Skip to content

Commit

Permalink
tests: Adds nyquist plot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyPlanden committed Aug 15, 2024
1 parent b6375f9 commit e571b8d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/unit/test_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,35 @@ def test_plot2d_prior_bounds(self, model, dataset):
):
warnings.simplefilter("always")
pybop.plot2d(cost)

@pytest.mark.unit
def test_nyquist(self):
# Define model
model = pybop.lithium_ion.SPM(
eis=True, options={"surface form": "differential"}
)

# Fitting parameters
parameters = pybop.Parameters(
pybop.Parameter(
"Positive electrode thickness [m]",
prior=pybop.Gaussian(60e-6, 1e-6),
bounds=[10e-6, 80e-6],
)
)

# Form dataset
dataset = pybop.Dataset(
{
"Frequency [Hz]": np.logspace(-4, 5, 10),
"Current function [A]": np.ones(10) * 0.0,
"Impedance": np.ones(10) * 0.0,
}
)

signal = ["Impedance"]
# Generate problem, cost function, and optimisation class
problem = pybop.FittingProblem(model, parameters, dataset, signal=signal)

# Plot the nyquist
pybop.nyquist(problem, problem_inputs=[60e-6], title="Optimised Comparison")

0 comments on commit e571b8d

Please sign in to comment.