Skip to content

Commit

Permalink
Change the name for component name array re #6755
Browse files Browse the repository at this point in the history
Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Apr 3, 2013
1 parent d09a728 commit 7d79b42
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Code/Mantid/scripts/Calibration/tube_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def __init__(self,ws):
self.ws = ws
self.inst = ws.getInstrument()
self.numTubes = 0
self.specComponentArray = []
self.component = 0 # NEXT STEP: Put self.component into array ##########
self.componentNameArray = []
self.componentArray = []
self.minNumDetsInTube = 200
self.tubes = []

Expand All @@ -42,7 +42,7 @@ def setTubeSpecByString(self, tubeSpecString ):
If the specification is not unique, the first found will be used and there will
be no error message. So if in doubt don't skip a step.
"""
self.specComponentArray.append(tubeSpecString)
self.componentNameArray.append(tubeSpecString)
self.delimiter = '/' # delimiter between parts of string in tree
self.numTubes = -1 # Negative value forces tubes to be searched and counted

Expand Down Expand Up @@ -106,18 +106,18 @@ def getComponent ( self ):
@Return value: instrument component
"""
if( self.component != 0):
return self.component
if( self.componentArray != []):
return self.componentArray[0]

# We look for the component
print "Looking for", self.specComponentArray[0],
print "Looking for", self.componentNameArray[0],

comp = self.inst.getComponentByName(self.specComponentArray[0])
comp = self.inst.getComponentByName(self.componentNameArray[0])

if( comp ):
self.component = comp
self.componentArray.append(comp)

return self.component
return self.componentArray[0]


def getDetectorInfoFromTube( self, tubeIx ):
Expand Down Expand Up @@ -158,7 +158,7 @@ def getDetectorInfoFromTube( self, tubeIx ):
#print "First dectector ", firstDet," Last detector ", firstDet+numDet-1, "Number of detectors ", numDet
#print "First dectector ", firstDet," Last detector ", comp[numDet-1].getID()
else:
print self.specComponentArray[0], tubeIx, "not found"
print self.componentNameArray[0], tubeIx, "not found"
return 0, 0, 1

return firstDet, numDet, step
Expand Down Expand Up @@ -186,7 +186,7 @@ def getTubeLength( self, tubeIx ):
numDet = comp.nelements()
return comp[0].getDistance( comp[numDet-1] )
else:
print self.specComponentArray[0], tubeIx, "not found"
print self.componentNameArray[0], tubeIx, "not found"
return 0.0

def getTubeName ( self, tubeIx ):
Expand All @@ -212,7 +212,7 @@ def getTubeName ( self, tubeIx ):
if(comp != 0):
return comp.getFullName()
else:
print self.specComponentArray[0], tubeIx, "not found"
print self.componentNameArray[0], tubeIx, "not found"
return "Unknown"


Expand Down

0 comments on commit 7d79b42

Please sign in to comment.