Skip to content

Commit

Permalink
Few more comments to this commit. Re #4403
Browse files Browse the repository at this point in the history
  • Loading branch information
Anders-Markvardsen committed Jan 6, 2012
1 parent 4f5f59a commit b33fe49
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Code/Mantid/scripts/SANS/isis_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,23 +609,32 @@ def move_components(self, ws, xbeam, ybeam):
@return: the locations of (in the new coordinates) beam center, center of detector bank
"""

# Store the name of the current detector since temporarily
# below set current detector to manual to move both front and rear
# detectors
temp = self.cur_detector().name()


# Deal with front detector

self.setDetector('front-detector')
# rotate front detector according to value in log file and correction value provided in user file
rotateDet = (-self.FRONT_DET_ROT - self.cur_detector().rot_corr)
RotateInstrumentComponent(ws, self.cur_detector().name(), X="0.", Y="1.0", Z="0.", Angle=rotateDet)
RotRadians = math.pi*(self.FRONT_DET_ROT + self.cur_detector().rot_corr)/180.
# I don't understand why the x-shift of the front detector is depending on the x-position
# of the rear detector
# x-position of rear detector is an indicator of the beam position...
xshift = (self.REAR_DET_X + self.other_detector().x_corr - self.FRONT_DET_X - self.cur_detector().x_corr + self.FRONT_DET_RADIUS*math.sin(RotRadians) )/1000. - self.FRONT_DET_DEFAULT_X_M - xbeam
yshift = (self.cur_detector().y_corr/1000. - ybeam)
# Note don't understand the comment below
# default in instrument description is 23.281m - 4.000m from sample at 19,281m !
# need to add ~58mm to det1 to get to centre of detector, before it is rotated.
zshift = (self.FRONT_DET_Z + self.cur_detector().z_corr + self.FRONT_DET_RADIUS*(1 - math.cos(RotRadians)) )/1000.
zshift -= self.FRONT_DET_DEFAULT_SD_M
MoveInstrumentComponent(ws, self.cur_detector().name(), X = xshift, Y = yshift, Z = zshift, RelativePosition="1")


# deal with rear detector

self.setDetector('rear-detector')
xshift = -xbeam
yshift = -ybeam
Expand All @@ -634,8 +643,10 @@ def move_components(self, ws, xbeam, ybeam):
mantid.sendLogMessage("::SANS:: Setup move "+str(xshift*1000.)+" "+str(yshift*1000.)+" "+str(zshift*1000.))
MoveInstrumentComponent(ws, self.cur_detector().name(), X = xshift, Y = yshift, Z = zshift, RelativePosition="1")

# set the current detector back to that it was at the start of this method
self.setDetector(temp)


super(SANS2D, self).move_components(ws)

#this implements the TRANS/TRANSPEC=4/SHIFT=... line, this overrides any other monitor move
Expand Down

0 comments on commit b33fe49

Please sign in to comment.