コード例 #1
0
/** Compare the dimensions etc. of two MDWorkspaces
*/
void CompareMDWorkspaces::compareMDGeometry(
    Mantid::API::IMDWorkspace_sptr ws1, Mantid::API::IMDWorkspace_sptr ws2) {
  compare(ws1->getNumDims(), ws2->getNumDims(),
          "Workspaces have a different number of dimensions");
  for (size_t d = 0; d < ws1->getNumDims(); d++) {
    IMDDimension_const_sptr dim1 = ws1->getDimension(d);
    IMDDimension_const_sptr dim2 = ws2->getDimension(d);
    compare(dim1->getName(), dim2->getName(),
            "Dimension #" + Strings::toString(d) + " has a different name");
    compare(dim1->getUnits(), dim2->getUnits(),
            "Dimension #" + Strings::toString(d) + " has different units");
    compare(dim1->getNBins(), dim2->getNBins(),
            "Dimension #" + Strings::toString(d) +
                " has a different number of bins");
    compareTol(dim1->getMinimum(), dim2->getMinimum(),
               "Dimension #" + Strings::toString(d) +
                   " has a different minimum");
    compareTol(dim1->getMaximum(), dim2->getMaximum(),
               "Dimension #" + Strings::toString(d) +
                   " has a different maximum");
  }
}
コード例 #2
0
/** Set the original workspace, to show the axes plot choice */
void LinePlotOptions::setOriginalWorkspace(Mantid::API::IMDWorkspace_sptr ws) {
  if (!ws)
    return;

  for (size_t d = 0; d < (ws->getNumDims()); d++) {
    IMDDimension_const_sptr dim = ws->getDimension(d);
    std::string text = dim->getName();
    std::string tooltip =
        "Use the " + dim->getName() + " dimension as the X plot axis.";
    const bool bIntegrated = dim->getIsIntegrated();
    // Index into the radio buttons array
    int index = int(d) + 2;
    if (m_radPlots.size() > index) {
      m_radPlots[index]->setText(QString::fromStdString(text));
      m_radPlots[index]->setToolTip(QString::fromStdString(tooltip));
    } else
      addPlotRadioButton(text, tooltip, bIntegrated);
  }
}