Status: offline
Registered: 07/10/2007
Posts: 23
|
I was having problems with nstar not placing stars that wander off the frame in the .nrj file and posted a question which nobody responded to, so I ended up writing a little script to try and insert the missing stars into the files myself. Unfortunately, it's getting hung up. Here's the code:[code:1:e42dbb35b1]#Declare all necessary variables
string s1 = ""
string s2 = ""
string s3 = ""
string s4 = ""
string s5 = ""string id
string mag
string otime
string xairmass
string ifilter
int staridint n = 1
int l = 1struct *list1
struct *list2
struct *list3
#Combine .nst and .nrj files together into a .concat file, and psort id in .concat
sections ("a-*.fits", opt="fullname", > "datalistfits")
match (".fits.","datalistfits",stop+,>"datalistimages")
sed 's/.fits/.fits.nst.1/g' "datalistimages" > "datalistnst"
sed 's/.fits/.fits.nrj.1/g' "datalistimages" > "datalistnrj"
sed 's/.fits/.concat/g' "datalistimages" > "datalistconcat"
joinlines ("datalistimages"//","//"datalistnst"//","//"datalistnrj"//","//"datalistconcat", > "datalistfull")
list = "datalistfull"
while(fscan(list,s1,s2,s3,s4) != EOF){
pconcat (s2//","//s3, s4)
psort (s4,"ID")
}del data*
#Pull out the columns from .concat files needed for use in varstar into files called star*.joined
sections ("*.concat", opt="fullname", > "datalistconcat")
list1 = "datalistconcat"
while(fscan(list1,s1) != EOF){
for(l=1;l<=sections.nimages; l+=1){
txdump (s1, "id"//","//"mag"//","//"otime"//","//"xairmass"//","//"ifilter", yes, > "star-"//(l)//".joined")
}
}
#Add missing stars into star*.joined files and create .lst files for varstar
sections ("*.joined", opt="fullname", > "dataliststarfiles")
list2 = "dataliststarfiles"
while(fscan(list2,s5) != EOF){
list3 = (s5)
while(fscan(list3,id,mag,otime,xairmass,ifilter) != EOF){
starid = int(id)
while(starid>=n){
if(starid==n){
print(starid,>>"datalistid")
print(mag,>>"datalistmag")
print(otime,>>"datalistotime")
print(xairmass,>>"datalistairmass")
print(ifilter,>>"datalistfilter")
};
if(starid!=n){
print(n,>>"datalistid")
print("INDEF",>>"datalistmag")
print(otime,>>"datalistotime")
print(xairmass,>>"datalistairmass")
print(ifilter,>>"datalistfilter")
};
n=n+1
}
}
joinlines ("datalistid"//","//"datalistmag"//","//"datalistotime"//","//"datalistairmass"//","//"datalistfilter", > (s5)//".lst")
del data*
n = 1
}
[/code:1:e42dbb35b1]The problem seems to be on this line:[code:1:e42dbb35b1]
sections ("*.joined", opt="fullname", > "dataliststarfiles")
[/code:1:e42dbb35b1]When the script reaches that point I get the error "cannot open star-1.joined for writing". But if I manually enter the exact same code at the cl prompt and then continue the script starting on the next line, everything runs just fine and the .lst files are created just the way I want them to be.Any ideas? I don't really understand why I'm getting a "writing" error, since I'm not trying to write anything to a file.-Craig
|