-
Notifications
You must be signed in to change notification settings - Fork 26
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
MIRI LRS specwcs datamodel #382
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
%YAML 1.1 | ||
--- | ||
$schema: "http://stsci.edu/schemas/asdf/asdf-schema-1.1.0" | ||
id: "http://stsci.edu/schemas/jwst_datamodel/specwcs_miri_lrs.schema" | ||
title: MIRI LRS Spec Schema | ||
allOf: | ||
- $ref: referencefile.schema | ||
- $ref: keyword_pexptype.schema | ||
- $ref: keyword_exptype.schema | ||
- $ref: keyword_readpatt.schema | ||
- $ref: keyword_filter.schema | ||
- $ref: keyword_band.schema | ||
- $ref: subarray.schema | ||
- type: object | ||
properties: | ||
wavetable: | ||
title: Wavelengths and x, y locations of wavelengths | ||
fits_hdu: WAVETABLE | ||
datatype: | ||
- name: x_center | ||
datatype: float32 | ||
unit: pixels | ||
title: x location of the center of a given wavelength element | ||
- name: y_center | ||
datatype: float32 | ||
unit: pixels | ||
title: y location of the center of a given wavelength element | ||
- name: wavelength | ||
datatype: float32 | ||
unit: microns | ||
title: central wavelength of the wavelength element at x_center, y_center | ||
- name: x0 | ||
datatype: float32 | ||
unit: pixels | ||
title: x location of the upper left corner of a given wavelength element | ||
- name: y0 | ||
datatype: float32 | ||
unit: pixels | ||
title: y location of the upper left corner of a given wavelength element | ||
- name: x1 | ||
datatype: float32 | ||
unit: pixels | ||
title: x location of the upper right corner of a given wavelength element | ||
- name: y1 | ||
datatype: float32 | ||
unit: pixels | ||
title: y location of the upper right corner of a given wavelength element | ||
- name: x2 | ||
datatype: float32 | ||
unit: pixels | ||
title: x location of the lower right corner of a given wavelength element | ||
- name: y2 | ||
datatype: float32 | ||
unit: pixels | ||
title: y location of the lower right corner of a given wavelength element | ||
- name: x3 | ||
datatype: float32 | ||
unit: pixels | ||
title: x location of the lower left corner of a given wavelength element | ||
- name: y3 | ||
datatype: float32 | ||
unit: pixels | ||
title: y location of the lower left corner of a given wavelength element | ||
- type: object | ||
properties: | ||
meta: | ||
type: object | ||
properties: | ||
x_ref: | ||
type: number | ||
title: x coord of ref position of MIRIM_SLIT | ||
default: pixels | ||
fits_keyword: IMX | ||
y_ref: | ||
type: number | ||
title: y coord of ref position of MIRIM_SLIT | ||
default: pixels | ||
fits_keyword: IMY | ||
x_ref_slitless: | ||
type: number | ||
title: x coord of ref position of MIRIM_SLITLESS | ||
default: pixels | ||
fits_keyword: IMXSLTL | ||
y_ref_slitless: | ||
type: number | ||
title: y coord of ref position of MIRIM_SLITLESS | ||
default: pixels | ||
fits_keyword: IMYSLTL | ||
v2_vert1: | ||
type: number | ||
title: Slit vertex 1 in V2 frame | ||
fits_keyword: V2VERT1 | ||
v2_vert2: | ||
type: number | ||
title: Slit vertex 2 in V2 frame | ||
fits_keyword: V2VERT2 | ||
v2_vert3: | ||
type: number | ||
title: Slit vertex 3 in V2 frame | ||
fits_keyword: V2VERT3 | ||
v2_vert4: | ||
type: number | ||
title: Slit vertex 4 in V2 frame | ||
fits_keyword: V2VERT4 | ||
v3_vert1: | ||
type: number | ||
title: Slit vertex 1 in V3 frame | ||
fits_keyword: V3VERT1 | ||
v3_vert2: | ||
type: number | ||
title: Slit vertex 2 in V3 frame | ||
fits_keyword: V3VERT2 | ||
v3_vert3: | ||
type: number | ||
title: Slit vertex 3 in V3 frame | ||
fits_keyword: V3VERT3 | ||
v3_vert4: | ||
type: number | ||
title: Slit vertex 4 in V3 frame | ||
fits_keyword: V3VERT4 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,8 @@ | |
'WavelengthrangeModel', 'CameraModel', 'CollimatorModel', 'OTEModel', | ||
'FOREModel', "FPAModel", 'IFUPostModel', 'IFUFOREModel', 'IFUSlicerModel', | ||
'MSAModel', 'FilteroffsetModel', 'DisperserModel', | ||
'NIRCAMGrismModel', 'NIRISSGrismModel', 'WaveCorrModel'] | ||
'NIRCAMGrismModel', 'NIRISSGrismModel', 'WaveCorrModel', | ||
'MiriLRSSpecwcsModel'] | ||
|
||
|
||
class _SimpleModel(ReferenceFileModel): | ||
|
@@ -343,6 +344,106 @@ def to_fits(self): | |
raise NotImplementedError("FITS format is not supported for this file.") | ||
|
||
|
||
class MiriLRSSpecwcsModel(ReferenceFileModel): | ||
""" | ||
A model for a reference file of type "specwcs" for MIRI LRS Slit. | ||
The model is for the specwcs for LRS Fixed Slit and LRSSlitless | ||
Parameters | ||
---------- | ||
x_ref : float | ||
x coordinate of reference position of fixed slit aperture | ||
y_ref : float | ||
y coordinate of reference position of fixed slit aperture | ||
x_ref_slitless : float | ||
x coordinate of reference position of slitless aperture | ||
y_ref_slitless : float | ||
y coordinate of reference position of slitless aperture | ||
v2vert1 : float | ||
slit vertex 1 in V2 frame | ||
v2vert2 : float | ||
slit vertex 2 in V2 frame | ||
v2vert3 : float | ||
slit vertex 3 in V2 frame | ||
v2vert4 : float | ||
slit vertex 4 in V2 frames | ||
v3vert1 : float | ||
slit vertex 1 in V3 frames | ||
v3vert2 : float | ||
slit vertex 2 in V3 frames | ||
v3vert3 : float | ||
slit vertex 3 in V3 frames | ||
v3vert4 : float | ||
slit vertex 4 in V3 frames | ||
wavetable : numpy 2-D array | ||
For each row in the slit hold wavelength, and | ||
x center, ycenter, x and y box region cooresponding to the wavelength | ||
""" | ||
schema_url = "http://stsci.edu/schemas/jwst_datamodel/specwcs_miri_lrs.schema" | ||
reftype = "specwcs" | ||
|
||
def __init__(self, init=None, | ||
wavetable=None, | ||
x_ref=None, | ||
y_ref=None, | ||
x_ref_slitless=None, | ||
y_ref_slitless=None, | ||
v2_vert1=None, | ||
v2_vert2=None, | ||
v2_vert3=None, | ||
v2_vert4=None, | ||
v3_vert1=None, | ||
v3_vert2=None, | ||
v3_vert3=None, | ||
v3_vert4=None, | ||
**kwargs): | ||
super().__init__(init=init, **kwargs) | ||
|
||
if init is None: | ||
self.populate_meta() | ||
if wavetable is not None: | ||
self.wavetable = wavetable | ||
if x_ref is not None: | ||
self.meta.x_ref = x_ref | ||
if y_ref is not None: | ||
self.meta.y_ref = y_ref | ||
if x_ref_slitless is not None: | ||
self.meta.x_ref_slitless = x_ref_slitless | ||
if y_ref_slitless is not None: | ||
self.meta.y_ref_slitless = y_ref_slitless | ||
if v2_vert1 is not None: | ||
self.meta.v2_vert1 = v2_vert1 | ||
if v2_vert2 is not None: | ||
self.meta.v2_vert2 = v2_vert2 | ||
if v2_vert3 is not None: | ||
self.meta.v2_vert3 = v2_vert3 | ||
if v2_vert4 is not None: | ||
self.meta.v2_vert4 = v2_vert4 | ||
if v3_vert1 is not None: | ||
self.meta.v3_vert1 = v3_vert1 | ||
if v3_vert2 is not None: | ||
self.meta.v3_vert2 = v3_vert2 | ||
if v3_vert3 is not None: | ||
self.meta.v3_vert3 = v3_vert3 | ||
if v3_vert4 is not None: | ||
self.meta.v3_vert4 = v3_vert4 | ||
|
||
def populate_meta(self): | ||
self.meta.instrument.name = "MIRI" | ||
self.meta.instrument.detector = "MIRIMAGE" | ||
self.meta.reftype = self.reftype | ||
|
||
def validate(self): | ||
super(MiriLRSSpecwcsModel, self).validate() | ||
try: | ||
assert self.meta.instrument.name == "MIRI" | ||
assert self.meta.instrument.detector == "MIRIMAGE" | ||
assert self.meta.reftype == self.reftype | ||
except AssertionError: | ||
if self._strict_validation: | ||
raise | ||
else: | ||
warnings.warn(traceback.format_exc(), ValidationWarning) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want to be able to programmatically create a MIRILRSModel then you need to implement the A Would yo consider renaming the model to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nden I will add init and populate_meta. I will follow what the other models do in wcs_ref_models.py. I have never made a model like this. Could you explain the reason these methods are in the model. Is it to able to create On the name I tried to name the model in a way that was consistent with the other models defined in wcs_ref_models.py. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, that's the only reason. If you think the model will be be initialized only by a file then it's not necessary to add an |
||
class RegionsModel(ReferenceFileModel): | ||
""" | ||
A model for a reference file of type "regions". | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be helpful to add description (or title) for each of these fields. These can come as a minimum from the names in the FITS table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nden The names in the fits file are exactly these names and no more information in fits file is provided. I will give a shot at a description and run that by Greg Sloan who I think made these reference files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. The names are the same. I sent you a document with the description. I think it's good to add the descriptions because the meaning of the names is not obvious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done