spacetelescope / jwst

Python library for science observations from the James Webb Space Telescope
https://jwst-pipeline.readthedocs.io/en/latest/
Other
569 stars 167 forks source link

Pixel area map reference file not loaded properly #4243

Closed jotaylor closed 4 years ago

jotaylor commented 5 years ago

In 0be3208811c75d80fbcae32f4655ebd095a5a418 photom.py was updated to load the pixel area map using a generic datamodels.open instead of datamodels.PixelAreaModel (see here). However, I'm having issues loading the pixel area map using the new method, receiving the following warning during Image2:

stpipe.Image2Pipeline.photom - WARNING - The PIXAR_SR keyword is missing from /grp/crds/test_cache/references/jwst/jwst_niriss_area_0011.fits
stpipe.Image2Pipeline.photom - WARNING - The PIXAR_A2 keyword is missing from /grp/crds/test_cache/references/jwst/jwst_niriss_area_0011.fits
stpipe.Image2Pipeline.photom - DEBUG - PIXAR_SR = None, PIXAR_A2 = None

The PIXAR_SR and PIXAR_A2 keywords are in both the 0th and SCI extensions of the referenced pixel area map.

As a result, there is no meta.photometry info in the opened datamodel because it opens the pixel area map as a generic ReferenceImageModel. Consequently, in Image3.source_catalog objects are assigned NaN ABmag, which causes the pipeline to crash in Spec2.extract_2d because there are no valid targets:

stpipe.Spec2Pipeline.extract_2d - INFO - Grism object list created from source catalog:

The full traceback is attached if needed: pipeline.log

Luckily it's an easy fix for my purposes (testing the new photom files)- the pixel area map just needs to be opened using the explicit datamodel.

Also, seems like this issue will become obsolete when issue #3837 is addressed.

philhodge commented 5 years ago

The reference file jwst_niriss_area_0011.fits is missing the DATAMODL keyword. This is a required keyword.

jotaylor commented 5 years ago

That'll do it! Thanks Phil. An even easier fix that doesn't involve the pipeline then :) I'm heading out for the weekend but I'll try fixing the reference file next week.

hbushouse commented 4 years ago

@jotaylor What's the status of the reference file fix? Even if that work hasn't been done yet, are you OK with us closing this PR, because we assume the code change will not be needed after all?

jotaylor commented 4 years ago

Sorry, was out of town. I'm delivering new reference files with the required DATAMODL keywords so this should become a non-issue soon.

hbushouse commented 4 years ago

OK, given that the code change isn't needed, I'm going to close this issue and PR #4244