From c2217bce3148b66fa6975f34335ee8209e7aa04d Mon Sep 17 00:00:00 2001 From: Valentin Sulzer Date: Mon, 23 Nov 2020 10:48:19 -0500 Subject: [PATCH 1/4] change graphviz version for windows --- .github/workflows/test_on_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 7fb0962cd1..e23c1b6cb3 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -56,7 +56,7 @@ jobs: - name: Install Windows system dependencies if: matrix.os == 'windows-latest' - run: choco install graphviz + run: choco install graphviz --version 2.42.2 - name: Install standard python dependencies run: | From 4669cf8d9e9702faa451d106a9a466744a6a5678 Mon Sep 17 00:00:00 2001 From: Valentin Sulzer Date: Mon, 23 Nov 2020 10:56:54 -0500 Subject: [PATCH 2/4] try another version --- .github/workflows/test_on_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index e23c1b6cb3..9f724371a3 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -56,7 +56,7 @@ jobs: - name: Install Windows system dependencies if: matrix.os == 'windows-latest' - run: choco install graphviz --version 2.42.2 + run: choco install graphviz --version=2.38.0.20190211 - name: Install standard python dependencies run: | From 6cee128842147069ed47a40def75963ad0a2b762 Mon Sep 17 00:00:00 2001 From: Valentin Sulzer Date: Mon, 23 Nov 2020 12:07:34 -0500 Subject: [PATCH 3/4] #1243 add refs for numpy paper and jax solver --- pybamm/CITATIONS.txt | 19 +++++++++++++++++++ pybamm/citations.py | 3 ++- pybamm/solvers/jax_solver.py | 1 + tests/unit/test_citations.py | 7 ++++++- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/pybamm/CITATIONS.txt b/pybamm/CITATIONS.txt index 452d75f9d6..895bb25444 100644 --- a/pybamm/CITATIONS.txt +++ b/pybamm/CITATIONS.txt @@ -36,6 +36,17 @@ note = {\href{ http://dx.doi.org/10.1149/1.2221597}{doi: 10.1149/1.2221597}}, } +@Article{harris2020array, + title={Array programming with NumPy}, + author={Harris, Charles R and Millman, K Jarrod and van der Walt, St{'e}fan J and Gommers, Ralf and Virtanen, Pauli and Cournapeau, David and Wieser, Eric and Taylor, Julian and Berg, Sebastian and Smith, Nathaniel J and others}, + journal={Nature}, + volume={585}, + number={7825}, + pages={357--362}, + year={2020}, + publisher={Nature Publishing Group} +} + @techreport{hindmarsh2000pvode, title={The {PVODE} and {IDA} algorithms}, author={Hindmarsh, AC}, @@ -55,6 +66,14 @@ publisher={ACM New York, NY, USA} } +@software{jax2018github, + author = {James Bradbury and Roy Frostig and Peter Hawkins and Matthew James Johnson and Chris Leary and Dougal Maclaurin and Skye Wanderman-Milne}, + title = {{JAX}: composable transformations of {P}ython+{N}um{P}y programs}, + url = {http://github.com/google/jax}, + version = {0.2.5}, + year = {2018}, +} + @article{kim2011multi, title={Multi-domain modeling of lithium-ion batteries encompassing multi-physics in varied length scales}, author={Kim, Gi-Heon and Smith, Kandler and Lee, Kyu-Jin and Santhanagopalan, Shriram and Pesaran, Ahmad}, diff --git a/pybamm/citations.py b/pybamm/citations.py index c2e7608684..ce492b8c40 100644 --- a/pybamm/citations.py +++ b/pybamm/citations.py @@ -29,8 +29,9 @@ def _reset(self): "Reset citations to default only (only for testing purposes)" # Initialize empty papers to cite self._papers_to_cite = set() - # Register the PyBaMM paper + # Register the PyBaMM paper and the numpy paper self.register("sulzer2020python") + self.register("harris2020array") def read_citations(self): "Read the citations text file" diff --git a/pybamm/solvers/jax_solver.py b/pybamm/solvers/jax_solver.py index c597556e5b..d81e973c53 100644 --- a/pybamm/solvers/jax_solver.py +++ b/pybamm/solvers/jax_solver.py @@ -60,6 +60,7 @@ def __init__( self.extra_options = extra_options or {} self.name = "JAX solver ({})".format(method) self._cached_solves = dict() + pybamm.citations.register("jax2018github") def get_solve(self, model, t_eval): """ diff --git a/tests/unit/test_citations.py b/tests/unit/test_citations.py index a2e243f552..c361de16cf 100644 --- a/tests/unit/test_citations.py +++ b/tests/unit/test_citations.py @@ -8,10 +8,10 @@ class TestCitations(unittest.TestCase): def test_citations(self): citations = pybamm.citations - citations._reset() # Default papers should be in both _all_citations dict and in the papers to cite self.assertIn("sulzer2020python", citations._all_citations.keys()) self.assertIn("sulzer2020python", citations._papers_to_cite) + self.assertIn("harris2020array", citations._papers_to_cite) # Non-default papers should only be in the _all_citations dict self.assertIn("sulzer2019physical", citations._all_citations.keys()) self.assertNotIn("sulzer2019physical", citations._papers_to_cite) @@ -163,6 +163,11 @@ def test_solver_citations(self): pybamm.AlgebraicSolver() self.assertIn("virtanen2020scipy", citations._papers_to_cite) + citations._reset() + self.assertNotIn("jax2018github", citations._papers_to_cite) + pybamm.JaxSolver() + self.assertIn("jax2018github", citations._papers_to_cite) + if pybamm.have_scikits_odes(): citations._reset() self.assertNotIn("scikits-odes", citations._papers_to_cite) From 76e45e892f91480c676a01eb24267a566fd765e1 Mon Sep 17 00:00:00 2001 From: Valentin Sulzer Date: Mon, 23 Nov 2020 13:23:13 -0500 Subject: [PATCH 4/4] #1243 skip citations test on windows --- tests/unit/test_citations.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/unit/test_citations.py b/tests/unit/test_citations.py index c361de16cf..711595f02f 100644 --- a/tests/unit/test_citations.py +++ b/tests/unit/test_citations.py @@ -3,6 +3,7 @@ # import pybamm import unittest +from platform import system class TestCitations(unittest.TestCase): @@ -163,11 +164,6 @@ def test_solver_citations(self): pybamm.AlgebraicSolver() self.assertIn("virtanen2020scipy", citations._papers_to_cite) - citations._reset() - self.assertNotIn("jax2018github", citations._papers_to_cite) - pybamm.JaxSolver() - self.assertIn("jax2018github", citations._papers_to_cite) - if pybamm.have_scikits_odes(): citations._reset() self.assertNotIn("scikits-odes", citations._papers_to_cite) @@ -185,6 +181,14 @@ def test_solver_citations(self): pybamm.IDAKLUSolver() self.assertIn("hindmarsh2005sundials", citations._papers_to_cite) + @unittest.skipIf(system() == "Windows", "JAX not supported on windows") + def test_jax_citations(self): + citations = pybamm.citations + citations._reset() + self.assertNotIn("jax2018github", citations._papers_to_cite) + pybamm.JaxSolver() + self.assertIn("jax2018github", citations._papers_to_cite) + if __name__ == "__main__": print("Add -v for more debug output")