lib.Calibration.Qfiber module
- class lib.Calibration.Qfiber.Chi2Implement(functname, x, y, covarin, extra_args=None)[source]
Bases:
Chi2MinimizerMethods
__call__(*pars[, extra_args])Call self as a function.
- class lib.Calibration.Qfiber.Chi2Minimizer(functname, xin, yin, covarin, extra_args=None, invcovar=None)[source]
Bases:
objectParent classes with the model to minimize
Methods
__call__(*pars[, extra_args])Call self as a function.
- class lib.Calibration.Qfiber.MyChi2(xin, yin, covarin, functname, extra_args=None, invcovar=None, diag=False)[source]
Bases:
objectClass defining the minimizer and the data
Methods
__call__(*pars[, extra_args])Call self as a function.
- class lib.Calibration.Qfiber.MyChi2_nocov(xin, yin, functname)[source]
Bases:
objectClass defining the minimizer and the data
Methods
__call__(*pars)Call self as a function.
- lib.Calibration.Qfiber.butter_bandpass(lowcut, highcut, fs, order=5)[source]
- Parameters:
lowcut (scalar)
highcut (scalar)
fs
order (int) – order of the filter
- Returns:
b, a – Numerator (b) and denominator (a) polynomials of the IIR filter.
- Return type:
(ndarray, ndarray)
- lib.Calibration.Qfiber.butter_bandpass_filter(data, lowcut, highcut, fs, order=5)[source]
- Parameters:
data (array like)
lowcut
highcut
fs
order
- Returns:
y – The output of the digital filter.
- Return type:
array
- lib.Calibration.Qfiber.calibrate(fib, pow_maynooth, allparams, allerr, allok, cutparam=None, cuterr=None, bootstrap=None)[source]
- Parameters:
fib
pow_maynooth
allparams
allerr
allok
cutparam
cuterr
bootstrap
- lib.Calibration.Qfiber.do_minuit(x, y, covarin, guess, functname=<function thepolynomial>, fixpars=None, chi2=None, rangepars=None, nohesse=False, force_chi2_ndf=False, verbose=True, minos=True, extra_args=None, print_level=0, force_diag=False, nsplit=1, ncallmax=10000, precision=None)[source]
- lib.Calibration.Qfiber.exponential_filter1d(input, sigma, axis=-1, output=None, mode='reflect', cval=0.0, truncate=10.0, power=1)[source]
One-dimensional Exponential filter.
- Parameters:
input
sigma (scalar) – Tau of exponential kernel
axis (int, optional) – The axis of input along which to calculate. Default is -1.
output (array or dtype, optional) – The array in which to place the output, or the dtype of the returned array. By default an array of the same dtype as input will be created.
mode ({‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’}, optional) – The mode parameter determines how the input array is extended beyond its boundaries. Default is ‘reflect’.
cval (scalar, optional) – Value to fill past edges of input if mode is ‘constant’. Default is 0.0.
truncate (float) – Truncate the filter at this many standard deviations. Default is 4.0.
- lib.Calibration.Qfiber.filter_data(time_in, data_in, lowcut=None, highcut=None, rebin=True, verbose=False, notch=None, order=5)[source]
- lib.Calibration.Qfiber.fit_all(t, folded, av, initpars=None, fixpars=[0, 0, 0, 0], stop_each=False, functname=<function simsig>, rangepars=None)[source]
- Parameters:
t
folded
av
initpars
fixpars
stop_each
functname
rangepars
- lib.Calibration.Qfiber.fit_average(t, folded, fff, dc, fib, Vtes, initpars=None, fixpars=[0, 0, 0, 0], doplot=True, functname=<function simsig>, clear=True, name='fib')[source]
- Parameters:
t
folded
fff (float) – Modulation frequency of the external source.
dc (float) – Duty cycle of the modulation.
fib
Vtes
initpars
fixpars
doplot (bool) – If true make the plot.
functname
clear (bool) – If true, clear the window before plotting.
name
- lib.Calibration.Qfiber.fold_data(time, dd, period, nbins, lowcut=None, highcut=None, notch=None, rebin=None, median=False, mode=False, clip=None, return_error=False, return_noise_harmonics=None, silent=False, verbose=None)[source]
- Parameters:
time (array)
dd (array) – Data signal.
period (float) – Data will be folded on this period.
lowcut (If highcut is given but no) – Low cut for the filter.
highcut (If lowcut is given but no) – High cut for the filter.
given (If none of them is)
applied. (no cut frequency filter is)
highcut
applied.
lowcut
applied.
given
applied.
used. (In any case notch filter can still be)
nbins
notch
return_error
- lib.Calibration.Qfiber.image_asics(data1=None, data2=None, all1=None)[source]
Return an image of detectors on the focal plane. Each asic has 124 TES and 4 thermometers.
- Parameters:
data1
data2
all1 (array) – signal from 2 asics (256 detectors)
- lib.Calibration.Qfiber.meancut(data, nsig, med=False, disp=True)[source]
- Parameters:
data (array like)
nsig (float) – Lower and upper bound factor of sigma clipping.
med (bool) – If True, perform the median and not the mean.
disp (bool) – If True, return the dispersion (STD), if False, return the error on the mean (STD/sqrt(N))
- Return type:
The mean/median and the dispersion/error.
- lib.Calibration.Qfiber.notch_array(freqs, bw)[source]
Returns array to be used with notch_filter
- Parameters:
freqs (list) – Frequencies to filter
bw (scalar) – The filter bandwidth
- lib.Calibration.Qfiber.notch_filter(data, f0, bw, fs)[source]
- Parameters:
data
f0
bw
fs
- Returns:
y – Output of the notch filter
- Return type:
array
- lib.Calibration.Qfiber.profile(xin, yin, rng=None, nbins=10, fmt=None, plot=True, dispersion=True, log=False, median=False, cutbad=True, rebin_as_well=None, clip=None, mode=False)[source]
- lib.Calibration.Qfiber.qs2array(dataset, FREQ_SAMPLING=None, timerange=None, asic=None)[source]
Loads qubic instance to create ‘dd’ which is TOD for each TES Also normalises raw data Also returns ‘time’ which is linear time array Can also specify a timerange
- Parameters:
dataset (directory containing the QubicStudio dataset)
FREQ_SAMPLING (this argument is kept for backwards compatibility) – frequency sampling is given by the qubicpack qubicfp object
timerange (array) – Time range, low and high boundaries
Returns (time array, data array, qubicfp object)
-------
- lib.Calibration.Qfiber.read_hkintern(basedir, thefieldname=None)[source]
- Parameters:
basedir (str) – directory of the file
thefieldname (str)
- Returns:
newdate (array) – New time array of te measurement
hk (array) – Angle position given by the encoder (number of encoder steps).
- lib.Calibration.Qfiber.run_asic(fpobj, idnum, Vtes, fff, dc, asic, reselect_ok=False, lowcut=0.5, highcut=15.0, nbins=50, nointeractive=False, doplot=True, notch=None, lastpassallfree=False, name='fib', okfile=None, initpars=None, timerange=None, removesat=False, stop_each=False, rangepars=None)[source]
- Parameters:
fpobj (a qubicpack.qubicfp object)
idnum (fibre number)
Vtes (bias voltage (this is normally accessible in the qubicfp object, but maybe not for old data))
fff (float) – Modulation frequency of the external source
dc (float) – Duty cycle of the modulation
asic (the asic number (1 or 2))
reselect_ok (bool) – If true, you will select the good TES one by one, if False, you will use the file created before.
lowcut
highcut
nbins
nointeractive
doplot
notch
lastpassallfree
name
okfile
initpars
timerange
removesat
stop_each
rangepars
- lib.Calibration.Qfiber.simsig(x, pars, extra_args=None)[source]
- Parameters:
x (list)
pars (list) – List with 4 parameters: cycle, ctime, initial time, amplitude
- Return type:
A simulated signal.
- lib.Calibration.Qfiber.simsig_fringes(time, stable_time, params)[source]
Simulate a TOD signal obtained during the fringe measurement. This function was done to make a fit. :type time: :param time: Time sampling. :type time: array :type stable_time: :param stable_time: Stable time [s] on each step. :type stable_time: float :type params: :param params: ctime (constant time response of the detector), starting time, the 6 amplitudes. :type params: list
- Return type:
The simulated signal.
- lib.Calibration.Qfiber.simsig_nonorm(x, pars, extra_args=None)[source]
Same as simsig but without normalisation.
- lib.Calibration.Qfiber.weighted_mean(x, dx, dispersion=True, renorm=False)[source]
Calculated the weighted mean of data, errors If dispersion is True (default) the error on the mean comes from the RMS of the data, otherwise the error on the weighted mean is analytically calculated from input errors