circuits¶
Client API for circuits in Nexus.
- qnexus.client.circuits.cost(
- circuit_ref: CircuitRef | list[CircuitRef],
- n_shots: int | list[int],
- backend_config: Annotated[AerConfig | AerStateConfig | AerUnitaryConfig | BraketConfig | QuantinuumConfig | IBMQConfig | IBMQEmulatorConfig | QulacsConfig | SeleneConfig | SelenePlusConfig | HeliosConfig, FieldInfo(annotation=NoneType, required=True, discriminator='type')],
- syntax_checker: str | None = None,
- project: ProjectRef | None = None,
Estimate the cost (in HQC) of running Circuit programs for n_shots number of shots on a Quantinuum H2 system.
- NB: This will execute a costing job on a dedicated cost estimation device.
Once run, the cost will be visible also in the Nexus web portal as part of the job.
If a project is not provided, it will be taken from either the active context or the ProjectRef listed on the first CircuitRef.
Future versions of this function will require a ProjectRef to be provided.
- qnexus.client.circuits.get(
- *,
- id: UUID | str | None = None,
- name: str | None = None,
- name_like: str | None = None,
- creator_email: list[str] | None = None,
- project: ProjectRef | None = None,
- properties: OrderedDict[str, bool | int | float | str] | None = None,
- created_before: datetime | None = None,
- created_after: datetime | None = datetime.datetime(2023, 1, 1, 0, 0),
- modified_before: datetime | None = None,
- modified_after: datetime | None = None,
- sort_filters: list[SortFilterEnum] | None = None,
- page_number: int | None = None,
- page_size: int | None = None,
- scope: ScopeFilterEnum = ScopeFilterEnum.USER,
Get a single circuit using filters. Throws an exception if the filters do not match exactly one object.
Examples
>>> import qnexus as qnx >>> circuit_ref = qnx.circuits.get(name="my_circuit", project=project_ref)
- qnexus.client.circuits.get_all(
- *,
- name_like: str | None = None,
- name_exact: list[str] | None = None,
- creator_email: list[str] | None = None,
- project: ProjectRef | None = None,
- properties: OrderedDict[str, bool | int | float | str] | None = None,
- created_before: datetime | None = None,
- created_after: datetime | None = datetime.datetime(2023, 1, 1, 0, 0),
- modified_before: datetime | None = None,
- modified_after: datetime | None = None,
- sort_filters: list[SortFilterEnum] | None = None,
- page_number: int | None = None,
- page_size: int | None = None,
- scope: ScopeFilterEnum = ScopeFilterEnum.USER,
Get a NexusIterator over circuits with optional filters.
Examples
>>> import qnexus as qnx >>> all_circuits = qnx.circuits.get_all(project=project_ref) >>> all_circuits.df()
>>> qnx.circuits.get_all(name_like="bell", project=project_ref)
- qnexus.client.circuits.update(
- ref: CircuitRef,
- name: str | None = None,
- description: str | None = None,
- properties: OrderedDict[str, bool | int | float | str] | None = None,
Update the annotations on a CircuitRef.
Examples
>>> import qnexus as qnx >>> updated_ref = qnx.circuits.update( ... circuit_ref, ... name="renamed_circuit", ... properties={"version": 2}, ... )
- qnexus.client.circuits.upload(
- circuit: Circuit,
- project: ProjectRef | None = None,
- name: str | None = None,
- description: str | None = None,
- properties: OrderedDict[str, bool | int | float | str] | None = None,
Upload a pytket Circuit to Nexus.
Examples
>>> import qnexus as qnx >>> from pytket.circuit import Circuit >>> circuit = Circuit(2).H(0).CX(0, 1).measure_all() >>> circuit_ref = qnx.circuits.upload( ... circuit=circuit, ... name="bell_state", ... project=project_ref, ... )