Skip to content

Commit

Permalink
JP-3790: MIRI MRS models to hold residual fringe correction (#377)
Browse files Browse the repository at this point in the history
Co-authored-by: jemorrison <[email protected]>
  • Loading branch information
melanieclarke and jemorrison authored Jan 16, 2025
1 parent 1a05ad2 commit 7798b8a
Show file tree
Hide file tree
Showing 9 changed files with 302 additions and 177 deletions.
1 change: 1 addition & 0 deletions changes/377.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add new spectral models for MIRI MRS data, including new table columns for residual fringe corrected flux, surface brightness, and background.
8 changes: 4 additions & 4 deletions src/stdatamodels/jwst/datamodels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from .multiexposure import MultiExposureModel
from .multiextract1d import MultiExtract1dImageModel
from .multislit import MultiSlitModel
from .multispec import MultiSpecModel
from .multispec import MultiSpecModel, MRSMultiSpecModel
from .nirspec_flat import NirspecFlatModel, NirspecQuadFlatModel
from .nrm import NRMModel
from .outlierpars import OutlierParsModel
Expand Down Expand Up @@ -69,7 +69,7 @@
from .pastasossmodel import PastasossModel
from .sossextractmodel import SossExtractModel
from .sosswavegrid import SossWaveGridModel
from .spec import SpecModel
from .spec import SpecModel, MRSSpecModel
from .speckernel import SpecKernelModel
from .specprofile import SpecProfileModel, SpecProfileSingleModel
from .specpsf import SpecPsfModel
Expand Down Expand Up @@ -123,7 +123,7 @@
'LinearityModel', 'MaskModel', 'MSAModel',
'MultiCombinedSpecModel', 'MultiExposureModel',
'MultiExtract1dImageModel', 'MultiSlitModel',
'MultiSpecModel',
'MultiSpecModel', 'MRSMultiSpecModel',
'NIRCAMGrismModel', 'NIRISSGrismModel',
'OTEModel',
'OutlierParsModel','OutlierIFUOutputModel',
Expand All @@ -142,7 +142,7 @@
'ReferenceFileModel', 'ReferenceCubeModel', 'ReferenceImageModel', 'ReferenceQuadModel',
'RegionsModel', 'ResetModel',
'ResolutionModel', 'MiriResolutionModel',
'RSCDModel', 'SaturationModel', 'SIRSKernelModel', 'SlitDataModel', 'SlitModel', 'SpecModel',
'RSCDModel', 'SaturationModel', 'SIRSKernelModel', 'SlitDataModel', 'SlitModel', 'SpecModel','MRSSpecModel',
'SegmentationMapModel',
'SossExtractModel',
'SossWaveGridModel',
Expand Down
26 changes: 24 additions & 2 deletions src/stdatamodels/jwst/datamodels/multispec.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from .model_base import JwstDataModel
from .spec import SpecModel
from .spec import SpecModel, MRSSpecModel


__all__ = ['MultiSpecModel']
__all__ = ['MultiSpecModel', 'MRSMultiSpecModel']


class MultiSpecModel(JwstDataModel):
Expand Down Expand Up @@ -57,3 +57,25 @@ def __init__(self, init=None, **kwargs):
return

super(MultiSpecModel, self).__init__(init=init, **kwargs)


class MRSMultiSpecModel(JwstDataModel):
"""
A data model for MIRI MRS multi-spec images.
This model has a special member `spec` that can be used to
deal with an entire spectrum at a time. It behaves identically
to `MultiSpecModel`, except that the spectra have additional columns
for the MIRI MRS mode, containing residual fringe corrected values.
"""
schema_url = "http://stsci.edu/schemas/jwst_datamodel/mrs_multispec.schema"

def __init__(self, init=None, **kwargs):

if isinstance(init, MRSSpecModel):
super(MRSMultiSpecModel, self).__init__(init=None, **kwargs)
self.spec.append(self.spec.item())
self.spec[0].spec_table = init.spec_table
return

super(MRSMultiSpecModel, self).__init__(init=init, **kwargs)
19 changes: 19 additions & 0 deletions src/stdatamodels/jwst/datamodels/schemas/mrs_multispec.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/fits-schema/fits-schema"
id: "http://stsci.edu/schemas/jwst_datamodel/mrs_multispec.schema"
allOf:
- $ref: core.schema
- $ref: int_times.schema
- type: object
properties:
spec:
type: array
title: An array of spectra
items:
allOf:
- type: object
properties:
spec_table:
$ref: mrs_spectable.schema
- $ref: specmeta.schema
11 changes: 11 additions & 0 deletions src/stdatamodels/jwst/datamodels/schemas/mrs_spec.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/fits-schema/fits-schema"
id: "http://stsci.edu/schemas/jwst_datamodel/mrs_spec.schema"
title: Spectrum data model with residual fringe correction for MIRI MRS
allOf:
- $ref: core.schema
- type: object
properties:
spec_table:
$ref: mrs_spectable.schema
49 changes: 49 additions & 0 deletions src/stdatamodels/jwst/datamodels/schemas/mrs_spectable.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/fits-schema/fits-schema"
id: "http://stsci.edu/schemas/jwst_datamodel/mrs_spectable.schema"
title: Extracted spectral data table with residual fringe correction for MIRI MRS
fits_hdu: EXTRACT1D
datatype:
- name: WAVELENGTH
datatype: float64
- name: FLUX
datatype: float64
- name: FLUX_ERROR
datatype: float64
- name: FLUX_VAR_POISSON
datatype: float64
- name: FLUX_VAR_RNOISE
datatype: float64
- name: FLUX_VAR_FLAT
datatype: float64
- name: SURF_BRIGHT
datatype: float64
- name: SB_ERROR
datatype: float64
- name: SB_VAR_POISSON
datatype: float64
- name: SB_VAR_RNOISE
datatype: float64
- name: SB_VAR_FLAT
datatype: float64
- name: DQ
datatype: uint32
- name: BACKGROUND
datatype: float64
- name: BKGD_ERROR
datatype: float64
- name: BKGD_VAR_POISSON
datatype: float64
- name: BKGD_VAR_RNOISE
datatype: float64
- name: BKGD_VAR_FLAT
datatype: float64
- name: NPIXELS
datatype: float64
- name: RF_FLUX
datatype: float64
- name: RF_SURF_BRIGHT
datatype: float64
- name: RF_BACKGROUND
datatype: float64
175 changes: 6 additions & 169 deletions src/stdatamodels/jwst/datamodels/schemas/multispec.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,172 +11,9 @@ allOf:
type: array
title: An array of spectra
items:
type: object
properties:
spec_table:
$ref: spectable.schema
name:
title: Slit name
type: string
fits_keyword: SLTNAME
fits_hdu: EXTRACT1D
slitlet_id:
title: Slitlet ID
type: integer
default: 0
fits_keyword: SLITID
fits_hdu: EXTRACT1D
source_id:
title: Source ID number
type: integer
default: 0
fits_keyword: SOURCEID
fits_hdu: EXTRACT1D
source_name:
title: Source name
type: string
fits_keyword: SRCNAME
fits_hdu: EXTRACT1D
source_alias:
title: Source alias
type: string
fits_keyword: SRCALIAS
fits_hdu: EXTRACT1D
stellarity:
title: Source stellarity
type: number
fits_keyword: STLARITY
fits_hdu: EXTRACT1D
source_type:
title: Source type used for calibration
type: string
fits_keyword: SRCTYPE
fits_hdu: EXTRACT1D
source_xpos:
title: Source position in slit (x-axis)
type: number
default: 0.0
fits_keyword: SRCXPOS
fits_hdu: EXTRACT1D
source_ypos:
title: Source position in slit (y-axis)
type: number
default: 0.0
fits_keyword: SRCYPOS
fits_hdu: EXTRACT1D
source_ra:
title: Right Ascension of the source
type: number
fits_keyword: SRCRA
fits_hdu: EXTRACT1D
source_dec:
title: Declination of the source
type: number
fits_keyword: SRCDEC
fits_hdu: EXTRACT1D
extraction_x:
title: X center of extraction region
type: number
fits_keyword: EXTR_X
fits_hdu: EXTRACT1D
extraction_y:
title: Y center of extraction region
type: number
fits_keyword: EXTR_Y
fits_hdu: EXTRACT1D
extraction_xstart:
title: X axis start of extraction region
type: number
fits_keyword: EXTRXSTR
fits_hdu: EXTRACT1D
extraction_xstop:
title: X axis end of extraction region
type: number
fits_keyword: EXTRXSTP
fits_hdu: EXTRACT1D
extraction_ystart:
title: Y axis start of extraction region
type: number
fits_keyword: EXTRYSTR
fits_hdu: EXTRACT1D
extraction_ystop:
title: Y axis end of extraction region
type: number
fits_keyword: EXTRYSTP
fits_hdu: EXTRACT1D
shutter_state:
title: All (open and close) shutters in a slit
type: string
default: ""
fits_keyword: SHUTSTA
fits_hdu: EXTRACT1D
slit_ra:
title: "[deg] Right Ascension at middle of slit"
type: number
default: 0.0
fits_keyword: SLIT_RA
fits_hdu: EXTRACT1D
slit_dec:
title: "[deg] Declination at middle of slit"
type: number
default: 0.0
fits_keyword: SLIT_DEC
fits_hdu: EXTRACT1D
spectral_order:
title: Spectral order number
type: integer
default: 1
fits_keyword: SPORDER
fits_hdu: EXTRACT1D
dispersion_direction:
title: Dispersion direction
type: integer
fits_keyword: DISPAXIS
fits_hdu: EXTRACT1D
int_num:
title: Integration number
type: integer
fits_keyword: INT_NUM
fits_hdu: EXTRACT1D
time_sys:
title: "principal time system for time-related keywords"
type: string
default: "UTC"
fits_keyword: TIMESYS
fits_hdu: EXTRACT1D
time_unit:
title: Default unit applicable to all time values
type: string
default: 's'
fits_keyword: TIMEUNIT
fits_hdu: EXTRACT1D
start_time_mjd:
title: "[d] integration start time in MJD"
type: number
fits_keyword: MJD-BEG
fits_hdu: EXTRACT1D
mid_time_mjd:
title: "[d] integration mid-point in MJD"
type: number
fits_keyword: MJD-AVG
fits_hdu: EXTRACT1D
end_time_mjd:
title: "[d] integration end time in MJD"
type: number
fits_keyword: MJD-END
fits_hdu: EXTRACT1D
start_tdb:
title: "TDB at start of integration [MJD]"
type: number
fits_keyword: TDB-BEG
fits_hdu: EXTRACT1D
mid_tdb:
title: "TDB at middle of integration [MJD]"
type: number
fits_keyword: TDB-MID
fits_hdu: EXTRACT1D
end_tdb:
title: "TDB at end of integration [MJD]"
type: number
fits_keyword: TDB-END
fits_hdu: EXTRACT1D
allOf:
- type: object
properties:
spec_table:
$ref: spectable.schema
- $ref: specmeta.schema
Loading

0 comments on commit 7798b8a

Please sign in to comment.