Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cshanahan1 committed Mar 21, 2023
1 parent 8045c07 commit 569355a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
16 changes: 9 additions & 7 deletions docs/roman/source_detection/arguments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@ The source detection fitting step has several arguments. These can be specified
by the user by passing them to the step in a Python session, or setting them
in a parameter file.

* ``--coverage_mask``: True/False to mask pixels with DO_NOT_USE flags in their
dq array. Default is True.
* ``--kernel_fwhm``: A parameter for DAOStarFinder: size of Gaussian kernel in
pixels. Default is 2.0.
* ``--sharplo``: A parameter for DAOStarFinder: lower bound for sharpness.
Default is 0.0.
* ``--sharphi``: A parameter for DAOStarFinder: upper bound for sharpness.
Default is 1.0.
* ``--roundlo``: A parameter for DAOStarFinder: lower bound for roundness.
Default is -1.0.
Default is -1.0. A circular source will have a zero roundness.
A source extended in x or y will have a negative or positive
roundness, respectively.
* ``--roundhi``: A parameter for DAOStarFinder: upper bound for roundness.
Default is 1.0.
Default is 1.0. A circular source will have a zero roundness.
A source extended in x or y will have a negative or positive
roundness, respectively.
* ``--peakmax``: A parameter for DAOStarFinder: upper limit on brightest pixel
in sources. Default is 1000.0.
* ``--max_sources``: The maximum number of sources in the output catalog,
choosing brightest. Default is None, which will return all
detected sources.
* ``--scalar_threshold``: If specified, a single scalar threshold to be used
for source detection with DAOStarFinder across the
entire image. One of `scalar_threshold`,
* ``--scalar_threshold``: If specified, the absolute detection threshold to be
used for the entire image. Units are assumed to be the
same as input data. One of `scalar_threshold`,
`calc_scalar_threshold` must be chosen. Default is
None.
* ``--calc_scalar_threshold``: If specified, a single scalar threshold will be
Expand Down
7 changes: 0 additions & 7 deletions docs/roman/source_detection/description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ threshold value for the entire image based on the sigma-clipped average
Other Options
=============

Masking DO_NOT_USE pixels
-------------------------

By default, sources that fall on pixels with DO_NOT_USE in their DQ array
will be excluded from the final output catalog. This can be controlled with
the `coverage_mask` parameter.

Limiting maximum number of sources
----------------------------------

Expand Down
19 changes: 10 additions & 9 deletions romancal/source_detection/source_detection_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ class SourceDetectionStep(RomanStep):
"""

spec = """
coverage_mask = boolean(default=True) # Mask DO_NOT_USE pixels in image?
kernel_fwhm = float(default=2.) # DAOStarFinder:Size of Gaussian kernel,
# in pixels.
sharplo = float(default=0.) # DAOStarFinder: Lower bound for sharpness.
sharphi = float(default=1.0) # DAOStarFinder: Upper bound for sharpness.
roundlo = float(default=-1.0) # DAOStarFinder: Lower bound for roundness.
# A circular source will have a zero roundness. A source extended in x or
# y will have a negative or positive roundness, respectively.
roundhi = float(default=1.0) # DAOStarFinder: Upper bound for roundness.
peakmax = float(default=1000.0) # Upper limit on brightest pixel in sources.
max_sources = float(default=None) # Max number of sources, choosing brightest.
Expand Down Expand Up @@ -75,13 +76,12 @@ def process(self, input):
else:
self.data = input_model.data

# mask DO_NOT_USE pixels?
if self.coverage_mask:
self.coverage_mask = (
(dqflags.pixel["DO_NOT_USE"]) & input_model.dq
).astype(bool)
else:
self.coverage_mask = None
# mask DO_NOT_USE pixels

self.coverage_mask = (
(dqflags.pixel["DO_NOT_USE"]) & input_model.dq
).astype(bool)


# if a pre-determined threshold value for detection for the whole
# image is provided, use this
Expand Down Expand Up @@ -118,7 +118,8 @@ def process(self, input):

elif self.calc_threshold is not None:
# subtrack background from data if calculating abs. threshold
sources = daofind(self.data - bkg.background, mask=self.coverage_mask)
sources = daofind(self.data - bkg.background,
mask=self.coverage_mask)

# reduce table to minimal number of columns, just source ID,
# positions, and fluxes
Expand Down

0 comments on commit 569355a

Please sign in to comment.