Skip to content

Commit

Permalink
Merge remote branch 'origin/bugfix/10225_snspdred_mpi_failure'
Browse files Browse the repository at this point in the history
  • Loading branch information
VickieLynch committed Sep 26, 2014
2 parents 3e29dd6 + cd3e788 commit 4a9faf6
Showing 1 changed file with 10 additions and 12 deletions.
@@ -1,3 +1,5 @@
import mantid
import mantid.api
import mantid.simpleapi as api
from mantid.api import *
from mantid.kernel import *
Expand Down Expand Up @@ -248,7 +250,7 @@ def PyExec(self):
returned = self._focusChunks(samRun, SUFFIX, timeFilterWall, calib, self._splitws,
preserveEvents=preserveEvents)

if returned.__class__.__name__ == "list":
if isinstance(returned, list):
# Returned with a list of workspaces
focusedwksplist = returned
irun = 0
Expand All @@ -272,9 +274,9 @@ def PyExec(self):
for samRun in samwksplist:
samRun = mtd[str(samRun)]
try:
self.log().information("[F1136] Sample Run %s: number of events = %d" % (str(samRun), samRun.getNumberEvents()))
self.log().information("Sample Run %s: starting number of events = %d" % (str(samRun), samRun.getNumberEvents()))
except Exception as e:
self.log().information("[F1136] Unable to get number of events of sample run %s. Error message: %s" % (str(samRun), str(e)))
self.log().information("Unable to get number of events of sample run %s. Error message: %s" % (str(samRun), str(e)))

# Get run number
runnumber = samRun.getRunNumber()
Expand Down Expand Up @@ -482,7 +484,7 @@ def _loadData(self, runnumber, extension, filterWall=None, outname=None, **chunk

# filter bad pulses
if self._filterBadPulses > 0.:
isEventWS = str(type(wksp)).count("IEvent") > 0
isEventWS = isinstance(wksp, mantid.api._api.IEventWorkspace)
if isEventWS is True:
# Event workspace: record original number of events
numeventsbefore = wksp.getNumberEvents()
Expand Down Expand Up @@ -579,7 +581,7 @@ def _focusChunks(self, runnumber, extension, filterWall, calib, splitwksp=None,

# Load chunk
temp = self._loadData(runnumber, extension, filterWall, **chunk)
if str(type(temp)).count("IEvent") > 0:
if isinstance(temp, mantid.api._api.IEventWorkspace) is True:
# Event workspace
self.log().debug("F1141C There are %d events after data is loaded in workspace %s." % (
temp.getNumberEvents(), str(temp)))
Expand Down Expand Up @@ -649,10 +651,6 @@ def _focusChunks(self, runnumber, extension, filterWall, calib, splitwksp=None,
for itemp in xrange(numwksp):
temp = tempwslist[itemp]
# Align and focus
self.log().information("Begin to align and focus workspace %s; Number of events = %d of chunk %d with RemovePromptPulseWidth = %s, LowResSpectrumOffset = %s" % (str(temp),
temp.getNumberEvents(), ichunk, str(self._removePromptPulseWidth), str(self._lowResTOFoffset)))
# api.CloneWorkspace(InputWorkspace=temp, OutputWorkspace="_"+str(temp)+"_Phase1")

focuspos = self._focusPos
temp = api.AlignAndFocusPowder(InputWorkspace=temp, OutputWorkspace=temp, CalFileName=calib,
Params=self._binning, ResampleX=self._resampleX, Dspacing=self._bin_in_dspace,
Expand All @@ -665,9 +663,9 @@ def _focusChunks(self, runnumber, extension, filterWall, calib, splitwksp=None,
spec = temp.getSpectrum(iws)
self.log().debug("[DBx131] ws %d: spectrum ID = %d. " % (iws, spec.getSpectrumNo()))

self.log().information("After being aligned and focussed workspace %s; Number of events = %d of chunk %d " % (str(temp),
temp.getNumberEvents(), ichunk))
# api.CloneWorkspace(InputWorkspace=temp, OutputWorkspace="_"+str(temp)+"_Phase2")
if preserveEvents is True and isinstance(temp, mantid.api._api.IEventWorkspace) is True:
self.log().information("After being aligned and focussed workspace %s; Number of events = %d of chunk %d " % (str(temp),
temp.getNumberEvents(), ichunk))

# Rename and/or add to workspace of same splitter but different chunk
wkspname = wksp
Expand Down

0 comments on commit 4a9faf6

Please sign in to comment.