imap_processing.idex.idex_l2a.fit_emg#

imap_processing.idex.idex_l2a.fit_emg(peak_time: ndarray, peak_signal: ndarray, event_num: int) ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None#

Fit an exponentially modified gaussian function to the peak signal.

Scipy.stats.exponnorm.pdf uses parameters shape (k), location (mu), and scale (sigma) where k = 1/(sigma*lambda) with lambda being the exponential decay rate.

Parameters:
  • peak_time (numpy.ndarray) – TOF high +5 and -5 samples around peak.

  • peak_signal (numpy.ndarray) – High sampling time array at +5 and -5 samples around peak.

  • event_num (int) – Dust event number (for debugging purposes).

Returns:

param – Fitted EMG optimal values for the parameters (popt) [k (shape parameter), mu, sigma] if fit successful, None otherwise.

Return type:

numpy.ndarray or None