def test_pixsim_cosmics(self): night = '20150105' expid = 124 camera = 'r0' obs.new_exposure('arc', night=night, expid=expid, nspec=3) pixsim.simulate(night, expid, camera, nspec=3, trimxy=True, cosmics=self.cosmics) self.assertTrue(os.path.exists(io.findfile('simspec', night, expid))) simspec = io.read_simspec(io.findfile('simspec', night, expid)) self.assertTrue(os.path.exists(io.findfile('simpix', night, expid, camera))) self.assertTrue(os.path.exists(io.findfile('pix', night, expid, camera)))
def test_pixsim(self): night = '20150105' expid = 123 camera = 'r0' obs.new_exposure('arc', night=night, expid=expid, nspec=3) pixsim.simulate(night, expid, camera, nspec=3, trimxy=True) self.assertTrue(os.path.exists(io.findfile('simspec', night, expid))) simspec = io.read_simspec(io.findfile('simspec', night, expid)) self.assertTrue( os.path.exists(io.findfile('simpix', night, expid, camera))) self.assertTrue( os.path.exists(io.findfile('pix', night, expid, camera)))
def test_simulate(self): import desispec.image night = self.night expid = self.expid camera = 'r0' nspec = 3 obs.new_exposure('arc', night=night, expid=expid, nspec=nspec) simspec = io.read_simspec(io.findfile('simspec', night, expid)) psf = desimodel.io.load_psf(camera[0]) psf.npix_y, psf.npix_x = self.ccdshape image, rawpix, truepix = pixsim.simulate(camera, simspec, psf, nspec=nspec) self.assertTrue(isinstance(image, desispec.image.Image)) self.assertTrue(isinstance(rawpix, np.ndarray)) self.assertTrue(isinstance(truepix, np.ndarray)) self.assertEqual(image.pix.shape, truepix.shape) self.assertEqual(image.pix.shape[0], rawpix.shape[0]) self.assertLess(image.pix.shape[1], rawpix.shape[1]) #- raw has overscan