View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

HEDIT, ASTHEDIT: dealing with sexigesimal numbers

Frank Valdes wrote on Aug 11, 1998

Q:  I have a header which has RA and ST information as sexigesimal. I
want to form the HA as (ST-RA). I can't figure out how to get hedit to
do this. The command

hedit test ha '(st - ra)' add+

complains that the ST and RA are strings and not numbers. I don't see
a function in the hedit help file that will convert the ST and RA from
strings in hh:mm:ss form into real format.

Is there an easy way of doing this?


A:  This is an old misfeature.  The function evaluation should convert
sexigesimal numbers automatically (as it does in other parts of IRAF)
but even if not the function "real" should do it.  The only reason
the numbers are strings is because they have to be represented as
strings in FITS.

The standard trick is to first create dummy keywords as real values,
copy the string values to those keywords, then do your operation.  A
sequence would be:

	cl> hedit obj228 streal 1. add+
	cl> hedit obj228 rareal 1. add+
	cl> hedit obj228 streal '(st)'
	cl> hedit obj228 rareal '(ra)'
	cl> hedit obj228 ha '(streal-rareal)' add+
	cl> hedit obj228 streal,rareal del+
	
You can also use astutil.asthedit interactively or with a command file.
Interactively it would be:

as> asthedit obj228 ""
asthedit> ha=st-ra
asthedit> quit

Last post on Aug 11, 1998