From c63e4febcfd4109fa6de3d34133b35c90c652bbc Mon Sep 17 00:00:00 2001 From: Valentin Sulzer Date: Wed, 17 Nov 2021 17:19:23 -0500 Subject: [PATCH 01/20] #1804 parameterization with absolute path --- pybamm/parameters/parameter_values.py | 3 +++ tests/unit/test_parameters/test_parameter_values.py | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/pybamm/parameters/parameter_values.py b/pybamm/parameters/parameter_values.py index 24d74e7bdb..a013915f55 100644 --- a/pybamm/parameters/parameter_values.py +++ b/pybamm/parameters/parameter_values.py @@ -964,6 +964,9 @@ def find_parameter(path): """Look for parameter file in the different locations in PARAMETER_PATH """ + # Check for absolute path + if os.path.isfile(path) and os.path.isabs(path): + return path for location in pybamm.PARAMETER_PATH: trial_path = os.path.join(location, path) if os.path.isfile(trial_path): diff --git a/tests/unit/test_parameters/test_parameter_values.py b/tests/unit/test_parameters/test_parameter_values.py index 59e9ecad11..e0eedbad8d 100644 --- a/tests/unit/test_parameters/test_parameter_values.py +++ b/tests/unit/test_parameters/test_parameter_values.py @@ -61,6 +61,18 @@ def test_init(self): ) self.assertEqual(param["Positive electrode porosity"], 0.3) + # from file, absolute path + param = pybamm.ParameterValues( + os.path.join( + pybamm.root_dir(), + "pybamm", + "input", + "parameters", + "lithium_ion/positive_electrodes/lico2_Marquis2019/parameters.csv", + ) + ) + self.assertEqual(param["Positive electrode porosity"], 0.3) + # values vs chemistry with self.assertRaisesRegex( ValueError, "values and chemistry cannot both be None" From 544a833bfabb0daecb0acc698658479b9e9645c3 Mon Sep 17 00:00:00 2001 From: Valentin Sulzer Date: Fri, 26 Nov 2021 12:18:48 -0500 Subject: [PATCH 02/20] #1804 more debug statements --- pybamm/parameters/parameter_values.py | 2 ++ pybamm/util.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/pybamm/parameters/parameter_values.py b/pybamm/parameters/parameter_values.py index 5678948a44..e095ed295d 100644 --- a/pybamm/parameters/parameter_values.py +++ b/pybamm/parameters/parameter_values.py @@ -946,9 +946,11 @@ def find_parameter(path): """ # Check for absolute path if os.path.isfile(path) and os.path.isabs(path): + pybamm.logger.verbose(f"Using absolute path: '{path}'") return path for location in pybamm.PARAMETER_PATH: trial_path = os.path.join(location, path) if os.path.isfile(trial_path): + pybamm.logger.verbose(f"Using path: '{location}' + '{path}'") return trial_path raise FileNotFoundError("Could not find parameter {}".format(path)) diff --git a/pybamm/util.py b/pybamm/util.py index 90a06ef702..93d2c799f5 100644 --- a/pybamm/util.py +++ b/pybamm/util.py @@ -289,6 +289,9 @@ def load_function(filename): path = root_path.replace("/", ".") path = path.replace("\\", ".") + pybamm.logger.debug( + f"Importing function '{tail}' from file '{filename}' via path '{path}'" + ) module_object = importlib.import_module(path) return getattr(module_object, tail) From 937a9a815e4e21192757e8595744fdc78315d270 Mon Sep 17 00:00:00 2001 From: Saransh Date: Sat, 4 Dec 2021 14:29:42 +0530 Subject: [PATCH 03/20] #1804 allow imports from another drive --- pybamm/util.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pybamm/util.py b/pybamm/util.py index 93d2c799f5..ddf4fd45e7 100644 --- a/pybamm/util.py +++ b/pybamm/util.py @@ -278,12 +278,24 @@ def load_function(filename): # Assign path to _ and filename to tail _, tail = os.path.split(filename) + # Store the current working directory + orig_dir = os.getcwd() + # Strip absolute path to pybamm/input/example.py if "pybamm" in filename: root_path = filename[filename.rfind("pybamm") :] + # If the function is in the current working directory elif os.getcwd() in filename: root_path = filename.replace(os.getcwd(), "") root_path = root_path[1:] + # If the function is not in the current working directory and the path provided is + # absolute + elif os.path.isabs(filename) and not os.getcwd() in filename: + # Change directory to import the function + dir_path = os.path.split(filename)[0] + os.chdir(dir_path) + root_path = filename.replace(os.getcwd(), "") + root_path = root_path[1:] else: root_path = filename @@ -294,6 +306,8 @@ def load_function(filename): ) module_object = importlib.import_module(path) + # Revert back current working directory if it was changed + os.chdir(orig_dir) return getattr(module_object, tail) From 435183d29524fea45cc44e7c5c9ab308cad8224a Mon Sep 17 00:00:00 2001 From: Saransh Date: Mon, 6 Dec 2021 12:40:30 +0530 Subject: [PATCH 04/20] #1804 `os.getcwd()` issue --- pybamm/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pybamm/util.py b/pybamm/util.py index ddf4fd45e7..5c24f2e87d 100644 --- a/pybamm/util.py +++ b/pybamm/util.py @@ -287,7 +287,9 @@ def load_function(filename): # If the function is in the current working directory elif os.getcwd() in filename: root_path = filename.replace(os.getcwd(), "") - root_path = root_path[1:] + # getcwd() returns "C:\\" when in the root drive and "C:\\a\\b\\c" otherwise + if root_path[0] == "\\" or root_path[0] == "/": + root_path = root_path[1:] # If the function is not in the current working directory and the path provided is # absolute elif os.path.isabs(filename) and not os.getcwd() in filename: From bc383c0c07043db065ffe734c559d8c5f2eb8a69 Mon Sep 17 00:00:00 2001 From: Scott Marquis Date: Mon, 10 Jan 2022 08:58:16 +0100 Subject: [PATCH 05/20] #1886 added fix within processed variable --- pybamm/solvers/processed_variable.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pybamm/solvers/processed_variable.py b/pybamm/solvers/processed_variable.py index 7261a9aaad..1977464f74 100644 --- a/pybamm/solvers/processed_variable.py +++ b/pybamm/solvers/processed_variable.py @@ -599,7 +599,12 @@ def initialise_sensitivity_explicit_forward(self): # Add the individual sensitivity start = 0 - for name, inp in self.all_inputs[0].items(): + # Sort the list of input names so that it aligns + # with the sorting applied during solver setup + sorted_input_names = self.all_inputs[0].keys() + sorted_input_names.sort() + for name in sorted_input_names: + inp = self.all_inputs[0][name] end = start + inp.shape[0] sensitivities[name] = S_var[:, start:end] start = end From 3ff8bd706cfc231722a038ad6d2f62108e6efcd9 Mon Sep 17 00:00:00 2001 From: Scott Marquis Date: Mon, 10 Jan 2022 09:20:25 +0100 Subject: [PATCH 06/20] #1886 added to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b3c901cca..fbb786aa26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ## Bug fixes +- Fixed issue in extraction of sensitivites ([#1886](https://github.com/pybamm-team/PyBaMM/issues/1886)) - `PyBaMM` is now importable in `Linux` systems where `jax` is already installed ([#1874](https://github.com/pybamm-team/PyBaMM/pull/1874)) - Simulations with drive cycles now support `initial_soc` ([#1842](https://github.com/pybamm-team/PyBaMM/pull/1842)) - Fixed bug in expression tree simplification ([#1831](https://github.com/pybamm-team/PyBaMM/pull/1831)) From 6103f2c9c775fedeab1bd28677eb4239c3b7c5df Mon Sep 17 00:00:00 2001 From: Scott Marquis Date: Mon, 10 Jan 2022 09:46:13 +0100 Subject: [PATCH 07/20] #1886 fix missing list argument --- pybamm/solvers/processed_variable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pybamm/solvers/processed_variable.py b/pybamm/solvers/processed_variable.py index 1977464f74..5ac647658f 100644 --- a/pybamm/solvers/processed_variable.py +++ b/pybamm/solvers/processed_variable.py @@ -601,7 +601,7 @@ def initialise_sensitivity_explicit_forward(self): start = 0 # Sort the list of input names so that it aligns # with the sorting applied during solver setup - sorted_input_names = self.all_inputs[0].keys() + sorted_input_names = list(self.all_inputs[0].keys()) sorted_input_names.sort() for name in sorted_input_names: inp = self.all_inputs[0][name] From 3a3c2311690e86a666345fd407c08c2cf897e1fc Mon Sep 17 00:00:00 2001 From: Scott Marquis Date: Mon, 10 Jan 2022 09:50:04 +0100 Subject: [PATCH 08/20] #1886 fixed link in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbb786aa26..93d7216800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ ## Bug fixes -- Fixed issue in extraction of sensitivites ([#1886](https://github.com/pybamm-team/PyBaMM/issues/1886)) +- Fixed issue in extraction of sensitivites ([#1886](https://github.com/pybamm-team/PyBaMM/pull/1894/files)) - `PyBaMM` is now importable in `Linux` systems where `jax` is already installed ([#1874](https://github.com/pybamm-team/PyBaMM/pull/1874)) - Simulations with drive cycles now support `initial_soc` ([#1842](https://github.com/pybamm-team/PyBaMM/pull/1842)) - Fixed bug in expression tree simplification ([#1831](https://github.com/pybamm-team/PyBaMM/pull/1831)) From c8964436d231c4881d0fd1718f452f98fca61294 Mon Sep 17 00:00:00 2001 From: Scott Marquis Date: Mon, 10 Jan 2022 09:50:35 +0100 Subject: [PATCH 09/20] #1886 actually fixed the link in the changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93d7216800..94bcb34743 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ ## Bug fixes -- Fixed issue in extraction of sensitivites ([#1886](https://github.com/pybamm-team/PyBaMM/pull/1894/files)) +- Fixed issue in extraction of sensitivites ([#1886](https://github.com/pybamm-team/PyBaMM/pull/1894)) - `PyBaMM` is now importable in `Linux` systems where `jax` is already installed ([#1874](https://github.com/pybamm-team/PyBaMM/pull/1874)) - Simulations with drive cycles now support `initial_soc` ([#1842](https://github.com/pybamm-team/PyBaMM/pull/1842)) - Fixed bug in expression tree simplification ([#1831](https://github.com/pybamm-team/PyBaMM/pull/1831)) From 51b7ed8cf9a2ebd81dfb2d73ab6e91403b07b15f Mon Sep 17 00:00:00 2001 From: Scott Marquis Date: Mon, 10 Jan 2022 09:51:14 +0100 Subject: [PATCH 10/20] #1886 and the other one --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94bcb34743..16a0c31da7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ ## Bug fixes -- Fixed issue in extraction of sensitivites ([#1886](https://github.com/pybamm-team/PyBaMM/pull/1894)) +- Fixed issue in extraction of sensitivites ([#1894](https://github.com/pybamm-team/PyBaMM/pull/1894)) - `PyBaMM` is now importable in `Linux` systems where `jax` is already installed ([#1874](https://github.com/pybamm-team/PyBaMM/pull/1874)) - Simulations with drive cycles now support `initial_soc` ([#1842](https://github.com/pybamm-team/PyBaMM/pull/1842)) - Fixed bug in expression tree simplification ([#1831](https://github.com/pybamm-team/PyBaMM/pull/1831)) From c171f328361ea6d898058d05a589fc5c42c3817c Mon Sep 17 00:00:00 2001 From: Scott Marquis Date: Tue, 11 Jan 2022 21:36:16 +0100 Subject: [PATCH 11/20] #1886 modify to pass test - now sort inputs when initially passed to solver --- pybamm/solvers/base_solver.py | 7 ++++++- pybamm/solvers/processed_variable.py | 20 +++++++++---------- tests/unit/test_solvers/test_casadi_solver.py | 3 ++- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/pybamm/solvers/base_solver.py b/pybamm/solvers/base_solver.py index 98fa02dd59..1ed9785162 100644 --- a/pybamm/solvers/base_solver.py +++ b/pybamm/solvers/base_solver.py @@ -1459,7 +1459,12 @@ def _set_up_ext_and_inputs( inputs[name] = casadi.MX.sym(name, input_param._expected_size) external_variables = external_variables or {} - ext_and_inputs = {**external_variables, **inputs} + + ordered_inputs_names = list(inputs.keys()) + ordered_inputs_names.sort() + ordered_inputs = {name: inputs[name] for name in ordered_inputs_names} + + ext_and_inputs = {**external_variables, **ordered_inputs} return ext_and_inputs diff --git a/pybamm/solvers/processed_variable.py b/pybamm/solvers/processed_variable.py index 5ac647658f..20a6150200 100644 --- a/pybamm/solvers/processed_variable.py +++ b/pybamm/solvers/processed_variable.py @@ -351,10 +351,14 @@ def initialise_2D(self): self.second_dimension = "x" self.R_sol = first_dim_pts self.x_sol = second_dim_pts - elif self.domain[0] in [ - "negative particle size", - "positive particle size", - ] and self.auxiliary_domains["secondary"] == ["current collector"]: + elif ( + self.domain[0] + in [ + "negative particle size", + "positive particle size", + ] + and self.auxiliary_domains["secondary"] == ["current collector"] + ): self.first_dimension = "R" self.second_dimension = "z" self.R_sol = first_dim_pts @@ -563,6 +567,7 @@ def initialise_sensitivity_explicit_forward(self): name: casadi.MX.sym(name, value.shape[0]) for name, value in self.all_inputs[0].items() } + p_casadi_stacked = casadi.vertcat(*[p for p in p_casadi.values()]) # Convert variable to casadi format for differentiating @@ -599,12 +604,7 @@ def initialise_sensitivity_explicit_forward(self): # Add the individual sensitivity start = 0 - # Sort the list of input names so that it aligns - # with the sorting applied during solver setup - sorted_input_names = list(self.all_inputs[0].keys()) - sorted_input_names.sort() - for name in sorted_input_names: - inp = self.all_inputs[0][name] + for name, inp in self.all_inputs[0].items(): end = start + inp.shape[0] sensitivities[name] = S_var[:, start:end] start = end diff --git a/tests/unit/test_solvers/test_casadi_solver.py b/tests/unit/test_solvers/test_casadi_solver.py index 4678e7fec9..1b44445115 100644 --- a/tests/unit/test_solvers/test_casadi_solver.py +++ b/tests/unit/test_solvers/test_casadi_solver.py @@ -589,9 +589,10 @@ def test_solve_sensitivity_scalar_var_scalar_input(self): solution = solver.solve( model, t_eval, - inputs={"p": 0.1, "q": 2, "r": -1, "s": 0.5}, + inputs={"r": -1, "s": 0.5, "q": 2, "p": 0.1}, calculate_sensitivities=True, ) + np.testing.assert_allclose(solution.y[0], -1 + 0.2 * solution.t) np.testing.assert_allclose( solution.sensitivities["p"], From 517cab716b55c78111cfd53c9ddbc0b3836c57dd Mon Sep 17 00:00:00 2001 From: Saransh Date: Fri, 14 Jan 2022 13:53:50 +0530 Subject: [PATCH 12/20] Debug --- .../test_operations/test_convert_to_casadi.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py b/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py index a74ad7ecd7..1042530b80 100644 --- a/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py +++ b/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py @@ -11,6 +11,7 @@ class TestCasadiConverter(unittest.TestCase): def assert_casadi_equal(self, a, b, evalf=False): + print(a, b) if evalf is True: self.assertTrue((casadi.evalf(a) - casadi.evalf(b)).is_zero()) else: @@ -129,6 +130,7 @@ def test_special_functions(self): np.arccosh, np.arcsinh, ]: + print(np_fun) self.assert_casadi_equal( pybamm.Function(np_fun, c).to_casadi(), casadi.MX(np_fun(3)), evalf=True ) From 8f160d386dc87cf65698080e69f06bf57e374e6d Mon Sep 17 00:00:00 2001 From: Saransh Date: Fri, 14 Jan 2022 13:55:01 +0530 Subject: [PATCH 13/20] Run workflow on push for debugging --- .github/workflows/test_on_push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index f2023326dc..7fb9b2e3e3 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -2,6 +2,7 @@ name: PyBaMM on: workflow_dispatch: + push: pull_request: # everyday at 3 am UTC From 75a1239b680211c0c7a5593b61637a54b7c5d28d Mon Sep 17 00:00:00 2001 From: Saransh Date: Fri, 14 Jan 2022 14:22:45 +0530 Subject: [PATCH 14/20] More debug --- .../test_operations/test_convert_to_casadi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py b/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py index 1042530b80..69f7f02bae 100644 --- a/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py +++ b/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py @@ -12,6 +12,7 @@ class TestCasadiConverter(unittest.TestCase): def assert_casadi_equal(self, a, b, evalf=False): print(a, b) + print(casadi.evalf(a), casadi.evalf(b), casadi.evalf(a) - casadi.evalf(b)) if evalf is True: self.assertTrue((casadi.evalf(a) - casadi.evalf(b)).is_zero()) else: From 6985c4bd3495bb6f4901a32399a7c1d170039553 Mon Sep 17 00:00:00 2001 From: Saransh Date: Fri, 14 Jan 2022 19:19:46 +0530 Subject: [PATCH 15/20] Use `assert_casadi_almost_equal` for `cosh` --- .../test_operations/test_convert_to_casadi.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py b/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py index 69f7f02bae..6e2638181a 100644 --- a/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py +++ b/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py @@ -121,7 +121,6 @@ def test_special_functions(self): for np_fun in [ np.sqrt, np.tanh, - np.cosh, np.sinh, np.exp, np.log, @@ -136,6 +135,16 @@ def test_special_functions(self): pybamm.Function(np_fun, c).to_casadi(), casadi.MX(np_fun(3)), evalf=True ) + for np_fun in [ + np.cosh + ]: + self.assert_casadi_almost_equal( + pybamm.Function(np_fun, c).to_casadi(), + casadi.MX(np_fun(3)), + decimal=14, + evalf=True, + ) + # test functions with assert_casadi_almost_equal for np_fun in [special.erf]: self.assert_casadi_almost_equal( From e20c351d38d21714f4d90115df649190f1a12d08 Mon Sep 17 00:00:00 2001 From: Saransh Date: Fri, 14 Jan 2022 19:42:55 +0530 Subject: [PATCH 16/20] Remove debug print statements --- .../test_operations/test_convert_to_casadi.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py b/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py index 6e2638181a..4edfea099e 100644 --- a/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py +++ b/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py @@ -11,8 +11,6 @@ class TestCasadiConverter(unittest.TestCase): def assert_casadi_equal(self, a, b, evalf=False): - print(a, b) - print(casadi.evalf(a), casadi.evalf(b), casadi.evalf(a) - casadi.evalf(b)) if evalf is True: self.assertTrue((casadi.evalf(a) - casadi.evalf(b)).is_zero()) else: @@ -130,7 +128,6 @@ def test_special_functions(self): np.arccosh, np.arcsinh, ]: - print(np_fun) self.assert_casadi_equal( pybamm.Function(np_fun, c).to_casadi(), casadi.MX(np_fun(3)), evalf=True ) From 70c040372be9a3e946a9e5c9451d7dfb661b8fde Mon Sep 17 00:00:00 2001 From: Saransh Date: Fri, 14 Jan 2022 20:54:45 +0530 Subject: [PATCH 17/20] Change coverage to Python 3.9 --- .github/workflows/test_on_push.yml | 11 +++++------ .../test_operations/test_convert_to_casadi.py | 5 +++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 7fb9b2e3e3..71f4560317 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -2,7 +2,6 @@ name: PyBaMM on: workflow_dispatch: - push: pull_request: # everyday at 3 am UTC @@ -88,16 +87,16 @@ jobs: if: matrix.os == 'ubuntu-latest' run: tox -e pybamm-requires - - name: Run unit tests for GNU/Linux with Python 3.8 and 3.9 - if: matrix.os == 'ubuntu-latest' && matrix.python-version != 3.7 + - name: Run unit tests for GNU/Linux with Python 3.7 and 3.8 + if: matrix.os == 'ubuntu-latest' && matrix.python-version != 3.9 run: python -m tox -e unit - - name: Run unit tests for GNU/Linux with Python 3.7 and generate coverage report - if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.7 + - name: Run unit tests for GNU/Linux with Python 3.9 and generate coverage report + if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9 run: tox -e coverage - name: Upload coverage report - if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.7 + if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9 uses: codecov/codecov-action@v2.1.0 - name: Run integration tests for GNU/Linux diff --git a/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py b/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py index 4edfea099e..32b20ba610 100644 --- a/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py +++ b/tests/unit/test_expression_tree/test_operations/test_convert_to_casadi.py @@ -132,6 +132,11 @@ def test_special_functions(self): pybamm.Function(np_fun, c).to_casadi(), casadi.MX(np_fun(3)), evalf=True ) + # A workaround to fix the tests running on GitHub Actions - + # casadi.evalf( + # pybamm.Function(np_fun, c).to_casadi() + # ) - casadi.evalf(casadi.MX(np_fun(3))) + # is not zero, but a small number of the order 10^-15 when np_func is np.cosh for np_fun in [ np.cosh ]: From 1f080fd13c5aedcf9fd685bcc2e2f8bdbd97638f Mon Sep 17 00:00:00 2001 From: Saransh Date: Sat, 15 Jan 2022 13:17:13 +0530 Subject: [PATCH 18/20] coverage --- pybamm/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pybamm/util.py b/pybamm/util.py index 50729bcb6f..5026b468bd 100644 --- a/pybamm/util.py +++ b/pybamm/util.py @@ -297,7 +297,7 @@ def load_function(filename): root_path = root_path[1:] # If the function is not in the current working directory and the path provided is # absolute - elif os.path.isabs(filename) and not os.getcwd() in filename: + elif os.path.isabs(filename) and not os.getcwd() in filename: # pragma: no cover # Change directory to import the function dir_path = os.path.split(filename)[0] os.chdir(dir_path) From 934336cbdab2c2244f53d1409fb5b3fd393e2043 Mon Sep 17 00:00:00 2001 From: Saransh Date: Sat, 15 Jan 2022 13:24:04 +0530 Subject: [PATCH 19/20] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf14fb269f..ef7d7c5a2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Bug fixes +- Parameters can now be imported from any given path in `Windows` ([#1900](https://github.com/pybamm-team/PyBaMM/pull/1900)) - Fixed initial conditions for the EC SEI model ([#1895](https://github.com/pybamm-team/PyBaMM/pull/1895)) # [v21.12](https://github.com/pybamm-team/PyBaMM/tree/v21.11) - 2021-12-29 From 1ce6f5353e895237b01a50d28d433349aa5f0718 Mon Sep 17 00:00:00 2001 From: Scott Marquis Date: Mon, 17 Jan 2022 10:05:09 +0100 Subject: [PATCH 20/20] #1886 update changelog --- CHANGELOG.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16a0c31da7..ca544f5903 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# unreleased + +## Bug fixes +- Fixed issue in extraction of sensitivites ([#1894](https://github.com/pybamm-team/PyBaMM/pull/1894)) + # [v21.12](https://github.com/pybamm-team/PyBaMM/tree/v21.11) - 2021-12-29 ## Features @@ -7,8 +12,6 @@ - Added cylindrical geometry and finite volume method ([#1824](https://github.com/pybamm-team/PyBaMM/pull/1824)) ## Bug fixes - -- Fixed issue in extraction of sensitivites ([#1894](https://github.com/pybamm-team/PyBaMM/pull/1894)) - `PyBaMM` is now importable in `Linux` systems where `jax` is already installed ([#1874](https://github.com/pybamm-team/PyBaMM/pull/1874)) - Simulations with drive cycles now support `initial_soc` ([#1842](https://github.com/pybamm-team/PyBaMM/pull/1842)) - Fixed bug in expression tree simplification ([#1831](https://github.com/pybamm-team/PyBaMM/pull/1831))