Skip to content

Commit

Permalink
Testing updates (#62)
Browse files Browse the repository at this point in the history
* try updating ci to use mamba

* try again with micromamba

* indentation error

* update environment file

* install geoscilabs in test environment

* updates to fix deprecating plotImage, SimPEG, discretize deprication fixes

* make running test verbose

* update extractCoreMesh --> extract_core_mesh

* remove the mamba activate command

* split up tests into matrix

* simplify some of the environment file

* have environment file follow dev environment file

* update the VMD code to fix deprications
  • Loading branch information
lheagy authored Aug 15, 2023
1 parent bea6b88 commit 26ce0a8
Show file tree
Hide file tree
Showing 19 changed files with 105 additions and 119 deletions.
39 changes: 15 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,29 @@ on:
- '*'
jobs:
setup-build:
name: Ex1 (${{ matrix.python-version }}, ${{ matrix.os }})
name: Ex1 (${{ matrix.python-version }}, ${{ matrix.os }}, ${{ matrix.test-file }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: [3.7, "3.10"]
test-file: ["tests/test_dcip.py", "tests/test_em.py", "tests/test_gpr.py tests/test_seismic.py", "tests/test_inversion.py", "tests/test_gravity.py tests/test_mag.py"]

steps:
- uses: actions/checkout@v2
- name: Setup Conda
uses: s-weigand/setup-conda@v1
- uses: mamba-org/setup-micromamba@v1
with:
update-conda: true
conda-channels: conda-forge
python-version: ${{ matrix.python-version }}

- name: Install Env
shell: bash
run: |
python --version
conda env create -f environment-dev.yml
- name: Install Our Package
shell: bash
run: |
source activate geosci-labs-dev
pip install -e .
conda list
environment-file: environment-dev.yml
init-shell: >-
bash
powershell
create-args: >-
python=${{ matrix.python-version }}
cache-environment: true
post-cleanup: 'all'
- name: Run Tests
shell: bash
shell: micromamba-shell {0}
run: |
source activate geosci-labs-dev
pytest .
pip install -e . --no-deps
pytest ${{ matrix.test-file }} -v
7 changes: 0 additions & 7 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@ name: geosci-labs-dev

channels:
- conda-forge
- defaults
dependencies:
- cvxopt
- deepdish
- discretize
- empymod
- ipywidgets>=0.6.0
- jupyter
- matplotlib=3.4.3
- mkl>=2021.3.0
- numpy=1.21
- Pillow
- pip
- pymatsolver
- python=3.10
- requests
- scipy>=1.7
- scikit-learn<1.0
- SimPEG
- pytest
- flake8
Expand Down
4 changes: 0 additions & 4 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ dependencies:
- cvxopt
- deepdish
- discretize
- empymod=2.0.0
- ipywidgets>=0.6.0
- jupyter
- matplotlib<3.5
- mkl>=2021.3.0
- numpy
- Pillow
- pip
- pymatsolver
- python=3.10
- requests
- scipy
- SimPEG
- pip:
- git+https://github.com/geoscixyz/geosci-labs
6 changes: 3 additions & 3 deletions geoscilabs/dcip/DCIP_overburden_PseudoSection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from discretize import TensorMesh

from SimPEG import maps, SolverLU, utils
from SimPEG.utils import ExtractCoreMesh
from SimPEG.utils import extract_core_mesh
from SimPEG.electromagnetics.static import resistivity as DC
from SimPEG.electromagnetics.static import induced_polarization as IP
from pymatsolver import Pardiso
Expand All @@ -50,7 +50,7 @@
xr = np.arange(xmin, xmax + 1.0, dx)
dxr = np.diff(xr)
xylim = np.c_[[xmin, ymin], [xmax, ymax]]
indCC, meshcore = ExtractCoreMesh(xylim, mesh)
indCC, meshcore = extract_core_mesh(xylim, mesh)
indx = (
(mesh.gridFx[:, 0] >= xmin)
& (mesh.gridFx[:, 0] <= xmax)
Expand Down Expand Up @@ -855,7 +855,7 @@ def DCIP2Dfwdfun(
u = np.ma.masked_where(mdctrue <= np.log(1e-8), mtrue)
else:
u = np.ma.masked_where(mtrue <= np.log(1e-8), np.log10(1.0 / (mapping * mtrue)))
dat1 = mesh.plotImage(
dat1 = mesh.plot_image(
u,
ax=ax1,
clim=(u.min(), u.max()),
Expand Down
6 changes: 3 additions & 3 deletions geoscilabs/dcip/DCWidgetPlate2_5D.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from discretize import TensorMesh
from SimPEG import maps, SolverLU, utils
from SimPEG.utils import ExtractCoreMesh
from SimPEG.utils import extract_core_mesh
from SimPEG.electromagnetics.static import resistivity as DC
from ..base import widgetify

Expand All @@ -37,7 +37,7 @@
ymin = -40.0
ymax = 8.0
xylim = np.c_[[xmin, ymin], [xmax, ymax]]
indCC, meshcore = ExtractCoreMesh(xylim, mesh)
indCC, meshcore = extract_core_mesh(xylim, mesh)
indx = (
(mesh.gridFx[:, 0] >= xmin)
& (mesh.gridFx[:, 0] <= xmax)
Expand Down Expand Up @@ -638,7 +638,7 @@ def PLOT(
eps = 1e-16
else:
eps = 0.0
dat = meshcore.plotImage(
dat = meshcore.plot_image(
u[ind] + eps,
v_type=xtype,
ax=ax[1],
Expand Down
6 changes: 3 additions & 3 deletions geoscilabs/dcip/DCWidgetPlate_2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from discretize import TensorMesh
from SimPEG import maps, SolverLU, utils
from SimPEG.utils import ExtractCoreMesh
from SimPEG.utils import extract_core_mesh
from SimPEG.electromagnetics.static import resistivity as DC

from ..base import widgetify
Expand All @@ -37,7 +37,7 @@
ymin = -40.0
ymax = 8.0
xylim = np.c_[[xmin, ymin], [xmax, ymax]]
indCC, meshcore = ExtractCoreMesh(xylim, mesh)
indCC, meshcore = extract_core_mesh(xylim, mesh)
indx = (
(mesh.gridFx[:, 0] >= xmin)
& (mesh.gridFx[:, 0] <= xmax)
Expand Down Expand Up @@ -639,7 +639,7 @@ def plot_Surface_Potentials(
eps = 1e-16
else:
eps = 0.0
dat = meshcore.plotImage(
dat = meshcore.plot_image(
u[ind] + eps,
v_type=xtype,
ax=ax[1],
Expand Down
6 changes: 3 additions & 3 deletions geoscilabs/dcip/DCWidgetResLayer2D.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from discretize import TensorMesh
from SimPEG import maps, SolverLU, utils
from SimPEG.utils import ExtractCoreMesh
from SimPEG.utils import extract_core_mesh
import numpy as np
from SimPEG.electromagnetics.static import resistivity as DC
import matplotlib
Expand Down Expand Up @@ -34,7 +34,7 @@
ymin = -40.0
ymax = 8.0
xylim = np.c_[[xmin, ymin], [xmax, ymax]]
indCC, meshcore = ExtractCoreMesh(xylim, mesh)
indCC, meshcore = extract_core_mesh(xylim, mesh)
indx = (
(mesh.gridFx[:, 0] >= xmin)
& (mesh.gridFx[:, 0] <= xmax)
Expand Down Expand Up @@ -668,7 +668,7 @@ def plot_Surface_Potentials(
eps = 1e-16
else:
eps = 0.0
dat = meshcore.plotImage(
dat = meshcore.plot_image(
u[ind] + eps,
v_type=xtype,
ax=ax[1],
Expand Down
6 changes: 3 additions & 3 deletions geoscilabs/dcip/DCWidgetResLayer2_5D.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import matplotlib.patches as patches

from SimPEG import maps, SolverLU, utils
from SimPEG.utils import ExtractCoreMesh
from SimPEG.utils import extract_core_mesh
from SimPEG.electromagnetics.static import resistivity as DC
from pymatsolver import Pardiso

Expand Down Expand Up @@ -40,7 +40,7 @@
ymin = -40.0
ymax = 8.0
xylim = np.c_[[xmin, ymin], [xmax, ymax]]
indCC, meshcore = ExtractCoreMesh(xylim, mesh)
indCC, meshcore = extract_core_mesh(xylim, mesh)
indx = (
(mesh.gridFx[:, 0] >= xmin)
& (mesh.gridFx[:, 0] <= xmax)
Expand Down Expand Up @@ -674,7 +674,7 @@ def PLOT(
eps = 1e-16
else:
eps = 0.0
dat = meshcore.plotImage(
dat = meshcore.plot_image(
u[ind] + eps,
v_type=xtype,
ax=ax[1],
Expand Down
6 changes: 3 additions & 3 deletions geoscilabs/dcip/DCWidget_Overburden_2_5D.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from discretize import TensorMesh
from SimPEG import maps, utils
from SimPEG.utils import ExtractCoreMesh
from SimPEG.utils import extract_core_mesh
from SimPEG.electromagnetics.static import resistivity as DC

from pymatsolver import Pardiso
Expand All @@ -43,7 +43,7 @@
ymin = -1000.0
ymax = 100.0
xylim = np.c_[[xmin, ymin], [xmax, ymax]]
indCC, meshcore = ExtractCoreMesh(xylim, mesh)
indCC, meshcore = extract_core_mesh(xylim, mesh)
indx = (
(mesh.gridFx[:, 0] >= xmin)
& (mesh.gridFx[:, 0] <= xmax)
Expand Down Expand Up @@ -679,7 +679,7 @@ def PLOT(
# print ind.shape
# print u.shape
# print xtype
dat = meshcore.plotImage(
dat = meshcore.plot_image(
u[ind] + eps,
v_type=xtype,
ax=ax[1],
Expand Down
6 changes: 3 additions & 3 deletions geoscilabs/dcip/DC_Pseudosections.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _transform(self, m):
ymin = -40.0
ymax = 5.0
xylim = np.c_[[xmin, ymin], [xmax, ymax]]
indCC, meshcore = utils.ExtractCoreMesh(xylim, mesh)
indCC, meshcore = utils.extract_core_mesh(xylim, mesh)
indx = (
(mesh.gridFx[:, 0] >= xmin)
& (mesh.gridFx[:, 0] <= xmax)
Expand Down Expand Up @@ -536,7 +536,7 @@ def DC2Dfwdfun(
ax1 = plt.subplot(211)
ax2 = plt.subplot(212)

dat1 = mesh.plotImage(
dat1 = mesh.plot_image(
np.log10(1.0 / (mapping * mtrue)),
ax=ax1,
clim=(1, 3),
Expand Down Expand Up @@ -576,7 +576,7 @@ def DC2Dfwdfun(
obs = griddata(xzlocs, appresobs, (xi, yi), method="linear")
plt.figure(figsize=(12, 9))
ax1 = plt.subplot(311)
dat1 = mesh.plotImage(
dat1 = mesh.plot_image(
np.log10(1.0 / (mapping * mtrue)),
ax=ax1,
clim=(1, 3),
Expand Down
6 changes: 3 additions & 3 deletions geoscilabs/dcip/DC_cylinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from discretize import TensorMesh

from SimPEG import maps, utils
from SimPEG.utils import ExtractCoreMesh, mkvc
from SimPEG.utils import extract_core_mesh, mkvc
from SimPEG.electromagnetics.static import resistivity as DC

from ipywidgets import interact, IntSlider, FloatSlider, FloatText, ToggleButtons, BoundedFloatText
Expand All @@ -37,7 +37,7 @@
ymin = -40.0
ymax = 8.0
xylim = np.c_[[xmin, ymin], [xmax, ymax]]
indCC, meshcore = ExtractCoreMesh(xylim, mesh)
indCC, meshcore = extract_core_mesh(xylim, mesh)
indx = (
(mesh.gridFx[:, 0] >= xmin)
& (mesh.gridFx[:, 0] <= xmax)
Expand Down Expand Up @@ -518,7 +518,7 @@ def plot_Surface_Potentials(
eps = 1e-16
else:
eps = 0.0
dat = meshcore.plotImage(
dat = meshcore.plot_image(
u[ind] + eps,
v_type=xtype,
ax=ax[1],
Expand Down
Loading

0 comments on commit 26ce0a8

Please sign in to comment.