inquanto-nexus

InQuanto Nexus extension.

class ProtocolAnnotations(name=None, description=None, properties=None)

Annotations describing information about circuits or jobs which will be created in Nexus.

Parameters:
  • name (Optional[str], default: None) – Name of the circuit or job to be created in Nexus.

  • description (Optional[str], default: None) – Description of the circuit or job to be created in Nexus.

  • properties (Optional[OrderedDict[str, bool | int | float | str]], default: None) – Properties of the circuit or job to be created in Nexus. Note

class QNexusAdapter(target, project_ref)

Adapter for accessing backends through qNexus.

Implements all methods that directly interact with the backend for all users with Nexus subscriptions.

Parameters:
  • target (Union[AerConfig, AerStateConfig, AerUnitaryConfig, BraketConfig, QuantinuumConfig, IBMQConfig, IBMQEmulatorConfig, ProjectQConfig, QulacsConfig]) – Target backend to use for quantum computations.

  • project_ref (ProjectRef) – Reference to the Nexus project where experiments will be stored.

get_compiled_circuit(circ, optimisation_level, compile_job_annotations=None, circuit_annotations=None, **kwargs)

Uploads, compiles then retrieves the measurement circuit from Nexus.

Parameters:
  • circ (Circuit) – The measurement circuit.

  • optimisation_level (int) – Level of circuit optimisation.

  • compile_job_annotations (Optional[ProtocolAnnotations], default: None) – Annotations with information about the Nexus compilation job.

  • circuit_annotations (Optional[ProtocolAnnotations], default: None) – Annotations with information about the circuits uploaded to Nexus.

Raises:

ResourceCreateFailed – If the circuit or job could not be submitted to Nexus.

Returns:

Circuit – A compiled measurement circuit.

get_compiled_circuits(circs, optimisation_level, compile_job_annotations=None, circuit_annotations=None, **kwargs)

Uploads, compiles then retrieves the measurement circuit from Nexus.

Parameters:
  • circs (Sequence[Circuit]) – Measurement circuits.

  • optimisation_level (int) – Level of circuit optimisation.

  • compile_job_annotations (Optional[ProtocolAnnotations], default: None) – Annotations with information about the Nexus compilation job.

  • circuit_annotations (Optional[ProtocolAnnotations], default: None) – Annotations with information about the circuits uploaded to Nexus.

Raises:

ResourceCreateFailed – If the circuit or job could not be submitted to Nexus.

Returns:

list[Circuit] – Compiled measurement circuits.

get_results(handles)

Returns results of the execution job from Nexus.

Parameters:

handles (list[ResultHandle]) – Result handles.

Raises:
  • ResourceFetchFailed – If the results could not be fetched from Nexus.

  • ZeroMatches – If no results could be found.

Returns:

list[BackendResult] – Results from the circuit execution.

process_circuits(circs, n_shots=None, execute_job_annotations=None, **kwargs)

Starts an execution job of the compiled circuits on Nexus.

Parameters:
  • circs (Sequence[Circuit]) – Circuits to process on the backend.

  • n_shots (Optional[list[int]], default: None) – Number of shots for each circuit.

  • execute_job_annotations (Optional[ProtocolAnnotations], default: None) – The name of the execution job for all executed circuits.

Raises:

ResourceCreateFailed – If the circuit or job could not be submitted to Nexus.

Returns:

list[BackendResult] – Results from the circuit execution.