events.fits[EVENTS] # open EVENTS extension of a FITS file array.file[ARRAY(s1024)] # open raw array of 1024x1024 shorts events.file[EVENTS(x:1024,y:1024...)] # open raw event listNote that in many Unix shells (e.g., csh and tcsh), filenames must be enclosed in quotes to protect the brackets from shell processing.
The file designator can be a disk file, or special keywords "stdin" and "stdout" to designate Unix standard input and standard output, respectively. Also, the string "-" (hyphen) will mean "stdin" if the file is opened for reading and "stdout" if the file is opened for writing.
A file can be an INET socket on the same or another machine using the syntax:
machine:portThus, for example:
karapet:1428specifies that I/O should be performed to/from port 1428 on the machine karapet. If no machine name is specified, the default is to use the current machine:
:1428This means to open port 1428 on the current machine. Socket support allows you to generate a distributed pipe:
on karapet: funtask1 in.fits bynars:1428 on bynars: funtask2 :1428 out.fitsThe socket mechanism provides simple parallel processing using process decomposition. Note that parallel processing using data decomposition is supported via the section specifier (see below), and the row# specifier, which is part of Table Filtering.
A file also can be a pointer to existing shared memory using the syntax:
shm:[id|@key][:size]A shared memory segment is specified with a shm: prefix, followed by either the shared memory id or the shared memory key (where the latter is prefixed by the '@' character). The size (in bytes) of the shared memory segment can then be appended (preceded by the ':' character). If the size specification is absent, the code will attempt to determine the length automatically. Note that the shared memory segment must exist already.
The specification of FITS ext name, ind number and image section must be done in order, but all sensible defaults are supported:
The ext argument specifies the name of the FITS extension (i.e. the value of the EXTENSION header parameter in a FITS extension), while the index specifies the value of the FITS EXTVER header parameter. When a Funtools data file is opened for reading using FunOpen(), the specified extension is automatically located and is used to initialize the Funtools handle.
In all cases, block is optional and defaults to 1. An 's' or 'a' can be appended to signify "sum" or "average" blocking (default is "sum"). Section specifications are given in image coordinates by default. If you wish to specify physical coordinates, add a 'p' as the last character of the section specification, before the closing bracket. For example:
Do not be confused by:
foo.fits foo.fits[*,2]The former specifies opening the second extension of the FITS file. The latter specifies application of block 2 to the image section.
foo.arr[ARRAY(r512)] # bitpix=-32 dim1=512 dim2=512 foo.arr[ARRAY(r512.400)] # bitpix=-32 dim1=512 dim2=400 foo.arr[ARRAY(r512.400]) # bitpix=-32 dim1=512 dim2=400 foo.arr[ARRAY(r512.400:2880)] # bitpix=-32 dim1=512 dim2=400 skip=2880 foo.arr[ARRAY(r512l)] # bitpix=-32 dim1=512 dim2=512 endian=little setenv ARRAY "r512.400:2880" foo.arr[ARRAY()] # bitpix=-32 dim1=512 dim2=400 skip=2880
Furthermore, image dimensions are attached to the event specification in order to tell Funtools how to bin the events into an image. They follow the conventions for the FITS TLMIN/TLMAX keywords. If the low image dimension is not specified, it defaults to 1. Thus:
TTYPE1 = 'X ' / Label for field TFORM1 = '1I ' / Data type for field TLMIN1 = 1 / Min. axis value TLMAX1 = 10 / Max. axis value TTYPE2 = 'Y ' / Label for field TFORM2 = '1I ' / Data type for field TLMIN2 = 2 / Min. axis value TLMAX2 = 11 / Max. axis value TTYPE3 = 'PHA ' / Label for field TFORM3 = '1I ' / Data type for field TTYPE4 = 'PI ' / Label for field TFORM4 = '1J ' / Data type for field TTYPE5 = 'TIME ' / Label for field TFORM5 = '1D ' / Data type for field TTYPE6 = 'DX ' / Label for field TFORM6 = '1E ' / Data type for field TLMIN6 = 1 / Min. axis value TLMAX6 = 10 / Max. axis value TTYPE7 = 'DY ' / Label for field TFORM7 = '1E ' / Data type for field TLMIN7 = 3 / Min. axis value TLMAX7 = 12 / Max. axis valueAn raw event file containing these same data would have the event specification:
setenv EVENTS "X:I:10,Y:I:10,PHA:I,PI:J,TIME:D,DX:E:10,DY:E:10"In addition to knowing the data structure, it is necessary to know the endian ordering of the data, i.e., whether or not the data is in bigendian format, so that we can convert to the native format for this platform. This issue does not arise for FITS Binary Tables because all FITS files use big-endian ordering, regardless of platform. For example, big-endian data produced on a Sun workstation but read on a Linux PC need to be byte-swapped, since PCs use little-endian ordering. To specify an ordering, use the bigendian= or endian= keywords on the command-line or the EVENTS_BIGENDIAN or EVENTS_ENDIAN environment variables. The value of the bigendian variables should be "true" or "false", while the value of the endian variables should be "little" or "big". Thus, for example, for a PC to access data produced by a Sun, use:
hrc.nepr[EVENTS(),bigendian=true] or hrc.nepr[EVENTS(),endian=big] or setenv EVENTS_BIGENDIAN true or setenv EVENTS_ENDIAN bigIf none of these are specified, the data are assumed to follow the format for that platform and no byte-swapping is performed.
bincols=([xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]])in bracket syntax, and uses the column names thus specified. The tlmin, tlmax, and binsiz specifiers determine the image binning dimensions using:
dim = (tlmax - tlmin)/binsiz (floating point data) dim = (tlmax - tlmin)/binsiz + 1 (integer data)These tlmin, tlmax, and binsiz specifiers can be omitted if TLMIN, TLMAX, and TDBIN header parameters are present in the FITS binary table header, respectively. If only one parameter is specified, it is assumed to be tlmax, and tlmin defaults to 1. If two parameters are specified, they are assumed to be tlmin and tlmax. For example, to bin an HRC event list columns "VPOS" and "UPOS", use:
hrc.nepr[bincols=(VPOS:49152,UPOS:4096)]Note that you can optionally specify the dimensions of these columns to cover cases where neither TLMAX keywords are defined in the header. If either dimension is specified, then both must be specified.
You can set the FITS_BINCOLS or EVENTS_BINCOLS environment variable as an alternative to adding the "bincols=" specifier to each file name for FITS binary tables and raw event files, respectively. If no binning keywords or environment variables are specified, or if the specified columns are not in the binary table, the Chandra parameters CPREF (or PREFX) are searched for in the FITS binary table header. Failing this, columns named "X" and "Y" are sought. If these are not found, the code looks for columns containing the characters "X" and "Y". Thus, you can bin on "DETX" and "DETX" columns without specifying them, if these are the only column names containing the "X" and "Y" characters.
Finally, when binning events, the data type of the resulting 2D image must be specified. This can be done with the "bitpix=[n]" keyword in the bracket specification. For example:
events.fits[bincols=(VPOS,UPOS),bitpix=-32]will create a floating point image binned on columns VPOS and UPOS. If no bitpix keyword is specified, bitpix=32 is assumed. As with bincols values, you also can use the FITS_BITPIX and EVENTS_BITPIX environment variables to set this value for FITS binary tables and raw event files, respectively.