Make Region a TOMToolkit model#7
Open
phycodurus wants to merge 21 commits intomainfrom
Open
Conversation
Self-contained port of skyportal/healpix-alchemy onto django.contrib.postgres primitives. MOCs are stored as one row per int8range tile with SP-GiST. PostgreSQL 14+ only; hard-fails elsewhere from AppConfig.ready().
mocpy 0.19 dropped its public cdshealpix dep, and cdshealpix 0.8 requires Longitude/Latitude (with units) rather than radian floats.
ListView, DetailView, app integration points urls, etc.
The List page reders an HTMX-driven, filterable table with an Aladin Lite skymap whose MOC overlay set updates in lockstep via the OOB-data-update pattern. Detail page reuses the same Aladin partial for a single-region view and exposes the IVOA MOC JSON via a labeled link.
Aladin Lite's A.MOCFromURL parses FITS only; switch the overlay to A.MOCFromJSON with the IVOA dict inlined in the page payload. Extract a region_to_moc_json helper so the HTTP endpoint and the inline overlay share one encoder. Label the detail-page link as IVOA.
Tiles are stored at their native HEALPix level (length-encoded in the int8range), so a single region's rows span multiple orders, and that's where the compression vs. a flat depth-29 list comes from. Adds two MultiOrderStorageTests cases that demonstrate the property at the database layer.
boot_django.py + run_tests.py runs the test suite via `python tom_regions/tests/run_tests.py` without standing up a host TOM; the GitHub Actions matrix exercises Python 3.12/3.13 against a postgres:16-alpine service container.
Steradians is the SI unit and stays as the database column. but every user-facing display converts to square degrees. - SQ_DEG_PER_STERADIAN goes in `healpix_django.constants`. - `BaseRegion.area_sq_deg` is a thin @Property wrapping the conversion.
Read the upload's bytes into a BytesIO before passing it to MOC.from_fits. mocpy's MOC.from_fits checks for BytesIO first and reads its bytes directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is designed to be the basis of a future
tom_nonlocalizedeventsrefactor and future radio astronomy use cases.healpix_djangosubpackagecurl -o gaiaDR2.fits "http://alasky.u-strasbg.fr/MocServer/query?ID=CDS/I/345/gaia2&get=moc&fmt=fits"and upload the saved file (gaiaDR2.fits)