nibcq.temperature.TemperatureAware

class nibcq.temperature.TemperatureAware

Mixin class for measurements that need temperature awareness.

This class provides a simple interface for measurements that need access to temperature functionality. It delegates to the device’s temperature capability if available.

Typical Usage Workflow:
  1. Enable temperature capability on device with device.with_temperature(settings)

  2. Optionally set a temperature delta: measurement.acceptable_temperature_delta = 2.5

  3. Measure or validate temperature against target:
    • Measure temperature: measurement.measure_temperature()

    • Validate temperature: measurement.validate_temperature(target_temperature)

Examples

>>> # Setup device with temperature capability
>>> device = Device.create(DeviceFamily.SMU, "PXI1Slot2")
>>> settings = ThermocoupleSettings("Dev1/ai0")
>>> device.with_temperature(settings)
>>>
>>> # Use in measurement
>>> measurement = EIS(device)
>>> compensation = measurement.load_compensation_file("file.json")
>>> measurement.acceptable_temperature_delta = 1.5  # Optional override
>>> current_temperature = measurement.measure_temperature()
>>> print(f"Current Temperature: {current_temperature.center}°C")
>>> is_valid = measurement.validate_temperature(compensation.temperature_parameter)
property acceptable_temperature_delta: float

Get the acceptable temperature delta for compensation validation.

Returns the maximum allowed temperature difference from the device’s temperature capability. This is a pass-through property that delegates to the underlying TemperatureCapability.

Returns:

The acceptable temperature delta in degrees, or NaN if no temperature capability

Return type:

float

Examples

>>> measurement = EIS(device)
>>> measurement.acceptable_temperature_delta = 2.5
>>> delta = measurement.acceptable_temperature_delta
property temperature: float

Get the latest temperature reading from the device.

Returns:

The most recent temperature measurement, or NaN if no temperature capability

Return type:

float

property temperature_range: CenteredRange

Get the latest temperature reading from the device, coupled with the user-set delta.

Returns:

A CenteredRange representing the most recent temperature measurement (NaN if not available), along with the acceptable temperature delta (NaN if not set).

Return type:

CenteredRange

measure_temperature() CenteredRange

Get a new temperature reading from the device.

Returns:

Current temperature reading, or NaN if no temperature capability

Return type:

CenteredRange

validate_temperature(target_temperature: CenteredRange) bool

Validate the current temperature against the compensation file’s target.

Delegates to the device’s temperature capability for validation. The capability handles all validation logic including checking if thermocouple is configured, using overridden delta values if set, and printing appropriate warnings.

Parameters:

target_temperature (CenteredRange) – The target temperature parameters for validation

Returns:

True if thermocouple is configured and temperature is within range.

False if thermocouple is not configured (capability missing or not set up), or if target temperature/delta is NaN.

Return type:

bool

Raises:

ValueError – If the current temperature exceeds the target ± delta range (only raised when capability is configured)

Examples

>>> measurement = EIS(device)
>>> measurement.measure_temperature()
>>> target = compensation.temperature_parameter
>>> is_valid = measurement.validate_temperature(target)