View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Running psfmeasure from command-line

Yiftah Lipkin wrote on Sep 05, 2006

Hello,
I am trying to get obsutil.psfmeasure run from command-line, in a non user-interactive, non-graphic mode.

form CL, for following works 'almost well' - it prints to the screen the output results, but also opens a graphic Tektronix window (myXY.txt contains lines with two floats - centers of stars; cursor.txt contains '0 0 1 q'):

psfmeasure(coords="mark1", wcs="logical", display=no, frame=1, level=0.5, size="FWHM", beta=INDEF, scale=0.696, radius=4, sbuffer=5, swidth=5, saturation=31500, ignore_sat=yes, iterations=3,xcenter=INDEF, ycenter=INDEF, logfile="", graphcur="cursor.txt", images="myimage.fits", imagecur="myXY.txt")

From the shell, the following stalls for a few minutes using ~75% of the computer's CPU and memory, and usually freezes the system:

x_obsutil.e psfmeasure coords="mark1" wcs="logical" display=no frame=1 level=0.5 size="FWHM" beta=INDEF scale=0.696 radius=6. sbuffer=5. swidth=5. saturation=31500 ignore_sat=yes iterations=1 xcenter=INDEF ycenter=INDEF logfile="" graphcur=cursor.txt images=myimage.fits imagecur=myXY.txt

How can I solve this problem? Or is there another way to calculate the FWHM from command-line, in a non user-interactive, non-graphic mode?

Thank You!
Yiftah Lipkin
Tel Aviv University

Francisco Valdes wrote on Sep 05, 2006

Hello Yiftah,

The usual way to deal with unneeded graphics output is to redirect it to a file, especially the null file. In the CL this is done with the >G redirection. In your example


psfmeasure(coords="mark1", wcs="logical", display=no, frame=1, level=0.5, size="FWHM", beta=INDEF, scale=0.696, radius=4, sbuffer=5, swidth=5, saturation=31500, ignore_sat=yes, iterations=3,xcenter=INDEF, ycenter=INDEF, logfile="", graphcur="cursor.txt", images="myimage.fits", imagecur="myXY.txt", G> "dev$null")


In many tasks it can also be done by using the "graphics" parameter. However, PSFMEASURE does not have a "graphics" parameter and so you can't control that.

There is a problem in trying to do what you want from the host command line. Graphics redirection is not supported when running an IRAF executable standalone. By the way I also found the same behavior with taking a long time and it is something I have not encountered before and did not take the time to track it down.

In general it is tricky and tedious to do host commands by calling the IRAF binaries directly. A better way, which I have made considerable use of, is to use the CL as the shell in a host shell script. To do what you want in this
way create the file psfm.cl shown below, make it executable with chmod, and then you can execute it as you would any unix command. The main tricks in using this are to make sure the packages are loaded and that you end with a logout.


#!/usr/local/bin/cl.e -f

noao
obsutil

psfmeasure(coords="mark1", wcs="logical", display=no, frame=1,
level=0.5, size="FWHM", beta=INDEF, scale=0.696, radius=4, sbuffer=5,
swidth=5, saturation=31500, ignore_sat=yes, iterations=3, xcenter=INDEF,
ycenter=INDEF, logfile="", graphcur="cursor.txt", images="myimage.fits",
imagecur="myXY.txt", >G "dev$null")

logout


You would use the path to the cl.e executable (which is not the same as the cl command). This may not be installed in the standard local bin but you can find it in your iraf installation at $iraf/bin.[arch]/cl.e where arch is something like redhat.

For more on host callable cl scripts (aka "hash-bang cl" scripts) see

http://iraf.noao.edu/iraf/web/new_stuff/cl_host.html

Yours,
Frank Valdes

Last post on Sep 05, 2006