View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Text Cursor

ofwolf42 wrote on Jan 21, 2011

I've been trying to read up on text cursors on IRAF. I want to use imexam as part of a script and perform automated processes on a series of images. Most information talks about using "fscan" to get the current position and store the co-ordinates as variables. I want to know how to feed these variables into a function (such as imexam). Is this possible?

Also is it possible to script imexam commands? Such as the "a" keystroke or similar.

Mike Fitzpatrick wrote on Jan 21, 2011

You didn't say specifically what you've been reading, but see section 3.7 of "cl> help cursors" for the description of a coordinate input file. This is what you would use to pass in e.g. the 'a' command to imexam in a batch mode.

Note that many of the functions in imexam have task equivalents (e.g. the 'a' key could be done with apphot tasks). If you still have questions, please post an example of what you're trying to do.

ofwolf42 wrote on Jan 21, 2011

So using a text file of co-ords I can pass a position to an iraf function. What I want to do now is edit that text file within a script.

What I want to do is get the co-ords of the center of an object (from apphot or imexam etc) add that co-ord to a text file then move to the next image, then use apphot "center" function or imexam "a" function at the co-ord that was added to the text file and repeat the process over a series of images.

Problem is that the only way I know how to extract the co-ord from the log file and enter into a text file is using c++ programs or (maybe with some practice) a UNIX script. Is it possible to run a .sh file within an IRAF script?

Mike Fitzpatrick wrote on Jan 21, 2011

Host programs can be used in scripts by declaring them as 'foreign tasks', e.g. in your login.cl you would declare a task as e.g.

task $fixit = /path/fixit.sh


Otherwise I'm not clear on exactly how you're creating the coords files, but I can imagine a loop that get the coords and write out the new coord file each time it is needed.

ofwolf42 wrote on Jan 21, 2011

What about the reverse? Is it possible to run IRAF scripts from an sh file? I can't seem to find anything on it.

Mike Fitzpatrick wrote on Jan 21, 2011

See http://iraf.noao.edu/iraf/web/new_stuff/cl_host.html

ofwolf42 wrote on Jan 21, 2011

Okay, so I set stdimcur to text then functions expect a text input. When I run imexam it expects a user text input. How do I pass a co-ord list to it? Is there a parameter I can change in imexam so it always looks in the same file for co-ords?

Mike Fitzpatrick wrote on Jan 21, 2011

Do you mean you set the 'stdimcur' environment variable to the name of a cursor file, or actual text values? A task like IMEXAM has it's own 'imagecur' parameter which must also be set to a cursor file.

A cursor file contains simply "x y wcs key" values one per line, how you convert your coordinate lists into this format is up to you.

ofwolf42 wrote on Jan 21, 2011

I read online that using the command::

"set stdimcur=text"


that it was then possible to pass text files to functions. Is this not needed for IMEXAM? Can I just epar the 'imagecur' to a file name with the appropriate values and it will then use those values automatically?

Will it still ask for the user to input which display layer to use (when using DS9)? If so, is there a way to tell it which layer when calling the function (for the sake of a script)?

ofwolf42 wrote on Jan 21, 2011

Okay, I've got IMEXAM reading in the co-ord file but it's not giving me the same values that I get when I perform the same action with the mouse and keyboard. Is there some kind of offset I'm not accounting for? The wcs is set to "logical" in both IMEXAM's parameters and in the co-ord file. I assumed that this was the same system that DS9 displays, am I wrong?

Last post on Jan 21, 2011