API Reference
Module containing the ArbokDriver class for managing and running sequences on a physical OPX instrument.
- class arbok_driver.arbok_driver.ArbokDriver(name, device, **kwargs)
Bases:
InstrumentClass containing all functionality to manage and run modular sequences on a physical OPX instrument
- opx: QuantumMachine | QmApi
- qm_job: RunningQmJob
- qmm: QuantumMachinesManager
- result_handles: StreamsManager
- is_mock: bool
- property measurements: list[Measurement]
Measurements to be run within program uploaded to the OPX
- reset_measurements()
Resets all measurements in the program TODO: delete instances of those measurements
- Return type:
None
- connect_opx(host_ip, qm_config=None, reconnect=False, **kwargs)
Creates QuantumMachinesManager and opens a quantum machine on it with the given IP address
- Parameters:
host_ip (
str) – Ip address of the OPXqm_config (
dict|None) – QM/OPX config dictionary to be used. Defaults to None, in which case the config from the device is used. If given overwrites the device config.reconnect (
bool) – Whether to reconnect to the OPX if already connected. Keeps QMM alive if true. Defaults to False.**kwargs – Arbitrary keyword arguments for QMM instanciation
- Return type:
None
- reconnect_opx(host_ip, qm_config=None)
Reconnects to the OPX with the given IP address and closes the previous connection
- Parameters:
host_ip (
str) – Ip address of the OPXqm_config (
dict) – QM/OPX config dictionary to be used. Defaults to None, in which case the config from the device is used. If given overwrites the device config.
- Return type:
None
- add_measurement(new_measurement)
Adds a class which inherits Measurement to the program and adds it as a QCoDeS sub-module
- Parameters:
new_measurement (
Measurement) – The instance which inheritsadded (Measurement to be)
- run(qua_program, **kwargs)
Sends the qua program for execution to the OPX and sets the programs result handles
- Parameters:
qua_program (program) – QUA program to be executed
- print_qua_program_to_file(path, qua_program, add_config=False)
Creates file with ‘filename’ and prints the QUA code to this file
- Parameters:
file_name (str) – File name of target file
qua_program (program) – QUA program to be printed
add_config (
bool) – Whether config is added to output file
- Return type:
None
- run_local_simulation(qua_program, duration, **kwargs)
Simulates the given program of the sequence for duration cycles TODO: Move to SequenceBase and add checks if OPX is connected :type qua_program: program :param qua_program: QUA program to be simulated :type qua_program: program :param duration: Simulation duration in cycles :type duration:
int:type **kwargs: :param **kwargs: Arbitrary keyword arguments for QMM simulation- Returns:
QM job with waveform simulation result nr_controllers (int): Nr of controllers to fetch simulation results
- Return type:
simulated_job (SimulatedJob)
- get_idn()
Overload the get_idn method as we don’t have one.
- ask_raw(cmd)
Abstract method from qcodes Instrument
- Return type:
str
- write_raw(cmd)
Abstract method from qcodes Instrument
- Return type:
None
- create_measurement_from_experiment(experiment, qc_measurement_name=None, name='measurement')
Creates an arbok and QCoDeS measurement from an arbok-experiment
- Parameters:
name (
str) – Name of the measurement (py. variable name compliant)experiment (
Experiment) – Experiment to be runqc_measurement_name (
str|None) – Name of the QCoDeS measurement (as it will be saved in the database)
- Returns:
Measurement instance
- Return type:
- check_db_engine_and_bucket_connected()
Checks if database engine and s3 bucket are connected Raises error if not connected TODO: ping both TCP connections to check if still alive
- get_run_from_id(run_id)
Fetches a run from the connected arbok database engine based on the given run ID
- Parameters:
run_id (
int) – ID of the run to be fetched- Returns:
detached run instance
- Return type:
- get_data_from_id(run_id)
Fetches data from the connected database engine based on the given run ID
- Parameters:
run_id (
int) – ID of the run to fetch data from- Returns:
- Lazy loaded xarray dataset. Will only
load data when using .load() or .compute() methods!
- Return type:
Dataset
Module containing abstract class for dependent readouts
- class arbok_driver.abstract_readout.EmptyParameterClass
Bases:
ParameterClass
- class arbok_driver.abstract_readout.AbstractReadout(name, read_sequence, signal, save_results=True, parameters=None)
Bases:
Generic[P],ABCAbstract base class for abstract readouts. This base class handles qua variable and stream declaration, saving and streaming. The child class only needs to handle the abstract method qua_measure
- PARAMETER_CLASS: Type[P]
- read_sequence: ReadSequence
- arbok_params: P
- abstractmethod qua_measure()
Measures the qua variables for the given abstract readout
- property parameters: dict[str, SequenceParameter]
Returns the parameters of the readout
- property gettables: dict[str, GettableParameterBase]
Returns the gettables of the readout
- create_gettable(gettable_name, var_type)
Creates a new GettableParameter for the AbstractReadout. The gettable is added to the read sequence as a parameter and registered
under the given name.
- Parameters:
gettable_name (
str) – Name of the gettable to be createdvar_type (
type[int|bool|fixed]) – Type of the gettable variable
- Returns:
The created gettable parameter
- Return type:
- create_multi_gettable(gettable_name, var_type, internal_setpoints)
Creates a new GettableParameterMulti for the AbstractReadout. The gettable is added to the read sequence as a parameter and registered under the given name.
- Parameters:
gettable_name (
str) – Name of the gettable to be createdvar_type (
type[int|bool|fixed]) – Type of the gettable variable(internal_setpoints (internal_setpoints) – Sequence[Parameter]): setpoints for this multi gettable
- Returns:
The created gettable parameter
- Return type:
- qua_declare_variables()
Declares all necessary qua variables for readout
- Return type:
None
- qua_save_variables()
Saves the qua variables of all gettables in this readout
- Return type:
None
- qua_save_streams()
Saves acquired results to qua stream
- Return type:
None
- qua_measure_and_save(*args, **kwargs)
Measures and saves the result of the given readout
- add_qc_params_from_config(param_dict)
Adds the given parameters to the sequence with the readout prefix
- Parameters:
params (list) – List of parameter names to be added to the sequence
- Return type:
None
- map_arbok_params()
Adds the parameters to a ParameterClass instance
- Returns:
ParameterClass with references to all needed params
- Return type:
TypeVar(P, bound=ParameterClass)
- get_gettable_from_path(attr_path)
Returns the gettable from a given path from a given string. If the string leads to an AbstractReadout it is being tried to find a single gettable associated to that AbstractReadout
- Parameters:
attr_path (
str) – Path to the given gettable relative to the ReadSequence with the format ‘signal.gettable_name’- Returns:
The found gettable from the given path
- Return type:
- Raises:
ValueError – If the path is not in the format ‘signal.gettable_name’
KeyError – If the signal or gettable is not found in the read sequence
TypeError – If the found object is not a child class of gettable
Module containing Devices class
- class arbok_driver.device.Device(name, opx_config, divider_config, master_config=None)
Class describing the used device by its config and the used sequence.
Module containing abstract class for experiments
- class arbok_driver.experiment.Experiment(**configs_to_prepare)
Abstract class describing a type of experiment to run on the QM. This enforces a certain order of sequences that only requires certain input parameters or configurations to be set. E.g. for a rabi experiment, the order of sequences is:
Initialization of quantum state
Rabi pulse
Readout of quantum state
- abstract property sequences_config: dict
Sequences to be run within program uploaded to the OPX
- property name: str
Name of the experiment to run
Module containing GenericTuningInterface class.
- class arbok_driver.generic_tuning_interface.CostFunction(*args, **kwargs)
- class arbok_driver.generic_tuning_interface.GenericTuningInterface(measurement, parameter_dicts, verbose=False)
Generic streaming interface for machine learning–based parameter tuning.
This class coordinates measurement execution, parameter management, and cost evaluation via a pluggable
CostStrategy.- measurement
Measurement object providing access to the experiment.
- Type:
- driver
Driver associated with the measurement.
- Type:
- parameter_dict
Dictionary describing tunable parameters and their configurations.
- Type:
dict[str, dict]
- sweeps
List of sweep configurations defining remaining parameters are being varied
- Type:
list[dict[SequenceParameter, Sequence]]
- gettables
Gettables to be saved
- Type:
dict[str, GettableParameterBase]
- verbose
Whether all optional printouts are shown
- Type:
bool
- compile_connect_and_run(host_ip)
Compiles, connects and runs the parity readout sequences on device with given host ip.
- run_parameter_set(input_param_dict, progress_bar=None)
Runs the given parameter set an returns the current values for singlet and triplet init
- Parameters:
input_param_dict (
dict[SequenceParameter,float]) – List of parameters to runprogress_bar (Optional) – Progress bar to update
- Returns:
All measured gettables for the parameter set dict: All parameters of the parameter set
- Return type:
tuple[dict,dict]
- run_cross_entropy_sampler(populations, cost_strategy, select_frac=0.3, plot_histograms=False, sampling_params_to_plot=None)
Runs the cross entropy method for the given populations.
- Parameters:
populations (
list) – List of population sizes for each iteration.cost_strategy (
CostFunction) – A callable that takes a dictionary mapping gettables to numpy arrays of measurement results and returns a scalar cost.select_frac (
float) – Fraction of best parameters to select for generating new bounds.plot_histograms (
bool) – If True, plot parameter distributions during sampling.sampling_params_to_plot (
list|None) – Parameter pairs to visualize during the sampling process.
- Returns:
- Dataset containing all gettables, parameters and
rewards
- Return type:
Dataset
- arbok_driver.generic_tuning_interface.sobol_sampling(num_samples, bound_dict)
Generate Sobol sequence devices for the given parameters.
- Parameters:
num_samples (
int) – Number of devices to generate.parameter_dict (dict) – Dictionary containing the parameters to device. Must have bounds as a key for each parameter.
- Returns:
Dictionary containing the parameters as keys and the devices as values.
- Return type:
ndarray
Module containing the Measurement class
- class arbok_driver.measurement.Measurement(parent, name, sequence_config=None)
Class describing a Measurement in an OPX driver
- merge_with_device_config(device, sequence_config)
Merges a sequence configuration with a device’s master configuration.
If both sequence_config and device.master_config are provided, the device’s master configuration takes precedence in case of key conflicts.
- Parameters:
device – An object with a ‘master_config’ attribute (dict or None).
sequence_config – A dictionary representing the sequence configuration, or None.
- Returns:
A new dictionary containing the merged configurations. If neither sequence_config nor device.master_config is provided, an empty dictionary is returned.
- reset()
On reset, call super to reset then, reset local params, sweeps and gettables
- Return type:
None
- reset_registered_gettables()
Resets gettables to prepare for new measurement
- Return type:
None
- property gettables: dict[str, GettableParameterBase]
List of `GettableParameter`s for data acquisition
- property sweep_size: int
Product of sweep axes sizes
- property sweep_dims: tuple[int]
Dimensionality of sweep axes
- property step_requirements: list
Registered input stream parameters
- property available_gettables: list[GettableParameter]
List of all available gettables from all sub sequences
- property is_mock: bool
Returns True if the measurement is a mock measurement
- property run_id: int
Run id of the measurement
- property dataset: Dataset
Xarray Dataset of the measurement
- property input_stream_parameters: list[SequenceParameter]
Registered input stream parameters
- qua_declare()
Contains raw QUA code to declare variables
- qua_before_sweep()
Qua code to be executed before the sweep loop but after the qua.pause statement that aligns the measurement results
- Return type:
None
- qua_before_sequence(simulate=False)
Qua code to be executed before the inner measurement
- qua_after_sequence()
Qua code to be executed after the measurement loop and the code it contains
- qua_increment_shot_tracker()
Increments the shot tracker variable by one and saves it to stream
- qua_stream()
Contains raw QUA code to define streams
- set_sweeps(*args)
Sets the given sweeps from its dict type arguments. Each argument creates one sweep axis. Each dict key, value pair is sweept concurrently along this axis.
- Parameters:
*args (
dict[SequenceParameter,Sequence|ndarray[Any,dtype[TypeVar(_ScalarType_co, bound=generic, covariant=True)]]]) – Arguments of type dict with SequenceParameters as keys and np arrays as setpoints. All values (arrays) must have same length!- Return type:
None
- register_gettables(*args, keywords=None, verbose=False)
Registers GettableParameters that will be retreived during measurement. Gettable parameters can be given as arguments or automatically seached by keywords.
- Parameters:
*args (GettableParameter) – Parameters to be measured
keywords (
str|list|tuple|None) – Keywords to find gettables by name
- Return type:
None
- compile_qua_and_run(save_path=None)
Compiles the QUA code and runs it
- Return type:
Program
- initialize_tuning_interface(parameter_dicts, verbose=False)
Initializes a GenericTuningInterface based on the current measurement
- Return type:
- insert_single_value_input_streams(value_dict)
Compresses all input streams to single array stream
- Parameters:
value_dict (
dict[SequenceParameter,float]) – Dictionary containing all input stream parameters (SequenceParameters) and their values- Raises:
KeyError – If not all input stream parameters that were added to the input_stream_parameters attribute are given in value_dict
ValueError – If the given value_dict contains invalid types
- Return type:
None
- add_available_gettables(gettables)
Adds given gettables to the list of all gettables
- Parameters:
gettables (
list) – List of GettableParameters- Return type:
None
- get_sequence_path()
Returns its name since Measurement is the top level
- add_input_stream_parameter(parameter)
Adds given parameter to input stream parameters
- Return type:
None
- advance_input_streams(new_value_dict)
Advances all input streams by one step with the new given values
- Parameters:
new_value_dict (
dict) – Dictionary containing all parameters and their new values- Return type:
None
- qua_check_step_requirements(action, requirements_list=None)
Checks if the qua variables corresponding to the given save requirements are true and save results to GettableParameters. Otherwise continue without saving. This is useful for feedback sequences or conditional operations.
- find_parameter_from_sub_sequence(attr_path)
Returns the parameter from a given path
- Return type:
- add_step_requirement(requirement)
Adds a bool qua variable as a step requirement for the measurement
- Return type:
None
- add_subsequences_from_dict(subsequence_dict, namespace_to_add_to=None)
Adds subsequences to the sequence from a given dictionary
- Parameters:
subsequence_dict (
dict) – Dictionary containing the subsequencesnamespace_to_add_to (
dict) – Name space to insert the subsequence into (e.g locals(), globals()) defaults to None
- Return type:
None
- get_qc_measurement(measurement_name=None)
Creates a QCoDeS measurement from the given experiment
- Parameters:
measurement_name (
str) – Name of the QCoDeS measurement (as it will be saved in the database)- Returns:
Measurement instance
- Return type:
Measurement
- get_xr_dataset_and_id()
Creates a QCoDeS dataset from the given experiment TODO: THIS NEEDS TO BE IN QCODES MEASUREMENT RUNNER
- Returns:
Dataset instance
- Return type:
tuple[Dataset,int]
- run_measurement(ext_sweep_list=None, inner_func=None, qua_program_save_path=None, opx_address=None, measurement_backend='qcodes')
Runs the measurement with the given sweep list based on MeasurementRunner class TODO: add default save path!
- Parameters:
ext_sweep_list (
list[dict] |None) – List of dictionaries with parameters as keys and np.ndarrays as setpoints. Each list entry creates one sweep axis. If you want to sweep params concurrently enter more entries into their sweep dictinner_func (callable) – The function to be executed for each setpoint in the sweep list (e.g on every opx data fetch)
qua_program_save_path (
str|None) – The file path to save the compiled QUA program. Defaults to None. If not given, the program is being auto-saved next to the database.opx_address (
str|None) – The address of the OPX. Defaults to None. If not given does not attempt to connect to the OPX.measurement_backend (
str) – The measurement backend to use. Can be either ‘qcodes’ or ‘native’.
- Return type:
Dataset
- get_measurement_runner(ext_sweep_list=None, measurement_backend='qcodes')
Returns the measurement runner for the current measurement
- Parameters:
ext_sweep_list (
list[dict] |None) – List of dictionaries with parameters as keys and np.ndarrays as setpoints. Each list entry creates one sweep axis. If you want to sweep params concurrently enter more entries into their sweep dictmeasurement_backend (
str) – The measurement backend to use. Can be either ‘qcodes’ or ‘native’.
- Returns:
The measurement runner instance
- Return type:
MeasurementRunnerBase
- wait_until_result_buffer_full(progress_tracker=None)
Waits until the result buffer is full and updates the progress bar if given
- Parameters:
progress_bar (tuple) – Tuple containing the progress bar and the total number of results
- fetch_all_results()
Fetches all results from the quantum machine
- Returns:
Contains a dict with result names and results as key value pair
- Return type:
dict
Module containing ParameterClass
- class arbok_driver.parameter_class.ParameterClass
Parent for shared identity for the parameter classes every sub-sequence should own
- class arbok_driver.parameter_class.EmptyParameterClass
Empty ParameterClass for all sub-sequences that require no parameters
Module containing ParameterType classes
- class arbok_driver.parameter_types.ParameterMap(_mapping)
- class arbok_driver.parameter_types.Time(*args, var_type=None, element=None, **kwargs)
Cycles sequence parameter. Parameter values and sweeps are given in units of FPGA cycles (4 ns). The parameter is converted to seconds before being registered to a measurement.
- unit = 's'
‘cycles’
- Type:
Default
- var_type
Default: int
alias of
int
- sweep_validator: Arrays = None
Numbers
- Type:
Default
- convert_to_real_units(value)
Converts the value of the parameter to real units
- Parameters:
value (float|int) – Value to be converted
- Returns:
Converted value
- Return type:
float|int
- class arbok_driver.parameter_types.String(*args, var_type=None, element=None, **kwargs)
- unit = 'N/A'
‘N/A’
- Type:
Default
- var_type
Default: str
alias of
str
- scale = None
Strings
- Type:
Default
- class arbok_driver.parameter_types.Voltage(*args, var_type=None, element=None, **kwargs)
- unit = 'V'
‘V’
- Type:
Default
- var_type
Default: fixed
alias of
fixed
- sweep_validator: Arrays = <MultiTypeOr: Numbers, Arrays, shape: None>
Numbers
- Type:
Default
- class arbok_driver.parameter_types.Frequency(*args, var_type=None, element=None, **kwargs)
- unit = 'Hz'
‘Hz’
- Type:
Default
- var_type
Default: ‘qua.fixed’
alias of
int
- sweep_validator: Arrays = <MultiTypeOr: Numbers, Arrays, shape: None>
Numbers
- Type:
Default
- class arbok_driver.parameter_types.Amplitude(*args, var_type=None, element=None, **kwargs)
- unit = None
- var_type
Default: fixed
alias of
fixed
- sweep_validator: Arrays = <MultiTypeOr: Numbers -2<=v<=2, Arrays, shape: None>
Numbers
- Type:
Default
- class arbok_driver.parameter_types.List(*args, var_type=None, element=None, **kwargs)
- unit = 'N/A'
‘N/A’
- Type:
Default
- var_type = None
str
- Type:
Default
- scale = None
Strings
- Type:
Default
- class arbok_driver.parameter_types.Int(*args, var_type=None, element=None, **kwargs)
- var_type
alias of
int
- unit = '#'
int
- Type:
Default
- class arbok_driver.parameter_types.Boolean(*args, var_type=None, element=None, **kwargs)
- var_type
Default: int
alias of
bool
- class arbok_driver.parameter_types.Radian(*args, var_type=None, element=None, **kwargs)
- var_type
alias of
fixed
- class arbok_driver.parameter_types.Pi(*args, var_type=None, element=None, **kwargs)
- var_type
alias of
fixed
Module containing functions for path finding objects within the Arbok driver.
- arbok_driver.path_finders.get_gettable_from_read_sequence(read_sequence, signal_name, gettable_name)
Helper method to get a gettable from this readout. This is used
- Parameters:
read_sequence (
ReadSequence) – The read sequence to get the gettable fromsignal_name (
str) – Name of the signalgettable_name (
str) – Name of the gettable
- Raises:
KeyError – If the signal or gettable is not found in the read sequence
KeyError – If the GettableParameter is not found in the signal
ValueError – If the found object is not a child class of GettableParameter
- Return type:
- arbok_driver.path_finders.get_sequence_from_measurement_path(measurement, path)
Get a sequence from a measurement by resolving the given attribute path.
- Parameters:
measurement (
Measurement) – The measurement to get the read sequence frompath (
str|list[str]) – The attribute path to the read sequence relative to the measurement
- Returns:
The sub-sequence found at the given path
- Return type:
- arbok_driver.path_finders.get_read_sequence_from_measurement_path(measurement, path)
Get a read sequence from a measurement by resolving the given attribute path.
- Parameters:
measurement (
Measurement) – The measurement to get the read sequence frompath (
str|list[str]) – The attribute path to the read sequence relative to the measurement
- Returns:
The read sequence found at the given path
- Return type:
- arbok_driver.path_finders.get_read_sequence_from_readout_path(readout, path)
Get a read sequence from a readout by resolving the given attribute path.
- Parameters:
readout (
AbstractReadout) – The readout to get the read sequence frompath (
str|list[str]) – The attribute path to the read sequence relative to the readout
- Returns:
The read sequence found at the given path
- Return type:
- arbok_driver.path_finders.get_params_with_prefix(sub_sequence, prefix)
Finds all parameters in a sub-sequence that have the given prefix in their name. TODO: This is not a very clean solution, make more readable
- Parameters:
prefix (
str) – Prefix of the element parameters- Returns:
Dictionary with suffixes as keys and parameters as values
- Return type:
dict
- arbok_driver.path_finders.get_gettable_from_measurement_path(measurement, path)
Get a gettable from a measurement by resolving the given attribute path.
- Parameters:
measurement (
Measurement) – The measurement to get the gettable frompath (
str|list[str]) – The attribute path to the gettable relative to the measurement
- Returns:
The gettable found at the given path
- Return type:
Module containing the ReadSequence class
- class arbok_driver.read_sequence.ReadSequence(parent, name, sequence_config)
Baseclass for sequences containing readouts
- property signals
Signals registered in this sequence
- property readout_groups
All configured readout groups
- property abstract_readouts
All abstract readouts in this read-sequence
- qua_declare()
QUA variable and stream declaration based on the given sequence configuration. Only to be called within qua.program() context manager!
- qua_stream()
Saves acquired results to qua stream Only to be called within qua.program() context manager!
- add_gettable(gettable)
Adds a gettable parameter to the read sequence. This is used to make the gettable fetchable during a measurement.
- Parameters:
gettable (
GettableParameterBase) – Gettable parameter to be added- Return type:
None
Module containing BaseSequence class
- class arbok_driver.sequence_base.SequenceBase(parent, name, sequence_config=None, check_step_requirements=False, **kwargs)
Class describing a subsequence of a QUA programm (e.g Init, Control, Read).
- classmethod config_template()
The user can get an example config template. This feature is useful if building from scratch or for UI prompting.
- Return type:
dict|None- Returns:
A dictionary with an example config template.
- property opx_config: FullQuaConfig
OPX configuration used to compile the QUA program. Some operations in arbok automatically introduce new pulses and waveforms. Therefore the config you set on the device can be extended
- qua_declare()
Contains raw QUA code to initialize the qua variables
- Return type:
None
- qua_before_sweep()
Contains raw QUA code that is being executed before sweeps
- Return type:
None
- qua_before_sequence()
Contains raw QUA code that is being executed before the sequence
- Return type:
None
- qua_sequence()
Contains raw QUA code to define the pulse sequence
- Return type:
None
- qua_after_sequence()
Contains raw QUA code that is being executed after the sequence
- Return type:
None
- qua_stream()
Contains raw QUA code to define streams
- Return type:
None
- property sub_sequences: list[SubSequence]
List of `SubSequences`s that build the given sequence
- property gettables: list
List of GettableParameter`s that can be registered for acquisition in a `program
- add_subsequence(new_sequence)
Adds a subsequence to self
- Return type:
None
- add_qc_params_from_config(config)
Creates QCoDeS parameters for all entries of the config TODO: Use custom Parameter types for times -> setting in ns ! (cycles)
use validator to check if ns are a multiple of 4 (1 cycle)
TODO: if voltage add scale = 0.5 and validate if |v| <= 0.5
- Parameters:
config (dict) – Configuration containing all sequence parameters
- draw_sub_sequence_tree()
Draws a tree of the subsequences of the sequence with their names and types
- Return type:
None
- get_qua_program_as_str(recompile=False)
Returns the qua program as str. Will be compiled if it wasnt yet
- Return type:
str
- get_qua_program(simulate=False, config=None)
Composes the entire sequence by searching recursively through init, sequence and stream methods of all subsequences and their subsequences. The respective qua sequence will only be added once the recursive scans have reached the lowest level of sequences (e.g sequences have no sub-sequences anymore)
- Parameters:
simulate (bool) – Flag whether program is simulated
- Returns:
Program compiled into QUA language
- Return type:
Program
- get_qua_code(simulate=False)
Composes the entire qua sequence in qua code. Only execurte with qm.qua.program() environment
- Parameters:
simulate (bool) – True if program is generated for simulation
- Return type:
None
- print_qua_program_to_file(file_name)
Creates file with ‘filename’ and prints the QUA code to this file
- qua_declare_sweep_vars()
Declares all sweep variables as QUA with their correct type
- Return type:
None
- recursive_sweep_generation(sweeps)
Recursively generates QUA parameter sweeps by introducing one nested QUA loop per swept axis. The last given sweep and its corresponding setpoints are in the innermost loop. TODO: Reimplement a fast version of this for non-paired parameter
sweeps
- Parameters:
sweeps (list) – list of Sweep objects
- reset()
On reset, ensure param validators are no longer sweep_validators
- Return type:
None
- remove_subsequences()
Removes all subsequences from the sequence
- Return type:
None
- run_remote_simulation(host, port, duration)
Simulates the MW sequence on a remote simulator on the host
- Parameters:
host (str) – Host address
duration (
int) – Amount of cycles (4ns/cycle) to simulate
- Returns:
QM job containing simulation results
- Return type:
SimulatedJob
- find_parameters_from_keywords(keys, elements=None)
Returns a list containing all parameters of the seqeunce with names that contain one of names in the ‘keys’ list. TODO: - raise error if no params were found
- Parameters:
keys (
str|list) – string with parameter name sub-string or list of thoseelements (
list[str] |None)
- Return type:
dict- Returns:
- Dict of parameters containing substrings from keys in their name
with element as key
- find_parameters(key, elements=None)
Finds all parameters generated from elements and a the given key. Similar to find_parameters_from_keywords but returns a non nested dict with elements as keys and SequenceParameters as key. This function gets its elements straigt from the given quantum machines config, therefore only params with elements that are known to the hardware are returned.
- Parameters:
key (
str) – Name of the searched parameterselements (
list|None) – List of elements to be searched for
- Returns:
Dict with all found SequenceParameters and elements as keys
- Return type:
dict
- find_parameter(key, element)
Returns parameter with a certain key for a given element
- get_attribute_by_path(path)
Access a nested attribute using a dot-separated string. :type path: :param path: a dot delimited path to get the variable from.
- Returns:
The variable matching the string path
- find_parameter_from_str_path(path)
Returns the parameter from the given path
- Parameters:
path (
str|list[str]) – Path to the parameter- Returns:
Parameter at the given path
- Return type:
- ask_raw(*args)
Overwrites abstract method
- set_raw(*args)
Overwrites abstract method
- set_params_with_unit_to_value(unit, value)
Sets all parameters with the given unit to the given value
- Parameters:
unit (
str) – Unit of the parameters to be setvalue (
any) – Value to be set
- Return type:
None
Module containing signal class
- class arbok_driver.signal.Signal(name, read_sequence)
Class managing voltage signal from certain readout elements of OPX
- property gettables: dict[str, GettableParameterBase]
Dictionary with all gettables registered on the signal
- add_gettable(gettable)
Adds a gettable parameter to the signal
- Parameters:
gettable (
GettableParameterBase) – Gettable parameter to be added- Return type:
None
- class arbok_driver.sqlalchemy_classes.Base(**kwargs)
- metadata: ClassVar[MetaData] = MetaData()
Refers to the
_schema.MetaDatacollection that will be used for new_schema.Tableobjects.See also
orm_declarative_metadata
- registry: ClassVar[registry] = <sqlalchemy.orm.decl_api.registry object>
Refers to the
_orm.registryin use where new_orm.Mapperobjects will be associated.
- class arbok_driver.sqlalchemy_classes.SqlRun(**kwargs)
- class arbok_driver.sqlalchemy_classes.SqlExperiment(**kwargs)
- class arbok_driver.sqlalchemy_classes.SqlDevice(**kwargs)
Module containing Sequence class
- class arbok_driver.sub_sequence.SubSequence(parent, name, sequence_config=None, check_step_requirements=False, **kwargs)
Class describing a subsequence of a QUA programm (e.g Init, Control, Read).
- property measurement: Measurement
Returns parent (sub) sequence
- qua_sequence()
Contains raw QUA code to define the pulse sequence
- map_arbok_params()
Maps required params for QUA code to arbok_params attribute
- Return type:
- add_subsequences_from_dict(subsequence_dict, namespace_to_add_to=None)
Adds subsequences to the sequence from a given dictionary
- Parameters:
subsequence_dict (
dict) – Dictionary containing the subsequencesnamespace_to_add_to (
dict|None) – Namespace to add the registered subsequences to
- Return type:
None
- find_measurement()
Recursively searches the parent sequence
- Return type:
- get_sequence_path(path=None)
Returns the path of subsequences up to the parent sequence
- Return type:
str
Module with Sweep class
- class arbok_driver.sweep.Sweep(measurement, param_dict, register_all=False)
Class characterizing a parameter sweep along one axis in the OPX
- property parameters: list[SequenceParameter]
List containing all varied parameters
- property qua_variables
Tuple containing all qua variables of parameters
- property qua_sweep_arrays
Tuple containing all qua sweep arrays of parameters
- property length: int
Length of sweep array for parameters on the given axis
- property input_streams
Returns all input streams if the sweep is set up to be streamed
- property inputs_are_streamed: bool
Whether sweep is fed by input stream
- property can_be_parameterized
Whether sweep can be parameterized with start, stop and step for memory saving. If the user has not set this value, it will be checked by the entries of the given arrays
- property config: dict[SequenceParameter, ndarray]
Config dict for parameter sweep. Keys are params, values setpoints
- property config_to_register: dict
Parameters that will be registered in QCoDeS measurement
- configure_sweep()
- Return type:
None
Configures the sweep from the given dictionairy TODO: This breaks the input stream implementation, needs to be fixed
i am quite sure this can be done more elegantly! perhaps not even using set_sweeps but a different method on measurement
- check_input_dict()
- Return type:
None
- Validates equal sizes of input arrays in three steps:
Checks if all parameters are SequenceParameter/Parameter
Checks if var_type is int, bool or qua.fixed
Checks if all sweep setpoint arrays have same lengths
Checks if all input streams have the same dimension
- qua_generate_parameter_sweep(next_action, next_sweep)
- Return type:
None
Runs a qua loop based on the configured method. Currently three different methods are available:
From input stream
From parametrized array (start, stop, step)
From an explicitly defined qua array
If the next (inner) sweep uses snaking, its direction variable is reset before entering that sweep so it starts in the correct direction.
- declare_snake_variable()
Declares the QUA boolean variable that tracks sweep direction. Initialized to False; toggled at the start of each sweep execution, so the first pass runs forward (True).
- Return type:
None
- remove_parameter_dependencies()
Removes all qcodes parameter dependencies set by is_controlled_by and has_control_of methods.
- Return type:
None
Module containing various utils
- arbok_driver.utils.plot_qmm_simulation_results(simulated_devices)
Visualizes analog and digital channel simulation results TODO: Check type of simulated_devices
- arbok_driver.utils.plotly_sim_results(simulated_devices)
Plots one graph for each analog and digital simulation result per controller
- Parameters:
simulated_results – simulated devices from qm simulator
- Returns:
plotly figure
- arbok_driver.utils.plotly_sim_results_separate(simulated_devices)
Plots one graph for each analog and digital simulation result per controller
- Parameters:
simulated_results – simulated devices from qm simulator
- Returns:
plotly figure
- arbok_driver.utils.get_all_controller_results(simulated_devices)
Takes simulated devices and returns a dict with all controller results
- Return type:
dict
- arbok_driver.utils.set_qm_logging_to_file(filename)
Changes the standart logging handle (stdout) to the given file
- arbok_driver.utils.get_module(name=None, mod_path=None)
Dynamically loads a Python module from a specified file path.
This function creates a module specification and loads the module from the provided file path.
- Parameters:
name (
str) – The desired name for the loaded module.mod_path (
str) – The absolute path to the Python module file (.py).
- Returns:
The loaded module object.
- Raises:
ImportError – If the module specification cannot be created or if the module cannot be loaded.
- arbok_driver.utils.dict_to_anytree(name, d, parent=None)
Convert a nested dictionary to an anytree structure.
Module containing GettableParameterBase class
- class arbok_driver.parameters.gettable_parameter_base.GettableParameterBase(name, read_sequence, var_type, **kwargs)
This is a valid Gettable not because of inheritance, but because it has the expected attributes and methods. TODO: zip all streams together, stream at once and unpack while opx resume TODO: interleaved measurements
- unit
Unit of the parameter
- Type:
str
- readout
Readout instance that created this parameter
- Type:
Readout
- read_sequence
ReadSequence managing the sequence of QUA program
- Type:
- abstractmethod qua_declare_variables()
Declares the qua variables and streams for this gettable
- Return type:
None
- abstractmethod qua_save_variables()
Saves acquired results to qua stream
- Return type:
None
- qua_save_streams()
Saves acquired results to qua stream
- Return type:
None
- set_raw(*args, **kwargs)
Empty abstract set_raw method. Parameter not meant to be set
- Return type:
None
- reset_measuerement_attributes()
Resets all job specific attributes
- configure_from_measurement(setpoints)
Configures the gettable parameter from the measurement object. This method sets the sweep dimensions, batch size, and snaked shape based on the sweeps defined in the measurement.
- Parameters:
setpoints (
tuple[ParameterBase,...]) – The setpoint parameters for this gettable- Return type:
None
- set_qm_buffer(qm_job)
Fetches the QM buffer result from the QM driver and assigns it to the buffer attribute.
- Parameters:
qm_driver (RunningQmJob) – The QM driver instance to fetch the buffer from.
- Return type:
None
- get_raw()
Get method to retrieve a single batch of data from a running measurement On its first call, the gettables attributes get configured regarding the given measurement and the underlying hardware.
- Return type:
ndarray
- fetch_results()
Get method to retrieve the results from the OPX buffer.
- Returns:
Reshaped data array from the OPX buffer.
- Return type:
ndarray
- unpack_self(value)
Unpacks the ParameterWithSetpoints, its setpoints and any inferred parameters controlled by the setpoints. :param value: The data acquired from this parameter. :type value:
str|complex|integer|floating|complexfloating|ndarray[Any,dtype[TypeVar(_ScalarType_co, bound=generic, covariant=True)]] |Sequence[str|complex|integer|floating|complexfloating] |Sequence[Sequence[str|complex|integer|floating|complexfloating]]- Return type:
list[tuple[ParameterBase,str|complex|integer|floating|complexfloating|ndarray[Any,dtype[TypeVar(_ScalarType_co, bound=generic, covariant=True)]] |Sequence[str|complex|integer|floating|complexfloating] |Sequence[Sequence[str|complex|integer|floating|complexfloating]]]]- Returns:
A list of tuples of parameters and values to be added as results to the dataset.
- get_mock_result()
Generates linearly increasing results filling the shape of the batch
- get_full_dims_and_coords(ext_dims, ext_coords)
Returns the full dims and coordinates for xarray DataArray generation
- Parameters:
ext_dims (
list[str]) – list of external dimesionsexternal_coords (dict)
- Return type:
tuple[list[str],dict[str,ndarray]]
Module containing GettableParameter class
- class arbok_driver.parameters.gettable_parameter.GettableParameter(name, read_sequence, var_type, **kwargs)
Gettableparameter class handling sclar results from an abstract readout
- qua_declare_variables()
Saves acquired results to qua stream
- qua_save_variables()
Saves acquired results to qua stream
- set_raw(*args, **kwargs)
Empty abstract set_raw method. Parameter not meant to be set
- Return type:
None
- reset_measuerement_attributes()
Resets all job specific attributes
Module containing GettableParameter class
- class arbok_driver.parameters.gettable_parameter_multi.GettableParameterMulti(name, read_sequence, var_type, internal_setpoints, **kwargs)
GettableParameterMulti class handling high dimensional results from an abstract readout
- qua_declare_variables()
Declares the qua variables and streams for this gettable
- Return type:
None
- qua_save_variables()
Saves acquired results to qua stream
- Return type:
None
- reset_measuerement_attributes()
Resets all job specific attributes
- configure_from_measurement(setpoints)
Configures the gettable parameter from the measurement object. This method sets the sweep dimensions, batch size, and snaked shape based on the sweeps defined in the measurement.
- get_length()
Calculates length of internal sweep
- Return type:
int
Module containing SequenceParameter class
- class arbok_driver.parameters.sequence_parameter.SequenceParameter(*args, var_type=None, element=None, **kwargs)
A parameter wrapper that adds the respective element as attribute
TODO: Write get_raw abstract method without crashing sequence compilation
- qua_type
alias of
int
- property sequence_path: str
Returns the path through all parent sequences above
- property full_name: str
Returns the full name of the parameter
- property qua: T_co
Getter method for parameter
- convert_to_real_units(value)
Converts the value of the parameter to real units
- Parameters:
value (float|int) – Value to be converted
- Returns:
Converted value
- Return type:
float|int
- call_method(value=None, **kwargs)
Method being executed when SequenceParameter is called.
- Parameters:
value (
Union[float,int,ndarray,None]) – Value if given sets- Returns:
Parameter value if no input value is given
- Return type:
Optional[TypeVar(T_co, covariant=True)]
- reset()
In case we have switched to a sweep state, reset the validator to a scalar.
- Return type:
None
- qua_declare(setpoints)
Declares the parameter inside qua code as variable and sets its class attributes accordingly. Note: This method can only be called inside the qua.program() context manager
- Parameters:
setpoints (list, numpy.array) – Setpoints for parameter sweep
- add_stream_param_to_sequence()
Adds input stream to sequence