DRTxECM

v0.2.0 繁體中文

Guide

The DRTxECM interface is in English. Every button and field name below is quoted verbatim from the program, so that you can follow along on screen. The overall workflow is a fixed seven-step sequence.

Overall workflow

  1. Import — import EIS data (CSV / TXT)
  2. Clean Noise Data — click away noise points on the plot (optional, recommended)
  3. Run — run the DRT to obtain γ(τ)
  4. Inspect the DRT quality (DRT, residuals, EIS Score)
  5. Launch Stage 2 — Gaussian peak decomposition of γ(τ)
  6. Export to Stage 3 — adjust R, Q and α and perform the CNLS fit
  7. Export the parameters and figures

Step 1 / Importing EIS data

In the Import Data section on the left side of the main window, click Import and select a CSV or TXT file; the "EIS Data Import Preprocessing Panel (DRTxECM)" window then opens.

Different instruments (BioLogic, Autolab, Solartron, Gamry…) export different numbers of header rows and different column orders, and this window exists to handle those differences:

ControlPurpose
Number of rows to skipSpecify how many rows to skip at the start of the file (instrument header, comments, blank rows)
Toggle Column 3 (Z'') Sign (* -1)Multiply the third column (the imaginary part) by −1. Some instruments store Z'' as positive, which turns the Nyquist plot upside down; use this button to correct it
Confirm and ImportConfirm and import

After importing, the data appear in the main window and an EIS plot is shown at the top of the screen. The data-parsing logic lives in DataImportPreprocessor; if your file format is unusual, the source is in pyDRTtools/extensions.py.

Step 2 / Cleaning noisy data

The menu bar has a separate action, Clean Noise Data (shortcut Ctrl+D). Clicking it opens the "EIS Interactive Data Cleaning Interface".

On the Nyquist plot, click directly on the data points you want to remove to delete them; there is no need to go back and edit the source file.

ButtonPurpose
↩ Undo Last DeletionUndo the last deletion
Reset All ChangesRestore all deleted points
Apply Cleaning and ReturnApply and return to the main window

The window shows Current active data points: — the number of remaining points — live, so that you can see how many points you have deleted.

Once cleaning is finished, the program resamples the data onto a uniform logarithmic frequency grid using PCHIP monotone interpolation. The numerical DRT method requires a uniform frequency grid, so this step is not a plain deletion of data: it resamples at the same time. If your data are already uniform and clean, you may skip this step.

The main window after importing the ZARC sample data: DRT settings on the left, the raw EIS Nyquist plot on the right
The state after importing the bundled ZARC sample data. On the right is the Nyquist plot of the raw EIS data — a depressed semicircle (its centre lies below the real axis), which is the signature of a CPE phase angle α < 1. On the left are all the DRT settings. Click the image for full size.

Step 3 / Configuring and running the DRT

The left side of the main window holds the DRT settings; the upper right shows the plots and the lower right the run buttons. The settings are as follows:

FieldOptionsDescription
Method of Discretization Gaussian (default), C2 Matern, C4 Matern, C6 Matern, Inverse Quadratic, Inverse Quadric, Cauchy, PWL The basis functions (radial basis) used to discretize γ(τ). Gaussian is the most common starting point; PWL is piecewise linear
Data Used Combined Re-Im Data (default), Re Data, Im Data Whether the fit uses the real part, the imaginary part, or both. Both are used by default
Inductance Fitting w/o Inductance (default), Fitting with Inductance, Discard Inductive Data Whether the inductive behavior at the high-frequency end is fitted along with the rest, ignored, or whether the data in the inductive region are simply discarded
Regularization Derivative 1st order (default), 2nd order The order of the derivative in the regularization term, which controls the smoothness of γ(τ)
Parameter Selection Method custom, GCV (the default at program start), mGCV, rGCV, LC, kf, re-im How the regularization parameter λ is determined. With custom it is set manually in the field below
Regularization parameter default 0.001 The manual value of λ (used only in custom mode)
Optimal Regularization parameter read-only The λ selected automatically by the program; it is displayed here after a run
Number of Samples default 1000 Number of samples for the Bayesian-related methods (Bayesian / BHT)
RBF Shape Control FWHM Coefficient (default), Shape Factor How the width of the basis functions is determined
FWHM Control default 0.5 The width coefficient of the basis functions. Larger = smoother; smaller = higher resolution but more prone to oscillation

Once configured, three DRT algorithms can be run from the lower right, each with its own Run button:

ButtonMethod
Simple RunRidge regression / Tikhonov regularization. The fastest; use this first in ordinary cases
Bayesian RunBayesian regularization, estimating the noise and regularization hyperparameters jointly
Hilbert TransformBHT (Bayesian Hilbert Transform), a variant that makes use of the Kramers-Kronig relations

Step 4 / Reviewing the DRT results

The right side of the main window has a row of display buttons that switch between plots:

ButtonPlot contents
EIS DataNyquist plot of the raw EIS data
MagnitudeImpedance magnitude |Z| of the Bode plot
PhasePhase angle of the Bode plot
Re PartReal part versus frequency
Im PartImaginary part versus frequency
Re ResidualReal-part residual (experimental value − fitted value)
Im ResidualImaginary-part residual
DRTThe γ(τ) distribution, that is, the target of the decomposition in the next step
EIS ScoreThe goodness-of-fit score of each method, used to compare different settings

A tip for judging quality: the residuals should scatter randomly around zero and should not curve systematically. If the residuals show clear structure, it usually means that the number of peaks is insufficient, that the regularization parameter λ is unsuitable, or that the high-frequency inductance has not been handled properly.

The DRT result showing a single relaxation peak in gamma(tau)
The DRT result after pressing Simple Run (with Parameter Selection Method set to GCV). This dataset has a single clear relaxation peak, so decomposing it with one or two peaks is sufficient for the next step.

Step 5 / Stage 2: Gaussian peak decomposition

In the Peak deconvolution section, enter the Number of peaks (default 3), then click the blue Launch Stage 2 (Peak Analysis) button to open the "Stage 2: DRT Peak Fitting (DRTxECM)" window.

This window performs a multi-Gaussian peak fit on the γ(τ) obtained in the previous step, splitting the continuous distribution into a number of discrete peaks:

γ(ln τ) ≈ Σi Ai · exp( −(ln τ − μi)2 / (2 σi2) )
ButtonPurpose
View Initial Guess (Plot Guess)Show the initial guess generated automatically by the program first, without optimizing
Execute Gaussian FitRun the multi-Gaussian fit
Export Stage 2 Decomposition Report (.csv)Export the decomposition report: the parameters of each peak, together with the sampled points of each peak's fitted curve
Export to Stage 3 (CPE Fine-Tuning)Convert the peak parameters into initial R//CPE values and open the third stage

Peak parameter table

Each peak has three fields, each with its own check box:

FieldMeaning
ampPeak amplitude Ai
cenPeak center position μi (in ln τ)
widPeak width σi (default 0.8)

Checked = lock that parameter (it is held fixed and given no room to vary); unchecked = let the fit adjust it freely. If you are confident about the physical location of a given peak, locking it lets the other peaks converge more stably.

The Stage 2 window: a three-Gaussian-peak decomposition and its parameter table
The result after pressing Execute Gaussian Fit. The table on the left holds each peak's amplitude amp, position cen and width wid; on the right the black dots are the raw DRT data, the red line is the sum of the three peaks, and the coloured dashed curves are the individual peaks. The top left also shows the R_ohm resolved in Stage 1 (10.014 Ω for this sample).

Step 6 / Stage 3: equivalent-circuit CNLS fitting

Clicking Export to Stage 3 (CPE Fine-Tuning) opens the "Stage 3: ECM Fine-Tune Panel (DRTxECM)".

How peak parameters become circuit initial values

The program performs the following conversion automatically (each Gaussian peak corresponds to one R//CPE branch):

R = A · σ · √(2π)
τ = exp(μ)
Q = τ / R
α = 1.0 (starting value)

In other words, the DRT peaks are not merely a visual decomposition: they directly provide a physically reasonable starting point. This is one of the greatest advantages of DRTxECM over general-purpose circuit-fitting tools.

Parameter table

The columns of the table on the left are Element | Freedom | Value | Error | Error%:

ElementCorresponding circuit element
R_ohmThe series ohmic resistance R0 (high-frequency intercept)
L_indThe series inductance L
R_iResistance of the i-th branch
Q_iCPE parameter Q of the i-th branch
n_iThe CPE phase angle α of the i-th branch (0.2 to 1.0 or 1.05)

The Freedom column determines how free each parameter is during optimization. Different element types offer different modes (these are the exact strings shown in the interface):

ElementAvailable modesAllowed range
R_i, Q_i Free, Free +-5%, Free +-10%, Fixed Free: 0 to ∞; Free +-5% / Free +-10%: ±5% / ±10% of the current value; Fixed: locked
n_i (that is, α) Free, <= 1, Fixed <= 1: 0.2 to 1.0; Free: 0.2 to 1.05; Fixed: locked
L_ind Free, Fixed Free: −∞ to ∞; Fixed: locked

R, Q and L all default to Fixed, and α defaults to <= 1, so on first entering Stage 3 only the three α values can be optimized. The recommended order is: let the α values converge first, then release R and Q one at a time.

In the formal literature the theoretical upper bound for the CPE α is 1 (an ideal capacitor). The program also offers a mode that allows up to 1.05, in order to absorb measurement error and deviations in the equivalent series resistance, so that the fit does not get stuck on a hard boundary. If you need the α in your report to conform strictly to the physical definition, use <= 1.

Running the fit

  1. Click Simulation first to draw the simulated curve with the current parameter values and confirm that the starting state is reasonable
  2. Click the green Fitting (Optimize Parameters) button to run the CNLS optimization
  3. Once converged, the Value column is updated to the optimal values, and the Error and Error% columns show the estimated standard errors
  4. The Nyquist and Bode plots on the right update in step, with each branch drawn in a different color

The bottom of the window shows Complex Impedance RMSE, which is updated after Fitting to the RMSE value with units.

The Stage 3 parameter table after fitting, with branch-resolved Nyquist and Bode plots
The outcome of Fitting with three branches, R and Q set to Free +-10% and α set to <= 1. Note the Error% column: this example fits a single ZARC semicircle with three branches, which over-parameterizes the data, so the standard errors are large. In practice the number of peaks should match the actual peaks in the DRT curve rather than being increased just to lower the RMSE.

Step 7 / Exporting the results

LocationButtonWhat is exported
Main window, Export sectionDRT → ExportThe γ(τ) result of the DRT (frequency, τ, γ)
Main window, Export sectionEIS Regression → ExportThe fitted EIS values and the residuals
Main window, Export sectionFigure → SaveThe figure currently displayed
Stage 2Export Stage 2 Decomposition Report (.csv)The peak parameters and the decomposition curve of each peak
Stage 3Export Datasheet (.csv)The circuit parameters, standard errors, and the combined report after fitting

Troubleshooting

Clicking Clean Noise Data says there is no data

The warning No EIS data loaded! appears. Click Import to load data first.

The DRT curve goes negative or oscillates violently

This is usually under-regularization (λ too small) or an FWHM Control that is too small. You can: leave Parameter Selection Method on GCV so that the program selects λ automatically; increase FWHM Control; or switch to Bayesian Run.

The fit does not converge

The common cause is initial values that lie too far from the true values. The recommended order is: use Stage 2 first to obtain a good initial guess → in Stage 3, release the parameters one at a time rather than setting them all to free at once. In practice, release R and Q first and release α once they have converged; this is much more stable.

α sticks at 0.2 or 1.0

This means that the optimum lies on a boundary. If it sticks at 1.0, the branch may in fact be close to an ideal capacitor, or the data quality may not support a free fit of α; if it sticks at 0.2, the frequency range of that branch is usually too narrow or it has too few points. You can check the branch's coverage in the Nyquist plot.

Error% shows N/A or <15%

The uncertainty is estimated from the inverse Hessian matrix. If the Hessian cannot be obtained or is unstable, the program falls back to displaying N/A; in some cases it shows <15% instead, as a rough upper bound on the relative error. This is not an error, but it does mean that the standard errors for that parameter set should be treated with caution.

The Stage 2 fit takes a long time

The multi-Gaussian fit iterates at most 10000 times. The more peaks there are, the slower it is. Start with 2 to 4 peaks and increase the number once you have confirmed the shape of γ(τ).