'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.
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
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