nibcq.compensation.Compensation =============================== .. py: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 .. attribute:: compensation_method The type of compensation to apply (from CompensationMethod enum). Determines how compensation_parameters are used in calculations. .. attribute:: compensation_file_path Optional path to the file containing compensation data. Used for traceability and reloading calibration information. .. attribute:: target_temperature Temperature conditions for optimal compensation accuracy. Compensation may be temperature-dependent for high-precision work. .. attribute:: compensation_parameters Dictionary mapping frequencies (Hz) to complex compensation values (Ohms). Core calibration data for error correction. .. rubric:: 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) .. py:method:: to_list() -> List[CompensationParameter] Converts the AllCompensation instance to a list of CompensationParameters. .. py:method:: from_file(method: nibcq.enums.CompensationMethod, file_path: str) -> Compensation :classmethod: Creates an AllCompensation instance from a compensation file. :param method: The compensation method to associate with this data :param file_path: Path to the compensation file to load :returns: Instance loaded from the file :rtype: AllCompensation .. py:method:: 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. :param frequency: The frequency for which to get compensated impedance :param measured_impedance: The raw measured impedance value :param interpolation_mode: Interpolation mode for compensation lookup (defaults to NEAREST) :returns: The compensated impedance value :rtype: complex