def test_pycombine(self): clist = CubeList(self.cubenames) cube, expmap, stat_pix, rejmap = clist.pycombine(header={'FOO': 'BAR'}) cube2, expmap2, stat_pix2, rejmap2 = clist.pycombine( header={'FOO': 'BAR'}, mad=True) assert_array_equal(cube.data, cube2.data) assert_array_equal(expmap.data, expmap2.data) self.assert_header(cube) assert_array_equal(cube.data, self.combined_cube) assert_array_equal(expmap.data, self.expmap) cube = clist.pycombine(nclip=(5., 5.), var='stat_mean')[0] assert_array_equal(cube.data, self.combined_cube)
def test_get_item(self): clist = CubeList(self.cubenames) assert_array_equal(clist[0, 0, 1], self.cubevals) assert_array_equal( np.array([a.data for a in clist[0, :, :]])[:, 0, 1], self.cubevals) assert_array_equal( np.array([a.data for a in clist[0]])[:, 0, 1], self.cubevals)
def test_checks(self): cube = generate_cube(shape=(3, 2, 1)) cube.write(os.path.join(self.tmpdir, 'cube-tmp.fits'), savemask='nan') clist = CubeList(self.cubenames[:1] + [cube.filename]) assert clist.check_dim() is False assert clist.check_wcs() is False cube = generate_cube(shape=self.shape, crval=12.) cube.write(os.path.join(self.tmpdir, 'cube-tmp.fits'), savemask='nan') clist = CubeList(self.cubenames[:1] + [cube.filename]) assert clist.check_dim() is True assert clist.check_wcs() is False
def test_pycombine_scale(self): clist = CubeList(self.cubenames, scalelist=self.scalelist, offsetlist=self.offsetlist) cube2, expmap2, _, _ = clist.pycombine(header={'FOO': 'BAR'}) assert_array_equal(cube2.data, self.scaledcube)
def test_combine_scale(self): clist = CubeList(self.cubenames, scalelist=self.scalelist, offsetlist=self.offsetlist) cube, expmap, stat_pix = clist.combine(header={'FOO': 'BAR'}) assert_array_equal(cube.data, self.scaledcube)
def test_pymedian(self): clist = CubeList(self.cubenames) cube, expmap, stat_pix = clist.pymedian(header={'FOO': 'BAR'}) self.assert_header(cube) assert_array_equal(cube.data, self.arr) assert_array_equal(expmap.data, self.expmap)