コード例 #1
0
ファイル: test_erfa.py プロジェクト: udaymankena/astropy
def test_erfa_wrapper():
    """
    Runs a set of tests that mostly make sure vectorization is
    working as expected
    """

    jd = np.linspace(2456855.5, 2456855.5+1.0/24.0/60.0, 60*2+1)
    ra = np.linspace(0.0, np.pi*2.0, 5)
    dec = np.linspace(-np.pi/2.0, np.pi/2.0, 4)

    aob, zob, hob, dob, rob, eo = erfa.atco13(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, jd, 0.0, 0.0, 0.0, np.pi/4.0, 0.0, 0.0, 0.0, 1014.0, 0.0, 0.0, 0.5)
    assert aob.shape == (121,)

    aob, zob, hob, dob, rob, eo = erfa.atco13(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, jd[0], 0.0, 0.0, 0.0, np.pi/4.0, 0.0, 0.0, 0.0, 1014.0, 0.0, 0.0, 0.5)
    assert aob.shape == ()

    aob, zob, hob, dob, rob, eo = erfa.atco13(ra[:, None, None], dec[None, :, None], 0.0, 0.0, 0.0, 0.0, jd[None, None, :], 0.0, 0.0, 0.0, np.pi/4.0, 0.0, 0.0, 0.0, 1014.0, 0.0, 0.0, 0.5)
    (aob.shape) == (5, 4, 121)

    iy, im, id, ihmsf = erfa.d2dtf("UTC", 3, jd, 0.0)
    assert iy.shape == (121,)
    assert ihmsf.shape == (121,)
    assert ihmsf.dtype == erfa.dt_hmsf

    iy, im, id, ihmsf = erfa.d2dtf("UTC", 3, jd[0], 0.0)
    assert iy.shape == ()
    assert ihmsf.shape == ()
    assert ihmsf.dtype == erfa.dt_hmsf
コード例 #2
0
ファイル: hipparcos.py プロジェクト: sayitfast/MountWizzard4
    def calculateAlignStarPositionsAltAz(self):
        """
        calculateAlignStarPositionsAltAz does calculate the star coordinates from give data
        out of generated star list. calculation routines are from astropy erfa. atco13 does
        the results based on proper motion, parallax and radial velocity and need J2000
        coordinates. because of using the hipparcos catalogue, which is based on J1991,
        25 epoch the pre calculation from J1991,25 to J2000 is done already when generating
        the alignstars file. there is no refraction data taken into account, because we need
        this only for display purpose and for this, the accuracy is more than sufficient.

        :return: lists for alt, az and name of star
        """

        location = self.app.mount.obsSite.location
        if location is None:
            return False
        t = self.app.mount.obsSite.timeJD
        star = list(self.alignStars.values())
        self.name = list(self.alignStars.keys())

        aob, zob, hob, dob, rob, eo = erfa.atco13(
            [x[0] for x in star], [x[1] for x in star], [x[2] for x in star],
            [x[3] for x in star], [x[4] for x in star], [x[5]
                                                         for x in star], t.ut1,
            0.0, t.dut1, location.longitude.radians, location.latitude.radians,
            location.elevation.m, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        self.az = aob * 360 / 2 / np.pi
        self.alt = 90.0 - zob * 360 / 2 / np.pi
        return True
コード例 #3
0
ファイル: transform.py プロジェクト: sayitfast/MountWizzard4
def J2000ToAltAz(ra, dec, timeJD, location):
    """

    :param ra:
    :param dec:
    :param timeJD:
    :param location:
    :return:
    """

    if not isinstance(ra, Angle):
        return Angle(degrees=0), Angle(degrees=0)
    if not isinstance(dec, Angle):
        return Angle(degrees=0), Angle(degrees=0)

    with _lock:
        ra = ra.radians
        dec = dec.radians
        lat = location.latitude.radians
        lon = location.longitude.radians
        elevation = location.elevation.m

        aob, zob, hob, dob, rob, eo = ERFA.atco13(ra,
                                                  dec,
                                                  0.0,
                                                  0.0,
                                                  0.0,
                                                  0.0,
                                                  timeJD.ut1,
                                                  0.0,
                                                  0,
                                                  lon,
                                                  lat,
                                                  elevation,
                                                  0.0,
                                                  0.0,
                                                  0.0,
                                                  0.0,
                                                  0.0,
                                                  0.0)
        decConv = np.pi / 2 - zob

        ra = Angle(radians=aob, preference='degrees')
        dec = Angle(radians=decConv, preference='degrees')
        return ra, dec