View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Interactive review of CCD frames

Petr Skoda wrote on Jan 22, 2007

Hi all,

Before any reduction of CCD frames it is usually necessary to check the quality of frames and its image type (e.g. not to do flatcombine when the flat is overexposed or if it is in fact the arc exposure with wrong header...). Sometimes more detailed execution is required by running implot on different collumns and lines (e.g. when the aperture position is shifted you cannot use the aperture template for the same configuration -esp. for echelle order traces).

Does anybody have a solution how to do the preview in a interactive way (running e.g. implot ) with the capability of rejecting particular bad frames while creating @-lists ?

Moreover it would be nice to run the check only by plotting quickly particular line or collumn and when some doubts occur you could go to more detailed execution by another key.

Or to have the possibility to type after quick preview something like
F or C or O or Z (its a correct flat, comp, Object or zero ) some other key for bad file (e.g. space or enter) and this would add the current filename to the respective lists of files used to @list in parameters

I have seen only some examples of asking question yes, no in cl scripts but not how to respond and recognize more keys immediately .

I suppose many people here were working on some pipelines - can you send some stubs or links to examples ?

Petr Skoda

Mike Fitzpatrick wrote on Jan 22, 2007

Hi Petr,

Of course, the exact task you describe doesn't exist, but all the pieces you need could be done in a CL script pretty easily (e.g. PROW/PCOL for a quick plot, IMPLOT for interactive examination, and command input to make the whole thing interactive. Most scripts would use print() to print a prompt and scan() to read the response, but if what you want is something more like the cursor keystroke command, you can use the under-appreciated 'ukey' parameter of the CL.

For instance, assuming you're looping over a list of images in the script you could do something like


        for (ch = "d"; ch != "n"; ch = cl.ukey) {
            print ("")
            switch (ch) {
            case "?":   print ("help for commands here...")
            case "h":   imheader (imname, long+)
            case "e":   imexamine (imname, 1)
            case "d":   display (imname, 1, fill+)
            case "n":   break                                       # next image
            case "q":   goto cleanup
            case "s":   imstat (imname)
            }
            printf ("Command? ")
        }


The ukey param takes a single char as input and the above code shows how you might construct a command loop with it. In your task, you might do a PCOL plot by default and have the 's' save the image to the processed output list and 'i' drop into IMPLOT. For a better idea of what ukey does, type "=ukey" at the CL prompt and then type a key afterwards.

Hope this helps,
Cheers,
-Mike

Petr Skoda wrote on Jan 22, 2007

Thank you Mike!
It is fantastic - exactly what I wanted.

I have played with it (currently preparing the required task) but one subtle week point is the "case" argument:
As I understand it works well for single keystrokes of letters but when I just press ENTER (to go the default way) it complains on wrong argument (when printing ch it gives "\015").


switch (ch) {
case "h": imhead(...)
case "\015": print ("ENTER pressed")


does not work

Is there still a solution for this ?
------------------------------
BTW - I have noticed the switch/case statement as shown above does not work in simple scripts run through

cl<myscript.cl


I had to declare it as procedure script including the defiition of task. Why it does not work, but if or for or while statements work? I could not found any example cl script with switch in IRAF source and help "switch" is confusing a little...

Mike Fitzpatrick wrote on Jan 22, 2007

Hi Petr,

The newline is typed as a char string internally, try something like


        for (ch = "h"; ch != "q"; ch = cl.ukey) {
            if (ch < "a") {
                print ("got a newline")
            } else {
                switch (ch) {
                     :


to trap it as a special case (i.e. "\015" is less than the ASCII char 'a').

Cheers,
-Mike

Last post on Jan 22, 2007