Beispiel #1
0
void Divide::setOutputUnits(const API::MatrixWorkspace_const_sptr lhs,
                            const API::MatrixWorkspace_const_sptr rhs,
                            API::MatrixWorkspace_sptr out) {
  if (rhs->YUnit().empty() || !WorkspaceHelpers::matchingBins(lhs, rhs, true)) {
    // Do nothing
  }
  // If the Y units match, then the output will be a distribution and will be
  // dimensionless
  else if (lhs->YUnit() == rhs->YUnit() && rhs->blocksize() > 1) {
    out->setYUnit("");
    out->setDistribution(true);
  }
  // Else we need to set the unit that results from the division
  else {
    if (!lhs->YUnit().empty())
      out->setYUnit(lhs->YUnit() + "/" + rhs->YUnit());
    else
      out->setYUnit("1/" + rhs->YUnit());
  }
}
Beispiel #2
0
void Multiply::setOutputUnits(const API::MatrixWorkspace_const_sptr lhs,
                              const API::MatrixWorkspace_const_sptr rhs,
                              API::MatrixWorkspace_sptr out) {
  if (!lhs->isDistribution() || !rhs->isDistribution())
    out->setDistribution(false);
}