Skip to content

Commit

Permalink
Refs #9992. Cleaning up, comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Wedel committed Mar 30, 2015
1 parent 076b43d commit 24237a9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
Expand Up @@ -59,6 +59,7 @@ class MANTID_SINQ_DLL PoldiFitPeaks2D : public API::Algorithm {

virtual const std::string summary() const;

protected:
Poldi2DFunction_sptr getFunctionIndividualPeaks(
std::string profileFunctionName,
const PoldiPeakCollection_sptr &peakCollection) const;
Expand All @@ -71,7 +72,6 @@ class MANTID_SINQ_DLL PoldiFitPeaks2D : public API::Algorithm {
getPeakFromPeakFunction(API::IPeakFunction_sptr profileFunction,
const Kernel::V3D &hkl) const;

protected:
PoldiPeakCollection_sptr
getPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const;
PoldiPeakCollection_sptr getIntegratedPeakCollection(
Expand Down
40 changes: 33 additions & 7 deletions Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp
Expand Up @@ -111,8 +111,13 @@ void PoldiFitPeaks2D::init() {
declareProperty(new WorkspaceProperty<TableWorkspace>(
"RefinedPoldiPeakWorkspace", "", Direction::Output),
"Table workspace with fitted peaks.");

declareProperty(new WorkspaceProperty<TableWorkspace>(
"RefinedCellParameters", "", Direction::Output, PropertyMode::Optional));
}


/// Creates a PoldiPeak from the given profile function/hkl pair.
PoldiPeak_sptr
PoldiFitPeaks2D::getPeakFromPeakFunction(IPeakFunction_sptr profileFunction,
const V3D &hkl) const {
Expand All @@ -133,15 +138,12 @@ PoldiFitPeaks2D::getPeakFromPeakFunction(IPeakFunction_sptr profileFunction,
}
}

// size_t dIndex = peakFunction->parameterIndex("Centre");
UncertainValue d(profileFunction->getParameter(dIndex),
profileFunction->getError(dIndex));

// size_t iIndex = peakFunction->parameterIndex("Area");
UncertainValue intensity(profileFunction->getParameter(iIndex),
profileFunction->getError(iIndex));

// size_t fIndex = peakFunction->parameterIndex("Sigma");
double fwhmValue = profileFunction->fwhm();
UncertainValue fwhm(fwhmValue, fwhmValue /
profileFunction->getParameter(fIndex) *
Expand Down Expand Up @@ -214,13 +216,23 @@ PoldiPeakCollection_sptr PoldiFitPeaks2D::getPeakCollectionFromFunction(
getPeakFromPeakFunction(profileFunction, V3D(0, 0, 0));

normalizedPeaks->addPeak(peak);
continue;
}
}

return normalizedPeaks;
}

/**
* Returns a Poldi2DFunction that encapsulates individual peaks
*
* This function takes all peaks from the supplied peak collection and generates
* an IPeakFunction of the type given in the name parameter, wraps them
* in a Poldi2DFunction and returns it.
*
* @param profileFunctionName :: Profile function name.
* @param peakCollection :: Peak collection with peaks to be used in the fit.
* @return :: A Poldi2DFunction with peak profile functions.
*/
Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionIndividualPeaks(
std::string profileFunctionName,
const PoldiPeakCollection_sptr &peakCollection) const {
Expand Down Expand Up @@ -257,6 +269,21 @@ Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionIndividualPeaks(
return mdFunction;
}

/**
* Returns a Poldi2DFunction that encapsulates a PawleyFunction
*
* This function creates a PawleyFunction using the supplied profile function
* name and the crystal system as well as initial cell from the input properties
* of the algorithm and wraps it in a Poldi2DFunction.
*
* Because the peak intensities are integral at this step but PawleyFunction
* expects peak heights, a profile function is created and setIntensity/height-
* methods are used to convert.
*
* @param profileFunctionName :: Profile function name for PawleyFunction.
* @param peakCollection :: Peak collection with peaks to be used in the fit.
* @return :: A Poldi2DFunction with a PawleyFunction.
*/
Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionPawley(
std::string profileFunctionName,
const PoldiPeakCollection_sptr &peakCollection) const {
Expand Down Expand Up @@ -306,9 +333,8 @@ Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionPawley(
/**
* Constructs a proper function from a peak collection
*
* This method constructs a Poldi2DFunction and assigns one
*PoldiSpectrumDomainFunction to it for
* each peak contained in the peak collection.
* This method constructs a Poldi2DFunction depending on whether or not a
* Pawley fit is performed each peak contained in the peak collection.
*
* @param peakCollection :: PoldiPeakCollection containing peaks with integral
*intensities
Expand Down

0 comments on commit 24237a9

Please sign in to comment.