Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in OCRREJECT CR-growth parameter #163

Open
sean-lockwood opened this issue May 31, 2024 · 1 comment
Open

Bug in OCRREJECT CR-growth parameter #163

sean-lockwood opened this issue May 31, 2024 · 1 comment
Assignees
Labels

Comments

@sean-lockwood
Copy link
Member

sean-lockwood commented May 31, 2024

@stscirij -

Setting stistools.ocrreject.ocrreject() parameter crthresh to 0 does not force all surrounding pixels to be flagged within a radius defined by crradius, and instead does not grow the CR region at all.

From the docstring:

If crthresh = 0 then all adjacent pixels (see crradius) will be rejected.

Setting it to zero doesn't actually do this:

from stistools.ocrreject import ocrreject

filenames = ['oeki09cvq_flt.fits', 'oeki09cxq_flt.fits', 'oeki09czq_flt.fits',
             'oeki09d2q_flt.fits', 'oeki09d4q_flt.fits']

ocrreject(', '.join(filenames)),
          output='combined.fits',
          all=True,
          crthresh=0,
          crradius=3.,)
image

However, setting it to a slight negative value seems to do the trick.

ocrreject(', '.join(filenames)),
          output='combined.fits',
          all=True,
          crthresh=-0.001,
          crradius=3.,)
image

stistools calls cs2.e with the -thresh parameter set to the provided crthresh value.
This gets inserted into the par->psigma parameter in hstcal, and gets used here:
https://github.com/spacetelescope/hstcal/blob/main/pkg/stis/lib/cs2/crrej_loop.c#L92

@sean-lockwood
Copy link
Member Author

sean-lockwood commented May 31, 2024

Aha!

stistools doesn't set the flag because if 0 doesn't evaulate to True:

if crthresh:
    optional_args.append("-thresh")
    optional_args.append("%.10g" % crthresh)

We should change this to if crthresh is not None.

sean-lockwood added a commit that referenced this issue May 31, 2024
…'badinpdq' by testing for default against 'None'.
@sean-lockwood sean-lockwood self-assigned this May 31, 2024
sean-lockwood added a commit that referenced this issue Feb 25, 2025
…'badinpdq' by testing for default against 'None'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant