sourceinfo (version 1.0)

You can also look at:
#! /usr/bin/ksh

###########################################################################
#
# 
# SYNTAX: sourceinfo
#
# DESCRIPTION: This routine creates an HTML page descrbing the sources detected
# DESCRIPTION: in processing.
#
# VERSION: 1.0
#
# HISTORY: 0.0 -> 1.0 5/9/97
# HISTORY: Now report extended flag
#
##############################################################################
#DEBUG=1

$UTIL/milestone "Creating HTML source list"

sourceinfo=$($UTIL/generate_filename sourceinfo )
header=$($UTIL/generate_filename header )
seq=$($UTIL/read_parfile $JOBPAR sequence )

rm -f $sourceinfo

echo "<html>"                                                 >>$sourceinfo
echo "<head>"                                                 >>$sourceinfo
echo "<title>ASCA Sequence ${seq} Source List</title>"        >>$sourceinfo
echo "</head>"                                                >>$sourceinfo

echo "<body>"                                                 >>$sourceinfo
echo "<h1>ASCA Sequence $seq Source List</h1>"                >>$sourceinfo

echo "This page lists the sources detected in processing for" >>$sourceinfo
echo "this observation. "                                     >>$sourceinfo
echo "The counts quoted below are the raw counts in the"      >>$sourceinfo
echo "extraction circle "                                     >>$sourceinfo
echo "from the screened BRIGHT or PH mode data."              >>$sourceinfo
echo "No corrections have been made for"                      >>$sourceinfo
echo "background or vignetting."                              >>$sourceinfo

echo "<p>"                                                    >>$sourceinfo

echo "The following information is also available:"           >>$sourceinfo
echo "<ul>"                                                   >>$sourceinfo
echo "<li><strong><a href=\"${header}\">"                     >>$sourceinfo
echo "The processing header page</a></strong>"                >>$sourceinfo
echo "</ul>"                                                  >>$sourceinfo


echo "<hr>"                                                   >>$sourceinfo

#################################
# loop over source catalogs
#################################
list=$($UTIL/generate_filename sourcecat any any any any )
list=$(ls $list 2>/dev/null )
for sourcecat in $list; do

     inst=$($UTIL/parse_filename inst $sourcecat  )
     dimen=$($UTIL/parse_filename index $sourcecat )
     mode=$($UTIL/parse_filename mode $sourcecat )

     ###################
     # debugging output
     ####################
     if [ -n "$DEBUG" ]; then
          echo ${0##*/}: sourcecat=$sourcecat
          echo ${0##*/}: inst=$inst
          echo ${0##*/}: dimen=$dimen
          echo ${0##*/}: mode=$mode
     fi
     
     ##########################
     # heading
     #########################
     case "$inst" in 
     sis)
          echo "<h2>Sources detected in combined " >>$sourceinfo
          echo "SIS0 and SIS1 data</h2>"           >>$sourceinfo
          ;;
     gis)
          echo "<h2>Sources in combined "          >>$sourceinfo
          echo "GIS2 and GIS3 data with 256"       >>$sourceinfo
          echo "pixel resolution</h2>"             >>$sourceinfo
          ;;
     esac

     #######################
     # list all sources
     #######################

     nsources=$($UTIL/read_fits_keyword $sourcecat[1] NAXIS2 )

     if [ $nsources -eq 0 ]; then
          echo "No sources were found in these data." >>$sourceinfo
     else
          echo "<ol>" >>$sourceinfo

          typeset -i source=1
          while [ $source -le $nsources ]; do

               xpixel=$($UTIL/read_bintable $sourcecat xpixel $source )
               ypixel=$($UTIL/read_bintable $sourcecat ypixel $source )
               rpixel=$($UTIL/read_bintable $sourcecat rpixel $source )

               ra=$( $UTIL/read_bintable $sourcecat RA  $source )
               dec=$($UTIL/read_bintable $sourcecat Dec $source )
               rdeg=$($UTIL/read_bintable $sourcecat rdeg $source )

               ra=$(  $STOOLS/equals "int(${ra}  *1000+.5)/1000" )
               dec=$( $STOOLS/equals "int(${dec} *1000+.5)/1000" )
               rdeg=$($STOOLS/equals "int(${rdeg}*60*10+.5)/10" )



               hardcnts=$($UTIL/read_bintable $sourcecat hardcnts $source )
               softcnts=$($UTIL/read_bintable $sourcecat softcnts $source )

               echo "<li>" >>$sourceinfo

               echo "<strong>Sky coordinate central pixel:"  >>$sourceinfo
               echo "</strong>"                              >>$sourceinfo
               echo "($xpixel,$ypixel)<br>"                  >>$sourceinfo

               echo "<strong>R.A.:</strong>"                 >>$sourceinfo
               echo "$ra degrees<br>"                        >>$sourceinfo
               echo "<strong>Dec.:</strong>"                 >>$sourceinfo
               echo "$dec degrees<br>"                       >>$sourceinfo

               echo "<strong>Extraction radius:</strong>"    >>$sourceinfo
               echo "$rpixel pixels =  $rdeg arcmin</br>"    >>$sourceinfo

               echo "<strong>Hard (>2 keV) counts:</strong>" >>$sourceinfo
               echo "$hardcnts<br>"                          >>$sourceinfo

               echo "<strong>Soft (<2 keV) counts:</strong>" >>$sourceinfo
               echo "$softcnts<br>"                          >>$sourceinfo

               extended=$($UTIL/read_bintable $sourcecat extended $source )
               case "$extended" in
               T) echo "This source is extended" >>$sourceinfo;;
               F) echo "This source is compact"  >>$sourceinfo;;
               *) $UTIL/exception $0 1 "unknown extended flag $extended"
               esac

               echo "<p>" >>$sourceinfo

               let source=$source+1
          done

          echo "</ol>" >>$sourceinfo

     fi

done

exit 0