Skip to content

Commit

Permalink
Remove support of discontinuous indices re #6755
Browse files Browse the repository at this point in the history
Support of discontinuous indices in tube is not used and could complicate future work.

Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Apr 2, 2013
1 parent d825dbd commit 0781dea
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions Code/Mantid/scripts/Calibration/tube_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self,ws):
self.minNumDetsInTube = 200
self.tubes = []

def setTubeSpecByString(self, tubeSpecString, DiscontinousIndicesInTube=False):
def setTubeSpecByString(self, tubeSpecString ):
"""
Sets tube specification by string. The string specifies a component of the intrument
as in the instrument tree of its IDF file. This component may contain one or more tubes
Expand All @@ -43,7 +43,6 @@ def setTubeSpecByString(self, tubeSpecString, DiscontinousIndicesInTube=False):
self.specString = tubeSpecString
self.delimiter = '/' # delimiter between parts of string in tree
self.numTubes = -1 # Negative value forces tubes to be searched and counted
self.continuousIndicesInTube = not DiscontinousIndicesInTube

def getInstrumentName (self):
return self.inst.getName()
Expand Down Expand Up @@ -241,28 +240,18 @@ def getTubeByString(self, tubeIx):
return wkIds

# Go and get workspace Indices
if(self.continuousIndicesInTube):
if(step == -1):
startDet = firstDet - numDet + 1
else:
startDet = firstDet
if( numDet > 0):
for i in range (0, self.ws.getNumberHistograms(), numDet):
deti = self.ws.getDetector(i)
detID = deti.getID()
if (detID >= startDet and detID < startDet+numDet):
iPixel = detID - firstDet
wkIds = range( i - iPixel, i - iPixel + step*numDet, step)
# print "Workspace indices",i-iPixel,"to",i-iPixel+numDet-1

else: #We can't assume continuous indices within tube, must loop over all indices (there are many).
if( numDet > 0):
for i in range(self.ws.getNumberHistograms()):
sp=self.ws.getSpectrum(i)
detids = sp.getDetectorIDs()
for j in range(len(detids)):
if (detids[j] >= firstDet and detids[j] < firstDet+numDet):
wkIds.append(i)
if(step == -1):
startDet = firstDet - numDet + 1
else:
startDet = firstDet
if( numDet > 0):
for i in range (0, self.ws.getNumberHistograms(), numDet):
deti = self.ws.getDetector(i)
detID = deti.getID()
if (detID >= startDet and detID < startDet+numDet):
iPixel = detID - firstDet
wkIds = range( i - iPixel, i - iPixel + step*numDet, step)
# print "Workspace indices",i-iPixel,"to",i-iPixel+numDet-1

#print firstDet, numDet
if (numDet > 0):
Expand Down

0 comments on commit 0781dea

Please sign in to comment.