nibcq.measurement.Measurement ============================= .. py:class:: nibcq.measurement.Measurement(device: nibcq._device.Device, test_parameters: TestParameters) Bases: :py:obj:`abc.ABC`, :py:obj:`nibcq.switch.SwitchAware`, :py:obj:`nibcq.temperature.TemperatureAware` Abstract 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. .. attribute:: hardware The hardware configuration used for the measurement. :type: Hardware .. attribute:: 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 .. py:property:: test_parameters :type: 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 :rtype: TestParameters .. rubric:: Examples >>> measurement = Measurement(device) >>> params = measurement.test_parameters >>> print(params.powerline_frequency) PowerlineFrequency.FREQ_60_HZ .. py:property:: result :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] 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 .. rubric:: 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") .. py:method:: run() :abstractmethod: 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. .. py:method:: run_with_switching() :abstractmethod: 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 .. py:property:: has_switch_capability :type: bool Check if the device has switch capability. :returns: True if switch capability is available, False otherwise .. py:method:: connect_channel(channel: SMUCellData) -> None Connect to a specific DUT channel using the device's switch capability. :param channel: SwitchChannel containing connection information :raises RuntimeError: If no switch capability is available .. py:method:: disconnect_all() -> None Disconnect all channels using the device's switch capability. :raises RuntimeError: If no switch capability is available .. py:method:: wait_for_debounce() -> None Wait for switch relays to settle using the device's switch capability. :raises RuntimeError: If no switch capability is available .. py:property:: switch_cells :type: 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. .. py:property:: acceptable_temperature_delta :type: 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 :rtype: float .. rubric:: Examples >>> measurement = EIS(device) >>> measurement.acceptable_temperature_delta = 2.5 >>> delta = measurement.acceptable_temperature_delta .. py:property:: temperature :type: float Get the latest temperature reading from the device. :returns: The most recent temperature measurement, or NaN if no temperature capability .. py:property:: temperature_range :type: 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). .. py:method:: measure_temperature() -> CenteredRange Get a new temperature reading from the device. :returns: Current temperature reading, or NaN if no temperature capability .. py:method:: 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. :param target_temperature: 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. :rtype: bool :raises ValueError: If the current temperature exceeds the target ± delta range (only raised when capability is configured) .. rubric:: Examples >>> measurement = EIS(device) >>> measurement.measure_temperature() >>> target = compensation.temperature_parameter >>> is_valid = measurement.validate_temperature(target)