preprocess_impedance_data

autoeis.utils.preprocess_impedance_data(freq: ndarray[float], Z: ndarray[complex], tol_linKK: float = 0.05, high_freq_threshold: float = 1000.0, return_aux: bool = False) tuple[ndarray[float], ndarray[complex], Box]

Preprocesses/cleans up impedance measurements.

The preprocessing does the following steps:
  • Discard invalid high frequency measurements (see Notes section)

  • Filter out data with a positive imaginary part in high frequencies

  • Enforce the Kramers-Kronig validation (aka Lin-KK)

Parameters:
  • freq (np.ndarray[float]) – Frequencies corresponding to impedance measurements.

  • Z (np.ndarray[complex]) – Impedance measurements as a complex array.

  • tol_linKK (float) – Tolerance for acceptable measurements based on linKK residuals.

  • high_freq_threshold (float) – Lower bound for what is considered a high frequency measurement.

  • return_aux (bool, optional) – If True, returns the preprocessed data along with auxiliary information. Default is False.

Returns:

Tuple containing the preprocessed data with the following elements:
  • freq: Frequencies corresponding to the impedance data.

  • Z: Filtered impedance data.

  • aux: Box containing the Lin-KK validation results with keys:
    • res.real: Residual array for real part of the impedance data.

    • res.imag: Residual array for imaginary part of the impedance data.

    • rmse: Root mean square error of KK validated data vs. measurements.

Return type:

tuple[np.ndarray[float], np.ndarray[complex], Box]