irfpy.vels.energy

ELS energy module.

ELS energy module used for scientific works.

Difference with bible

irfpy.vels.bible.energy also provides energy module for VEX/ELS. The irfpy.vels.bible.energy module provides usually lower level access, so it is recommended to use this module for ordinary use.

Warning

Energy of ELS data is not simple. Strictly speaking, it is anode dependent and time dependent.

However, one may want to use energy table as simple as possible, especially for “loose” analysis or quick look implementation.

The functions including “default” returns such energy table. Approach is using calibration (or reference) values of HV setting together with median of anode.

If one want to refer to the time-dependent monitor value of HV setting for energy calculation, you must use irfpy.vels.scidata.ElsCountData.get_energy().

irfpy.vels.energy.get_default_table_128(fill_flyback=nan)[source]

Return a default energy step for E128 mode.

Parameters

fill_flyback – Normally highest energy index should not be used because this is the flyback channel. This keyword can set what value is filled in the highest energy index.

Returns

Energy table. Index=0 is highest energy.

Return type

np.MaskedArray

Note

If you want the flyback energy, you may use fill_flyback=0.8.

Note that the index order of energy table is opposite from the implementation of irfpy.vels.bible.energy. In this method low index is high energy.

>>> etbl = get_default_table_128()
>>> print(etbl.shape)
(128,)
>>> print('%.1f' % etbl[0])
30495.6
>>> print(etbl[127])
nan
irfpy.vels.energy.get_default_bound_128()[source]

Return the energy bounds.

The default 128 step energy bounds are returned. This is easily used for pcolormesh routines.

Returns

Energy bounds. (129,) array.

>>> ebounds = get_default_bound_128()
>>> print(ebounds.shape)
(129,)
>>> print('{:.2f}'.format(ebounds[0]))
31562.97
irfpy.vels.energy.get_default_range_128()[source]

Return the energy range for E128 mode.

The energy range is returned as 2x128 array. The bounds are defined by the log-average between the neighboring bins.

Returns

Energy range as 2x128 array. [0, :] is for the lower energy and [1, :] is for the higher energy. Float values are returned for the last energy steps. This should be masked by user later.

Return type

ndarray with shape of (2, 128)

>>> erange = get_default_range_32_as_128()
>>> print(erange.shape)
(2, 128)
irfpy.vels.energy.get_default_table_32(fill_flyback=nan)[source]

Return a default energy step for E32 mode.

See also get_default_table_128() function.

>>> etbl = get_default_table_32()
>>> print(etbl.shape)
(32,)
>>> print('%.1f' % etbl[0])
239.4
>>> print(etbl[31])
nan
irfpy.vels.energy.get_default_bound_32()[source]

Return the energy bounds.

The default 32 step energy bounds are returned. This is easily used for pcolormesh routines.

Returns

Energy bounds. (33,) array.

>>> ebounds = get_default_bound_32()
>>> print(ebounds.shape)
(33,)
>>> print('{:.2f}'.format(ebounds[0]))
247.78
irfpy.vels.energy.get_default_range_32()[source]

Return the energy range for E32 mode.

The energy range is returned as 2x32 array. The bounds are defined by the log-average between the neighboring bins.

Returns

Energy range as 2x32 array. [0, :] is for the lower energy and [1, :] is for the higher energy. Float values are returned for the last energy steps. This should be masked by user later.

Return type

ndarray with shape of (2, 32)

>>> erange = get_default_range_32()
>>> print(erange.shape)
(2, 32)
irfpy.vels.energy.get_default_table_32_as_128(fill_flyback=nan)[source]

Return a defaut energy step for E32 mode, but in 128 element.

The energy value is for 32 energy mode, but returns (128,) element array. The save values are repeated 4 times.

See also get_default_table_32().

>>> etbl = get_default_table_32_as_128()
>>> print(etbl.shape)
(128,)
>>> print('%.1f' % etbl[0])
239.4
>>> print(etbl[31])
nan
>>> print('%.1f' % etbl[64])
239.4
>>> print(etbl[127])
nan
irfpy.vels.energy.get_default_range_32_as_128()[source]

Return a default energy range for E32 mode but in 128 element.

See also get_default_range_32().

>>> erange = get_default_range_32_as_128()
>>> print(erange.shape)
(2, 128)
irfpy.vels.energy.doctests()[source]