Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JP-3622 Update refpix step for NIR detectors to use convolution kernel #321

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions changes/321.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adding datamodel schema for jwst refpix convolution kernel.
3 changes: 2 additions & 1 deletion src/stdatamodels/jwst/datamodels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -102,7 +103,7 @@
'NrsMosApcorrModel', 'NrsFsApcorrModel', 'NrsIfuApcorrModel',
'AsnModel',
'BarshadowModel', 'CameraModel', 'CollimatorModel',
'CombinedSpecModel', 'ContrastModel', 'CubeModel',
'CombinedSpecModel', 'ContrastModel', 'ConvKernelModel','CubeModel',
'DarkModel', 'DarkMIRIModel',
'DisperserModel', 'DistortionModel', 'DistortionMRSModel',
'EmiModel',
Expand Down
31 changes: 31 additions & 0 deletions src/stdatamodels/jwst/datamodels/conv_kernel.py
Original file line number Diff line number Diff line change
@@ -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

Check warning on line 28 in src/stdatamodels/jwst/datamodels/conv_kernel.py

View check run for this annotation

Codecov / codecov/patch

src/stdatamodels/jwst/datamodels/conv_kernel.py#L28

Added line #L28 was not covered by tests

def validate(self):
super(ConvKernelModel, self).validate()

Check warning on line 31 in src/stdatamodels/jwst/datamodels/conv_kernel.py

View check run for this annotation

Codecov / codecov/patch

src/stdatamodels/jwst/datamodels/conv_kernel.py#L31

Added line #L31 was not covered by tests
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions src/stdatamodels/jwst/datamodels/schemas/core.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down