spacetelescope / jwst

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

Update BUNIT in all output products #63

Closed hbushouse closed 6 years ago

hbushouse commented 8 years ago

SDP is including the keyword BUNIT in the SCI extension header of the level-1b products that serve as input to the cal pipeline. They have its value set to 'DN' in the level-1b products. We don't currently have BUNIT in our datamodels schema and hence that keyword simply gets passed along untouched (presumably via the extra_fits attribute of our data models) to all the output files created by the cal pipeline. But the value of 'DN' is no longer correct for those output products and can be misleading. So we need to add that keyword to our core schema and make sure it gets updated when necessary.

Normally this would be an easy thing to implement, but given that the keyword resides in the SCI extension header, rather than the primary header, I'm not exactly sure how we can implement or specify it in our core schema. Is there a way to designate the fits_hdu to which a given keyword belongs?

bernie-simon commented 8 years ago

On Jun 14, 2016, at 1:47 PM, Howard Bushouse notifications@github.com wrote:

Is there a way to designate the fits_hdu to which a given keyword belongs?

Yes, you just add a fits_hdu tag to the schema, as in this example from multislit.schema.yaml:

      source_id:
        title: Source ID
        type: integer
        default: 0
        fits_keyword: SOURCEID
        fits_hdu: SCI
hbushouse commented 7 years ago

1389 includes updates to ramp_fit to set BUNIT to 'DN/s' in _rate and _rateints products. Products stay in those units until they are converted to calibrated fluxes. This happens, if at all, in different places for different modes of data.

Images: Currently not converted to calibrated fluxes, so all we need to do is verify that BUNIT='DN/s' is being carried along to all subsequent data products, like the _cal and _calints products coming out of calwebb_image2 and the _i2d products coming out of the resample step.

Spectra - IFU: They get converted to calibrated fluxes by the photom step in calwebb_spec2, which does update BUNIT appropriately in the _cal products. The cube_build step appears to be propagating these values to the _s3d products, so this mode appears to be complete.

Spectra - non-IFU: It appears that the resample_spec step is NOT propagating the BUNIT keyword at all to _s2d products, so this needs to be fixed. These data get converted to flux calibrated units during the extract_1d step, so that step should be setting appropriate units for each column of the MultiSpecModel (_x1d) product tables that it creates.

hbushouse commented 6 years ago

Fixed by #1633.