imarith problem in iraf script
astrofun wrote on May 03, 2010
Hello,
I am having troubles to make this script work properly. I found another similar topic on this site but still not working with the right syntax. Please help.
procedure xxx
struct *imlist
struct *outlist
begin
string imlst,outlst,textfile1
imlst = mktemp ("imfx")
outlst = mktemp ("imfd")
files ("exap??_*c.fits", >imlst)
files ("%ex%cor%ap??_*c.fits", > outlst)
imlist = imlst
outlist = outlst
textfile1= "corrt.txt"
imarith ("@"//imlist,"-","@"//textfile1,"@"//outlist)
end
corrt.txt contains a list of numbers. When i run it, it gives me this error message:
ERROR: Cannot open file (corap46_xxc.fits)
"imarith ("@"//imlist,"-","@"//textfile1,"@"//outlist)"
line 20: ../../../script/xxx.cl
called as: `xxx ()'
I don't understand why it cannot "open" that file. It supposes to be an output file. The temp files, imfx* and imfd* certainly contain the input and output file names.
I am having troubles to make this script work properly. I found another similar topic on this site but still not working with the right syntax. Please help.
procedure xxx
struct *imlist
struct *outlist
begin
string imlst,outlst,textfile1
imlst = mktemp ("imfx")
outlst = mktemp ("imfd")
files ("exap??_*c.fits", >imlst)
files ("%ex%cor%ap??_*c.fits", > outlst)
imlist = imlst
outlist = outlst
textfile1= "corrt.txt"
imarith ("@"//imlist,"-","@"//textfile1,"@"//outlist)
end
corrt.txt contains a list of numbers. When i run it, it gives me this error message:
ERROR: Cannot open file (corap46_xxc.fits)
"imarith ("@"//imlist,"-","@"//textfile1,"@"//outlist)"
line 20: ../../../script/xxx.cl
called as: `xxx ()'
I don't understand why it cannot "open" that file. It supposes to be an output file. The temp files, imfx* and imfd* certainly contain the input and output file names.
Mike Fitzpatrick wrote on May 03, 2010
Try using the string variable 'outlst' rather than the list pointer 'outlist'.
The difference is that "@"//outlst will evaluate to an @-file with the name of the file whereas "@"//outlist is an '@' followed by the contents (at least the first line) of that file. Since it's an output file to be created, that content doesn't exist yet and the task cannot read "@corap46_xxc.fits" to get the file list.
The difference is that "@"//outlst will evaluate to an @-file with the name of the file whereas "@"//outlist is an '@' followed by the contents (at least the first line) of that file. Since it's an output file to be created, that content doesn't exist yet and the task cannot read "@corap46_xxc.fits" to get the file list.
astrofun wrote on May 03, 2010
Thank you!
Take your suggestion, change it to:
imarith ("@"//imlist,"-","@"//textfile1,"@"//outlst)
However, this time it gives:
ERROR: Wrong number of elements in the operand lists
"imarith ("@"//imlist,"-","@"//textfile1,"@"//outlst)"
I did an epar imarith, it seems to put the operand correctly. If i do it manually in the command line, imarith @in - @text @out, i have no trouble.
Take your suggestion, change it to:
imarith ("@"//imlist,"-","@"//textfile1,"@"//outlst)
However, this time it gives:
ERROR: Wrong number of elements in the operand lists
"imarith ("@"//imlist,"-","@"//textfile1,"@"//outlst)"
I did an epar imarith, it seems to put the operand correctly. If i do it manually in the command line, imarith @in - @text @out, i have no trouble.
Mike Fitzpatrick wrote on May 03, 2010
I should have been more complete in my answer: You need to likewise use the 'imlst' string variable rather than "imlist". Using imlist you get the single first value rather than the full list. Otherwise I'm assuming the 'corrt.txt' file has the same number of values as the number of images.
Last post on May 03, 2010