Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 20 additions & 0 deletions example/cfis/config_tile_Ng_template.ini
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,25 @@ PIXEL_SCALE = 0.186
# noisy for stars and flagged as incorrect — see #767).
CENTROID_SOURCE = wcs

# BLEND_HANDLING (optional): neighbour treatment. "noisefill" (default,
# historical) replaces a neighbour's pixels with a noise realisation;
# "uberseg" hard-masks (weight -> 0) every pixel closer to a neighbour's
# segmentation footprint than to the central object. "uberseg" REQUIRES
# SEG_VIGNET_PATH below.
# BLEND_HANDLING = uberseg

# SEG_VIGNET_PATH (optional): coadd-frame SExtractor segmentation vignets
# (the CLASSIC-mode VIGNETMAKER_RUNNER_RUN_3 seg output), row-aligned to the
# tile catalogue and on the same 51x51 grid as the coadd VIGNET. Required for
# BLEND_HANDLING = uberseg; when set, the file must exist for every tile
# (missing file -> error). Omit for the noise-fill path.
# SEG_VIGNET_PATH = $SP_RUN/output/run_sp_tile_PiViVi/vignetmaker_runner_run_3/output/seg_vignet{file_number_string}.fits

# DILATE_NEIGHBOUR (optional): binary-dilation iterations enlarging the uberseg
# neighbour mask, to absorb the few-pixel coadd-vs-epoch seg-overlay offset.
# Ignored unless BLEND_HANDLING = uberseg. Default 1 (~one pixel); 0 recovers
# the pure Sheldon UberSeg mask.
# DILATE_NEIGHBOUR = 1

ID_OBJ_MIN = X
ID_OBJ_MAX = X
38 changes: 37 additions & 1 deletion example/cfis/config_tile_PiViVi_canfar_sx.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN_NAME = run_sp_tile_PiViVi
# Module name, single string or comma-separated list of valid module runner names
#MODULE = psfex_interp_runner,

MODULE = psfex_interp_runner, vignetmaker_runner, vignetmaker_runner
MODULE = psfex_interp_runner, vignetmaker_runner, vignetmaker_runner, vignetmaker_runner

# Parallel processing mode, SMP or MPI
MODE = SMP
Expand Down Expand Up @@ -166,3 +166,39 @@ PREFIX =
ME_IMAGE_EXP_DIR = $SP_EXP
ME_IMAGE_EXP_RUNNERS = split_exp_runner, split_exp_runner, split_exp_runner, sextractor_runner, sextractor_runner
ME_IMAGE_PATTERN = flag, image, weight, background, background_rms


[VIGNETMAKER_RUNNER_RUN_3]

# Cut per-object coadd-frame segmentation stamps from the tile SExtractor
# SEGMENTATION check image (config_tile_Sx.ini: CHECKIMAGE = BACKGROUND,
# SEGMENTATION). Integer labels, no interpolation, zero-padded — CLASSIC mode
# guarantees this. Row-aligned to the tile catalogue on the same XWIN/YWIN
# centres and 51x51 grid as the coadd VIGNET, so ngmix can overlay the seg
# stamp directly for uberseg neighbour masking (shapepipe#776).

INPUT_DIR = run_sp_tile_Sx:sextractor_runner

FILE_PATTERN = sexcat, segmentation

FILE_EXT = .fits, .fits

# NUMBERING_SCHEME (optional) string with numbering pattern for input files
NUMBERING_SCHEME = -000-000

MASKING = False
MASK_VALUE = 0

# CLASSIC: cut stamps at object positions in the coadd (tile) frame.
MODE = CLASSIC

# Coordinate frame type, one in PIX (pixel frame), SPHE (spherical coordinates)
COORD = PIX
POSITION_PARAMS = XWIN_IMAGE,YWIN_IMAGE

# Vignet size in pixels — MUST equal the coadd VIGNET size (51) so the seg
# stamp overlays the galaxy stamp on an identical grid.
STAMP_SIZE = 51

# Output file name prefix, file name is <PREFIX>_vignet.fits
PREFIX = seg
2 changes: 1 addition & 1 deletion example/cfis/config_tile_Sx.ini
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ BKG_FROM_HEADER = False
# BACKGROUND, BACKGROUND_RMS, INIBACKGROUND,
# MINIBACK_RMS, -BACKGROUND, #FILTERED,
# OBJECTS, -OBJECTS, SEGMENTATION, APERTURES
CHECKIMAGE = BACKGROUND
CHECKIMAGE = BACKGROUND, SEGMENTATION

# File name suffix for the output sextractor files (optional)
SUFFIX = sexcat
Expand Down
3 changes: 3 additions & 0 deletions example/cfis/final_cat.param
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ NGMIX_G2_PSF_ORIG_NOSHEAR
N_EPOCH
NGMIX_N_EPOCH

# Blend flag: coadd seg stamp held a non-central footprint (shapepipe#776)
NGMIX_NEIGHBOUR_FLAG

## Shape measurement outputs
## Ngmix: model fitting

Expand Down
15 changes: 13 additions & 2 deletions src/shapepipe/modules/make_cat_package/make_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,11 @@ def _save_ngmix_data(self, ngmix_cat_path, moments=False):
Save the NGMIX catalogue into the final one.

Column grammar: ``NGMIX[m]_<COMPONENT>[_ERR][_<OBJECT>]_<SHEAR>``,
plus three OBJECT/SHEAR-less per-object metadata columns
plus four OBJECT/SHEAR-less per-object metadata columns
(``NGMIX[m]_MCAL_FLAGS``, ``NGMIX_N_EPOCH``,
``NGMIX_MCAL_TYPES_FAIL``). The galaxy is the implicit default object
``NGMIX_MCAL_TYPES_FAIL``, ``NGMIX_NEIGHBOUR_FLAG`` — the last a blend
flag set when the coadd seg stamp held a non-central footprint,
shapepipe#776). The galaxy is the implicit default object
and carries NO ``OBJECT`` token (``NGMIX_G1_NOSHEAR``, dropping the
``GAL`` segment carried by the pre-#761 names). The explicit PSF
objects are ``PSF_ORIG``
Expand Down Expand Up @@ -369,6 +371,9 @@ def _save_ngmix_data(self, ngmix_cat_path, moments=False):
#return err_msg

ngmix_mcal_types_fail = ngmix_cat_file.get_data()["mcal_types_fail"]
# Per-object blend flag (shapepipe#776): the seg stamp held a
# non-central footprint. Galaxy-only (non-moments), like N_EPOCH.
ngmix_neighbour_flag = ngmix_cat_file.get_data()["neighbour_flag"]
# Needed in both moments and non-moments modes (used unconditionally
# below), so read them outside the branch.
ngmix_mcal_flags = ngmix_cat_file.get_data()["mcal_flags"]
Expand All @@ -384,6 +389,7 @@ def _save_ngmix_data(self, ngmix_cat_path, moments=False):

self._add2dict("NGMIX_N_EPOCH", np.zeros(n_obj))
self._add2dict("NGMIX_MCAL_TYPES_FAIL", np.zeros(n_obj))
self._add2dict("NGMIX_NEIGHBOUR_FLAG", np.zeros(n_obj))

prefix = f"NGMIX{m}"

Expand Down Expand Up @@ -535,6 +541,11 @@ def _save_ngmix_data(self, ngmix_cat_path, moments=False):
ngmix_mcal_types_fail[ind[0]],
idx,
)
self._add2dict(
"NGMIX_NEIGHBOUR_FLAG",
ngmix_neighbour_flag[ind[0]],
idx,
)

ngmix_cat_file.close()

Expand Down
Loading