def setup_cube(ngroups, nrows, ncols): ''' Set up fake data to test.''' nints = 1 data_model = RampModel() data_model.data = np.zeros(shape=(nints, ngroups, nrows, ncols), dtype=np.float32) data_model.pixeldq = np.zeros(shape=(nrows, ncols), dtype=np.int32) data_model.groupdq = np.zeros(shape=(nints, ngroups, nrows, ncols), dtype=np.float32) data_model.meta.subarray.xstart = 1 data_model.meta.subarray.ystart = 1 data_model.meta.subarray.xsize = ncols data_model.meta.subarray.ysize = nrows data_model.meta.exposure.ngroups = ngroups data_model.meta.instrument.name = 'NIRCAM' saturation_model = SaturationModel() saturation_model.data = np.zeros(shape=(2048, 2048), dtype=np.float32) saturation_model.dq = np.zeros(shape=(2048, 2048), dtype=np.int32) saturation_model.meta.subarray.xstart = 1 saturation_model.meta.subarray.ystart = 1 saturation_model.meta.subarray.xsize = 2048 saturation_model.meta.subarray.ysize = 2048 saturation_model.meta.instrument.name = 'NIRCAM' saturation_model.meta.description = 'Fake data.' saturation_model.meta.telescope = 'JWST' saturation_model.meta.reftype = 'SaturationModel' saturation_model.meta.author = 'Alicia' saturation_model.meta.pedigree = 'Dummy' saturation_model.meta.useafter = '2015-10-01T00:00:00' return data_model, saturation_model
def _cube(): # create a JWST datamodel for NIRSPEC IRS2 data data_model = RampModel((1, 5, 3200, 2048)) data_model.data = np.ones(((1, 5, 3200, 2048))) data_model.groupdq = np.zeros(((1, 5, 3200, 2048))) data_model.pixeldq = np.zeros(((3200, 2048))) data_model.meta.instrument.name = 'NIRSPEC' data_model.meta.instrument.detector = 'NRS1' data_model.meta.instrument.filter = 'F100LP' data_model.meta.observation.date = '2019-07-19' data_model.meta.observation.time = '23:23:30.912' data_model.meta.exposure.type = 'NRS_LAMP' data_model.meta.subarray.name = 'FULL' data_model.meta.subarray.xstart = 1 data_model.meta.subarray.xsize = 2048 data_model.meta.subarray.ystart = 1 data_model.meta.subarray.ysize = 2048 data_model.meta.exposure.nrs_normal = 16 data_model.meta.exposure.nrs_reference = 4 data_model.meta.exposure.readpatt = 'NRSIRS2RAPID' # create a saturation model for the saturation step saturation_model = SaturationModel((2048, 2048)) saturation_model.data = np.ones( (2048, 2048)) * 60000 # saturation limit for every pixel is 60000 saturation_model.meta.description = 'Fake data.' saturation_model.meta.telescope = 'JWST' saturation_model.meta.reftype = 'SaturationModel' saturation_model.meta.useafter = '2015-10-01T00:00:00' saturation_model.meta.instrument.name = 'NIRSPEC' saturation_model.meta.instrument.detector = 'NRS1' saturation_model.meta.author = 'Clare' saturation_model.meta.pedigree = 'Dummy' saturation_model.meta.subarray.xstart = 1 saturation_model.meta.subarray.xsize = 2048 saturation_model.meta.subarray.ystart = 1 saturation_model.meta.subarray.ysize = 2048 return data_model, saturation_model