qetpy.cut package¶
-
qetpy.cut._cut.
removeoutliers
(x, maxiter=20, skewtarget=0.05)¶ Function to return indices of inlying points, removing points by minimizing the skewness
Parameters: - x : ndarray
Array of real-valued variables from which to remove outliers.
- maxiter : float, optional
Maximum number of iterations to continue to minimize skewness. Default is 20.
- skewtarget : float, optional
Desired residual skewness of distribution. Default is 0.05.
Returns: - inds : ndarray
Boolean indices indicating which values to select/reject, same length as x.
-
qetpy.cut._cut.
iterstat
(data, cut=3, precision=1000.0)¶ Function to iteratively remove outliers based on how many standard deviations they are from the mean, where the mean and standard deviation are recalculated after each cut.
Parameters: - data : ndarray
Array of data that we want to remove outliers from
- cut : float, optional
Number of standard deviations from the mean to be used for outlier rejection
- precision : float, optional
Threshold for change in mean or standard deviation such that we stop iterating. The threshold is determined by np.std(data)/precision. This means that a higher number for precision means a lower threshold (i.e. more iterations).
Returns: - datamean : float
Mean of the data after outliers have been removed.
- datastd : float
Standard deviation of the data after outliers have been removed
- datamask : ndarray
Boolean array indicating which values to keep or reject in data, same length as data.
-
qetpy.cut._cut.
autocuts
(traces, fs=625000.0, is_didv=False, sgfreq=200.0, symmetrizeflag=False, outlieralgo='removeoutliers', lgcpileup1=True, lgcslope=True, lgcbaseline=True, lgcpileup2=True, lgcchi2=True, nsigpileup1=2, nsigslope=2, nsigbaseline=2, nsigpileup2=2, nsigchi2=3)¶ Function to automatically cut out bad traces based on the optimum filter amplitude, slope, baseline, and chi^2 of the traces.
Parameters: - traces : ndarray
2-dimensional array of traces to do cuts on
- fs : float, optional
Sample rate that the data was taken at
- is_didv : bool, optional
Boolean flag on whether or not the trace is a dIdV curve
- sgfreq : float, optional
If is_didv is True, then the sgfreq is used to know where the flat parts of the traces should be
- symmetrizeflag : bool, optional
Flag for whether or not the slopes should be forced to have an average value of zero. Should be used if most of the traces have a slope
- outlieralgo : string, optional
Which outlier algorithm to use. If set to “removeoutliers”, uses the removeoutliers algorithm that removes data based on the skewness of the dataset. If set to “iterstat”, uses the iterstat algorithm to remove data based on being outside a certain number of standard deviations from the mean
- lgcpileup1 : boolean, optional
Boolean value on whether or not do the pileup1 cut (this is the initial pileup cut that is always done whether or not we have dIdV data). Default is True.
- lgcslope : boolean, optional
Boolean value on whether or not do the slope cut. Default is True.
- lgcbaseline : boolean, optional
Boolean value on whether or not do the baseline cut. Default is True.
- lgcpileup2 : boolean, optional
Boolean value on whether or not do the pileup2 cut (this cut is only done when is_didv is also True). Default is True.
- lgcchi2 : boolean, optional
Boolean value on whether or not do the chi2 cut. Default is True.
- nsigpileup1 : float, optional
If outlieralgo is “iterstat”, this can be used to tune the number of standard deviations from the mean to cut outliers from the data when using iterstat on the optimum filter amplitudes. Default is 2.
- nsigslope : float, optional
If outlieralgo is “iterstat”, this can be used to tune the number of standard deviations from the mean to cut outliers from the data when using iterstat on the slopes. Default is 2.
- nsigbaseline : float, optional
If outlieralgo is “iterstat”, this can be used to tune the number of standard deviations from the mean to cut outliers from the data when using iterstat on the baselines. Default is 2.
- nsigpileup2 : float, optional
If outlieralgo is “iterstat”, this can be used to tune the number of standard deviations from the mean to cut outliers from the data when using iterstat on the optimum filter amplitudes after the mean has been subtracted. (only used if is_didv is True). Default is 2.
- nsigchi2 : float, optional
This can be used to tune the number of standard deviations from the mean to cut outliers from the data when using iterstat on the chi^2 values. Default is 3. This is always used, as iterstat is always used for the chi^2 cut.
Returns: - ctot : ndarray
Boolean array giving which indices to keep or throw out based on the autocuts algorithm
-
qetpy.cut._cut.
get_muon_cut
(traces, thresh_pct=0.95, nsatbins=600)¶ Function to help identify saturated muons from array of time series traces.
*Traces must have POSITIVE going pulses*
Note, for best results, only large amplitude traces should based to this function. The user may need to play around with the thresh_pct and nsatbins parameters to achive the desired result.
Parameters: - traces: array
Array of time series traces of shape (#number of traces, #bins per trace).
- thresh_pct: float, optional
The percentage of the maximum amplitude that the pulse must remain above for nsatbins in order to be considered `saturated’.
- nsatbins: int, optional
The minimum number of bins that a muon should be saturated for.
Returns: - muon_cut: array
Boolean array corresponding to saturated muon events