Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
cac4c6c
inital commit of anacal ingester
empEvil Nov 4, 2025
52093b0
fixed, first attempt
empEvil Nov 4, 2025
0542c09
Merge branch 'master' into AnaCal_ingestion
empEvil Feb 27, 2026
cb0bead
Merge branch 'master' into AnaCal_ingestion
empEvil Mar 20, 2026
5f985ad
Merge branch 'master' into AnaCal_ingestion
empEvil Apr 17, 2026
abba469
fixing the ingestion part
empEvil Apr 17, 2026
fd42ff6
updating test configs
empEvil Apr 17, 2026
1c99217
more input edits
empEvil Apr 17, 2026
8126a27
typo fix
empEvil Apr 17, 2026
96914db
change naming
empEvil Apr 17, 2026
09bf4e3
WIP on anacal calibrator
empEvil Apr 27, 2026
21103dd
WIP simplifying the calibration
empEvil Apr 27, 2026
5881da1
added calibration calculator
empEvil Apr 28, 2026
7966f16
WIP
empEvil May 5, 2026
6fb51b9
initial version of source selector
empEvil May 5, 2026
5c444a1
adding missing stage to init
empEvil May 27, 2026
3cc7017
more import
empEvil May 27, 2026
54b1846
Merge branch 'master' into AnaCal_ingestion
empEvil May 28, 2026
a7b56a6
added butler version to Anacal WIP
empEvil May 28, 2026
fcc9c07
fixing butler calls
empEvil May 28, 2026
75f3e4a
fixin input columns
empEvil May 28, 2026
71f004f
fixing ingestion
empEvil May 28, 2026
dcb80cc
removing missing detail
empEvil May 28, 2026
901b0c2
fixing prefix
empEvil May 28, 2026
b39c0d2
typo
empEvil May 28, 2026
cb0d002
fixing inputs
empEvil May 28, 2026
c6f2a3b
fixing flux reading
empEvil May 28, 2026
ba9fe19
typo
empEvil May 28, 2026
cbce432
another typo
empEvil May 28, 2026
276d805
fixing sourceselection
empEvil May 28, 2026
99eec0b
fixing the calculator
empEvil May 29, 2026
c5744a7
adding specific selectors
empEvil May 29, 2026
a795dea
adding missing columns
empEvil May 29, 2026
30b4e45
fixing the calibration
empEvil May 29, 2026
1f29f6a
more fixes
empEvil May 29, 2026
9ad3c5e
more fixes
empEvil May 29, 2026
2459f90
typo
empEvil May 29, 2026
7bbc450
fixing a missing import
empEvil May 29, 2026
f727a96
fixed a typo
empEvil May 29, 2026
06e1820
fixed a typo
empEvil May 29, 2026
05ac192
fixing the calibrator
empEvil May 29, 2026
089c8bb
typo
empEvil May 29, 2026
64e95ec
changed save
empEvil May 29, 2026
803cee2
adding 2d
empEvil May 29, 2026
e761385
trying to fix calibration
empEvil Jun 1, 2026
62ad6a6
adding anacal definitions
empEvil Jun 1, 2026
82413b6
fixing typos
empEvil Jun 1, 2026
20363b3
adding anacal specifics
empEvil Jun 1, 2026
8a900fe
adding tests for anacal's calibrator
empEvil Jul 1, 2026
1ec3129
small upates
empEvil Jul 10, 2026
20f554e
adding s2n derivatives
empEvil Jul 14, 2026
baaadff
fixing response flux to magnitude
empEvil Jul 14, 2026
cd1a7fe
fixing mask_threshold
empEvil Jul 14, 2026
d80dd63
fixing folder
empEvil Jul 14, 2026
5a66b75
fixing catalog name
empEvil Jul 14, 2026
69f08ef
minor fixes
empEvil Jul 14, 2026
a0275a9
fixing doctstring
empEvil Jul 14, 2026
89b6543
fixing error message
empEvil Jul 14, 2026
3a72a90
adding select_tracts option
empEvil Jul 14, 2026
7346ae7
trying to fix the calibration of the detection response
empEvil Jul 14, 2026
5131798
removing unused things
empEvil Jul 14, 2026
0e5890a
fixing threshold flagging
empEvil Jul 14, 2026
32d4979
fixing missing input in test
empEvil Jul 14, 2026
8d3a0be
correcting test
empEvil Jul 14, 2026
e98a09a
1. unify shear_catalog_type to "anacal". There was 'Anacal' and 'anacal'
mr-superonion Jul 15, 2026
2312eb1
fix R_sel normalization and guard nanojansky_err_to_mag_ab
mr-superonion Jul 15, 2026
04dc546
update the examples/anacal so that they are consistent
mr-superonion Jul 15, 2026
3e7ad1a
Merge pull request #482 from mr-superonion/AnaCal_ingestion
empEvil Jul 15, 2026
e112dea
1. Extended the examples/anacal/ pipeline. Added TXSourceSelectorAnaCal
mr-superonion Jul 16, 2026
6cf485e
Moving the PZ_SUFFIXES for clarity
empEvil Jul 16, 2026
77654ac
update test to use consistent delta_gamma for anacal
mr-superonion Jul 16, 2026
0f2d95f
1. use ParallelMean;
mr-superonion Jul 17, 2026
1812a90
add necessary columns in test_cal.py
mr-superonion Jul 17, 2026
a21049e
separate the ingestor from selector and calibrator in examples/anacal/
mr-superonion Jul 17, 2026
a468235
1. add selection on magnitude in different bands (with selection
mr-superonion Jul 22, 2026
9085096
removed unused anacal code in utils/conversion.py
mr-superonion Jul 22, 2026
ae7e7c2
moving variant columns from selector to ingestor
empEvil Jul 29, 2026
b795700
fixing g1/g2 vs e1/e2
empEvil Jul 29, 2026
a84dae6
add calibrator to example
mr-superonion Jul 22, 2026
956f9cc
Ingest anacal mask column as n_mask_base
mr-superonion Aug 31, 2026
bdb46cc
Add per-band PSF properties to anacal ingest
mr-superonion Aug 31, 2026
0009f70
Ingest all tracts in the collection when no selection is given
mr-superonion Aug 31, 2026
1f4ad0f
add extinction column from dm pipeline
mr-superonion Aug 31, 2026
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
79 changes: 79 additions & 0 deletions examples/anacal/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
global:
Comment thread
empEvil marked this conversation as resolved.
chunk_rows: 100000
sparse: true # Generate sparse maps - faster if using small areas
pixelization: healpix
nside: 512

TXIngestAnacal:
# DP1-v3 AnaCal outputs for the a360 cluster field (per-tract).
butler_config_file: /global/cfs/cdirs/lsst/production/gen3/rubin/DP1/repo/butler.yaml
collections: "u/xiangchl/dp1-v3/a360_anacal2"

# a360 sits in the "Low Ecliptic Latitude Field" (LELF). DP1_TRACTS["LELF"]
# contains the two live tracts 10463, 10464 (plus four never-processed).
select_field: "LELF"
cosmology_tracts_only: False

# Merged catalog carries band-combined shape moments under the "fpfs1_*"
# prefix and Gaussian-aperture fluxes at scale "gauss2". Per-band
# columns are survey-prefixed as ``lsst_{band}_...`` (v3 schema) and
# carry pre-computed magnitudes + dmag/dg responses, so no
# nanojansky→mag conversion happens inside the ingest. a360 was
# measured on griz only (no u/y coadds).
prefix: "fpfs1"
scale: "gauss2"
bands: "griz"

TXSourceSelectorAnaCal:
# AnaCal shear-response step size for selection bias correction — must
# match the δγ used to build the on-disk photo-z distortions
# (zmode_{1p,1m,2p,2m}) in xlens' photoZPipe (currently ±0.01 in
# DISTORTIONS).
delta_gamma: 0.01

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

i add the selection stage in the example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But we don't want to run them at the same time. Sadly from how things are set up on NERSC, we want to run the ingestion stage in one environment and then the rest of the pipeline should be run in a dedicated environment for TXPipe. But we want to be able to run the Selection stage later, where we might be able to use different photo-z's for example

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

thanks for the comment and i have separated the ingestion from the rest of the task in the examples folder (see commit a21049e)

# mask_value threshold — sources with mask_value >= this get dropped.
# AnaCal reports a bit-packed flag; 1 means "any bit set" (strictest).
mask_threshold: 40

# AnaCal S/N cut (flux / flux_err). Default in code is 5.0.
s2n_cut: 5.0

# Band-combined size cut (m00 + m20) / m00 > T_cut on fpfs1 moments.
# Default 0.1.
T_cut: 0.1

# Band-combined shape magnitude cut |e| < emax (selector applies
# esq < emax**2 on the ``esq`` column).
emax: 0.5

# Per-band AB mag upper bounds (uses pre-computed mag_{b} from v3
# ingest). Default 50 is above the xlens smooth-truncation cap
# (mag=40) so no cut is applied; set per band to gate on brightness.
g_hi_cut: 50.0
r_hi_cut: 50.0
i_hi_cut: 50.0
z_hi_cut: 50.0

# Bands available in the a360 ingest.
bands: [g, r, i, z]

# 5 tomographic bins — will need edited to fit your science n(z).
source_zbin_edges: [0.3, 0.6, 0.9, 1.2, 1.5, 2.0]

# ``input_pz: true`` reads ``mean_z`` from the shear catalog and skips the
# random-forest classifier. TXIngestAnacal exposes ``mean_z`` (from
# ``zmode_0`` in the merged catalog) plus the four shifted variants
# ``mean_z_{1p,1m,2p,2m}`` (from ``zmode_{1p,1m,2p,2m}``) — the selector
# consumes the baseline column for tomographic binning and the four
# variants for the selection response computation.
# If ``input_pz: false``, a shear_tomography_classifier pickle +
# spectroscopic_catalog are required (see pipeline.yml inputs).
input_pz: true
true_z: false
verbose: True
chunk_rows: 100000

TXShearCalibration:
shear_catalog_type: anacal
subtract_mean_shear: true
chunk_rows: 100000
28 changes: 28 additions & 0 deletions examples/anacal/ingest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# AnaCal ingest — runs TXIngestAnacal only. Writes the shear catalog
# into ``data/example/anacal_inputs`` which is then consumed by
# ``examples/anacal/pipeline.yml``.

stages:
- name: TXIngestAnacal

output_dir: data/example/anacal_inputs

launcher:
name: mini
interval: 1.0

site:
name: local

modules: >
txpipe

config: examples/anacal/config.yml

inputs:
# Butler-mode ingest doesn't read this FITS, but ceci requires every
# declared input to have a path — pointed at the DP1-v3 published
# per-field catalog to satisfy the graph builder.
anacal_catalog: /global/cfs/cdirs/desc-wl/projects/anacal/DP1-v3/catalogs/anacal_catalog_a360.fits

resume: False
35 changes: 35 additions & 0 deletions examples/anacal/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# AnaCal selector + calibrator pipeline — reads the shear catalog produced
# by ``examples/anacal/ingest.yml``.

stages:
- name: TXSourceSelectorAnaCal
- name: TXShearCalibration

output_dir: data/example/output_anacal

launcher:
name: mini
interval: 1.0

site:
name: local
max_threads: 2

modules: >
txpipe

config: examples/anacal/config.yml

inputs:
shear_catalog: data/example/anacal_inputs/shear_catalog.hdf5

# Selector-side inputs. With ``input_pz: true`` in config.yml the
# selector reads ``mean_z`` from the shear catalog (populated by
# TXIngestAnacal from ``zmode_0``), so these two are only exercised
# under ``input_pz: false`` (random-forest tomography). Kept here to
# satisfy the ceci graph builder — ceci checks every declared input
# has a path, even when the stage doesn't open it.
spectroscopic_catalog: /pscratch/sd/x/xiangchl/data/DP1/catalogs/spec_catalog_a360.hdf5
shear_tomography_classifier: /pscratch/sd/x/xiangchl/data/DP1/catalogs/shear_tomography_classifier_a360.pkl

resume: False
1 change: 1 addition & 0 deletions txpipe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
TXSourceSelectorMetacal,
TXSourceSelectorLensfit,
TXSourceSelectorMetadetect,
TXSourceSelectorAnacal,
)
from .lens_selector import TXMeanLensSelector
from .photoz_stack import TXPhotozStack, TXPhotozPlot, TXTruePhotozStack
Expand Down
2 changes: 2 additions & 0 deletions txpipe/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def run(self):
# therefore, we add dec to split data into these fields.
# You can choose not to by setting dec_cut = 90 in the config, for example.
d["g1"], d["g2"] = cal.apply(d["g1"], d["g2"], d["dec"], subtract_mean=subtract_mean_shear)
elif cat_type == "anacal":
d["g1"], d["g2"] = cal.apply(d["g1"], d["g2"], d["weight"], subtract_mean=subtract_mean_shear)
else:
d["g1"], d["g2"] = cal.apply(d["g1"], d["g2"], subtract_mean=subtract_mean_shear)

Expand Down
3 changes: 3 additions & 0 deletions txpipe/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ def get_primary_catalog_names(self, true_shear=False):
elif self.catalog_type == "metadetect":
shear_cols = ["00/g1", "00/g2", "00/ra", "00/dec", "00/weight"]
rename = {c: c[3:] for c in shear_cols}
elif self.catalog_type == "anacal":
shear_cols = ["e1", "e2", "ra", "dec", "weight"]
rename = {"e1":"g1", "e2":"g2"}
else:
shear_cols = ["g1", "g2", "ra", "dec", "weight"]
rename = {}
Expand Down
2 changes: 2 additions & 0 deletions txpipe/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ def run(self):
"weight",
)
shear_cols += band_variants(bands, "mag", "mag_err", shear_catalog_type="metadetect")
elif cat_type == "anacal":
raise NameError("anacal does not work with this atm.")
else:
shear_cols = [
"dec",
Expand Down
1 change: 1 addition & 0 deletions txpipe/ingest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
TXIngestSSIDetectionDESBalrog,
)
from .dp1 import TXIngestDataPreview1
from .anacal import TXIngestAnacal
from .stage3 import TXIngestDESY3Gold
Loading
Loading