From bee8c870ed42aadb9d61dbcf44250bb9336d641c Mon Sep 17 00:00:00 2001 From: Bob Myhill Date: Sun, 6 Oct 2024 17:37:22 +0100 Subject: [PATCH 1/2] replace deprecated/modified functions --- burnman/classes/material.py | 3 ++- burnman/classes/solution.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/burnman/classes/material.py b/burnman/classes/material.py index 3e7c36ac..462ea7de 100644 --- a/burnman/classes/material.py +++ b/burnman/classes/material.py @@ -293,9 +293,10 @@ def evaluate(self, vars_list, pressures, temperatures, molar_fractions=None): assert pressures.shape == temperatures.shape + first_index = list(np.ndenumerate(temperatures))[0][0] if molar_fractions is not None: molar_fractions = np.array(molar_fractions) - self.set_composition(molar_fractions[0]) + self.set_composition(molar_fractions[first_index]) assert temperatures.shape == molar_fractions.shape[:-1] # First, check the output types of all the requested variables: diff --git a/burnman/classes/solution.py b/burnman/classes/solution.py index 4ad6d100..b96731a8 100644 --- a/burnman/classes/solution.py +++ b/burnman/classes/solution.py @@ -679,7 +679,8 @@ def compositional_null_basis(self): null_basis = np.array([v[:] for v in null]) M = null_basis[:, self.dependent_element_indices] - assert (M.shape[0] == M.shape[1]) and (M == np.eye(M.shape[0])).all() + assert (M.shape[0] == M.shape[1]) + assert (np.abs(M - np.eye(M.shape[0])) < 1.e-20).all() return null_basis From 7c780aae359edcf3e3c45a999aea7263a097d2b2 Mon Sep 17 00:00:00 2001 From: Bob Myhill Date: Sun, 6 Oct 2024 17:38:04 +0100 Subject: [PATCH 2/2] update installation and test.sh --- .github/workflows/main.yml | 12 ++++++------ .github/workflows/python-publish.yml | 2 +- burnman/classes/seismic.py | 2 +- burnman/classes/solution.py | 4 ++-- test.sh | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6325917d..67cd544b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,9 +13,9 @@ jobs: python-versions: ['3.12'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-versions }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-versions }} - name: make indent @@ -24,7 +24,7 @@ jobs: ./contrib/utilities/indent git diff > changes-astyle.diff - name: archive indent results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: changes-astyle.diff path: changes-astyle.diff @@ -41,9 +41,9 @@ jobs: python-versions: ['3.9', '3.10', '3.11', '3.12'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-versions }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-versions }} - name: setup @@ -55,7 +55,7 @@ jobs: texlive \ texlive-latex-extra python -m pip install --upgrade pip - pip install pycddlib # this is optional + pip install pycddlib==2.1.7 # this is optional pip install autograd # this is optional python --version - name: test diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index b7a704be..f1ce1159 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -23,7 +23,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install dependencies diff --git a/burnman/classes/seismic.py b/burnman/classes/seismic.py index 4fa833fc..08cc8704 100644 --- a/burnman/classes/seismic.py +++ b/burnman/classes/seismic.py @@ -333,7 +333,7 @@ def _compute_pressure(self): # convert radii to depths depth = self.earth_radius - radii pressure = scipy.integrate.cumulative_trapezoid( - gravity * density, x=depth, initial=0.0 + gravity * density, x=depth, initial=0 ) self.table_pressure = pressure diff --git a/burnman/classes/solution.py b/burnman/classes/solution.py index b96731a8..31cdcf9c 100644 --- a/burnman/classes/solution.py +++ b/burnman/classes/solution.py @@ -679,8 +679,8 @@ def compositional_null_basis(self): null_basis = np.array([v[:] for v in null]) M = null_basis[:, self.dependent_element_indices] - assert (M.shape[0] == M.shape[1]) - assert (np.abs(M - np.eye(M.shape[0])) < 1.e-20).all() + assert M.shape[0] == M.shape[1] + assert (np.abs(M - np.eye(M.shape[0])) < 1.0e-20).all() return null_basis diff --git a/test.sh b/test.sh index e2b93841..b2d06e34 100755 --- a/test.sh +++ b/test.sh @@ -30,7 +30,7 @@ echo "" # Quietly install optional modules after burnman echo "Installing optional cvxpy, pycddlib, autograd and jupyter modules ..." -$PYTHON -m pip install -q cvxpy pycddlib autograd jupyter +$PYTHON -m pip install -q cvxpy pycddlib==2.1.7 autograd jupyter echo "" function testit {