From b37715e55ca9ae8912a717efbdbf016b540e9e2e Mon Sep 17 00:00:00 2001 From: MARCHAND MANON Date: Thu, 18 Jul 2024 09:12:35 +0200 Subject: [PATCH] fix: zero order cells in moc creation from healpix cells are re-instated --- CHANGELOG.md | 6 ++++++ Cargo.toml | 2 +- codemeta.json | 4 ++-- python/mocpy/moc/moc.py | 4 ++-- python/mocpy/tests/test_moc.py | 2 ++ python/mocpy/version.py | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ba6b73c..810d68d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Cargo.toml b/Cargo.toml index d665aac8..fc4dd9eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "MOCPy" -version = "0.16.0" +version = "0.16.1" authors = [ "Matthieu Baumann ", "Thomas Boch ", diff --git a/codemeta.json b/codemeta.json index 9bc9c030..c6bb318a 100644 --- a/codemeta.json +++ b/codemeta.json @@ -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", diff --git a/python/mocpy/moc/moc.py b/python/mocpy/moc/moc.py index d7464112..2bcd4473 100644 --- a/python/mocpy/moc/moc.py +++ b/python/mocpy/moc/moc.py @@ -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( @@ -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): diff --git a/python/mocpy/tests/test_moc.py b/python/mocpy/tests/test_moc.py index aabc9b18..fc9c3874 100644 --- a/python/mocpy/tests/test_moc.py +++ b/python/mocpy/tests/test_moc.py @@ -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(): diff --git a/python/mocpy/version.py b/python/mocpy/version.py index 5a313cc7..113af05a 100644 --- a/python/mocpy/version.py +++ b/python/mocpy/version.py @@ -1 +1 @@ -__version__ = "0.16.0" +__version__ = "0.16.1"