irfpy.mima.massring

Calculate mass ring number from energy and mass.

The way of calculating the mass ring number from energy and mass is described in the MEXImaTables.pdf file. This module implements that.

rm(e_per_q, m_per_q, pi)

Return Rm.

dm(e_per_q, m_per_q, pi)

Return Dm.

massline(m_per_q, pi[, enestep])

Return the iso-mass contour.

Users may use rm() function to calculate the mass ring number from energy and mass together with PACC index. The mass ring number looks to have 0-based index. It may say that the range of mass ring number could be (-0.5, 31.5).

>>> print('{:.2f}'.format(rm(100, 32, 4)))     # Mass ring number for 100 eV/q, 32 amu/q particle with PACC=4.
10.34

dm() will give the width, although it is almost always 1.2.

Users also want to know the iso-mass line. This will be done by massline() function.

>>> energies, masses = massline(32, 7, enestep=np.logspace(1, 4, 96))
>>> print('{e:.2f} {m:.2f}'.format(e=energies[15], m=masses[15]))
29.76 7.84

See also the example in snippet_mima.mima_masscontour.

Details: The table contains the table needed for calculation. It is 8-element list, but only used for 0, 4, and 7th element. Each corresponds to the table for each PACC. The table is (5, 12) shaped. Contents is in _load_table6() function.

>>> print(table[0].shape)
(5, 12)
>>> print(table[3])
None
irfpy.mima.massring.table = [array([[ 0.000e+00,  3.000e+02,  2.000e+02,  0.000e+00,  1.913e+01,         -2.389e+00,  1.200e+00,  1.200e+00,  2.737e-01,  1.000e+00,         -5.000e+01,  1.000e+00],        [ 0.000e+00,  3.000e+02,  2.000e+02,  1.000e+00,  2.479e-01,          2.392e+00,  5.416e-16, -1.203e-16,  1.517e+00,  2.000e+00,         -5.000e+01,  2.000e+00],        [ 0.000e+00,  3.000e+02,  2.000e+02,  2.000e+00, -1.246e-02,         -2.307e-02, -2.604e-17, -4.879e-19, -7.909e-01,  1.700e+01,         -4.900e+00,  1.600e+01],        [ 0.000e+00,  3.000e+02,  2.000e+02,  3.000e+00,  0.000e+00,          0.000e+00,  0.000e+00,  0.000e+00,  0.000e+00,  2.800e+01,          0.000e+00,  3.200e+01],        [ 0.000e+00,  3.000e+02,  2.000e+02,  4.000e+00,  0.000e+00,          0.000e+00,  0.000e+00,  0.000e+00,  0.000e+00,  3.900e+01,          1.500e+00,  5.000e+01]]), None, None, None, array([[ 1.000e+00,  2.433e+03,  3.400e+02,  0.000e+00,  1.945e+01,         -3.707e+00,  1.200e+00,  1.200e+00,  1.067e-01,  1.000e+00,         -4.000e+01,  1.000e+00],        [ 1.000e+00,  2.433e+03,  3.400e+02,  1.000e+00, -1.134e+00,          2.117e+00, -2.996e-16,  8.844e-17,  1.957e+00,  2.000e+00,         -2.500e+01,  2.000e+00],        [ 1.000e+00,  2.433e+03,  3.400e+02,  2.000e+00,  8.625e-03,          1.202e-02,  1.765e-17, -1.240e-17, -9.828e-01,  1.700e+01,         -3.500e+00,  1.600e+01],        [ 1.000e+00,  2.433e+03,  3.400e+02,  3.000e+00,  0.000e+00,          0.000e+00,  0.000e+00,  0.000e+00,  0.000e+00,  2.600e+01,          0.000e+00,  3.200e+01],        [ 1.000e+00,  2.433e+03,  3.400e+02,  4.000e+00,  0.000e+00,          0.000e+00,  0.000e+00,  0.000e+00,  0.000e+00,  3.300e+01,          1.500e+00,  5.000e+01]]), None, None, array([[ 2.000e+00,  4.216e+03,  4.990e+02,  0.000e+00,  1.132e+01,         -1.500e+00,  1.200e+00,  1.200e+00,  3.594e-02,  1.000e+00,         -3.000e+01,  1.000e+00],        [ 2.000e+00,  4.216e+03,  4.990e+02,  1.000e+00, -4.321e-01,          1.647e+00, -1.451e-16,  4.208e-17,  3.741e-01,  1.800e+00,         -2.200e+01,  2.000e+00],        [ 2.000e+00,  4.216e+03,  4.990e+02,  2.000e+00,  1.041e-02,         -1.065e-02,  2.290e-17,  1.632e-17, -1.731e-01,  1.700e+01,         -3.600e+00,  1.600e+01],        [ 2.000e+00,  4.216e+03,  4.990e+02,  3.000e+00,  0.000e+00,          0.000e+00,  0.000e+00,  0.000e+00,  0.000e+00,  3.200e+01,          0.000e+00,  3.200e+01],        [ 2.000e+00,  4.216e+03,  4.990e+02,  4.000e+00,  0.000e+00,          0.000e+00,  0.000e+00,  0.000e+00,  0.000e+00,  4.500e+01,          1.500e+00,  5.000e+01]])]

Table for Mass Ring calculation.

An list of numpy array with a shape of (5,12). This is eight elements, each corresponds to PACC index.

>>> print(table[0].shape)
(5, 12)
>>> print(table[3])
None
irfpy.mima.massring.rm(e_per_q, m_per_q, pi)[source]

Return Rm.

>>> Rm = rm(1200, 12.8, 0)    # M/q = 12.8 for PACC=0
Parameters
  • e_per_q – Energy per charge (in eV/q)

  • m_per_q – Mass per charge (in amu/q)

  • pi – Pacc index, 0, 4 or 7.

Returns

Mass ring number.

>>> print('{:.2f}'.format(float(Rm)))
14.23
>>> Rm = rm(2400, 37.6, 4)    # M/q = 37.6 for PACC=4
>>> print('{:.2f}'.format(float(Rm)))
3.95
>>> Rm = rm(750, 3.75, 7)    # M/q = 3.75 for PACC=7
>>> print('{:.2f}'.format(float(Rm)))
20.23
>>> Rm = rm(100, 12.8, 0)    # M/q = 12.8 for PACC=0
>>> print('{:.2f}'.format(float(Rm)))
28.26
>>> Rm = rm(250, 37.6, 4)    # M/q = 37.6 for PACC=4
>>> print('{:.2f}'.format(float(Rm)))
10.82
>>> Rm = rm(350, 3.75, 7)    # M/q = 3.75 for PACC=7
>>> print('{:.2f}'.format(float(Rm)))
22.35
irfpy.mima.massring.massline(m_per_q, pi, enestep=None)[source]

Return the iso-mass contour.

For the given mass and post acceleration, the mass ring numbers as a function of energies are returned.

For normal data analysis, use central_mass_channel() function.

Parameters
  • m_per_q – Mass per charge (amu/q)

  • pi – Post acceleration index. 0, 4, or 7.

  • enestep – Energy step. Default is logspace(0, 4, 96).

Returns

(enestep, massring) with each element np.array with shape of given enestep.

irfpy.mima.massring.central_mass_channel(m_per_q, promsection, paccindex, fill_nan_invalid_energy=True)[source]

Return the central mass channel, Rm, for given PROM section and PACC index.

Parameters
  • m_per_q – Mass per charge in amu

  • promsection – PROM section, 0 to 16

  • paccindex – PACC index, 0 to 7

  • fill_nan – If True, the step for invalid energy step is filled by nan.

Returns

Central mass channel for given m_per_q. 96 steps corresponding to the energy table.

Return type

Tuple

>>> m1curve = central_mass_channel(1, 15, 4)    # Proton for prom=15 and pacc=4
>>> print(f'{m1curve[0]:.2f}')
12.92
>>> m16curve = central_mass_channel(32, 16, 4)    # OO+ for prom-16 and pacc=4
>>> print(f'{m16curve[30]:.2f}')
7.18
>>> print(m16curve[90])   # The non-valid energy step corresponds to nan
nan

If you do not want to fill nan for all the energy step,

>>> m16curve_float = central_mass_channel(32, 16, 4, fill_nan_invalid_energy=False) # Dont fill nan for any energy step
>>> print(f'{m16curve_float[90]:.2f}')   # Value shall be used with care!
9.44
irfpy.mima.massring.dm0(*args)[source]

Simple version of dm(). It just returns 1.2.

Parameters

args – Whatever.

Returns

1.2

irfpy.mima.massring.dm(e_per_q, m_per_q, pi)[source]

Return Dm.

Parameters
  • e_per_q – Energy per charge (in eV/q)

  • m_per_q – Mass per charge (in amu/q)

  • pi – Pacc index, 0, 4 or 7.

Returns

Mass ring number.

Dm is almost always 1.2 (as fitting parameters on Geff dependence is 1e-16 or less..). I wonder if there are some errors in the calibration document, I could not find them. So, a simple way to use dm is just use dm0(), which always returns 1.2.

>>> Dm = dm(1200, 12.8, 0)    # M/q = 12.8 for PACC=0
>>> print('{:.2f}'.format(float(Dm)))
1.20
>>> Dm = dm(2400, 37.6, 4)    # M/q = 37.6 for PACC=4
>>> print('{:.2f}'.format(float(Dm)))
1.20
>>> Dm = dm(750, 3.75, 7)    # M/q = 3.75 for PACC=7
>>> print('{:.2f}'.format(float(Dm)))
1.20
>>> Dm = dm(100, 12.8, 0)    # M/q = 12.8 for PACC=0
>>> print('{:.2f}'.format(float(Dm)))
1.20
>>> Dm = dm(250, 37.6, 4)    # M/q = 37.6 for PACC=4
>>> print('{:.2f}'.format(float(Dm)))
1.20
>>> Dm = dm(350, 3.75, 7)    # M/q = 3.75 for PACC=7
>>> print('{:.2f}'.format(float(Dm)))
1.20