GammaLib
2.0.0
|
FITS file class. More...
#include <GFits.hpp>
Classes | |
struct | cdouble |
struct | cfloat |
Public Member Functions | |
GFits (void) | |
Void constructor. More... | |
GFits (const GFilename &filename, const bool &create=false) | |
FITS file constructor. More... | |
GFits (const GFits &fits) | |
Copy constructor. More... | |
virtual | ~GFits (void) |
Destructor. More... | |
GFits & | operator= (const GFits &fits) |
Assignment operator. More... | |
GFitsHDU * | operator[] (const int &extno) |
Get pointer to HDU. More... | |
const GFitsHDU * | operator[] (const int &extno) const |
Get pointer to HDU (const version) More... | |
GFitsHDU * | operator[] (const std::string &extname) |
Get pointer to HDU. More... | |
const GFitsHDU * | operator[] (const std::string &extname) const |
Get pointer to HDU (const version) More... | |
void | clear (void) |
Clear FITS file. More... | |
GFits * | clone (void) const |
Clone FITS file. More... | |
std::string | classname (void) const |
Return class name. More... | |
GFitsHDU * | at (const int &extno) |
Get pointer to HDU. More... | |
const GFitsHDU * | at (const int &extno) const |
Get pointer to HDU (const version) More... | |
GFitsHDU * | at (const std::string &extname) |
Get pointer to HDU. More... | |
const GFitsHDU * | at (const std::string &extname) const |
Get pointer to HDU (const version) More... | |
GFitsImage * | image (const int &extno) |
Get pointer to image HDU. More... | |
const GFitsImage * | image (const int &extno) const |
Get pointer to image HDU (const version) More... | |
GFitsImage * | image (const std::string &extname) |
Get pointer to image HDU. More... | |
const GFitsImage * | image (const std::string &extname) const |
Get pointer to image HDU (const version) More... | |
GFitsTable * | table (const int &extno) |
Get pointer to table HDU. More... | |
const GFitsTable * | table (const int &extno) const |
Get pointer to table HDU (const version) More... | |
GFitsTable * | table (const std::string &extname) |
Get pointer to table HDU. More... | |
const GFitsTable * | table (const std::string &extname) const |
Get pointer to table HDU. More... | |
int | size (void) const |
Return number of HDUs in FITS file. More... | |
bool | is_empty (void) const |
Signals if there are no HDUs in FITS file. More... | |
GFitsHDU * | set (const int &extno, const GFitsHDU &hdu) |
Set HDU for the specified extension number. More... | |
GFitsHDU * | set (const std::string &extname, const GFitsHDU &hdu) |
Set HDU for the specified extension name. More... | |
GFitsHDU * | append (const GFitsHDU &hdu) |
Append HDU to FITS file. More... | |
GFitsHDU * | insert (const int &extno, const GFitsHDU &hdu) |
Set HDU for the specified extension number. More... | |
GFitsHDU * | insert (const std::string &extname, const GFitsHDU &hdu) |
Insert HDU into FITS file. More... | |
void | remove (const int &extno) |
Remove HDU from FITS file. More... | |
void | remove (const std::string &extname) |
Remove HDU from FITS file. More... | |
void | reserve (const int &num) |
Reserves space for HDUs in FITS file. More... | |
void | extend (const GFits &fits) |
Append FITS file. More... | |
bool | contains (const int &extno) const |
Check if HDU exists in FITS file. More... | |
bool | contains (const std::string &extname) const |
Check if HDU exists in FITS file. More... | |
const GFilename & | filename (void) const |
Return FITS filename. More... | |
int | extno (const std::string &extname) const |
Return extension number for specified extension name. More... | |
void | open (const GFilename &filename, const bool &create=false) |
Open or (optionally) create FITS file. More... | |
void | save (const bool &clobber=false) |
Saves FITS file. More... | |
void | saveto (const GFilename &filename, const bool &clobber=false) |
Saves to specified FITS file. More... | |
void | close (void) |
Close FITS file. More... | |
void | publish (const int &extno, const std::string &name="") const |
Publish FITS HDU on VO Hub. More... | |
void | publish (const std::string &extname, const std::string &name="") const |
Publish FITS HDU on VO Hub. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print FITS information. More... | |
Public Member Functions inherited from GContainer | |
virtual | ~GContainer (void) |
Destructor. More... | |
Public Member Functions inherited from GBase | |
virtual | ~GBase (void) |
Destructor. More... | |
Private Member Functions | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GFits &fits) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
GFitsImage * | new_image (void) |
Allocate new FITS image and return memory pointer. More... | |
GFitsImage * | new_primary (void) |
Return minimal primary HDU. More... | |
Private Attributes | |
std::vector< GFitsHDU * > | m_hdu |
Pointers to HDUs. More... | |
GFilename | m_filename |
FITS file name. More... | |
void * | m_fitsfile |
FITS file pointer. More... | |
bool | m_readwrite |
FITS file is readwrite (true/false) More... | |
bool | m_created |
FITS file has been created (true/false) More... | |
FITS file class.
This class provides a physical representation of a FITS file in memory. It handles creation, manipulation, writing and reading of FITS files. As a FITS file is a collection of Header Data Units (HDUs), also known as FITS file extensions, the class is designed as a container class of HDUs.
HDUs are represented by the abstract GFitsHDU base class. A HDU may be either an image, represented by the abstract GFitsImage base class, or a table, represented by the abstract GFitsTable class. The image() and table() method allow accessing the HDUs. HDUs may be accessed by index (also called extension number) or by extension name.
GFits::GFits | ( | void | ) |
Void constructor.
Constructs empty FITS file.
Definition at line 90 of file GFits.cpp.
References init_members().
Referenced by clone().
GFits::GFits | ( | const GFilename & | filename, |
const bool & | create = false |
||
) |
FITS file constructor.
[in] | filename | FITS file name. |
[in] | create | Create file if it does not exist? (default: false) |
Construct an object by opening a FITS file. If the file does not exist it will be created if create
is set to true.
Definition at line 109 of file GFits.cpp.
References init_members(), and open().
GFits::GFits | ( | const GFits & | fits | ) |
Copy constructor.
[in] | fits | FITS file. |
Definition at line 127 of file GFits.cpp.
References copy_members(), and init_members().
|
virtual |
Append HDU to FITS file.
[in] | hdu | HDU. |
Append HDU to the next free position in a FITS file. In case that no HDU exists so far in the FITS file and if the HDU to append is NOT an image, an empty primary image will be inserted as first HDU in the FITS file. This guarantees the compatibility with the FITS standard.
Definition at line 678 of file GFits.cpp.
References GFitsHDU::clone(), GFitsHDU::connect(), GFitsHDU::extno(), GFitsHDU::exttype(), FPTR, __fitsfile::HDUposition, GFitsHDU::HT_ASCII_TABLE, GFitsHDU::HT_BIN_TABLE, GFitsHDU::HT_IMAGE, m_fitsfile, m_hdu, new_primary(), and size().
Referenced by GVOClient::publish(), GCOMIaq::save(), GCOMTim::save(), GModelSpectralTable::save(), GSkyMap::save(), GObservations::likelihood::save_fits(), saveto(), GLATPsfV1::write(), GLATPsfV3::write(), GCTAEventList::write(), GGti::write(), GRmf::write(), GEnergies::write(), GNodeArray::write(), GArf::write(), GEbounds::write(), GPha::write(), GSkyMap::write(), GLATAeff::write_aeff(), GSPIResponse::write_detids(), GLATEdisp::write_edisp(), GLATAeff::write_efficiency(), GSPIResponse::write_energies(), and GLATPsfBase::write_scale().
GFitsHDU * GFits::at | ( | const int & | extno | ) |
Get pointer to HDU.
[in] | extno | Extension number [0,...,size()-1]. |
GException::out_of_range | Extension number is out of range. |
GException::runtime_error | No HDU found for specified extension number. |
Returns a pointer to the HDU with the specified extension number extno
. An exception is thrown if the HDU is not valid (i.e. NULL).
Definition at line 233 of file GFits.cpp.
References extno(), G_AT1, m_hdu, size(), and gammalib::str().
Referenced by image(), GSkyMap::load(), operator[](), publish(), GLATEventCube::read(), GMWLSpectrum::read(), GCTAObservation::read(), GModelSpatialDiffuseCube::read(), table(), and GCTAObservation::write().
const GFitsHDU * GFits::at | ( | const int & | extno | ) | const |
Get pointer to HDU (const version)
[in] | extno | Extension number [0,...,size()-1]. |
GException::out_of_range | Extension number is out of range. |
GException::runtime_error | No HDU found for specified extension number. |
Returns a pointer to the HDU with the specified extension number extno
. An exception is thrown if the HDU is not valid (i.e. NULL).
Definition at line 272 of file GFits.cpp.
References extno(), G_AT1, m_hdu, size(), and gammalib::str().
GFitsHDU * GFits::at | ( | const std::string & | extname | ) |
Get pointer to HDU.
[in] | extname | Name of HDU extension. |
GException::invalid_argument | No HDU with specified name has been found. |
Returns a pointer to the HDU with the specified extname
. An exception is thrown if the HDU is not valid (i.e. NULL).
const GFitsHDU * GFits::at | ( | const std::string & | extname | ) | const |
Get pointer to HDU (const version)
[in] | extname | Name of HDU extension. |
GException::invalid_argument | No HDU with specified name has been found. |
Returns a pointer to the HDU with the specified extname
. An exception is thrown if the HDU is not valid (i.e. NULL).
|
inlinevirtual |
|
virtual |
Clear FITS file.
Implements GBase.
Definition at line 195 of file GFits.cpp.
References free_members(), and init_members().
Referenced by GCaldb::init_members().
|
virtual |
void GFits::close | ( | void | ) |
Close FITS file.
Closing detaches a FITS file from the GFits object and returns a clean empty object.
Definition at line 1342 of file GFits.cpp.
References free_members(), and init_members().
Referenced by GCaldb::close(), GCTAEventList::fetch(), GCTAEdisp2D::fetch(), GCOMInstChars::load(), GCOMD1Response::load(), GCOMD2Response::load(), GCOMEventList::load(), GMWLSpectrum::load(), GCTAAeffArf::load(), GCTAPsfVector::load(), GLATEventList::load(), GCTABackground2D::load(), GCTABackground3D::load(), GLATEventCube::load(), GCOMTim::load(), GCOMEventCube::load(), GCTAAeff2D::load(), GCTAPsf2D::load(), GCTAPsfKing::load(), GCTAPsfTable::load(), GSPIEventCube::load(), GCOMOads::load(), GCTAEventList::load(), GCOMBvcs::load(), GCTACubeBackground::load(), GSPIObservation::load(), GLATLtCube::load(), GCTAEventCube::load(), GCOMResponse::load(), GCTAModelSkyCube::load(), GGti::load(), GCTACubeExposure::load(), GCTAModelSpatialLookup::load(), GEnergies::load(), GModelSpectralTable::load(), GNodeArray::load(), GCTACubePsf::load(), GEbounds::load(), GCTACubeEdisp::load(), GSPIResponse::load(), GCTAObservation::load(), GCOMObservation::load(), GCOMDri::load(), GSkyMap::load(), GCTAResponseIrf::load_aeff(), GCTAResponseIrf::load_background(), GCOMObservation::load_drb(), GCOMObservation::load_dre(), GCOMObservation::load_drg(), GCOMObservation::load_drx(), GCTAResponseIrf::load_edisp(), GSPIResponse::load_irf(), GSPIResponse::load_irfs(), GModelTemporalLightCurve::load_nodes(), GModelTemporalPhaseCurve::load_nodes(), GCTAResponseIrf::load_psf(), GCOMStatus::load_status(), GLATObservation::load_unbinned(), GCOMEventList::save(), GSPIEventCube::save(), GCTACubeBackground::save(), GCTACubeExposure::save(), GCTACubePsf::save(), GCTACubeEdisp::save(), GSPIResponse::save(), GCOMDri::save(), GObservations::likelihood::save_fits(), and saveto().
|
inline |
Check if HDU exists in FITS file.
[in] | extno | Extension number [0,...,size()-1]. |
extno
exists, false otherwise.Returns true if a HDU with the specified extension number is present, false otherwise.
Definition at line 282 of file GFits.hpp.
References size().
Referenced by GCTAResponseIrf::load_aeff(), GCTAResponseIrf::load_background(), GCTAResponseIrf::load_edisp(), GPulsar::load_fits(), GCTAResponseIrf::load_psf(), GLATEventList::read(), GLATPsf::read(), GLATEdisp::read(), GCTAEventList::read(), GLATAeff::read(), GCTAEventCube::read(), GCTAObservation::read(), GPha::read(), GSPIResponse::read_energies(), GLATLtCubeMap::write(), GCTAEventCube::write(), GGti::write(), GEnergies::write(), GRmf::write(), GCTACubeEdisp::write(), GCTAObservation::write(), GArf::write(), GNodeArray::write(), GEbounds::write(), and GPha::write().
|
inline |
|
private |
Copy class members.
fits | Object to be copied |
The method does not copy the FITS file name and FITS file pointer. This prevents that several copies of the FITS file pointer exist in different instances of GFits, which would lead to confusion since one instance could close the file while for another it still would be opened. The rule ONE INSTANCE - ONE FILE applies.
Definition at line 1535 of file GFits.cpp.
References GFilename::clear(), m_created, m_filename, m_fitsfile, m_hdu, and m_readwrite.
Referenced by GFits(), and operator=().
void GFits::extend | ( | const GFits & | fits | ) |
Append FITS file.
[in] | fits | FITS file. |
Append all extension of fits
file to FITS file.
Definition at line 934 of file GFits.cpp.
References GFitsHDU::connect(), GFitsHDU::extno(), extno(), FPTR, __fitsfile::HDUposition, is_empty(), m_fitsfile, m_hdu, reserve(), and size().
int GFits::extno | ( | const std::string & | extname | ) | const |
Return extension number for specified extension name.
[in] | extname | Name of HDU extension. |
Returns the extension number for a specified extension name extname
. If the extension name if "PRIMARY" an extension number of 0 is returned. If the extension is not found, -1 is returned.
extname
is case in-sensitive.
Definition at line 990 of file GFits.cpp.
References m_hdu, size(), and gammalib::toupper().
Referenced by at(), contains(), extend(), insert(), publish(), remove(), and set().
|
inline |
Return FITS filename.
Returns the FITS file name. If the object is not yet associated to a file the file name will be empty.
Definition at line 313 of file GFits.hpp.
References m_filename.
Referenced by GCTAEventList::fetch(), open(), GSPIEventCube::read(), GMWLSpectrum::read(), GCTAEventList::read(), GCTAObservation::read(), GSPIEventCube::read_models(), gammalib::spi_hdu(), gammalib::spi_num_hdus(), and GCTAEventList::write().
|
private |
Delete class members.
Closes the FITS file if it had been opened and deallocate all HDUs.
If the G_DELETE_EMPTY_FITS_FILES option is defined, files without HDUs or corrupted files will be deleted. This prevents leaving corrupted files on disk (yet, corrupted files may be generated by another application, thus this is not 100% safe; better make the code solid against reading corrupted FITS files).
Definition at line 1565 of file GFits.cpp.
References __ffclos, __ffdelt, FPTR, G_FREE_MEM, m_created, m_fitsfile, m_hdu, and size().
Referenced by clear(), close(), operator=(), and ~GFits().
GFitsImage * GFits::image | ( | const int & | extno | ) |
Get pointer to image HDU.
[in] | extno | Extension number [0,...,size()-1]. |
GException::invalid_argument | Requested HDU is not an image. |
Returns a pointer to the image HDU with extension number extno.
Definition at line 368 of file GFits.cpp.
References at(), G_IMAGE1, and gammalib::str().
Referenced by GCOMResponse::load(), GCTAModelSkyCube::load(), GCOMDri::load(), GCOMObservation::load_drb(), GCOMObservation::load_drg(), GCOMObservation::load_drx(), GSPIResponse::load_irf(), new_image(), new_primary(), publish(), GLATEventCube::read(), GCOMEventCube::read(), GCTACubeBackground::read(), GCTAEventCube::read(), GCTACubeExposure::read(), GCTACubePsf::read(), GCTACubeEdisp::read(), and GSPIResponse::read().
const GFitsImage * GFits::image | ( | const int & | extno | ) | const |
Get pointer to image HDU (const version)
[in] | extno | Extension number [0,...,size()-1]. |
GException::invalid_argument | Requested HDU is not an image. |
Returns a pointer to the image HDU with extension number extno.
Definition at line 397 of file GFits.cpp.
References at(), G_IMAGE1, and gammalib::str().
GFitsImage * GFits::image | ( | const std::string & | extname | ) |
Get pointer to image HDU.
[in] | extname | Name of HDU extension. |
GException::invalid_argument | Requested HDU is not an image. |
Returns a pointer to the image HDU with extension name extname.
const GFitsImage * GFits::image | ( | const std::string & | extname | ) | const |
Get pointer to image HDU (const version)
[in] | extname | Name of HDU extension. |
GException::invalid_argument | Requested HDU is not an image. |
Returns a pointer to the image HDU with extension name extname.
|
private |
Initialise class members.
Definition at line 1510 of file GFits.cpp.
References GFilename::clear(), m_created, m_filename, m_fitsfile, m_hdu, and m_readwrite.
Referenced by clear(), close(), GFits(), and operator=().
Set HDU for the specified extension number.
[in] | extno | Extension number [0,...,size()-1]. |
[in] | hdu | HDU. |
GException::out_of_range | Extension number out of range. |
GException::invalid_argument | Attempt to insert non-image HDU in first slot. |
Definition at line 778 of file GFits.cpp.
References GFitsHDU::clone(), GFitsHDU::connect(), GFitsHDU::extno(), extno(), GFitsHDU::exttype(), FPTR, G_INSERT1, __fitsfile::HDUposition, GFitsHDU::HT_IMAGE, m_fitsfile, m_hdu, and size().
Referenced by insert().
Insert HDU into FITS file.
[in] | extname | Extension name. |
[in] | hdu | Extension. |
hdu
.GException::invalid_argument | Extension name not found. |
Inserts an extension hdu
into the FITS file before the extension with the specified extname
.
|
inlinevirtual |
Signals if there are no HDUs in FITS file.
Signals if the FITS file does not contain any HDUs.
Implements GContainer.
Definition at line 251 of file GFits.hpp.
References m_hdu.
Referenced by extend().
|
private |
Allocate new FITS image and return memory pointer.
runtime_error | Invalid number of bits per pixel. |
Depending on the number of bits per pixel, a FITS image is allocated and the pointer is returned. The following FITS image classes are handled: GFitsImageByte (bitpix=8) GFitsImageShort (bitpix=16) GFitsImageLong (bitpix=32) GFitsImageLongLong (bitpix=64) GFitsImageFloat (bitpix=-32) GFitsImageDouble (bitpix=-64) The information about the number of bits per pixels is extracted from the actual HDU.
Definition at line 1642 of file GFits.cpp.
References __ffgiet, __ffgky, __TLONGLONG, FPTR, G_NEW_IMAGE, image(), m_fitsfile, and gammalib::str().
Referenced by open().
|
private |
Return minimal primary HDU.
Creates a primary HDU in memory and open it using the GFitsHDU::open() method.
Definition at line 1724 of file GFits.cpp.
References __ffclos, __ffcrim, __ffdelt, __ffinit, FPTR, image(), GFitsHDU::m_fitsfile, and GFitsHDU::open().
Referenced by append().
void GFits::open | ( | const GFilename & | filename, |
const bool & | create = false |
||
) |
Open or (optionally) create FITS file.
[in] | filename | Name of FITS file to be opened. |
[in] | create | Create FITS file if it does not exist (default: false) |
GException::invalid_argument | Class instance contains already an opened FITS file. Close file before opening a new one using GFits::close(). |
GException::fits_error | Unable to determine number of HDUs in the FITS file. |
GException::runtime_error | Unknown HDU type encountered. |
This method opens all HDUs that are found in the specified FITS file. If the file does not exist, and if create=true, a new FITS file is created. For each HDU, a GFitsHDU object is associated to the GFits object. The HDUs can then be accessed using the hdu(const std::string&) or hdu(int extno) method. Any environment variable present in the filename will be expanded.
Definition at line 1041 of file GFits.cpp.
References __ffinit, __ffopen, __ffthdu, FHANDLE, filename(), gammalib::fits_move_to_hdu(), FPTR, G_OPEN, GFitsHDU::HT_ASCII_TABLE, GFitsHDU::HT_BIN_TABLE, GFitsHDU::HT_IMAGE, m_created, m_filename, m_fitsfile, m_hdu, m_readwrite, new_image(), GFitsHDU::open(), GFilename::remove(), gammalib::str(), and GFilename::url().
Referenced by GFits(), and GCaldb::open().
Assignment operator.
[in] | fits | FITS file. |
Definition at line 165 of file GFits.cpp.
References copy_members(), free_members(), and init_members().
|
inline |
Get pointer to HDU.
[in] | extno | Extension number [0,...,size()-1]. |
Returns a pointer to the HDU with the specified extension number extno
. No range checking is performed. If the HDU is not valid, NULL is returned.
Definition at line 173 of file GFits.hpp.
References m_hdu.
|
inline |
Get pointer to HDU (const version)
[in] | extno | Extension number [0,...,size()-1]. |
Returns a pointer to the HDU with the specified extension number extno
. No range checking is performed. If the HDU is not valid, NULL is returned.
Definition at line 189 of file GFits.hpp.
References m_hdu.
|
inline |
Get pointer to HDU.
[in] | extname | Name of HDU extension. |
Returns a pointer to the HDU with the specified extname
. No checking for the existence of extname
is performed. If the HDU is not valid, NULL is returned.
Definition at line 206 of file GFits.hpp.
References at().
|
inline |
Get pointer to HDU (const version)
[in] | extname | Name of HDU extension. |
Returns a pointer to the HDU with the specified extname
. No checking for the existence of extname
is performed. If the HDU is not valid, NULL is returned.
Definition at line 223 of file GFits.hpp.
References at().
Print FITS information.
[in] | chatter | Chattiness. |
Implements GBase.
Definition at line 1455 of file GFits.cpp.
References m_created, m_filename, m_hdu, m_readwrite, NORMAL, gammalib::parformat(), gammalib::reduce(), SILENT, size(), and gammalib::str().
void GFits::publish | ( | const int & | extno, |
const std::string & | name = "" |
||
) | const |
Publish FITS HDU on VO Hub.
[in] | extno | Extension number. |
[in] | name | Optional name of published ressource. |
Publishes FITS HDU with specified extno
.
Definition at line 1363 of file GFits.cpp.
References at(), GFitsHDU::extname(), GFitsHDU::HT_IMAGE, image(), GVOClient::publish(), and table().
Referenced by publish().
void GFits::publish | ( | const std::string & | extname, |
const std::string & | name = "" |
||
) | const |
|
virtual |
Remove HDU from FITS file.
[in] | extno | Extension number [0,...,size()-1]. |
GException::out_of_range | Specified extno is out of range. |
Implements GContainer.
Definition at line 862 of file GFits.cpp.
References extno(), G_REMOVE1, GFitsHDU::HT_IMAGE, m_hdu, and size().
Referenced by GCTABackground2D::save(), GCTABackground3D::save(), GCTAAeff2D::save(), GCTAModelSpatialLookup::save(), GCTAPsf2D::save(), GCTAPsfTable::save(), GCTAPsfKing::save(), GCTAEdisp2D::save(), GLATLtCubeMap::write(), GCTAEventCube::write(), GGti::write(), GRmf::write(), GEnergies::write(), GCTACubeEdisp::write(), GCTAObservation::write(), GArf::write(), GNodeArray::write(), GEbounds::write(), and GPha::write().
void GFits::remove | ( | const std::string & | extname | ) |
Remove HDU from FITS file.
[in] | extname | Name of HDU extension. |
GException::invalid_argument | Specified extname not found in FITS file. |
|
inlinevirtual |
Reserves space for HDUs in FITS file.
[in] | num | Number of HDUs |
Reserves space for num
HDUs in the FITS file.
Implements GContainer.
Definition at line 265 of file GFits.hpp.
References m_hdu.
Referenced by extend().
void GFits::save | ( | const bool & | clobber = false | ) |
Saves FITS file.
[in] | clobber | Overwrite existing FITS file? (default: false). |
GException::invalid_value | Attemting to overwrite an existing file without having specified clobber=true. FITS file needs to be opened before saving. |
Saves all HDUs of an open FITS file to disk. After saving, the FITS file remains open. Invoke the close() method if explicit closing is needed. Note that de-allocation of the GFits object also closes the FITS file.
In the special case that no first HDU exists an empty primary image is created.
Definition at line 1178 of file GFits.cpp.
References __ffcrim, __ffdhdu, __ffflus, __ffmahd, __ffthdu, FPTR, G_SAVE, m_created, m_filename, m_fitsfile, m_hdu, and size().
Referenced by saveto(), and GApplication::stamp().
void GFits::saveto | ( | const GFilename & | filename, |
const bool & | clobber = false |
||
) |
Saves to specified FITS file.
[in] | filename | Filename. |
[in] | clobber | Overwrite existing FITS file? |
GException::invalid_value | Specified file exists already. Overwriting requires clobber=true. |
Saves the FITS object into a specific file.
Definition at line 1293 of file GFits.cpp.
References append(), close(), GFilename::exists(), G_SAVETO, m_hdu, GFilename::remove(), save(), size(), and GFilename::url().
Referenced by GVOClient::publish(), GCOMEventList::save(), GCOMIaq::save(), GLATEventCube::save(), GLATPsf::save(), GCOMTim::save(), GCOMEventCube::save(), GLATEdisp::save(), GSPIEventCube::save(), GLATAeff::save(), GCTACubeBackground::save(), GLATLtCube::save(), GCTAEventCube::save(), GCTACubeExposure::save(), GRmf::save(), GModelSpectralTable::save(), GArf::save(), GCTACubePsf::save(), GCTACubeEdisp::save(), GSPIResponse::save(), GModelSpatialDiffuseCube::save(), GCOMDri::save(), GPha::save(), GSkyMap::save(), and GObservations::likelihood::save_fits().
Set HDU for the specified extension number.
[in] | extno | Extension number [0,...,size()-1]. |
[in] | hdu | HDU. |
GException::out_of_range | Extension number out of range. |
GException::invalid_argument | Attempt to insert non-image HDU in first slot. |
Definition at line 597 of file GFits.cpp.
References GFitsHDU::clone(), extno(), GFitsHDU::exttype(), FPTR, G_SET1, __fitsfile::HDUposition, GFitsHDU::HT_IMAGE, m_fitsfile, m_hdu, and size().
Referenced by set().
|
inlinevirtual |
Return number of HDUs in FITS file.
Returns the number of Header Data Units (HDUs) in the FITS file.
Implements GContainer.
Definition at line 237 of file GFits.hpp.
References m_hdu.
Referenced by append(), at(), contains(), extend(), extno(), free_members(), gammalib::gadf_hduclas4(), insert(), GSkyMap::load(), print(), GLATEventCube::read(), GMWLSpectrum::read(), GModelSpatialDiffuseCube::read(), remove(), save(), saveto(), set(), gammalib::spi_hdu(), gammalib::spi_num_hdus(), GApplication::stamp(), GCTACubeBackground::write(), GCTACubeExposure::write(), GCTACubePsf::write(), and GCTACubeEdisp::write().
GFitsTable * GFits::table | ( | const int & | extno | ) |
Get pointer to table HDU.
[in] | extno | Extension number [0,...,size()-1]. |
GException::invalid_argument | Requested HDU is not a table. |
Returns a pointer to the table HDU with extension number extno.
Definition at line 482 of file GFits.cpp.
References at(), G_TABLE1, and gammalib::str().
Referenced by GCaldb::copy_members(), GCTAEventList::fetch(), GCTAEdisp2D::fetch(), GApplication::gCO2e(), GCOMInstChars::load(), GCOMD1Response::load(), GCOMD2Response::load(), GCTAAeffArf::load(), GCTAPsfVector::load(), GEphemerides::load(), GCTABackground2D::load(), GCTABackground3D::load(), GCOMTim::load(), GCTAAeff2D::load(), GCTAPsf2D::load(), GCTAPsfKing::load(), GCTAPsfTable::load(), GCOMOads::load(), GCOMBvcs::load(), GCTAModelSkyCube::load(), GGti::load(), GCTAModelSpatialLookup::load(), GEnergies::load(), GNodeArray::load(), GEbounds::load(), GCTAResponseIrf::load_aeff(), GCTAResponseIrf::load_background(), GCTAResponseIrf::load_edisp(), GModelSpectralTable::load_eng(), GPulsar::load_fits(), GModelTemporalLightCurve::load_nodes(), GModelTemporalPhaseCurve::load_nodes(), GModelSpectralTable::load_par(), GCTAResponseIrf::load_psf(), GModelSpectralTable::load_spec(), GCOMStatus::load_status(), GCaldb::open(), publish(), GCOMEventList::read(), GLATEventList::read(), GLATPsf::read(), GLATEventCube::read(), GLATEdisp::read(), GMWLSpectrum::read(), GCTACubeBackground::read(), GCTAEventList::read(), GLATAeff::read(), GLATLtCube::read(), GCTAEventCube::read(), GCTACubeExposure::read(), GRmf::read(), GCTACubePsf::read(), GCTACubeEdisp::read(), GArf::read(), GModelSpatialDiffuseCube::read(), GPha::read(), GSPIResponse::read_detids(), GSPIResponse::read_energies(), GCTACubePsf::write(), and GSPIResponse::write_energies().
const GFitsTable * GFits::table | ( | const int & | extno | ) | const |
Get pointer to table HDU (const version)
[in] | extno | Extension number [0,...,size()-1]. |
GException::invalid_argument | Requested HDU is not a table. |
Returns a pointer to the table HDU with extension number extno.
Definition at line 511 of file GFits.cpp.
References at(), G_TABLE1, and gammalib::str().
GFitsTable * GFits::table | ( | const std::string & | extname | ) |
Get pointer to table HDU.
[in] | extname | Name of HDU extension. |
GException::invalid_argument | Requested HDU is not a table. |
Returns a pointer to the table HDU with extension name extname.
const GFitsTable * GFits::table | ( | const std::string & | extname | ) | const |
Get pointer to table HDU.
[in] | extname | Name of HDU extension. |
GException::invalid_argument | Requested HDU is not a table. |
Returns a pointer to the table HDU with extension name extname.
|
private |
FITS file has been created (true/false)
Definition at line 147 of file GFits.hpp.
Referenced by copy_members(), free_members(), init_members(), open(), print(), and save().
|
private |
FITS file name.
Definition at line 144 of file GFits.hpp.
Referenced by copy_members(), filename(), init_members(), open(), print(), and save().
|
private |
FITS file pointer.
Definition at line 145 of file GFits.hpp.
Referenced by append(), copy_members(), extend(), free_members(), init_members(), insert(), new_image(), open(), save(), and set().
|
private |
Pointers to HDUs.
Definition at line 143 of file GFits.hpp.
Referenced by append(), at(), copy_members(), extend(), extno(), free_members(), init_members(), insert(), is_empty(), open(), operator[](), print(), remove(), reserve(), save(), saveto(), set(), and size().
|
private |
FITS file is readwrite (true/false)
Definition at line 146 of file GFits.hpp.
Referenced by copy_members(), init_members(), open(), and print().