def setUp(self):
     self.tempDB = os.path.join(self.scratch_dir, 'PhoSimTestDatabase.db')
     self.obs_metadata = makePhoSimTestDB(size=10, filename=self.tempDB)
     self.bulgeDB = testGalaxyBulgeDBObj(driver='sqlite',
                                         database=self.tempDB)
     self.diskDB = testGalaxyDiskDBObj(driver='sqlite',
                                       database=self.tempDB)
     self.agnDB = testGalaxyAgnDBObj(driver='sqlite', database=self.tempDB)
     self.starDB = testStarsDBObj(driver='sqlite', database=self.tempDB)
     filter_translation = {'u': 0, 'g': 1, 'r': 2, 'i': 3, 'z': 4, 'y': 5}
     alt, az, pa = altAzPaFromRaDec(self.obs_metadata.pointingRA,
                                    self.obs_metadata.pointingDec,
                                    self.obs_metadata,
                                    includeRefraction=False)
     self.control_header = [
         'moondec %.7f\n' %
         np.degrees(self.obs_metadata.OpsimMetaData['moondec']),
         'rottelpos %.7f\n' %
         np.degrees(self.obs_metadata.OpsimMetaData['rottelpos']),
         'declination %.17f\n' % self.obs_metadata.pointingDec,
         'moonalt %.7f\n' %
         np.degrees(self.obs_metadata.OpsimMetaData['moonalt']),
         'rotskypos %.17f\n' % self.obs_metadata.rotSkyPos,
         'moonra %.7f\n' %
         np.degrees(self.obs_metadata.OpsimMetaData['moonra']),
         'sunalt %.7f\n' %
         np.degrees(self.obs_metadata.OpsimMetaData['sunalt']),
         'mjd %.17f\n' % (self.obs_metadata.mjd.TAI + 16.5 / 86400.0),
         'azimuth %.17f\n' % az,
         'rightascension %.17f\n' % self.obs_metadata.pointingRA,
         'dist2moon %.7f\n' %
         np.degrees(self.obs_metadata.OpsimMetaData['dist2moon']),
         'filter %d\n' % filter_translation[self.obs_metadata.bandpass],
         'altitude %.17f\n' % alt
     ]
 def setUp(self):
     self.obs_metadata = makePhoSimTestDB(size=10)
     self.bulgeDB = testGalaxyBulgeDBObj(driver='sqlite', database='PhoSimTestDatabase.db')
     self.diskDB = testGalaxyDiskDBObj(driver='sqlite', database='PhoSimTestDatabase.db')
     self.agnDB = testGalaxyAgnDBObj(driver='sqlite', database='PhoSimTestDatabase.db')
     self.starDB = testStarsDBObj(driver='sqlite', database='PhoSimTestDatabase.db')
     baseLineFileName = lsst.utils.getPackageDir('sims_catUtils')+'/tests/testData/phoSimControlCatalog.txt'
     self.baseLineFile = open(baseLineFileName,'r')
    def setUpClass(cls):
        cls.dbName = tempfile.mktemp(dir=ROOT, prefix='PhoSimVariabilityDatabase-', suffix='.db')
        cls.obs_metadata = makePhoSimTestDB(size=10, filename=cls.dbName)
        cls.obs_metadata.mjd = ModifiedJulianDate(TAI=60000.0)

        cls.bulgeDB = testGalaxyBulgeDBObj(driver='sqlite', database=cls.dbName)
        cls.diskDB = testGalaxyDiskDBObj(driver='sqlite', database=cls.dbName)
        cls.agnDB = testGalaxyAgnDBObj(driver='sqlite', database=cls.dbName)
        cls.starDB = testStarsDBObj(driver='sqlite', database=cls.dbName)
    def setUp(cls):
        cls.dbName = 'PhoSimVariabilityDatabase.db'
        if os.path.exists(cls.dbName):
            os.unlink(cls.dbName)

        cls.obs_metadata = makePhoSimTestDB(size=10, filename=cls.dbName)

        cls.bulgeDB = testGalaxyBulgeDBObj(driver='sqlite', database=cls.dbName)
        cls.diskDB = testGalaxyDiskDBObj(driver='sqlite', database=cls.dbName)
        cls.agnDB = testGalaxyAgnDBObj(driver='sqlite', database=cls.dbName)
        cls.starDB = testStarsDBObj(driver='sqlite', database=cls.dbName)
Beispiel #5
0
 def testAgns(self):
     """
     Test that GalSimInterpreter puts the right number of counts on images of AGN
     """
     catName = os.path.join(self.scratch_dir, 'testAgnCat.sav')
     agn = testGalaxyAgnDBObj(driver=self.driver, database=self.dbName)
     cat = testAgnCatalog(agn, obs_metadata=self.obs_metadata)
     cat.write_catalog(catName)
     self.catalogTester(catName=catName, catalog=cat, nameRoot='agn')
     if os.path.exists(catName):
         os.unlink(catName)
 def testAgns(self):
     """
     Test that GalSimInterpreter puts the right number of counts on images of AGN
     """
     catName = 'testAgnCat.sav'
     agn = testGalaxyAgnDBObj(driver=self.driver, database=self.dbName)
     cat = testAgnCatalog(agn, obs_metadata = self.obs_metadata)
     cat.write_catalog(catName)
     self.catalogTester(catName=catName, catalog=cat, nameRoot='agn')
     if os.path.exists(catName):
         os.unlink(catName)
 def setUp(self):
     self.obs_metadata = makePhoSimTestDB(size=10)
     self.bulgeDB = testGalaxyBulgeDBObj(driver='sqlite', database='PhoSimTestDatabase.db')
     self.diskDB = testGalaxyDiskDBObj(driver='sqlite', database='PhoSimTestDatabase.db')
     self.agnDB = testGalaxyAgnDBObj(driver='sqlite', database='PhoSimTestDatabase.db')
     self.starDB = testStarsDBObj(driver='sqlite', database='PhoSimTestDatabase.db')
     filter_translation={'u':0,'g':1, 'r':2, 'i':3, 'z':4, 'y':5}
     self.control_header = ['Opsim_moondec %.9g\n' % numpy.degrees(self.obs_metadata.phoSimMetaData['Opsim_moondec'][0]),
                           'Opsim_rottelpos %.9g\n' % numpy.degrees(self.obs_metadata.phoSimMetaData['Opsim_rottelpos'][0]),
                           'Unrefracted_Dec %.9g\n' % numpy.degrees(self.obs_metadata.phoSimMetaData['pointingDec'][0]),
                           'Opsim_moonalt %.9g\n' % numpy.degrees(self.obs_metadata.phoSimMetaData['Opsim_moonalt'][0]),
                           'Opsim_rotskypos %.9g\n' % numpy.degrees(self.obs_metadata.phoSimMetaData['Opsim_rotskypos'][0]),
                           'Opsim_moonra %.9g\n' % numpy.degrees(self.obs_metadata.phoSimMetaData['Opsim_moonra'][0]),
                           'Opsim_sunalt %.9g\n' % numpy.degrees(self.obs_metadata.phoSimMetaData['Opsim_sunalt'][0]),
                           'Opsim_expmjd %.9g\n' % self.obs_metadata.phoSimMetaData['Opsim_expmjd'][0],
                           'Unrefracted_Azimuth %.9g\n' % numpy.degrees(self.obs_metadata.phoSimMetaData['Unrefracted_Azimuth'][0]),
                           'Unrefracted_RA %.9g\n' % numpy.degrees(self.obs_metadata.phoSimMetaData['pointingRA'][0]),
                           'Opsim_dist2moon %.9g\n' % numpy.degrees(self.obs_metadata.phoSimMetaData['Opsim_dist2moon'][0]),
                           'Opsim_filter %d\n' % filter_translation[self.obs_metadata.phoSimMetaData['Opsim_filter'][0]],
                           'Unrefracted_Altitude %.9g\n' % numpy.degrees(self.obs_metadata.phoSimMetaData['Unrefracted_Altitude'][0])]
 def setUp(self):
     self.tempDB = os.path.join(self.scratch_dir, 'PhoSimTestDatabase.db')
     self.obs_metadata = makePhoSimTestDB(size=10, filename=self.tempDB)
     self.bulgeDB = testGalaxyBulgeDBObj(driver='sqlite', database=self.tempDB)
     self.diskDB = testGalaxyDiskDBObj(driver='sqlite', database=self.tempDB)
     self.agnDB = testGalaxyAgnDBObj(driver='sqlite', database=self.tempDB)
     self.starDB = testStarsDBObj(driver='sqlite', database=self.tempDB)
     filter_translation = {'u': 0, 'g': 1, 'r': 2, 'i': 3, 'z': 4, 'y': 5}
     alt, az, pa = altAzPaFromRaDec(self.obs_metadata.pointingRA,
                                    self.obs_metadata.pointingDec,
                                    self.obs_metadata, includeRefraction=False)
     self.control_header = ['moondec %.7f\n' % np.degrees(self.obs_metadata.OpsimMetaData['moondec']),
                            'rottelpos %.7f\n' % np.degrees(self.obs_metadata.OpsimMetaData['rottelpos']),
                            'declination %.17f\n' % self.obs_metadata.pointingDec,
                            'moonalt %.7f\n' % np.degrees(self.obs_metadata.OpsimMetaData['moonalt']),
                            'rotskypos %.17f\n' % self.obs_metadata.rotSkyPos,
                            'moonra %.7f\n' % np.degrees(self.obs_metadata.OpsimMetaData['moonra']),
                            'sunalt %.7f\n' % np.degrees(self.obs_metadata.OpsimMetaData['sunalt']),
                            'mjd %.17f\n' % (self.obs_metadata.mjd.TAI+16.5/86400.0),
                            'azimuth %.17f\n' % az,
                            'rightascension %.17f\n' % self.obs_metadata.pointingRA,
                            'dist2moon %.7f\n' % np.degrees(self.obs_metadata.OpsimMetaData['dist2moon']),
                            'filter %d\n' % filter_translation[self.obs_metadata.bandpass],
                            'altitude %.17f\n' % alt]