create_full_measurement
- specatalog.helpers.full_entry.create_full_measurement(data, raw_data_path, fmt, progress=None)[source]
Create a complete measurement entry with atomic database and file operations.
Performs all measurement creation steps in a transaction-safe manner:
Creates the database entry.
Sets up a temporary directory.
Creates the temporary measurement directory.
Copies the raw data files.
Converts the raw data to HDF5 format.
Copies the completed measurement to the final archive location.
Commits the database transaction.
- Parameters:
data (cr.measurement_model_pyd) – Measurement metadata used to create the database entry.
raw_data_path (list[str]) – List of paths to the raw data files that should be copied and processed.
fmt (str) – Identifier of the raw data format.
progress (ProgressCallback, optional) –
Optional callback used to report the progress of the operation. The callback is called with two arguments:
fractionfloatProgress value between
0.0and1.0.
messagestrHuman-readable description of the current processing step.
The callback is independent of the GUI and may, for example, be connected to a graphical progress bar by the caller.
- Returns:
Result object containing the status of the operation.
If the operation succeeds,
successisTrueandmeasurement_idcontains the ID of the created measurement.If the operation fails,
successisFalseanderrorcontains the exception that caused the failure.- Return type:
CreateMeasurementResult
Notes
A temporary directory is used to ensure that incomplete files are not written directly to the final archive location.
If an error occurs, database and file operations are rolled back where possible, and partially created archive data is removed.
The
progresscallback is optional. If it isNone, no progress information is reported.The function does not depend on Qt or any other GUI framework.