Skip to content

reanalysis_utils

tergite_autocalibration.utils.reanalysis_utils

Classes:

Name Description
DayInfo

Dataclass for a day folder.

MeasurementInfo

Dataclass for info on a measurement folder.

RunInfo

Dataclass for info a run folder.

Functions:

Name Description
get_day_infos

Returns all the day folder info in the data folder provided.

get_run_infos

Returns all the run folder info in the day folder provided.

is_day_folder

Determine whether the path argument is a day folder.

is_measurement_folder

Determine whether the path argument is a measurement folder.

is_run_folder

Determine whether the path argument is a run folder.

search_all_runs_for_measurement

Explicitly search for a certain measurement folder name or measurement folder path

select_measurement_for_analysis

Selects a measurement info from a run folder for re-analysis.

DayInfo dataclass

DayInfo(timestamp: date, day_idx: int, runs: list[RunInfo])

Dataclass for a day folder.

timestamp: when the day folder was created (the day it was created). day_idx: the first day folder has index 1, the second 2, etc. runs: list of run info instances for the run folders in the day folder.

MeasurementInfo dataclass

MeasurementInfo(timestamp: datetime, tuid: str, msmt_idx: int, node_name: str, measurement_folder_path: Path, run_folder_path: Path, dataset_path: Path | None = None)

Dataclass for info on a measurement folder.

timestamp: when the folder was created. tuid: hex identifier for the measurement, without label. msmt_idx: first measurement of the run has index 1, second 2, etc. measurement_folder_path: the os path to the measurement folder. run_folder_path: the os path to the run folder (containing the measurement). dataset_path: the os path to the dataset .hdf5 file.

RunInfo dataclass

RunInfo(timestamp: time, run_idx: int, measurements: list[MeasurementInfo])

Dataclass for info a run folder.

timestamp: when the run folder was created (the HH-MM-SS time it was created). run_idx: the first run of the day has index 1, second 2, etc. measurements: list of measurement info instances for the measurement folders in the run folder.

get_day_infos

get_day_infos(path_to_tergite_data_out_folder: Path | str) -> list[DayInfo]

Returns all the day folder info in the data folder provided.

get_run_infos

get_run_infos(path_to_day_folder: Path | str) -> list[RunInfo]

Returns all the run folder info in the day folder provided.

is_day_folder

is_day_folder(path_to_something: Path | str)

Determine whether the path argument is a day folder.

The folder has to exist and has to match the regex

^(\d{4}-\d{2}-\d{2})$

is_measurement_folder

is_measurement_folder(path_to_something: Path | str)

Determine whether the path argument is a measurement folder.

The folder has to exist and has to match the regex

^(\d{8}-\d{6})-\d{3}-[0-9a-f]{6}-[\w]+$

is_run_folder

is_run_folder(path_to_something: Path | str)

Determine whether the path argument is a run folder.

The folder has to exist and has to match the regex

^(\d{2}-\d{2}-\d{2})_[\w]+-[\w]+$

search_all_runs_for_measurement

search_all_runs_for_measurement(path_to_tergite_data_out_folder: Path | str, data_identifier: str) -> MeasurementInfo | None

Explicitly search for a certain measurement folder name or measurement folder path inside the provided data folder, using the data_identifier.

select_measurement_for_analysis

select_measurement_for_analysis(path_to_run_folder: Path | str, node_name: str | None = None) -> MeasurementInfo

Selects a measurement info from a run folder for re-analysis.

If node_name is provided, it attempts to find and return the corresponding measurement directly. If not provided, the user will be prompted via CLI to select a measurement from the available ones.

The prompt can be cancelled with by inputting '0' during selection.

Parameters:

Name Type Description Default
path_to_run_folder Path | str

Path to the run folder containing measurement subfolders.

required
node_name str | None

Name of the node to select directly. If None, prompts user.

None

Returns:

Name Type Description
MeasurementInfo MeasurementInfo

The selected measurement folder info.

Raises:

Type Description
FileNotFoundError

If the folder is not a valid run folder, contains no measurement data, or the specified node name is not found.

Abort

If the user chooses to cancel from the CLI prompt.