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

Adds support for roman ramp data #43

Merged
merged 2 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/stcal/ramp_fitting/ramp_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,8 @@ def create_ramp_fit_class(model, dqflags=None):
"""
ramp_data = ramp_fit_class.RampData()

ramp_data.set_arrays(
model.data, model.err, model.groupdq, model.pixeldq, model.int_times)

ramp_data.set_meta(
name=model.meta.instrument.name,
frame_time=model.meta.exposure.frame_time,
group_time=model.meta.exposure.group_time,
groupgap=model.meta.exposure.groupgap,
nframes=model.meta.exposure.nframes,
drop_frames1=model.meta.exposure.drop_frames1)
ramp_data.set_arrays(model)
ramp_data.set_meta(model)

ramp_data.set_dqflags(dqflags)

Expand Down
92 changes: 43 additions & 49 deletions src/stcal/ramp_fitting/ramp_fit_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,75 +26,69 @@ def __init__(self):
self.flags_no_gain_val = None
self.flags_unreliable_slope = None

def set_arrays(self, data, err, groupdq, pixeldq, int_times):
def set_arrays(self, model):
"""
Set the arrays needed for ramp fitting.

Parameter
---------
data : ndarray
4-D array containing the pixel information. It has dimensions
Sets the following arrays:
data : 4-D array containing the pixel information. It has dimensions
(nintegrations, ngroups, nrows, ncols)

err : ndarray
4-D array containing the error information. It has dimensions
err : 4-D array containing the error information. It has dimensions
(nintegrations, ngroups, nrows, ncols)

groupdq : ndarray (uint16)
4-D array containing the data quality flags. It has dimensions
groupdq :4-D array containing the data quality flags. It has dimensions
(nintegrations, ngroups, nrows, ncols)

pixeldq : ndarray (uint32)
4-D array containing the pixel data quality information. It has dimensions
pixeldq : 4-D array containing the pixel data quality information. It has dimensions
(nintegrations, ngroups, nrows, ncols)

int_times : list
Time information for each integration.
"""
# Get arrays from the data model
self.data = data
self.err = err
self.groupdq = groupdq
self.pixeldq = pixeldq
self.int_times = int_times

def set_meta(self, name, frame_time, group_time, groupgap,
nframes, drop_frames1=None):
"""
Set the metainformation needed for ramp fitting.

Parameter
---------
name : str
The instrument name.

frame_time : float32
The time to read one frame.
Time information for each integration (only JWST).

group_time : float32
The time to read one group.

groupgap : int
The number of frames that are not included in the group average
Parameters
----------
model : Data model
JWST or Roman Ramp Model

nframes : int
The number of frames that are included in the group average

drop_frames1 :
The number of frames dropped at the beginning of every integration.
May not be used in some pipelines, so is defaulted to NoneType.
"""

# Get arrays from the data model
self.data = model.data
self.err = model.err
self.groupdq = model.groupdq
self.pixeldq = model.pixeldq
if hasattr(model, 'int_times'):
self.int_times = model.int_times

def set_meta(self, model):
"""
Set the meta information needed for ramp fitting.

name: The instrument name.
frame_time: The time to read one frame.
group_time: The time to read one group.
groupgap: The number of frames that are not included in the group average
nframes: The number of frames that are included in the group average
drop_frames1: The number of frames dropped at the beginning of every integration.
May not be used in some pipelines, so is defaulted to NoneType.

Parameters
----------
model : Data model
JWST or ROman Ramp Model
"""
# Get meta information
self.instrument_name = name
self.instrument_name = model.meta.instrument.name

self.frame_time = frame_time
self.group_time = group_time
self.groupgap = groupgap
self.nframes = nframes
self.frame_time = model.meta.exposure.frame_time
self.group_time = model.meta.exposure.group_time
self.groupgap = model.meta.exposure.groupgap
self.nframes = model.meta.exposure.nframes

# May not be available for all pipelines, so is defaulted to NoneType.
self.drop_frames1 = drop_frames1
if hasattr(model, 'drop_frames1'):
self.drop_frames1 = model.exposure.drop_frames1

def set_dqflags(self, dqflags):
"""
Expand Down