Skip to content

Commit

Permalink
Refs #11674. Adding CalibrationRun option to PoldiDataAnalysis
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Wedel committed May 22, 2015
1 parent f03c0d9 commit 015cb80
Showing 1 changed file with 12 additions and 10 deletions.
Expand Up @@ -42,6 +42,10 @@ def PyInit(self):
self.declareProperty("ProfileFunction", "Gaussian", validator=allowedProfileFunctions,
direction=Direction.Input)

self.declareProperty("CalibrationRun", False, direction=Direction.Input,
doc='In this mode, an additional parameter is fitted for calibration purposes. Can not '
'be used in combination with PawleyFit. Will automatically disable residual analysis.')

self.declareProperty("PawleyFit", False, direction=Direction.Input,
doc='Should the 2D-fit determine lattice parameters?')

Expand Down Expand Up @@ -73,6 +77,9 @@ def PyExec(self):
self.inputWorkspace = self.getProperty("InputWorkspace").value
self.expectedPeaks = self.getProperty("ExpectedPeaks").value
self.profileFunction = self.getProperty("ProfileFunction").value
self.isCalibration = self.getProperty("CalibrationRun").value
self.analyseResiduals = self.getProperty("AnalyseResiduals").value and not self.isCalibration
self.isPawleyFit = self.getProperty("PawleyFit").value and not self.isCalibration

correlationSpectrum = self.runCorrelation()
self.outputWorkspaces.append(correlationSpectrum)
Expand Down Expand Up @@ -109,8 +116,7 @@ def runMainAnalysis(self, correlationSpectrum):
indexedPeaks, unindexedPeaks = self.runIndex(refinedPeaks)
outputWorkspaces.append(indexedPeaks)

pawleyFit = self.getProperty('PawleyFit').value
if pawleyFit:
if self.isPawleyFit:
outputWorkspaces.append(unindexedPeaks)

fitPeaks2DResult = self.runPeakFit2D(indexedPeaks)
Expand All @@ -119,8 +125,7 @@ def runMainAnalysis(self, correlationSpectrum):
spectrum2D = fitPeaks2DResult[0]
spectrum1D = fitPeaks2DResult[1]

analyseResiduals = self.getProperty('AnalyseResiduals').value
if analyseResiduals:
if self.analyseResiduals:
residuals = self.runResidualAnalysis(spectrum2D)
outputWorkspaces.append(residuals)

Expand Down Expand Up @@ -172,8 +177,7 @@ def runIndex(self, peaks):

# Remove unindexed peaks from group for pawley fit
unindexedPeaks = indexedPeaks.getItem(indexedPeaks.getNumberOfEntries() - 1)
pawleyFit = self.getProperty('PawleyFit').value
if pawleyFit:
if self.isPawleyFit:
indexedPeaks.remove(unindexedPeaks.getName())

self._removeEmptyTablesFromGroup(indexedPeaks)
Expand All @@ -191,13 +195,11 @@ def runPeakFit2D(self, peaks):
if outputRawFitParameters:
rawFitParametersWorkspaceName = self.baseName + "_raw_fit_parameters"


pawleyFit = self.getProperty('PawleyFit').value

PoldiFitPeaks2D(InputWorkspace=self.inputWorkspace,
PoldiPeakWorkspace=peaks,
PeakProfileFunction=self.profileFunction,
PawleyFit=pawleyFit,
PawleyFit=self.isPawleyFit,
CalibrationRun=self.isCalibration,
MaximumIterations=100,
OutputWorkspace=spectrum2DName,
Calculated1DSpectrum=spectrum1DName,
Expand Down

0 comments on commit 015cb80

Please sign in to comment.