本文整理汇总了C++中GFits::size方法的典型用法代码示例。如果您正苦于以下问题:C++ GFits::size方法的具体用法?C++ GFits::size怎么用?C++ GFits::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFits
的用法示例。
在下文中一共展示了GFits::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
/***********************************************************************//**
* @brief Read LAT event cube from FITS file.
*
* @param[in] fits FITS file.
*
* It is assumed that the counts map resides in the primary extension of the
* FITS file, the energy boundaries reside in the EBOUNDS extension and the
* Good Time Intervals reside in the GTI extension. The method clears the
* object before loading, thus any events residing in the object before
* loading will be lost.
***************************************************************************/
void GLATEventCube::read(const GFits& fits)
{
// Clear object
clear();
// Get HDUs
const GFitsImage& hdu_cntmap = *fits.image("Primary");
const GFitsTable& hdu_ebounds = *fits.table("EBOUNDS");
const GFitsTable& hdu_gti = *fits.table("GTI");
// Load counts map
read_cntmap(hdu_cntmap);
// Load energy boundaries
read_ebds(hdu_ebounds);
// Load GTIs
read_gti(hdu_gti);
// Load additional source maps
for (int i = 1; i < fits.size(); ++i) {
if (fits.at(i)->exttype() == GFitsHDU::HT_IMAGE) {
const GFitsImage& hdu_srcmap = *fits.image(i);
read_srcmap(hdu_srcmap);
}
}
// Return
return;
}
示例2: read
/***********************************************************************//**
* @brief Read spectrum from FITS file
*
* @param[in] fits FITS file.
* @param[in] extno Extension number of spectrum.
*
* @exception GMWLException::file_open_error
* No table found in file.
*
* Read the spectrum from a FITS table found in the specified extension.
* In no extension number if specified (or if extno=0) then the spectrum
* is loaded from the first table extension that is found in the file.
***************************************************************************/
void GMWLSpectrum::read(const GFits& fits, const int& extno)
{
// Clear object
clear();
// Initialise extension number
int extension = extno;
// If the extension number is 0 then load first FITS table in file.
if (extension == 0) {
for (int i = 0; i < fits.size(); ++i) {
if (fits.at(i)->exttype() == GFitsHDU::HT_ASCII_TABLE ||
fits.at(i)->exttype() == GFitsHDU::HT_BIN_TABLE) {
extension = i;
break;
}
}
}
// If we found no table then throw an exception
if (extension == 0) {
throw GMWLException::file_open_error(G_READ, fits.filename(),
"No table found in file.");
}
// Get table pointer
const GFitsTable& table = *fits.table(extension);
// Read spectrum from table
read_fits(table);
// Return
return;
}
示例3: write
/***********************************************************************//**
* @brief Write CTA exposure cube into FITS object.
*
* @param[in] fits FITS file.
*
* Writes the exposure cube image, the energy boundaries and the Good Time
* Intervals into the FITS object.
***************************************************************************/
void GCTACubeExposure::write(GFits& fits) const
{
// Write cube
m_cube.write(fits);
// Get last HDU and write attributes
GFitsHDU& hdu = *fits[fits.size()-1];
write_attributes(hdu);
// Write energy boundaries
m_ebounds.write(fits);
// Write GTIs
m_gti.write(fits);
// Return
return;
}