arbok_driver package
Submodules
arbok_driver.abstract_readout module
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]
- 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:
GettableParameter
- 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:
GettableParameterMulti
- 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:
GettableParameter- 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
arbok_driver.arbok_driver module
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
- qm_job: RunningQmJob
- qmm: QuantumMachinesManager
- result_handles: StreamsManager
- 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) – 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:
SqlRun
- 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
arbok_driver.device module
Module containing Devices class
- class arbok_driver.device.Device(name, opx_config, divider_config, master_config=None)
Bases:
objectClass describing the used device by its config and the used sequence.
- master_config: dict = None
- property master_config_path
Getter for master_config.
- Returns:
The current configuration dictionary.
- Return type:
str
- reload_master_config()
If the master config path is set, force reloading
arbok_driver.experiment module
Module containing abstract class for experiments
- class arbok_driver.experiment.Experiment(**configs_to_prepare)
Bases:
ABCAbstract 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
- get_sequences_config(device)
- Return type:
dict
arbok_driver.generic_tunig_interface module
Module containing GenericTuningInterface class.
- class arbok_driver.generic_tunig_interface.CostStrategy(gettables, sweeps)
Bases:
ABCAbstract base class for cost evaluation strategies.
A
CostStrategyencapsulates the logic required to compute a scalar cost value from one or more measurement outputs (“gettables”). Different implementations allow flexible optimization objectives without modifying the tuning interface.- Parameters:
gettables (
list[GettableParameterBase]) – List of measurement parameters that provide the data required to compute the cost.
- abstractmethod get_cost(results)
Compute and return the current cost value.
This method must be implemented by subclasses. It should read the relevant data from
self.gettablesand return a single scalar value representing the cost.- Returns:
The computed cost value.
- Return type:
float
- class arbok_driver.generic_tunig_interface.GenericTuningInterface(measurement, parameter_dicts, cost_strategy, verbose=False)
Bases:
objectGeneric 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:
- cost_strategy
Strategy object used to compute the optimization cost.
- Type:
- parameter_dict
Dictionary describing tunable parameters and their configurations.
- Type:
dict[str, dict]
- bounds
Parameter bounds used during optimization.
- Type:
dict[str, tuple]
- input_stream_params
Parameters streamed into the QUA program.
- Type:
list[SequenceParameter]
- gettables
Mapping of measurement outputs used for cost evaluation.
- Type:
dict[str, GettableParameterBase]
- qua_program
Compiled QUA program used for execution.
- Type:
_ProgramScope
- 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_params (list) – List of parameters to run
progress_bar (Optional) – Progress bar to update
- Returns:
Reward/cost of the parameter set dict: All measured gettables for the parameter set dict: All parameters of the parameter set
- Return type:
tuple[float,dict,dict]
- run_cross_entropy_sampler(populations, 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 iterationselect_frac (
float) – Fraction of best parameters to select for generation of new boundssampling_params_to_plot (
list|None) – List of tuples containing parameter names to plot during the sampling process
- Returns:
- Dataset containing all gettables, parameters and
rewards
- Return type:
Dataset
- arbok_driver.generic_tunig_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
arbok_driver.gettable_parameter module
arbok_driver.measurement module
Module containing the Measurement class
- class arbok_driver.measurement.Measurement(parent, name, sequence_config=None)
Bases:
SequenceBaseClass describing a Measurement in an OPX driver
- shot_tracker_qua_var: QuaVariable
- shot_tracker_qua_stream: ResultStreamSource
- 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]) – 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) – Keywords to find gettables by name
- Return type:
None
- get_qua_code(simulate=False)
Compiles all qua code from its sub-sequences and writes their loops
- Parameters:
simulate (bool) – True if the program is meant to be simulated
- Return type:
QuaProgram
- Reterns:
qua_program: Program from qm context manager
- compile_qua_and_run(save_path=None)
Compiles the QUA code and runs it
- Return type:
QuaProgram
- initialize_tuning_interface(parameter_dicts, cost_strategy, 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:
SequenceParameter
- 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) – 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) – 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
arbok_driver.measurement_runner module
arbok_driver.observable module
arbok_driver.parameter_types module
Module containing ParameterType classes
- class arbok_driver.parameter_types.ParameterMap(_mapping)
Bases:
Mapping[K,V],Generic[K,V]
- class arbok_driver.parameter_types.Time(*args, var_type=None, element=None, **kwargs)
Bases:
SequenceParameter[int]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
- vals = <Ints>
- scale = 1
- sweep_validator = 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)
Bases:
SequenceParameter[str]- unit = 'N/A'
‘N/A’
- Type:
Default
- var_type
Default: str
alias of
str
- vals = <Strings>
- scale = None
Strings
- Type:
Default
- sweep_validator = <MultiTypeOr: Strings, Arrays, shape: None>
- class arbok_driver.parameter_types.Voltage(*args, var_type=None, element=None, **kwargs)
Bases:
SequenceParameter[float|QuaVariable]- unit = 'V'
‘V’
- Type:
Default
- var_type
Default: fixed
alias of
fixed
- vals = <Numbers>
- scale = 1
- sweep_validator = <MultiTypeOr: Numbers, Arrays, shape: None>
Numbers
- Type:
Default
- class arbok_driver.parameter_types.Frequency(*args, var_type=None, element=None, **kwargs)
Bases:
SequenceParameter[int|QuaVariable]- unit = 'Hz'
‘Hz’
- Type:
Default
- var_type
Default: ‘qua.fixed’
alias of
int
- vals = <Numbers>
- scale = 1
- sweep_validator = <MultiTypeOr: Numbers, Arrays, shape: None>
Numbers
- Type:
Default
- class arbok_driver.parameter_types.Amplitude(*args, var_type=None, element=None, **kwargs)
Bases:
SequenceParameter[float|QuaVariable[NumberT] |QuaLiteral[NumberT] |QuaBinaryOperation[NumberT] |QuaArrayCell[NumberT] |QuaArrayLength[NumberT] |QuaLibFunctionOutput[NumberT] |QuaFunctionOutput[NumberT] |QuaBroadcast[NumberT] |NumberT]- unit = None
- var_type
Default: fixed
alias of
fixed
- vals = <Numbers -2<=v<=2>
- scale = 1
- sweep_validator = <MultiTypeOr: Numbers -2<=v<=2, Arrays, shape: None>
Numbers
- Type:
Default
- class arbok_driver.parameter_types.List(*args, var_type=None, element=None, **kwargs)
Bases:
SequenceParameter[list]- unit = 'N/A'
‘N/A’
- Type:
Default
- var_type = None
str
- Type:
Default
- vals = <Sequence : len: None sorted: False <Anything>>
- scale = None
Strings
- Type:
Default
- sweep_validator = <Sequence : len: None sorted: False <Anything>>
- class arbok_driver.parameter_types.Int(*args, var_type=None, element=None, **kwargs)
Bases:
SequenceParameter[int|QuaVariable]- var_type
Default: int
alias of
int
- vals = <Ints>
- scale = 1
- sweep_validator = <MultiTypeOr: Numbers, Arrays, shape: None>
- class arbok_driver.parameter_types.Boolean(*args, var_type=None, element=None, **kwargs)
Bases:
SequenceParameter[bool]- var_type
Default: int
alias of
bool
- vals = <Boolean>
- scale = None
- sweep_validator = None
- class arbok_driver.parameter_types.Radian(*args, var_type=None, element=None, **kwargs)
Bases:
SequenceParameter[float]- unit = 'pi'
- var_type
alias of
fixed
- vals = <Numbers -6.283185307179586<=v<=6.283185307179586>
- scale = 1
- sweep_validator = <MultiTypeOr: Numbers -6.283185307179586<=v<=6.283185307179586, Arrays, shape: None>
arbok_driver.qua_helpers module
arbok_driver.read_sequence module
Module containing the ReadSequence class
- class arbok_driver.read_sequence.ReadSequence(parent, name, sequence_config)
Bases:
SubSequenceBaseclass 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
arbok_driver.readout_point module
arbok_driver.sequence_base module
Module containing BaseSequence class
- class arbok_driver.sequence_base.SequenceBase(parent, name, sequence_config=None, check_step_requirements=False, **kwargs)
Bases:
InstrumentModule,ABCClass describing a subsequence of a QUA programm (e.g Init, Control, Read).
- PARAMETER_CLASS: type[ParameterClass]
- 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:
None- Returns:
A dictionary with an example config template.
- 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
- get_parameters_and_maps(param_names)
- Return type:
dict[str,SequenceParameter|ParameterMap]
- 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:
QuaProgram
- 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
- 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:
SequenceParameter
- 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
arbok_driver.sequence_parameter module
arbok_driver.signal module
Module containing signal class
- class arbok_driver.signal.Signal(name, read_sequence)
Bases:
objectClass 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
arbok_driver.sub_sequence module
Module containing Sequence class
- class arbok_driver.sub_sequence.SubSequence(parent, name, sequence_config=None, check_step_requirements=False, **kwargs)
Bases:
SequenceBase,ABCClass 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:
ParameterClass
- 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
arbok_driver.sweep module
Module with Sweep class
- class arbok_driver.sweep.Sweep(measurement, param_dict, register_all=False)
Bases:
objectClass characterizing a parameter sweep along one axis in the OPX
- dim_parameter: SequenceParameter
- snake_scan: bool
- property parameters: list[SequenceParameter]
List containing all varied parameters
- property qua_variables: tuple(QuaVariable)
Tuple containing all qua variables of parameters
- property qua_sweep_arrays: tuple(ndarray)
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 necessary, we need to reset the snake var for the inner loop before entering the snaking loop.
- get_snake_var()
Declare a snake_var if we are snaking and return that var if snaking.
- Returns:
The snaking indicator if snaking, None otherwise
- Return type:
qua bool var
- remove_parameter_dependencies()
Removes all qcodes parameter dependencies set by is_controlled_by and has_control_of methods.
- Return type:
None
arbok_driver.utils module
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.