pyepr.resonator_profile_analysis.ResonatorProfileAnalysis

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

Analysis and calculation of resonator profiles.

Fitting fuction:

\nu(t) = a \cos(2\pi f (t - x_0)) e^{-(t - x_0)/\tau} + 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]

Attributes

n_files[source]
t[source]
f_lims = (32, 36)[source]
attenuator = 0[source]

Methods

process_nutations(noisedensity=None, threshold=2, nfft=1000, **kwargs)[source]

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)

fit(model='lorenz_sqrt', f_diff_threshold=2, cores=1, fc_guess=None, **kwargs)[source]

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(axs=None, fig=None, **kwargs)[source]

plot.

Parameters:
axsmatplotlib.Axes, optional

Axes to plot on, by default None. Needs to be a flat array with two axes

figmatplotlib.Figure, optional

Figure to plot on, by default None

Returns:
Matplotlib.Figure

matplotlib figure object