From e998e4ca81a0fe525b888f5c770497d38a3f700c Mon Sep 17 00:00:00 2001 From: Shadi Date: Thu, 4 Apr 2024 17:50:58 -0400 Subject: [PATCH] `magenpy==0.0.1` release; Minor bug fixes in GitHub workflow + Cython scripts. --- .github/workflows/ci-docs.yml | 4 ++-- .github/workflows/ci-linux.yml | 2 +- .github/workflows/ci-osx.yml | 2 +- .github/workflows/ci-windows.yml | 2 +- .github/workflows/wheels.yml | 2 +- magenpy/stats/ld/c_utils.pyx | 21 +++++++++++---------- setup.py | 5 ++++- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/ci-docs.yml index aee4e51..c147bad 100644 --- a/.github/workflows/ci-docs.yml +++ b/.github/workflows/ci-docs.yml @@ -1,4 +1,4 @@ -name: ci Docs +name: Build Docs on: push: branches: @@ -31,5 +31,5 @@ jobs: restore-keys: | mkdocs-material- - - run: python -m pip install -r requirements-docs.txt + - run: python -m pip install -v -e .[docs] - run: mkdocs gh-deploy --force \ No newline at end of file diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index fa7cfcc..771778a 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -1,4 +1,4 @@ -name: magenpy Linux-CI +name: Linux-CI on: [push, pull_request] diff --git a/.github/workflows/ci-osx.yml b/.github/workflows/ci-osx.yml index 4171572..754f4b4 100644 --- a/.github/workflows/ci-osx.yml +++ b/.github/workflows/ci-osx.yml @@ -1,4 +1,4 @@ -name: magenpy OSX-CI +name: OSX-CI on: [push, pull_request] diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index a160509..31fc761 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -1,4 +1,4 @@ -name: magenpy OSX-CI +name: Windows-CI on: [push, pull_request] diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 3eac899..a42af56 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -1,4 +1,4 @@ -name: Build magenpy and upload to PyPI +name: Wheels on: workflow_dispatch: diff --git a/magenpy/stats/ld/c_utils.pyx b/magenpy/stats/ld/c_utils.pyx index b61b44d..03cacbd 100644 --- a/magenpy/stats/ld/c_utils.pyx +++ b/magenpy/stats/ld/c_utils.pyx @@ -115,8 +115,8 @@ cpdef find_ld_block_boundaries(long[:] pos, long[:, :] block_boundaries): cdef: int i, j, ldb_idx, block_start, block_end, B = block_boundaries.shape[0], M = pos.shape[0] - long[:] v_min = np.zeros_like(pos, dtype=np.int64) - long[:] v_max = M*np.ones_like(pos, dtype=np.int64) + int[:] v_min = np.zeros_like(pos, dtype=np.int32) + int[:] v_max = M*np.ones_like(pos, dtype=np.int32) with nogil: for i in range(M): @@ -156,8 +156,8 @@ cpdef find_windowed_ld_boundaries(double[:] pos, double max_dist): cdef: int i, j, M = pos.shape[0] - long[:] v_min = np.zeros_like(pos, dtype=np.int64) - long[:] v_max = M*np.ones_like(pos, dtype=np.int64) + int[:] v_min = np.zeros_like(pos, dtype=np.int32) + int[:] v_max = M*np.ones_like(pos, dtype=np.int32) with nogil: for i in range(M): @@ -180,9 +180,9 @@ cpdef find_windowed_ld_boundaries(double[:] pos, double max_dist): @cython.cdivision(True) @cython.exceptval(check=False) cpdef find_shrinkage_ld_boundaries(double[:] cm_pos, - double genmap_ne, - int genmap_sample_size, - double cutoff): + double genmap_ne, + int genmap_sample_size, + double cutoff): """ Find the LD boundaries for the shrinkage estimator of Wen and Stephens (2010). @@ -192,9 +192,10 @@ cpdef find_shrinkage_ld_boundaries(double[:] cm_pos, :param cutoff: The threshold below which we set the shrinkage factor to zero. """ - cdef unsigned int i, j, M = cm_pos.shape[0] - cdef long[:] v_min = np.zeros_like(cm_pos, dtype=int) - cdef long[:] v_max = M*np.ones_like(cm_pos, dtype=int) + cdef: + int i, j, M = cm_pos.shape[0] + int[:] v_min = np.zeros_like(cm_pos, dtype=np.int32) + int[:] v_max = M*np.ones_like(cm_pos, dtype=np.int32) # The multiplicative term for the shrinkage factor # The shrinkage factor is 4 * Ne * (rho_ij/100) / (2*m) diff --git a/setup.py b/setup.py index fc40d4a..4afa845 100644 --- a/setup.py +++ b/setup.py @@ -72,6 +72,9 @@ def no_cythonize(extensions, **_ignore): with open("requirements-test.txt") as fp: test_requires = fp.read().strip().split("\n") +with open("requirements-docs.txt") as fp: + docs_requires = fp.read().strip().split("\n") + # ------------------------------------------------------ setup( @@ -105,7 +108,7 @@ def no_cythonize(extensions, **_ignore): 'config/*.ini']}, scripts=['bin/magenpy_ld', 'bin/magenpy_simulate'], install_requires=install_requires, - extras_require={'opt': opt_requires, 'test': test_requires}, + extras_require={'opt': opt_requires, 'test': test_requires, 'docs': docs_requires}, ext_modules=extensions, zip_safe=False )