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.

Parameters:
file_path

Path to the calibration diary CSV file

Type:

str

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:

Entry

Raises:

Examples

>>> diary = Diary("calibration.csv")
>>> entry = diary.last_entry
>>> print(f"Last calibrated: {entry.timestamp} at {entry.temperature}°C")
add_new_entry(entry: Entry)

Add a new calibration entry to the diary.

Parameters:

entry (Entry)