pyepr.ResonatorProfileAnalysis

class pyepr.ResonatorProfileAnalysis(dataset, f_lims=(32, 36), attentuator=0, R_limit=0.2, bounds=None, p0=None, **kwargs)

Analysis and calculation of resonator profiles.

Fitting fuction:

\[\nu(t) = a \cos(2\pi f (t - x_0)) e^{-(t - x_0)/ au} + k\]

where \(a\) is the amplitude, \(f\) is the nutation frequency, \(\tau\) is the decay time, \(x_0\) is the offset and \(k\) is a constant offset. The fit is performed for each frequency in the dataset. The fit is performed using the curve_fit function from scipy.optimize.

Parameters:
datasetxr.xarray

The dataset containing the nutations. It must have both a ‘LO’ axis and a ‘pulse0_tp’ axis.

f_limstuple, optional

The frequency limits of the resonator profile, by default (33,35)

attenuator: int

The value of the main attentuator in dB, by default 0

R_limit: float, optional

The R^2 limit for extracting fits, by default 0.2

boundstuple, optional

The bounds for the fit in the form ([lower bounds],[upper bounds]), by default None. If not given the bounds are set to ([5e-3,10,0,-1,-5],[0.3,2000,2,1,5])

p0list, optional

The initial guess for the fit, by default None. If not given the guess is set to [50e-3,150,1,0]

n_files
t
f_lims = (32, 36)
attenuator = 0
process_nutations(noisedensity=None, threshold=2, nfft=1000, **kwargs)

Uses a power series to extract the resonator profile.

Parameters:
noisedensitytuple, optional

If not given the first trace is assumed to be so far off resonance that it is just noise.

nfft: int, optional

The length of the fft to be used, zero padded if requred, default is 1000.

threshold: int, optional

The multiples above the noise a single must be to not be excluded, default is 2.

Returns:
prof_data: np.ndarray

The resonator profile, give in nutation frequency (GHz)

prof_frqs: np.ndarray

The frequency axis in GHz

Parameters:
  • noisedensity (float)

  • threshold (int)

  • nfft (int)

_process_fit(R_limit=0.5, mask=None, debug=False)

Processes the nutation data by fitting a cosine function to each frequency in the dataset.

Function used for fitting: .. math:: nu(t) = a cos(2pi f (t - x_0)) e^{-(t - x_0)/ au} + k where \(a\) is the amplitude, \(f\) is the nutation frequency, \(\tau\) is the decay time, \(x_0\) is the offset and \(k\) is a constant offset.

Parameters:
R_limitfloat, optional

The R^2 limit for extracting fits, by default 0.5

masknp.ndarray, optional

A mask to apply to the dataset, by default None. If not given the whole dataset is used. The mask is applied along the ‘pulse0_tp’ axis, so it should be a 1D array

debugbool, optional

If True all fits that are below the R_limit are plotted, by default False

fit(f_diff_threshold=2, cores=1, multi_mode=False, fc_guess=None)

Fit the resonator profile with a sum of lorentzians.

Parameters:
f_diff_thresholdfloat, optional

The difference between two peaks at which they will be merged into one, by default 0.03

plot(fieldsweep=None, axs=None, fig=None)

plot.

Parameters:
fieldsweepFieldSweepAnalysis, optional

Overlays the FieldSweep if provided, by default None

axsmatplotlib.Axes, optional

Axes to plot on, by default None

figmatplotlib.Figure, optional

Figure to plot on, by default None

Returns:
Matplotlib.Figure

matplotlib figure object

classmethod _dummy_create(freq_axis, nu_max, Q, fc)

Creates a dummy resonator profile for testing purposes.

Parameters:
freq_axisnp.ndarray

The frequency axis of the resonator profile.

nu_maxfloat

The maximum nutation frequency.

Qfloat

The quality factor of the resonator.

fcfloat

The center frequency of the resonator.

Parameters:
  • freq_axis (numpy.ndarray)

  • nu_max (float)

  • Q (float)

  • fc (float)