nibcq.Calibrator

class nibcq.Calibrator(device: nibcq._device.Device, calibration_settings: nibcq.calibration.Settings, calibration_file_path: str | None = None)

A calibration manager for hardware devices that handles self-calibration operations.

The Calibrator class manages device self-calibration by tracking calibration history, validating calibration status based on time and temperature constraints, and performing new calibrations when needed. It uses a diary system to persist calibration records and works with hardware adapters to interface with actual devices.

calibration_settings

Configuration settings for calibration validation, including temperature delta and time interval thresholds.

Type:

Settings

Raises:
  • ValueError – When calibration file path is empty or invalid.

  • TypeError – When self-calibration is not supported by the device.

  • RuntimeError – When attempting calibration on unsupported hardware.

Parameters:

Example

>>> device = Device(session, device_family)
>>> settings = Settings(temperature_delta=2.0, days_to_calibration=30)
>>> calibrator = Calibrator(device, settings, "/path/to/cal.json")
>>> if not calibrator.last_calibration_is_valid:
...     calibrator.self_calibrate()
property calibration_file_path

Return the calibration file path.

property last_calibration_is_valid

Return if the latest self-calibration is valid for the instrument.

self_calibrate(force: bool = False) bool

Perform self-calibration on the session.

Parameters:

force (bool) – If True, skips the user prompt for acknowledgment.

Return type:

bool