Skip to content

Commit

Permalink
Updated m(RQ)-fit method implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
vyrjana committed Nov 1, 2024
1 parent e00197f commit 9f55d1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions src/pyimpspec/analysis/drt/mrq_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 9f55d1a

Please sign in to comment.