Beispiel #1
0
def test_hcc_hgs_observer_mismatch():
    # Test whether the transformation gives the same answer regardless of what obstime the observer
    # coordinate is represented in
    observer1 = HeliographicStonyhurst(0 * u.deg,
                                       0 * u.deg,
                                       1 * u.AU,
                                       obstime='2001-01-01')
    observer2 = observer1.transform_to(
        HeliographicStonyhurst(obstime='2001-03-31'))

    hcc1 = Heliocentric(0.2 * u.AU,
                        0.3 * u.AU,
                        0.4 * u.AU,
                        observer=observer1,
                        obstime=observer1.obstime)
    hgs1 = hcc1.transform_to(HeliographicStonyhurst(obstime=hcc1.obstime))

    hcc2 = Heliocentric(0.2 * u.AU,
                        0.3 * u.AU,
                        0.4 * u.AU,
                        observer=observer2,
                        obstime=observer1.obstime)
    hgs2 = hcc2.transform_to(HeliographicStonyhurst(obstime=hcc2.obstime))

    assert_quantity_allclose(hgs1.lon, hgs2.lon)
    assert_quantity_allclose(hgs1.lat, hgs2.lat)
    assert_quantity_allclose(hgs1.radius, hgs2.radius)
Beispiel #2
0
def test_hcc_hcc():
    # Test same observer and changing obstime
    observer = HeliographicStonyhurst(0 * u.deg,
                                      0 * u.deg,
                                      1 * u.AU,
                                      obstime='2001-02-01')
    from_hcc = Heliocentric(0.2 * u.AU,
                            0.3 * u.AU,
                            0.4 * u.AU,
                            observer=observer,
                            obstime='2001-01-01')
    to_hcc = from_hcc.transform_to(
        Heliocentric(observer=observer, obstime='2001-03-31'))

    # Since the observer is the same, the coordinates should be nearly the same but not exactly
    # equal due to motion of the origin (the Sun)
    assert np.all(from_hcc.cartesian.xyz != to_hcc.cartesian.xyz)
    assert_quantity_allclose(from_hcc.cartesian.xyz,
                             to_hcc.cartesian.xyz,
                             rtol=2e-3)

    # Test changing observer and same obstime
    observer1 = HeliographicStonyhurst(0 * u.deg,
                                       0 * u.deg,
                                       1 * u.AU,
                                       obstime='2001-01-01')
    observer2 = HeliographicStonyhurst(0 * u.deg,
                                       0 * u.deg,
                                       1 * u.AU,
                                       obstime='2001-03-31')
    from_hcc = Heliocentric(0.2 * u.AU,
                            0.3 * u.AU,
                            0.4 * u.AU,
                            observer=observer1,
                            obstime='2001-02-01')
    to_hcc = from_hcc.transform_to(
        Heliocentric(observer=observer2, obstime='2001-02-01'))

    # This change in observer is approximately a 90-degree rotation about the Y axis
    assert_quantity_allclose(to_hcc.x, -from_hcc.z, rtol=2e-3)
    assert_quantity_allclose(to_hcc.y, from_hcc.y, rtol=2e-3)
    assert_quantity_allclose(to_hcc.z, from_hcc.x, rtol=2e-3)
def test_hcc_to_hgs():
    '''
    Check that a coordinate pointing to the observer in Heliocentric
    coordinates maps to the lattitude/longitude of the observer in
    HeliographicStonyhurst coordinates.
    '''
    lat = 10 * u.deg
    lon = 20 * u.deg
    observer = HeliographicStonyhurst(lat=lat, lon=lon)
    hcc_in = Heliocentric(x=0*u.km, y=0*u.km, z=1*u.km, observer=observer)
    hgs_out = hcc_in.transform_to(HeliographicStonyhurst)

    assert_quantity_allclose(hgs_out.lat, lat)
    assert_quantity_allclose(hgs_out.lon, lon)
def test_hcc_to_hgs():
    '''
    Check that a coordinate pointing to the observer in Heliocentric
    coordinates maps to the lattitude/longitude of the observer in
    HeliographicStonyhurst coordinates.
    '''
    lat = 10 * u.deg
    lon = 20 * u.deg
    observer = HeliographicStonyhurst(lat=lat, lon=lon)
    hcc_in = Heliocentric(x=0*u.km, y=0*u.km, z=1*u.km, observer=observer)
    hgs_out = hcc_in.transform_to(HeliographicStonyhurst)

    assert_quantity_allclose(hgs_out.lat, lat)
    assert_quantity_allclose(hgs_out.lon, lon)