HiPicked up some error again!
The Script worked a couple of days ago. I then proceeded to include a code section to display the stars' id's that the daophot package write into the .pst. files. So the user can see what id's to use when he wants to dump the data.Now all of a sudden the code does not want to work. Up until the end of the scan part. The error seems to occur with the "nscan" part. I think.
Here is the code.[code:1:73dd34ef11]
procedure stardump (pst_temp, pst_files, num_stars) # Define procedure# Define procedure variablesstring pst_temp {prompt="The pstfile template for the star id's"}
string pst_files {prompt="The pstfiles containing the calculated magnitudes"}
string num_stars {prompt="The number of stars, or the starnumber to be dumped"}struct *pstlistbegin # Define script variables
int i, n, k
string pststar, pst, nstars, starfile, expr, starid, pstid
# Make sure the nessecary packages are installed
if ( ! defpac ("daophot")) {
bye()
}
;
# Get the star id's from the pst file, and display them for the user to choose.
pstid = pst_temp
starid = mktemp ("tmp$pst")
txdump (pstid, "id", yes, > starid)
print ("Measured stars' id's!")
type (starid)
# Expand the image template into a text file list
pststar = mktemp ("tmp$pst")
sections (pst_files, option="fullname" , > pststar)
# Get the rest of the parameters
nstars = num_stars
pstlist = pststar
# Scan through nstars to get the starnumber
scan (nstars)
if (nscan () != 0) {
# If there is a starnumber do the textdump
i = strlen (nstars)
if (substr (nstars, i, i) == "'" ) { # Check for specific stars
n = int(substr (nstars, 1, i-1))
# Do the txdump. The textfiles containing the data will
# appear in the same directory as the source files!
starfile = "star" // n
expr = "id ==" // n
while (fscan (pstlist, pst) != EOF ) {
txdump (pst, "ifilter,otime,xairmass,xcenter,ycenter,mag,msky", expr, >> starfile)
}
;
}
else {
n = int(nstars) # Dump all the stars in order, if numbered from 1 to n
# Do the txdump. The textfiles containing the data will
# appear in the same directory as the source files!
while (fscan (pstlist, pst) != EOF ) {
for (k = 1; k <= n; k+=1) {
starfile = "star" // k
expr = "id ==" // k
txdump (pst, "ifilter,otime,xairmass,xcenter,ycenter,mag,msky", expr, >> starfile)
}
;
}
;
}
;
}
;
# Clean up
delete (pststar, ver-, >& "dev$null")
delete (starid, ver-, >& "dev$null")
end[/code:1:73dd34ef11]Hope U can helpRegards
Pat