qblox_scheduler.qblox.hardware_agent#
The HardwareAgent object is the goto object when running experiments on qblox hardware. It provides an interface to easily set up the hardware, run experiments, and receive results.
Attributes#
Classes#
Hardware definition of qblox backend. |
Functions#
Module Contents#
- _get_pydantic_value_or_set_default(obj: dict | pydantic.BaseModel, attribute: str, default: T = None) T[source]#
- _load_quantum_device_from_file(file: str | pathlib.Path) qblox_scheduler.device_under_test.quantum_device.QuantumDevice[source]#
- class HardwareAgent(hardware_configuration: qblox_scheduler.backends.qblox_backend.QbloxHardwareCompilationConfig | dict | str | pathlib.Path, quantum_device_configuration: dict | str | pathlib.Path | qblox_scheduler.device_under_test.quantum_device.QuantumDevice | None = None, *, debug: qblox_instruments.types.DebugLevel = DebugLevel.MINIMAL_CHECK, output_dir: pathlib.Path | str | None = None)[source]#
Hardware definition of qblox backend. Contains definitions for the cluster, the hardware configuration, and related classes to manage the instruments.
- Parameters:
hardware_configuration –
The hardware configuration. Either - a QbloxHardwareCompilationConfig instance - a dictionary as pydantic model of the QbloxHardwareCompilationConfig - a json file that stores the above dictionary
The cluster fields in “hardware_description” will have its modules field autogenerated, based on its ip field when they are not defined. This ip field is mandatory.
quantum_device_configuration – The quantum device configuration. Either - a json dictionary of the QuantumDevice - a path to the file that stores the json dictionary
debug – Debug level of the cluster. By default, it is set to DebugLevel.MINIMAL_CHECK. Available debug levels are: - DebugLevel.MINIMAL_CHECK: Check compatibility between the hardware firmware version and qblox-instruments version, and check for errors when starting and stopping sequencers. - DebugLevel.ERROR_CHECK: Check for errors after every low-level cluster command. - DebugLevel.NO_CHECK: Do not check for errors. - DebugLevel.VERSION_AND_ERROR_CHECK: Combination of DebugLEVEL.MINIMAL_CHECK and DebugLevel.ERROR_CHECK.
default_output_dir – Default output directory where the data will be stored.
- _clusters: dict[str, qblox_scheduler.instrument_coordinator.components.qblox.ClusterComponent][source]#
- _latest_compiled_schedule: qblox_scheduler.schedules.schedule.CompiledSchedule | None = None[source]#
- property hardware_configuration: qblox_scheduler.backends.qblox_backend.QbloxHardwareCompilationConfig[source]#
The (validated) hardware configuration of this hardware. Only available after the connections with the clusters have been established using connect_clusters if initially given as a file/dictionary. Note that this is not in json/dictionary format.
- add_device_elements(device_elements: collections.abc.Sequence[qblox_scheduler.device_under_test.device_element.DeviceElement]) None[source]#
Add multiple device elements to the quantum device.
- Parameters:
device_elements – list of device elements to be added
- add_edges(edges: list[qblox_scheduler.device_under_test.edge.Edge]) None[source]#
Add multiple edges to the quantum device.
- Parameters:
edges – list of edges to be added
- connect_clusters() None[source]#
Connect the defined clusters to the hardware given their identifiers.
Will also supplement the modules to the given hardware description and/or verify them.
- property quantum_device: qblox_scheduler.device_under_test.quantum_device.QuantumDevice[source]#
The quantum device active in this hardware.
The quantum device contains the device elements and how the connectivity between them is defined.
- property instrument_coordinator: qblox_scheduler.instrument_coordinator.instrument_coordinator.InstrumentCoordinator[source]#
The instrument coordinator active in this hardware.
The instrument coordinator is responsible for executing the (compiled) schedule on the instruments in this backend.
- property measurement_control: quantify_core.measurement.control.MeasurementControl[source]#
The instrument coordinator active in this hardware.
The instrument coordinator is responsible for executing the (compiled) schedule on the instruments in this backend.
- get_clusters() dict[str, qblox_instruments.Cluster][source]#
Get all the instantiated clusters.
- Returns:
A dictionary mapping cluster names to Cluster objects.
- property latest_compiled_schedule: qblox_scheduler.schedules.schedule.CompiledSchedule | None[source]#
Get the latest compiled schedule, if one exists.
- run(schedule: qblox_scheduler.schedule.Schedule | qblox_scheduler.schedules.schedule.TimeableSchedule | qblox_scheduler.schedules.schedule.CompiledSchedule, *, timeout: int = 10, save_to_experiment: bool = True, save_snapshot: bool = True) xarray.Dataset[source]#
Run a schedule on the hardware.
- Parameters:
schedule – The schedule to run.
timeout – The timeout for retrieving the results, in seconds
save_to_experiment – Whether to save the dataset to an experiment directory. The dataset and (optionally) snapshot will be saved in <datadir>/<tuid>/dataset.hdf5 and <datadir>/<tuid>/snapshot.json, where datadir is specified by
set_datadir()andget_datadir()save_snapshot – Whether to save a snapshot of the experiment
- Returns:
Acquisition result dataset if any acquisitions are used in the schedule. Empty dataset otherwise.
- Raises:
TimeoutError – When hardware doesn’t return results in the given timeout.
- compile(schedule: qblox_scheduler.schedules.schedule.TimeableSchedule) qblox_scheduler.schedules.schedule.CompiledSchedule[source]#
Compile the schedule to the hardware. Compilation is already done in the run method, so run this method only if the compiled schedule requires to be investigated.
- Parameters:
schedule – The TimeableSchedule to compile for this hardware
- Returns:
The compiled schedule
- static set_output_data_dir(datadir: pathlib.Path | str | None = None) None[source]#
Sets the output data directory.
- Parameters:
datadir – Path of the data directory. If set to
None, resets the datadir to the default datadir (<top_level>/data).
- _verify_hardware_configuration() None[source]#
Verifies if the given hardware configuration can be run on the cluster.
- Raises:
TypeError – When the hardware_configuration has not been correctly initialized yet.
ValueError – When the hardware configuration does not match the modules installed on the cluster.
- _create_cluster(cluster_name: str, cluster_description: dict | qblox_scheduler.backends.types.qblox.ClusterDescription) qblox_instruments.Cluster[source]#
- _create_dummy_cluster(cluster_name: str, cluster_description: dict | qblox_scheduler.backends.types.qblox.ClusterDescription) qblox_instruments.Cluster[source]#