.help cmppha Aug95 ftools.caltools
.ih
NAME
cmppha -- Converts a TYPE II to a TYPE I OGIP pha file
.ih
USAGE
cmppha infile outfile cmpmode
.ih
DESCRIPTION

  This task converts an OGIP standard TYPE II pha file to a TYPE I pha
file. A TYPE II pha file contains one extension with one or more 
spectra stored as rows. A TYPE I pha file contains only one spectrum
in an extension. This task has two modes, Squish, and Expand. Squish
compresses (adds) all the TYPE I spectra to form one spectrum, and 
writes it to the output file. Expand writes an extension for each
spectrum.
  The resultant output file can then be used by other ftools (eg GRPPHA)
that expect a TYPE I pha file as input.

.ih
SUPPORTED FITS FORMATS

  Currently only the following OGIP standards are supported by this task:
.ls HDUCLAS1/HDUVERS1 = 'SPECTRUM'/'1.*.*'
    (commonly also known as "PHAVERSN=1992a")
.le
.ls HDUCLAS2 = 'TOTAL'/'NET'/'BKG'
.le
.ls HDUCLAS3 = 'COUNT'/'RATE'
.le
.ls HDUCLAS4 = 'TYPE:II'
.le


.ih
PARAMETERS
.le
.ls infile [character string]
 The name of the FITS PHA file to be compressed or expanded.
.le 
.ls outfile [character string]
 The name of the FITS file to be written containing the PHA dataset(s)
.le
.ls cmpmode [character string]
 The conversion mode to be used. Squish or Expand are the options. Squish
 will compress all the pha spectra in one extension of a TYPE II pha
 file, into one spectrum. Expand writes a seperate extension for each spectrum. 
.le
.ls (rows="-") [character string]
 The range of rows to squish/expand.  The default of - means operate on all
 rows.  The first ten rows could be specified as ROWS=1-10, or just
 ROWS=-10.  To operate on the first three rows and all rows from 11,
 use ROWS=1-3,11-.  ROWS=3,5,7 will select only these three rows.
.le
.ls (datacol=" ") [character string]
 The column name to read in the input file.  By default (" "), cmppha will
 use either COUNTS or RATE column, as specified in the Type II PHA file
 standard.  This hidden parameter can be used to force it to operate on an
 additional column that is present in the input file (such as BACKGROUND_UP
 column in a Chandra grating pha2.fits files).
.le
.ls (backfile="%") [character string]
 Associated background filename to be written in o/p file, as the value of
 the BACKFILE keyword. The default value "%" indicates that the BACKFILE keyword value will be copied from the input file.
 file.
.le
.ls (corrfile="%") [character string]
 Associated correction filename to be written in o/p file, as the value of
 the CORRFILE keyword. The default value "%" indicates that the CORRFILE keyword
 value will be copied from the input file.
.le
.ls (arfile="%") [character string]
 Associated ancillary response filename to be written in o/p file, as the value
 of the ANCRFILE keyword. The default value "%" indicates that the ANCRFILE 
 keyword value will be copied from the input file.
.le
.ls (rmfile="%") [character string]
 Associated redistribution matrix filename to be written in o/p file, as the 
 value of the RESPFILE keyword. The default value "%" indicates that the
 RESPFILE keyword value will be copied from the input file.
.le
.ls (chatter = 9) [integer]
 Flag to indicate how chatty the task is at execution. A value of 9 is the
 default, with lower/higher values producing quieter/verbose output
 respectively.    
.le
.ls (clobber = false) [boolean]
 Flag specifying whether or not a pre-existing file with the same name as that
 requested as the output file from this task will be overwritten.
.le

.ih
BUGS
The routine to parse the ROWS parameter only has a primitive error handling
capabilities; an incorrect input here could cause unexpected behaviors.
Otherwise, none known.

.ih
SEE ALSO
.br
.nj
 Arnaud etal, 1992. Legacy, 2, 65 (OGIP/92-007)
.ju

.ih
LOG OF SIGNIFICANT CHANGES

.ls v1.0.0 (1995 Aug)
    Beta test version
.le
.ls v1.1.0 (2000 Sep)
    Updated to make it useful for Chandra grating spectra.
.le
.ls v1.1.1 (2000 Oct)
    Added datacol parameter and a few history keywords.
.le

.ih
PRIMARY AUTHOR

.nj
Rehana Yusaf
.br
.nj
HEASARC
.br
.nj
NASA/GSFC
.br
.nj
http://heasarc.gsfc.nasa.gov/cgi-bin/ftoolshelp
.br
.nj
(301) 286-6115
.ju

.endhelp
