kwkchan |
12/05/2009 08:28AM (Read 3559 times)
|
|
|
Status: offline
Registered: 10/02/2009
Posts: 12
|
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, outputreal contfile cat2, cur2beginfile cat20string in, outcat20=cat2in=input;out=outputrspectext(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
|
|
|
|
fitz |
12/05/2009 08:28AM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
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 |
12/05/2009 08:28AM
|
|
|
Status: offline
Registered: 10/02/2009
Posts: 12
|
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 |
12/05/2009 08:28AM
|
|
|
Status: offline
Registered: 10/02/2009
Posts: 12
|
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, outputreal contbeginfile cat2, cur2string in, outin=input;out=outputrspectext(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")endCan somebody tell me what the commmond delete(cat2,ver-, >& "dev$null") mean?
|
|
|
|
| |
|