def test_create_combined(_jail, wfs_association, data1, data2, dq1, dq2,
                         result_data, result_dq):
    path_asn, path1, path2 = wfs_association

    # Populate data and DQ array at [5, 5] with what is to be tested
    with datamodels.open(path1) as im1, datamodels.open(path2) as im2:
        # Populate some data and DQ flags for the test
        im1.data[5, 5] = data1
        im2.data[5, 5] = data2
        im1.dq[5, 5] = dq1
        im2.dq[5, 5] = dq2

        im1.save(path1)
        im2.save(path2)

    result = WfsCombineStep.call(path_asn,
                                 do_refine=False,
                                 flip_dithers=False,
                                 psf_size=50,
                                 blur_size=10,
                                 n_size=2)

    # Check that results are as expected
    assert result[0].data[5, 5] == result_data
    assert result[0].dq[5, 5] == result_dq
Exemple #2
0
def test_step_neg_shift_no_refine_no_flip(wfs_association):
    path_asn, path1, path2 = wfs_association
    nircam_pixel_size = 0.031 / 3600.
    delta_pixel = -5
    with datamodels.open(path2) as im2:
        im2.meta.wcsinfo = {
            'dec_ref': 11.99875540218638,
            'ra_ref': 22.02351763251896 + delta_pixel * nircam_pixel_size,
            'roll_ref': 0.005076934167039675,
            'v2_ref': 86.039011,
            'v3_ref': -493.385704,
            'v3yangle': -0.07385127,
            'vparity': -1,
            'wcsaxes': 2
        }
        im2 = AssignWcsStep.call(im2, sip_approx=False)
        im2.save(path2)

    wfs = WfsCombineStep.call(path_asn,
                              do_refine=False,
                              flip_dithers=False,
                              psf_size=50,
                              blur_size=10,
                              n_size=2)
    assert wfs[0].meta.wcsinfo.ra_ref == 22.02351763251896
Exemple #3
0
    def test_wfs_combine2(self):
        """
        Regression test of wfs_combine using do_refine=True
        """
        asn_file = self.get_data(self.test_dir,
                                   'wfs_3sets_asn3.json')
        for file in raw_from_asn(asn_file):
            self.get_data(self.test_dir, file)

        WfsCombineStep.call(asn_file,
                            do_refine=True)

        outputs = [('test_wfscom3_wfscmb.fits',
                    'test_wfscom_do_ref.fits'),
                   ('test_wfscom3a_wfscmb.fits',
                    'test_wfscoma_do_ref.fits'),
                   ('test_wfscom3b_wfscmb.fits',
                    'test_wfscomb_do_ref.fits')
                  ]
        self.compare_outputs(outputs)
Exemple #4
0
    def test_wfs_combine(self):
        """
        Regression test of wfs_combine using do_refine=False (default)
        Association table has 3 (identical) pairs of input files to combine
        """
        asn_file = self.get_data(self.test_dir,
                                   'wfs_3sets_asn.json')
        for file in raw_from_asn(asn_file):
            self.get_data(self.test_dir, file)

        WfsCombineStep.call(asn_file)

        outputs = [('test_wfscom_wfscmb.fits',
                    'test_wfscom.fits'),
                   ('test_wfscoma_wfscmb.fits',
                    'test_wfscoma.fits'),
                   ('test_wfscomb_wfscmb.fits',
                    'test_wfscomb.fits')
                  ]
        self.compare_outputs(outputs)