Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: make CI run #128

Merged
merged 8 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/37.yaml → .ci/310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test
channels:
- conda-forge
dependencies:
- python=3.7
- python=3.10
- libpysal
- numpy>=1.3
- pandas>=1
Expand Down
2 changes: 1 addition & 1 deletion .ci/39-DEV.yaml → .ci/311-DEV.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test
channels:
- conda-forge
dependencies:
- python=3.9
- python=3.11
- libpysal
- shapely
- numpy>=1.3
Expand Down
2 changes: 1 addition & 1 deletion .ci/38.yaml → .ci/311.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test
channels:
- conda-forge
dependencies:
- python=3.8
- python=3.11
- libpysal
- numpy>=1.3
- pandas>=1
Expand Down
53 changes: 22 additions & 31 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,38 @@
timeout-minutes: 90
strategy:
matrix:
os: ['macos-latest', 'ubuntu-latest', 'windows-latest']
environment-file: [.ci/37.yaml, .ci/38.yaml, .ci/39.yaml]
os: ['ubuntu-latest']
environment-file: [.ci/39.yaml, .ci/310.yaml, .ci/311.yaml, .ci/311-DEV.yaml]
include:
- environment-file: .ci/39-DEV.yaml
os: ubuntu-latest

- environment-file: .ci/311.yaml
os: macos-latest
- environment-file: .ci/311.yaml
os: windows-latest
fail-fast: false
defaults:
run:
shell: bash -l {0}

steps:
- name: checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: setup micromamba
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ${{ matrix.environment-file }}
micromamba-version: 'latest'
- name: install spglm via pip
shell: bash -l {0}
run: pip install --upgrade git+https://github.com/pysal/spglm.git@master

run: pip install --upgrade --no-deps git+https://github.com/pysal/spglm.git@main

- name: install spreg via pip
shell: bash -l {0}
run: pip install spreg

run: pip install spreg

- name: install bleeding edge libpysal (only Ubuntu / Python 3.9)
shell: bash -l {0}
run: pip install git+https://github.com/pysal/libpysal.git@master
run: pip install git+https://github.com/pysal/libpysal.git@main
if: matrix.os == 'ubuntu-latest' && contains(matrix.environment-file, 'DEV')

- name: run tests - bash
shell: bash -l {0}
run: pytest -v mgwr --cov=mgwr --cov-report=xml --timeout=300
if: matrix.os != 'windows-latest'

- name: run tests - powershell
shell: powershell
run: pytest -v mgwr --cov=mgwr --cov-report=xml --timeout=300
if: matrix.os == 'windows-latest'

- name: codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
name: spot-codecov

- uses: codecov/codecov-action@v3
14 changes: 7 additions & 7 deletions mgwr/tests/test_gwr.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,12 @@ def test_MGWR(self):
np.testing.assert_allclose(rslt_hat.R, rslt_hat_2.R, atol=1e-07)
np.testing.assert_allclose(
rslt_hat.S.dot(std_y).flatten(), self.MGWR.predy, atol=1e-07)

exact_rslt = model.exact_fit()

np.testing.assert_allclose(exact_rslt.R, rslt_hat.R,atol=1e-04)
np.testing.assert_allclose(exact_rslt.params, rslt_hat.params,atol=1e-04)

varnames = ['X0', 'X1', 'X2', 'X3']

# def suffixed(x):
Expand Down Expand Up @@ -366,13 +366,13 @@ def test_MGWR(self):
rslt.filter_tvals(),
self.MGWR[[s + "_filter_tvalues" for s in varnames]].values,
atol=1e-07)

np.testing.assert_allclose(rslt.get_bws_intervals(selector),
[(92.0, 99.0), (99.0, 101.0), (99.0, 136.0), (122.0, 158.0)])

np.testing.assert_allclose(rslt.local_collinearity()[0].flatten(),
self.MGWR.local_collinearity, atol=1e-07)

def test_Prediction(self):
coords = np.array(self.coords)
index = np.arange(len(self.y))
Expand Down Expand Up @@ -502,7 +502,7 @@ class TestGWRPoisson(unittest.TestCase):
def setUp(self):
data_path = os.path.join(
os.path.dirname(__file__), 'tokyo/Tokyomortality.csv')
data = io.open(data_path, mode='Ur')
data = io.open(data_path, mode='r')
self.coords = list(
zip(data.by_col('X_CENTROID'), data.by_col('Y_CENTROID')))
self.y = np.array(data.by_col('db2564')).reshape((-1, 1))
Expand Down
2 changes: 1 addition & 1 deletion mgwr/tests/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ class TestGWRPoissonPool(unittest.TestCase):
def setUp(self):
data_path = os.path.join(
os.path.dirname(__file__), 'tokyo/Tokyomortality.csv')
data = io.open(data_path, mode='Ur')
data = io.open(data_path, mode='r')
self.coords = list(
zip(data.by_col('X_CENTROID'), data.by_col('Y_CENTROID')))
self.y = np.array(data.by_col('db2564')).reshape((-1, 1))
Expand Down
2 changes: 1 addition & 1 deletion mgwr/tests/test_sel_bw.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class TestGWRSelBWPoisson(unittest.TestCase):
def setUp(self):
data_path = os.path.join(
os.path.dirname(__file__), 'tokyo/Tokyomortality.csv')
data = io.open(data_path, mode='Ur')
data = io.open(data_path, mode='r')
self.coords = list(
zip(data.by_col('X_CENTROID'), data.by_col('Y_CENTROID')))
self.y = np.array(data.by_col('db2564')).reshape((-1, 1))
Expand Down