def test_hpc_hpc(): # Use some unphysical values for solar parameters for testing, to make it # easier to calculate expected results. rsun = 1 * u.m D0 = 1 * u.km L0 = 1 * u.deg observer_in = HeliographicStonyhurst(lat=0 * u.deg, lon=0 * u.deg, radius=D0) observer_out = HeliographicStonyhurst(lat=0 * u.deg, lon=L0, radius=D0) hpc_in = Helioprojective(0 * u.arcsec, 0 * u.arcsec, rsun=rsun, observer=observer_in) hpc_out = Helioprojective(observer=observer_out, rsun=rsun) hpc_new = hpc_in.transform_to(hpc_out) assert hpc_new.observer == hpc_out.observer # Calculate the distance subtended by an angle of L0 from the centre of the # Sun. dd = -1 * rsun * np.tan(L0) # Calculate the angle corresponding to that distance as seen by the new # observer. theta = np.arctan2(dd, (D0 - rsun)) assert quantity_allclose(theta, hpc_new.Tx, rtol=1e-3)
def test_hpc_hpc_null(): hpc_in = Helioprojective(0 * u.arcsec, 0 * u.arcsec) hpc_out = Helioprojective() hpc_new = hpc_in.transform_to(hpc_out) assert hpc_new is not hpc_in assert quantity_allclose(hpc_new.Tx, hpc_in.Tx) assert quantity_allclose(hpc_new.Ty, hpc_in.Ty) assert hpc_out.observer == hpc_new.observer
def test_hpc_hpc_null(): hpc_in = Helioprojective(0*u.arcsec, 0*u.arcsec) hpc_out = Helioprojective() hpc_new = hpc_in.transform_to(hpc_out) assert hpc_new is not hpc_in assert quantity_allclose(hpc_new.Tx, hpc_in.Tx) assert quantity_allclose(hpc_new.Ty, hpc_in.Ty) assert hpc_out.observer == hpc_new.observer
def test_hpc_hcc_different_observer_radius(): # Tests HPC->HCC with a change in observer at different distances from the Sun observer1 = HeliographicStonyhurst(0*u.deg, 0*u.deg, 1*u.AU) hpc = Helioprojective(0*u.arcsec, 0*u.arcsec, 0.5*u.AU, observer=observer1) observer2 = HeliographicStonyhurst(90*u.deg, 0*u.deg, 0.75*u.AU) hcc = hpc.transform_to(Heliocentric(observer=observer2)) assert_quantity_allclose(hcc.x, -0.5*u.AU) assert_quantity_allclose(hcc.y, 0*u.AU, atol=1e-10*u.AU) assert_quantity_allclose(hcc.z, 0*u.AU, atol=1e-10*u.AU)
def test_hpc_hpc(): # Use some unphysical values for solar parameters for testing rsun = 1*u.m D0 = 1*u.km L0 = 1*u.deg hpc_in = Helioprojective(0*u.arcsec, 0*u.arcsec, rsun=rsun, D0=D0) hpc_out = Helioprojective(L0=L0, D0=D0, rsun=rsun) hpc_new = hpc_in.transform_to(hpc_out) assert hpc_new.L0 == hpc_out.L0 assert hpc_new.B0 == hpc_out.B0 assert hpc_new.D0 == hpc_out.D0 # Calculate the distance subtended by an angle of L0 from the centre of the # Sun. dd = -1 * rsun * np.tan(L0) # Calculate the angle corresponding to that distance as seen by the new # observer. theta = np.arctan2(dd, (D0 - rsun)) assert quantity_allclose(theta, hpc_new.Tx, rtol=1e-3)
def test_hpc_hpc(): # Use some unphysical values for solar parameters for testing, to make it # easier to calculate expected results. rsun = 1*u.m D0 = 1*u.km L0 = 1*u.deg observer_in = HeliographicStonyhurst(lat=0*u.deg, lon=0*u.deg, radius=D0) observer_out = HeliographicStonyhurst(lat=0*u.deg, lon=L0, radius=D0) hpc_in = Helioprojective(0*u.arcsec, 0*u.arcsec, rsun=rsun, observer=observer_in) hpc_out = Helioprojective(observer=observer_out, rsun=rsun) hpc_new = hpc_in.transform_to(hpc_out) assert hpc_new.observer == hpc_out.observer # Calculate the distance subtended by an angle of L0 from the centre of the # Sun. dd = -1 * rsun * np.tan(L0) # Calculate the angle corresponding to that distance as seen by the new # observer. theta = np.arctan2(dd, (D0 - rsun)) assert quantity_allclose(theta, hpc_new.Tx, rtol=1e-3)