imap_processing.idex.idex_l2a.time_to_mass#

imap_processing.idex.idex_l2a.time_to_mass(tof_high: ndarray, high_sampling_time: ndarray, masses: ndarray) tuple[ndarray[tuple[int, ...], dtype[_ScalarType_co]], ndarray[tuple[int, ...], dtype[_ScalarType_co]], ndarray[tuple[int, ...], dtype[_ScalarType_co]]]#

Calculate a mass scale for each TOF array in ‘TOF_high’.

  1. Make a vector with all zeros and a length of 8189, same as the TOF length: t_i

  2. Calculate the times when each input mass should appear in the TOF data: t_calc

    for each mass, calculate a time using this formula:

    t_calc = t_offset + stretch_factor*sqrt(mass)

    t_offset is the time offset (ns) stretch factor (ns)

    Then and set the value at the index of t_i that is closest to each of the t_calcs to 1, the rest stay zero.

  3. Calculate the cross-correlation with the original TOF.

    The max will give you the best lag (t_offset) for a given stretch_factor.

  4. Choose the stretch_factor that has the highest correlation

Parameters:
  • tof_high (numpy.ndarray) – The time of flight array for one dust event. Shape is (epoch, high_time_sample_rate).

  • high_sampling_time (numpy.ndarray) – The high sampling time array for one dust event. Shape is (epoch, high_time_sample_rate).

  • masses (np.ndarray) – Array of known masses of ions. Shape is (21,).

Returns:

  • numpy.ndarray – Best stretch value per event(adjusts scale).

  • numpy.ndarray – Best shift value per event (shifts scale left or right).

  • numpy.ndarray – Estimated mass for each time per event (after the time has been aligned using the best t_offset and stretch_factor).