Welcome to iraf.net Saturday, June 24 2017 @ 07:09 PM GMT

 Forum Index > Help Desk > General IRAF New Topic Post Reply
 Problem encountered with cl host scripting
 05/14/2017 11:42PM (Read 467 times)  

Status: offline

Registered: 03/15/2014
Posts: 19

I have been hitting my head against this problem for a few weeks. I expect the solution is simple, as I have a few other similar scripts working without problem. What I am trying to do is to write a script that will take already reduced images, plate solve them with a locally installed version of astrometry.net, and then do aperture photometry on them. The script is as follows:

#!/home/grayro/iraf/bin.linux64/ecl.e -f

set home = "/home/grayro/.iraf/"
set imdir = "/home/grayro/.iraf/imdir/grayro/"
set cache = "/home/grayro/.iraf/cache/grayro/"
set uparm = "home$uparm/"
set userid = "grayro"

set arch = ".linux64"
set clobber = yes
set imclobber = yes


int expos=0
int crop=0
int naxis=0
string list2
string filter
string *plist
real fwhm=3.0

!rm DARK*.fits
!rm FLAT*.fits
!rm BIAS.fits
!rm *LB.fits
!rm *LR.fits
!rm *LV.fits
!rm null*.fits
!rm *L-*.fits
!rm *.mag
!rm *.lst

!ls -1 *B.fits | sed -e 's/\.fits$//' > star.lis
!ls *V.fits | sed -e 's/\.fits$//' >> star.lis
!ls *R.fits | sed -e 's/\.fits$//' >> star.lis
list = ""
list = "star.lis"

while(fscan(list,s1) != EOF) {
printf("R6solve.sh %s.fits\n",s1, > "try.sh")
!chmod a+x try.sh
if(access(s1//".new")) {
print("Plate solved!")
printf("rm %s.fits\n",s1, > "try1.sh")
printf("mv %s.new %s.fits\n",s1,s1, >> "try1.sh")
printf("rm %s.wcs\n",s1, >> "try1.sh")
!chmod a+x try1.sh
!rm *.solved
!rm *.axy
!rm *.corr
!rm *.xyls
!rm *.match
!rm *.rdls
!rm try.sh
!rm temp.lst
!rm temp.psf
plist = "psf.out"
j = fscan(plist,fwhm)
datapars.epadu = 1.5
datapars.readnoise = 14
photpars.apertures = 3.5*fwhm
fitskypars.annulus = 3.5*fwhm + 6

The script fails at the first daofind call, with errors that look like:

Plate solved!
rm: cannot remove ‘temp.lst’: No such file or directory
**: }
ERROR: syntax error
called as: `daofind (image=GL890B, output=temp.lst, interactive=no, verify=no)'
called as: `cl ()'
line 29: ccdred$ccdred.cl
called as: `ccdred ()'
called as: `cl ()'
called as: `cl ()'
called as: `cl ()'
"dataio # rfits task required by aptest.cl script"
line 3: apphot$apphot.cl
called as: `apphot ()'
called as: `cl ()'
line 15: digiphot$digiphot.cl
called as: `digiphot ()'
called as: `cl ()'
line 55: imred$imred.cl
called as: `imred ()'
called as: `cl ()'
called as: `cl ()'
called as: `cl ()'
line 43: tv$tv.cl
called as: `tv ()'
called as: `cl ()'
called as: `cl ()'
line 19: dataio$dataio.cl
called as: `dataio ()'
called as: `cl ()'
line 41: plot$plot.cl
called as: `plot ()'
called as: `cl ()'
called as: `cl ()'
Error while reading login.cl file - may need to rebuild with mkiraf
Fatal startup error. CL dies.

PANIC in `/home/grayro/iraf/noao/bin.linux64/x_apphot.e': Write to IPC with no reader

When I try to use daofind manually on the image that was produced by the preceding part of the script (GL860B.fits, with wcs information in the header) it works without problem. Yes, there is a CR at the end of the file, and I have not been using emacs to edit the script. If I remove the !rm temp.lst and !rm temp.psf lines, I get the same error.
As I stated before, I have scripts very similar to this working, and as a matter of fact the lines from daofind down have been cut and pasted out of them, and so I have difficulty believing there is a syntax error in my use of daofind. What am I missing?

Perplexed, Richard Gray

Profile Email
 05/27/2017 03:44AM  

Status: offline

Registered: 09/30/2005
Posts: 3965
Try putting a ';' after the closing '}' of the if-clause and before the closing brace of the 'while', i.e.

PHP Formatted Code

    while (....) {
        if (....) {
        ;        <------- ADD THIS

There is a longstanding ambiguity in the grammar where an if-stmt is looking for a following 'else' clause, adding the semicolon explicitly terminates the 'if' statement. A dummy "junk = 0" statement would do the same thing.

Profile Email
 06/01/2017 02:56PM  

Status: offline

Registered: 03/15/2014
Posts: 19
Thank you! That did it! I seem to recall being stymied by this same problem before Smile


Profile Email
Content generated in: 0.20 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