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


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

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


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

示例1: write

/***********************************************************************//**
 * @brief Write CTA event cube into FITS file.
 *
 * @param[in] fits FITS file.
 *
 * Writes CTA event cube into a FITS file. The following HDUs will be written
 *
 *      COUNTS - Counts cube
 *      WEIGHTS - Weights for each counts cube bin
 *      EBOUNDS - Energy boundaries
 *      GTI - Good Time Intervals
 *
 * The counts cube will be written as a double precision sky map. The
 * weighing cube contains the weight for each counts cube, computed as the
 * fraction of the event bin that has been selected in filling the counts
 * cube. This allows to account for proper stacking of observations with
 * different energy thresholds, or different regions of interest. The energy
 * boundaries for all counts cube layers are also written, as well as the
 * Good Time Intervals that have been used in generating the counts cube.
 ***************************************************************************/
void GCTAEventCube::write(GFits& fits) const
{
    // Remove HDUs if they exist already
    if (fits.contains("GTI")) {
        fits.remove("GTI");
    }
    if (fits.contains("EBOUNDS")) {
        fits.remove("EBOUNDS");
    }
    if (fits.contains("WEIGHTS")) {
        fits.remove("WEIGHTS");
    }
    if (fits.contains("COUNTS")) {
        fits.remove("COUNTS");
    }
    if (fits.contains("Primary")) {
        fits.remove("Primary");
    }

    // Write counts cube
    m_map.write(fits, "COUNTS");

    // Write cube weighting
    m_weights.write(fits, "WEIGHTS");

    // Write energy boundaries
    ebounds().write(fits);

    // Write Good Time intervals
    gti().write(fits);

    // Return
    return;
}
开发者ID:,项目名称:,代码行数:54,代码来源:

示例2: read

/***********************************************************************//**
 * @brief Read CTA event cube from FITS file
 *
 * @param[in] fits FITS file.
 *
 * Read an event cube from a FITS file. The following HDUs will be read
 *
 *      COUNTS - Counts cube (or primary extension if COUNTS does not exist)
 *      WEIGHTS - Weights for each counts cube bin (optional)
 *      EBOUNDS - Energy boundaries
 *      GTI - Good Time Intervals
 *
 * The method clears the event cube before reading, thus any events residing
 * in the event cube will be lost.
 ***************************************************************************/
void GCTAEventCube::read(const GFits& fits)
{
    // Clear object
    clear();

    // Set counts cube HDU
    std::string counts_hdu("Primary");
    if (fits.contains("COUNTS")) {
        counts_hdu = "COUNTS";
    }
    
    // Get HDUs
    const GFitsImage& hdu_cntmap  = *fits.image(counts_hdu);
    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);

    // If a WEIGHTS HDU exist then load it from the FITS file ...
    if (fits.contains("WEIGHTS")) {

        // Get WEIGHTS HDU
        const GFitsImage& hdu_weights = *fits.image("WEIGHTS");

        // Read HDU
        m_weights.read(hdu_weights);

    }

    // ... otherwise set the weight map to unity
    else {
        m_weights = m_map;
        m_weights = 1.0;
    }

    // Return
    return;
}
开发者ID:,项目名称:,代码行数:60,代码来源:

示例3: read

/***********************************************************************//**
 * @brief Read LAT events from FITS file.
 *
 * @param[in] file FITS file.
 *
 * This method read the LAT event list from a FITS file.
 *
 * The method clears the object before loading, thus any events residing in
 * the object before loading will be lost.
 ***************************************************************************/
void GLATEventList::read(const GFits& file)
{
    // Clear object
    clear();

    // Get HDU (pointer is always valid)
    const GFitsTable& hdu = *file.table("EVENTS");

    // Read event data
    read_events(hdu);

    // Read data selection keywords
    read_ds_keys(hdu);

    // If we have a GTI extension, then read Good Time Intervals from that
    // extension
    if (file.contains("GTI")) {
        const GFitsTable& gti = *file.table("GTI");
        m_gti.read(gti);
    }

    // ... otherwise build GTI from TSTART and TSTOP
    else {

        // Read start and stop time
        double tstart = hdu.real("TSTART");
        double tstop  = hdu.real("TSTOP");

        // Create time reference from header information
        GTimeReference timeref(hdu);
        
        // Set start and stop time
        GTime start(tstart);
        GTime stop(tstop);

        // Append start and stop time as single time interval to GTI
        m_gti.append(start, stop);

        // Set GTI time reference
        m_gti.reference(timeref);

    } // endelse: GTI built from TSTART and TSTOP

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

示例4: read

/***********************************************************************//**
 * @brief Read effective area from FITS file
 *
 * @param[in] fits FITS file.
 *
 * Reads the effective area and efficiency parameter information form the
 * FITS file. The effective area is read from the extension EFFECTIVE AREA,
 * the efficiency parameter information from the extension EFFICIENCY_PARAMS.
 * If the latter extension does not exist, no efficiency parameters will be
 * loaded.
 *
 * @todo Implement reading of Phi-dependence information.
 ***************************************************************************/
void GLATAeff::read(const GFits& fits)
{
    // Clear instance
    clear();

    // Get pointer to effective area HDU
    const GFitsTable& hdu_aeff = *fits.table("EFFECTIVE AREA");

    // Read effective area
    read_aeff(hdu_aeff);

    // Read efficiency factors from appropriate HDU. Does nothing if the
    // HDU does not exist.
    if (fits.contains("EFFICIENCY_PARAMS")) {
        const GFitsTable& hdu_eff = *fits.table("EFFICIENCY_PARAMS");
        read_efficiency(hdu_eff);
    }

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


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