View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

syntax error in header value extraction

Andrea Cardullo wrote on Dec 16, 2010

Hi guys,
I'm working on a simple programme that makes some counts on header parameters.
The idea is to put as input the name of the keyword, and then to use its value to create a new keyword. However I can't figure out how to combine the name of the key with its value, in hedit.
I show few lines of the programme:
...
string ut = "" {prompt = "Universal Time Keyword (initial)"}
...
hedit (image=name, field="H_UT", value="(ut/3600)", add=yes, addonly=no, delete=no, verify=no, update=yes)

How should I write to make the programme able to understand that the variable ut is a keyword which value it should use in the formula?
Thanks!

Mike Fitzpatrick wrote on Dec 16, 2010

Since you're using a script variable in the expression, the simplest thing is to construct the expression using string concatenation, e.g.

...,value="(" // ut // "/3600)", ....


The value of the 'ut' variable will then be used in the expression, and as long as it is a valid header keyword that keyword-value will then be used to compute the value.

There is a value-indirection '@' operator (see the help page) to use the value of a parameter, but that applies only to header keyword parameters AFAIK (e.g. a keyword used to name the keyword containing the UT time) and isn't what you need here. Hope this helps.

Last post on Dec 16, 2010