Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://hea-www.harvard.edu/RD/saotng/adding_files.html
Дата изменения: Unknown Дата индексирования: Tue Oct 2 00:54:27 2012 Кодировка: Поисковые слова: http astro.uni-altai.ru pub article.html id 1542 |
SAOtng supports FITS files internally, so that a standard FITS image file can be sent directly to SAOtng for display using XPA:
xpaset SAOtng < foo.fitsAlso, when a new file name is sent to SAOtng, the program checks the first 2880 bytes of the file to see if it is a FITS file and if so, processes it accordingly. Support for other image file formats (or any other image format) is added to SAOtng by writing two external file access programs:
These program pairs are made known to SAOtng at start-up time in a user-configurable ASCII file. When loading an image, the program command lines first are macro-expanded to fill in user-defined arguments and then is executed externally using the system() function (see Macro expansion in SAOtng.
The ASCII file that defines the known image files consists of one or more file descriptors, each of which has the following format:
For example, the default image access file currently contains the following:
# # File access descriptions: # help explanation # file template # file type # header access command # data access command FITS image files *.fit *.fits FITS fitsextract fits='$filename' xcen=$xcen ycen=$ycen xdim=$xdim ydim=$ydim block=$block option=$blocking_preference checkNaN=$donan ofits=stdout type=image mode=h 2>$errorlog fitsheader fits='$filename' ofits=stdout type=image mode=h ARRAY files (use: foo.arr[xdim=x,ydim=y,bitpix=b,skip=s]) *.arr[*] ARRAY fitsextract fits='$filename' xcen=$xcen ycen=$ycen xdim=$xdim ydim=$ydim block=$block option=$blocking_preference checkNaN=$donan ofits=stdout type=array mode=h 2>$errorlog fitsheader fits='$filename' ofits=stdout type=array mode=h IRAF image files (qpoe, imh, etc.) *.qp *.imh *.stf *.pl QPOE IMH STF uiraf x_fmgr.e -b blkfits image='$filename' xcen=$xcen ycen=$ycen xdim=$xdim ydim=$ydim block=$block option=$blocking_preference uiraf x_fmgr.e -b hdrfits image='$filename' VIEW image files *.sdt VIEW viewextract view='$filename' xcen=$xcen ycen=$ycen xdim=$xdim ydim=$ydim block=$block option=$blocking_preference 2>$errorlog viewheader view='$filename' binary event lists *.ev *.nepr BINTABLE fitsextract fits='$filename' xcen=$xcen ycen=$ycen xdim=$xdim ydim=$ydim block=$block option=$blocking_preference checkNaN=$donan ofits=stdout type=events mode=h 2>$errorlog fitsheader fits='$filename' ofits=stdout type=events mode=h FITS files over the Net ftp://* http://* WWW wwwtng '$root' | fitsextract fits='stdin' ext='$filename' xcen=$xcen ycen=$ycen xdim=$xdim ydim=$ydim block=$block option=$blocking_preference checkNaN=$donan ofits=stdout type=image mode=h 2>$errorlog wwwtng '$root' | fitsheader fits='stdin' ext='$filename' ofits=stdout type=image mode=h compressed FITS files *.Z *.gz COMPRESSED unziptng '$root' | fitsextract fits='stdin' ext='$filename' xcen=$xcen ycen=$ycen xdim=$xdim ydim=$ydim block=$block option=$blocking_preference checkNaN=$donan ofits=stdout type=image mode=h 2>$errorlog unziptng '$root' | fitsheader fits='stdin' ext='$filename' ofits=stdout type=image mode=h
Note that you do not actually have to write full image extraction programs for your new file type. It is sufficient to write a program that generates a FITS file from your data and then pass that FITS file to the fitsextract program for sectioning. Use of this technique can be seen above in the support given to compressed FITS and FITS on the Web. For example, in the case of a compressed FITS file (containing either images or binary tables), the script tngunzip takes a compressed FITS file as input, uncompresses it and pipes the FITS result to fitsextract, which handles the extraction and blocking.
In such a case, the $root macro is used on the command line to pass to pass filename info to tngunzip (so that irrelevant filter information is not sent to the script) and the full name including filter then is passed to fitsextract via the ext= keyword. In this way, a program such as gunzip can uncompress the file and pass the result to fitsextract, where the filter can be applied appropriately.
New files are added to SAOtng using the -files [file access list] option on the command line (or the SAOTNG_FILES environment variable). The files in the file access list are then added to the system-support file types.