Skip to content

Commit ad6efa0

Browse files
delucchi-cmusmcguire-cmucamposandro
authored
Remove margin fine filtering, and healpy dependency. (#434)
* Remove margin fine filtering. * Remove unused unseen. * Remove margin fine filtering. (#421) * Remove margin fine filtering. * Remove unused unseen. * Use cdshealpix for margin pixel finding. * Unused import. * add color_by_order option and plot on existing axes * reset matplotlib after tests * pylint * Migrate ang2vec (#426) * Use astropy for ang2vec conversion * Allow for kwargs in ang2vec * use mindist instead of resol for margin filter * Replace healpy in healpix_shim pixel math operations * isort * support np arrays * use order instead of nside * remove unused variable * Return int64 from radec2pix (#432) * Migrate box filtering to use MOCpy (#428) * Use mocpy in box filtering * Update tests * Ensure moc is correct in box filter test * Remove unused healpy methods * Pin mocpy * Remove healpy references. (#433) * Address merge conflicts --------- Co-authored-by: Sean McGuire <[email protected]> Co-authored-by: Sean McGuire <[email protected]> Co-authored-by: Sandro Campos <[email protected]>
1 parent c39621d commit ad6efa0

23 files changed

+504
-980
lines changed

docs/guide/contributing.rst

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,7 @@ Notes:
5858

5959
.. tip::
6060
Installing on Mac
61-
62-
Native prebuilt binaries for healpy on Apple Silicon Macs
63-
`do not yet exist <https://healpy.readthedocs.io/en/latest/install.html#binary-installation-with-pip-recommended-for-most-other-python-users>`_,
64-
so it's recommended to install via conda before proceeding to hats.
65-
66-
.. code-block:: bash
67-
68-
$ conda config --add channels conda-forge
69-
$ conda install healpy
70-
$ git clone https://github.com/astronomy-commons/hats
71-
$ cd hats
72-
$ pip install -e .
73-
61+
7462
When installing dev dependencies, make sure to include the single quotes.
7563

7664
.. code-block:: bash

docs/guide/pixel_math.md

Lines changed: 0 additions & 194 deletions
This file was deleted.

docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ operations on top of these utilities. Some known extensions:
3636
:caption: Developers
3737

3838
guide/contributing
39-
Pixel math <guide/pixel_math>
4039
API Reference <autoapi/index>
4140

4241
Getting Started

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ dependencies = [
2222
"aiohttp", # http filesystem support
2323
"astropy",
2424
"fsspec>=2023.10.0", # Used for abstract filesystems
25-
"healpy",
2625
"jproperties",
2726
"matplotlib>=3.3,<3.9",
28-
"mocpy",
27+
"mocpy>=0.17.1",
2928
"numba>=0.58",
3029
"numpy<3",
3130
"pandas",

src/hats/catalog/healpix_dataset/healpix_dataset.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,10 @@ def filter_by_cone(self, ra: float, dec: float, radius_arcsec: float) -> Self:
155155
)
156156
return self.filter_by_moc(cone_moc)
157157

158-
def filter_by_box(
159-
self, ra: Tuple[float, float] | None = None, dec: Tuple[float, float] | None = None
160-
) -> Self:
158+
def filter_by_box(self, ra: Tuple[float, float], dec: Tuple[float, float]) -> Self:
161159
"""Filter the pixels in the catalog to only include the pixels that overlap with a
162-
right ascension or declination range. In case both ranges are provided, filtering
163-
is performed using a polygon.
160+
zone, defined by right ascension and declination ranges. The right ascension edges follow
161+
great arc circles and the declination edges follow small arc circles.
164162
165163
Args:
166164
ra (Tuple[float, float]): Right ascension range, in degrees

src/hats/catalog/margin_cache/margin_catalog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def filter_by_moc(self, moc: MOC) -> Self:
3333
pixel sizes.
3434
"""
3535
max_order = moc.max_order
36-
max_order_size = hp.nside2resol(2**max_order, arcmin=True)
37-
if self.catalog_info.margin_threshold > max_order_size * 60:
36+
max_order_size_arcsec = hp.order2mindist(max_order) * 60
37+
if self.catalog_info.margin_threshold > max_order_size_arcsec:
3838
raise ValueError(
3939
f"Cannot Filter Margin: Margin size {self.catalog_info.margin_threshold} is "
4040
f"greater than the size of a pixel at the highest order {max_order}."

src/hats/catalog/partition_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def calculate_fractional_coverage(self):
274274
"""Calculate what fraction of the sky is covered by partition tiles."""
275275
pixel_orders = [p.order for p in self.pixel_list]
276276
cov_order, cov_count = np.unique(pixel_orders, return_counts=True)
277-
area_by_order = [hp.nside2pixarea(hp.order2nside(order), degrees=True) for order in cov_order]
277+
area_by_order = [hp.order2pixarea(order, degrees=True) for order in cov_order]
278278
# 41253 is the number of square degrees in a sphere
279279
# https://en.wikipedia.org/wiki/Square_degree
280280
return (area_by_order * cov_count).sum() / (360**2 / np.pi)

0 commit comments

Comments
 (0)