celestial_frame_to_wcs#
- astropy.wcs.utils.celestial_frame_to_wcs(frame, projection='TAN')[源代码]#
对于给定的坐标系,返回相应的WCS对象。
请注意,返回的WCS对象只有对应于坐标系集合的元素(例如ctype、equinox、radesys)。
- 参数:
- frame :
BaseCoordinateFrame子类实例BaseCoordinateFrame子类实例 对象的一个实例
BaseCoordinateFrame要查找其WCS的子类实例- projection :
strPython :字符串 ctype中使用的投影代码(如果适用)
- frame :
- 返回:
- wcs :
WCS实例WCS实例 对应的WCS对象
- wcs :
笔记
要将此函数扩展到未在AXTYPY中定义的帧,您可以编写自己的函数,该函数应采用
BaseCoordinateFrame子类实例和投影(以字符串形式给出),并应返回WCS实例或None如果无法确定WCS。您可以使用::临时注册此函数>>> from astropy.wcs.utils import celestial_frame_to_wcs, custom_frame_to_wcs_mappings >>> with custom_frame_to_wcs_mappings(my_function): ... celestial_frame_to_wcs(...)
实例
>>> from astropy.wcs.utils import celestial_frame_to_wcs >>> from astropy.coordinates import FK5 >>> frame = FK5(equinox='J2010') >>> wcs = celestial_frame_to_wcs(frame) >>> wcs.to_header() WCSAXES = 2 / Number of coordinate axes CRPIX1 = 0.0 / Pixel coordinate of reference point CRPIX2 = 0.0 / Pixel coordinate of reference point CDELT1 = 1.0 / [deg] Coordinate increment at reference point CDELT2 = 1.0 / [deg] Coordinate increment at reference point CUNIT1 = 'deg' / Units of coordinate increment and value CUNIT2 = 'deg' / Units of coordinate increment and value CTYPE1 = 'RA---TAN' / Right ascension, gnomonic projection CTYPE2 = 'DEC--TAN' / Declination, gnomonic projection CRVAL1 = 0.0 / [deg] Coordinate value at reference point CRVAL2 = 0.0 / [deg] Coordinate value at reference point LONPOLE = 180.0 / [deg] Native longitude of celestial pole LATPOLE = 0.0 / [deg] Native latitude of celestial pole RADESYS = 'FK5' / Equatorial coordinate system EQUINOX = 2010.0 / [yr] Equinox of equatorial coordinates