Exemplo n.º 1
0
    def testGalaxyAndStarCatalog(self):
        """
        Test GalaxyTileCompoundObj by creating a catalog of galaxy bulges, disks,
        agns, and stars using both the 'old fashioned way' (one catalog at a time), and
        using CompoundInstanceCatalog
        """
        controlFileName = os.path.join(self.baseDir, 'galStar_compound_control.txt')
        testFileName = os.path.join(self.baseDir, 'galStar_compound_test.txt')

        if os.path.exists(controlFileName):
            os.unlink(controlFileName)
        if os.path.exists(testFileName):
            os.unlink(testFileName)

        obs = ObservationMetaData(pointingRA=25.0, pointingDec=-45.0,
                                  boundType='circle', boundLength=0.05)

        dbBulge = GalaxyBulgeObj()
        dbDisk = GalaxyDiskObj()
        dbAgn = GalaxyAgnObj()
        dbStar = StarObj()

        catBulge = BulgeDiskCatalog(dbBulge, obs_metadata=obs)
        catDisk = BulgeDiskCatalog(dbDisk, obs_metadata=obs)
        catAgn = AgnCatalog(dbAgn, obs_metadata=obs)
        catStar = StarCatalog(dbStar, obs_metadata=obs)

        catBulge.write_catalog(controlFileName, write_header=False, chunk_size=10000)
        catDisk.write_catalog(controlFileName, write_mode='a', write_header=False, chunk_size=10000)
        catAgn.write_catalog(controlFileName, write_mode='a', write_header=False, chunk_size=10000)
        catStar.write_catalog(controlFileName, write_mode='a', write_header=False, chunk_size=10000)

        totalCat = CompoundInstanceCatalog([BulgeDiskCatalog, BulgeDiskCatalog, StarCatalog, AgnCatalog],
                                           [GalaxyBulgeObj, GalaxyDiskObj, StarObj, GalaxyAgnObj],
                                           obs_metadata=obs,
                                           compoundDBclass=GalaxyTileCompoundObj)

        totalCat.write_catalog(testFileName, write_header=False, chunk_size=10000)

        with open(controlFileName, 'r') as controlFile:
            control = controlFile.readlines()

        with open(testFileName, 'r') as testFile:
            test = testFile.readlines()

        for line in control:
            self.assertIn(line, test)

        for line in test:
            self.assertIn(line, control)
Exemplo n.º 2
0
    from lsst.sims.catUtils.exampleCatalogDefinitions import PhoSimCatalogZPoint
    from lsst.sims.catUtils.exampleCatalogDefinitions import DefaultPhoSimHeaderMap
    from lsst.sims.catUtils.baseCatalogModels import StarObj
    from lsst.sims.catUtils.baseCatalogModels import GalaxyBulgeObj, GalaxyDiskObj
    from lsst.sims.catUtils.baseCatalogModels import GalaxyAgnObj
    from lsst.sims.utils import _getRotSkyPos
    import copy

    star_db = StarObj(database='LSSTCATSIM',
                      host='fatboy.phys.washington.edu',
                      port=1433,
                      driver='mssql+pymssql')

    bulge_db = GalaxyBulgeObj(connection=star_db.connection)
    disk_db = GalaxyDiskObj(connection=star_db.connection)
    agn_db = GalaxyAgnObj(connection=star_db.connection)

    if not os.path.exists(out_dir):
        os.mkdir(out_dir)

    phosim_header_map = copy.deepcopy(DefaultPhoSimHeaderMap)
    phosim_header_map['nsnap'] = 1
    phosim_header_map['vistime'] = 30.0
    phosim_header_map['camconfig'] = 1
    for obshistid in obshistid_list:

        obs_list = obs_generator.getObservationMetaData(obsHistID=obshistid,
                                                        boundType='circle',
                                                        boundLength=args.fov)

        obs = obs_list[0]
Exemplo n.º 3
0
 def _final_pass(self, results):
     GalaxyAgnObj._final_pass(self, results)
     sp = sprinkler(results)
     results = sp.sprinkle()
     return results