def test_copy(self): # Test that a copy can be made of the data product. datacopy = self.dataproduct.copy() self.assertIsNotNone(datacopy.finejump_table) self.assertEqual( len(self.dataproduct.finejump_table), len(datacopy.finejump_table) ) table1 = np.asarray(self.dataproduct.finejump_table) table2 = np.asarray(datacopy.finejump_table) assert_recarray_equal(table1, table2) del datacopy
def test_copy(self): # Test that a copy can be made of the data product. # This will generate a warning. with warnings.catch_warnings(): warnings.simplefilter("ignore") datacopy = self.dataproduct.copy() self.assertIsNotNone(datacopy.phot_table) self.assertEqual(len(self.dataproduct.phot_table), len(datacopy.phot_table)) table1 = np.asarray(self.dataproduct.phot_table) table2 = np.asarray(datacopy.phot_table) assert_recarray_equal(table1, table2) 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 MiriPhotometricModel(self.testfile) as readback: self.assertIsNotNone(readback.phot_table) self.assertEqual(len(self.dataproduct.phot_table), len(readback.phot_table)) original = np.asarray(self.dataproduct.phot_table) duplicate = np.asarray(readback.phot_table) assert_recarray_equal(original, duplicate) del readback
def test_copy(self): # Test that a copy can be made of the data product. # This will generate a warning. with warnings.catch_warnings(): warnings.simplefilter("ignore") datacopy = self.dataproduct.copy() self.assertIsNotNone(datacopy) self.assertIsNotNone(datacopy.latent1) self.assertEqual(len(self.dataproduct.latent1), len(datacopy.latent1)) tableA = np.asarray(self.dataproduct.latent1) tableB = np.asarray(datacopy.latent1) assert_recarray_equal(tableA, tableB) self.assertIsNotNone(datacopy.latent2) self.assertEqual(len(self.dataproduct.latent2), len(datacopy.latent2)) tableA = np.asarray(self.dataproduct.latent2) tableB = np.asarray(datacopy.latent2) assert_recarray_equal(tableA, tableB) del datacopy
def test_copy(self): # Test that a copy can be made of the data product. datacopy = self.dataproduct.copy() self.assertIsNotNone(datacopy) self.assertTrue( np.allclose(self.dataproduct.slicenumber, datacopy.slicenumber)) table1 = np.asarray(self.dataproduct.fov_ch3) table2 = np.asarray(datacopy.fov_ch3) assert_recarray_equal(table1, table2) table1 = np.asarray(self.dataproduct.fov_ch4) table2 = np.asarray(datacopy.fov_ch4) assert_recarray_equal(table1, table2) table1 = np.asarray(self.dataproduct.alpha_ch3) table2 = np.asarray(datacopy.alpha_ch3) assert_recarray_equal(table1, table2) table1 = np.asarray(self.dataproduct.lambda_ch3) table2 = np.asarray(datacopy.lambda_ch3) assert_recarray_equal(table1, table2) table1 = np.asarray(self.dataproduct.alpha_ch4) table2 = np.asarray(datacopy.alpha_ch4) assert_recarray_equal(table1, table2) table1 = np.asarray(self.dataproduct.lambda_ch4) table2 = np.asarray(datacopy.lambda_ch4) assert_recarray_equal(table1, table2) table1 = np.asarray(self.dataproduct.x_ch3) table2 = np.asarray(datacopy.x_ch3) assert_recarray_equal(table1, table2) table1 = np.asarray(self.dataproduct.y_ch3) table2 = np.asarray(datacopy.y_ch3) assert_recarray_equal(table1, table2) table1 = np.asarray(self.dataproduct.x_ch4) table2 = np.asarray(datacopy.x_ch4) assert_recarray_equal(table1, table2) table1 = np.asarray(self.dataproduct.y_ch4) table2 = np.asarray(datacopy.y_ch4) assert_recarray_equal(table1, table2) table1 = np.asarray(self.dataproduct.albe_to_xanyan) table2 = np.asarray(datacopy.albe_to_xanyan) assert_recarray_equal(table1, table2) table1 = np.asarray(self.dataproduct.xanyan_to_albe) table2 = np.asarray(datacopy.xanyan_to_albe) assert_recarray_equal(table1, table2) del datacopy