Skip to content
Snippets Groups Projects
Commit 75f88e63 authored by Loïc Le Guyader's avatar Loïc Le Guyader
Browse files

Add DSSC diamond center piece

parent ad674590
No related branches found
No related tags found
1 merge request!2Add DSSC diamond center piece
......@@ -39,6 +39,9 @@ class TZPGcalc():
plt.close('TZPGcalc')
fig, (self.ax_sam, self.ax_det) = plt.subplots(1, 2, num='TZPGcalc', figsize=(6,3))
# display scale
self.scale = 1e3 # displayed distances in [mm]
self.ax_sam.set_title('Sample plane')
self.ax_det.set_title('Detector plane')
......@@ -91,6 +94,7 @@ class TZPGcalc():
self.detLines = {'module': self.ax_det.add_patch(Rectangle((0, 0), 1, 1, fill=False, facecolor='k')),
'Vfilter': self.ax_det.add_patch(Rectangle((0, 0), 1, 1, facecolor="blue", alpha=0.4)),
'Hfilter': self.ax_det.add_patch(Rectangle((0, 0), 1, 1, facecolor="blue", alpha=0.4)),
'diamond': self.ax_det.add_patch(Rectangle((-8, -8), 16, 16, facecolor="blue", alpha=0.4, angle=45))
}
# 5x5 membranes
......@@ -109,15 +113,14 @@ class TZPGcalc():
xRight: x position of the right corner
yTop: y position of the top corner
"""
scale = 1e3 # displayed distances in [mm]
xw = np.abs(xLeft - xRight)
yw = np.abs(yTop - yBottom)
rect.set_xy((scale*xLeft, scale*yBottom))
rect.set_height(scale*yw)
rect.set_width(scale*xw)
rect.set_xy((self.scale*xLeft, self.scale*yBottom))
rect.set_height(self.scale*yw)
rect.set_width(self.scale*xw)
def UpdateBeams(self, Beams, Z, conf):
""" Update the position and size of the beams.
......@@ -172,14 +175,15 @@ class TZPGcalc():
"""
# x module axis is vertical, y module axis is horizontal
# the module 15 is +0.91 mm vertical from the beam and 4.233 mm horizontal from the beam
offset_h = 4.233e-3 #[mm]
offset_v = 0.91e-3 #[mm]
offset_h = 4.233e-3 #[m]
offset_v = 0.91e-3 #[m]
moduleHw = 256*0.236e-3 #[mm]
moduleVw = 128*0.204e-3 #[mm]
moduleHw = 256*0.236e-3 #[m]
moduleVw = 128*0.204e-3 #[m]
filterW = 7e-3 #[mm]
filterL = 160e-3 #[mm]
filterW = 7e-3 #[m]
filterL = 160e-3 #[m]
diamondW = 16e-3 #[m]
self.RectUpdate(self.detLines['module'],
-moduleHw - offset_h + Xoff, offset_v + Yoff, -offset_h + Xoff, moduleVw + offset_v + Yoff)
......@@ -187,6 +191,9 @@ class TZPGcalc():
-filterW/2 + Xoff, -filterL/2 + Yoff, filterW/2 + Xoff, filterL/2 + Yoff)
self.RectUpdate(self.detLines['Hfilter'],
-filterL/2 + Xoff, -filterW/2 + Yoff, filterL/2 + Xoff, filterW/2 + Yoff)
# moving rotated rectangles is a pain in matplotlib
self.detLines['diamond'].set_xy((self.scale*Xoff, self.scale*(Yoff - diamondW/2*np.sqrt(2))))
def SampleUpdate(self, w, p, Xoff, Yoff, thickness=0.525):
""" Draw the sample.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment