Usage of rad2radec

Return to directory of Todd's CASA extensions

Convert a position in RA/Dec from radians to sexagesimal string which is comma delimited. The position can either be entered via the ra and dec parameters, as a tuple via the 'ra' parameter, as an array of shape (2,1) via the 'ra' parameter, or as an imfit dictionary can be passed via the imfitdict argument, and the position of the specified component (default=0) will be displayed in RA/Dec sexagesimal. See also direction2radec, radec2direction, and radec2rad.

Usage:

au.rad2radec(ra=0, dec=0, imfitdict=None, prec=5, verbose=True, component=0, 
    replaceDecDotsWithColons=True, hmsdms=False, delimiter=', ',
    prependEquinox=False, hmdm=False)
CASA usually produces Declination strings that are (annoyingly) decimal-delimited: -35.45.56.2, therefore the default is to change these to commas (replaceDecDotsWithColons=True). Inputs:
  • prec: the precision to print (number of digits after RA decimal point)
  • imfitdict: a dictionary produced by imfit
  • component: which component of the dictionary to use
  • replaceDotsWithColons: replace dots with colons as the Declination d/m/s delimiter
  • hmsdms: produce output of format: '20h10m49.01s, +057d17m44.806s'
  • hmsdms: produce output of format: '20h10m49.01, +057d17m44.806'
  • delimiter: the character string used to delimit RA from Dec in the output string
  • prependEquinox: if True, insert "J2000" before coordinates (i.e. for clean)

Examples:

CASA 3>: au.rad2radec(0.5,1.3,hmsdms=True)
01h54m35.49354s, +074d29m04.248121s
  Out[3]: '01h54m35.49354s, +074d29m04.248121s'
CASA <4>: au.rad2radec(-1,1)
20:10:49.01292, +057:17:44.806247
  Out[4]: '20:10:49.01292, +057:17:44.806247'
CASA <5>: au.rad2radec(2,1)
07:38:21.97417, +057:17:44.806247
  Out[5]: '07:38:21.97417, +057:17:44.806247'
CASA <9>: dict=imfit('TWHydra_contall_apcal.image')
CASA <10>: dict
  Out[10]:
{'converged': array([ True], dtype=bool),
 'results': {'component0': {'flux': {'error': array([ 0.00265608,  0.        ,  0.        ,  0.        ]),
                                     'polarisation': 'Stokes',
                                     'unit': 'Jy',
                                     'value': array([ 1.45546379,  0.        ,  0.        ,  0.        ])},
                            'label': '',
                            'shape': {'direction': {'error': {'latitude': {'unit': 'arcsec',
                                                                           'value': 0.0015363974177154635},
                                                              'longitude': {'unit': 'arcsec',
                                                                            'value': 0.0014662347101245638}},
                                                    'm0': {'unit': 'rad',
                                                           'value': 2.8879274670071573},
                                                    'm1': {'unit': 'rad',
                                                           'value': -0.60571330948800917},
                                                    'refer': 'J2000',
                                                    'type': 'direction'},  ....


CASA <12>: au.rad2radec(imfitdict=dict)
11:01:51.85, -34:42:17.338

-- ToddHunter - 2012-06-11

This topic: ALMA > TWikiUsers > ToddHunter > CasaExtensions > Rad2radec
Topic revision: 2015-07-19, ToddHunter
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback