coordinate_iau_format

gammapy.catalog.coordinate_iau_format(coordinate, ra_digits, dec_digits=None, prefix='')[source]

Coordinate format as an IAU source designation.

Reference: http://cdsweb.u-strasbg.fr/Dic/iau-spec.html

Parameters:
coordinate : SkyCoord

Source coordinate.

ra_digits : int (>=2)

Number of digits for the Right Ascension part.

dec_digits : int (>=2) or None

Number of digits for the declination part Default is dec_digits = None, meaning dec_digits = ra_digits - 1.

prefix : str

Prefix to put before the coordinate string, e.g. “SDSS J”.

Returns:
strrepr : str or list of strings

IAU format string representation of the coordinate. If this input coordinate is an array, the output is a list of strings.

Examples

>>> from astropy.coordinates import SkyCoord
>>> from gammapy.catalog import coordinate_iau_format

Example position from IAU specification

>>> coordinate = SkyCoord('00h51m09.38s -42d26m33.8s', frame='icrs')
>>> designation = 'QSO J' + coordinate_iau_format(coordinate, ra_digits=6)
>>> print(designation)
QSO J005109-4226.5
>>> coordinate = coordinate.transform_to('fk4')
>>> designation = 'QSO B' + coordinate_iau_format(coordinate, ra_digits=6)
>>> print(designation)
QSO B004848-4242.8

Crab pulsar position (positive declination)

>>> coordinate = SkyCoord('05h34m31.93830s +22d00m52.1758s', frame='icrs')
>>> designation = 'HESS J' + coordinate_iau_format(coordinate, ra_digits=4)
>>> print(designation)
HESS J0534+220

PKS 2155-304 AGN position (negative declination)

>>> coordinate = SkyCoord('21h58m52.06511s -30d13m32.1182s', frame='icrs')
>>> designation = '2FGL J' + coordinate_iau_format(coordinate, ra_digits=5)
>>> print(designation)
2FGL J2158.8-3013

Coordinate array inputs result in list of string output.

>>> coordinates = SkyCoord(ra=[10.68458, 83.82208],
...                        dec=[41.26917, -5.39111],
...                        unit=('deg', 'deg'), frame='icrs')
>>> designations = coordinate_iau_format(coordinates, ra_digits=5, prefix='HESS J')
>>> print(designations)
['HESS J0042.7+4116', 'HESS J0535.2-0523']