auspex.analysis package

Submodules

auspex.analysis.fits module

class auspex.analysis.fits.Auspex2DFit(xpts, ypts, zpts, make_plots=False)
A generic fit class wrapping scipy.optimize.curve_fit for convenience.
Specific fits should inherit this class.
xlabel

Plot x-axis label.

Type:str
ylabel

Plot y-axis label.

Type:str
title

Plot title.

Type:str
annotation()

Annotation for the make_plot() method. Should return a string that is passed to matplotlib.pyplot.annotate.

make_plots()

Create a plot of the input data and the fitted model. By default will include any annotation defined in the annotation() class method.

model(x=None)

The fit function evaluated at the parameters found by curve_fit.

Parameters:x – A number or numpy.array returned by the model function.
title = 'Auspex Fit'
xlabel = 'X points'
ylabel = 'Y points'
class auspex.analysis.fits.AuspexFit(xpts, ypts, make_plots=False, ax=None)
A generic fit class wrapping scipy.optimize.curve_fit for convenience.
Specific fits should inherit this class.
xlabel

Plot x-axis label.

Type:str
ylabel

Plot y-axis label.

Type:str
title

Plot title.

Type:str
annotation()

Annotation for the make_plot() method. Should return a string that is passed to matplotlib.pyplot.annotate.

ax = None
bounds = None
make_plots()

Create a plot of the input data and the fitted model. By default will include any annotation defined in the annotation() class method.

model(x=None)

The fit function evaluated at the parameters found by curve_fit.

Parameters:x – A number or numpy.array returned by the model function.
title = 'Auspex Fit'
xlabel = 'X points'
ylabel = 'Y points'
class auspex.analysis.fits.GaussianFit(xpts, ypts, make_plots=False, ax=None)

A fit to a gaussian function

title = 'Gaussian Fit'
xlabel = 'X Data'
ylabel = 'Y Data'
class auspex.analysis.fits.LorentzFit(xpts, ypts, make_plots=False, ax=None)

A fit to a simple Lorentzian function A /((x-b)^2 + (c/2)^2) + d

title = 'Lorentzian Fit'
xlabel = 'X Data'
ylabel = 'Y Data'
class auspex.analysis.fits.MultiGaussianFit(x, y, make_plots=False, n_gaussians=2, n_samples=100000)

A fit to a sum of gaussian function. Use with care!

title = 'Sum of Gaussians Fit'
xlabel = 'X Data'
ylabel = 'Y Data'
class auspex.analysis.fits.QuadraticFit(xpts, ypts, make_plots=False, ax=None)

A fit to a simple quadratic function A*(x-x0)**2 + b

title = 'Quadratic Fit'
xlabel = 'X Data'
ylabel = 'Y Data'

auspex.analysis.helpers module

auspex.analysis.helpers.cal_data(data, quad=<function real>, qubit_name='q1', group_name='main', return_type=<class 'numpy.float32'>, key='')

Rescale data to \(\sigma_z\). expectation value based on calibration sequences.

Parameters:
  • data (numpy array) – The data from the writer or buffer, which is a dictionary whose keys are typically in the format qubit_name-group_name, e.g. ({‘q1-main’} : array([(0.0+0.0j, …), (…), …]))
  • quad (numpy function) – This should be the quadrature where most of the data can be found. Options are: np.real, np.imag, np.abs and np.angle
  • qubit_name (string) – Name of the qubit in the data file. Default is ‘q1’
  • group_name (string) – Name of the data group to calibrate. Default is ‘main’
  • return_type (numpy data type) – Type of the returned data. Default is np.float32.
  • key (string) – In the case where the dictionary keys don’t conform to the default format a string can be passed in specifying the data key to scale.
Returns:

numpy array (type return_type)

Returns the data rescaled to match the calibration results for the \(\sigma_z\) expectation value.

Examples

Loading and calibrating data

>>> exp = QubitExperiment(T1(q1),averages=500)
>>> exp.run_sweeps()
>>> data, desc = exp.writers[0].get_data()
auspex.analysis.helpers.cal_ls()

List of auspex.pulse_calibration results

auspex.analysis.helpers.cal_scale(data, bit=0, nqubits=1, repeats=2)

Scale data from calibration points. :param data: :type data: Unscaled data with cal points. :param bit: :type bit: Which qubit in the sequence is to be calibrated (0 for 1st, etc…). Default 0. :param nqubits: :type nqubits: Number of qubits in the data. Default 1. :param repeats: :type repeats: Number of calibraiton repeats. Default 2.

Returns:data
Return type:scaled data array
auspex.analysis.helpers.get_cals(qubit, params, make_plots=True, depth=0)

Return and optionally plot the result of the most recent calibrations/characterizations :param qubit: :type qubit: qubit name (string) :param params: :type params: parameter(s) to plot (string or list of strings) :param make_plots: :type make_plots: optional bool (default = True) :param depth: :type depth: optional integer, number of most recent calibrations to load (default = 0 for all cals) :param ————-: :param Returns: :param List of: :type List of: dates, values, errors

auspex.analysis.helpers.get_file_name()

Helper function to get a filepath from a dialog box

auspex.analysis.helpers.load_data(dirpath=None)

Open data in the .auspex file at dirpath/

Parameters:dirpath (string) – Path to the .auspex file. If no folder is specified, a dialogue box will ask for a path.
Returns:
data_set (Dict{data group}{data name}{data,descriptor})
Data as a dictionary structure with data groups, types of data and the data packed sequentially

Examples

Loading a data container

>>> data = load_data('/path/to/my/data.auspex')
>>> data
{'q2-main': {'data': {'data': array([[ 0.16928101-0.05661011j,  0.3225708 +0.08914185j,
    0.2114563 +0.10314941j, ..., -0.32357788+0.16964722j,
>>> data["q3-main"]["variance"]["descriptor"]
<DataStreamDescriptor(num_dims=1, num_points=52)>
>>> data["q3-main"]["variance"]["data"]
array([0.00094496+0.00014886j, 0.00089747+0.00015082j,
0.00090634+0.00015106j, 0.00090128+0.00014451j,...
auspex.analysis.helpers.normalize_buffer_data(data, desc, qubit_index, zero_id=0, one_id=1)
auspex.analysis.helpers.normalize_data(data, zero_id=0, one_id=1)
auspex.analysis.helpers.open_data(num=None, folder=None, groupname='main', datasetname='data', date=None)
Convenience Load data from an AuspexDataContainer given a file number and folder.
Assumes that files are named with the convention ExperimentName-NNNNN.auspex
Parameters:
  • num (int) – File number to be loaded.
  • folder (string) – Base folder where file is stored. If the date parameter is not None, assumes file is a dated folder. If no folder is specified, open a dialogue box. Open the folder with the desired ExperimentName-NNNN.auspex, then press OK
  • groupname (string) – Group name of data to be loaded.
  • datasetname (string, optional) – Data set name to be loaded. Default is “data”.
  • date (string, optional) – Date folder from which data is to be loaded. Format is “YYMMDD” Defaults to today’s date.
Returns:

data (numpy.array)

Data loaded from file.

desc (DataSetDescriptor)

Dataset descriptor loaded from file.

Examples

Loading a data container

>>> data, desc = open_data(42, '/path/to/my/data', "q1-main", date="190301")

Module contents