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 5d83779 commit e00197f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- Updated the `fit_circuit` function to ignore `RuntimeWarning`s during fitting.
- 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`.
- 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
11 changes: 10 additions & 1 deletion src/pyimpspec/analysis/drt/mrq_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,16 @@ def _validate_circuit(circuit: Circuit):


def _adjust_initial_values(circuit: Circuit, data: DataSet) -> Circuit:
element: Union[Element, Connection]
for element in circuit.get_elements(recursive=True):
defaults: Dict[str, float] = element.get_default_values()

key: str
value: float
for key, value in element.get_values().items():
if not isclose(value, defaults[key]):
return circuit

f: Frequencies = data.get_frequencies()
Z_exp: ComplexImpedances = data.get_impedances()

Expand All @@ -342,7 +352,6 @@ def _adjust_initial_values(circuit: Circuit, data: DataSet) -> Circuit:
if not isinstance(series, Series):
raise TypeError(f"Expected a Series instead of {series=}")

element: Union[Element, Connection]
for element in series:
if isinstance(element, Resistor):
if not element.is_fixed("R"):
Expand Down

0 comments on commit e00197f

Please sign in to comment.