multimanagerΒΆ

MultiManager - The manager of multiple experiments. (qurry.qurrium.multimanager)

class qurry.qurrium.multimanager.multimanager.MultiManager(naming_complex: IOComplex, multicommons: MultiCommonparams, beforewards: Before, afterwards: After, quantity_container: QuantityContainer, outfields: dict[str, Any], gitignore: GitSyncControl | list[str] | None = None)[source]ΒΆ

The manager of multiple experiments.

after_lock: bool = FalseΒΆ

Protect the :cls:`afterward` content to be overwritten. When setitem is called and completed, it will be setted as False automatically.

analyze(analysis_name: str = 'report', no_serialize: bool = False, specific_analysis_args: dict[Hashable, _RA | dict[str, Any] | bool] | None = None, **analysis_args: dict[str, Any] | AnalyzeArgs) str[source]ΒΆ

Analyze the experiments.

Parameters:
  • exps_container (ExperimentContainer[_ExpInst]) – The container of experiments.

  • analysis_name (str, optional) – The name of analysis. Defaults to β€œreport”.

  • no_serialize (bool, optional) – Whether serialize the analysis. Defaults to False.

  • specific_analysis_args (SpecificAnalsisArgs, optional) – The specific analysis arguments. Defaults to None.

  • **analysis_args (Union[dict[str, Any], AnalyzeArgs]) – The arguments of analysis.

Returns:

The name of analysis.

Return type:

str

classmethod build(config_list: list[dict[str, ~typing.Any]], experiment_instance: ~typing.Type[~qurry.qurrium.container.experiments._E], summoner_name: str | None = None, shots: int | None = None, backend: ~qiskit.providers.backend.Backend = <AerSimulator('aer_simulator')>, tags: tuple[str, ...] | None = None, manager_run_args: ~qurry.declare.run.base_run.BaseRunArgs | dict[str, ~typing.Any] | None = None, jobstype: ~typing.Literal['local', 'IBMQ', 'IBM', 'IBMRuntime', 'Qulacs', 'AWS_Bracket', 'Azure_Q'] = 'local', pending_strategy: ~typing.Literal['onetime', 'each', 'tags'] = 'tags', save_location: ~pathlib.Path | str = PosixPath('.'), skip_writing: bool = False, multiprocess_build: bool = False, multiprocess_write: bool = False) MultiManager[_E][source]ΒΆ

Build the multi-experiment.

Parameters:
  • config_list (list[dict[str, Any]]) – The list of config of experiments. This config is used to build the experiments.

  • experiment_instance (ExperimentPrototype) – The instance of experiment.

  • summoner_name (Optional[str], optional) – Name of experiment of the MultiManager. Defaults to None.

  • shots (Optional[int], optional) – The shots of experiments. Defaults to None.

  • backend (Backend, optional) – The backend of experiments. Defaults to GeneralSimulator().

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

  • manager_run_args (Optional[Union[BaseRunArgs, dict[str, Any]]], optional) – The arguments of manager run. Defaults to None.

  • jobstype (PendingTargetProviderLiteral, optional) – The jobstype of experiments. Defaults to β€œlocal”.

  • pending_strategy (PendingStrategyLiteral, optional) – The pending strategy of experiments. Defaults to β€œtags”.

  • save_location (Union[Path, str], optional) – Location of saving experiment. Defaults to Path(β€œ./”).

  • skip_writing (bool, optional) – Whether skip writing. Defaults to False.

  • multiprocess_build (bool, optional) – Whether use multiprocess for building. Defaults to False.

  • multiprocess_write (bool, optional) – Whether use multiprocess for writing. Defaults to False.

Returns:

The container of experiments and multi-experiment.

Return type:

MultiManager

clear_all_exps_result(*args, security: bool = False, mute_warning: bool = False) None[source]ΒΆ

Clear the result of all experiments.

Parameters:
  • security (bool, optional) – Security for clearing. Defaults to False.

  • mute_warning (bool, optional) – Mute the warning when clearing. Defaults to False.

compress(compress_overwrite: bool = False, remain_only_compressed: bool = False) Path[source]ΒΆ

Compress the export_location to tar.xz.

Parameters:
  • compress_overwrite (bool, optional) – Reproduce all the compressed files. Defaults to False.

  • remain_only_compressed (bool, optional) – Remove uncompressed files. Defaults to False.

Returns:

Path of the compressed file.

Return type:

Path

easycompress(overwrite: bool = False) Path[source]ΒΆ

Compress the export_location to tar.xz.

Parameters:

overwrite (bool, optional) – Reproduce all the compressed files. Defaults to False.

Returns:

Path of the compressed file.

Return type:

Path

classmethod easydecompress(naming_complex: IOComplex) Path[source]ΒΆ

Decompress the tar.xz file of experiment.

Parameters:

naming_complex (IOComplex) – The naming complex of experiment.

Returns:

Path of the decompressed file.

Return type:

Path

exps: ExperimentContainer[_E]ΒΆ

The experiments container.

property id: strΒΆ

ID of experiment of the MultiManager.

mute_auto_lock: bool = FalseΒΆ

Whether mute the auto-lock message.

property name: strΒΆ

Name of experiment of the MultiManager.

quantity_container: QuantityContainer[tuple[str, ...]]ΒΆ

The container of quantity.

qurryinfo: dict[str, dict[str, str]] = {}ΒΆ

The qurryinfo of the multi-experiment.

This is a dictionary with experiment IDs as keys, and the values are dictionaries containing the exported information.

classmethod read(summoner_name: str, experiment_instance: Type[_E], save_location: Path | str = PosixPath('.'), is_read_or_retrieve: bool = False, read_from_tarfile: bool = False) MultiManager[_E][source]ΒΆ

Read the multi-experiment.

Parameters:
  • experiment_instance (ExperimentPrototype) – The instance of experiment.

  • summoner_name (Optional[str], optional) – Name of experiment of the MultiManager. Defaults to None.

  • save_location (Union[Path, str], optional) – Location of saving experiment. Defaults to Path(β€œ./”).

  • is_read_or_retrieve (bool, optional) – Whether read or retrieve. Defaults to False.

  • read_from_tarfile (bool, optional) – Whether read from tarfile. Defaults to False.

Returns:

The container of experiments and multi-experiment.

Return type:

MultiManager

register(current_id: str, config: dict[str, Any], exps_instance: _E)[source]ΒΆ

Register the experiment to multimanager.

Parameters:
  • current_id (str) – ID of experiment.

  • config (dict[str, Any]) – The config of experiment.

  • exps_instance (ExperimentPrototype) – The instance of experiment.

remove_analysis(name: str)[source]ΒΆ

Removes the analysis.

Parameters:

name (str) – The name of the analysis.

reset_afterwards(*args, security: bool = False, mute_warning: bool = False) None[source]ΒΆ

Reset the measurement and release memory for overwrite.

Parameters:
  • security (bool, optional) – Security for reset. Defaults to False.

  • mute_warning (bool, optional) – Mute warning. Defaults to False.

property summoner_id: strΒΆ

ID of experiment of the MultiManager.

property summoner_name: strΒΆ

Name of experiment of the MultiManager.

update_save_location(save_location: Path | str, without_serial: bool = True) dict[str, Any][source]ΒΆ

Update the save location of the multi-experiment.

Parameters:
  • save_location (Union[Path, str]) – Location of saving experiment.

  • without_serial (bool, optional) – Whether without serial number. Defaults to True.

Returns:

The dict of multiConfig.

Return type:

dict[str, Any]

write(save_location: str | Path | None = None, export_transpiled_circuit: bool = False, skip_before_and_after: bool = False, skip_exps: bool = False, skip_quantities: bool = False, multiprocess: bool = False) dict[str, Any][source]ΒΆ

Export the multi-experiment.

Parameters:
  • save_location (Union[Path, str], optional) – Location of saving experiment. Defaults to None.

  • export_transpiled_circuit (bool, optional) – Export the transpiled circuit. Defaults to False.

  • skip_before_and_after (bool, optional) – Skip the beforewards and afterwards. Defaults to False.

  • skip_exps (bool, optional) – Skip the experiments. Defaults to False.

  • skip_quantities (bool, optional) – Skip the quantities container. Defaults to False.

  • multiprocess (bool, optional) – Whether to use multiprocess for exporting. Defaults to False.

Returns:

The dict of multiConfig.

Return type:

dict[str, Any]