imstat data
kwkchan wrote on Dec 05, 2009
Hi! I am writing the following script to find the mode of a list of data with imstat and have the result save to a file which I named cat20 and then tail the cat20 file ans scan the no. in the cat20 file (note: cat20 file contain only one line and one single no.) and at last have the no. print with some other number (a and 1 h) in another file cur2. When I run the script in iraf it told my that there is a syntax error, line 23, :tail("cat20", nlines=1) | scan(cont)
I try google around but still can't get any clue how to fix the error so that the script would work.
I really hope somebody could help me out
And here is my code:
procedure ktext (input, output, cat2)
string input, output
real cont
file cat2, cur2
begin
file cat20
string in, out
cat20=cat2
in=input;out=output
rspectext(in,out,title="",flux+,crval1=3650.,cdelt1=2.)
imstat(out,field="mode",lower=INDEF,upper=INDEF,nclip=0,lsigma=3,usigma=3,binwidth=0.1,format=no,cache=yes,>>"cat20")
tail("cat20", nlines=1) | scan(cont)
print(a//""//cont//" 1 h",>>"cur2")
end
I try google around but still can't get any clue how to fix the error so that the script would work.
I really hope somebody could help me out
And here is my code:
procedure ktext (input, output, cat2)
string input, output
real cont
file cat2, cur2
begin
file cat20
string in, out
cat20=cat2
in=input;out=output
rspectext(in,out,title="",flux+,crval1=3650.,cdelt1=2.)
imstat(out,field="mode",lower=INDEF,upper=INDEF,nclip=0,lsigma=3,usigma=3,binwidth=0.1,format=no,cache=yes,>>"cat20")
tail("cat20", nlines=1) | scan(cont)
print(a//""//cont//" 1 h",>>"cur2")
end
Mike Fitzpatrick wrote on Dec 05, 2009
I think the syntax error is that you've declared 'cont' before the 'begin' statement, making it a parameter and not a script variable. Note you can scan directly into the variable from the imstat() statement without tail'ing an intermediate file.
kwkchan wrote on Dec 05, 2009
Hi I try to declared 'cont' after the begin but it still giving me the same error message: line 23, :tail("cat20", nlines=1) | scan(cont)
kwkchan wrote on Dec 05, 2009
I keep google around for solution and finally manage get the script to work by adding the line delete(cat2,ver-, >& "dev$null") as follow:
procedure ktest (input, output)
string input, output
real cont
begin
file cat2, cur2
string in, out
in=input;out=output
rspectext(in,out,title="",flux+,crval1=3650.,cdelt1=2.)
imstat(out,field="mode",lower=INDEF,upper=INDEF,nclip=0,lsigma=3,usigma=3,binwidth=0.1,format=no,cache=yes,>>"cat2")
delete(cat2,ver-, >& "dev$null")
tail("cat2", nlines=1) | scan(cont)
imdel(out,>&"dev$null")
print(6719.564//""//cont//" 1 h",>>"cur2")
end
Can somebody tell me what the commmond delete(cat2,ver-, >& "dev$null") mean?
procedure ktest (input, output)
string input, output
real cont
begin
file cat2, cur2
string in, out
in=input;out=output
rspectext(in,out,title="",flux+,crval1=3650.,cdelt1=2.)
imstat(out,field="mode",lower=INDEF,upper=INDEF,nclip=0,lsigma=3,usigma=3,binwidth=0.1,format=no,cache=yes,>>"cat2")
delete(cat2,ver-, >& "dev$null")
tail("cat2", nlines=1) | scan(cont)
imdel(out,>&"dev$null")
print(6719.564//""//cont//" 1 h",>>"cur2")
end
Can somebody tell me what the commmond delete(cat2,ver-, >& "dev$null") mean?
Last post on Dec 05, 2009