8000 JP-1454: Exit gracefully if APCORR data is missing by larrybradley · Pull Request #4948 · spacetelescope/jwst · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

JP-1454: Exit gracefully if APCORR data is missing #4948

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

Merged
merged 2 commits into from
May 14, 2020
Merged
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
5 changes: 5 additions & 0 deletions jwst/source_catalog/source_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ def _aperture_ee_table(self):
for key, value in selector.items()]
ee_table = apcorr[np.logical_and.reduce(mask_idx)]

if len(ee_table) == 0:
raise RuntimeError('APCORR reference file data is missing for '
f'{selector}.')
return

return ee_table

def _get_ee_table_row(self, aperture_ee):
Expand Down
17 changes: 12 additions & 5 deletions jwst/source_catalog/source_catalog_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,16 @@ def process(self, input_model):

aperture_ee = (self.aperture_ee1, self.aperture_ee2,
self.aperture_ee3)
refdata = ReferenceData(model, aperture_ee=aperture_ee,
apcorr_filename=apcorr_fn,
abvegaoffset_filename=abvegaoffset_fn)
try:
refdata = ReferenceData(model, aperture_ee=aperture_ee,
apcorr_filename=apcorr_fn,
abvegaoffset_filename=abvegaoffset_fn)
aperture_params = refdata.aperture_params
abvega_offset = refdata.abvega_offset
except RuntimeError as err:
msg = f'{err} Source catalog will not be created.'
self.log.warn(msg)
return

coverage_mask = (model.wht == 0)
if coverage_mask.all():
Expand Down Expand Up @@ -104,8 +111,8 @@ def process(self, input_model):
catobj = SourceCatalog(model, segment_img, error=total_error,
kernel=kernel,
kernel_fwhm=self.kernel_fwhm,
aperture_params=refdata.aperture_params,
abvega_offset=refdata.abvega_offset)
aperture_params=aperture_params,
abvega_offset=abvega_offset)
catalog = catobj.catalog

if self.save_results:
Expand Down
0