Skip to content

Commit

Permalink
Merge pull request #230 from knaaptime/testing
Browse files Browse the repository at this point in the history
old numpy nan
  • Loading branch information
knaaptime authored Nov 5, 2024
2 parents 4352234 + 0ab89a2 commit af53e83
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
strategy:
matrix:
os: ['ubuntu-latest']
environment-file: [.ci/39.yml]
environment-file: [ci/312.yml]
experimental: [false]
defaults:
run:
Expand Down
66 changes: 42 additions & 24 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,88 @@

on:
push:
branches: [main]
branches:
- '*'
pull_request:
branches:
- '*'
schedule:
- cron: "0 0 * * 1,4"
- cron: '59 23 * * *'
workflow_dispatch:
inputs:
version:
description: Manual Unittest Run
default: test
required: false
inputs:
version:
description: Manual CI Run
default: test
required: false

jobs:
Tests:
tests:
name: ${{ matrix.os }}, ${{ matrix.environment-file }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
environment-file:
- ci/310.yml
- ci/311.yml
- ci/312.yml
environment-file: [
ci/311.yml,
ci/312.yml,
ci/313.yml,
]
include:
- environment-file: ci/312.yml
os: macos-13 # Intel
- environment-file: ci/312.yml
os: macos-14 # Apple Silicon
os: macos-14 # Apple Silicon
- environment-file: ci/312.yml
os: windows-latest
fail-fast: false

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4

- name: checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags.

- name: setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ${{ matrix.environment-file }}
micromamba-version: 'latest'
- name: Test segregation

- name: environment info
run: |
pytest \
segregation \
micromamba info
micromamba list
- name: spatial versions
run: 'python -c "import geopandas; geopandas.show_versions();"'

- name: install package
run: 'pip install . --no-deps'

- name: run tests
run: |
pytest segregation \
-v \
-r a \
-n auto \
--color yes \
--cov segregation \
--cov-append \
--cov-report term-missing \
--cov-report xml \
--cov-report xml
- name: codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
name: segregation-codecov

- name: Generate and publish the report
if: |
failure()
Expand Down
2 changes: 1 addition & 1 deletion ci/310.yml → ci/313.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test
channels:
- conda-forge
dependencies:
- python=3.10
- python=3.13
- deprecation
- geopandas>=0.9
- joblib
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- python=3.9
- python>=3.12
- deprecation
- geopandas>=0.9
- joblib
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ classifiers = [
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: GIS",
]
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
"deprecation",
"geopandas>=0.9",
Expand Down
4 changes: 2 additions & 2 deletions segregation/singlegroup/relative_centralization.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ def _relative_centralization(
Xi = np.cumsum(x[asc_ind]) / X
Yi = np.cumsum(y[asc_ind]) / Y

RCE = np.nansum(shift(Xi, 1, cval=np.NaN) * Yi) - np.nansum(
Xi * shift(Yi, 1, cval=np.NaN)
RCE = np.nansum(shift(Xi, 1, cval=np.nan) * Yi) - np.nansum(
Xi * shift(Yi, 1, cval=np.nan)
)

core_data = data[[group_pop_var, total_pop_var, data.geometry.name]]
Expand Down

0 comments on commit af53e83

Please sign in to comment.