From ac16694e6194e8d4ac73e378d1752cc0cacffc58 Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Fri, 28 Jun 2024 10:27:29 +0100 Subject: [PATCH 1/3] feat: add model.simulateS1 to benchmarks, add build clean between CI --- .github/workflows/periodic_benchmarks.yaml | 7 +++++++ .github/workflows/scheduled_tests.yaml | 7 +++++++ CHANGELOG.md | 1 + benchmarks/benchmark_model.py | 10 ++++++++++ 4 files changed, 25 insertions(+) diff --git a/.github/workflows/periodic_benchmarks.yaml b/.github/workflows/periodic_benchmarks.yaml index 637711507..e015bf24c 100644 --- a/.github/workflows/periodic_benchmarks.yaml +++ b/.github/workflows/periodic_benchmarks.yaml @@ -22,6 +22,13 @@ jobs: runs-on: [self-hosted, macOS, ARM64] if: github.repository == 'pybop-team/PyBOP' steps: + - name: Cleanup build folder + run: | + ls -la ./ + rm -rf ./* || true + rm -rf ./.??* || true + ls -la ./ + - uses: actions/checkout@v4 - name: Install python & create virtualenv diff --git a/.github/workflows/scheduled_tests.yaml b/.github/workflows/scheduled_tests.yaml index ade881885..1daf7c237 100644 --- a/.github/workflows/scheduled_tests.yaml +++ b/.github/workflows/scheduled_tests.yaml @@ -113,6 +113,13 @@ jobs: matrix: ${{fromJson(needs.filter_pybamm_matrix.outputs.filtered_pybop_matrix)}} steps: + - name: Cleanup build folder + run: | + ls -la ./ + rm -rf ./* || true + rm -rf ./.??* || true + ls -la ./ + - uses: actions/checkout@v4 - name: Install python & create virtualenv shell: bash diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a04d46bf..93752e1d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Features +- [#379](https://github.com/pybop-team/PyBOP/pull/379) - Adds model.simulateS1 to weekly benchmarks. - [#174](https://github.com/pybop-team/PyBOP/issues/174) - Adds new logo and updates Readme for accessibility. - [#316](https://github.com/pybop-team/PyBOP/pull/316) - Adds Adam with weight decay (AdamW) optimiser, adds depreciation warning for pints.Adam implementation. - [#271](https://github.com/pybop-team/PyBOP/issues/271) - Aligns the output of the optimisers via a generalisation of Result class. diff --git a/benchmarks/benchmark_model.py b/benchmarks/benchmark_model.py index df0335c24..97f1b0f02 100644 --- a/benchmarks/benchmark_model.py +++ b/benchmarks/benchmark_model.py @@ -81,3 +81,13 @@ def time_model_simulate(self, model, parameter_set): parameter_set (str): The name of the parameter set being used. """ self.problem._model.simulate(inputs=self.inputs, t_eval=self.t_eval) + + def time_model_simulateS1(self, model, parameter_set): + """ + Benchmark the simulate method of the model. + + Args: + model (pybop.Model): The model class being benchmarked. + parameter_set (str): The name of the parameter set being used. + """ + self.problem._model.simulateS1(inputs=self.inputs, t_eval=self.t_eval) From f72a85e6e4f3046ebc660e3b7d445a60b6431cec Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Fri, 28 Jun 2024 13:19:41 +0100 Subject: [PATCH 2/3] fix: docstrings, remove ls -la command --- .github/workflows/periodic_benchmarks.yaml | 2 -- .github/workflows/scheduled_tests.yaml | 2 -- benchmarks/benchmark_model.py | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/periodic_benchmarks.yaml b/.github/workflows/periodic_benchmarks.yaml index e015bf24c..704c7975a 100644 --- a/.github/workflows/periodic_benchmarks.yaml +++ b/.github/workflows/periodic_benchmarks.yaml @@ -24,10 +24,8 @@ jobs: steps: - name: Cleanup build folder run: | - ls -la ./ rm -rf ./* || true rm -rf ./.??* || true - ls -la ./ - uses: actions/checkout@v4 diff --git a/.github/workflows/scheduled_tests.yaml b/.github/workflows/scheduled_tests.yaml index 1daf7c237..159152f05 100644 --- a/.github/workflows/scheduled_tests.yaml +++ b/.github/workflows/scheduled_tests.yaml @@ -115,10 +115,8 @@ jobs: steps: - name: Cleanup build folder run: | - ls -la ./ rm -rf ./* || true rm -rf ./.??* || true - ls -la ./ - uses: actions/checkout@v4 - name: Install python & create virtualenv diff --git a/benchmarks/benchmark_model.py b/benchmarks/benchmark_model.py index 97f1b0f02..843b03bcc 100644 --- a/benchmarks/benchmark_model.py +++ b/benchmarks/benchmark_model.py @@ -84,7 +84,7 @@ def time_model_simulate(self, model, parameter_set): def time_model_simulateS1(self, model, parameter_set): """ - Benchmark the simulate method of the model. + Benchmark the simulateS1 method of the model. Args: model (pybop.Model): The model class being benchmarked. From da9b1e5e0624d8d10ca3251f749ab5471d469b38 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 30 Jun 2024 10:42:18 +0000 Subject: [PATCH 3/3] style: pre-commit fixes --- .../LGM_50_identification.ipynb | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/examples/notebooks/Battery Parameterisation/LGM_50_identification.ipynb b/examples/notebooks/Battery Parameterisation/LGM_50_identification.ipynb index a3b766ccf..219595430 100644 --- a/examples/notebooks/Battery Parameterisation/LGM_50_identification.ipynb +++ b/examples/notebooks/Battery Parameterisation/LGM_50_identification.ipynb @@ -166,8 +166,12 @@ "outputs": [], "source": [ "ocp = loadmat(\"LG_M50_ECM/data/LGM50_5Ah_OCV.mat\", simplify_cells=True, mat_dtype=False)\n", - "pulse_data = loadmat(\"LG_M50_ECM/data/LGM50_5Ah_Pulse.mat\", simplify_cells=True, mat_dtype=False)\n", - "rate_data = loadmat(\"LG_M50_ECM/data/LGM50_5Ah_RateTest.mat\", simplify_cells=True, mat_dtype=False)" + "pulse_data = loadmat(\n", + " \"LG_M50_ECM/data/LGM50_5Ah_Pulse.mat\", simplify_cells=True, mat_dtype=False\n", + ")\n", + "rate_data = loadmat(\n", + " \"LG_M50_ECM/data/LGM50_5Ah_RateTest.mat\", simplify_cells=True, mat_dtype=False\n", + ")" ] }, { @@ -271,14 +275,14 @@ 0.6170000000856817, 0.7250000000931323, 0.8570000000763685, - 0.9250000000465661, + 0.925000000046566, 1.0330000000540167, - 1.1739999999990687, + 1.173999999999069, 1.2300000000977889, 1.343000000109896, 1.4170000000158325, - 1.5370000000111759, - 1.6480000000447035, + 1.537000000011176, + 1.6480000000447037, 1.7160000000149012, 1.8209999999962747, 1.922000000020489, @@ -353,11 +357,11 @@ 8.852000000071712, 8.989000000059605, 9.078000000095926, - 9.127000000094995, - 9.274000000092201, + 9.127000000094997, + 9.2740000000922, 9.361000000033528, 9.434000000008382, - 9.524000000092201, + 9.5240000000922, 9.63600000005681, 9.754000000073574, 9.83800000010524, @@ -366,13 +370,13 @@ 10.065000000060536, 10.085000000079162, 11.104000000050291, - 12.092000000062399, + 12.0920000000624, 13.12100000004284, - 14.091000000014901, + 14.0910000000149, 15.08800000010524, 16.113000000012107, 17.14000000001397, - 18.087000000057742, + 18.087000000057746, 19.101000000024214, 20.10800000000745 ],