nilspodlib.calibration_utils.save_calibration#
- nilspodlib.calibration_utils.save_calibration(calibration: CalibrationInfo, sensor_id: str, cal_time: datetime, folder: path_t, folder_structure: str = '') Path [source]#
Save a calibration info object in the correct format and file name for NilsPods.
The files will be saved in the format
folder/{sensor_id}_%Y-%m-%d_%H-%M.json
by default. If you want to recreate the default folder structure ofimucal
, passfolder_structure="{sensor_id}/{cal_info.CAL_TYPE}"
to the function.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:
- calibration
The CalibrationInfo object ot be saved
- sensor_id
The for 4 letter/digit identifier of a sensor_type, as obtained from
nilspodlib.header.Header.sensor_id
- cal_time
The date and time (min precision) when the calibration was performed. It is preferable to pass this value in UTC timezone, as this is in line with the time handling in the rest of the library.
- folder
Basepath of the folder, where the file will be stored.
- folder_structure
A valid formatted Python string using the
{}
syntax.sensor_id
, calibration as the namecal_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
Examples using nilspodlib.calibration_utils.save_calibration
#
Performing a Ferraris Calibration with a Nilspod