Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BOZcalc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SCS
BOZcalc
Commits
75f88e63
Commit
75f88e63
authored
5 years ago
by
Loïc Le Guyader
Browse files
Options
Downloads
Patches
Plain Diff
Add DSSC diamond center piece
parent
ad674590
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2
Add DSSC diamond center piece
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
TZPGcalc.py
+17
-10
17 additions, 10 deletions
TZPGcalc.py
with
17 additions
and
10 deletions
TZPGcalc.py
+
17
−
10
View file @
75f88e63
...
...
@@ -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
#[m
m
]
offset_v
=
0.91e-3
#[m
m
]
offset_h
=
4.233e-3
#[m]
offset_v
=
0.91e-3
#[m]
moduleHw
=
256
*
0.236e-3
#[m
m
]
moduleVw
=
128
*
0.204e-3
#[m
m
]
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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment