diff --git a/changes/321.feature.rst b/changes/321.feature.rst new file mode 100644 index 00000000..273889fb --- /dev/null +++ b/changes/321.feature.rst @@ -0,0 +1 @@ +Adding datamodel schema for jwst refpix convolution kernel. diff --git a/src/stdatamodels/jwst/datamodels/__init__.py b/src/stdatamodels/jwst/datamodels/__init__.py index 611cf80c..983b61ec 100644 --- a/src/stdatamodels/jwst/datamodels/__init__.py +++ b/src/stdatamodels/jwst/datamodels/__init__.py @@ -64,6 +64,7 @@ from .rscd import RSCDModel from .saturation import SaturationModel from .segmap import SegmentationMapModel +from .sirs_kernel import SIRSKernelModel from .slit import SlitModel, SlitDataModel from .pastasossmodel import PastasossModel from .sossextractmodel import SossExtractModel @@ -140,7 +141,7 @@ 'ReferenceFileModel', 'ReferenceCubeModel', 'ReferenceImageModel', 'ReferenceQuadModel', 'RegionsModel', 'ResetModel', 'ResolutionModel', 'MiriResolutionModel', - 'RSCDModel', 'SaturationModel', 'SlitDataModel', 'SlitModel', 'SpecModel', + 'RSCDModel', 'SaturationModel', 'SIRSKernelModel', 'SlitDataModel', 'SlitModel', 'SpecModel', 'SegmentationMapModel', 'SossExtractModel', 'SossWaveGridModel', diff --git a/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml b/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml index 0ffe7898..64a19c37 100644 --- a/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml +++ b/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml @@ -1790,6 +1790,15 @@ properties: type: string fits_keyword: R_COLLIM blend_table: True + sirskernel: + title: NIR Optimized Convolution Kernel reference file information + type: object + properties: + name: + title: NIR Simple Improved Reference Subtraction + type: string + fits_keyword: R_SIRSKL + blend_table: True cubepar: title: IFU cube reference file information type: object diff --git a/src/stdatamodels/jwst/datamodels/schemas/sirs_kernel.schema.yaml b/src/stdatamodels/jwst/datamodels/schemas/sirs_kernel.schema.yaml new file mode 100644 index 00000000..b6c1c008 --- /dev/null +++ b/src/stdatamodels/jwst/datamodels/schemas/sirs_kernel.schema.yaml @@ -0,0 +1,16 @@ +%YAML 1.1 +--- +$schema: "http://stsci.edu/schemas/asdf/asdf-schema-1.0.0" +id: "http://stsci.edu/schemas/jwst_datamodel/sirs_kernel.schema" +allOf: +- $ref: referencefile.schema +- type: object + patternProperties: + "^(nrca1|nrca2|nrca3|nrca4|nrcalong|nrcb1|nrcb2|nrcb3|nrcb4|nrcblong|nrs1|nrs2|mirimage|mirifulong|mirifushort|nis)$": + type: object + properties: + gamma: + datatype: float64 + zeta: + datatype: float64 + required: [gamma, zeta] diff --git a/src/stdatamodels/jwst/datamodels/sirs_kernel.py b/src/stdatamodels/jwst/datamodels/sirs_kernel.py new file mode 100644 index 00000000..768180cc --- /dev/null +++ b/src/stdatamodels/jwst/datamodels/sirs_kernel.py @@ -0,0 +1,32 @@ +from .reference import ReferenceFileModel + + +__all__ = ['SIRSKernelModel'] + + +class SIRSKernelModel(ReferenceFileModel): + """ + A data model for the NIR Optimized Convolution Kernel Fourier Coefficients, + also called Simple Improved Reference Subtraction (SIRS). + + Parameters + __________ + data : numpy table + The reference waves to correct for 1/f at the REFPIX step for NIR data. + A table-like object containing the Fourier Coefficients for the + optimized convolution kernel. The format is the same for all NIR files + - Detector name: str + - gamma: float32 1D array + - zeta: float32 1D array + """ + schema_url = "http://stsci.edu/schemas/jwst_datamodel/sirs_kernel.schema" + reftype = "sirskernel" + + def __init__(self, init=None, **kwargs): + super(SIRSKernelModel, self).__init__(init=init, **kwargs) + + def on_save(self, path=None): + self.meta.reftype = self.reftype + + def validate(self): + super(SIRSKernelModel, self).validate()