Skip to content

Commit

Permalink
JP-2066: Add srctype to Combine1D headers (#6079)
Browse files Browse the repository at this point in the history
* start adding source_type

* push source_type to c1d

* [skip ci] changelog
  • Loading branch information
tapastro authored May 27, 2021
1 parent 20d5bbb commit b77df8a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
1.2.1 (unreleased)
==================

combine_1d
----------

- Added SRCTYPE to COMBINE1D output extension headers, propagated from
EXTRACT1D inputs [#6079]

general
-------

Expand Down
3 changes: 3 additions & 0 deletions jwst/combine_1d/combine1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class InputSpectrumModel:
right_ascension
declination
source_id
source_type
"""

def __init__(self, ms, spec, exptime_key):
Expand Down Expand Up @@ -65,6 +66,7 @@ def __init__(self, ms, spec, exptime_key):
self.right_ascension = np.zeros_like(self.wavelength)
self.declination = np.zeros_like(self.wavelength)
self.source_id = spec.source_id
self.source_type = spec.source_type

self.weight = np.ones_like(self.wavelength)
if exptime_key == "integration_time":
Expand Down Expand Up @@ -580,6 +582,7 @@ def combine_1d_spectra(input_model, exptime_key):
output_order = output_spectra[order].create_output_data()
output_order.spectral_order = order
output_order.source_id = input_spectra[order][0].source_id
output_order.source_type = input_spectra[order][0].source_type
output_model.spec.append(output_order)

# Copy one of the input headers to output.
Expand Down
6 changes: 6 additions & 0 deletions jwst/datamodels/schemas/combinedspec.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ allOf:
type: integer
fits_keyword: SOURCEID
fits_hdu: COMBINE1D
source_type:
title: Source type used for calibration
type: string
enum: [EXTENDED, POINT, UNKNOWN]
fits_keyword: SRCTYPE
fits_hdu: COMBINE1D
6 changes: 6 additions & 0 deletions jwst/datamodels/schemas/multicombinedspec.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ allOf:
type: integer
fits_keyword: SOURCEID
fits_hdu: COMBINE1D
source_type:
title: Source type used for calibration
type: string
enum: [EXTENDED, POINT, UNKNOWN]
fits_keyword: SRCTYPE
fits_hdu: COMBINE1D

0 comments on commit b77df8a

Please sign in to comment.