示例#1
0
def gal2hor(l, b, time, date_obs=QubicSampling.DEFAULT_DATE_OBS,
            latitude=DOMECLAT, longitude=DOMECLON):
    """
    gal2hor(l, b, time, [date_obs, [latitude, [longitude]]]) -> az, el
    Galactic to horizontal spherical conversion. Angles are in degrees.


    Parameters
    ----------
    time : array-like
        Elapsed time in seconds since date_obs.
    date_obs : string
        The starting date, UTC.
    latitude : float
        The observer's latitude geolocation. Default is Dome C.
    longitude : float
        The observer's longitude geolocation. Default is Dome C.

    Example
    -------
    >>> gal2hor(0, 0, 0)
    (array(50.35837815921487), array(39.212362279976155))

    """
    incoords, time = _format_sphconv(l, b, date_obs, time)
    g2e = SphericalGalactic2EquatorialOperator(degrees=True)
    e2h = SphericalEquatorial2HorizontalOperator(
        'NE', time, latitude, longitude, degrees=True)
    outcoords = e2h(g2e(incoords))
    return outcoords[..., 0], outcoords[..., 1]
示例#2
0
文件: samplings.py 项目: mgiard/qubic
def equ2hor(ra,
            dec,
            time,
            date_obs=QubicSampling.DEFAULT_DATE_OBS,
            latitude=DOMECLAT,
            longitude=DOMECLON):
    """
    equ2hor(ra, dec, time, [date_obs, [latitude, [longitude]]]) -> az, el
    Equatorial to horizontal spherical conversion. Angles are in degrees.

    Parameters
    ----------
    time : array-like
        Elapsed time in seconds since date_obs.
    date_obs : string
        The starting date, UTC.
    latitude : float
        The observer's latitude geolocation. Default is Dome C.
    longitude : float
        The observer's longitude geolocation. Default is Dome C.

    Example
    -------
    >>> equ2hor(0, 0, 0, date_obs='2000-01-01 00:00:00')
    (array(135.71997181016644), array(-10.785386358099927))

    """
    incoords, time = _format_sphconv(ra, dec, date_obs, time)
    outcoords = SphericalEquatorial2HorizontalOperator('NE',
                                                       time,
                                                       latitude,
                                                       longitude,
                                                       degrees=True)(incoords)
    return outcoords[..., 0], outcoords[..., 1]
示例#3
0
def test_sphconv():

    time = Time(QubicSampling.DEFAULT_DATE_OBS, scale='utc')

    def _pack(x):
        return np.array([x[0], x[1]]).T

    sphs = equ2gal, gal2equ, equ2hor, hor2equ, gal2hor, hor2gal
    extraargs = (), (), (0, ), (0, ), (0, ), (0, )
    e2g = SphericalEquatorial2GalacticOperator(degrees=True)
    e2h = SphericalEquatorial2HorizontalOperator('NE',
                                                 time,
                                                 DOMECLAT,
                                                 DOMECLON,
                                                 degrees=True)
    refs = e2g, e2g.I, e2h, e2h.I, e2h(e2g.I), e2g(e2h.I)

    incoords = np.array([[10, 20], [30, 40], [50, 60]])

    def func(sph, extraarg, ref):
        args = (incoords[..., 0], incoords[..., 1]) + extraarg
        outcoords = _pack(sph(*args))
        assert_same(outcoords, ref(incoords), rtol=100)

    for sph, extraarg, ref in zip(sphs, extraargs, refs):
        yield func, sph, extraarg, ref