nibcq.compensation.Compensation

class nibcq.compensation.Compensation

Comprehensive compensation data container for ACIR/EIS measurement error correction.

This class serves as the central data structure for managing compensation information used to correct systematic errors in impedance measurements. It contains all necessary components including the compensation method, calibration data, temperature information, and frequency-specific compensation parameters.

The compensation system supports multiple correction methods: - NO_COMPENSATION: Raw measurements without correction - SHORT: Correction using short-circuit calibration data - GOLDEN_DUT: Correction using known reference device data

compensation_method

The type of compensation to apply (from CompensationMethod enum). Determines how compensation_parameters are used in calculations.

compensation_file_path

Optional path to the file containing compensation data. Used for traceability and reloading calibration information.

target_temperature

Temperature conditions for optimal compensation accuracy. Compensation may be temperature-dependent for high-precision work.

compensation_parameters

Dictionary mapping frequencies (Hz) to complex compensation values (Ohms). Core calibration data for error correction.

Example

>>> compensation = Compensation(
...     compensation_method=CompensationMethod.SHORT,
...     compensation_file_path="/path/to/cal.json",
...     compensation_parameters={1000.0: 10+5j, 2000.0: 15+3j}
... )
>>> compensated_z = compensation.get_compensated_impedance(
...     frequency=1000.0,
...     measured_impedance=100+20j
... )
>>> # Result: 100+20j - 10+5j = 90+15j (SHORT compensation)
to_list() List[CompensationParameter]

Converts the AllCompensation instance to a list of CompensationParameters.

Return type:

List[CompensationParameter]

classmethod from_file(method: nibcq.enums.CompensationMethod, file_path: str) Compensation

Creates an AllCompensation instance from a compensation file.

Parameters:
Returns:

Instance loaded from the file

Return type:

AllCompensation

get_compensated_impedance(frequency: float, measured_impedance: complex, interpolation_mode: nibcq.enums.InterpolationMode = None) complex

Get the compensated impedance value for a specific frequency.

This method applies compensation based on the compensation method without needing to convert between list/dict representations or use separate subtraction methods.

Parameters:
  • frequency (float) – The frequency for which to get compensated impedance

  • measured_impedance (complex) – The raw measured impedance value

  • interpolation_mode (nibcq.enums.InterpolationMode) – Interpolation mode for compensation lookup (defaults to NEAREST)

Returns:

The compensated impedance value

Return type:

complex