View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

syntax for file names in scripts

Guillermo Bosch wrote on Mar 03, 2006

Hi there

I am working on a script and need to build image names within it in order to use them with an IRAF task (say, "continuum")

I managed to get this working, but would like to avoid creating lists, if possible

for (i=1;i<=32;i+=1) {
print ("Mask1_0907S0151_",i//".0001.fits", >> "inconti")
print ("c"//"Mask1_0907S0151_",i//".0001.fits", >> "outconti")
continuum @inconti @outconti function="spline3" order=8 inter- high_reject=2 low_reject=2
del inconti
del outconti

any hint? btw: any IRAF doc regarding syntax for task parameters? ("help declarations" was not very useful for me...) :?

Mike Fitzpatrick wrote on Mar 03, 2006

I'd suggest having a look at the 'Script Programmer's Guide' (http://iraf.net/irafdocs/script/) if you haven't already, but your script could be easily rewritten as something like

for(i=1; i<=32; i+=1) {
print ("Mask1_0907S0151_%d.0001.fits\n", i) | scan (s1)
continuum (s1, "c"//s1, ......)
}

where the printf() formats the filename into the string variable 's1', and you simply prepend a 'c' to the filename using the '//' concatenation operator. For image names where the number has leading zeroes this also allows you to zero-fill the number using e.g. '%04d' as the format (for a 4-digit number). For tasks which take a list wildcard may also be used (e.g. "foo*.0001.fits") and in the case of spectra many tasks take an aperture parameter. Hope this helps.

-Mike
[/url]

Last post on Mar 03, 2006