NAME

ahgetvector - Extract vectors from a FITS file and output into an ASCII file

USAGE

ahgetvector infile outfile selmode xcol ycol row element

DESCRIPTION

'ahgetvecor' script extracts vectors from a pair of columns in a FITS file table and formats the data as text in an ASCII file with two columns. This format conversion facilitates the plotting of selected elements in columns with multiple elements.

The input FITS file extension must be in the form of a table where columns are either a single element array or a multi-element array. The task may output the elements in two columns with the same number of elements for a given row by setting 'selmode=2', selecting the row number using the 'row' parameter, and the names of the two columns using the 'xcol' and 'ycol' parameters. Alternatively, the task may output the values in single-element column and those for a particular element in a multi-element column for each row by setting 'selmode=1'. In this case the single-element column is specified by 'xcol' the multi-element column by 'ycol', and element index selected using the 'element' parameter. This element index must be within the valid range of vector elements for the 'ycol' column. For example, if the TFORM for 'ycol' is 3E, then 'element' must not be larger than 3. The file name and extension are determined by the 'infile' parameter. If no extension is specified, the first extension is used.

PARAMETERS

infile [filename]
Name of input FITS file.

outfile [filename]
Name of output ASCII file, or STDOUT to write to screen.

selmode [integer]
Select the data by either subelement ('selmode=1') or by row ('selmode=2'). If selecting by subelement, the parameter 'element' must be entered. If selecting by row, the parameter 'row' must be entered.

xcol [string]
Single column name to output as the first column in the output file.

ycol [string]
Single column name to output as the second column in the output file.

row [integer]
If the parameter 'selmode' is set to 2, this parameter specifies which row to retrieve. Must be a single row number, not a range of rows. This parameter is not used when 'selmode' is set to 1.

element [integer]
If the parameter 'selmode' is set to 1, this parameter specifies which element to retrieve. This must be within the valid range of vector elements for the 'ycol' column. This parameter is not used when 'selmode' is set to 2.

(cleanup = yes) [bool]
Delete temporary files ([yes]/no)

(buffer = -1) [integer]
Rows to buffer (-1=auto, 0=none, >0=numrows).

(clobber = no) [boolean]
Overwrites the existing output file if set to yes (yes/[no]).

(chatter = 1) [integer]
Chatter level for output. Set to 0 to suppress output, or to 1, 2, or 3 for increasing the chatter of the output.

(logfile = !DEFAULT) [string]
Log filename. If set to DEFAULT uses the name of the task and, if preceded by '!', overwrite the file if it exists. If set to NONE no log file is created.

(debug = no) [boolean]
Diagnostic output is printed out on the screen if set to yes (yes/[no]).

(history = yes) [boolean]
Records tool parameters in HISTORY ([yes]/no).

(mode = ql) [string ql|hl|q]
Mode to query the parameter file. Acceptable values include: 'ql' (query and learn/remember), 'hl' (hidden and learn/remember), 'q' (query but don't remember), 'h' (hidden).

EXAMPLES

  1. Extract vectors from a reflectivity probability file by element. Get the reflectivity for every energy, for the 2nd angle.
                ahgetvector.pl infile=ah_sxt_xrtreftb.fits[AX_SXT_FRONT] outfile=out.txt selmode=1 xcol=energy ycol=refprob01 row=- element=2 
          
    Where the input file has 3 columns with the format:
                Energy    Angle     RefProb01
                keV       rad       
                1E        2E        2E
          
    And 4 rows under each column:
                Energy    Angle       RefProb01
                10        0.02 0.03   0.51 0.29
                12        0.02 0.03   0.44 0.27
                14        0.02 0.03   0.41 0.23
                15        0.02 0.03   0.31 0.17
          
    The output ASCII file out.txt is as follows:
                energy    refprob01
                10        0.29
                12        0.27
                14        0.23
                15        0.17  
          
  2. Extract vectors from a reflectivity probability file by row. Get the reflectivity for every angle, for the 3rd energy.
                ahgetvector.pl infile=ah_sxt_xrtreftb.fits[AX_SXT_FRONT] outfile=out.txt selmode=2 xcol=angle ycol=refprob01 row=3 element=-
          
    Where the input file has 3 columns with the format:
                Energy    Angle     RefProb01
                keV       rad       
                1E        2E        2E
          
    And 4 rows under each column:
                Energy    Angle       RefProb01
                10        0.02 0.03   0.51 0.29
                12        0.02 0.03   0.44 0.27
                14        0.02 0.03   0.41 0.23
                15        0.02 0.03   0.31 0.17
          
    The output ASCII file out.txt is as follows:
                angle    refprob01
                0.02      0.41
                0.03      0.23
          

SEE ALSO

LAST MODIFIED

February 2, 2016