imucal.management.save_calibration_info#
- imucal.management.save_calibration_info(cal_info: CalibrationInfo, sensor_id: str, cal_time: datetime, folder: path_t, folder_structure='{sensor_id}/{cal_info.CAL_TYPE}', **kwargs) Path [source]#
Save a calibration info object in the correct format and file name for NilsPods.
By default the files will be saved in the format:
folder/{sensor_id}/{cal_info.CAL_TYPE}/{sensor_id}_%Y-%m-%d_%H-%M.json
The naming schema and format is of course just a suggestion, and any structure can be used as long as it can be converted back into a CalibrationInfo object. However, following the naming convention will allow to use other calibration utils to search for suitable calibration files.
Note
If the folder does not exist it will be created.
- Parameters:
- cal_info
The CalibrationInfo object ot be saved
- sensor_id
A unique id to identify the calibrated sensor. Note that this will converted to all lower-case!
- cal_time
The date and time (min precision) when the calibration was performed.
- folder
Basepath of the folder, where the file will be stored.
- folder_structure
A valid formatted Python string using the
{}
syntax.sensor_id
,cal_info
and kwargs will be passed to thestr.format
as keyword arguments and can be used in the string.
- Returns:
- output_file_name
The name under which the calibration file was saved
Notes
Yes, this way of storing files doubles information at various places, which is usually discouraged. However, in this case it ensures that you still have all information just from the file name and the file content, and also easy “categories” if you search through the file tree manually.
Examples using imucal.management.save_calibration_info
#
Annotate a session and perform a Ferraris Calibration