Skip to content

Commit

Permalink
Enable Multiple components to be calibrated re #6755
Browse files Browse the repository at this point in the history
This can be done by repeatedly calling the setTubeSpecByString method of one tube specification.

Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Apr 3, 2013
1 parent 7d79b42 commit 140082e
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions Code/Mantid/scripts/Calibration/tube_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def setTubeSpecByString(self, tubeSpecString ):
as in the instrument tree of its IDF file. This component may contain one or more tubes
and possibly all the tunes in the instrument.
If the tube specification is not empty this component is added to those already
in the specification.
in the specification. No checking is done for repeated or overlapping components.
@param tubeSpecString: string specifying tubes of a component of the instrument
Expand Down Expand Up @@ -65,7 +65,7 @@ def isTube(self, comp):

def searchForTubes(self, comp):
"""
Searches the component for tubes and saves them in array
Searches the component for tubes and saves them in array, appending if array is not empty.
@param comp: the component
"""
Expand All @@ -91,11 +91,13 @@ def getNumTubes(self):
return self.numTubes

# We have a negative number set in self.numTubes, so we search for tubes
comp = self.getComponent()
if( comp == 0):
comps = self.getComponents()
if( comps == []):
return self.numTubes

self.searchForTubes(comp)
for i in range( len(comps)):
self.searchForTubes(comps[i])

self.numTubes = len(self.tubes)
return self.numTubes

Expand All @@ -118,7 +120,34 @@ def getComponent ( self ):
self.componentArray.append(comp)

return self.componentArray[0]


def getComponents ( self ):
"""
Returns instrument components corresponding to specification
@Return value: array of instrument components
"""
if( self.componentArray != []):
return self.componentArray

# We look for the components
for i in range( len(self.componentNameArray)):
print "Looking for", self.componentNameArray[i],

comp = self.inst.getComponentByName(self.componentNameArray[i])

if( comp ):
self.componentArray.append(comp)
else:
print "Did not find", self.componentNameArray[i]
print "Tube specification not valid"
self.componentArray = []
return []

return self.componentArray



def getDetectorInfoFromTube( self, tubeIx ):
"""
Expand Down

0 comments on commit 140082e

Please sign in to comment.