batch photometry script
H.J. van Heerden wrote on Nov 13, 2006
Hi all.
I wrote this script using examples of scripts from "An itroductory guide to iraf scripts". It "should" work, but I have a problem?
When a call phot and psf outside (i.e. indep.) All work as it should. When I write a small script nl:
It works! And fast.
But when I call allphot, with just one star as input (do photometry, psf on one star, which should be fast), it seems as if the PC hangs. I.E. nothing happens.
I do not know if it is the code that is to "bulky" (shouldn't be), or if there are to many/few parameters. Or my PC that is to slow.
Please HELP!
Regards
Pat
P.S. If the script works properly, please feel free to use it if you want.
I wrote this script using examples of scripts from "An itroductory guide to iraf scripts". It "should" work, but I have a problem?
# Allphot script for batch psf photometry, using daophot.
procedure allphot (images, master_coo, master_pst)
string images {prompt="Images to be used"}
string master_coo {prompt="The master.coo file containing the stars' coordinates"}
string master_pst {prompt="The master.pst file containing the PSF template stars"}
struct *imglist
begin
int i
string img, imgfile, coord, pststar, magfile, psffile, psgroup, imgpst
# Make sure the necessary packages are loaded
if (! defpac ("digiphot") || ! defpac("daophot"))
bye
# Expand the image template into a text file list
imgfile = mktemp ("tmp$apt")
sections (images, option="fullname", > imgfile)
# Get the rest of the parameters
coord = master_coo
pststar = master_pst
imglist = imgfile
while (fscan (imglist, img) != EOF) {
# Get rid of the ".imh" extention
i = strlen (img)
if (substr (img, i-4, i) == ".fits")
img = substr (img, 1, i-5)
# Make up the output files' names. These files will
# appear in the same directory as the images!
magfile = img // ".mag"
psffile = img // ".psf.fits"
psgroup = img // ".psg"
imgpst = img // ".pst"
# Do the photometry
if (access (img // ".fits")) {
phot (img, coord, >> magfile)
}
# Do the psf fitting
if (access (img // ".fits") || access (img // ".mag")) {
psf (img, magfile, pststar, >> psffile, >> imgpst, >> psgroup,
interactive = no, showplots = no)
#}
}
# Clean up
delete (imgfile, ver-, >& "dev$null")
end
When a call phot and psf outside (i.e. indep.) All work as it should. When I write a small script nl:
string img="Star001V.fits"
string coord="master.coo"
string magfile="Star001V.mag"
if (access (img // ".fits")) {
phot (img, coord, >> magfile)
}
It works! And fast.
But when I call allphot, with just one star as input (do photometry, psf on one star, which should be fast), it seems as if the PC hangs. I.E. nothing happens.
I do not know if it is the code that is to "bulky" (shouldn't be), or if there are to many/few parameters. Or my PC that is to slow.
Please HELP!
Regards
Pat
P.S. If the script works properly, please feel free to use it if you want.
Mike Fitzpatrick wrote on Nov 13, 2006
I haven't tried the script, but I do notice there is a comment char before the closing brace of the if-statement around the call to PSF which should be an error. The PSF call itself seems to be redirecting to three different files (can't be done) so I suspect the issue is here somewhere.
Otherwise, you can use the 'd_trace' command before executing the script to see what it is doing when it hangs.
-Mike
Otherwise, you can use the 'd_trace' command before executing the script to see what it is doing when it hangs.
-Mike
H.J. van Heerden wrote on Nov 13, 2006
The comment char was just a typing error. The problem was with the redirection to the output-files. Used 'default'. Now it works, to a degree.
I now sit with the problem that it asks me for confirmation on some of the parameters for every single image. When you run through a star list of 60 images, it gets ...
Q! How can i set up parameter textfiles, (datapars,centerpars,skypars, enc) so that it calls the files, and run through the script ONETIME, with the only time that I have to CR is at the beginning to run the procedure, If you understand what I mean.
ThanX for the help.
Regards
Pat
I now sit with the problem that it asks me for confirmation on some of the parameters for every single image. When you run through a star list of 60 images, it gets ...
Q! How can i set up parameter textfiles, (datapars,centerpars,skypars, enc) so that it calls the files, and run through the script ONETIME, with the only time that I have to CR is at the beginning to run the procedure, If you understand what I mean.
ThanX for the help.
Regards
Pat
Mike Fitzpatrick wrote on Nov 13, 2006
Try first to turn off the daophot.verify parameter, I think this is what's causing the queries....
-Mike
-Mike
H.J. van Heerden wrote on Nov 13, 2006
Hi Mike
The "verify=no" worked. The script now runs without a problem. NICE!!!!! :D
ThanX for all the help
Regards
Pat
The "verify=no" worked. The script now runs without a problem. NICE!!!!! :D
ThanX for all the help
Regards
Pat
H.J. van Heerden wrote on Nov 13, 2006
Hi all
The prereduction scripts now work. See "photometry prereduction script"
The problem is that now I wanted to test the pipeline and see what results the (WORKING) batch photometry scripts give me. At least they worked last time I used them.
Now all of a sudden the script has a error. When I check the strlen, to remove the .imh or .fit extendtion it gives me the wrong value. I have checked it again and again, and somehow it gives me a value that is 6 less than the strlen. I.e strlen should be 14, gives 8, or 15 give 9, enc.
I build the script under iraf 2.12.2a, am now using 2.13.
Hope u understand my Q
Thanx
Pat
The prereduction scripts now work. See "photometry prereduction script"
The problem is that now I wanted to test the pipeline and see what results the (WORKING) batch photometry scripts give me. At least they worked last time I used them.
Now all of a sudden the script has a error. When I check the strlen, to remove the .imh or .fit extendtion it gives me the wrong value. I have checked it again and again, and somehow it gives me a value that is 6 less than the strlen. I.e strlen should be 14, gives 8, or 15 give 9, enc.
I build the script under iraf 2.12.2a, am now using 2.13.
Hope u understand my Q
Thanx
Pat
H.J. van Heerden wrote on Nov 13, 2006
P.S. Only seem to occur within procedure scripts
Mike Fitzpatrick wrote on Nov 13, 2006
Pat,
Please post a sample string and maybe the code fragment being used. You can check values on the command line with something like
-Mike
Please post a sample string and maybe the code fragment being used. You can check values on the command line with something like
cl> s1 = "/path/foo.imh"
cl> =strlen(s1)
cl> =strlen("/path/foo.imh")-Mike
H.J. van Heerden wrote on Nov 13, 2006
Hi Mike
When I tested it this morning it now suddenly works. I have no idee what happened. The code that I used is the same as that which I posted earliar in this forum. (Just corrected).
If it happens again I'll let you know.
Many thanx for the help.
Regards
Pat
When I tested it this morning it now suddenly works. I have no idee what happened. The code that I used is the same as that which I posted earliar in this forum. (Just corrected).
If it happens again I'll let you know.
Many thanx for the help.
Regards
Pat
Last post on Nov 13, 2006