imap_processing.idex.idex_l2a.fit_emg#
- imap_processing.idex.idex_l2a.fit_emg(peak_time: ndarray, peak_signal: ndarray, event_num: int) tuple[ndarray[tuple[int, ...], dtype[_ScalarType_co]], float, float]#
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 (numpy.ndarray) – Fitted EMG optimal values for the parameters (popt) [k (shape parameter), mu, sigma] if fit is successful, array of np.nans otherwise.
chisqr (float) – Chi-square value if fit is successful, np.nan otherwise.
redchi (float) – Reduced chi-square value if fit is successful, np.nan otherwise.