qick.averager_program

Several helper classes for writing qubit experiments.

Functions

merge_sweeps(sweeps)

create a new QickSweep object that merges the update and reset functions of multiple QickSweeps into one.

Classes

AbsQickSweep(prog[, label])

Abstract QickSweep class.

AveragerProgram(soccfg, cfg)

AveragerProgram class is an abstract base class for programs which do loops over experiments in hardware.

NDAveragerProgram(soccfg, cfg)

NDAveragerProgram class, for experiments that sweep over multiple variables in qick.

QickSweep(prog, reg, start, stop, expts[, label])

QickSweep class, describes a sweeps over a qick register.

RAveragerProgram(soccfg, cfg)

RAveragerProgram class, for qubit experiments that sweep over a variable (whose value is stored in expt_pts).

class qick.averager_program.AveragerProgram(soccfg, cfg)[source]

Bases: AcquireProgram

AveragerProgram class is an abstract base class for programs which do loops over experiments in hardware. It consists of a template program which takes care of the loop and acquire methods that talk to the processor to stream single shot data in real-time and then reshape and average it appropriately.

Parameters:
  • soccfg (QickConfig) – This can be either a QickSOc object (if the program is running on the QICK) or a QickCOnfig (if running remotely).

  • cfg (dict) – Configuration dictionary

initialize()[source]

Abstract method for initializing the program and can include any instructions that are executed once at the beginning of the program.

body()[source]

Abstract method for the body of the program

make_program()[source]

A template program which repeats the instructions defined in the body() method the number of times specified in self.cfg[“reps”].

acquire(soc, threshold=None, angle=None, readouts_per_experiment=None, save_experiments=None, load_pulses=True, start_src='internal', progress=False)[source]

This method optionally loads pulses on to the SoC, configures the ADC readouts, loads the machine code representation of the AveragerProgram onto the SoC, starts the program and streams the data into the Python, returning it as a set of numpy arrays. config requirements: “reps” = number of repetitions;

Parameters:
  • soc (Qick object) – Qick object

  • threshold (int) – threshold

  • angle (list) – rotation angle

  • readouts_per_experiment (int) – readouts per experiment

  • save_experiments (list) – saved readouts (by default, save all readouts)

  • load_pulses (bool) – If true, loads pulses into the tProc

  • start_src (string) – “internal” (tProc starts immediately) or “external” (each round waits for an external trigger)

  • progress (bool) – If true, displays progress bar

Returns:

  • expt_pts (list) - list of experiment points

  • avg_di (list) - list of lists of averaged accumulated I data for ADCs 0 and 1

  • avg_dq (list) - list of lists of averaged accumulated Q data for ADCs 0 and 1

acquire_decimated(soc, load_pulses=True, readouts_per_experiment=None, start_src='internal', progress=True)[source]

This method acquires the raw (downconverted and decimated) data sampled by the ADC. This method is slow and mostly useful for lining up pulses or doing loopback tests.

config requirements: “reps” = number of tProc loop repetitions; “soft_avgs” = number of Python loop repetitions;

The data is returned as a list of ndarrays (one ndarray per readout channel). There are two possible array formats. reps = 1: 2D array with dimensions (2, length), indices (I/Q, sample) reps > 1: 3D array with dimensions (reps, 2, length), indices (rep, I/Q, sample) readouts_per_experiment>1: 3D array with dimensions (reps, expts, 2, length), indices (rep, expt, I/Q, sample)

Parameters:
  • soc (Qick object) – Qick object

  • load_pulses (bool) – If true, loads pulses into the tProc

  • readouts_per_experiment (int) – readouts per experiment (all will be saved)

  • start_src (string) – “internal” (tProc starts immediately) or “external” (each soft_avg waits for an external trigger)

  • progress (bool) – If true, displays progress bar

Returns:

  • iq_list (list) - list of lists of averaged decimated I and Q data

class qick.averager_program.RAveragerProgram(soccfg, cfg)[source]

Bases: AcquireProgram

RAveragerProgram class, for qubit experiments that sweep over a variable (whose value is stored in expt_pts). It is an abstract base class similar to the AveragerProgram, except has an outer loop which allows one to sweep a parameter in the real-time program rather than looping over it in software. This can be more efficient for short duty cycles. Acquire gathers data from both ADCs 0 and 1.

Parameters:

cfg (dict) – Configuration dictionary

initialize()[source]

Abstract method for initializing the program and can include any instructions that are executed once at the beginning of the program.

body()[source]

Abstract method for the body of the program

update()[source]

Abstract method for updating the program

make_program()[source]

A template program which repeats the instructions defined in the body() method the number of times specified in self.cfg[“reps”].

get_expt_pts()[source]

Method for calculating experiment points (for x-axis of plots) based on the config.

Returns:

Numpy array of experiment points

Return type:

array

acquire(soc, threshold=None, angle=None, load_pulses=True, readouts_per_experiment=None, save_experiments=None, start_src='internal', progress=False)[source]

This method optionally loads pulses on to the SoC, configures the ADC readouts, loads the machine code representation of the AveragerProgram onto the SoC, starts the program and streams the data into the Python, returning it as a set of numpy arrays. config requirements: “reps” = number of repetitions;

Parameters:
  • soc (Qick object) – Qick object

  • threshold (int) – threshold

  • angle (list) – rotation angle

  • readouts_per_experiment (int) – readouts per experiment

  • save_experiments (list) – saved readouts (by default, save all readouts)

  • load_pulses (bool) – If true, loads pulses into the tProc

  • start_src (string) – “internal” (tProc starts immediately) or “external” (each round waits for an external trigger)

  • progress (bool) – If true, displays progress bar

Returns:

  • expt_pts (list) - list of experiment points

  • avg_di (list) - list of lists of averaged accumulated I data for ADCs 0 and 1

  • avg_dq (list) - list of lists of averaged accumulated Q data for ADCs 0 and 1

class qick.averager_program.AbsQickSweep(prog: QickProgram, label=None)[source]

Bases: object

Abstract QickSweep class.

get_sweep_pts() Union[List, array][source]

abstract method for getting the sweep values

update()[source]

abstract method for updating the sweep value

reset()[source]

abstract method for resetting the sweep value at the beginning of each sweep.

class qick.averager_program.QickSweep(prog: QickProgram, reg: QickRegister, start, stop, expts: int, label=None)[source]

Bases: AbsQickSweep

QickSweep class, describes a sweeps over a qick register.

get_sweep_pts()[source]

abstract method for getting the sweep values

update()[source]

update the register value. This will be called after finishing last register sweep. This function should be overwritten if more complicated update is needed. :return:

reset()[source]

reset the register to the start value. will be called at the beginning of each sweep. This function should be overwritten if more complicated reset is needed. :return:

qick.averager_program.merge_sweeps(sweeps: List[QickSweep]) AbsQickSweep[source]

create a new QickSweep object that merges the update and reset functions of multiple QickSweeps into one. This is useful when multiple registers need to be updated at the same time in one sweep. :param sweeps: list of “QickSweep”s :return:

class qick.averager_program.NDAveragerProgram(soccfg, cfg)[source]

Bases: QickRegisterManagerMixin, AcquireProgram

NDAveragerProgram class, for experiments that sweep over multiple variables in qick. The order of experiment runs follow outer->inner: reps, sweep_n,… sweep_0.

Parameters:

cfg (dict) – Configuration dictionary

initialize()[source]

Abstract method for initializing the program. Should include the instructions that will be executed once at the beginning of the qick program.

body()[source]

Abstract method for the body of the program.

add_sweep(sweep: AbsQickSweep)[source]

Add a layer of register sweep to the qick asm program. The order of sweeping will follow first added first sweep. :param sweep: :return:

make_program()[source]

Make the N dimensional sweep program. The program will run initialize once at the beginning, then iterate over all the sweep parameters and run the body. The whole sweep will repeat for cfg[“reps”] number of times.

get_expt_pts()[source]
Returns:

acquire(soc, threshold: Optional[int] = None, angle: Optional[List] = None, load_pulses=True, readouts_per_experiment=None, save_experiments: Optional[List] = None, start_src: str = 'internal', progress=False)[source]

This method optionally loads pulses on to the SoC, configures the ADC readouts, loads the machine code representation of the AveragerProgram onto the SoC, starts the program and streams the data into the Python, returning it as a set of numpy arrays. Note here the buf data has “reps” as the outermost axis, and the first swept parameter corresponds to the innermost axis.

config requirements: “reps” = number of repetitions;

Parameters:
  • soc – Qick object

  • threshold – threshold

  • angle – rotation angle

  • readouts_per_experiment – readouts per experiment

  • save_experiments – saved readouts (by default, save all readouts)

  • load_pulses – If true, loads pulses into the tProc

  • start_src – “internal” (tProc starts immediately) or “external” (each round waits for an external trigger)

  • progress – If true, displays progress bar

Returns:

  • expt_pts (list) - list of experiment points

  • avg_di (list) - list of lists of averaged accumulated I data for ADCs 0 and 1

  • avg_dq (list) - list of lists of averaged accumulated Q data for ADCs 0 and 1