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..9afa85b4 100644 --- a/src/stdatamodels/jwst/datamodels/__init__.py +++ b/src/stdatamodels/jwst/datamodels/__init__.py @@ -12,6 +12,7 @@ from .barshadow import BarshadowModel from .combinedspec import CombinedSpecModel from .contrast import ContrastModel +from .conv_kernel import ConvKernelModel from .cube import CubeModel from .dark import DarkModel from .darkMIRI import DarkMIRIModel @@ -102,7 +103,7 @@ 'NrsMosApcorrModel', 'NrsFsApcorrModel', 'NrsIfuApcorrModel', 'AsnModel', 'BarshadowModel', 'CameraModel', 'CollimatorModel', - 'CombinedSpecModel', 'ContrastModel', 'CubeModel', + 'CombinedSpecModel', 'ContrastModel', 'ConvKernelModel','CubeModel', 'DarkModel', 'DarkMIRIModel', 'DisperserModel', 'DistortionModel', 'DistortionMRSModel', 'EmiModel', diff --git a/src/stdatamodels/jwst/datamodels/conv_kernel.py b/src/stdatamodels/jwst/datamodels/conv_kernel.py new file mode 100644 index 00000000..8dc461e4 --- /dev/null +++ b/src/stdatamodels/jwst/datamodels/conv_kernel.py @@ -0,0 +1,31 @@ +from .reference import ReferenceFileModel + + +__all__ = ['ConvKernelModel'] + + +class ConvKernelModel(ReferenceFileModel): + """ + A data model for the NIR Optimized Convolution Kernel Fourier Coefficients. + + 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/conv_kernel.schema" + reftype = "conv_kernel" + + def __init__(self, init=None, **kwargs): + super(ConvKernelModel, self).__init__(init=init, **kwargs) + + def on_save(self, path=None): + self.meta.reftype = self.reftype + + def validate(self): + super(ConvKernelModel, self).validate() diff --git a/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml b/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml new file mode 100644 index 00000000..1bba6621 --- /dev/null +++ b/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.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/conv_kernel.schema" +allOf: +- $ref: referencefile.schema +- type: object + properties: + data: + title: NIR Optimized Convolution Kernel Fourier Coefficients + type: object + properties: + meta: + type: object + frequencies: + type: object + description: | + Detector name, gamma, and zeta values + subarray_cases: + type: object + description: | + Fourier Coefficients for NIR Optimized Convolution Kernel diff --git a/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml b/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml index 86603e09..d15dafdf 100644 --- a/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml +++ b/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml @@ -1785,6 +1785,15 @@ properties: type: string fits_keyword: R_COLLIM blend_table: True + conv_kernel: + title: NIR Optimized Convolution Kernel reference file information + type: object + properties: + name: + title: NIR Optimized Convolution Kernel reference file name + type: string + fits_keyword: R_CONVKL + blend_table: True cubepar: title: IFU cube reference file information type: object