def test_hpc_frame_to_wcs(): frame = Helioprojective(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] == 'HPLN-TAN' assert result_wcs.wcs.cunit[0] == 'arcsec' assert result_wcs.wcs.dateobs == '2013-10-28T00:00:00.000' new_frame = solar_wcs_frame_mapping(result_wcs) assert isinstance(new_frame.observer, HeliographicStonyhurst) assert new_frame.rsun == frame.rsun # Test a frame with no obstime and no observer frame = Helioprojective() result_wcs = solar_frame_to_wcs_mapping(frame) assert isinstance(result_wcs, WCS) assert result_wcs.wcs.ctype[0] == 'HPLN-TAN' assert result_wcs.wcs.cunit[0] == 'arcsec' assert result_wcs.wcs.dateobs == '' new_frame = solar_wcs_frame_mapping(result_wcs) assert new_frame.observer is None assert new_frame.rsun == frame.rsun
def test_hpc_frame_to_wcs(): frame = Helioprojective(observer="earth", obstime='2013-10-28', rsun=690 * u.Mm) result_wcs = solar_frame_to_wcs_mapping(frame) assert isinstance(result_wcs, WCS) assert result_wcs.wcs.ctype[0] == 'HPLN-TAN' assert result_wcs.wcs.cunit[0] == 'arcsec' assert result_wcs.wcs.dateobs == '2013-10-28T00:00:00.000' assert result_wcs.wcs.aux.rsun_ref == frame.rsun.to_value(u.m) new_frame = solar_wcs_frame_mapping(result_wcs) assert new_frame.rsun == frame.rsun # Test a frame with no obstime and no observer frame = Helioprojective() result_wcs = solar_frame_to_wcs_mapping(frame) assert isinstance(result_wcs, WCS) assert result_wcs.wcs.ctype[0] == 'HPLN-TAN' assert result_wcs.wcs.cunit[0] == 'arcsec' assert result_wcs.wcs.dateobs == '' new_frame = solar_wcs_frame_mapping(result_wcs) assert new_frame.observer is None assert new_frame.rsun == frame.rsun
def test_hgc_frame_to_wcs(): frame = HeliographicCarrington(obstime='2013-10-28') result_wcs = solar_frame_to_wcs_mapping(frame) assert isinstance(result_wcs, WCS) assert result_wcs.wcs.ctype[0] == 'CRLN-TAN' assert result_wcs.wcs.cunit[0] == 'deg' assert result_wcs.wcs.dateobs == '2013-10-28T00:00:00.000' # Test a frame with no obstime frame = HeliographicCarrington() result_wcs = solar_frame_to_wcs_mapping(frame) assert isinstance(result_wcs, WCS) assert result_wcs.wcs.ctype[0] == 'CRLN-TAN' assert result_wcs.wcs.cunit[0] == 'deg' assert result_wcs.wcs.dateobs == ''
def test_self_observer(): frame = HeliographicCarrington(0 * u.deg, 0 * u.deg, 1 * u.au, observer="self", obstime='2013-10-28') wcs = solar_frame_to_wcs_mapping(frame) assert wcs.wcs.aux.hgln_obs is None assert u.allclose(wcs.wcs.aux.hglt_obs, frame.lon.to_value(u.deg)) assert u.allclose(wcs.wcs.aux.crln_obs, frame.lon.to_value(u.deg)) assert u.allclose(wcs.wcs.aux.dsun_obs, frame.radius.to_value(u.m))
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' new_frame = solar_wcs_frame_mapping(result_wcs) assert isinstance(new_frame.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 == '' new_frame = solar_wcs_frame_mapping(result_wcs) assert new_frame.observer is None
def test_hgc_frame_to_wcs(): frame = HeliographicCarrington(obstime='2013-10-28', rsun=690 * u.Mm) result_wcs = solar_frame_to_wcs_mapping(frame) assert isinstance(result_wcs, WCS) assert result_wcs.wcs.ctype[0] == 'CRLN-TAN' assert result_wcs.wcs.cunit[0] == 'deg' assert result_wcs.wcs.dateobs == '2013-10-28T00:00:00.000' assert result_wcs.wcs.aux.rsun_ref == frame.rsun.to_value(u.m) new_frame = solar_wcs_frame_mapping(result_wcs) assert new_frame.rsun == frame.rsun # Test a frame with no obstime frame = HeliographicCarrington() result_wcs = solar_frame_to_wcs_mapping(frame) assert isinstance(result_wcs, WCS) assert result_wcs.wcs.ctype[0] == 'CRLN-TAN' assert result_wcs.wcs.cunit[0] == 'deg' assert result_wcs.wcs.dateobs == ''
def test_non_sunpy_frame_to_wcs(): # For a non-SunPy frame, our mapping should return None frame = BaseCoordinateFrame() assert solar_frame_to_wcs_mapping(frame) is None