ccatkidlib.analysis.fit.kid_phase_fit package

Submodules

ccatkidlib.analysis.fit.kid_phase_fit.fit_single_det module

class ccatkidlib.analysis.fit.kid_phase_fit.fit_single_det.ResonanceFitterSingleTone(f, z, tau, numspan=2, tone_freq_lo=0, window_width=0, pherr_threshold_num=10, pherr_threshold=0.2, verbose=False, **keywords)

Bases: object

Class to extract resonance parameters following algorithm in Gao Thesis Appendix E 1) remove cable delay 2) find circle x0,y0 and radius 3) rotate and translate to origin 4) fit phase versus frequency to extract fr, Qr Class to load resonator data and perform a simple or nonlinear phase fit (user-specified) on a single tone

fit the resonance following method described in Jiansong Gao thesis Appendix E data needs to be complex (like I + jQ)

calcphasebounds(Q, f0, phi, fmargin=0.02, phimargin=0.05)
calcphasenlinbounds(Q, alpha, f0, phi, fmargin=0.02, phimargin=0.05)
fitphase2(f, z, f0g, Qg, numspan=2, showplot=False, use_bounds=False)
fitphasenlin_c2(f, z, estv, numspan=2, use_bounds=False)
fitphasenlintest2(ft, angt, Q, alpha, f0, phi, r, zt, **keywords)
fitphasetest(ft, angt, Q, f0, phi, **keywords)
fits21sim(showplot=False, use_bounds=False)
fits21simnlin(use_bounds=False, showplot=False)
fphaselin(ft, Q, f0, phi)
fphasenlin(f, Q, alpha, f00, phi, r, z)
fphasenlin2(f, Q, alpha, f00, phi, r, z)
plot()
plotComplexPlane(z)
plotPolar(z)
rescaleCircle(z, r)
rotateCircle(z, phi)
windowgauss(f)
windowlorentz(f)

ccatkidlib.analysis.fit.kid_phase_fit.phase_fit module

ccatkidlib.analysis.fit.kid_phase_fit.phase_fit.fit_single_res(fs, z, numspan=2, **kwargs)
ccatkidlib.analysis.fit.kid_phase_fit.phase_fit.fit_target_sweep(targ_file=None, cfg_file=None, verb=False, keep_model=False, **kwargs)

fits target sweep using data from targ_file. cfg_file is the config of that target sweep. returns a dictionary of numpy arrays for fitted values. Also filters some of the nonphysical fits if select filt=True

inputs

targ_file: string The target sweep data file cfg_file: string The target sweep config file verb: bool whether to output with more verbosity

kwargs: {

numspan: int tone_freq_lo: float window_width: float pherr_threshold_num: float pherr_threshold: float

}

returns

ret = {

‘Qi’: np.array, ‘Qc’: np.array, ‘Q’: np.array, ‘bif’: np.array, ‘alpha’: np.array, ‘tau’: np.array, ‘f0’: np.array, ‘chi_sq’: np.array, ‘flag’: np.array, An array of flags corresponding to each fit

0 is fit successful, 1 is fit failed

‘fs’: np.array, ‘fit_z’: np.array, will return if keep_model is True ‘data_z’: np.array,

}

ccatkidlib.analysis.fit.kid_phase_fit.utils module

class ccatkidlib.analysis.fit.kid_phase_fit.utils.Circlefit(z, scaling=False)

Bases: object

Class to perform a circle fit on data

data needs to be complex (like I + jQ)

nsphere_fit_test(scaling)

Fit an n-sphere to ND data. The center and radius of the n-sphere are optimized using the Coope method. The sphere is described by .. math:

\left \lVert

ec{x} - ec{c} ight Vert_2 = r

xarray-like

The n-vectors describing the data. Usually this will be a nxm array containing m n-dimensional data points.

axisint

The axis that determines the number of dimensions of the n-sphere. All other axes are effectively raveled to obtain an (m, n) array.

scalingbool

If True, scale and offset the data to a bounding box of -1 to +1 during computations for numerical stability. Default is False.

rscalar

The optimal radius of the best-fit n-sphere for x.

carray

An array of size x.shape[axis] with the optimized center of the best-fit n-sphere.

  • [Coope]ref-cfblanls

ccatkidlib.analysis.fit.kid_phase_fit.utils.complexS21(i, q)
ccatkidlib.analysis.fit.kid_phase_fit.utils.estpara3(f, z, verbose=False, **keywords)
ccatkidlib.analysis.fit.kid_phase_fit.utils.find_a_extrapolatev2(x, y, a_sorted, tolerance=1e-05)
ccatkidlib.analysis.fit.kid_phase_fit.utils.find_best_adrv(fit_obj, a_ref=0.2, a_min=-0.2, a_max=1.5, a_tolerance=0.01)

This function determining the best driving power empirically.

ccatkidlib.analysis.fit.kid_phase_fit.utils.find_best_adrv_extrapolate(fit_obj, a_ref=0.2, a_min=-0.2, a_max=1.5, a_tolerance=0.01)

This function determining the best driving power empirically.

ccatkidlib.analysis.fit.kid_phase_fit.utils.find_best_adrv_tone_amp(fit_obj, a_ref=0.2, a_min=-0.2, a_max=1.5, a_tolerance=0.01)

This function determining the best driving power empirically.

ccatkidlib.analysis.fit.kid_phase_fit.utils.find_first_zerocrossing1d(x, y, tolerance=1e-05)
ccatkidlib.analysis.fit.kid_phase_fit.utils.find_nearest_indice(x, val)
ccatkidlib.analysis.fit.kid_phase_fit.utils.findcabledelay(f, z)
ccatkidlib.analysis.fit.kid_phase_fit.utils.fit_cable_delay(gain_f, gain_z)
ccatkidlib.analysis.fit.kid_phase_fit.utils.get_dip_depth(s21)

Input an array of s21, find the depth between maximal and minimal point.

ccatkidlib.analysis.fit.kid_phase_fit.utils.guess_tone_drive_atten(tone_range, powlist, a_guess, a_predict_threshold, Q_dict, Qc_dict, omega_r_dict, a_dict, E_star_dict, bif_flag_filter_dict)
ccatkidlib.analysis.fit.kid_phase_fit.utils.logmag(z)
ccatkidlib.analysis.fit.kid_phase_fit.utils.magS21(i, q)
ccatkidlib.analysis.fit.kid_phase_fit.utils.phase2(z)
ccatkidlib.analysis.fit.kid_phase_fit.utils.plot_summary_for_index(data, ii, fig=None, ax=None)
ccatkidlib.analysis.fit.kid_phase_fit.utils.removecable(f, z, tau, verbose=False, showplot=False)
ccatkidlib.analysis.fit.kid_phase_fit.utils.smoothdata2(y, N)
ccatkidlib.analysis.fit.kid_phase_fit.utils.trimdata(f, z, f0, Q, numspan=1)

Module contents