The ahgetvector Perl 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 a 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 the element index is 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 keyword for 'ycol' is 3E, 'element' must not be larger than three. The file name and extension are determined by the 'infile' parameter. If no extension is specified, the first extension is used.
ahgetvector infile="ah_sxt_xrtreftb.fits[AX_SXT_FRONT]" outfile=out.txt selmode=1 xcol=energy ycol=REFPROB01 \ row=- element=2In this example, the input file has 3 columns with the format:
ENERGY ANGLE REFPROB01 keV rad 1E 2E 2EAnd 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.17The output ASCII file out.txt is as follows:
ENERGY REFPROB01 10 0.29 12 0.27 14 0.23 15 0.17
ahgetvector infile="ah_sxt_xrtreftb.fits[AX_SXT_FRONT]" outfile=out.txt selmode=2 xcol=angle ycol=REFPROB01 \ row=3 element=-In this example, the input file has 3 columns with the format:
ENERGY ANGLE REFPROB01 keV rad 1E 2E 2EAnd 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.17The output ASCII file out.txt is as follows:
ANGLE REFPROB01 0.02 0.41 0.03 0.23