From d8593c1b591dbf54ab633a842ff4c9b0d4e8851c Mon Sep 17 00:00:00 2001 From: Maria Pena-Guerrero Date: Wed, 28 Aug 2024 09:47:34 -0400 Subject: [PATCH 1/7] initial changes for convolution kernel at refpix --- .../jwst/datamodels/conv_kernel.py | 31 +++++++++++++++++++ .../schemas/conv_kernel.schema.yaml | 22 +++++++++++++ .../jwst/datamodels/schemas/core.schema.yaml | 9 ++++++ 3 files changed, 62 insertions(+) create mode 100644 src/stdatamodels/jwst/datamodels/conv_kernel.py create mode 100644 src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml 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 08a7c72c..81d3167d 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 From 1eed54075299b0247b893d61a786d767d9f45bd7 Mon Sep 17 00:00:00 2001 From: Maria Pena-Guerrero Date: Thu, 29 Aug 2024 13:27:18 -0400 Subject: [PATCH 2/7] adding convolution kernel model to init --- src/stdatamodels/jwst/datamodels/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/stdatamodels/jwst/datamodels/__init__.py b/src/stdatamodels/jwst/datamodels/__init__.py index ac4b52d2..8af12073 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', 'DrizParsModel', From 1d3f3fed95614a25f605c77696c30b27e6067499 Mon Sep 17 00:00:00 2001 From: Maria Pena-Guerrero Date: Tue, 22 Oct 2024 11:59:36 -0400 Subject: [PATCH 3/7] adding pr number and changes --- changes/321.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/321.feature.rst 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. From 752344c32536e96d72de3a94ff33a508a7260311 Mon Sep 17 00:00:00 2001 From: Maria Date: Fri, 22 Nov 2024 12:52:22 -0500 Subject: [PATCH 4/7] Update src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml Co-authored-by: Brett Graham --- .../schemas/conv_kernel.schema.yaml | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml b/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml index 1bba6621..729b3bc8 100644 --- a/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml +++ b/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml @@ -5,18 +5,12 @@ 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 + patternProperties: + "nrc[ab][1-4]": 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 + gamma: + datatype: float64 + zeta: + datatype: float64 + required: [gamma, zeta] From 49c67bb3a8a9509cb2d05d3a70097e59b40a5ae6 Mon Sep 17 00:00:00 2001 From: Maria Date: Fri, 22 Nov 2024 16:09:03 -0500 Subject: [PATCH 5/7] Update src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml Co-authored-by: Brett Graham --- .../jwst/datamodels/schemas/conv_kernel.schema.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml b/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml index 729b3bc8..2cf567c5 100644 --- a/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml +++ b/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml @@ -6,7 +6,7 @@ allOf: - $ref: referencefile.schema - type: object patternProperties: - "nrc[ab][1-4]": + "^(nrca1|nrca2|nrca3|nrca4|nrcalong|nrcb1|nrcb2|nrcb3|nrcb4|nrcblong|nrs1|nrs2|mirimage|mirifulong|mirifushort|nis|guider1|guider2)$": type: object properties: gamma: From 636b2f33e4100b40d7a38b515405191011784272 Mon Sep 17 00:00:00 2001 From: Brett Graham Date: Tue, 26 Nov 2024 12:34:43 -0500 Subject: [PATCH 6/7] Update src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml --- src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml b/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml index d9d8e10e..beee6b6a 100644 --- a/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml +++ b/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml @@ -1790,7 +1790,7 @@ properties: type: string fits_keyword: R_COLLIM blend_table: True - conv_kernel: + sirskernel: title: NIR Optimized Convolution Kernel reference file information type: object properties: From b7e50f991f33077275b8f4d6ce5d08e8b014bf99 Mon Sep 17 00:00:00 2001 From: Maria Pena-Guerrero Date: Tue, 26 Nov 2024 18:52:27 -0500 Subject: [PATCH 7/7] addressing changes in PR --- src/stdatamodels/jwst/datamodels/__init__.py | 6 +++--- .../jwst/datamodels/schemas/core.schema.yaml | 4 ++-- ...kernel.schema.yaml => sirs_kernel.schema.yaml} | 4 ++-- .../datamodels/{conv_kernel.py => sirs_kernel.py} | 15 ++++++++------- 4 files changed, 15 insertions(+), 14 deletions(-) rename src/stdatamodels/jwst/datamodels/schemas/{conv_kernel.schema.yaml => sirs_kernel.schema.yaml} (72%) rename src/stdatamodels/jwst/datamodels/{conv_kernel.py => sirs_kernel.py} (65%) diff --git a/src/stdatamodels/jwst/datamodels/__init__.py b/src/stdatamodels/jwst/datamodels/__init__.py index 9afa85b4..983b61ec 100644 --- a/src/stdatamodels/jwst/datamodels/__init__.py +++ b/src/stdatamodels/jwst/datamodels/__init__.py @@ -12,7 +12,6 @@ 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 @@ -65,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 @@ -103,7 +103,7 @@ 'NrsMosApcorrModel', 'NrsFsApcorrModel', 'NrsIfuApcorrModel', 'AsnModel', 'BarshadowModel', 'CameraModel', 'CollimatorModel', - 'CombinedSpecModel', 'ContrastModel', 'ConvKernelModel','CubeModel', + 'CombinedSpecModel', 'ContrastModel', 'CubeModel', 'DarkModel', 'DarkMIRIModel', 'DisperserModel', 'DistortionModel', 'DistortionMRSModel', 'EmiModel', @@ -141,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 beee6b6a..64a19c37 100644 --- a/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml +++ b/src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml @@ -1795,9 +1795,9 @@ properties: type: object properties: name: - title: NIR Optimized Convolution Kernel reference file name + title: NIR Simple Improved Reference Subtraction type: string - fits_keyword: R_CONVKL + fits_keyword: R_SIRSKL blend_table: True cubepar: title: IFU cube reference file information diff --git a/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml b/src/stdatamodels/jwst/datamodels/schemas/sirs_kernel.schema.yaml similarity index 72% rename from src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml rename to src/stdatamodels/jwst/datamodels/schemas/sirs_kernel.schema.yaml index 2cf567c5..b6c1c008 100644 --- a/src/stdatamodels/jwst/datamodels/schemas/conv_kernel.schema.yaml +++ b/src/stdatamodels/jwst/datamodels/schemas/sirs_kernel.schema.yaml @@ -1,12 +1,12 @@ %YAML 1.1 --- $schema: "http://stsci.edu/schemas/asdf/asdf-schema-1.0.0" -id: "http://stsci.edu/schemas/jwst_datamodel/conv_kernel.schema" +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|guider1|guider2)$": + "^(nrca1|nrca2|nrca3|nrca4|nrcalong|nrcb1|nrcb2|nrcb3|nrcb4|nrcblong|nrs1|nrs2|mirimage|mirifulong|mirifushort|nis)$": type: object properties: gamma: diff --git a/src/stdatamodels/jwst/datamodels/conv_kernel.py b/src/stdatamodels/jwst/datamodels/sirs_kernel.py similarity index 65% rename from src/stdatamodels/jwst/datamodels/conv_kernel.py rename to src/stdatamodels/jwst/datamodels/sirs_kernel.py index 8dc461e4..768180cc 100644 --- a/src/stdatamodels/jwst/datamodels/conv_kernel.py +++ b/src/stdatamodels/jwst/datamodels/sirs_kernel.py @@ -1,12 +1,13 @@ from .reference import ReferenceFileModel -__all__ = ['ConvKernelModel'] +__all__ = ['SIRSKernelModel'] -class ConvKernelModel(ReferenceFileModel): +class SIRSKernelModel(ReferenceFileModel): """ - A data model for the NIR Optimized Convolution Kernel Fourier Coefficients. + A data model for the NIR Optimized Convolution Kernel Fourier Coefficients, + also called Simple Improved Reference Subtraction (SIRS). Parameters __________ @@ -18,14 +19,14 @@ class ConvKernelModel(ReferenceFileModel): - gamma: float32 1D array - zeta: float32 1D array """ - schema_url = "http://stsci.edu/schemas/jwst_datamodel/conv_kernel.schema" - reftype = "conv_kernel" + schema_url = "http://stsci.edu/schemas/jwst_datamodel/sirs_kernel.schema" + reftype = "sirskernel" def __init__(self, init=None, **kwargs): - super(ConvKernelModel, self).__init__(init=init, **kwargs) + super(SIRSKernelModel, self).__init__(init=init, **kwargs) def on_save(self, path=None): self.meta.reftype = self.reftype def validate(self): - super(ConvKernelModel, self).validate() + super(SIRSKernelModel, self).validate()