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

Adds spot center calculation

parent f1521f8b
No related branches found
No related tags found
1 merge request!14Collection of small updates
This diff is collapsed.
...@@ -113,6 +113,13 @@ class TZPGcalc(): ...@@ -113,6 +113,13 @@ class TZPGcalc():
for k in ['L', 'H']: for k in ['L', 'H']:
self.SpotSizes[d][k] = np.zeros((6, 2)) self.SpotSizes[d][k] = np.zeros((6, 2))
# spot center of all beams
self.SpotCenters = {}
for d in ['det', 'sam']:
self.SpotCenters[d] = {}
for k in ['L', 'H']:
self.SpotCenters[d][k] = np.zeros((6, 2))
self.UpdateFig() self.UpdateFig()
display(self.control) display(self.control)
...@@ -367,6 +374,8 @@ class TZPGcalc(): ...@@ -367,6 +374,8 @@ class TZPGcalc():
vs = corners[:, k] vs = corners[:, k]
self.SpotSizes[img['type']][conf['Energy']][z, k] = ( self.SpotSizes[img['type']][conf['Energy']][z, k] = (
1e3*(np.max(vs) - np.min(vs))) 1e3*(np.max(vs) - np.min(vs)))
self.SpotCenters[img['type']][conf['Energy']][z, k] = (
1e3*0.5*(np.max(vs) + np.min(vs)))
# 3 beams configuration # 3 beams configuration
b = self.widgets['3beams'].value b = self.widgets['3beams'].value
...@@ -554,6 +563,12 @@ class TZPGcalc(): ...@@ -554,6 +563,12 @@ class TZPGcalc():
columns=['H (um)', 'V (um)']) columns=['H (um)', 'V (um)'])
self.widgets[f'SpotSize{v}'].value = df.to_html( self.widgets[f'SpotSize{v}'].value = df.to_html(
float_format='{:.2f}'.format) float_format='{:.2f}'.format)
df = pd.DataFrame(self.SpotCenters['sam'][v],
index=['F0G-1', 'F0G0', 'F0G1',
'F1G-1', 'F1G0', 'F1G1'],
columns=['H (um)', 'V (um)'])
self.widgets[f'SpotCenter{v}'].value = df.to_html(
float_format='{:.2f}'.format)
# update the detector # update the detector
detXoff = self.widgets['detX'].value*1e-3 # [m] detXoff = self.widgets['detX'].value*1e-3 # [m]
...@@ -589,6 +604,19 @@ class TZPGcalc(): ...@@ -589,6 +604,19 @@ class TZPGcalc():
widgets.Label(value='High energy'), widgets.Label(value='High energy'),
self.widgets['SpotSizeH']]) self.widgets['SpotSizeH']])
]) ])
# Spot centers
self.widgets['SpotCenterL'] = widgets.HTML()
self.widgets['SpotCenterH'] = widgets.HTML()
SpotCenter = HBox([VBox([widgets.Label(value='Low energy'),
self.widgets['SpotCenterL']]),
VBox([
widgets.Label(value='High energy'),
self.widgets['SpotCenterH']])
])
SpotSizeAndCenter = HBox([
VBox([widgets.Label(value='Spot Size'), SpotSize]),
VBox([widgets.Label(value='Spot center'), SpotCenter])
])
# Source # Source
self.Reset = widgets.Button( self.Reset = widgets.Button(
...@@ -959,8 +987,8 @@ class TZPGcalc(): ...@@ -959,8 +987,8 @@ class TZPGcalc():
tab3.set_title(0, 'Detector') tab3.set_title(0, 'Detector')
tab3.selected_index = 0 tab3.selected_index = 0
tab4 = widgets.Accordion([SpotSize]) tab4 = widgets.Accordion([SpotSizeAndCenter])
tab4.set_title(0, 'Spot sizes') tab4.set_title(0, 'Spot sizes and centers')
tab4.selected_index = 0 tab4.selected_index = 0
self.control = VBox([self.Update, tab0, tab1, tab2, tab3, tab4]) self.control = VBox([self.Update, tab0, tab1, tab2, tab3, tab4])
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