Esempio n. 1
0
/** Returns a cropped workspace with data equal to and above the specified x limit
 *
 *  @param workspace :: MatrixWorkspace
 *  @param x :: Minimum allowed x-value in the data.
 *  @return MatrixWorkspace cropped to values with x >= specified limit.
 */
MatrixWorkspace_sptr PoldiTruncateData::getWorkspaceAboveX(MatrixWorkspace_sptr workspace, double x)
{
    Algorithm_sptr crop = getCropAlgorithmForWorkspace(workspace);
    crop->setProperty("Xmin", x);

    return getOutputWorkspace(crop);
}
Esempio n. 2
0
/** Returns a MatrixWorkspace with all spectrum summed up.
 *
 *  The summation is done with the SumSpectra-algorithm.
 *
 *  @param workspace :: MatrixWorkspace
 *  @return MatrixWorkspace with one spectrum which contains all counts.
 */
MatrixWorkspace_sptr
PoldiTruncateData::getSummedSpectra(MatrixWorkspace_sptr workspace) {
  Algorithm_sptr sumSpectra = createChildAlgorithm("SumSpectra");

  if (!sumSpectra) {
    throw std::runtime_error("Could not create SumSpectra algorithm.");
  }

  sumSpectra->setProperty("InputWorkspace", workspace);

  return getOutputWorkspace(sumSpectra);
}
Esempio n. 3
0
/**
 * Set the output workspace(s) if the load's return workspace has type
 * API::Workspace
 * @param loader :: Shared pointer to load algorithm
 */
void Load::setOutputWorkspace(const API::IAlgorithm_sptr &loader) {
  // Go through each OutputWorkspace property and check whether we need to make
  // a counterpart here
  const std::vector<Property *> &loaderProps = loader->getProperties();
  const size_t count = loader->propertyCount();
  for (size_t i = 0; i < count; ++i) {
    Property *prop = loaderProps[i];
    if (dynamic_cast<IWorkspaceProperty *>(prop) &&
        prop->direction() == Direction::Output) {
      const std::string &name = prop->name();
      if (!this->existsProperty(name)) {
        declareProperty(Kernel::make_unique<WorkspaceProperty<Workspace>>(
            name, loader->getPropertyValue(name), Direction::Output));
      }
      Workspace_sptr wkspace = getOutputWorkspace(name, loader);
      setProperty(name, wkspace);
    }
  }
}