beforewards

Experiment - Beforewards (qurry.qurrium.experiment.beforewards)

class qurry.qurrium.experiment.beforewards.Before(target: list[tuple[Hashable, QuantumCircuit | str]], target_qasm: list[tuple[str, str]], circuit: list[QuantumCircuit], circuit_qasm: list[str], job_id: list[str], side_product: dict[str, Any])[source]

The data of experiment will be independently exported in the folder ‘advent’, which generated before the experiment.

circuit: list[QuantumCircuit]

The transpiled circuits of experiment.

circuit_qasm: list[str]

The OpenQASM of transpiled circuits.

static default_value()[source]

These default value are used for autofill the missing value.

export(export_transpiled_circuit: bool = False) tuple[dict[str, Any], dict[str, Any]][source]

Export the experiment’s data before executing.

Parameters:

export_circuit (bool, optional) – Whether to export the transpiled circuit as txt. Defaults to False. for It’s space-saving purpose and performance improvement. When set to True, the transpiled circuit will be draw as txt. Otherwise, the circuit will be not exported but circuit qasm remains.

Returns:

The experiment’s arguments, and the experiment’s side product.

Return type:

tuple[dict[str, Any], dict[str, Any]]

job_id: list[str]

ID of job for pending on real machine (IBMQBackend).

classmethod read(file_index: dict[str, str], save_location: Path) Before[source]

Read the exported experiment file.

Parameters:
  • file_index (dict[str, str]) – The index of exported experiment file.

  • save_location (Path) – The location of exported experiment file.

Returns:

The experiment’s arguments, the experiment’s common parameters, and the experiment’s side product.

Return type:

tuple[dict[str, Any], “Before”, dict[str, Any]]

revive_circuit(replace_circuits: bool = False) list[QuantumCircuit][source]

Revive the circuit from the qasm, return the revived circuits.

Parameters:

replace_circuits (bool, optional) – Whether to replace the circuits. Defaults to False.

Raises:

ValueError – If the .circuit is not empty.

Returns:

The revived circuits.

Return type:

list[QuantumCircuit]

revive_target(replace_target: bool = False) dict[Hashable, QuantumCircuit][source]

Revive the target circuits from the qasm, return the revived target.

Parameters:

replace_target (bool, optional) – Whether to replace the target circuits. Defaults to False.

Raises:

ValueError – If the .target is not empty.

Returns:

The revived target circuits.

Return type:

dict[Hashable, QuantumCircuit]

side_product: dict[str, Any]

The data of experiment will be independently exported in the folder ‘tales’.

target: list[tuple[Hashable, QuantumCircuit | str]]

The target circuits of experiment.

target_qasm: list[tuple[str, str]]

The OpenQASM of target circuits.

qurry.qurrium.experiment.beforewards.create_beforewards(beforewards: Before | None) Before[source]

Create a Beforewards object.

Parameters:

beforewards (Optional[Before]) – The Beforewards object to create. Defaults to None.

Returns:

The Beforewards object.

Return type:

Before

Raises:

TypeError – If ‘beforewards’ is not a Before object or None.

qurry.qurrium.experiment.beforewards.v5_to_v7_field_transpose(advent: dict[str, Any]) dict[str, Any][source]

Transpose the v5 field to v7 field.

qurry.qurrium.experiment.beforewards.v7_to_v11_field_transpose(advent: dict[str, Any]) dict[str, Any][source]

Transpose the v7 field to v11 field.