irfpy.vima.energy

Energy table for VEX/IMA.

Energy table for VEX/IMA can be obtained by a function get_default_table_for(). See the description in get_default_table_for() to read the data and the energy table.

If you know PROM/EEPROM index, you can refer to get_default_table() function.

Warning

It is known that the energy table has been swapped for the version before 4.1.1a3. At the release of v4.2.0, the energy table has been fixed.

irfpy.vima.energy.get_default_table_for(imadata, keep_negative=True)[source]

Get the energy table for VEX/IMA

Parameters
  • imadata – Data of VEX/IMA. irfpy.imacommon.imascipac.CntMatrix object is expected.

  • keep_negative – If True (default), negative energy is kept as is. Thus, the returned table will contain negative energy. If False, the negative values are proxied by a very small positive energy, in order to confirm the returned array always positive.

Returns

The energy table in eV/q. (96) shape.

Example of getting the energy table:

First, to get the IMA data, a preparation is needed.

>>> import datetime
>>> from irfpy.vima.rawdata import DataCenterCount3d
>>> dc = DataCenterCount3d()

Then, we get the data.

>>> t0 = datetime.datetime(2008, 10, 5, 7, 30)
>>> t, ima3d = dc.nextof(t0)    # ima3d is an object of irfpy.imacommon.imascipac.CntMatrix
>>> print(t)
2008-10-05 07:30:11.709940
>>> print(ima3d)
<<class 'irfpy.imacommon.imascipac.CntMatrix'>(VEX/IMA)@2008-10-05T07:30:11.709940:MOD=24 >>25<<:CNTmax=368>

Now, you can get the IMA energy table.

>>> etbl = get_default_table_for(ima3d)     # Getting the energy table
>>> print(etbl[0])    # Highest energy
29999.9

For the later part of the mission, another energy table was used.

>>> t0 = datetime.datetime(2012, 10, 5, 4, 0, 0)
>>> t, ima3d = dc.nextof(t0)
>>> etbl = get_default_table_for(ima3d)     # Getting the energy table
>>> print(etbl[0])    # Highest energy
20003.6
irfpy.vima.energy.get_default_table(promsection, keep_negative=True)[source]

Get the default energy table for VEX/IMA.

Since the energy table is defined by PROM/EEPROM index, this function requires that index as argument.

Parameters
  • promsection – PROM/EEPROM section. This defines the energy / elevation table.

  • keep_negative – If True (default), negative energy is kept as is. Thus, the returned table will contain negative energy. If False, the negative values are proxied by a very small positive energy, in order to confirm the returned array always positive.

Returns

The energy table in eV/q. (96) shape.

The PROM/EEPROM index can be obtained from the HK in the IMA dataset. If you have an object of irfpy.imacommon.imascipac.CntMatrix, the index is accessible via

print(ima3d.hk.promsection)     # ima3d is an object of ``CntMatrix``.
irfpy.vima.energy.get_default_table_v1(negative=True)[source]

Return the default energy table (V1)

Parameters

negative – If True, negative energy is considered as valid (default). If False, negative energy is proxied by a very small positive energy, in order to confirm the returned array always positive. NB: The v1 default table does not include negative energy so that this switch does not influence the returned array.

Returns

Energy table in eV/q. 96 elements.

>>> etbl = get_default_table_v1()
>>> print(etbl.shape)
(96,)
irfpy.vima.energy.get_default_table_v3(negative=True)[source]

Return the default energy table (V3)

Parameters

negative – If True, negative energy is considered as valid (default). If False, negative energy is proxied by a very small positive energy, in order to confirm the returned array always positive.

Returns

Energy table in eV/q. 96 elements.

>>> etbl = get_default_table_v3()
>>> print(etbl.shape)
(96,)
>>> print(etbl[-4])     # Last 6 energies are indeed negative or zero.
-4.0
>>> etbl2 = get_default_table_v3(negative=False)
>>> print(etbl2.shape)
(96,)
>>> print('{:.3e}'.format(etbl2[-4]))    # Being negative=False given, the first 6 steps also gives positive value.
9.687e-09