Distribution of relaxation times

Calculating the distribution of relaxation times (DRT) is one way of analyzing impedance spectra. Several different approaches have been described (see Boukamp (2020) for a review). The DRT results can be used to, e.g., develop a suitable equivalent circuit.

Note

Validation of impedance spectra using, e.g., Kramers-Kronig tests prior to proceeding with DRT analyses is highly recommended. The instrument control software for your potentiostat/galvanostat may include tools for analyzing the excitation and response signals for indications of non-linear behavior.

The supported methods

Implementations based on the following approaches are included in pyimpspec:

Note

The methods using Tikhonov regularization require selection of a suitable regularization parameter, \(\lambda\). The implementations of the TR-NNLS and TR-RBF methods in pyimpspec include approaches to automatically selecting this parameter. However, this is not guaranteed to work in all cases. An unsuitable regularization parameter can lead to, e.g., sharp peaks that should not be there or broad peaks that should be two or more separate sharper peaks.

Note

The BHT method makes use of random initial values for some of its calculations, which can produce different results when repeated with the same impedance spectrum.

How to use

Each method has its own function that can be used but there is also a wrapper function (calculate_drt()) that takes a method argument.

>>> from pyimpspec import (
...   DataSet,
...   DRTResult,              # An abstract class for DRT results
...   calculate_drt,          # Wrapper function for all methods
...   generate_mock_data,
... )
>>> from pyimpspec.analysis.drt import (
...   BHTResult,              # Result of the BHT method
...   LMResult,               # Result of the Loewner method
...   MRQFitResult,           # Result of the m(RQ)fit method
...   TRNNLSResult,           # Result of the TR-NNLS method
...   TRRBFResult,            # Result of the TR-RBF method
...   calculate_drt_bht,      # BHT method
...   calculate_drt_lm,       # Loewner method
...   calculate_drt_mrq_fit,  # m(RQ)fit method
...   calculate_drt_tr_nnls,  # TR-NNLS method
...   calculate_drt_tr_rbf,   # TR-RBF method
... )
>>>
>>> data: DataSet = generate_mock_data("CIRCUIT_1", noise=5e-2, seed=42)[0]
>>> drt: TRNNLSResult = calculate_drt_tr_nnls(data, lambda_value=1e-4)
>>> drt: DRTResult = calculate_drt(data, method="tr-nnls", lambda_value=1e-4)
>>> assert isinstance(drt, TRNNLSResult)

Below are some figures demonstrating the results of the methods listed above when applied to the example data.

(Source code)

_images/guide_drt-1_00.svg
_images/guide_drt-1_01.svg
_images/guide_drt-1_02.svg
_images/guide_drt-1_03.svg
_images/guide_drt-1_04.svg
_images/guide_drt-1_05.svg

(Source code)

_images/guide_drt-2_00.svg
_images/guide_drt-2_01.svg
_images/guide_drt-2_02.svg
|   tau, RC (s) |   gamma, RC (ohm) |   tau, RL (s) |   gamma, RL (ohm) |
|--------------:|------------------:|--------------:|------------------:|
|   8.00717e-12 |           289.999 |      0.266667 |           150.012 |
|   0.00023     |           230     |    nan        |           nan     |
|   0.0576      |           576.007 |    nan        |           nan     |

This example shows that some additional processing of the obtained values may be necessary. In this case, the high-frequency resistive-capacitive peak does not directly tell us the value of \(R_1\) and instead it is \(R_1 + R_4\). However, we can still obtain an estimated value: \(R_1 \approx 289.999\ \Omega - 150.012\ \Omega \approx 140\ \Omega\). Other estimated values such as capacitances and inductances can also be obtained:

  • \(R_2 \approx 230\ \Omega\) and \(C_1 \approx 0.0023\ {\rm s} / 230\ \Omega \approx 10^{-6}\ {\rm F}\)

  • \(R_3 \approx 576\ \Omega\) and \(C_2 \approx 0.0576\ {\rm s} / 576.007\ \Omega \approx 10^{-4}\ {\rm F}\)

  • \(R_4 \approx 150\ \Omega\) and \(L_2 \approx 0.266667\ {\rm s} \times 150.012\ \Omega \approx 40\ {\rm H}\)

The above is a best-case scenario, but even with a bit of added noise (\(\sigma = 0.05\ \% \times |Z|\)) one can still obtain decent estimates despite the additional peaks:

  • \(R1 \approx 289.925\ \Omega - 149.085\ \Omega \approx 141\ \Omega\).

  • \(R_2 \approx 230\ \Omega\) and \(C_1 \approx 0.00230559\ {\rm s} / 230.233\ \Omega \approx 10^{-6}\ {\rm F}\)

  • \(R_3 \approx 574\ \Omega\) and \(C_2 \approx 0.0574022\ {\rm s} / 574.438\ \Omega \approx 10^{-4}\ {\rm F}\)

  • \(R_4 \approx 149\ \Omega\) and \(L_2 \approx 0.271608\ {\rm s} \times 149.085\ \Omega \approx 40\ {\rm H}\)

(Source code)

_images/guide_drt-3.svg
|   tau, RC (s) |   gamma, RC (ohm) |   tau, RL (s) |   gamma, RL (ohm) |
|--------------:|------------------:|--------------:|------------------:|
|   4.60645e-10 |      289.925      |   3.05543e-06 |        0.00891355 |
|   5.28003e-06 |        0.0198689  |   3.05543e-06 |        0.00891355 |
|   5.28003e-06 |        0.0198689  |   1.63833e-05 |        0.0126733  |
|   5.92308e-06 |        0.0270496  |   1.63833e-05 |        0.0126733  |
|   5.92308e-06 |        0.0270496  |   2.75326e-05 |        0.0099311  |
|   1.01729e-05 |        0.00475814 |   2.75326e-05 |        0.0099311  |
|   1.01729e-05 |        0.00475814 |   0.000109749 |        0.0314605  |
|   3.70669e-05 |        0.0147584  |   0.000109749 |        0.0314605  |
|   3.70669e-05 |        0.0147584  |   0.000166522 |        0.0195471  |
|   7.28352e-05 |        0.0196474  |   0.000166522 |        0.0195471  |
|   7.28352e-05 |        0.0196474  |   0.000272624 |        0.0393392  |
|   0.000230559 |      230.233      |   0.000272624 |        0.0393392  |
|   0.000771132 |        0.00893735 |   0.000512795 |        0.0399306  |
|   0.000771132 |        0.00893735 |   0.000512795 |        0.0399306  |
|   0.00105728  |        0.00459818 |   0.00789638  |        0.0116901  |
|   0.00105728  |        0.00459818 |   0.00789638  |        0.0116901  |
|   0.00185517  |        0.0331227  |   0.00956206  |        1.02824    |
|   0.00185517  |        0.0331227  |   0.271608    |      149.085      |
|   0.00370024  |        0.0500698  |   0.658958    |        0.0536769  |
|   0.00370024  |        0.0500698  |   0.658958    |        0.0536769  |
|   0.00546967  |        0.044606   |   1.45096     |        0.0433677  |
|   0.00546967  |        0.044606   |   1.45096     |        0.0433677  |
|   0.0126403   |        0.150534   | nan           |      nan          |
|   0.0126403   |        0.150534   | nan           |      nan          |
|   0.0285097   |        0.00708604 | nan           |      nan          |
|   0.0285097   |        0.00708604 | nan           |      nan          |
|   0.0455447   |        0.116258   | nan           |      nan          |
|   0.0455447   |        0.116258   | nan           |      nan          |
|   0.0574022   |      574.438      | nan           |      nan          |
|   0.0675327   |        0.0681987  | nan           |      nan          |
|   0.0675327   |        0.0681987  | nan           |      nan          |
|   0.131324    |        0.0287684  | nan           |      nan          |
|   0.131324    |        0.0287684  | nan           |      nan          |
|   0.228107    |        0.0382958  | nan           |      nan          |
|   0.228107    |        0.0382958  | nan           |      nan          |
|   0.276414    |        0.0018757  | nan           |      nan          |
|   0.276414    |        0.0018757  | nan           |      nan          |
|   1.00071     |        1.19876    | nan           |      nan          |

Peak analysis

DRT results (aside from those obtained using the Loewner method) can be analyzed using skew normal distributions (see Danzer (2019) and Plank et al. (2024)). This facilitates the estimation of the polarization contribution of each peak based on the area of that peak.

(Source code)

_images/guide_drt-4_00.svg
_images/guide_drt-4_01.svg
_images/guide_drt-4_02.svg
_images/guide_drt-4_03.svg
|     tau (s) |   gamma (ohm) |   R_peak (ohm) |
|------------:|--------------:|---------------:|
| 1.24844e-05 |   2.68972e-08 |    4.33529e-07 |
| 0.00155063  | 520.733       |  280.396       |
| 0.00419888  | 831.637       |  470.508       |
| 9.76195     |   0.364749    |    0.552689    |
Table 2 True and estimated values of parallel RC elements.

Component

True value

Estimated value

\(R_2\)

\(300\ \Omega\)

\(280\ \Omega\)

\(C_1\)

\(5.0 \times 10^{-6}\ {\rm F}\)

\(5.5 \times 10^{-6}\ {\rm F}\)

\(R_3\)

\(450\ \Omega\)

\(471\ \Omega\)

\(C_2\)

\(1.0 \times 10^{-5}\ {\rm F}\)

\(8.9 \times 10^{-6}\ {\rm F}\)

References: