Skip to content

Commit

Permalink
magenpy==0.0.1 release; Minor bug fixes in GitHub workflow + Cython…
Browse files Browse the repository at this point in the history
… scripts.
  • Loading branch information
shz9 committed Apr 4, 2024
1 parent 4c83c94 commit e998e4c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci Docs
name: Build Docs
on:
push:
branches:
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: magenpy Linux-CI
name: Linux-CI

on: [push, pull_request]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-osx.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: magenpy OSX-CI
name: OSX-CI

on: [push, pull_request]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: magenpy OSX-CI
name: Windows-CI

on: [push, pull_request]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build magenpy and upload to PyPI
name: Wheels

on:
workflow_dispatch:
Expand Down
21 changes: 11 additions & 10 deletions magenpy/stats/ld/c_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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).
Expand All @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
)

0 comments on commit e998e4c

Please sign in to comment.