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


C++ MatrixWorkspace_sptr::sample方法代码示例

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


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

示例1: invalid_argument

/*
 * Add parameter logs and convert to MD for a single run
 *
 * @param input_workspace :: datasource workspace
 * @param emode :: analysis mode "Elastic", "Direct" or "Indirect"
 * @param efix :: datasource energy values in meV
 * @param psi :: goniometer rotation in degrees
 * @param gl :: goniometer rotation in degrees
 * @param gs :: goniometer rotation in degrees
 * @param in_place :: do merge step at the same time as converting to
 *MDWorkspace
 * @param alatt :: length of crystal lattice parameter in angstroms
 * @param angdeg :: lattice angle
 * @param u :: lattice vector parallel to incident neutron beam
 * @param v :: lattice vector perpendicular to u in the horizontal plane
 * @param out_mdws :output workspace to use if merge step is carried out
 */
Mantid::API::IMDEventWorkspace_sptr CreateMD::single_run(
    Mantid::API::MatrixWorkspace_sptr input_workspace, const std::string &emode,
    double efix, double psi, double gl, double gs, bool in_place,
    const std::vector<double> &alatt, const std::vector<double> &angdeg,
    const std::vector<double> &u, const std::vector<double> &v,
    const std::string &filebackend_filename, const bool filebackend,
    Mantid::API::IMDEventWorkspace_sptr out_mdws) {

  std::vector<std::vector<double>> ub_params{alatt, angdeg, u, v};

  if (any_given(ub_params) && !all_given(ub_params)) {
    throw std::invalid_argument(
        "Either specify all of alatt, angledeg, u, v or none of them");
  } else {
    if (input_workspace->sample().hasOrientedLattice()) {
      g_log.warning() << "Sample already has a UB. This will not be "
                         "overwritten. Use ClearUB and re-run.\n";
    } else {
      setUB(input_workspace, alatt[0], alatt[1], alatt[2], angdeg[0], angdeg[1],
            angdeg[2], u, v);
    }

    if (efix > 0.0) {
      addSampleLog(input_workspace, "Ei", efix);
    }

    addSampleLog(input_workspace, "gl", gl);
    addSampleLog(input_workspace, "gs", gs);
    addSampleLog(input_workspace, "psi", psi);
    setGoniometer(input_workspace);

    return convertToMD(input_workspace, emode, in_place, filebackend_filename,
                       filebackend, out_mdws);
  }
}
开发者ID:samueljackson92,项目名称:mantid,代码行数:52,代码来源:CreateMD.cpp


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