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


C++ OptionalDouble::is_initialized方法代码示例

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


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

示例1: makeTransmissionCorrection

/**
 * Create a transmission corrections workspace utilising one or two workspaces.
 *
 * Input workspaces are in TOF. These are converted to lambda, normalized and
 *stitched together (if two given).
 *
 * @param processingCommands : Processing instructions. Usually a list of
 *detector indexes to keep.
 * @param wavelengthInterval : Wavelength interval for the run workspace.
 * @param wavelengthMonitorBackgroundInterval : Wavelength interval for the
 *monitor background
 * @param wavelengthMonitorIntegrationInterval : Wavelength interval for the
 *monitor integration
 * @param i0MonitorIndex : Monitor index for the I0 monitor
 * @param firstTransmissionRun : The first transmission run
 * @param secondTransmissionRun : The second transmission run (optional)
 * @param stitchingStart : Stitching start (optional but dependent on
 *secondTransmissionRun)
 * @param stitchingDelta : Stitching delta (optional but dependent on
 *secondTransmissionRun)
 * @param stitchingEnd : Stitching end (optional but dependent on
 *secondTransmissionRun)
 * @param stitchingStartOverlap : Stitching start overlap (optional but
 *dependent on secondTransmissionRun)
 * @param stitchingEndOverlap : Stitching end overlap (optional but dependent on
 *secondTransmissionRun)
 * @return A transmission workspace in Wavelength units.
 */
MatrixWorkspace_sptr CreateTransmissionWorkspace::makeTransmissionCorrection(
    const std::string &processingCommands, const MinMax &wavelengthInterval,
    const OptionalMinMax &wavelengthMonitorBackgroundInterval,
    const OptionalMinMax &wavelengthMonitorIntegrationInterval,
    const OptionalInteger &i0MonitorIndex,
    MatrixWorkspace_sptr firstTransmissionRun,
    OptionalMatrixWorkspace_sptr secondTransmissionRun,
    const OptionalDouble &stitchingStart, const OptionalDouble &stitchingDelta,
    const OptionalDouble &stitchingEnd,
    const OptionalDouble &stitchingStartOverlap,
    const OptionalDouble &stitchingEndOverlap) {
  /*make struct of optional inputs to refactor method arguments*/
  /*make a using statements defining OptionalInteger for MonitorIndex*/
  auto trans1InLam =
      toLam(firstTransmissionRun, processingCommands, i0MonitorIndex,
            wavelengthInterval, wavelengthMonitorBackgroundInterval);
  MatrixWorkspace_sptr trans1Detector = trans1InLam.get<0>();
  MatrixWorkspace_sptr trans1Monitor = trans1InLam.get<1>();

  // Monitor integration ... can this happen inside the toLam routine?
  if (wavelengthMonitorIntegrationInterval.is_initialized()) {
    auto integrationAlg = this->createChildAlgorithm("Integration");
    integrationAlg->initialize();
    integrationAlg->setProperty("InputWorkspace", trans1Monitor);
    integrationAlg->setProperty(
        "RangeLower", wavelengthMonitorIntegrationInterval.get().get<0>());
    integrationAlg->setProperty(
        "RangeUpper", wavelengthMonitorIntegrationInterval.get().get<1>());
    integrationAlg->execute();
    trans1Monitor = integrationAlg->getProperty("OutputWorkspace");
  }
  MatrixWorkspace_sptr transmissionWS = divide(trans1Detector, trans1Monitor);
  if (secondTransmissionRun.is_initialized()) {
    auto transRun2 = secondTransmissionRun.get();
    g_log.debug(
        "Extracting second transmission run workspace indexes from spectra");

    auto trans2InLam =
        toLam(transRun2, processingCommands, i0MonitorIndex, wavelengthInterval,
              wavelengthMonitorBackgroundInterval);

    // Unpack the conversion results.
    MatrixWorkspace_sptr trans2Detector = trans2InLam.get<0>();
    MatrixWorkspace_sptr trans2Monitor = trans2InLam.get<1>();

    // Monitor integration ... can this happen inside the toLam routine?
    if (wavelengthMonitorIntegrationInterval.is_initialized()) {
      auto integrationAlg = this->createChildAlgorithm("Integration");
      integrationAlg->initialize();
      integrationAlg->setProperty("InputWorkspace", trans2Monitor);
      integrationAlg->setProperty(
          "RangeLower", wavelengthMonitorIntegrationInterval.get().get<0>());
      integrationAlg->setProperty(
          "RangeUpper", wavelengthMonitorIntegrationInterval.get().get<1>());
      integrationAlg->execute();
      trans2Monitor = integrationAlg->getProperty("OutputWorkspace");
    }

    MatrixWorkspace_sptr normalizedTrans2 =
        divide(trans2Detector, trans2Monitor);

    // Stitch the results.
    auto stitch1DAlg = this->createChildAlgorithm("Stitch1D");
    stitch1DAlg->initialize();
    AnalysisDataService::Instance().addOrReplace("transmissionWS",
                                                 transmissionWS);
    AnalysisDataService::Instance().addOrReplace("normalizedTrans2",
                                                 normalizedTrans2);
    stitch1DAlg->setProperty("LHSWorkspace", transmissionWS);
    stitch1DAlg->setProperty("RHSWorkspace", normalizedTrans2);
    if (stitchingStartOverlap.is_initialized()) {
      stitch1DAlg->setProperty("StartOverlap", stitchingStartOverlap.get());
//.........这里部分代码省略.........
开发者ID:DanNixon,项目名称:mantid,代码行数:101,代码来源:CreateTransmissionWorkspace.cpp


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