utils
ΒΆ
Experiment Utilities (qurry.qurrium.experiment.utils
)
- qurry.qurrium.experiment.utils.create_save_location(save_location: str | Path | None, commons: Commonparams | None = None) Path [source]ΒΆ
Create a save location for the experiment.
- Parameters:
save_location (Optional[str]) β The save location of the experiment.
commons (Optional[Commonparams]) β The common parameters of the experiment. It is used to get the default save location if save_location is None.
- Returns:
The save location as a Path object.
- Return type:
Path
- Raises:
ValueError β If save_location is not a Path or str, or if it is None and commons is also None.
- qurry.qurrium.experiment.utils.decide_folder_and_filename(commons: Commonparams, args: ArgumentsPrototype) tuple[str, str] [source]ΒΆ
Decide the folder and filename for the experiment.
- Parameters:
commons (Commonparams) β The common parameters of the experiment.
args (ArgumentsPrototype) β The arguments of the experiment.
- Returns:
The folder and filename for the experiment.
- Return type:
- qurry.qurrium.experiment.utils.exp_id_process(exp_id: str | None) str [source]ΒΆ
Check the exp_id is valid or not, if not, then generate a new one.
- qurry.qurrium.experiment.utils.folder_with_repeat_times(exp_name: str, repeat_times: int) str [source]ΒΆ
Create a folder with repeat times.
- qurry.qurrium.experiment.utils.implementation_check(name_exps: str, args: ArgumentsPrototype, commons: Commonparams) None [source]ΒΆ
Check whether the experiment is implemented correctly.
- qurry.qurrium.experiment.utils.make_statesheet(exp_name: str, args: ArgumentsPrototype, commons: Commonparams, outfields: dict[str, str], beforewards: Before, afterwards: After, reports: AnalysesContainer, report_expanded: bool = False, hoshi: bool = False) Hoshi [source]ΒΆ
Show the state of experiment.
- Parameters:
exp_name (str) β Name of the experiment.
args (ArgumentsPrototype) β Arguments of the experiment.
commons (Commonparams) β Common parameters of the experiment.
beforewards (Before) β Beforewards of the experiment.
afterwards (After) β Afterwards of the experiment.
reports (AnalysesContainer) β Reports of the experiment.
report_expanded (bool, optional) β Show more infomation. Defaults to False.
hoshi (bool, optional) β Showing name of Hoshi. Defaults to False.
- Returns:
Statesheet of experiment.
- Return type:
- qurry.qurrium.experiment.utils.memory_usage_factor_expect(target: list[tuple[Hashable, QuantumCircuit | str]], circuits: list[QuantumCircuit], commonparams: Commonparams) int [source]ΒΆ
Estimate the memory usage of :cls:`ExperimentPrototype` by the circuits.
The memory usage is estimated by the number of instructions in the circuits and the number of shots. The factor is calculated by the formula:
where target_circuit_instructions_num is the number of instructions in the target circuits, transpiled_circuit_instructions_num is the number of instructions in the circuits which has been transpiled and will be run on the backend, and shots is the number of shots.
The factor is rounded to the nearest integer. The factor is used to estimate the memory usage of the experiment.
- Parameters:
circuits (list[QuantumCircuit]) β The circuits to be estimated.
commonparams (Commonparams) β The common parameters of the experiment.
- Returns:
The factor of the memory usage.
- Return type:
- qurry.qurrium.experiment.utils.summonner_check(serial: int | None, summoner_id: str | None, summoner_name: str | None)[source]ΒΆ
Check the summoner information taken from the experiment.
- Parameters:
- Raises:
QurrySummonerInvalid β If the summoner information is not completed.
- Returns:
True if the summoner information is completed, False otherwise.
- Return type: