CosmoStat / CosmoStat/sp_validation

Galaxy selection: replace the IMAFLAGS_ISO == 0 cut with the MASK_n* bit columns

Open
#342 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2
Forks
5
Avg merge
1d 14h
Merged PRs (30d)
19

Description

Since CosmoStat/shapepipe#847, ShapePipe generates no masks. Tile detection runs with no flag image, so IMAFLAGS_ISO — which was the rasterized star/galaxy/external mask OR'd over each object's isophote — no longer exists in the shear catalogue. Its replacement is one column per UNIONS mask bit, MASK_n1 … MASK_n2048, queried from the sky-fixed healsparse maps at each object's position (True = masked; see the bit table in #847). The wiring lands in CosmoStat/shapepipe#886 and the columns reach final_cat_<campaign>.hdf5 via CosmoStat/shapepipe#879.

sp_validation still cuts on IMAFLAGS_ISO == 0 (galaxy.py:175 classification_galaxy_base, scripts/calibration/extract_info.py:163, scripts/masking.py, params.py column lists). Against a v2 catalogue that raises a missing-column error.

Proposed: define the galaxy-sample mask as an explicit set of bits and cut on their OR. The set {n1, n2, n4, n8, n64, n1024} reproduces the v1 r-band mask exactly (OR == mask_r on P3; n64 is an undocumented reason bit in the r-band default bitmask, not a coverage flag) — star mask (n4), halos (n1 | n2, combined: which is faint vs bright is unconfirmed for the Aug-2026 products), manual galaxy masks (n8), MaxiMask (n1024). Do not OR every MASK_* column: n16/n32/n128/n256 are per-band (u g i z) coverage flags and n2048 is 1 wherever Pan-STARRS z2 is absent, so a blanket OR masks the whole footprint. The bit list should be config, not code.

Related: #879 also moves the star catalogue to full_starcat_<campaign>.hdf5 (exposures/<exp> datasets) — the fits.getdata readers in extract_info.py and compute_leakage_harmony.py need an hdf5 path. Both fit naturally with #340.

— Claude (Fable) on behalf of Cail

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with galaxy.py:175, scripts/calibration/extract_info.py:163, scripts/masking.py, and the column lists in params.py to trace every IMAFLAGS_ISO use. Review the UNIONS bit table from #847 and the catalogue wiring in #886 and #879, then inspect the FITS readers in extract_info.py and compute_leakage_harmony.py. Done means v2 catalogues no longer raise missing-column errors and the configured mask selection matches the stated v1 comparison.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.