nibcq.LCRACIR
- class nibcq.LCRACIR(device: nibcq._device.Device, test_parameters: LCRTestParameters)
Bases:
nibcq.measurement.MeasurementLCR-based ACIR (AC Internal Resistance) measurement handler class.
This class implements single-frequency AC impedance measurements using the NI PXIe-4190 LCR Meter. Unlike SMU-based ACIR which uses waveform generation and FFT analysis, the LCR meter performs hardware-based impedance measurements directly at 1000 Hz.
The LCR meter handles all signal generation and analysis internally, making measurements simpler and faster than SMU-based methods. Compensation is applied via hardware settings (onboard storage), not post-processing, so the _run_workflow() override skips the _calculate() and _apply_compensation() steps entirely - only _configure() and _measure() are executed.
Inherits from Measurement to follow the Template Method pattern: validate → lock → configure → measure → (calculate) → (compensate) → result.
- Parameters:
device (nibcq._device.Device)
test_parameters (LCRTestParameters)
- DEVICE_FAMILY
DeviceFamily.LCR_METER - required device type.
- Type:
Examples
>>> device = Device.create(DeviceFamily.LCR_METER, "PXI1Slot2") >>> params = LCRTestParameters(current_amplitude=0.07) >>> lcr_acir = LCRACIR(device, params) >>> result = lcr_acir.run() >>> print(f"Impedance: {result.z_magnitude:.4f} Ohm")
- property result: nibcq.measurement.LCRMeasurementResult | None
Get the last measurement result.
- Returns:
- The last measurement result, or None if no
measurement has been performed yet.
- Return type:
- property measurement_frequency: float
Get the current measurement frequency.
- Returns:
The measurement frequency in Hz.
- Return type:
- static validate_current_amplitude(current_amplitude: float) bool
Validate that the current amplitude is within acceptable limits.
- Parameters:
current_amplitude (float) – The current amplitude to validate in Amperes RMS.
- Returns:
Always returns True when validation passes.
- Return type:
- Raises:
LCRParameterError – If the current amplitude is outside the valid range (7.08 nA to 707 mA).
- create_compensation(params: nibcq.lcr_compensation.LCRCompensationParameters, skip_prompts: bool = False) nibcq.measurement.LCRMeasurementResult
Generate LCR compensation data and verify with a measurement.
This method performs the complete 7-step compensation generation flow as defined in the LabVIEW “Create Compensation” example:
Session init (already done via Device.create)
Custom cable compensation (if enabled)
Set cable length
Open/Short compensation (if enabled)
Load compensation (if enabled)
Configure session for verification measurement
Verification measurement (initiate, wait, measure, reset)
The compensation data is stored on the device’s onboard memory and remains available for subsequent measurements until the device is reset or powered off.
User prompts are displayed before each step requiring physical connection changes (open, short, load). These prompts ensure the user has made the correct physical setup before compensation data is captured.
- Parameters:
params (LCRCompensationParameters) – LCRCompensationParameters with all configuration options.
skip_prompts (bool) – If True, skips user prompts for physical connections. User must ensure correct connections are made before each step. Useful for automated testing or scripted calibration sequences. Follows the Calibrator.self_calibrate(force=…) pattern.
- Returns:
- Verification measurement result after
compensation is applied. Can be used to verify compensation quality (should show near-zero impedance for a short).
- Return type:
- Raises:
LCRParameterError – If parameters are invalid (e.g., load comp without open AND short).
nidcpower.Error – If hardware operation fails.
Examples
>>> # Interactive compensation with user prompts >>> lcr = LCRACIR(device, test_params) >>> result = lcr.create_compensation( ... LCRCompensationParameters( ... generate_open=True, ... generate_short=True, ... enable_open=True, ... enable_short=True, ... ) ... ) >>> print(f"Verification Z: {result.z_magnitude:.6f} Ohm") >>> >>> # Automated compensation (for testing) >>> result = lcr.create_compensation(params, skip_prompts=True)
- property test_parameters: TestParameters
Get the current test parameters for the measurement.
Returns the configuration parameters that define how the measurement should be performed, including settings like powerline frequency and other measurement-specific parameters.
- Returns:
The current test parameters configuration
- Return type:
Examples
>>> measurement = Measurement(device) >>> params = measurement.test_parameters >>> print(params.powerline_frequency) PowerlineFrequency.FREQ_60_HZ
- property compensation: Compensation | None
Get the compensation object for error correction.
- Returns:
The compensation data, or None if no compensation is applied.
- Return type:
Compensation | None
- run(compensation: Compensation | None = None, **kwargs)
Run the measurement process (Template Method).
Defines the invariant measurement workflow:
Optionally set compensation from argument.
Store any extra keyword arguments in
_run_kwargsso hook methods can access them.Validate preconditions (temperature, etc.) — before locking.
Lock all device sessions.
Execute the workflow (configure → measure → calculate → compensate).
Release locks.
Clear
_run_kwargs.Return result.
Subclasses customize behavior by overriding the abstract/hook methods:
_configure,_measure,_calculate,_apply_compensation,_validate_preconditions,_lock_sessions,_run_workflow.- Parameters:
compensation (Compensation | None) – Optional compensation data for error correction. If provided, sets
self._compensationbefore running. If None, uses the previously setself._compensation(which may also be None, meaning no compensation is applied).kwargs (Any) – Additional keyword arguments (
**kwargs) forwarded to hook methods viaself._run_kwargs. Subclasses may read specific keys from this dict inside their_run_workflowor other hooks.
- Returns:
The measurement result (type depends on the specific subclass).
- Return type:
Any
- 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:
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:
- 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:
- measure_temperature() CenteredRange
Get a new temperature reading from the device.
- Returns:
Current temperature reading, or NaN if no temperature capability
- Return type:
- 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:
- Raises:
TemperatureError – 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)