def test_lastframe_add1_groupdq(): """ Test if the lasttframe code set the groupdq flag on the first group to 'do_not_use' by adding 1 to the flag, not overwriting to 1 """ # size of integration ngroups = 5 xsize = 1032 ysize = 1024 # create the data and groupdq arrays csize = (1, ngroups, ysize, xsize) data = np.full(csize, 1.0) groupdq = np.zeros(csize, dtype=int) # create a JWST datamodel for MIRI data dm_ramp = MIRIRampModel(data=data, groupdq=groupdq) # set a flag in the groupdq, last frame dm_ramp.groupdq[0, ngroups-1, 500:510, 500:510] = 4 # run the last frame correction step dm_ramp_lastframe = do_correction(dm_ramp) # test if pixels in groupdq were incremented in value by 1 assert(dm_ramp_lastframe.groupdq[0, ngroups-1, 505, 505] == 5)
def make_rampmodel(ngroups, ysize, xsize): '''Make MIRI ramp model for testing''' # create the data and groupdq arrays csize = (1, ngroups, ysize, xsize) # create JWST datamodel and set each frame equal to frame number dm_ramp = MIRIRampModel(csize) for i in range(0, ngroups-1): dm_ramp.data[0, i, :, :] = i # populate header of data model dm_ramp.meta.instrument.name = 'MIRI' dm_ramp.meta.instrument.detector = 'MIRIMAGE' dm_ramp.meta.instrument.filter = 'F560W' dm_ramp.meta.instrument.band = 'N/A' dm_ramp.meta.observation.date = '2016-06-01' dm_ramp.meta.observation.time = '00:00:00' dm_ramp.meta.exposure.type = 'MIR_IMAGE' dm_ramp.meta.subarray.name = 'FULL' dm_ramp.meta.subarray.xstart = 1 dm_ramp.meta.subarray.xsize = xsize dm_ramp.meta.subarray.ystart = 1 dm_ramp.meta.subarray.ysize = ysize return dm_ramp
def test_lastframe_add1_groupdq(): """ Test if the lasttframe code set the groupdq flag on the first group to 'do_not_use' by adding 1 to the flag, not overwriting to 1 """ # size of integration ngroups = 5 xsize = 1032 ysize = 1024 # create the data and groupdq arrays csize = (1, ngroups, ysize, xsize) data = np.full(csize, 1.0) groupdq = np.zeros(csize, dtype=int) # create a JWST datamodel for MIRI data dm_ramp = MIRIRampModel(data=data, groupdq=groupdq) # set a flag in the groupdq, last frame dm_ramp.groupdq[0, ngroups-1, 500:510, 500:510] = 4 # run the last frame correction step dm_ramp_lastframe = do_correction(dm_ramp) # test if pixels in groupdq were incremented in value by 1 assert(dm_ramp_lastframe.groupdq[0, ngroups-1, 505, 505] == 5)
def make_rampmodel(ngroups, ysize, xsize): '''Make MIRI ramp model for testing''' # create the data and groupdq arrays csize = (1, ngroups, ysize, xsize) # create JWST datamodel and set each frame equal to frame number dm_ramp = MIRIRampModel(csize) for i in range(0, ngroups - 1): dm_ramp.data[0, i, :, :] = i # populate header of data model dm_ramp.meta.instrument.name = 'MIRI' dm_ramp.meta.instrument.detector = 'MIRIMAGE' dm_ramp.meta.instrument.filter = 'F560W' dm_ramp.meta.instrument.band = 'N/A' dm_ramp.meta.observation.date = '2016-06-01' dm_ramp.meta.observation.time = '00:00:00' dm_ramp.meta.exposure.type = 'MIR_IMAGE' dm_ramp.meta.subarray.name = 'FULL' dm_ramp.meta.subarray.xstart = 1 dm_ramp.meta.subarray.xsize = xsize dm_ramp.meta.subarray.ystart = 1 dm_ramp.meta.subarray.ysize = ysize return dm_ramp
def test_lastframe_single_group(): """ Test that the lastframe code does nothing when passed a single group integration """ # size of integration ngroups = 1 xsize = 1032 ysize = 1024 # create the data and groupdq arrays csize = (1, ngroups, ysize, xsize) data = np.full(csize, 1.0) groupdq = np.zeros(csize, dtype=int) # create a JWST datamodel for MIRI data dm_ramp = MIRIRampModel(data=data, groupdq=groupdq) # run the last frame correction step dm_ramp_lastframe = do_correction(dm_ramp) # check that the difference in the groupdq flags is equal to # zero dq_diff = dm_ramp_lastframe.groupdq[0, ngroups-1, :, :] - dm_ramp.groupdq[0, ngroups-1, :, :] np.testing.assert_array_equal(np.full((ysize, xsize), 0, dtype=int), dq_diff, err_msg='groupdq changed for single group ' + 'when it should not')
def test_lastframe_ngroup2(): """ Test if the lastframe code set the groupdq flag on the last group to 'do_not_use'. Lastframe should not be flagged with ngroups=2. """ # size of integration ngroups = 2 xsize = 1032 ysize = 1024 # create the data and groupdq arrays csize = (1, ngroups, ysize, xsize) data = np.full(csize, 1.0) groupdq = np.zeros(csize, dtype=int) # create a JWST datamodel for MIRI data dm_ramp = MIRIRampModel(data=data, groupdq=groupdq) # run the last frame correction step dm_ramp_lastframe = do_correction(dm_ramp) # check that the difference in the groupdq flags is equal to # zero dq_diff = dm_ramp_lastframe.groupdq[0, ngroups - 1, :, :] - dm_ramp.groupdq[0, ngroups - 1, :, :] np.testing.assert_array_equal(np.full((ysize, xsize), 0, dtype=int), dq_diff, err_msg='groupdq flag changed ' + 'when it should not')
def test_err_array(): """test that the error array is not changed by the linearity step""" # size of integration ngroups = 20 xsize = 1032 ysize = 1024 # create the data and groupdq arrays csize = (1, ngroups, ysize, xsize) data = np.full(csize, 1.0) pixeldq = np.zeros((ysize, xsize), dtype=int) groupdq = np.zeros(csize, dtype=int) err = np.full(csize, 2.0) # create a JWST datamodel for MIRI data im = MIRIRampModel(data=data, pixeldq=pixeldq, groupdq=groupdq, err=err) # set file header values im.meta.instrument.detector = 'MIRIMAGE' im.meta.instrument.name = 'MIRI' im.meta.observation.date = '2018-01-01' im.meta.observation.time = '00:00:00' im.meta.subarray.xstart = 1 im.meta.subarray.xsize = xsize im.meta.subarray.ystart = 1 im.meta.subarray.ysize = ysize # run pipeline outfile = LinearityStep.call(im) # check output of error array # test that the science data are not changed np.testing.assert_array_equal(np.full(csize, 2.0, dtype=float), outfile.err, err_msg='no changes should be seen in array ')
def test_err_array(): """Test that the error array is not changed by the linearity step""" # size of integration ngroups = 10 xsize = 1032 ysize = 1024 # create a JWST datamodel for MIRI data im = MIRIRampModel((1, ngroups, ysize, xsize)) im.data += 1 im.err += 2 # set file header values im.meta.instrument.detector = 'MIRIMAGE' im.meta.instrument.name = 'MIRI' im.meta.observation.date = '2018-01-01' im.meta.observation.time = '00:00:00' im.meta.subarray.xstart = 1 im.meta.subarray.xsize = xsize im.meta.subarray.ystart = 1 im.meta.subarray.ysize = ysize # run pipeline outfile = LinearityStep.call(im) # check output of error array # test that the science data are not changed np.testing.assert_allclose(im.err, outfile.err)
def test_lin_subarray(): """Test that the pipeline properly extracts the subarray from the reference file. put dq flags in specific pixels and make sure they match in the output subarray file""" # create input data # create model of data with 0 value array ngroups = 50 ysize = 224 xsize = 288 # create a JWST datamodel for MIRI data im = MIRIRampModel((1, ngroups, ysize, xsize)) im.data += 1 im.meta.instrument.name = 'MIRI' im.meta.instrument.detector = 'MIRIMAGE' im.meta.instrument.filter = 'F1500W' im.meta.instrument.band = 'N/A' im.meta.observation.date = '2016-06-01' im.meta.observation.time = '00:00:00' im.meta.exposure.type = 'MIR_IMAGE' im.meta.subarray.name = 'MASK1550' im.meta.subarray.xstart = 1 im.meta.subarray.xsize = xsize im.meta.subarray.ystart = 467 im.meta.subarray.ysize = ysize # Read in reference file dq = np.zeros((1024, 1032), dtype=int) numcoeffs = 3 # place dq flags in dq array that would be in subarray # MASK1550 file has colstart=1, rowstart=467 dq[542, 100:105] = 1 ref_model = LinearityModel((numcoeffs, 1024, 1032)) ref_model.dq = dq ref_model.meta.instrument.name = 'MIRI' ref_model.meta.instrument.detector = 'MIRIMAGE' ref_model.meta.description = "MIRI LINEARITY Correction" ref_model.meta.reftype = "LINEARITY" ref_model.meta.author = "Monty Pytest" ref_model.meta.pedigree = "GROUND" ref_model.meta.useafter = '2015-08-01T00:00:00' ref_model.meta.subarray.xstart = 1 ref_model.meta.subarray.xsize = 1032 ref_model.meta.subarray.ystart = 1 ref_model.meta.subarray.ysize = 1024 # run through pipeline outfile = lincorr(im, ref_model) # read dq array outpixdq = outfile.pixeldq # check for dq flag in pixeldq of subarray image assert (outpixdq[76, 100] == 1) assert (outpixdq[76, 104] == 1)
def make_rawramp(instrument, nints, ngroups, ysize, xsize, ystart, xstart, exp_type=None): # create the data and groupdq arrays csize = (nints, ngroups, ysize, xsize) data = np.full(csize, 1.0) # create a JWST datamodel if instrument == "FGS": dm_ramp = GuiderRawModel(data=data) dm_ramp.meta.exposure.type = exp_type elif instrument == "MIRI": dm_ramp = MIRIRampModel(data=data) else: dm_ramp = RampModel(data=data) dm_ramp.meta.subarray.xstart = xstart dm_ramp.meta.subarray.xsize = xsize dm_ramp.meta.subarray.ystart = ystart dm_ramp.meta.subarray.ysize = ysize return dm_ramp
def setup_subarray_inputs(ngroups=10, readnoise=10, nints=1, nrows=1032, ncols=1024, subxstart=1, subystart=1, subxsize=1024, subysize=1032, nframes=1, grouptime=1.0, gain=1, deltatime=1): times = np.array(list(range(ngroups)), dtype=np.float64) * deltatime gain = np.ones(shape=(nrows, ncols), dtype=np.float64) * gain err = np.ones(shape=(nints, ngroups, nrows, ncols), dtype=np.float64) data = np.zeros(shape=(nints, ngroups, subysize, subxsize), dtype=np.float64) pixdq = np.zeros(shape=(subysize, subxsize), dtype=np.float64) read_noise = np.full((nrows, ncols), readnoise, dtype=np.float64) gdq = np.zeros(shape=(nints, ngroups, subysize, subxsize), dtype=np.int32) model1 = MIRIRampModel(data=data, err=err, pixeldq=pixdq, groupdq=gdq, times=times) model1.meta.instrument.name = 'MIRI' model1.meta.instrument.detector = 'MIRIMAGE' model1.meta.instrument.filter = 'F480M' model1.meta.observation.date = '2015-10-13' model1.meta.exposure.type = 'MIR_IMAGE' model1.meta.exposure.group_time = deltatime model1.meta.subarray.name = 'FULL' model1.meta.subarray.xstart = subxstart model1.meta.subarray.ystart = subystart model1.meta.subarray.xsize = subxsize model1.meta.subarray.ysize = subysize model1.meta.exposure.frame_time = deltatime model1.meta.exposure.ngroups = ngroups model1.meta.exposure.group_time = deltatime model1.meta.exposure.nframes = 1 model1.meta.exposure.groupgap = 0 gain = GainModel(data=gain) gain.meta.instrument.name = 'MIRI' gain.meta.subarray.xstart = 1 gain.meta.subarray.ystart = 1 gain.meta.subarray.xsize = 1024 gain.meta.subarray.ysize = 1032 rnModel = ReadnoiseModel(data=read_noise) rnModel.meta.instrument.name = 'MIRI' rnModel.meta.subarray.xstart = 1 rnModel.meta.subarray.ystart = 1 rnModel.meta.subarray.xsize = 1024 rnModel.meta.subarray.ysize = 1032 return model1, gdq, rnModel, pixdq, err, gain
def create_mod_arrays(ngroups, nints, nrows, ncols, deltatime, gain, readnoise): """ For an input datacube (arbitrarily chosen to be MIRI), create arrays having the specified dimensions for the pixel DQ, the group DQ, and the ERR extensions, and create datamodels for the ramp, readnoise, and gain. """ gain = np.ones(shape=(nrows, ncols), dtype=np.float32) * gain err = np.zeros(shape=(nints, ngroups, nrows, ncols), dtype=np.float32) data = np.zeros(shape=(nints, ngroups, nrows, ncols), dtype=np.float32) pixdq = np.zeros(shape=(nrows, ncols), dtype=np.int32) read_noise = np.full((nrows, ncols), readnoise, dtype=np.float32) gdq = np.zeros(shape=(nints, ngroups, nrows, ncols), dtype=np.uint8) # Create and populate ramp model RampMod = MIRIRampModel(data=data, err=err, pixeldq=pixdq, groupdq=gdq) RampMod.meta.instrument.name = 'MIRI' RampMod.meta.instrument.detector = 'MIRIMAGE' RampMod.meta.instrument.filter = 'F480M' RampMod.meta.observation.date = '2015-10-13' RampMod.meta.exposure.type = 'MIR_IMAGE' RampMod.meta.exposure.group_time = deltatime RampMod.meta.subarray.name = 'FULL' RampMod.meta.subarray.xstart = 1 RampMod.meta.subarray.ystart = 1 RampMod.meta.subarray.xsize = ncols RampMod.meta.subarray.ysize = nrows RampMod.meta.exposure.frame_time = deltatime RampMod.meta.exposure.ngroups = ngroups RampMod.meta.exposure.group_time = deltatime RampMod.meta.exposure.nframes = 1 RampMod.meta.exposure.groupgap = 0 # Create and populate gain model GMod = GainModel(data=gain) GMod.meta.instrument.name = 'MIRI' GMod.meta.subarray.xstart = 1 GMod.meta.subarray.ystart = 1 GMod.meta.subarray.xsize = ncols GMod.meta.subarray.ysize = nrows # Create and populate readnoise model RnMod = ReadnoiseModel(data=read_noise) RnMod.meta.instrument.name = 'MIRI' RnMod.meta.subarray.xstart = 1 RnMod.meta.subarray.ystart = 1 RnMod.meta.subarray.xsize = ncols RnMod.meta.subarray.ysize = nrows return RampMod, RnMod, GMod, pixdq, gdq, err
def setup_small_cube(ngroups=10, nints=1, nrows=2, ncols=2, deltatime=10., gain=1., readnoise=10.): '''Create input MIRI datacube having the specified dimensions ''' gain = np.ones(shape=(nrows, ncols), dtype=np.float64) * gain err = np.zeros(shape=(nints, ngroups, nrows, ncols), dtype=np.float64) data = np.zeros(shape=(nints, ngroups, nrows, ncols), dtype=np.float64) pixdq = np.zeros(shape=(nrows, ncols), dtype=np.int32) read_noise = np.full((nrows, ncols), readnoise, dtype=np.float64) gdq = np.zeros(shape=(nints, ngroups, nrows, ncols), dtype=np.uint8) model1 = MIRIRampModel(data=data, err=err, pixeldq=pixdq, groupdq=gdq) model1.meta.instrument.name = 'MIRI' model1.meta.instrument.detector = 'MIRIMAGE' model1.meta.instrument.filter = 'F480M' model1.meta.observation.date = '2015-10-13' model1.meta.exposure.type = 'MIR_IMAGE' model1.meta.exposure.group_time = deltatime model1.meta.subarray.name = 'FULL' model1.meta.subarray.xstart = 1 model1.meta.subarray.ystart = 1 model1.meta.subarray.xsize = ncols model1.meta.subarray.ysize = nrows model1.meta.exposure.frame_time = deltatime model1.meta.exposure.ngroups = ngroups model1.meta.exposure.group_time = deltatime model1.meta.exposure.nframes = 1 model1.meta.exposure.groupgap = 0 gain = GainModel(data=gain) gain.meta.instrument.name = 'MIRI' gain.meta.subarray.xstart = 1 gain.meta.subarray.ystart = 1 gain.meta.subarray.xsize = ncols gain.meta.subarray.ysize = nrows rnModel = ReadnoiseModel(data=read_noise) rnModel.meta.instrument.name = 'MIRI' rnModel.meta.subarray.xstart = 1 rnModel.meta.subarray.ystart = 1 rnModel.meta.subarray.xsize = ncols rnModel.meta.subarray.ysize = nrows return model1, gdq, rnModel, pixdq, err, gain
def make_rampmodel(nints, ngroups, ysize, xsize): """Function to provide ramp model to tests""" dm_ramp = MIRIRampModel((nints, ngroups, ysize, xsize)) dm_ramp.data += 1 dm_ramp.meta.instrument.name = 'MIRI' dm_ramp.meta.observation.date = '2018-01-01' dm_ramp.meta.observation.time = '00:00:00' dm_ramp.meta.subarray.xstart = 1 dm_ramp.meta.subarray.xsize = xsize dm_ramp.meta.subarray.ystart = 1 dm_ramp.meta.subarray.ysize = ysize return dm_ramp
def make_rampmodel(nints, ngroups, ysize, xsize): # create the data and groupdq arrays csize = (nints, ngroups, ysize, xsize) data = np.full(csize, 1.0) pixeldq = np.zeros((ysize, xsize), dtype=int) groupdq = np.zeros(csize, dtype=int) # create a JWST datamodel for MIRI data dm_ramp = MIRIRampModel(data=data, pixeldq=pixeldq, groupdq=groupdq) dm_ramp.meta.instrument.name = 'MIRI' dm_ramp.meta.observation.date = '2018-01-01' dm_ramp.meta.observation.time = '00:00:00' dm_ramp.meta.subarray.xstart = 1 dm_ramp.meta.subarray.xsize = xsize dm_ramp.meta.subarray.ystart = 1 dm_ramp.meta.subarray.ysize = ysize return dm_ramp
def _ramp(nints, ngroups, ysize, xsize): # create the data and groupdq arrays csize = (nints, ngroups, ysize, xsize) data = np.full(csize, 1.0) # create a JWST datamodel for MIRI data dm_ramp = MIRIRampModel(data=data) dm_ramp.meta.instrument.name = 'MIRI' dm_ramp.meta.observation.date = '2018-01-01' dm_ramp.meta.observation.time = '00:00:00' dm_ramp.meta.subarray.xstart = 1 dm_ramp.meta.subarray.xsize = xsize dm_ramp.meta.subarray.ystart = 1 dm_ramp.meta.subarray.ysize = ysize dm_ramp.meta.description = 'Fake data.' return dm_ramp
def test_lastframe_set_groupdq(): """ Test if the lastframe code set the groupdq flag on the last group to 'do_not_use'. For ngroups >= 3, lastframe should be flagged. """ # size of integration ngroups = 3 xsize = 1032 ysize = 1024 # create the data and groupdq arrays csize = (1, ngroups, ysize, xsize) data = np.full(csize, 1.0) groupdq = np.zeros(csize, dtype=int) # create a JWST datamodel for MIRI data dm_ramp = MIRIRampModel(data=data, groupdq=groupdq) # run the last frame correction step dm_ramp_lastframe = do_correction(dm_ramp) # check that the difference in the groupdq flags is equal to # the 'do_not_use' flag dq_diff = dm_ramp_lastframe.groupdq[0, ngroups - 1, :, :] - dm_ramp.groupdq[0, ngroups - 1, :, :] np.testing.assert_array_equal(np.full((ysize, xsize), dqflags.group['DO_NOT_USE'], dtype=int), dq_diff, err_msg='Diff in groupdq flags is not ' + 'equal to the DO_NOT_USE flag') # test that the groupdq flags are not changed for the rest of the groups dq_diff = (dm_ramp_lastframe.groupdq[0, 0:ngroups - 2, :, :] - dm_ramp.groupdq[0, 0:ngroups - 2, :, :]) np.testing.assert_array_equal( np.full((ngroups - 2, ysize, xsize), 0, dtype=int), dq_diff, err_msg='n <= ngroups-2 groupdq flags changes ' + 'and they should not be')
def _cube(xstart, ystart, ngroups, nrows, ncols): nints = 1 # create a JWST datamodel for MIRI data data_model = MIRIRampModel((nints, ngroups, nrows, ncols)) data_model.data += 1 data_model.meta.instrument.name = 'MIRI' data_model.meta.instrument.detector = 'MIRIMAGE' data_model.meta.instrument.filter = 'F1500W' data_model.meta.instrument.band = 'N/A' data_model.meta.observation.date = '2016-06-01' data_model.meta.observation.time = '00:00:00' data_model.meta.exposure.type = 'MIR_IMAGE' data_model.meta.subarray.name = 'MASK1550' data_model.meta.subarray.xstart = xstart data_model.meta.subarray.xsize = ncols data_model.meta.subarray.ystart = ystart data_model.meta.subarray.ysize = nrows # create a saturation model for the saturation step saturation_model = SaturationModel((1032, 1024)) 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' saturation_model.meta.instrument.name = 'MIRI' saturation_model.meta.instrument.detector = 'MIRIMAGE' saturation_model.meta.subarray.xstart = 1 saturation_model.meta.subarray.xsize = 1024 saturation_model.meta.subarray.ystart = 1 saturation_model.meta.subarray.ysize = 1032 return data_model, saturation_model
def test_dq_subarray(): """Test that the pipeline properly extracts the subarray from the reference file.""" # put dq flags in specific pixels and make sure they match in the output subarray file # create input data # create model of data with 0 value array ngroups = 50 ysize = 224 xsize = 288 fullxsize = 1032 fullysize = 1024 # create the data and groupdq arrays csize = (1, ngroups, ysize, xsize) data = np.full(csize, 1.0) pixeldq = np.zeros((ysize, xsize), dtype=int) groupdq = np.zeros(csize, dtype=int) # create a JWST datamodel for MIRI data im = MIRIRampModel(data=data, pixeldq=pixeldq, groupdq=groupdq) im.meta.instrument.name = 'MIRI' im.meta.instrument.detector = 'MIRIMAGE' im.meta.instrument.filter = 'F1500W' im.meta.instrument.band = 'N/A' im.meta.observation.date = '2016-06-01' im.meta.observation.time = '00:00:00' im.meta.exposure.type = 'MIR_IMAGE' im.meta.subarray.name = 'MASK1550' im.meta.subarray.xstart = 1 im.meta.subarray.xsize = xsize im.meta.subarray.ystart = 467 im.meta.subarray.ysize = ysize # create full size mask model dq, dq_def = make_maskmodel(fullysize, fullxsize) # place dq flags in dq array that would be in subarray # MASK1550 file has colstart=1, rowstart=467 dq[542, 100] = 2 dq[550, 100] = 1 dq[580, 80] = 4 # write mask model ref_data = MaskModel(dq=dq, dq_def=dq_def) ref_data.meta.instrument.name = 'MIRI' ref_data.meta.subarray.xstart = 1 ref_data.meta.subarray.xsize = fullxsize ref_data.meta.subarray.ystart = 1 ref_data.meta.subarray.ysize = fullysize # Filter out validation warnings from ref_data warnings.filterwarnings("ignore", category=ValidationWarning) # run correction step outfile = do_dqinit(im, ref_data) # read dq array outpixdq = outfile.pixeldq # check for dq flag in pixeldq of subarray image assert (outpixdq[76, 100] == 1024) assert (outpixdq[84, 100] == 1) assert (outpixdq[114, 80] == 2048 ) # check that pixel was flagged 'NO_SAT_CHECK'
def test_lin_subarray(): """Test that the pipeline properly extracts the subarray from the reference file. put dq flags in specific pixels and make sure they match in the output subarray file""" # create input data # create model of data with 0 value array ngroups = 50 ysize = 224 xsize = 288 # create the data and groupdq arrays csize = (1, ngroups, ysize, xsize) data = np.full(csize, 1.0) pixeldq = np.zeros((ysize, xsize), dtype=int) groupdq = np.zeros(csize, dtype=int) # create a JWST datamodel for MIRI data im = MIRIRampModel(data=data, pixeldq=pixeldq, groupdq=groupdq) im.meta.instrument.name = 'MIRI' im.meta.instrument.detector = 'MIRIMAGE' im.meta.instrument.filter = 'F1500W' im.meta.instrument.band = 'N/A' im.meta.observation.date = '2016-06-01' im.meta.observation.time = '00:00:00' im.meta.exposure.type = 'MIR_IMAGE' im.meta.subarray.name = 'MASK1550' im.meta.subarray.xstart = 1 im.meta.subarray.xsize = xsize im.meta.subarray.ystart = 467 im.meta.subarray.ysize = ysize # Read in reference file dq = np.zeros((1024, 1032), dtype=int) numcoeffs = 3 # place dq flags in dq array that would be in subarray # MASK1550 file has colstart=1, rowstart=467 dq[542, 100:105] = 1 ref_model = LinearityModel() ref_model.data = np.zeros(shape=(numcoeffs, 1024, 1032), dtype=np.float32) ref_model.dq = dq ref_model.meta.instrument.name = 'MIRI' ref_model.meta.instrument.detector = 'MIRIMAGE' ref_model.meta.subarray.xstart = 1 ref_model.meta.subarray.xsize = 1032 ref_model.meta.subarray.ystart = 1 ref_model.meta.subarray.ysize = 1024 # run through pipeline outfile = lincorr(im, ref_model) # read dq array outpixdq = outfile.pixeldq # check for dq flag in pixeldq of subarray image assert(outpixdq[76, 100] == 1) assert(outpixdq[76, 104] == 1)