Skip to content

Commit

Permalink
Refs #9081 Small clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
jmborr committed Feb 27, 2014
1 parent 7971b56 commit 8f14859
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Expand Up @@ -32,7 +32,7 @@
from mantid import logger
import numpy

from pdb import set_trace as tr
#from pdb import set_trace as tr

class DSFinterp1DFit(IFunction1D):

Expand Down Expand Up @@ -168,7 +168,6 @@ def function1D(self, xvals):
else:
self._channelgroup.InitializeInterpolator(windowlength=0)
# channel group has been initialized, so just evaluate the interpolator
#tr()
dsf = self._channelgroup(p['TargetParameter'])
return p['Intensity']*dsf.intensities # can we pass by reference?

Expand Down
Expand Up @@ -37,11 +37,13 @@ def generateWorkspaces(self, nf, startf, df, e=False):
HWHM = f# half-width at half maximum
# Impose uncertainty in the Lorentzian by making its actual HWHM different than the theoretical one
if e:
HWHM += 4*df*(0.5-random()) # add uncertainty as big as twice the step between consecutive HWHM!!!
HWHM += 2*df*(0.5-random()) # add uncertainty as big as twice the step between consecutive HWHM!!!
if HWHM < 0: HWHM = startf
yvalues = 1/numpy.pi * HWHM / (HWHM*HWHM + xvalues*xvalues)
evalues = yvalues*0.1*numpy.random.rand(2*n) # errors
CreateWorkspace(OutputWorkspace='sim{0}'.format(iif), DataX=xvalues, DataY=yvalues, DataE=evalues)
SaveNexus(InputWorkspace='sim{0}'.format(iif), Filename='/tmp/sim{0}.nxs'.format(iif)) #only for debugging purposes
#SaveNexus(InputWorkspace='sim{0}'.format(iif), Filename='/tmp/sim{0}.nxs'.format(iif)) #only for debugging purposes
#print iif, f, HWHM
fvalues += ' {0}'.format(f) # theoretical HWHM, only coincides with real HWHM when no uncertainty
workspaces += ' sim{0}'.format(iif)
# Target workspace against which we will fit
Expand All @@ -50,6 +52,7 @@ def generateWorkspaces(self, nf, startf, df, e=False):
evalues = yvalues*0.1*numpy.random.rand(2*n) # errors
CreateWorkspace(OutputWorkspace='targetW', DataX=xvalues, DataY=yvalues, DataE=evalues)
#SaveNexus(InputWorkspace='targetW', Filename='/tmp/targetW.nxs') #only for debugging purposes
#print HWHM
return fvalues, workspaces, xvalues, HWHM

def cleanup(self, nf):
Expand Down

0 comments on commit 8f14859

Please sign in to comment.