custom_ctype_to_ucd_mapping

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

Bases: object

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

Parameters
mappingdict

A dictionary mapping a CTYPE value to a UCD1+ value

Examples

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 overridden:

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