spacer link to MAST page spacer logo image spacer
 
link to STScI page


PSTACK

*NAME:
      PSTACK

*PURPOSE:

      To read the 'bst' files and stack appropriate scans

*CALLING SEQUENCE:

      pstack,star,infile=infile,outext=outext,bkgnd=bkgnd,/batch,istack=istack,$
          nstacks=nstacks,iscan=iscan,sstack=sstack,sscan=sscan,/inspect

*PARAMETERS:

      star   (req) (i) (0) (is)
             Star number

      infile (key) (i)
             Listing to read.  Default is BST file for that star.

      outext (key) (i)
             Set this keyword to write output FITS files.  If not set equal
             to an extension, default is BU1.  (Thus, /outext writes files
             with .BU1 extension; outext='test' writes files with .test)

      bkgnd  (opt) (i)
             Background subtraction option.  1=use background vectors from
             raw data file (default).  2=use backgrounds from table. 
             0=no background subtraction.

      istack (key) (i) (0,1) (i)
             EXACT stack number(s) to process.  Stack numbers start with 1.

      iscan  (key) (i) (0,1) (i)
             Stack(s) which include the scan number(s) given via ISCAN will be
             processed.

      sstack (key) (i) (0) (i)
             Starting stack number.  All stacks beginning with stack SSTACK
             will be processed.

      sscan  (key) (i) (0) (i)
             All stacks beginning with the stack containing scan SSCAN will
             be processed.

      nstacks (key) (i) (0) (i)
             Number of stacks to process.  This keyword may be used with the
             SSTACK or SSCAN keywords, but NOT with ISTACK or ISCAN.

      inspect (key) (i) (0) (i)
              If set, the user will be able to screen individual scans.

      batch   (key) (i)
             If set, no plots will appear on the screen and the user will
             not be prompted or allowed to reject portions of scans.  A
             postscript file of the results will be generated.  Without
             this keyword, the user has the option of writing a postscript
             file after viewing the plot on the screen.

*EXAMPLES:

      Process all stacks for star 22 in batch mode, creating output files:

       pstack,22,/out,/batch

      Process stacks 30, 31, and 32 in star 22, writing output FITS files:

       pstack,22,/out,sstack=30,nstacks=3     

      Process stacks 30, 40, and 50 in star 22, writing output FITS files:

       pstack,22,/out,istack=[30,40,50]

      Process those stacks that contain scans 500 and 600, no FITS files:

       pstack,22,iscan=[500,600]

      Process the stack containing scan 500 and all subsequent stacks:

       pstack,22,sscan=500

*SUBROUTINES CALLED:

      stk_read  Reads BST file
      within    Range checking
      stack     Stacks the scans

*FILES USED:

      BST listing file
      Input raw data file (STACK)
      Temperature and/or background correction files (STACK)
      Output stacked spectral file(s) and/or postscript files (STACK)

*SYSTEM VARIABLES USED:

      none

*PROCEDURE:

      The scan numbers are read from the listing (BST) file.  Then, the
      input raw file name is constructed using the star number.  A list of
      output file names is constructed using the star number and an image
      sequence number (1 through the number of stacks).  The stacks are
      determined on the basis of zeroes located in the listing file.  If
      the ISTACK, ISCAN, or NSTACKS keywords are set, the list of stacks
      is modified accordingly.  Then STACK is called for each stack.

*MODIFICATION HISTORY:

      22 Jun 95 LLT Wrote.
      26 Jul 95 LLT fixed some things and added sscan and sstack
      29 Feb 96 RWT use either '.bu1 or '.uu1' extension depending on value
                    of wdiff
      01 May 96 RWT use !copr system variable for disk location