Skip to content

Commit

Permalink
fix: zero order cells in moc creation from healpix cells are re-instated
Browse files Browse the repository at this point in the history
  • Loading branch information
ManonMarchand committed Jul 18, 2024
1 parent 557a4b0 commit b37715e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.16.1]

### Fixed

* `from_healpix_cells` and `from_valued_healpix_cells` accept order zero cells again

## [0.16.0]

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "MOCPy"
version = "0.16.0"
version = "0.16.1"
authors = [
"Matthieu Baumann <matthieu.baumann@astro.unistra.fr>",
"Thomas Boch <thomas.boch@astro.unistra.fr>",
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"dateModified": "2023-12-04",
"issueTracker": "https://github.com/cds-astro/mocpy/issues",
"name": "MOCpy",
"version": "0.16.0",
"softwareVersion": "0.16.0",
"version": "0.16.1",
"softwareVersion": "0.16.1",
"description": "Python library to easily create and manipulate MOCs (Multi-Order Coverage maps)",
"applicationCategory": ["Astronomy", "Science"],
"funding": "ESCAPE 824064, ASTERICS 653477",
Expand Down
4 changes: 2 additions & 2 deletions python/mocpy/moc/moc.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _mask_unsigned_before_casting(indices):
indices : `numpy.ndarray` or Iterable
"""
if np.issubdtype(np.asarray(indices).dtype, np.unsignedinteger) or all(
np.asarray(indices) > 0,
np.asarray(indices) >= 0,
):
return None
warnings.warn(
Expand All @@ -100,7 +100,7 @@ def _mask_unsigned_before_casting(indices):
UserWarning,
stacklevel=2,
)
return np.array(indices) > 0
return np.array(indices) >= 0


def _extract_mask_and_values_multiordermap(multiordermap, column):
Expand Down
2 changes: 2 additions & 0 deletions python/mocpy/tests/test_moc.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ def test_from_healpix_cells():
):
moc = MOC.from_healpix_cells(ipix=[40, -1, 65], depth=depth, max_depth=3)
assert moc == MOC.from_str("3/40 65")
# also allow order zero (regression for issue #157)
assert MOC.from_healpix_cells(np.array([0]), 0, 0) == MOC.from_str("0/0")


def test_from_polygons():
Expand Down
2 changes: 1 addition & 1 deletion python/mocpy/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.16.0"
__version__ = "0.16.1"

0 comments on commit b37715e

Please sign in to comment.