Distribution of relaxation times

A collection of functions and classes for calculating the distribution of relaxation times in data sets.

Wrapper function and base class

pyimpspec.calculate_drt(data, method='tr-nnls', **kwargs)

Calculates the distribution of relaxation times (DRT) for a given data set using one of the supported methods (see the ‘method’ parameter below for more details).

Parameters:
  • data (DataSet) – The data set to use in the calculations.

  • method (str, optional) –

    Valid values include:

    • ”bht”

    • ”lm”

    • ”mrq-fit”

    • ”tr-nnls”

    • ”tr-rbf”

  • **kwargs – Additional keyword arguments are passed to the chosen method’s function. See the documentation for those functions for more information about their parameters.

Return type:

DRTResult

class pyimpspec.DRTResult(time_constants, frequencies, impedances, residuals, pseudo_chisqr)

The base class for objects representing the results of calculating the distribution of relaxation times in a data set. Each method implements a subclass for its results based on this class.

Parameters:
analyze_peaks(num_peaks=0, peak_positions=None, disallow_skew=False)

Analyze the peaks present in a distribution of relaxation times using skew normal distributions.

Parameters:
  • num_peaks (int, optional) – If greater than zero, then analyze only that number of peaks (sorted from highest to lowest gamma values).

  • peak_positions (Optional[Union[List[float], NDArray[float64]]], optional) – Analyze only the peaks at the provided positions.

  • disallow_skew (bool, optional) – If true, then normal distributions are used instead of skew normal distributions.

Return type:

DRTPeaks

get_bode_data()

Get the data necessary to plot this result as a Bode plot: the frequencies, the absolute magnitudes of the impedances, and the negative phase angles/shifts of the impedances in degrees.

Return type:

Tuple[Frequencies, Impedances, Phases]

get_frequencies()

Get the frequencies (in hertz) of the data set.

Return type:

Frequencies

get_impedances()

Get the complex impedance of the model.

Return type:

ComplexImpedances

abstract get_label()

The label includes information such as the method that was used.

Return type:

str

get_nyquist_data()

Get the data necessary to plot this result as a Nyquist plot: the real and the negative imaginary parts of the impedances.

Return type:

Tuple[Impedances, Impedances]

get_residuals_data()

Get the data necessary to plot the relative residuals for this result: the frequencies, the relative residuals for the real parts of the impedances in percents, and the relative residuals for the imaginary parts of the impedances in percents.

Return type:

Tuple[Frequencies, Residuals, Residuals]

get_time_constants()

Get the time constants.

Return type:

TimeConstants

abstract to_peaks_dataframe(threshold=0.0, columns=None)

Get the peaks as a pandas.DataFrame object that can be used to generate, e.g., a Markdown table.

Parameters:
  • threshold (float, optional) – The minimum peak height threshold (relative to the height of the tallest peak) for a peak to be included.

  • columns (Optional[List[str]], optional) – The labels for the column headers.

Return type:

pandas.DataFrame

abstract to_statistics_dataframe()

Get the statistics related to the DRT as a pandas.DataFrame object.

Return type:

pandas.DataFrame

Classes related to peak analysis

class pyimpspec.DRTPeak(position, height, alpha, sigma, x_offset, x_scale, y_offset, y_scale)

An object that represents a peak in a distribution of relaxation times. The peak is modeled using a (skew) normal distribution.

Parameters:
  • position (float64) – The relative position of the (skew) normal distribution.

  • height (float64) – The relative height of the (skew) normal distribution.

  • alpha (float64) – The skew of the (skew) normal distribution.

  • sigma (float64) – The standard deviation of the (skew) normal distribution.

  • x_offset (float64) – The offset used to translate time constants to the relative x-axis.

  • x_scale (float64) – The scaling factor used to translate time constants to the relative x-axis.

  • y_offset (float64) – The offset used to translate the relative y-axis values to gamma (ohm).

  • y_scale (float64) – The scaling factor used to translate the relative y-axis values to gamma (ohm).

get_area(time_constants)

Calculate the area (ohms) of this peak for a given set of time constants.

Parameters:

time_constants (TimeConstants)

Return type:

float64

get_gammas(time_constants)

Calculate the gamma values (ohm) corresponding to the given time constants.

Parameters:

time_constants (TimeConstants)

Return type:

Gammas

class pyimpspec.DRTPeaks(time_constants, peaks, suffix)

An object that represents a collection of peaks in a distribution of relaxation times. The peaks are modeled using a (skew) normal distribution.

Parameters:
  • time_constants (TimeConstants) – The time constants of the DRT.

  • peaks (List[DRTPeak) – A list of the (skew) normal distributions fitted to the DRT peaks.

  • suffix (str) – The suffix used in the labels when plotting the results.

get_gammas(peak_indices=None, num_per_decade=100)

Calculate the gamma values (ohm) for one or more peaks.

Parameters:
  • peak_indices (Optional[List[int]], optional) – If indices are specified, then only those peaks will be used.

  • num_per_decade (int, optional) – The number of points per decade to use when generating the gamma values.

Return type:

Gammas

get_num_peaks()

Get the number of peaks.

Return type:

int

get_peak_area(index)

Calculate the area of a peak.

Parameters:

index (int) – The index (zero-based) of the peak for which to calculate the area.

Return type:

float64

get_time_constants(num_per_decade=100)

Get either the original time constants (num_per_decade < 1) or an interpolated set of time constants.

Parameters:

num_per_decade (int, optional) – The number of points per decade to use when generating the time constants.

Return type:

TimeConstants

to_peaks_dataframe(peak_indices=None)

Generate a pandas.DataFrame object containing information about the peaks.

Parameters:

peak_indices (Optional[List[int]], optional) – If indices are specified, then only those peaks will be used.

Return type:

pandas.DataFrame

Method functions and classes

BHT method

pyimpspec.analysis.drt.calculate_drt_bht(data, rbf_type='gaussian', derivative_order=1, rbf_shape='fwhm', shape_coeff=0.5, num_samples=2000, num_attempts=10, maximum_symmetry=0.5, num_procs=-1, **kwargs)

Calculates the distribution of relaxation times (DRT) using the Bayesian Hilbert transform (BHT) method.

References:

Parameters:
  • data (DataSet) – The data set to use in the calculations.

  • rbf_type (str, optional) –

    The type of function to use for discretization. Valid values include:

    • ”gaussian”

    • ”c0-matern”

    • ”c2-matern”

    • ”c4-matern”

    • ”c6-matern”

    • ”inverse-quadratic”

    • ”inverse-quadric”

    • ”cauchy”

    • ”piecewise-linear”

  • derivative_order (int, optional) – The order of the derivative used during discretization.

  • rbf_shape (str, optional) –

    The shape control of the radial basis functions. Valid values include:

    • ”fwhm”: full width half maximum

    • ”factor”: shape_coeff is used directly

  • shape_coeff (float, optional) – The full width at half maximum (FWHM) coefficient affecting the chosen shape type.

  • inductance (bool, optional) – If true, then an inductive element is included in the calculations.

  • credible_intervals (bool, optional) – If true, then the credible intervals are also calculated for the DRT results according to Bayesian statistics.

  • num_samples (int, optional) – The number of samples drawn when calculating Jensen-Shannon distance. A greater number provides better accuracy but requires more time.

  • num_attempts (int, optional) – The minimum number of attempts to make when trying to find suitable random initial values. A greater number should provide better results at the expense of time.

  • maximum_symmetry (float, optional) – A maximum limit (between 0.0 and 1.0) for the relative vertical symmetry of the DRT. A high degree of symmetry is common for results where the gamma value oscillates wildly. A low value for the limit should improve the results but may cause the BHT method to take longer to finish.

  • num_procs (int, optional) – The maximum number of parallel processes to use. A value less than 1 results in an attempt to figure out a suitable value based on, e.g., the number of cores detected. Additionally, a negative value can be used to reduce the number of processes by that much (e.g., to leave one core for a GUI thread).

Return type:

BHTResult

class pyimpspec.analysis.drt.BHTResult(time_constants, frequencies, impedances, residuals, pseudo_chisqr, real_gammas, imaginary_gammas, scores)

An object representing the results of calculating the distribution of relaxation times in a data set using the Bayesian Hilbert transfrom (BHT) method.

Parameters:
  • time_constants (TimeConstants) – The time constants.

  • real_gammas (Gammas) – The gamma values calculated based on the real part of the impedance spectrum.

  • imaginary_gammas (Gammas) – The gamma values calculated based on the imaginary part of the impedance spectrum.

  • frequencies (Frequencies) – The frequencies of the impedance spectrum.

  • impedances (ComplexImpedances) – The impedance produced by the model.

  • residuals (ComplexResiduals) – The residuals of the real parts of the model and the data set.

  • pseudo_chisqr (float) – The pseudo chi-squared value, \(\chi^2_{\rm ps}\), of the modeled impedance (eq. 14 in Boukamp, 1995).

  • scores (Dict[str, complex]) – The scores calculated by the BHT method.

analyze_peaks(num_peaks=0, peak_positions=None, disallow_skew=False)

Analyze the peaks present in a distribution of relaxation times using skew normal distributions.

Parameters:
  • num_peaks (int, optional) – If greater than zero, then analyze only that number of peaks (sorted from highest to lowest gamma values).

  • peak_positions (Optional[Union[List[float], NDArray[float64]]], optional) – Analyze only the peaks at the provided positions.

  • disallow_skew (bool, optional) – If true, then normal distributions are used instead of skew normal distributions.

Returns:

The first and second DRTPeaks instance corresponds to the DRT generated based on the real or imaginary part, respectively, of the impedance spectrum.

Return type:

Tuple[DRTPeaks, DRTPeaks]

get_drt_data()

Get the data necessary to plot this DRT result as a DRT plot: the time constants and the corresponding real and imaginary gamma values.

Return type:

Tuple[TimeConstants, Gammas, Gammas]

get_gammas()

Get the gamma values calculated based on the real or imaginary parts of the impedance spectrum.

Return type:

Tuple[Gammas, Gammas]

get_label()

The label includes information such as the method that was used.

Return type:

str

get_peaks(threshold=0.0)

Get the time constants (in seconds) and gammas (in ohms) of peaks with magnitudes greater than the threshold. The threshold and the magnitudes are all relative to the magnitude of the highest peak.

Parameters:

threshold (float, optional) – The minimum peak height threshold (relative to the height of the tallest peak) for a peak to be included.

Return type:

Tuple[TimeConstants, Gammas, TimeConstants, Gammas]

get_scores()

Get the scores for the data set. The scores are represented as complex values where the real and imaginary parts have magnitudes ranging from 0.0 to 1.0. A consistent impedance spectrum should score high.

Return type:

Dict[str, complex]

to_peaks_dataframe(threshold=0.0, columns=None)

Get the peaks as a pandas.DataFrame object that can be used to generate, e.g., a Markdown table.

Parameters:
  • threshold (float, optional) – The minimum peak height threshold (relative to the height of the tallest peak) for a peak to be included.

  • columns (Optional[List[str]], optional) – The labels for the column headers.

Return type:

pandas.DataFrame

to_scores_dataframe(columns=None, rows=None)

Get the scores for the data set as a pandas.DataFrame object that can be used to generate, e.g., a Markdown table.

Parameters:
  • columns (Optional[List[str]], optional) – The labels for the column headers.

  • rows (Optional[List[str]], optional) – The labels for the rows.

Return type:

pandas.DataFrame

to_statistics_dataframe()

Get the statistics related to the DRT as a pandas.DataFrame object.

Return type:

pandas.DataFrame

LM method

pyimpspec.analysis.drt.calculate_drt_lm(data, model_order=0, model_order_method='matrix_rank', num_procs=-1, **kwargs)

Calculates the distribution of relaxation times (DRT) using the Loewner method (LM).

References:

Parameters:
  • data (DataSet) – The data set to use in the calculations.

  • model_order (int, optional) – The order of the model (k).

  • model_order_method (str, optional) –

    How to automatically pick the order of the model if the model order is not specified:

    • ”matrix_rank”

    • ”pseudo_chisqr”

  • num_procs (int, optional) – The maximum number of parallel processes to use. A value less than 1 results in an attempt to figure out a suitable value based on, e.g., the number of cores detected. Additionally, a negative value can be used to reduce the number of processes by that much (e.g., to leave one core for a GUI thread).

Return type:

LMResult

class pyimpspec.analysis.drt.LMResult(time_constants, frequencies, impedances, residuals, pseudo_chisqr, gammas, singular_values)

An object representing the results of calculating the distribution of relaxation times in a data set using the Loewner method.

Parameters:
  • time_constants (TimeConstants) – The time constants.

  • gammas (Gammas) – All gamma values. Positive and negative values correspond to resistive-capacitive and resistive-inductive peaks, respectively.

  • frequencies (Frequencies) – The frequencies of the impedance spectrum.

  • impedances (ComplexImpedances) – The impedance produced by the model.

  • residuals (ComplexResiduals) – The residuals of the real parts of the model and the data set.

  • pseudo_chisqr (float) – The pseudo chi-squared value, \(\chi^2_{\rm ps}\), of the modeled impedance (eq. 14 in Boukamp, 1995).

  • singular_values (NDArray[float64]) – The singular values as a function of the model order \(k \in [1..n]\) where \(n\) is the closest value divisible by 2 that is less than the total number of frequencies in the DataSet that was analyzed.

analyze_peaks(num_peaks=0, peak_positions=None, disallow_skew=False)

Analyze the peaks present in a distribution of relaxation times using skew normal distributions.

Peak analysis of the DRT obtained using the Loewner method is not supported.

Parameters:
  • num_peaks (int, optional) – If greater than zero, then analyze only that number of peaks (sorted from highest to lowest gamma values).

  • peak_positions (Optional[Union[List[float], NDArray[float64]]], optional) – Analyze only the peaks at the provided positions.

  • disallow_skew (bool, optional) – If true, then normal distributions are used instead of skew normal distributions.

Returns:

Neither DRTPeaks instance actually contains any results corresponding to peaks.

Return type:

Tuple[DRTPeaks, DRTPeaks]

get_drt_data()

Get the data necessary to plot this DRT result as a DRT plot: the time constants and corresponding gamma values for the resistive-capacitive and the resistive-inductive peaks.

Return type:

Tuple[TimeConstants, Gammas, TimeConstants, Gammas]

get_gammas()

Get the gamma values for the resistive-capacitive and resistive-inductive peaks.

Return type:

Tuple[Gammas, Gammas]

get_label()

The label includes information such as the method that was used.

Return type:

str

get_peaks(threshold=0.0)

Get the time constants (in seconds) of peaks with magnitudes greater than the threshold. The threshold and the magnitudes are all relative to the magnitude of the highest peak.

Parameters:

threshold (float, optional) – The minimum peak height threshold (relative to the height of the tallest peak) for a peak to be included.

Return type:

Tuple[TimeConstants, Gammas, TimeConstants, Gammas]

to_peaks_dataframe(threshold=0.0, columns=None)

Get the peaks as a pandas.DataFrame object that can be used to generate, e.g., a Markdown table.

Parameters:
  • threshold (float, optional) – The minimum peak height threshold (relative to the height of the tallest peak) for a peak to be included.

  • columns (Optional[List[str]], optional) – The labels for the column headers.

Return type:

pandas.DataFrame

to_statistics_dataframe()

Get the statistics related to the DRT as a pandas.DataFrame object.

Return type:

pandas.DataFrame

m(RQ)fit method

pyimpspec.analysis.drt.calculate_drt_mrq_fit(data, circuit, fit=None, gaussian_width=0.15, num_per_decade=100, max_nfev=-1, num_procs=-1, **kwargs)

Calculates the distribution of relaxation times (DRT) for a given data set by fitting a circuit with multiple parallel RQ elements connected in series (m(RQ)fit method).

References:

Parameters:
  • data (DataSet) – The data set to use in the calculations.

  • circuit (Circuit) – A circuit that contains one or more parallel RQ and/or parallel RC elements connected in series. An optional series resistance may also be included. For example, a circuit with a CDC representation of “R(RQ)(RQ)(RC)” would be a valid circuit.

  • fit (Optional[FitResult], optional) – If a FitResult object is provided, then no fitting will be performed.

  • gaussian_width (float, optional) – The width of the Gaussian curve that is used to approximate the DRT of an “(RC)” element.

  • num_per_decade (int, optional) – The number of points per decade to use when calculating a DRT.

  • max_nfev (int, optional) – The maximum number of function evaluations when fitting anything.

  • num_procs (int, optional) – The maximum number of parallel processes to use. A value less than 1 results in an attempt to figure out a suitable value based on, e.g., the number of cores detected. Additionally, a negative value can be used to reduce the number of processes by that much (e.g., to leave one core for a GUI thread).

Return type:

MRQFitResult

class pyimpspec.analysis.drt.MRQFitResult(time_constants, frequencies, impedances, residuals, pseudo_chisqr, gammas, circuit)

An object representing the results of calculating the distribution of relaxation times in a data set using the multi-(RQ)-fit (or m(RQ)fit) method.

Parameters:
  • time_constants (TimeConstants) – The time constants.

  • gammas (Gammas) – The gamma values.

  • frequencies (Frequencies) – The frequencies of the impedance spectrum.

  • impedances (ComplexImpedances) – The impedance produced by the model.

  • residuals (ComplexResiduals) – The residuals of the impedance of the model and the data set.

  • pseudo_chisqr (float) – The pseudo chi-squared value, \(\chi^2_{\rm ps}\), of the modeled impedance (eq. 14 in Boukamp, 1995).

  • circuit (Circuit) – The fitted circuit.

get_drt_data()

Get the data necessary to plot this DRTResult as a DRT plot: the time constants and the corresponding gamma values.

Return type:

Tuple[TimeConstants, Gammas]

get_gammas()

Get the gamma values.

Return type:

Gammas

get_label()

The label includes information such as the method that was used.

Return type:

str

get_peaks(threshold=0.0)

Get the time constants (in seconds) and gamma (in ohms) of peaks with magnitudes greater than the threshold. The threshold and the magnitudes are all relative to the magnitude of the highest peak.

Parameters:

threshold (float, optional) – The minimum peak height threshold (relative to the height of the tallest peak) for a peak to be included.

Return type:

Tuple[TimeConstants, Gammas]

to_peaks_dataframe(threshold=0.0, columns=None)

Get the peaks as a pandas.DataFrame object that can be used to generate, e.g., a Markdown table.

Parameters:
  • threshold (float, optional) – The minimum peak height threshold (relative to the height of the tallest peak) for a peak to be included.

  • columns (Optional[List[str]], optional) – The labels for the column headers.

Return type:

pandas.DataFrame

to_statistics_dataframe()

Get the statistics related to the DRT as a pandas.DataFrame object.

Return type:

pandas.DataFrame

TR-NNLS method

pyimpspec.analysis.drt.calculate_drt_tr_nnls(data, mode='real', lambda_value=-1.0, max_iter=-1, **kwargs)

Calculates the distribution of relaxation times (DRT) for a given data set using Tikhonov regularization and non-negative least squares fitting (TR-NNLS method).

References:

Parameters:
  • data (DataSet) – The data set to use in the calculations.

  • mode (str, optional) – Which parts of the data are to be included in the calculations. Valid values include: - “real” - “imaginary”

  • lambda_value (float, optional) – The Tikhonov regularization parameter. If the value is equal to or less than zero, then an attempt will be made to automatically find a suitable value. If the value is between -1.5 and 0.0, then a custom approach is used. If the value is less than -1.5, then the L-curve corner search algorithm (DOI:10.1088/2633-1357/abad0d) is used.

  • max_iter (int, optional) – The maximum number of iterations. If set to less than one, then the default of scipy.optimize.nnls is used.

Return type:

TRNNLSResult

class pyimpspec.analysis.drt.TRNNLSResult(time_constants, frequencies, impedances, residuals, pseudo_chisqr, gammas, lambda_value)

An object representing the results of calculating the distribution of relaxation times in a data set using Tikhonov regularization and non-negative least squares fitting (TR-NNLS).

Parameters:
  • time_constants (TimeConstants) – The time constants.

  • gammas (Gammas) – The gamma values.

  • frequencies (Frequencies) – The frequencies of the impedance spectrum.

  • impedances (ComplexImpedances) – The impedance produced by the model.

  • residuals (ComplexResiduals) – The residuals of the real and imaginary parts of the model and the data set.

  • pseudo_chisqr (float) – The pseudo chi-squared value, \(\chi^2_{\rm ps}\), of the modeled impedance (eq. 14 in Boukamp, 1995).

  • lambda_value (float) – The lambda value that was used.

get_drt_data()

Get the data necessary to plot this DRTResult as a DRT plot: the time constants and the corresponding gamma values.

Return type:

Tuple[TimeConstants, Gammas]

get_gammas()

Get the gamma values.

Return type:

Gammas

get_label()

The label includes information such as the method that was used.

Return type:

str

get_peaks(threshold=0.0)

Get the time constants (in seconds) and gamma (in ohms) of peaks with magnitudes greater than the threshold. The threshold and the magnitudes are all relative to the magnitude of the highest peak.

Parameters:

threshold (float, optional) – The minimum peak height threshold (relative to the height of the tallest peak) for a peak to be included.

Return type:

Tuple[TimeConstants, Gammas]

to_peaks_dataframe(threshold=0.0, columns=None)

Get the peaks as a pandas.DataFrame object that can be used to generate, e.g., a Markdown table.

Parameters:
  • threshold (float, optional) – The minimum peak height threshold (relative to the height of the tallest peak) for a peak to be included.

  • columns (Optional[List[str]], optional) – The labels for the column headers.

Return type:

pandas.DataFrame

to_statistics_dataframe()

Get the statistics related to the DRT as a pandas.DataFrame object.

Return type:

pandas.DataFrame

TR-RBF method

pyimpspec.analysis.drt.calculate_drt_tr_rbf(data, mode='complex', lambda_value=-1.0, cross_validation='mgcv', rbf_type='gaussian', derivative_order=1, rbf_shape='fwhm', shape_coeff=0.5, inductance=False, credible_intervals=False, num_samples=2000, timeout=60, num_procs=-1, **kwargs)

Calculates the distribution of relaxation times (DRT) for a given data set using Tikhonov regularization and radial basis (or piecewise linear) discretization (TR-RBF method).

References:

Parameters:
  • data (DataSet) – The data set to use in the calculations.

  • mode (str, optional) –

    Which parts of the data are to be included in the calculations. Valid values include:

    • ”complex”

    • ”real”

    • ”imaginary”

  • lambda_value (float, optional) – The Tikhonov regularization parameter. If cross_validation="", then the provided lambda_value is used directly. Otherwise, the chosen cross-validation method is used to pick a suitable value and the provided lambda_value is simply used as the initial value. If lambda_value is equal to or less than zero, and a cross-validation method has been chosen, then lambda_value is set to 1e-3.

  • cross_validation (str, optional) –

    The lambda value can be optimized using one of several cross-validation methods. Valid values include:

    • ”gcv” - generalized cross-validation (GCV)

    • ”mgcv” - modified GCV

    • ”rgcv” - robust GCV

    • ”re-im” - real-imaginary cross-validation

    • ”lc” - L-curve

    An empty string (i.e., cross_validation="") forces lambda_value to be used directly.

  • rbf_type (str, optional) –

    The type of function to use for discretization. Valid values include:

    • ”gaussian”

    • ”c0-matern”

    • ”c2-matern”

    • ”c4-matern”

    • ”c6-matern”

    • ”inverse-quadratic”

    • ”inverse-quadric”

    • ”cauchy”

    • ”piecewise-linear”

  • derivative_order (int, optional) – The order of the derivative used during discretization.

  • rbf_shape (str, optional) –

    The shape control of the radial basis functions. Valid values include:

    • ”fwhm”: full width half maximum

    • ”factor”: shape_coeff is used directly

  • shape_coeff (float, optional) – The full width at half maximum (FWHM) coefficient affecting the chosen shape type.

  • inductance (bool, optional) – If true, then an inductive element is included in the calculations.

  • credible_intervals (bool, optional) – If true, then the credible intervals are also calculated for the DRT results according to Bayesian statistics.

  • num_samples (int, optional) – The number of samples drawn when calculating the Bayesian credible intervals. A greater number provides better accuracy but requires more time.

  • timeout (int, optional) – The number of seconds to wait for the calculation of credible intervals to complete.

  • num_procs (int, optional) – The maximum number of parallel processes to use. A value less than 1 results in an attempt to figure out a suitable value based on, e.g., the number of cores detected. Additionally, a negative value can be used to reduce the number of processes by that much (e.g., to leave one core for a GUI thread).

Return type:

TRRBFResult

class pyimpspec.analysis.drt.TRRBFResult(time_constants, frequencies, impedances, residuals, pseudo_chisqr, gammas, mean_gammas, lower_bounds, upper_bounds, lambda_value)

An object representing the results of calculating the distribution of relaxation times in a data set using Tikhonov regularization and radial basis function (or piecewise linear) discretization (TR-RBF).

Parameters:
  • time_constants (TimeConstants) – The time constants.

  • gammas (Gammas) – The gamma values.

  • frequencies (Frequencies) – The frequencies of the impedance spectrum.

  • impedances (ComplexImpedances) – The impedance produced by the model.

  • residuals (ComplexResiduals) – The residuals of the impedances of the model and the data set.

  • mean_gammas (Gammas) – The mean gamma values of the Bayesian credible intervals.

  • lower_bounds (Gammas) – The lower bound gamma values of the Bayesian credible intervals.

  • upper_bounds (Gammas) – The upper bound gamma values of the Bayesian credible intervals.

  • pseudo_chisqr (float) – The pseudo chi-squared value, \(\chi^2_{\rm ps}\), of the modeled impedance (eq. 14 in Boukamp, 1995).

  • lambda_value (float) – The lambda value that was ultimately used.

get_drt_credible_intervals_data()

Get the data necessary to plot the Bayesian credible intervals for this DRT result: the time constants, the mean gamma values, the lower bound gamma values, and the upper bound gamma values.

Return type:

Tuple[TimeConstants, Gammas, Gammas, Gammas]

get_drt_data()

Get the data necessary to plot this DRTResult as a DRT plot: the time constants and the corresponding gamma values.

Return type:

Tuple[TimeConstants, Gammas]

get_gammas()

Get the gamma values.

Return type:

Gammas

get_label()

The label includes information such as the method that was used.

Return type:

str

get_peaks(threshold=0.0)

Get the time constants (in seconds) and gamma (in ohms) of peaks with magnitudes greater than the threshold. The threshold and the magnitudes are all relative to the magnitude of the highest peak.

Parameters:

threshold (float, optional) – The minimum peak height threshold (relative to the height of the tallest peak) for a peak to be included.

Return type:

Tuple[TimeConstants, Gammas]

to_peaks_dataframe(threshold=0.0, columns=None)

Get the peaks as a pandas.DataFrame object that can be used to generate, e.g., a Markdown table.

Parameters:
  • threshold (float, optional) – The minimum peak height threshold (relative to the height of the tallest peak) for a peak to be included.

  • columns (Optional[List[str]], optional) – The labels for the column headers.

Return type:

pandas.DataFrame

to_statistics_dataframe()

Get the statistics related to the DRT as a pandas.DataFrame object.

Return type:

pandas.DataFrame