View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Problem encountered with cl host scripting

grayro wrote on May 14, 2017


Hi,

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

images

plot

dataio

lists

tv

utilities

noao

imred

digiphot

apphot

ccdred

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

!./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

!./try1.sh

!rm *.solved

!rm *.axy

!rm *.corr

!rm *.xyls

!rm *.match

!rm *.rdls

!rm try.sh

!rm temp.lst

!rm temp.psf

daofind(image=s1,output="temp.lst",threshold=100,sigma=1.2,readnoise=14,interactive=no,verify=no,fwhmpsf=3.0)

fitpsf(image=s1,box=11,coords="temp.lst",output="temp.psf",interact=no,<"ukey.dat"

!psfrd

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

daofind(image=s1,output=s1//".coo",threshold=100,sigma=1.2,readnoise=14,interactive=no,verify=no,fwhmpsf=fwhm)

wcsctran(input=s1//".coo",output=s1//".wcs",image=s1,inwcs="logical",outwcs="world"

phot(image=s1,coords=s1//".coo",output=s1//".mag",interac=no,verify=no)

}

}

logout

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 ()'

"clbye()"

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 ()'

"clbye()"

line 15: digiphot$digiphot.cl

called as: `digiphot ()'

called as: `cl ()'

"clbye"

line 55: imred$imred.cl

called as: `imred ()'

called as: `cl ()'

called as: `cl ()'

called as: `cl ()'

"clbye()"

line 43: tv$tv.cl

called as: `tv ()'

called as: `cl ()'

called as: `cl ()'

"clbye()"

line 19: dataio$dataio.cl

called as: `dataio ()'

called as: `cl ()'

"clbye()"

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

Mike Fitzpatrick wrote on May 27, 2017


Try putting a ';' after the closing '}' of the if-clause and before the closing brace of the 'while', i.e.


    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.

grayro wrote on Jun 01, 2017


Thank you! That did it! I seem to recall being stymied by this same problem before

Richard

Last post on Jun 01, 2017