diff --git a/Framework/PythonInterface/plugins/algorithms/IntegratePeaksProfileFitting.py b/Framework/PythonInterface/plugins/algorithms/IntegratePeaksProfileFitting.py index acf3ae01be6ade1ff012f2439384ddd137521e66..49484fe5f0dac5e135616095aba19ec56ddaac95 100644 --- a/Framework/PythonInterface/plugins/algorithms/IntegratePeaksProfileFitting.py +++ b/Framework/PythonInterface/plugins/algorithms/IntegratePeaksProfileFitting.py @@ -13,6 +13,7 @@ import numpy as np class IntegratePeaksProfileFitting(PythonAlgorithm): + def summary(self): return 'Fits a series fo peaks using 3D profile fitting as an Ikeda-Carpenter function by a bivariate gaussian.' @@ -58,7 +59,7 @@ class IntegratePeaksProfileFitting(PythonAlgorithm): extensions=[".pkl"])) self.declareProperty("IntensityCutoff", defaultValue=0., doc="Minimum number of counts to force a profile") edgeDocString = 'Pixels within EdgeCutoff from a detector edge will be have a profile forced. Currently for Anger cameras only.' - self.declareProperty("EdgeCutoff", defaultValue=0., doc=edgeDocString) + self.declareProperty("EdgeCutoff", defaultValue=0., doc=edgeDocString) self.declareProperty("FracHKL", defaultValue=0.5, validator=FloatBoundedValidator(lower=0., exclusive=True), doc="Fraction of HKL to consider for profile fitting.") self.declareProperty("FracStop", defaultValue=0.05, validator=FloatBoundedValidator(lower=0., exclusive=True), @@ -69,7 +70,8 @@ class IntegratePeaksProfileFitting(PythonAlgorithm): self.declareProperty("MinpplFrac", defaultValue=0.7, doc="Min fraction of predicted background level to check") self.declareProperty("MaxpplFrac", defaultValue=1.5, doc="Max fraction of predicted background level to check") - self.declareProperty("MindtBinWidth", defaultValue=15, doc="Smallest spacing (in microseconds) between data points for TOF profile fitting.") + mindtBinWidthDocString = "Smallest spacing (in microseconds) between data points for TOF profile fitting." + self.declareProperty("MindtBinWidth", defaultValue=15, doc=mindtBinWidthDocString) self.declareProperty("NTheta", defaultValue=50, doc="Number of bins for bivarite Gaussian along the scattering angle.") self.declareProperty("NPhi", defaultValue=50, doc="Number of bins for bivariate Gaussian along the azimuthal angle.") @@ -193,8 +195,8 @@ class IntegratePeaksProfileFitting(PythonAlgorithm): except KeyboardInterrupt: raise except: - raise - #numerrors += 1 + # raise + numerrors += 1 peak.setIntensity(0.0) peak.setSigmaIntensity(1.0) diff --git a/Framework/PythonInterface/plugins/functions/BivariateGaussian.py b/Framework/PythonInterface/plugins/functions/BivariateGaussian.py index 4bf946d56baadd603e006e870865954dc647d1b8..e3bc87e143548688fed207f5055627bd4c6d7523 100644 --- a/Framework/PythonInterface/plugins/functions/BivariateGaussian.py +++ b/Framework/PythonInterface/plugins/functions/BivariateGaussian.py @@ -3,7 +3,7 @@ from mantid.api import IFunction1D, FunctionFactory from matplotlib.mlab import bivariate_normal -class BivariateGaussian(IFunction1D): +class BivariateGaussian(IFunction1D): """ BivariateGaussian implements a bivariate gaussian (BivariateGaussian) in Mantid (M) as a 1D function. This is done so that it can be fit in a straightforward fashion using Mantid's Fit() function. To achieve this, we use the flattened diff --git a/scripts/SCD_Reduction/BVGFitTools.py b/scripts/SCD_Reduction/BVGFitTools.py index 5852575e671671f80b03e6b1d5338c9c7135b4e8..3a978a86c68b2837e14b9be2a8d3d6ba576d5d2a 100644 --- a/scripts/SCD_Reduction/BVGFitTools.py +++ b/scripts/SCD_Reduction/BVGFitTools.py @@ -250,9 +250,6 @@ def fitTOFCoordinate(box, peak, padeCoefficients, dtSpread=0.03, minFracPixels=0 yScaled = (yFit - bg) / np.max(yFit - bg) goodIDX = yScaled > fracStop - if np.sum(goodIDX) > 0: - iStart = np.min(np.where(goodIDX)) - iStop = np.max(np.where(goodIDX)) interpF = interp1d(x, yFit, kind='cubic') tofxx = np.linspace(tofWS.readX(0).min(), tofWS.readX(0).max(), 1000) @@ -523,7 +520,6 @@ def doBVGFit(box, nTheta=200, nPhi=200, zBG=1.96, fracBoxToHistogram=1.0, goodID m = BivariateGaussian.BivariateGaussian() m.init() m['A'] = 0.1 - #m['muX'] = np.average(thCenters,weights=np.sum(h,axis=1)) #m['muY'] = np.average(phCenters,weights=np.sum(h,axis=0)) diff --git a/scripts/SCD_Reduction/ICCFitTools.py b/scripts/SCD_Reduction/ICCFitTools.py index 70717347c7ff4dac3148d8dfa0911103532c2fed..032683a9fcbe9a2bb4b631b177cb0b8677b2e5fa 100644 --- a/scripts/SCD_Reduction/ICCFitTools.py +++ b/scripts/SCD_Reduction/ICCFitTools.py @@ -931,9 +931,9 @@ def integrateSample(run, MDdata, peaks_ws, paramList, UBMatrix, dQ, qMask, padeC wavelength = peak.getWavelength() # in Angstrom energy = 81.804 / wavelength**2 / 1000.0 # in eV flightPath = peak.getL1() + peak.getL2() # in m - print( '---fitting peak ' + \ - str(i) + ' Num events: ' + \ - str(Box.getNEvents()), ' ', peak.getHKL()) + print( '---fitting peak ' + + str(i) + ' Num events: ' + + str(Box.getNEvents()), ' ', peak.getHKL()) if Box.getNEvents() < 1 or np.all(np.abs(peak.getHKL()) == 0): print("Peak %i has 0 events or is HKL=000. Skipping!" % i) peak.setIntensity(0)