irfpy.mima.energy

Energy table for MEX/IMA

Energy table for VEX/IMA can be obtained by a function

See the description in get_default_table_for() to read the data and the energy table.

Energy table, patch, and version.

Patch ver

p0

p1

p2

p3

p4

Patch date

020412

060520

090625

130220

130909

Section

HK

HK

PROM

0

0

+T0

T0

T0

T0

T0

EEPROM0

1

1

T0

+*T1*

T1

T1

T1

EEPROM1

2

2

T0

T1

T1

T1

T1

EEPROM2

3

3

T0

T1

T1

T1

T1

EEPROM3

4

4

T0

T1

T1

T1

T1

EEPROM4

5

5

T0

T1

T1

T1

T1

EEPROM5

6

6

T0

T1

T1

T1

T1

EEPROM6

7

7

T0

T1

T1

T1

T1

EEPROM7

8

8

T0

T1

T1

T1

T1

EEPROM8

9

9

T0

T1

T1

T1

T1

EEPROM9

10

a

T0

T1

T1

T1

T1

EEPROM10

11

b

T0

T1

T1

T1

T1

EEPROM11

12

c

T0

T1

T1

T1

T1

EEPROM12

13

d

T0

T1

T1

T1

T1

EEPROM13

14

e

T0

T1

T1

T1

T3

For fast-mode

EEPROM14

15

f

T0

T1

T1

T2

T2

For auto-reduction

EEPROM15

16

10

T0

T1

+*T2*

+T2

+T2

For IMAextra, ETableN entry of data dictionary gives the information of energy table. Users can use the function get_default_table_extra() to choose the energy table.

IMAEXTRA

PROM/EEPROM

Version

0

0

v4

1

1

v5

2

15, 16

v5late

3? (TBC)

14

v6

See https://sspt-wiki.irf.se/doku.php?id=sspt:imaenergytable for details.

Negative energy

Some of the default table contains negative energy, which should be invalid. For normal data analysis, those values shall be disregarded. In this case, you can use, for example,

>>> tbl = get_default_table_v5_late()
>>> print(tbl[95])
-20.0
>>> tbl[tbl < 0] = np.nan
>>> print(tbl[95])
nan

For some specific purposes, irfpy support to change this feature, namely, the negative values are converted to arbitrary positive values.

>>> tbl = get_default_table_v5_late(keep_negative=False)
>>> tbl[95]    # This is an arbitrary positive value.
1e-10
irfpy.mima.energy.get_default_table_for(imadata, keep_negative=True)[source]

Get the energy table for MEX/IMA

Parameters
  • imadata – Data of MEX/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 peraparation is eneded.

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

Then, you get the data.

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

Now, you can get the IMA energy table.

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

Different time uses different energy table.

>>> t0 = datetime.datetime(2008, 10, 5, 4, 0, 0)
>>> t, ima3d = dc.nextof(t0)
>>> etbl = get_default_table_for(ima3d)
>>> print(etbl[0])
25001.5
>>> t0 = datetime.datetime(2012, 10, 5, 4, 0, 0)
>>> t, ima3d = dc.nextof(t0)
>>> etbl = get_default_table_for(ima3d)
>>> print(etbl[0])
15005.6
irfpy.mima.energy.get_default_table_extra(etablen, keep_negative=True)[source]

Get the default energy table for MEX/IMA used for IMAEXTRA

Parameters
  • etablen – ETableN

  • 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.

Limitation is that we only support 0, 1, and 2.

irfpy.mima.energy.get_default_table(promsection, keep_negative=True)[source]

Get the default energy table for MEX/IMA.

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.

>>> etbl0 = get_default_table(0)
>>> print(etbl0[0])
32288.7
>>> etbl1 = get_default_table(1)
>>> print(etbl1[0])
25001.5
>>> etbl14 = get_default_table(14)
>>> print(etbl14[0])
4000.0
>>> etbl15 = get_default_table(15)
>>> print(etbl15[0])
15005.6
>>> etbl16 = get_default_table(16)
>>> print(etbl16[0])
15005.6
irfpy.mima.energy.get_default_table_v4(negative=None, keep_negative=True)[source]

Return the default table (v4).

Parameters
  • negative – (OBSOLETE) Alias to keep_negative. By historical reason, negative is prioritized than keep_negative but should use keep_negative for future.

  • keep_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.

irfpy.mima.energy.get_default_table_v5(negative=None, keep_negative=True)[source]

Return the default table (v5).

Parameters
  • negative – (OBSOLETE) Alias to keep_negative. By historical reason, negative is prioritized than keep_negative but should use keep_negative for future.

  • keep_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.

irfpy.mima.energy.get_default_table_v5_late(negative=None, keep_negative=True)[source]

Return the default table (yet another v5).

Parameters
  • negative – (OBSOLETE) Alias to keep_negative. By historical reason, negative is prioritized than keep_negative but should use keep_negative for future.

  • keep_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.

>>> tbl = get_default_table_v5_late()
>>> print(tbl.shape)
(96,)
>>> print(tbl[-1])
-20.0
>>> tbl2 = get_default_table_v5_late(negative=False)
>>> print(tbl2.shape)
(96,)
>>> print(tbl2[-1])
1e-10
irfpy.mima.energy.get_default_table_v6(negative=None, keep_negative=True)[source]

Return the default table for the v6, the 24s fast scan.

Parameters
  • negative – (OBSOLETE) Alias to keep_negative. By historical reason, negative is prioritized than keep_negative but should use keep_negative for future.

  • keep_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_v6()
>>> print(etbl.shape)
(96,)
>>> print(etbl[0])
4000.0
irfpy.mima.energy.get_default_table_v6_squashed(negative=None, keep_negative=True)[source]

Get the default table for v6, the 24s fast scan, with 32 energy steps.

Parameters
  • negative – (OBSOLETE) Alias to keep_negative. By historical reason, negative is prioritized than keep_negative but should use keep_negative for future.

  • keep_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.

  • invalidstep – Either keep, replace, or nan.

Returns

Energy table in eV/q. 32 elements.