-
Notifications
You must be signed in to change notification settings - Fork 1
FITSFILEOPS
FITSFILEOPS static class for facilitating interaction with FITS data on disk. Typically a user would never need to use this class, but it is used internally by JPFITS almost everywhere for facilitating the extraction of header and data blocks from FITS files.
bool SCANPRIMARYUNIT(FileStream fs, bool scanpastprimarydata, ref ArrayList? header_return, ref bool has_extensions)
Scans the primary header unit and data of a FITS file. Returns false if the file is not a FITS file.
-
fs
The FileStream of the FITS file. -
scanpastprimarydata
True to set the FileStream fs position to the end of the data block, otherwise the fs position will be at the end of the primary header block, i.e. at the beginning of the primary data. -
header_return
Returns the header of the extension as an ArrayList with each 80-character header line being a String^ member of this list. Pass nullptr if not required. -
has_extensions
Returns whether or not the FITS file may contain extensions.
bool SEEKEXTENSION(FileStream fs, string extension_type, string extension_name, ref ArrayList? header_return, out long extensionStartPosition, out long extensionEndPosition, out long tableEndPosition, out long pcount, out long theap)
Find the FITS extension table of the given type and name. Returns false if the XTENSION type of the specified EXTNAME is not found. If extension_name is found the FileStream fs will be placed at the beginning of the extension's main data table block.
-
fs
The FileStream of the FITS file. If EXTNAME is found the FileStream fs will be placed at the beginning of the extension's main data table block. If EXTNAME is NOT found it will be at the end of the file. -
extension_type
The XTENSION extension type, either: "BINTABLE", "TABLE", or "IMAGE". -
extension_name
The EXTNAME extension name. If the extension is known to have no EXTNAME keyword and name, then pass an empty String and the first nameless extension of the specified type will be seeked. -
header_return
Returns the header of the extension as an ArrayList with each 80-character header line being a String^ member of this list. Pass nullptr if not required. -
extensionStartPosition
Returns the start position within the FileStream of the extension...i.e. at the block boundary at the start of its header. -
extensionEndPosition
Returns the end position within the FileStream of the extension, including after any heap, rounded up to a multiple of 2880 bytes at the last block boundary. -
tableEndPosition
Returns the end position within the FileStream of the main data table, NOT rounded to a data block boundary. -
pcount
Returns the number of bytes of any remaining fill plus supplemental heap data area after the main table endposition, IF any heap data exists. Does not represent fill bytes after the main table if no heap exists. Does not include fill bytes after the heap. -
theap
Returns the position within the filestream of the beginning of the heap relative to the beginning of the main table. Nominally equal to NAXIS1 * NAXIS2 unless THEAP keyword specifies a larger value.
bool SEEKEXTENSION(FileStream fs, string extension_type, int extension_number, ref ArrayList? header_return, out long extensionStartPosition, out long extensionEndPosition, out long tableEndPosition, out long pcount, out long theap)
Find the FITS extension table of the given type and position index number. Returns false if the XTENSION type of the specified number is not found. If the index number is found the FileStream fs will be placed at the beginning of the extension's main data table block.
-
fs
The FileStream of the FITS file. If the extension number is found the FileStream fs will be placed at the beginning of the extension's main data table block. If the extension number is NOT found it will be at the end of the file. -
extension_type
The XTENSION extension type, either: "BINTABLE", "TABLE", or "IMAGE" -
extension_number
The ONE-BASED extension number. This can be used when extensions aren't named with the EXTNAME keyword; alternatively if they are named this still returns the XTENSION extension type of the specified number. -
header_return
Returns the header of the extension as an ArrayList with each 80-character header line being a String^ member of this list. Pass nullptr if not required. -
extensionStartPosition
Returns the start position within the FileStream of the extension...i.e. at the block boundary at the start of its header. -
extensionEndPosition
Returns the end position within the FileStream of the extension, including after any heap, rounded up to a multiple of 2880 bytes at the last block boundary. -
tableEndPosition
Returns the end position within the FileStream of the main data table, NOT rounded to a data block boundary. -
pcount
Returns the number of bytes of any remaining fill plus supplemental heap data area after the main table endposition, IF any heap data exists. Does not represent fill bytes after the main table if no heap exists. Does not include fill bytes after the heap. -
theap
Returns the position within the filestream of the beginning of the heap relative to the beginning of the main table. Nominally equal to NAXIS1 * NAXIS2 unless THEAP keyword specifies a larger value.
string[] GETALLEXTENSIONNAMES(string FileName, string extension_type)
Gets all extension names of a specified extension type in the FITS file.
-
FileName
The full file name to read from disk. -
extension_type
The XTENSION extension type, either: "BINTABLE", "TABLE", or "IMAGE".