class astropy.wcs.wcsapi.fitswcs.custom_ctype_to_ucd_mapping(mapping)[source] [edit on github]

Bases: object

A context manager that makes it possible to temporarily add new CTYPE to UCD1+ mapping used by FITSWCSAPIMixin.world_axis_physical_types.

mapping : dict

A dictionary mapping a CTYPE value to a UCD1+ value


Consider a WCS with the following CTYPE:

>>> from astropy.wcs import WCS
>>> wcs = WCS(naxis=1)
>>> wcs.wcs.ctype = ['SPAM']

By default, FITSWCSAPIMixin.world_axis_physical_types returns None, but this can be overriden:

>>> wcs.world_axis_physical_types
>>> with custom_ctype_to_ucd_mapping({'SPAM': 'food.spam'}):
...     wcs.world_axis_physical_types