Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove margin fine filtering, and healpy dependency. #434

Merged
merged 26 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
03b42dc
Remove margin fine filtering.
delucchi-cmu Nov 18, 2024
2dca8ec
Remove unused unseen.
delucchi-cmu Nov 18, 2024
f732d78
Remove margin fine filtering. (#421)
delucchi-cmu Nov 18, 2024
3606aa6
Use cdshealpix for margin pixel finding.
delucchi-cmu Nov 18, 2024
f2e56ba
Merge branch 'margin' into delucchi/cdshealpix_bounds
delucchi-cmu Nov 18, 2024
56d343c
Unused import.
delucchi-cmu Nov 18, 2024
3a813ba
Merge pull request #422 from astronomy-commons/delucchi/cdshealpix_bo…
smcguire-cmu Nov 18, 2024
82f98dd
add color_by_order option and plot on existing axes
smcguire-cmu Nov 16, 2024
1b52544
reset matplotlib after tests
smcguire-cmu Nov 18, 2024
0971802
pylint
smcguire-cmu Nov 19, 2024
8f8bb6b
Migrate ang2vec (#426)
camposandro Nov 19, 2024
7c8dfb7
use mindist instead of resol for margin filter
smcguire-cmu Nov 19, 2024
a87875e
Merge branch 'margin' into sean/fix-margin-filter
smcguire-cmu Nov 19, 2024
f5d359b
Merge pull request #427 from astronomy-commons/sean/fix-margin-filter
smcguire-cmu Nov 19, 2024
c5605d5
Merge pull request #424 from astronomy-commons/sean/plotting-improvem…
smcguire-cmu Nov 19, 2024
45512fc
Replace healpy in healpix_shim pixel math operations
smcguire-cmu Nov 20, 2024
312f557
isort
smcguire-cmu Nov 20, 2024
420a044
support np arrays
smcguire-cmu Nov 20, 2024
c7738f0
use order instead of nside
smcguire-cmu Nov 22, 2024
f495c43
remove unused variable
smcguire-cmu Nov 22, 2024
14ac56d
Merge pull request #430 from astronomy-commons/sean/healpy-math
smcguire-cmu Nov 22, 2024
4844911
Return int64 from radec2pix (#432)
delucchi-cmu Nov 22, 2024
e4ae032
Migrate box filtering to use MOCpy (#428)
camposandro Nov 22, 2024
fc48ad4
Remove healpy references. (#433)
delucchi-cmu Nov 25, 2024
1dd1010
Merge branch 'main' into merge_conflicts
delucchi-cmu Nov 25, 2024
b14bc14
Address merge conflicts
delucchi-cmu Nov 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions docs/guide/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,7 @@ Notes:

.. tip::
Installing on Mac

Native prebuilt binaries for healpy on Apple Silicon Macs
`do not yet exist <https://healpy.readthedocs.io/en/latest/install.html#binary-installation-with-pip-recommended-for-most-other-python-users>`_,
so it's recommended to install via conda before proceeding to hats.

.. code-block:: bash

$ conda config --add channels conda-forge
$ conda install healpy
$ git clone https://github.com/astronomy-commons/hats
$ cd hats
$ pip install -e .


When installing dev dependencies, make sure to include the single quotes.

.. code-block:: bash
Expand Down
194 changes: 0 additions & 194 deletions docs/guide/pixel_math.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ operations on top of these utilities. Some known extensions:
:caption: Developers

guide/contributing
Pixel math <guide/pixel_math>
API Reference <autoapi/index>

Getting Started
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ dependencies = [
"aiohttp", # http filesystem support
"astropy",
"fsspec>=2023.10.0", # Used for abstract filesystems
"healpy",
"jproperties",
"matplotlib>=3.3,<3.9",
"mocpy",
"mocpy>=0.17.1",
"numba>=0.58",
"numpy<3",
"pandas",
Expand Down
8 changes: 3 additions & 5 deletions src/hats/catalog/healpix_dataset/healpix_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,10 @@ def filter_by_cone(self, ra: float, dec: float, radius_arcsec: float) -> Self:
)
return self.filter_by_moc(cone_moc)

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

Args:
ra (Tuple[float, float]): Right ascension range, in degrees
Expand Down
4 changes: 2 additions & 2 deletions src/hats/catalog/margin_cache/margin_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def filter_by_moc(self, moc: MOC) -> Self:
pixel sizes.
"""
max_order = moc.max_order
max_order_size = hp.nside2resol(2**max_order, arcmin=True)
if self.catalog_info.margin_threshold > max_order_size * 60:
max_order_size_arcsec = hp.order2mindist(max_order) * 60
if self.catalog_info.margin_threshold > max_order_size_arcsec:
raise ValueError(
f"Cannot Filter Margin: Margin size {self.catalog_info.margin_threshold} is "
f"greater than the size of a pixel at the highest order {max_order}."
Expand Down
2 changes: 1 addition & 1 deletion src/hats/catalog/partition_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def calculate_fractional_coverage(self):
"""Calculate what fraction of the sky is covered by partition tiles."""
pixel_orders = [p.order for p in self.pixel_list]
cov_order, cov_count = np.unique(pixel_orders, return_counts=True)
area_by_order = [hp.nside2pixarea(hp.order2nside(order), degrees=True) for order in cov_order]
area_by_order = [hp.order2pixarea(order, degrees=True) for order in cov_order]
# 41253 is the number of square degrees in a sphere
# https://en.wikipedia.org/wiki/Square_degree
return (area_by_order * cov_count).sum() / (360**2 / np.pi)
Loading