samplingqurry

SamplingExecuter (qurry.qurrium.samplingqurry)

It is only for pendings and retrieve to remote backend.

arguments

SamplingExecuter - Arguments (qurry.qurrium.samplingqurry.arguments)

It is only for pendings and retrieve to remote backend.

class qurry.qurries.samplingqurry.arguments.QurryAnalyzeArgs[source]

The input of the analyze method.

class qurry.qurries.samplingqurry.arguments.QurryArguments(exp_name: str, sampling: int = 1)[source]

Construct the experiment’s parameters for specific options, which is overwritable by the inherition class.

sampling: int = 1

The number of sampling.

class qurry.qurries.samplingqurry.arguments.QurryMeasureArgs[source]

Output arguments for output().

sampling: int

The number of sampling.

wave: QuantumCircuit | Hashable | None

The key or the circuit to execute.

class qurry.qurries.samplingqurry.arguments.QurryOutputArgs[source]

Output arguments for output().

sampling: int

The number of sampling.

qurry.qurries.samplingqurry.arguments.SHORT_NAME = 'sampling_executer'

The short name for this qurry instance.

analysis

SamplingExecuter - Analysis (qurry.qurrium.samplingqurry.analysis)

It is only for pendings and retrieve to remote backend.

class qurry.qurries.samplingqurry.analysis.QurryAnalysis(*, serial: int, log: dict[str, Any] | None = None, datatime: str | None = None, **other_kwargs)[source]

Example of QurryAnalysis.

classmethod content_type()[source]

The content instance type.

classmethod input_type()[source]

The input instance type.

property side_product_fields: Iterable[str]

The fields that will be stored as side product.

class qurry.qurries.samplingqurry.analysis.QurryAnalysisContent(ultimate_answer: int, dummy: int)[source]

Analysis content.

dummy: int

Just a dummy field.

ultimate_answer: int

~The Answer to the Ultimate Question of Life, The Universe, and Everything.~

class qurry.qurries.samplingqurry.analysis.QurryAnalysisInput(ultimate_question: str)[source]

To set the analysis.

ultimate_question: str

ULtImAte QueStIoN.

experiment

SamplingExecuter - Experiment (qurry.qurrium.samplingqurry.experiment)

It is only for pendings and retrieve to remote backend.

class qurry.qurries.samplingqurry.experiment.QurryExperiment(arguments: _A | dict[str, Any], commonparams: Commonparams | dict[str, Any], outfields: dict[str, Any], beforewards: Before | None = None, afterwards: After | None = None, reports: AnalysesContainer | None = None)[source]

Experiment instance for QurryV9.

property analysis_instance: Type[QurryAnalysis]

The analysis instance for this experiment.

analyze(ultimate_question: str = '', shots: int | None = None, pbar: tqdm | None = None) QurryAnalysis[source]

Analysis of the experiment.

Parameters:
  • ultimate_question (str, optional) – The ultimate question of the universe.

  • shots (Optional[int], optional) – The number of shots.

  • pbar (Optional[tqdm.tqdm], optional) – The progress bar for showing the progress of the experiment. Defaults to None.

Returns:

The analysis of the experiment.

Return type:

QurryAnalysis

property arguments_instance: Type[QurryArguments]

The arguments instance for this experiment.

classmethod method(targets: list[tuple[Hashable, QuantumCircuit]], arguments: QurryArguments, pbar: tqdm | None = None, multiprocess: bool = True) tuple[list[QuantumCircuit], dict[str, Any]][source]

The method to construct circuit.

Parameters:
  • targets (list[tuple[Hashable, QuantumCircuit]]) – The circuits of the experiment.

  • arugments (ArgumentsPrototype) – The arguments of the experiment.

  • pbar (Optional[tqdm.tqdm], optional) – The progress bar for showing the progress of the experiment. Defaults to None.

  • multiprocess (bool, optional) – Whether to use multiprocess. Defaults to True.

Returns:

The circuits of the experiment and the side products.

Return type:

tuple[list[QuantumCircuit], dict[str, Any]]

classmethod params_control(targets: list[tuple[Hashable, QuantumCircuit]], exp_name: str = 'exps', sampling: int = 1, **custom_kwargs: Any) tuple[QurryArguments, Commonparams, dict[str, Any]][source]

Control the experiment’s parameters.

Parameters:
  • targets (list[tuple[Hashable, QuantumCircuit]]) – The circuits of the experiment.

  • exp_name (str) – The name of the experiment. Defaults to “exps”.

  • sampling (int, optional) – The number of sampling. Defaults to 1.

  • custom_kwargs (Any) – The custom parameters.

Raises:

ValueError – The number of target circuits should be only one.

Returns:

The arguments of the experiment, the common parameters, and the custom parameters

Return type:

tuple[QurryArguments, Commonparams, dict[str, Any]]

classmethod quantities(shots: int | None = None, counts: list[dict[str, int]] | None = None) dict[str, float | int][source]

Computing specific squantity.

Parameters:
  • shots (Optional[int], optional) – The number of shots.

  • counts (Optional[list[dict[str, int]]], optional) – The counts of the experiment.

Returns:

Counts, purity, entropy of experiment.

Return type:

dict[str, Union[float, int]]

qurry

QurryV9 (qurry.qurrium.samplingqurry.qurry)

It is only for pendings and retrieve to remote backend.

class qurry.qurries.samplingqurry.qurry.QurryV9[source]

Executing one quantum circuit in multiple times.

property experiment_instance: Type[QurryExperiment]

The container class responding to this QurryV9 class.

measure(wave: QuantumCircuit | Hashable | None = None, sampling: int = 1, shots: int = 1024, backend: Backend | None = None, exp_name: str = 'experiment', run_args: BaseRunArgs | dict[str, Any] | None = None, transpile_args: TranspileArgs | None = None, passmanager: str | PassManager | tuple[str, PassManager] | None = None, tags: tuple[str, ...] | None = None, qasm_version: Literal['qasm2', 'qasm3'] = 'qasm3', export: bool = False, save_location: Path | str | None = None, pbar: tqdm | None = None) str[source]

Execute the experiment.

Parameters:
  • wave (Union[QuantumCircuit, Hashable]) – The key or the circuit to execute.

  • sampling (int, optional) – The number of sampling. Defaults to 1.

  • shots (int, optional) – Shots of the job. Defaults to 1024.

  • backend (Optional[Backend], optional) – Arguments for Backend.run(). Defaults to None.

  • exp_name (str, optional) – The name of the experiment. Naming this experiment to recognize it when the jobs are pending to IBMQ Service. This name is also used for creating a folder to store the exports. Defaults to ‘experiment’.

  • run_args (RunArgsType, optional) – Arguments for Backend.run(). Defaults to None.

  • transpile_args (Optional[TranspileArgs], optional) – Arguments of transpile() from qiskit.compiler.transpiler. Defaults to None.

  • passmanager (Optional[Union[str, PassManager, tuple[str, PassManager]], optional) – The passmanager. Defaults to None.

  • tags (Optional[tuple[str, ...]], optional) – The tags of the experiment. Defaults to None.

  • qasm_version (Literal["qasm2", "qasm3"], optional) – The version of OpenQASM. Defaults to “qasm3”.

  • export (bool, optional) – Whether to export the experiment. Defaults to False.

  • save_location (Optional[Union[Path, str]], optional) – The location to save the experiment. Defaults to None.

  • pbar (Optional[tqdm.tqdm], optional) – The progress bar for showing the progress of the experiment. Defaults to None.

Returns:

The experiment ID.

Return type:

str

measure_to_output(wave: QuantumCircuit | Hashable | None = None, sampling: int = 1, shots: int = 1024, backend: Backend | None = None, exp_name: str = 'experiment', run_args: BaseRunArgs | dict[str, Any] | None = None, transpile_args: TranspileArgs | None = None, passmanager: str | PassManager | tuple[str, PassManager] | None = None, tags: tuple[str, ...] | None = None, qasm_version: Literal['qasm2', 'qasm3'] = 'qasm3', export: bool = False, save_location: Path | str | None = None, pbar: tqdm | None = None) QurryOutputArgs[source]

Trasnform measure() arguments form into output() form.

Parameters:
  • wave (Union[QuantumCircuit, Hashable]) – The key or The key or the circuit to execute.

  • sampling (int, optional) – The number of sampling. Defaults to 1.

  • shots (int, optional) – Shots of the job. Defaults to 1024.

  • backend (Optional[Backend], optional) – Arguments for Backend.run(). Defaults to None.

  • exp_name (str, optional) – The name of the experiment. Naming this experiment to recognize it when the jobs are pending to IBMQ Service. This name is also used for creating a folder to store the exports. Defaults to ‘experiment’.

  • run_args (RunArgsType, optional) – Arguments for Backend.run(). Defaults to None.

  • transpile_args (Optional[TranspileArgs], optional) – Arguments of transpile() from qiskit.compiler.transpiler. Defaults to None.

  • passmanager (Optional[Union[str, PassManager, tuple[str, PassManager]], optional) – The passmanager. Defaults to None.

  • tags (Optional[tuple[str, ...]], optional) – The tags of the experiment. Defaults to None.

  • qasm_version (Literal["qasm2", "qasm3"], optional) – The version of OpenQASM. Defaults to “qasm3”.

  • export (bool, optional) – Whether to export the experiment. Defaults to False.

  • save_location (Optional[Union[Path, str]], optional) – The location to save the experiment. Defaults to None.

  • pbar (Optional[tqdm.tqdm], optional) – The progress bar for showing the progress of the experiment. Defaults to None.

Returns:

The output arguments.

Return type:

QurryOutputArgs

short_name = 'sampling_executer'

The short name of Qurrium.