padre_meddea.spectrum.calibration#
Tools to analyze and calibrate spectral data
Functions
|
Given an uncalibrated PhotonList and a complete set of linear calibration parameters produced by calibrate_phlist_barium_linear, apply the calibration to the PhotonList. |
|
Given an uncalibrated SpectrumList and a complete set of linear calibration parameters produced by calibrate_phlist_barium_linear, apply the calibration to the PhotonList. |
|
Given a PhotonList of a Ba-133 spectrum, perform a linear energy calibration for all detectors and pixels. |
|
Given a PhotonList of a Ba-133 spectrum, perform a linear energy calibration for all detectors and pixels. |
|
Given a spectral region with a single line, fit a parabola to the peak and return the position of the maximum |
|
Given a spectrum and a set of approximate peak or line centers, perform a fit for each and return the fitted peak location for each. |
|
Given a full range Ba-133 spectrum, return a rough linear calibration function by finding and fitting only the two strongest lines (30.85 keV, 81 keV). |
|
Given a time return a quicklook calibration file. |
- padre_meddea.spectrum.calibration.calibrate_linear_phlist(ph_list: PhotonList, lin_cal_params: array) PhotonList[source]#
Given an uncalibrated PhotonList and a complete set of linear calibration parameters produced by calibrate_phlist_barium_linear, apply the calibration to the PhotonList. Adds a new energy column.
Paramters#
Uncalibrated PhotonList
Linear calibration parameter array
- returns:
calibrated PhotonList
- padre_meddea.spectrum.calibration.calibrate_linear_speclist(spec_list: SpectrumList, lin_cal_params: ndarray, spectral_axis: ndarray | None = None) SpectrumList[source]#
Given an uncalibrated SpectrumList and a complete set of linear calibration parameters produced by calibrate_phlist_barium_linear, apply the calibration to the PhotonList. Adds a new energy column.
- Parameters:
spec_list (SpectrumList) – Uncalibrated SpectrumList
lin_cal_params (np.ndarray) – Linear calibration parameter array
spectral_axis (np.ndarray) – The new energy axis to interpolate the spectra onto.
- Returns:
calibrated SpectrumList
- padre_meddea.spectrum.calibration.calibrate_phlist_barium_linear(ph_list: PhotonList, plot: bool = False)[source]#
Given a PhotonList of a Ba-133 spectrum, perform a linear energy calibration for all detectors and pixels.
- Parameters:
ph_list (PhotonList)
- Returns:
lin_cal_params[num_asics,num_pixels,2] – An array of linear calibration values for each pixel.
- padre_meddea.spectrum.calibration.calibrate_speclist_barium_linear(spec_list: SpectrumList, plot: bool = False)[source]#
Given a PhotonList of a Ba-133 spectrum, perform a linear energy calibration for all detectors and pixels.
- Parameters:
ph_list (PhotonList)
- Returns:
lin_cal_params[num_asics,num_pixels,2] – An array of linear calibration values for each pixel.
- padre_meddea.spectrum.calibration.fit_peak_parabola(spec: Spectrum1D) float[source]#
Given a spectral region with a single line, fit a parabola to the peak and return the position of the maximum
- Parameters:
spec (Spectrum1D)
- Returns:
peak_center (float)
- padre_meddea.spectrum.calibration.fit_peaks(spec: Spectrum1D, line_centers: Quantity, plot: bool = False, fit_func='parabola', window=30) Quantity[source]#
Given a spectrum and a set of approximate peak or line centers, perform a fit for each and return the fitted peak location for each.
- Parameters:
spec (Spectrum1D) – The input spectrum
line_centers (u.Quantity) – The approximate location of the line peaks
plot (bool) – If True, then plot the data and fit for each line center region.
fit_func (str) – The fit function for finding the peak value.
window (int) – Number of points to consider around the line center
- Returns:
fit_centers
- padre_meddea.spectrum.calibration.get_calfunc_barium_rough(spec: Spectrum1D, plot: bool = False)[source]#
Given a full range Ba-133 spectrum, return a rough linear calibration function by finding and fitting only the two strongest lines (30.85 keV, 81 keV). It does this by splitting the spectrum into two regions and finding the maximum value in those regions. The saturated values at high energies are ignored.
- Parameters:
spec (Spectrum1D) – The Ba-133 spectrum
plot (bool) – If True, then display a plot of the spectrum with the line peaks found.
- Returns:
np.poly1d linear fit