Welcome to iraf.net Friday, May 17 2024 @ 07:19 AM GMT


 Forum Index > Help Desk > Systems New Topic Post Reply
 batch photometry script
   
FSBoyden
 11/13/2006 11:18AM (Read 10722 times)  
++++-
Regular Member

Status: offline


Registered: 06/07/2006
Posts: 95
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?[code:1:bf74ce3cda]# 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 *imglistbegin

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[/code:1:bf74ce3cda]When a call phot and psf outside (i.e. indep.) All work as it should. When I write a small script nl:
[code:1:bf74ce3cda]string img="Star001V.fits"
string coord="master.coo"
string magfile="Star001V.mag"
if (access (img // ".fits")) {
phot (img, coord, >> magfile)
}
[/code:1:bf74ce3cda]
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
PatP.S. If the script works properly, please feel free to use it if you want.

 
Profile Email
 Quote
fitz
 11/13/2006 11:18AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
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

 
Profile Email
 Quote
FSBoyden
 11/13/2006 11:18AM  
++++-
Regular Member

Status: offline


Registered: 06/07/2006
Posts: 95
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

 
Profile Email
 Quote
fitz
 11/13/2006 11:18AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Try first to turn off the daophot.verify parameter, I think this is what's causing the queries....
-Mike

 
Profile Email
 Quote
FSBoyden
 11/13/2006 11:18AM  
++++-
Regular Member

Status: offline


Registered: 06/07/2006
Posts: 95
Hi MikeThe "verify=no" worked. The script now runs without a problem. NICE!!!!! Big Grin ThanX for all the helpRegards
Pat

 
Profile Email
 Quote
FSBoyden
 11/13/2006 11:18AM  
++++-
Regular Member

Status: offline


Registered: 06/07/2006
Posts: 95
Hi allThe 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 QThanx
Pat

 
Profile Email
 Quote
FSBoyden
 11/13/2006 11:18AM  
++++-
Regular Member

Status: offline


Registered: 06/07/2006
Posts: 95
P.S. Only seem to occur within procedure scripts

 
Profile Email
 Quote
fitz
 11/13/2006 11:18AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Pat, Please post a sample string and maybe the code fragment being used. You can check values on the command line with something like[code:1:c59b73375f] cl> s1 = "/path/foo.imh"
cl> =strlen(s1)
cl> =strlen("/path/foo.imh")[/code:1:c59b73375f]-Mike

 
Profile Email
 Quote
FSBoyden
 11/13/2006 11:18AM  
++++-
Regular Member

Status: offline


Registered: 06/07/2006
Posts: 95
Hi MikeWhen 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

 
Profile Email
 Quote
   
Content generated in: 0.25 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login