FitMixin¶
-
class
cait.mixins.FitMixin[source]¶ Bases:
objectA Mixin Class to the DataHandler Class with methods for the calculation of fits.
-
apply_sev_fit(type='events', only_channels=None, sample_length=None, down=1, order_bl_polynomial=3, t0_bounds=(- 20, 20), truncation_level=None, interval_restriction_factor=None, verb=False, processes=4, name_appendix='', group_name_appendix='', first_channel_dominant=False, use_saturation=False)[source]¶ Calculates the SEV fit for all events of type (events or tp) and stores in HDF5 file. The stored parameters are (pulse_height, onset_in_ms, bl_offset, bl_linear_coeffiient, quadratic, cubic).
This method was described in “F. Reindl, Exploring Light Dark Matter With CRESST-II Low-Threshold Detector”, available via http://mediatum.ub.tum.de/?id=1294132 (accessed on the 9.7.2021).
- Parameters
type (string) – Name of the group in the HDF5 set, either events or testpulses.
only_channels (list of ints) – Only these channels are fitted, the others are left as is or filled with zeros.
order_bl_polynomial (int) – Either 0,1,2 or 3 - the order of the polynomial assumed for baseline.
sample_length (float) – The length of a sample in milliseconds. If None, this is calculated from the sample frequency.
down (int) – The downsample factor for the fit, has to be a power of 2.
t0_bounds (2-tuple of ints) – The lower and upper bounds in milliseconds for the onset position.
truncation_level (list of nmbr_channel floats) – The pulse height Volt value at that the detector saturation starts.
interval_restriction_factor (2-tuple of ints) – Indices not inside this interval are ignored from the fit.
verb (bool) – Verbal feedback about the progress.
processes (int) – The number of workers for the fit.
name_appendix (string) – This gets appendend to the dataset name in the HDF5 set.
group_name_appendix (string) – This is appendend to the group name of the stdevent in the HDF5 set.
first_channel_dominant (bool) – Take the peak position from the first channel and evaluate the others at the same position.
-
calc_bl_coefficients(type='noise', down=1)[source]¶ Calcualted the fit coefficients with a cubic polynomial on the noise baselines.
- Parameters
type (string) – The group name in the HDF5 set, should be noise.
down (int) – The baselines are downsampled by this factor before the fit.
-
calc_parametric_fit(path_h5=None, type='events', processes=4)[source]¶ Calculate the Parameteric Fit for the Events in an HDF5 File.
This methods was described in “(1995) F. Pröbst et. al., Model for cryogenic particle detectors with superconducting phase transition thermometers.”
- Parameters
path_h5 (string) – Optional, the full path to the hdf5 file, e.g. “data/bck_001.h5”.
type (string) – Either events or testpulses.
processes (int) – The number of processes to use for the calculation.
-
calc_saturation(channel=0, only_idx=None)[source]¶ Fit a logistics curve to the testpulse amplitudes vs their pulse heights.
This method was used to describe the detector saturation in “M. Stahlberg, Probing low-mass dark matter with CRESST-III : data analysis and first results”, available via https://doi.org/10.34726/hss.2021.45935 (accessed on the 9.7.2021).
- Parameters
channel (int) – The channel for that we calculate the saturation.
only_idx (list of ints) – Only these indices are used in the fit of the saturation.
-
estimate_trigger_threshold(channel, detector_mass, allowed_noise_triggers=1, sigma_x0=2, method='of', bins=200, yran=None, xran=None, xran_hist=None, ul=30, ll=0, cut_flag=None, plot=True, title=None, sample_length=None, record_length=None, interval_restriction=0.75, binned_fit=False, model='gauss', ylog=False, save_path=None)[source]¶ Estimate the trigger threshold to obtain a given number of noise triggers per exposure.
The method assumes a Gaussian sample distribution of the noise, following “A method to define the energy threshold depending on noise level for rare event searches” (arXiv:1711.11459). There are multiple extensions implemented, that descibe additional Gaussian mixture or non-Gaussian components. A more extensive description can be found in the corresponding tutorial.
- Parameters
channel (int) – The number of the channel for that we estimate the noise trigger threshold.
detector_mass (float) – The mass of the detector in kg.
allowed_noise_triggers (float) – The number of noise triggers that are allowed per kg day exposure.
sigma_x0 (float) – A start value for the baseline resolution. Is only used for the unbinned fit.
method (string) – Either ‘of’ for estimating the noise triggers after optimal filtering or ‘ph’ for taking the maximum value of the raw data.
bins (int) – The number of bins for the histogram plots.
yran (tuple of two floats) – The range of the y axis on both plots.
xran (tuple of two floats) – The range of the x axis on the noise trigger estimation plot.
xran_hist (tuple of two floats) – The range of the x axis on the histogram plot.
ul (float) – The upper limit of the interval that is used to search a threshold, in mV.
ll (float) – The lower limit of the interval that is used to search a threshold, in mV.
cut_flag (list of bool) – A list of boolean values that determine which events are excluded from the calculation.
plot (bool) – If True, a plot of the fit and the noise trigger estimation are shown.
title (string) – A title for both plots.
sample_length (float) – The length of a sample in seconds. If None, it is calculated from the sample frequency.
record_length (int) – The number of samples within a record window.
interval_restriction –
binned_fit (bool) – Not recommended. If chosen, the model is fit with least squared to the histogram. Otherwise an unbinned likelihood fit is performed.
model (string) – Determine which model is fit to the noise. - ‘gauss’: Model of purely Gaussian noise. - ‘pollution_exponential’: Model of Gaussian noise with one exponentially distributed sample on each baseline. - ‘fraction_exponential’: Mixture model of Gaussian and exponentially distributed noise. - ‘pollution_gauss’: Model of Gaussian noise and one sample in each baseline that follows another, also Gaussian distribution. - ‘fraction_gauss’: Mixture model of two Gaussian noise components.
ylog (bool) – If set, the y axis is plotted logarithmically on the histogram plot.
save_path (string) – A path to save the plots.
-