diff --git a/.github/workflows/test_on_pull_request.yaml b/.github/workflows/test_on_pull_request.yaml index be1f21615..ce1498ad7 100644 --- a/.github/workflows/test_on_pull_request.yaml +++ b/.github/workflows/test_on_pull_request.yaml @@ -62,7 +62,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-13, macos-14] + os: [ubuntu-latest, windows-latest, macos-15-intel, macos-14] python-version: ["3.10", "3.11", "3.12"] exclude: # We run the coverage tests on macos-14 with Python 3.12 - os: macos-14 diff --git a/pybop/__init__.py b/pybop/__init__.py index dac2d9828..b815915c8 100644 --- a/pybop/__init__.py +++ b/pybop/__init__.py @@ -48,7 +48,7 @@ # # Dataset class # -from ._dataset import Dataset, import_pybrobe_result +from ._dataset import Dataset, import_pyprobe_result # # Transformation classes diff --git a/pybop/_dataset.py b/pybop/_dataset.py index f19bcb1cf..c87fdf8ad 100644 --- a/pybop/_dataset.py +++ b/pybop/_dataset.py @@ -179,21 +179,33 @@ def get_subset(self, index: list | np.ndarray): return Dataset(data, domain=self.domain) -def import_pybrobe_result( +def import_pyprobe_result( result: PyprobeResult, - columns: list[str], - pyprobe_columns: list[str] | None = None, + columns: list[str] = [ + "Time [s]", + "Current function [A]", + "Voltage [V]", + "Discharge capacity [Ah]", + ], + pyprobe_columns: list[str] | None = [ + "Time [s]", + "Current [A]", + "Voltage [V]", + "Capacity [Ah]", + ], ) -> Dataset: - """Import a PyprobeResult into a dictionary + """ + Import a pyprobe.Result into a dictionary - Args: - result (str): - A pybrobe Result object - columns (list of strings): - A list of columns to import. - pyprobe_columns: - An optional list of pyprobe columns names if any of them are not the same as in PyBoP. - Otherwise the column names are assumed to be identical with PyBoP. + Parameters + ---------- + result : str + A pyprobe.Result object. + columns : list[str] + A list of columns to import. + pyprobe_columns : list[str] + An optional list of pyprobe columns names if any of them are not the same as in PyBOP. + Otherwise the column names are assumed to be identical with PyBOP. """ if pyprobe_columns is None: @@ -223,8 +235,9 @@ def import_pybrobe_result( elif pyprobe_columns[i] in [ "Current [A]", "Capacity [Ah]", - "Discharge capacity [A.h]", ]: + # The sign convention in PyProBE is that positive current is charging, + # the convention in PyBaMM is that positive current means discharging data_dict[col] = -1.0 * result.get(pyprobe_columns[i]) else: data_dict[col] = result.get(pyprobe_columns[i]) diff --git a/pyproject.toml b/pyproject.toml index 9c1efa390..4cf2dfbf5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,11 +62,11 @@ bpx = [ "bpx>=0.5, <0.6", ] -pybrobe = [ +pyprobe = [ "PyProBE-Data;python_version>='3.11'" ] -all = ["pybop[plot,scifem,bpx,pybrobe]"] +all = ["pybop[plot,scifem,bpx,pyprobe]"] [tool.setuptools.packages.find] include = ["pybop", "pybop.*"] diff --git a/tests/unit/test_dataset.py b/tests/unit/test_dataset.py index 79cfb28d2..cad04b984 100644 --- a/tests/unit/test_dataset.py +++ b/tests/unit/test_dataset.py @@ -97,9 +97,9 @@ def test_pybamm_import(self): @pytest.mark.skipif( sys.version_info < (3, 11), reason="requires python3.11 or higher" ) - def test_pyrobe_import(self): + def test_pyprobe_import(self): """ - Function to test import of PyProBE result into a pybop.dataset. + Function to test import of PyProBE Result into a pybop.Dataset. PyProBE requires Python 3.11 or higher. """ import pyprobe @@ -170,7 +170,7 @@ def test_pyrobe_import(self): cell.import_pybamm_solution("US06 DFN", ["US06"], solution) # Import data from PyProBE into pybop.dataset - dataset_pyprobe = pybop.import_pybrobe_result( + dataset_pyprobe = pybop.import_pyprobe_result( cell.procedure["US06 DFN"], [ "Time [s]", @@ -191,7 +191,7 @@ def test_pyrobe_import(self): ) # Different choice of parameters where column names are identical between pyprobe and pybamm - dataset_pyprobe2 = pybop.import_pybrobe_result( + dataset_pyprobe2 = pybop.import_pyprobe_result( cell.procedure["US06 DFN"], [ "Time [s]",