def test_fitsio(self): # Suppress metadata warnings with warnings.catch_warnings(): warnings.simplefilter("ignore") # Check that the data product can be written to a FITS # file and read back again without changing the data. self.dataproduct.save(self.testfile, overwrite=True) with MiriMrsDistortionModel34(self.testfile) as readback: self.assertEqual(self.dataproduct.meta.reftype, readback.meta.reftype) self.assertEqual(self.dataproduct.meta.model_type, readback.meta.model_type) self.assertTrue( np.allclose(self.dataproduct.slicenumber, readback.slicenumber)) assert_products_equal(self, self.dataproduct, readback, arrays=['slicenumber'], tables=[ 'fov_ch3', 'fov_ch4', 'alpha_ch3', 'lambda_ch3', 'alpha_ch4', 'lambda_ch4', 'x_ch3', 'y_ch3', 'x_ch4', 'y_ch4', 'albe_to_xanyan', 'xanyan_to_albe' ]) del readback
def test_copy(self): # Test that a copy can be made of the data product. datacopy = self.dataproduct.copy() self.assertIsNotNone(datacopy) assert_products_equal( self, self.dataproduct, datacopy, arrays=['data'] ) del datacopy
def test_copy(self): # Test that a copy can be made of the data product. datacopy = self.dataproduct.copy() self.assertIsNotNone(datacopy) assert_products_equal( self, self.dataproduct, datacopy, arrays=['data', 'err', 'dq']) # FIXME: removed dq_def until data corruption bug fixed. Bug 589 # tables='dq_def' ) del datacopy
def test_fitsio(self): # Suppress metadata warnings with warnings.catch_warnings(): warnings.simplefilter("ignore") # Check that the data product can be written to a FITS # file and read back again without changing the data. self.dataproduct.save(self.testfile, overwrite=True) with MiriIPCModel(self.testfile) as readback: assert_products_equal( self, self.dataproduct, readback, arrays=['data'] ) del readback
def test_fitsio(self): # Suppress metadata warnings with warnings.catch_warnings(): warnings.simplefilter("ignore") # Check that the data product can be written to a FITS # file and read back again without changing the data. self.dataproduct.save(self.testfile, overwrite=True) with MiriImagingPointSpreadFunctionModel( self.testfile) as readback: self.assertEqual(self.dataproduct.meta.reftype, readback.meta.reftype) self.assertEqual(self.dataproduct.meta.model_type, readback.meta.model_type) assert_products_equal( self, self.dataproduct, readback, arrays=['data', 'err', 'dq'], # FIXME: removed dq_def until data corruption bug fixed. Bug 589 # tables=['dq_def', 'psf_lut'] ) tables=['psf_lut']) del readback # Check that other variations of the data product can be # written to a FITS file and read back again without changing # the data. a1 = [[10, 20, 30, 40], [50, 60, 70, 80], [90, 100, 110, 120]] aa1 = [a1, a1, a1, a1] b1 = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]] c1 = [[1, 0, 0, 0], [0, 1, 0, 1], [1, 0, 1, 0]] lut_im = [(1.0, 0.0, 0, 0.7, 0.7, 0.4, 0.4), (1.1, 0.0, 1, 0.5, 0.5, 0.2, 0.2), (1.0, 0.0, 2, 0.1, 0.1, 0.8, 0.8), (1.1, 0.0, 3, 0.6, 0.6, 0.1, 0.1)] testproduct = MiriImagingPointSpreadFunctionModel( data=aa1, err=b1, dq=c1, psf_lut=lut_im, psftype='PSF-OOF') testproduct.save(self.testfile, overwrite=True) with MiriImagingPointSpreadFunctionModel( self.testfile) as readback: self.assertEqual(testproduct.meta.reftype, readback.meta.reftype) assert_products_equal( self, testproduct, readback, arrays=['data', 'err', 'dq'], # FIXME: removed dq_def until data corruption bug fixed. Bug 589 # tables=['dq_def', 'psf_lut'] ) tables=['psf_lut']) del readback
def test_fitsio(self): # Suppress metadata warnings with warnings.catch_warnings(): warnings.simplefilter("ignore") # Check that the data product can be written to a FITS # file and read back again without changing the data. self.dataproduct.save(self.testfile, overwrite=True) with MiriResetModel(self.testfile) as readback: assert_products_equal( self, self.dataproduct, readback, arrays=['data', 'err', 'dq']) # FIXME: removed dq_def until data corruption bug fixed. Bug 589 # tables='dq_def' ) del readback
def test_fitsio(self): # Suppress metadata warnings with warnings.catch_warnings(): warnings.simplefilter("ignore") # Check that the data products can be written to a FITS # file and read back again without changing the data. self.dataproduct.save(self.testfile, overwrite=True) with MiriMrsTransmissionCorrectionModel(self.testfile) as readback: assert_products_equal(self, self.dataproduct, readback, arrays=[], tables='tracorr_table') del readback
def test_fitsio(self): # Suppress metadata warnings with warnings.catch_warnings(): warnings.simplefilter("ignore") # Check that the data product can be written to a FITS # file and read back again without changing the data. self.dataproduct.save(self.testfile, overwrite=True) with MiriMrsStraylightModel_CDP3(self.testfile) as readback: # FIXME: The dq_def table is not the same because a single line table is replace by the default. # assert_products_equal( self, self.dataproduct, readback, # arrays=['data'], tables='dq_def' ) assert_products_equal( self, self.dataproduct, readback, arrays=['dq'], tables=[] ) del readback
def test_fitsio(self): # Suppress metadata warnings with warnings.catch_warnings(): warnings.simplefilter("ignore") # Check that the data product can be written to a FITS # file and read back again without changing the data. self.dataproduct.save(self.testfile, overwrite=True) with MiriMrsWavelengthCorrectionModel(self.testfile) as readback: assert_products_equal(self, self.dataproduct, readback, arrays=[], tables=[ 'wavcorr_optical', 'wavcorr_xslice', 'wavcorr_shift' ]) del readback
def test_fitsio(self): # Suppress metadata warnings with warnings.catch_warnings(): warnings.simplefilter("ignore") # Check that the data products can be written to a FITS # file and read back again without changing the data. self.mv_lin.save(self.tempfile1, overwrite=True) with MiriMeasurement(self.tempfile1) as readback1: assert_products_equal(self, self.mv_lin, readback1, arrays=[], tables='measurement_table') del readback1 self.mv_lin.save(self.tempfile2, overwrite=True) with MiriMeasurement(self.tempfile2) as readback2: assert_products_equal(self, self.mv_lin, readback2, arrays=[], tables='measurement_table') del readback2