Skip to content

Commit

Permalink
Compatibility with NumPy 2.0 (#14)
Browse files Browse the repository at this point in the history
Update changelog as well
  • Loading branch information
jkanche authored Jun 27, 2024
1 parent 17151be commit db7099f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Changelog

## Version 0.1 (development)
## Version 0.2.0

- Feature A added
- FIX: nasty bug #1729 fixed
- add your changes here!
- Changes to support NumPy's 2.0 release.

## Version 0.1.0 - 0.1.3

First release of the package to access, download and save
datasets.
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@
"""

# import pytest

# only if certificates are not available for local testing
# from gypsum_client.config import REQUESTS_MOD
# REQUESTS_MOD["verify"] = False
10 changes: 5 additions & 5 deletions tests/test_polish_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,31 +120,31 @@ def test_polish_dataset_attempts_integer_conversions():
sce = SingleCellExperiment(assays={"counts": mat})

y = polish_dataset(sce)
assert y.assays["counts"].dtype == np.int_
assert np.issubdtype(y.assays["counts"].dtype, np.integer)

mat = np.random.poisson(0.1, (100, 10)).astype(float)
sce = SingleCellExperiment(assays={"counts": sparse.csr_matrix(mat)})

y = polish_dataset(sce)
assert sparse.issparse(y.assays["counts"])
assert y.assays["counts"].dtype == np.int_
assert np.issubdtype(y.assays["counts"].dtype, np.integer)

mat = np.random.poisson(3, (100, 10)) * 1.5
sce = SingleCellExperiment(assays={"counts": mat})

y = polish_dataset(sce)
assert y.assays["counts"].dtype == np.float_
assert np.issubdtype(y.assays["counts"].dtype, np.floating)


def test_polish_dataset_works_with_na_values():
mat = np.random.poisson(0.1, (100, 10))
mat = mat.astype(np.float_)
mat = mat.astype(np.float64)
mat.ravel()[np.random.choice(mat.size, 10, replace=False)] = np.nan
sce = SingleCellExperiment(assays={"counts": sparse.csr_matrix(mat)})

y = polish_dataset(sce)
assert sparse.issparse(y.assays["counts"])
assert y.assays["counts"].dtype == np.float_
assert np.issubdtype(y.assays["counts"].dtype, np.floating)


def test_polish_dataset_forbids_highly_nested_altexps():
Expand Down

0 comments on commit db7099f

Please sign in to comment.