Skip to content

Commit

Permalink
Fixes to actually call flagging sources that fall off the edge
Browse files Browse the repository at this point in the history
  • Loading branch information
cmccully committed Oct 30, 2023
1 parent a5d24ba commit 18fef45
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions banzai/photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def flag_edge_sources(image, sources, flag_value=8):
sources_off = np.logical_or(sources_off, major_xmax > nx)
sources_off = np.logical_or(sources_off, minor_ymax > ny)
sources_off = np.logical_or(sources_off, major_ymax > ny)
sources[sources_off] |= flag_value
sources[sources_off]['flag'] |= flag_value


class SourceDetector(Stage):
Expand Down Expand Up @@ -107,7 +107,8 @@ def do_stage(self, image):
deblended_seg_map = deblend_sources(convolved_data, segmentation_map,
npixels=self.min_area, nlevels=32,
contrast=0.005, progress_bar=False,
nproc=1)
nproc=1, mode='sinh')
logger.info('Finished deblending. Estimat', image=image)
# Convert the segmentation map to a source catalog
catalog = SourceCatalog(data, deblended_seg_map, convolved_data=convolved_data, error=error,
background=bkg.background)
Expand Down Expand Up @@ -140,6 +141,7 @@ def do_stage(self, image):
# Flag = 4 for sources that have saturated pixels
flag_sources(sources, catalog.labels, deblended_seg_map, image.mask, flag=4, mask_value=2)
# Flag = 8 if kron aperture falls off the image
flag_edge_sources(image, sources, flag_pixel=8)
# Flag = 16 if source has cosmic ray pixels
flag_sources(sources, catalog.labels, deblended_seg_map, image.mask, flag=16, mask_value=8)

Expand Down

0 comments on commit 18fef45

Please sign in to comment.