Analysis Functions for Fitting
Function to perform fitting of the spectra.
- analysis.fitting.append_dict(cal_dict, e0, popt, pcov)
Function to append the calibration parameters to the calibration dictionary.
- analysis.fitting.chi2_red(y, yfit, sigma, dof)
Calculates the reduced chi squared. Returns a float.
- analysis.fitting.do_double_gaussian_fit(peak_dict, tot, counts, counts_err, element, i)
Function to fit a double peak in the spectrium. Returns the parameters and the covariance matrix, and the mask of the data used for the fit.
- analysis.fitting.do_single_gaussian_fit(peak_dict, tot, counts, counts_err, element, i)
Function to fit a single peak in the spectrium. Returns the parameters and the covariance matrix, and the mask of the data used for the fit.
- analysis.fitting.fit_all(element, events, peak_dict)
Function to fit all peaks in the spectrum specified in the peak_dict. Returns the calibration dictionary.
- analysis.fitting.fit_double_gaussian(tot, counts, counts_err, mask, mask1, mask2)
Function to fit a double peak of a part of the spectrum. Returns the parameters and the covariance matrix, and the mask of the data used for the fit.
- analysis.fitting.fit_gaussian(tot, counts, counts_err, mask)
Function to fit a single peak of a part of the spectrum. Returns the parameters and the covariance matrix, and the mask of the data used for the fit.
- analysis.fitting.label_double_gaussian(e01, e02, popt, pcov)
Creates a label for the fitted double gaussian. Returns a string.
- analysis.fitting.label_gaussian(e0, popt, pcov)
Creates a label for the fitted gaussian. Returns a string.
- analysis.fitting.load_events(date, dir_list)
Loads the events from a list of directories and returns a dictionary with the events.
- analysis.fitting.load_single_event(dir, key, events)
Loads a single event from a file and plots the spectrum.
- analysis.fitting.plot_average(ax, events, title, n, i)
Plots the average of the events with a moving average of n bins.
- analysis.fitting.plot_error(ax, events, title)
Plots the counts with errorbars.
- analysis.fitting.plot_fit(element, events, peak_dict)
Function to plot the spectrum with the fitted peaks.
- analysis.fitting.plot_raw_spectrum(ax, element, events, tot=False)
Plots the raw spectrum of the element.
- analysis.fitting.plot_single_fit(element, events, peak_dict, energy_index)
Plots the fit of a single peak.
- Parameters:
element (str) – Element to be fitted.
events (dict) – Dictionary of events.
peak_dict (dict) – Dictionary of peaks.
energy_index (int) – Index of the energy to be fitted.