예제 #1
0
    def test_galaxy_astrometry_degrees(self):
        """
        Test that we can go from raPhoSim, decPhoSim to ICRS coordinates
        in the case of galaxies (in degrees)
        """
        db = testGalaxyDiskDBObj(driver='sqlite', database=self.db_name)
        cat = GalaxyTestCatalog(db, obs_metadata=self.obs)
        with lsst.utils.tests.getTempFilePath('.txt') as cat_name:
            cat.write_catalog(cat_name)
            dtype = np.dtype([('raICRS', float), ('decICRS', float),
                              ('raPhoSim', float), ('decPhoSim', float)])
            data = np.genfromtxt(cat_name, dtype=dtype)
        self.assertGreater(len(data), 100)

        # verify that, when transforming back to ICRS, we are within
        # 10^-3 arcsec
        ra_icrs, dec_icrs = PhoSimAstrometryBase.icrsFromPhoSim(
            data['raPhoSim'], data['decPhoSim'], self.obs)
        dist = angularSeparation(data['raICRS'], data['decICRS'], ra_icrs,
                                 dec_icrs)

        dist = 3600.0 * dist
        self.assertLess(dist.max(), 0.001)

        # verify that the distance between raPhoSim, decPhoSim and
        # raICRS, decICRS is greater than the distance between
        # the original raICRS, decICRS and the newly-calculated
        # raICRS, decICRS
        dist_bad = angularSeparation(data['raPhoSim'], data['decPhoSim'],
                                     data['raICRS'], data['decICRS'])

        dist_bad = 3600.0 * dist_bad
        self.assertGreater(dist_bad.min(), dist.max())

        del db
예제 #2
0
    def test_stellar_astrometry_degrees(self):
        """
        Test that we can go from raPhoSim, decPhoSim to ICRS coordinates
        in the case of stars (in degrees)
        """
        cat_name = os.path.join(self.scratch_dir,
                                'phosim_ast_star_cat_deg.txt')
        if os.path.exists(cat_name):
            os.unlink(cat_name)

        db = testStarsDBObj(driver='sqlite', database=self.db_name)
        cat = StarTestCatalog(db, obs_metadata=self.obs)
        cat.write_catalog(cat_name)
        dtype = np.dtype([('raICRS', float), ('decICRS', float),
                          ('raPhoSim', float), ('decPhoSim', float)])
        data = np.genfromtxt(cat_name, dtype=dtype)
        self.assertGreater(len(data), 100)

        # verify that, when transforming back to ICRS, we are within
        # 10^-3 arcsec
        ra_icrs, dec_icrs = PhoSimAstrometryBase.icrsFromPhoSim(
            data['raPhoSim'], data['decPhoSim'], self.obs)
        dist = angularSeparation(data['raICRS'], data['decICRS'], ra_icrs,
                                 dec_icrs)

        dist = 3600.0 * dist
        self.assertLess(dist.max(), 0.001)

        # verify that the distance between raPhoSim, decPhoSim and
        # raICRS, decICRS is greater than the distance between
        # the original raICRS, decICRS and the newly-calculated
        # raICRS, decICRS
        dist_bad = angularSeparation(data['raPhoSim'], data['decPhoSim'],
                                     data['raICRS'], data['decICRS'])

        dist_bad = 3600.0 * dist_bad
        self.assertGreater(dist_bad.min(), dist.max())

        if os.path.exists(cat_name):
            os.unlink(cat_name)
        del db
예제 #3
0
    def test_stellar_astrometry_degrees(self):
        """
        Test that we can go from raPhoSim, decPhoSim to ICRS coordinates
        in the case of stars (in degrees)
        """
        db = testStarsDBObj(driver='sqlite', database=self.db_name)
        cat = StarTestCatalog(db, obs_metadata=self.obs)
        with lsst.utils.tests.getTempFilePath('.txt') as cat_name:
            cat.write_catalog(cat_name)
            dtype = np.dtype([('raICRS', float), ('decICRS', float),
                             ('raPhoSim', float), ('decPhoSim', float),
                             ('raJ2000', float), ('decJ2000', float),
                             ('pmRA', float), ('pmDec', float),
                             ('parallax', float), ('vRad', float)])
            data = np.genfromtxt(cat_name, dtype=dtype)
        self.assertGreater(len(data), 100)

        # verify that, when transforming back to ICRS, we are within
        # 10^-3 arcsec
        ra_icrs, dec_icrs = PhoSimAstrometryBase.icrsFromPhoSim(data['raPhoSim'],
                                                                data['decPhoSim'],
                                                                self.obs)
        dist = angularSeparation(data['raICRS'], data['decICRS'],
                                 ra_icrs, dec_icrs)

        dist = 3600.0*dist
        self.assertLess(dist.max(), 0.001)

        # verify that the distance between raPhoSim, decPhoSim and
        # raICRS, decICRS is greater than the distance between
        # the original raICRS, decICRS and the newly-calculated
        # raICRS, decICRS
        dist_bad = angularSeparation(data['raPhoSim'], data['decPhoSim'],
                                     data['raICRS'], data['decICRS'])

        dist_bad = 3600.0*dist_bad
        self.assertGreater(dist_bad.min(), dist.max())

        del db