irfpy.cena.energy
¶
Implementation of CENA energy.
Energy table
CENA energy table based on the calibration report Issue 1 Rev 1. Energy bin is generalized. There are 16 (TBC) energy settings in the sensor. Three energy tables are used.
Energy bin |
Table 1 |
Table 2 |
Table 3 |
---|---|---|---|
0 |
193 8 |
652 11 |
3300 15 |
1 |
129 7 |
435 10 |
2200 14 |
2 |
86 6 |
290 9 |
1467 13 |
3 |
57 5 |
193 8 |
978 12 |
4 |
38 4 |
129 7 |
652 11 |
5 |
25 3 |
86 6 |
435 10 |
6 |
17 2 |
57 5 |
290 9 |
7 |
11 1 |
38 4 |
193 8 |
The definition of the energy ranges are illustrated here.
One definition is the range between the boundaries of neighboring energy steps.
This is important for analysis to calculate the integral for example.
Another definition is defined by the range of the energy channel response, which
is also important for calibration, flux calculation, or error estimation.
In this module, the response range is distinguished by using Fwhm
in the method name.
Energy response
While we do not exactly know the energy response, the function is implemented
based on the Kazama 2006 report.
This is approximated by a triangle, whose shape changed according to the incoming
beam energy. See response_simulation()
for details.
- irfpy.cena.energy.getEnergyE16()[source]¶
Returns the list of the central energy in eV for each energy bin.
16-element energy in eV is returned as numpy.array instance.
>>> etbl = getEnergyE16() >>> print(len(etbl)) 16 >>> print(etbl[5]) 57.0
- irfpy.cena.energy.getEnergy(nr_table)[source]¶
Returns the list of the central energy in eV for each energy bin.
Corresponding energy bins (8) for the given table.
>>> etbl = getEnergy(1) >>> print(len(etbl)) 8 >>> print(etbl[6]) 17.0
>>> etbl = getEnergy(3) >>> print(etbl[1]) 2200.0
- irfpy.cena.energy.getRangeE16()[source]¶
Returns the range of the energy.
Bounds are the average (in multiplication domain) of the neighboring bins. Returned is 2x16 array.
>>> erng = getRangeE16() >>> print(erng.shape) (2, 16)
- irfpy.cena.energy.getDeltaE16()[source]¶
Return the dE of the energy. Using average of boundaries as dE.
- Returns
The ndarray of the dE.
- Return type
ndarray (shape=(16,))
See also
getFwhmDeltaE16()
.
- irfpy.cena.energy.getFwhmDeltaE16()[source]¶
Return the dE of the energy. Using FWHM as dE.
- Returns
The ndarray of the dE.
- Return type
ndarray (shape=(16,))
See also
getDeltaE16()
.
- irfpy.cena.energy.getBoundaryE16()[source]¶
Return the boundary of the energy steps. np.array with 17 element.
- irfpy.cena.energy.getRange(nr_table)[source]¶
Returns the list of the energy range for the given table.
Bounds are calculated by the average of the neighboring bins. See also getRangeE16() funciton.
Returned is 2x8 array.
>>> erng = getRange(2) >>> print(erng.shape) (2, 8) >>> print('%.1f' % erng[0, 3]) # Lower bound for the energy step 3 157.8 >>> print('%.1f' % erng[1, 3]) # Lower bound for the energy step 3 236.6
- irfpy.cena.energy.getFwhmRangeE16()[source]¶
Returns the list of the effective energy range of the given table.
Bounds are calculated from the FWHM (or effective) energy range. According to the calibration report, (0.6-1.6) x E.
Returned is 2x16 array
- irfpy.cena.energy.getFwhmRange(nr_table)[source]¶
Returns the list of the energy range for the given table.
Bounds are calculated by the average of the neighboring bins. See also getRangeE16() funciton.
Returned is 2x8 array
>>> erng = getFwhmRange(2) >>> print(erng.shape) (2, 8) >>> print('%.1f' % erng[0, 3]) # Lower bound for the energy step 3 115.8 >>> print('%.1f' % erng[1, 3]) # Lower bound for the energy step 3 308.8
- irfpy.cena.energy.step_function(x, n)[source]¶
A step function
- Parameters
x – Scalar or np.array.
n – Step function parameter.
- Returns
0 if x<n whereas 1 for x>=n.
- irfpy.cena.energy.response_simulation(incoming_energy, detecting_energies, normalize='peak')[source]¶
Energy response function derived from Kazama’s simulation.
According to Kazama [2006], the energy response may be well fitted by triangle, while there may be a high energy tail.
- Parameters
incoming_energy – Incoming particle energy in
eV
detecting_energies (
iterable
orfloat
) – Energies to detect.normalize – Way of normalize. “peak” or “integral”.
- Returns
The energy response. Normalized (thus this is relative). The maximum of the response is set to 1 (``normalize``==”peak”) or the integral over the energy (in eV) is set to 1 (``normalize``==”integral”).
See also the script in
cena_energy_resolution_kazama
.For example, beam energy 25 eV is examined.
The response is maximum (=1) at 25 eV detecting energy >>> print(response_simulation(25, 25)) 1.0
The response falls down if it goes down to 12.5 eV or up to 63 eV. >>> print(response_simulation(25, [12.5, 63.])) [0. 0.]
The response is about half at 18.75 eV and 44. eV. >>> print(‘%.2f’ % response_simulation(25, 18.75)) 0.50 >>> print(‘%.2f’ % response_simulation(25, 44.)) 0.49
If you normalize by the
integral
, the integral response in energy in eV should be 1.>>> e = np.array([12.5, 18.75, 25., 44., 63.]) >>> r = response_simulation(25, e, normalize='integral') >>> print('%.4f %.4f %.4f %.4f %.4f' % (r[0], r[1], r[2], r[3], r[4])) 0.0000 0.0200 0.0400 0.0197 0.0000
Numerical integral to be roughly 1.
>>> print('%.2f' % ( ... r[1] * (e[2]-e[0])/2. + r[2] * (e[3]-e[1])/2. + r[3] * (e[4]-e[2])/2.)) 1.00