From 11804731b897d8e8be117c8d502c245507d701da Mon Sep 17 00:00:00 2001 From: Maria Date: Wed, 6 Dec 2023 20:40:02 -0500 Subject: [PATCH] JP-3248: Add ref file data model and step keywords for new MIRI EMI correction (#200) --- .gitignore | 1 + CHANGES.rst | 4 +++ src/stdatamodels/jwst/datamodels/__init__.py | 2 ++ src/stdatamodels/jwst/datamodels/emi.py | 35 +++++++++++++++++++ .../jwst/datamodels/schemas/core.schema.yaml | 14 ++++++++ .../jwst/datamodels/schemas/emi.schema.yaml | 22 ++++++++++++ 6 files changed, 78 insertions(+) create mode 100644 src/stdatamodels/jwst/datamodels/emi.py create mode 100644 src/stdatamodels/jwst/datamodels/schemas/emi.schema.yaml diff --git a/.gitignore b/.gitignore index 3d30cbe4..6f0cecb5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ __pycache__/ *.py[cod] *$py.class +*.DS_Store # C extensions *.so diff --git a/CHANGES.rst b/CHANGES.rst index 9c5c6f3d..907b6cdf 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -18,6 +18,10 @@ Other - Updated JWST core datamodel schema to include the new step status keyword "S_NSCLEN" for the new "nsclean" calibration step. [#237] +- Adding emicorr datamodel and schema, as well as + corresponding completion and reference file keywords [#200] + + 1.8.4 (2023-12-04) ================== diff --git a/src/stdatamodels/jwst/datamodels/__init__.py b/src/stdatamodels/jwst/datamodels/__init__.py index def385a1..1b9819ed 100644 --- a/src/stdatamodels/jwst/datamodels/__init__.py +++ b/src/stdatamodels/jwst/datamodels/__init__.py @@ -17,6 +17,7 @@ from .darkMIRI import DarkMIRIModel from .drizpars import DrizParsModel from .drizproduct import DrizProductModel +from .emi import EmiModel from .extract1dimage import Extract1dImageModel from .extract1d_spec import Extract1dIFUModel from .flat import FlatModel @@ -107,6 +108,7 @@ 'DisperserModel', 'DistortionModel', 'DistortionMRSModel', 'DrizParsModel', 'DrizProductModel', + 'EmiModel', 'Extract1dImageModel', 'Extract1dIFUModel', 'FilteroffsetModel', diff --git a/src/stdatamodels/jwst/datamodels/emi.py b/src/stdatamodels/jwst/datamodels/emi.py new file mode 100644 index 00000000..216cc04c --- /dev/null +++ b/src/stdatamodels/jwst/datamodels/emi.py @@ -0,0 +1,35 @@ +from .reference import ReferenceFileModel + + +__all__ = ['EmiModel'] + + +class EmiModel(ReferenceFileModel): + """ + A data model to correct MIRI images for EMI contamination. + + Parameters + __________ + data : numpy table + The reference waves to correct for MIRI EMI. + A table-like object containing phase amplitude values + corresponding to the appropriate frequency + - Hz390: float32 1D array + - Hz218a: float32 1D array + - Hz218b: float32 1D array + - Hz218c: float32 1D array + - Hz164: float32 1D array + - Hz10: float32 1D array + """ + schema_url = "http://stsci.edu/schemas/jwst_datamodel/emi.schema" + reftype = "emicorr" + + def __init__(self, init=None, **kwargs): + super(EmiModel, self).__init__(init=init, **kwargs) + + def on_save(self, path=None): + self.meta.reftype = self.reftype + self.meta.instrument.name = "MIRI" + + def validate(self): + super(EmiModel, self).validate() diff --git a/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml b/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml index d0ae8062..4a6eb305 100644 --- a/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml +++ b/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml @@ -1824,6 +1824,15 @@ properties: type: string fits_keyword: R_DRZPAR blend_table: True + emicorr: + title: MIRI EMI reference file information + type: object + properties: + name: + title: MIRI EMI correction reference file name + type: string + fits_keyword: R_MIREMI + blend_table: True extract1d: title: 1-D extraction parameters reference file information type: object @@ -2325,6 +2334,11 @@ properties: type: string fits_keyword: S_DQINIT blend_table: True + emicorr: + title: MIRI EMI Correction + type: string + fits_keyword: S_MIREMI + blend_table: True emission: title: Telescope Emission Correction type: string diff --git a/src/stdatamodels/jwst/datamodels/schemas/emi.schema.yaml b/src/stdatamodels/jwst/datamodels/schemas/emi.schema.yaml new file mode 100644 index 00000000..7f7588cc --- /dev/null +++ b/src/stdatamodels/jwst/datamodels/schemas/emi.schema.yaml @@ -0,0 +1,22 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/asdf/asdf-schema-1.0.0" +id: "http://stsci.edu/schemas/jwst_datamodel/emi.schema" +allOf: +- $ref: referencefile.schema +- type: object + properties: + data: + title: MIRI Reference Waves Table for EMI correction + type: object + properties: + meta: + type: object + frequencies: + type: object + description: | + Frequency names, values, and phase amplitude values + subarray_cases: + type: object + description: | + Frequencies to correct for according to subarray