当前位置: 首页>>代码示例>>C++>>正文


C++ GFits::at方法代码示例

本文整理汇总了C++中GFits::at方法的典型用法代码示例。如果您正苦于以下问题:C++ GFits::at方法的具体用法?C++ GFits::at怎么用?C++ GFits::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GFits的用法示例。


在下文中一共展示了GFits::at方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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().url(),
                                             "No table found in file.");
    }

    // Get table pointer
    const GFitsTable& table = *fits.table(extension);

    // Read spectrum from table
    read_fits(table);

    // Return
    return;
}
开发者ID:gammalib,项目名称:gammalib,代码行数:47,代码来源:GMWLSpectrum.cpp

示例2: 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;
}
开发者ID:,项目名称:,代码行数:41,代码来源:


注:本文中的GFits::at方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。