Running DAOPHOT from a script

DAOPHOT is primarily designed for interactive use, in that it doesn't accept command line arguments but has its own simple command language. However, it's not difficult to run it under Unix in an automated fashion for a number of files, by working out what you would type to it if you were sitting at the keyboard, and feeding this text to DAOPHOT using some kind of input redirection.

This quite a straightforward problem in shell scripting, although there are one or two things specific to DAOPHOT to watch out for. Here is a C-shell script which does a FIND on all files called pic*.sdf in a directory, writing output to pic*.coo text files. It uses shell variables interpolated into a `here document' as the input to the program.


#  Start up DAOPHOT.

#  Get rid of any junk files which DAOPHOT has left lying around.
      rm -f *jnk.sdf

#  Loop over the files we're interested in.
      foreach file ( pic*.sdf )

#  Get filename without the .sdf extension.
         set fileroot = $file:r

#  Write filename to screen.
         echo "***"
         echo "*** Processing file $file ***"
         echo "***"

#  If an old version of the output file exists, delete it.
         rm -f $fileroot.coo

#  Run DAOPHOT with the appropriate commands.
         daophot <<__DAOPHOT-END__
ATTACH $fileroot

#  Get rid of scratch file that DAOPHOT has written.
         rm ${fileroot}jnk.sdf

#  End of loop.
There are one or two things to note here: As with everything else in Unix, there are a hundred and one other ways to go about this.

Back to DAOPHOT support page.
Mark Taylor, Institute of Astronomy, Cambridge, UK