########################################################################
#
# Sample Tcl script for fv 2.6
#
# This script will open 2 sample files (available online and distributed
# with the fv executables) and displays their contents in several forms...
# header keyword list, a curve, and an image.
#
# USAGE:
#
#   This file is run by fv itself... run it either from the command-line
#   as 'fv TclScript.fv' or "Open" it after fv starts. 
#
# Another version of this script (TclScript.tcl) uses the XPA TCL interface
# which allows other Tcl programs to control fv remotely.
#
########################################################################

#
# Check to make sure it is OK to start an FTP transfer
#

set ans [tk_messageBox -message "fv is about to download 2 FITS files (~150KB).\
      This should take less than a minute over a modem." \
      -type okcancel -default ok -icon warning]
if { $ans=="cancel" } return

#
# Set a variable here which points to the fits files to be opened.
# This is just to make it easier to specify files later.
#

set FitsDir ftp://heasarc.gsfc.nasa.gov/software/ftools/release/other/pdw

#
# Open 2 sample files
#

open $FitsDir/ngc1316r.fit $FitsDir/rate.fit

#
# Select one of the files and open a header window of extension #1
#

select rate.fit
display header 1 

#
# Plot a curve of Time vs Rate in POW and alter the graph's appearance
#

display curve 1 time rate
pow bounds 770 -30 1070 300
pow curve pDisp No lDisp Yes lColor Blue

#
# Select the other file and plot an image, setting its colormap to histogram
#

select ngc1316r.fit
display image 0
pow colormap scale histo
