nibcq.calibration.Diary
- class nibcq.calibration.Diary(file_path: str, settings: Settings | None = None)
Manages calibration diary operations for tracking device calibration history.
Handles reading, writing, and parsing calibration entries in CSV format. Each entry contains a timestamp and temperature from when calibration was performed. The diary is used to determine when recalibration is needed based on elapsed time and temperature changes.
Examples
>>> diary = Diary("/path/to/calibration.csv") >>> entry = diary.last_entry >>> print(f"Last calibrated at {entry.timestamp}")
- property last_entry
Get the most recent calibration entry from the diary.
Reads the calibration diary file and returns the latest calibration entry containing timestamp and temperature information. This is used to determine when the device was last calibrated and under what temperature conditions.
- Returns:
The most recent calibration entry with timestamp and temperature
- Return type:
- Raises:
FileNotFoundError – If the calibration diary file doesn’t exist
ValueError – If the diary file format is invalid or corrupted
PermissionError – If the file cannot be read due to permissions
Examples
>>> diary = Diary("calibration.csv") >>> entry = diary.last_entry >>> print(f"Last calibrated: {entry.timestamp} at {entry.temperature}°C")