WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions impedance/models/circuits/circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,11 @@ def load(self, filepath, fitted_as_initial=False):
self.parameters_ = np.array(json_data["Parameters"])
self.conf_ = np.array(json_data["Confidence"])

@property
def parameters(self):
"""Returns the model parameters."""
return self.parameters_


class Randles(BaseCircuit):
""" A Randles circuit model class """
Expand Down
6 changes: 6 additions & 0 deletions impedance/tests/test_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_BaseCircuit():
# check initial_guess is loaded in correctly
base_circuit = BaseCircuit(initial_guess)
assert base_circuit.initial_guess == initial_guess
assert base_circuit.parameters is None

# improper input_guess types raise an TypeError
with pytest.raises(TypeError):
Expand Down Expand Up @@ -69,6 +70,7 @@ def test_Randles():
np.array([1.86235717e-02, 1.16804085e-02,
6.27121224e-02, 2.21232935e+02,
1.17171440e+00]), decimal=2)
np.testing.assert_array_equal(randles.parameters, randles.parameters_)

# compare with known impedance predictions
assert np.isclose(randles.predict(np.array([10.0])),
Expand Down Expand Up @@ -193,6 +195,10 @@ def test_CustomCircuit():
circuit=custom_string)
custom_circuit.fit([1, 2, 3], [4, 4, 4])
assert custom_circuit.parameters_[0] == 4
np.testing.assert_array_equal(
custom_circuit.parameters,
custom_circuit.parameters_
)

# space in circuit string
circuit = circuit = 'R0-p(R1, C1)'
Expand Down