Submit a Story  :  IRAF Links  :  Past Polls  :  Calendar  :  Advanced Search  
     iraf.net
FAQ
 Forum FAQForum FAQ   Forum SearchForum Search   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

imstat data

 
Post new topic   Reply to topic    iraf.net Forum Index -> Systems
View previous topic :: View next topic  
Author Message
kwkchan



Joined: 02 Oct 2009
Posts: 12

PostPosted: Sat Dec 05, 2009 8:28 am    Post subject: imstat data Reply with quote

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
Back to top
View user's profile Send private message
fitz
Site Admin


Joined: 30 Sep 2005
Posts: 3256
Location: Tucson

PostPosted: Sat Dec 05, 2009 4:51 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
kwkchan



Joined: 02 Oct 2009
Posts: 12

PostPosted: Sat Dec 05, 2009 11:11 pm    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message
kwkchan



Joined: 02 Oct 2009
Posts: 12

PostPosted: Sun Dec 06, 2009 1:37 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    iraf.net Forum Index -> Systems All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2009 phpBB Group
 Copyright © 2005-2011 iraf.net
 All trademarks and copyrights on this page are owned by their respective owners.
Powered By Geeklog 
Created this page in 0.43 seconds