nibcq.measurement.Measurement
- class nibcq.measurement.Measurement(device: nibcq._device.Device, test_parameters: TestParameters)
Bases:
abc.ABC,nibcq.switch.SwitchAware,nibcq.temperature.TemperatureAwareAbstract base class for all measurement subclasses.
This class provides the basic structure and properties for any measurement process. You will need to implement the ‘configure’ and ‘measure’ methods in subclasses. It also provides general properties for hardware, configuration parameters, result, and calibration file path. This class is designed to be extended for specific measurement types like OCV, ACIR, or EIS.
- Parameters:
device (nibcq._device.Device)
test_parameters (TestParameters)
- hardware
The hardware configuration used for the measurement.
- Type:
Hardware
- config_parameters
Configuration parameters for the measurement, provided by the user. There can be other, measurement type specific parameters in the child classes.
- Type:
ConfigParameters
- 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 result: float | SMUResult | list[SMUResult] | list[tuple[nibcq.switch.SMUCellData, SMUResult]] | list[tuple[nibcq.switch.SMUCellData, list[SMUResult]]] | list[tuple[str, tuple[datetime.datetime, datetime.datetime, float]]] | Any
Get the result of the last measurement.
Returns the measurement result from the most recent measurement operation. The result type depends on the specific measurement implementation and whether switching was used:
- Single measurements:
float for OCV and DCIR
SMUResult for ACIR
list[SMUResult] for EIS
- Switching measurements:
list[tuple[SMUCellData, SMUResult]] for ACIR with switching
list[tuple[SMUCellData, list[SMUResult]]], for EIS with switching
list[tuple[str, tuple[datetime, datetime, float]]], for OCV with switching
- Returns:
float | SMUResult | list[SMUResult] | list[tuple[SMUCellData, SMUResult]] | list[tuple[SMUCellData, list[SMUResult]]] | list[tuple[str, tuple[datetime, datetime, float]]] | Any: The measurement result(s). For switching measurements, returns a list of tuples where each tuple contains the cell data and its corresponding results.
- Raises:
RuntimeError – If no measurement has been performed yet or if the result is not available
- Return type:
Union[float, SMUResult, list[SMUResult], list[tuple[nibcq.switch.SMUCellData, SMUResult]], list[tuple[nibcq.switch.SMUCellData, list[SMUResult]]], list[tuple[str, tuple[datetime.datetime, datetime.datetime, float]]], Any]
Examples
>>> measurement.run(test_parameters) >>> result = measurement.result >>> print(f"Measurement result: {result}") >>> >>> # For switching measurements >>> switching_results = measurement.run_with_switching(compensation) >>> for cell_data, cell_results in measurement.result: ... print(f"Cell {cell_data.cell_serial_number}: {len(cell_results)} results")
- abstractmethod run()
Run the measurement process with the given test parameters used to configure the device.
- Returns:
A single result which is calculated and populated after fetching the data.
- abstractmethod run_with_switching()
Run measurement with automatic switching between DUT channels.
This method must be implemented by each measurement subclass to provide switching functionality. It should use the SwitchAware mixin capabilities to iterate through configured channels and perform measurements.
- Returns:
List of measurement results for each DUT channel
- Raises:
RuntimeError – If switching not enabled or no channels configured
- 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:
A list of DUT channel names or SMUCellData objects, which contain the DUT and switch channel information.
- Return type:
List[str] | List[SMUCellData]
- 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:
ValueError – 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)