View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Bizarre problem with FOR loop in cl script

nrowell wrote on Jun 19, 2009

Hi,
I'm writing a script for doing CCD reductions in batches, and am having an annoying problem with a section involving a for loop. This is the section of code:

for(i=1;i<5;i+=1){               
        cd ("Night"//i)          
        if(i>2){
                illumination ("sFlat",
                "Illum", interactive=yes, bins="", nbins=5, sample="*", naverage=1,
                function="spline3", order=9, low_reject=0., high_reject=0., niterate=1,
                grow=0., interpolator="poly3", graphics="stdgraph", cursor="")

                hedit ("sFlat",
                "OBSTYPE", "TEST", add=no, addonly=no, delete=no, verify=no, show=yes,
                update=yes)
        };
        cd ..
}


...so running the 'illumination' task then 'hedit' on the files Night3/sFlat.fit and Night4/sFlat.fit. Problem is, after successfully finishing the loop the script then skips the next twelve lines of code. I've no idea why it should do this, I've worked around it by leaving a gap of this length in the script but I'd really like to get to the bottom of it! Something funny is going on.

Cheers,

Nick Rowell

Mike Fitzpatrick wrote on Jun 19, 2009

Let me guess, you're running the script as something like

cl < myfile.cl


When you run a script redirected like this the standard input is universally redirected, meaning that if anything in the script (e.g. a parameter prompt) requires input that reply will come from the next line of the script itself. The #!cl script mechanism essentially works the same way, but writing this in a procedure script should work. You can also try running the command by hand to see what the prompt is/are.

-Mike

Last post on Jun 19, 2009