nibcq.OCV
- class nibcq.OCV(device: nibcq._device.Device, test_parameters: OCVTestParameters)
Bases:
nibcq.measurement.Measurement,nibcq.measurement.SwitchingSupportClass to handle the Open Circuit Voltage (OCV) process for a given instrument.
- Parameters:
device (nibcq._device.Device)
test_parameters (OCVTestParameters)
- DEVICE_FAMILY: Final[nibcq.enums.DeviceFamily]
Device family for OCV measurements.
- Type:
- property test_parameters: OCVTestParameters
Get the current OCV test parameters.
Returns the OCVTestParameters object containing all configuration settings specific to Open Circuit Voltage measurements including DMM range, aperture time, averaging settings, and ADC calibration options.
- Returns:
The current OCV-specific test parameters configuration
- Return type:
Examples
>>> ocv = OCV(device) >>> params = ocv.test_parameters >>> print(params.range) DMMRange.DC_10V >>> print(params.aperture_time) 0.0
- property dmm_configuration
Get the DMM configuration as an alias for test_parameters.
Provides backward compatibility and clarity by offering an alias to the test_parameters property with a name that clearly indicates this is DMM-specific configuration. This matches the LabVIEW API naming convention.
- Returns:
The current DMM configuration (same as test_parameters)
- Return type:
Examples
>>> ocv = OCV(device) >>> config = ocv.dmm_configuration >>> print(config.range) DMMRange.DC_10V
- property result: tuple[datetime.datetime, datetime.datetime, float] | tuple[tuple[str, tuple[datetime.datetime, datetime.datetime, float]], Ellipsis]
Get the result of the last OCV measurement.
Returns a tuple of (start_time, end_time, voltage) for single measurements, or an immutable tuple of switching results where each entry maps a cell to its (start_time, end_time, voltage) tuple.
- Returns:
The measurement result(s). For single measurements this is a
(start_time, end_time, voltage)tuple; for switching measurements it is an immutable tuple mapping each cell to its(start_time, end_time, voltage)tuple.- Raises:
DMMParameterError – If no measurement has been performed yet.
- Return type:
Union[tuple[datetime.datetime, datetime.datetime, float], tuple[tuple[str, tuple[datetime.datetime, datetime.datetime, float]], Ellipsis]]
- property start_time: datetime.datetime | None
Get the timestamp when the last measurement started.
- Return type:
datetime.datetime | None
- property end_time: datetime.datetime | None
Get the timestamp when the last measurement completed.
- Return type:
datetime.datetime | None
- run_with_switching() tuple[tuple[str, tuple[datetime.datetime, datetime.datetime, float]], Ellipsis]
Run OCV measurement with automatic switching between DUT channels.
Performs Open Circuit Voltage measurements on multiple DUTs by automatically switching between configured channels. Each measurement includes timing information and DUT identification.
- Parameters:
test_parameters (OCVTestParameters) – The OCV test parameters containing DMM range, aperture time, averaging settings, and other configuration options for the voltage measurement.
- Returns:
- An immutable tuple of
tuples containing (channel_name, (start_time, end_time, voltage_value)) for each measured channel.
- Return type:
- Raises:
SwitchConfigurationError – If switching is not enabled or no switch channels are configured.
DMMParameterError – If the device is not initialized or measurement fails.
nidmm.errors.DriverError – If DMM-specific errors occur during measurement.
Examples
>>> params = OCVTestParameters() >>> ocv = OCV(device, params) >>> results = ocv.run_with_switching() >>> for channel, result in results: ... print(f"Channel {channel}: {result[2]} V - {result[0]} - {result[1]} seconds.")
- 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)
- property has_switch_capability: bool
Check if the device has switch capability.
- Returns:
True if switch capability is available, False otherwise
- Return type:
- connect_channel(channel: SMUCellData) None
Connect to a specific DUT channel using the device’s switch capability.
- Parameters:
channel (SMUCellData) – SwitchChannel containing connection information
- Raises:
RuntimeError – If no switch capability is available
- Return type:
None
- disconnect_all() None
Disconnect all channels using the device’s switch capability.
- Raises:
RuntimeError – If no switch capability is available
- Return type:
None
- wait_for_debounce() None
Wait for switch relays to settle using the device’s switch capability.
- Raises:
RuntimeError – If no switch capability is available
- Return type:
None
- property switch_cells: List[str] | List[SMUCellData]
Get the configured switch cells from the device.
- Returns:
DUT channel names or SMUCellData objects, which contain the DUT and switch channel information.
- Return type:
list[str] | list[SMUCellData]