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

Add custom healpix plotting method #374

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Conversation

smcguire-cmu
Copy link
Contributor

@smcguire-cmu smcguire-cmu commented Oct 11, 2024

Replaces healpy's plotting methods with a new healpix map plotting method based on mocpy's plotting functions.

Fixes #242

dependabot bot and others added 14 commits October 1, 2024 08:53
Bumps [pre-commit-ci/lite-action](https://github.com/pre-commit-ci/lite-action) from 1.0.2 to 1.0.3.
- [Release notes](https://github.com/pre-commit-ci/lite-action/releases)
- [Commits](pre-commit-ci/lite-action@v1.0.2...v1.0.3)

---
updated-dependencies:
- dependency-name: pre-commit-ci/lite-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
…ons/pre-commit-ci/lite-action-1.0.3

Bump pre-commit-ci/lite-action from 1.0.2 to 1.0.3
…o-type

update healpixdataset catalog info type
* Wrap catalog's length method

* Clarify error message
Copy link

github-actions bot commented Oct 11, 2024

Before [4357f0c] After [a0d8ee3] Ratio Benchmark (Parameter)
13.3±0.2ms 13.8±0.5ms 1.04 benchmarks.Suite.time_inner_pixel_alignment
88.0±2ms 89.6±2ms 1.02 benchmarks.Suite.time_paths_creation
376±4ms 379±3ms 1.01 benchmarks.Suite.time_outer_pixel_alignment
43.1±1ms 43.3±1ms 1.01 benchmarks.Suite.time_pixel_tree_creation
121±0.7ms 123±2ms 1.01 benchmarks.time_test_alignment_even_sky
76.9±0.3ms 76.5±0.4ms 1 benchmarks.MetadataSuite.time_load_partition_join_info
971±4μs 967±7μs 1 benchmarks.time_test_cone_filter_multiple_order
76.9±0.2ms 75.9±1ms 0.99 benchmarks.MetadataSuite.time_load_partition_info_order7
20.1±0.5ms 19.3±0.4ms 0.96 benchmarks.MetadataSuite.time_load_partition_info_order6

Click here to view all benchmarks.

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 94.78261% with 6 lines in your changes missing coverage. Please review.

Project coverage is 93.75%. Comparing base (5da4158) to head (89433b0).
Report is 4 commits behind head on development.

Files with missing lines Patch % Lines
src/hipscat/inspection/visualize_catalog.py 95.53% 5 Missing ⚠️
...hipscat/catalog/healpix_dataset/healpix_dataset.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           development     #374      +/-   ##
===============================================
- Coverage        93.99%   93.75%   -0.24%     
===============================================
  Files               58       59       +1     
  Lines             2130     2241     +111     
===============================================
+ Hits              2002     2101      +99     
- Misses             128      140      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@smcguire-cmu smcguire-cmu changed the base branch from main to development October 11, 2024 19:19
Copy link
Contributor

@hombit hombit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, Sean!

src/.pylintrc Outdated Show resolved Hide resolved
src/hipscat/inspection/visualize_catalog.py Show resolved Hide resolved
src/hipscat/inspection/visualize_catalog.py Outdated Show resolved Hide resolved
src/hipscat/inspection/visualize_catalog.py Show resolved Hide resolved
src/hipscat/inspection/visualize_catalog.py Show resolved Hide resolved
src/hipscat/inspection/visualize_catalog.py Show resolved Hide resolved
# Set projection
_set_wcs(ax, wcs)

return ax
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need it to return anything? Maybe it is better to be col? (should plot_healpix_map also return col?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like plot_healpix_map returning ax, it makes it easy to overplot things, and you can get the collection from it anyway. You're right though that the inner function doesn't really need to return anything, I'll update that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also like that it matches plt.subplots fig, ax = plt.subplots()

src/hipscat/inspection/visualize_catalog.py Outdated Show resolved Hide resolved
return ipix_d


def plot_healpix_map(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIgh-level question. If I select some FOV, the color bar still shows the same range as for the whole plot. I'd probably prefer to have better color resolution when I zoom. Maybe it is just a documentation issue about norm/cmap arguments.

See an example with plot_points and DES DR2 catalog:
image
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we should cull the pixels outside of the fov, but I was lazy and I didn't think about this use case so I didn't think it would impact anything other than performance. But this is a good idea to add.

@hombit
Copy link
Contributor

hombit commented Oct 16, 2024

@smcguire-cmu I played more! It gave me empty plot when I tried to do it for ALLWISE:

import hipscat

catalog = hipscat.loaders.read_from_hipscat('https://data.lsdb.io/unstable/wise/allwise')
hipscat.inspection.plot_points(catalog)
image

It also uses a lot of RAM, but it is probably expected?

Zoomed version works fine

import hipscat
from astropy.coordinates import Angle, SkyCoord

catalog = hipscat.loaders.read_from_hipscat('https://data.lsdb.io/unstable/wise/allwise')
hipscat.inspection.plot_points(catalog, center=SkyCoord(0, 0, unit='deg'), fov=(Angle(5, 'deg'), Angle(10, 'deg')))
image

@hombit
Copy link
Contributor

hombit commented Oct 16, 2024

@smcguire-cmu One more thing. It would be nice to make a "view window" to be a rectangle when fov is passed

smcguire-cmu and others added 2 commits October 16, 2024 16:12
Base automatically changed from development to main October 22, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HEALPix pixel plotting improvements
3 participants