Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding notebook examples #135

Merged
merged 18 commits into from
Jan 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Add Adam notebook
BradyPlanden committed Jan 9, 2024
commit 5a185ae6c685a04df53a055d780600a7036c48f1
9,464 changes: 9,464 additions & 0 deletions examples/notebooks/spm_Adam.ipynb

Large diffs are not rendered by default.


Unchanged files with check annotations Beta

if any(w) and issubclass(w[-1].category, UserWarning):
# Catch infeasible parameter combinations e.g. E_Li > Q_p
print(f"ignoring this sample due to: {w[-1].message}")
return np.inf

Check warning on line 162 in examples/scripts/spme_max_energy.py

Codecov / codecov/patch

examples/scripts/spme_max_energy.py#L161-L162

Added lines #L161 - L162 were not covered by tests
else:
voltage = sol[:, 0]
)
if sol == [np.inf]:
return sol

Check warning on line 285 in pybop/_problem.py

Codecov / codecov/patch

pybop/_problem.py#L285

Added line #L285 was not covered by tests
else:
predictions = [sol[signal].data for signal in self.signal + ["Time [s]"]]
self.cost0 = cost_function(x0)
self.inf_count = 0
if np.isinf(self.cost0):
raise Exception("The initial parameter values return an infinite cost.")

Check warning on line 61 in pybop/optimisers/scipy_optimisers.py

Codecov / codecov/patch

pybop/optimisers/scipy_optimisers.py#L61

Added line #L61 was not covered by tests
def cost_wrapper(x):
cost = cost_function(x) / self.cost0
# Ensure outputs have the same length
len_diff = len(target_output) - len(model_output)
if len_diff > 0:
model_output = np.concatenate(

Check warning on line 221 in pybop/plotting/quick_plot.py

Codecov / codecov/patch

pybop/plotting/quick_plot.py#L221

Added line #L221 was not covered by tests
(model_output, np.full([len_diff, np.shape(model_output)[1]], np.nan)),
axis=0,
)