diff --git a/CHANGELOG.md b/CHANGELOG.md index 12d502f..fd0d126 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - Updated the `Warburg` element class to include an `n` exponent (fixed at 0.5 by default). - Updated the `plot_gamma` function to include a horizontal line marking zero on the y-axis. - Updated the automatic adjustment of initial values of circuit parameters to be bypassed when a non-default value is detected in a `Circuit` that is provided to the m(RQ)-fit method without a corresponding `FitResult`. +- Updated the m(RQ)-fit method to support resistive-inductive `(RQ)` elements. The `n` parameter of the `ConstantPhaseElement` instance would then need to be `-1.0 <= n < 0.0`. - Fixed a bug that caused methods such as `DRTResult.get_peaks` to miss peaks at the time constant extremes. - Fixed a bug that caused an element's parameters in `FitResult.to_parameters_dataframe` to not be in a sorted order. - Fixed the previously unimplemented `FitResult.get_parameters` method. diff --git a/src/pyimpspec/analysis/drt/mrq_fit.py b/src/pyimpspec/analysis/drt/mrq_fit.py index 36e1439..ca211b3 100644 --- a/src/pyimpspec/analysis/drt/mrq_fit.py +++ b/src/pyimpspec/analysis/drt/mrq_fit.py @@ -426,8 +426,11 @@ def _calculate_tau_gamma( n: float = parameters.get("n", 1.0) tau_0: float = (R * Y) ** (1.0 / n) - if isclose(n, 1.0, atol=1e-2): - gamma += R / (W * sqrt(pi)) * exp(-((ln(tau / tau_0) / W) ** 2)) + if isclose(abs(n), 1.0, atol=1e-2): + gamma += ( + R / (W * sqrt(pi)) * exp(-((ln(tau / tau_0) / W) ** 2)) + * (-1 if n < 0.0 else 1) + ) else: gamma += ( (R / (2 * pi))