Exemplo n.º 1
0
IFunction_sptr
PoldiFitPeaks1D2::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const {
  IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast<IPeakFunction>(
      FunctionFactory::Instance().createFunction(m_profileTemplate));
  clonedProfile->setCentre(poldiPeak->q());
  clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ));
  clonedProfile->setHeight(poldiPeak->intensity());

  return clonedProfile;
}
Exemplo n.º 2
0
void PoldiPeakSummary::storePeakSummary(TableRow tableRow,
                                        const PoldiPeak_sptr &peak) const {
  UncertainValue q = peak->q();
  UncertainValue d = peak->d();

  tableRow << MillerIndicesIO::toString(peak->hkl())
           << UncertainValueIO::toString(q) << UncertainValueIO::toString(d)
           << d.error() / d.value() * 1e3
           << UncertainValueIO::toString(peak->fwhm(PoldiPeak::Relative) * 1e3)
           << UncertainValueIO::toString(peak->intensity());
}
Exemplo n.º 3
0
IAlgorithm_sptr
PoldiFitPeaks1D::getFitAlgorithm(const Workspace2D_sptr &dataWorkspace,
                                 const PoldiPeak_sptr &peak,
                                 const IFunction_sptr &profile) {
  double width = peak->fwhm();
  double extent = std::min(0.05, std::max(0.002, width)) * m_fwhmMultiples;

  std::pair<double, double> xBorders(peak->q() - extent, peak->q() + extent);

  IAlgorithm_sptr fitAlgorithm = createChildAlgorithm("Fit", -1, -1, false);
  fitAlgorithm->setProperty("CreateOutput", true);
  fitAlgorithm->setProperty("Output", "FitPeaks1D");
  fitAlgorithm->setProperty("CalcErrors", true);
  fitAlgorithm->setProperty("Function", profile);
  fitAlgorithm->setProperty("InputWorkspace", dataWorkspace);
  fitAlgorithm->setProperty("WorkspaceIndex", 0);
  fitAlgorithm->setProperty("StartX", xBorders.first);
  fitAlgorithm->setProperty("EndX", xBorders.second);

  return fitAlgorithm;
}
Exemplo n.º 4
0
IFunction_sptr
PoldiFitPeaks1D::getPeakProfile(const PoldiPeak_sptr &poldiPeak) const {
  IPeakFunction_sptr clonedProfile = boost::dynamic_pointer_cast<IPeakFunction>(
      FunctionFactory::Instance().createFunction(m_profileTemplate));
  clonedProfile->setCentre(poldiPeak->q());
  clonedProfile->setFwhm(poldiPeak->fwhm(PoldiPeak::AbsoluteQ));
  clonedProfile->setHeight(poldiPeak->intensity());

  IFunction_sptr clonedBackground = m_backgroundTemplate->clone();

  auto totalProfile = boost::make_shared<CompositeFunction>();
  totalProfile->initialize();
  totalProfile->addFunction(clonedProfile);
  totalProfile->addFunction(clonedBackground);

  if (!m_profileTies.empty()) {
    totalProfile->addTies(m_profileTies);
  }

  return totalProfile;
}