nibcq.enums.InterpolationMode
- class nibcq.enums.InterpolationMode
-
Interpolation modes for compensation value lookups in frequency domain.
Defines how compensation values are calculated when the measurement frequency doesn’t exactly match a frequency in the compensation table. Different modes provide different trade-offs between accuracy and computational simplicity.
- Values:
- NEAREST (“nearest”): Nearest neighbor interpolation
Uses the compensation value from the closest frequency point
Fast and simple, but may introduce step discontinuities
- LOWER (“lower”): Lower bound interpolation
Always uses compensation value from the next lower frequency
Conservative approach, ensures no extrapolation above known points
- UPPER (“upper”): Upper bound interpolation
Always uses compensation value from the next higher frequency
Conservative approach, ensures no extrapolation below known points
- LINEAR (“linear”): Linear interpolation
Calculates compensation value using linear interpolation between neighboring frequency points
Most accurate for smooth frequency responses
Examples
>>> compensation = Compensation.from_file(CompensationMethod.SHORT, "short.json") >>> impedance = compensation.get_compensated_impedance( ... frequency=1500.0, ... measured_impedance=complex(0.1, 0.05), ... interpolation_mode=InterpolationMode.LINEAR ... )