def test_heliocentric_radial_psi(x, y, psi): # The cylindrical representation of HCC is Heliocentric Radial # Test that the `psi` component is represented as desired # The definition is shifted by 90 degrees relative to Thompson (2006) hcc = Heliocentric(CartesianRepresentation(x, y, 0*u.km), representation_type='cylindrical') assert_quantity_allclose(hcc.psi, psi)
def test_hcc_frame_to_wcs(): frame = Heliocentric(obstime='2013-10-28') result_wcs = solar_frame_to_wcs_mapping(frame) assert isinstance(result_wcs, WCS) assert result_wcs.wcs.ctype[0] == 'SOLX'
def test_hcc_frame_to_wcs(): frame = Heliocentric(observer="earth", obstime='2013-10-28') result_wcs = solar_frame_to_wcs_mapping(frame) assert isinstance(result_wcs, WCS) assert result_wcs.wcs.ctype[0] == 'SOLX' assert result_wcs.wcs.dateobs == '2013-10-28T00:00:00.000' assert isinstance(result_wcs.heliographic_observer, HeliographicStonyhurst) # Test a frame with no obstime and no observer frame = Heliocentric() result_wcs = solar_frame_to_wcs_mapping(frame) assert isinstance(result_wcs, WCS) assert result_wcs.wcs.ctype[0] == 'SOLX' assert result_wcs.wcs.dateobs == '' assert result_wcs.heliographic_observer is None
def test_hcc_default_observer(): # Observer is considered default if it hasn't been specified *and* if obstime isn't specified hcc = Heliocentric(0*u.AU, 0*u.AU, 0*u.AU) assert hcc.is_frame_attr_default('observer') hcc = Heliocentric(0*u.AU, 0*u.AU, 0*u.AU, obstime='2019-06-01') assert not hcc.is_frame_attr_default('observer')
def test_set_wcs_aux(): wcs = WCS(naxis=2) observer = Helioprojective(observer="earth", obstime='2013-10-28').observer _set_wcs_aux_obs_coord(wcs, observer) assert wcs.wcs.aux.hgln_obs == 0 assert u.allclose(wcs.wcs.aux.hglt_obs, 4.7711570596394015) assert u.allclose(wcs.wcs.aux.dsun_obs, 148644585949.4918) assert wcs.wcs.aux.crln_obs is None wcs = WCS(naxis=2) observer = observer.transform_to(HeliographicCarrington(observer=observer)) _set_wcs_aux_obs_coord(wcs, observer) assert wcs.wcs.aux.hgln_obs is None assert u.allclose(wcs.wcs.aux.hglt_obs, 4.7711570596394015) assert u.allclose(wcs.wcs.aux.dsun_obs, 148644585949.4918) assert u.allclose(wcs.wcs.aux.crln_obs, 326.05139910339886) observer = observer.transform_to(Heliocentric(observer=observer)) with pytest.raises(ValueError, match='obs_coord must be in a Stonyhurst or Carrington frame'): _set_wcs_aux_obs_coord(wcs, observer)