arguments¶

The Arguments of Experiment (qurry.qurrium.experiment.arguments)

class qurry.qurrium.experiment.arguments.ArgumentsPrototype(exp_name: str)[source]¶

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

exp_name: str¶

Name of experiment.

class qurry.qurrium.experiment.arguments.Commonparams(exp_id: str, target_keys: list[Hashable], shots: int, backend: Backend | str, run_args: BaseRunArgs | dict[str, Any], transpile_args: TranspileArgs, tags: tuple[str, ...], save_location: Path | str, serial: int | None, summoner_id: str | None, summoner_name: str | None, datetimes: DatetimeDict)[source]¶

Construct the experiment’s parameters for system running.

backend: Backend | str¶

Backend to execute the circuits on, or the backend used.

datetimes: DatetimeDict¶

The datetime of experiment.

static default_value() CommonparamsDict[source]¶

The default value of each field.

exp_id: str¶

ID of experiment.

export() CommonparamsDict[source]¶

Export the experiment’s common parameters.

Returns:

The common parameters of experiment.

Return type:

CommonparamsDict

classmethod read_with_arguments(exp_id: str, file_index: dict[str, str], save_location: Path) CommonparamsReadReturn[source]¶

Read the exported experiment file.

Parameters:
  • exp_id (str) – The ID of experiment.

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

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

Returns:

CommonparamsReadReturn

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

run_args: BaseRunArgs | dict[str, Any]¶

Arguments of execute.

save_location: Path | str¶

Location of saving experiment. If this experiment is called by :cls:`QurryMultiManager`, then adventure, legacy, tales, and reports will be exported to their dedicated folders in this location respectively. This location is the default location for it’s not specific where to save when call write(), if does, then will be overwriten and update.

serial: int | None¶

Index of experiment in a multiOutput.

shots: int¶

1024).

Type:

Number of shots to run the program (default

summoner_id: str | None¶

ID of experiment of :cls:`MultiManager`.

summoner_name: str | None¶

Name of experiment of :cls:`MultiManager`.

tags: tuple[str, ...]¶

Tags of experiment.

target_keys: list[Hashable]¶

The target keys of experiment.

transpile_args: TranspileArgs¶

Arguments of transpile() from qiskit.compiler.transpiler.

class qurry.qurrium.experiment.arguments.CommonparamsDict[source]¶

The export dictionary of :cls:`Commonparams`.

class qurry.qurrium.experiment.arguments.CommonparamsReadReturn[source]¶

The return type of Commonparams.read_with_arguments().

qurry.qurrium.experiment.arguments.REQUIRED_FOLDER = ['args', 'advent', 'legacy', 'tales', 'reports']¶

The required folder for exporting experiment.

qurry.qurrium.experiment.arguments.commons_dealing(commons_dict: dict[str, Any]) dict[str, Any][source]¶

Dealing some special commons arguments.

Parameters:

commons_dict (dict[str, Any]) – The common parameters of the experiment.

Returns:

The dealt common parameters of the experiment.

Return type:

dict[str, Any]

qurry.qurrium.experiment.arguments.create_exp_args(arguments: _A | dict[str, Any], arguments_instance: type[_A]) tuple[_A, dict[str, Any]][source]¶

Create experiment arguments from the given arguments.

Parameters:
  • arguments (Union[_A, dict[str, Any]]) – The arguments to be parsed.

  • arguments_instance (type[_A]) – The instance of the arguments class.

Returns:

A tuple containing the parsed arguments instance and

a dictionary of deprecated fields.

Return type:

tuple[_A, dict[str, Any]]

Raises:

TypeError – If the arguments is not an instance of the arguments class or a dictionary.

qurry.qurrium.experiment.arguments.create_exp_commons(commons: Commonparams | dict[str, Any]) tuple[Commonparams, dict[str, Any]][source]¶

Create experiment commons from the given commons.

Parameters:

commons (Union[Commonparams, dict[str, Any]]) – The commons to be parsed.

Returns:

A tuple containing the parsed commons instance and

a dictionary of deprecated fields.

Return type:

tuple[Commonparams, dict[str, Any]]

Raises:

TypeError – If the commons is not an instance of the commons class or a dictionary.

qurry.qurrium.experiment.arguments.create_exp_outfields(outfields: dict[str, Any] | None) dict[str, Any][source]¶

Create experiment outfields from the given outfields.

Parameters:

outfields (Union[dict[str, Any], None]) – The outfields to be parsed.

Returns:

The parsed outfields.

Return type:

dict[str, Any]

Raises:

TypeError – If the outfields is not a dictionary or None.

qurry.qurrium.experiment.arguments.filter_deprecated_args(arguments_or_commons_input: dict[str, Any], container_fields: tuple[str, ...] | set[str]) tuple[dict[str, Any], dict[str, Any]][source]¶

Filter deprecated arguments from the given arguments or commons.

Parameters:
  • arguments_or_commons_input (dict[str, Any]) – The arguments or commons to be filtered.

  • container_fields (Union[tuple[str, ...], set[str]]) – The fields to be kept.

Returns:

A tuple containing the filtered arguments or commons

and a dictionary of deprecated fields.

Return type:

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

Raises:

TypeError – If the arguments_or_commons_input is not a dictionary.

qurry.qurrium.experiment.arguments.v5_to_v7_field_transpose(data_args: dict[str, dict[str, Any]]) dict[str, dict[str, Any]][source]¶

The field name of v5 to v7.

Parameters:

data_args (dict[str, dict[str, Any]]) – The arguments of experiment.

Returns:

The arguments of experiment with new field name.

Return type:

dict[str, dict[str, Any]]

qurry.qurrium.experiment.arguments.v7_to_v9_field_transpose(data_args: dict[str, dict[str, Any]]) dict[str, dict[str, Any]][source]¶

The field name of v7 to v9.

Parameters:

data_args (dict[str, dict[str, Any]]) – The arguments of experiment.

Returns:

The arguments of experiment with new field name

Return type:

dict[str, dict[str, Any]]

qurry.qurrium.experiment.arguments.wave_key_to_target_keys(wave_key: str) list[str][source]¶

Convert the wave key to target keys.

Parameters:

wave_key (str) – The wave key.

Returns:

The target keys.

Return type:

list[str]