Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • SCS/bozcalc
1 result
Show changes
Commits on Source (3)
...@@ -27,7 +27,7 @@ from BOZcalc.GeoBeams import GeoBeams ...@@ -27,7 +27,7 @@ from BOZcalc.GeoBeams import GeoBeams
SampleN = 7 SampleN = 7
# Database of existing zone plates parameters # Database of existing zone plates parameters
BOZ_db = { BOZ_FFT_db = {
'Custom': { 'Custom': {
'design_nrj': 860, 'design_nrj': 860,
'BOZwH': 1, 'BOZwH': 1,
...@@ -100,6 +100,38 @@ BOZ_db = { ...@@ -100,6 +100,38 @@ BOZ_db = {
} }
} }
BOZ_CHEM_db = {
'Custom': {
'design_nrj': 860,
'BOZwH': 0.8,
'BOZwV': 1.0,
'BOZoffaxis': 0.75,
'grating': 3.1,
'F_x': 0.26,
'F_y': 0.32,
'3beams': True
},
'Fe': {
'design_nrj': 715,
'BOZwH': 0.8,
'BOZwV': 1.0,
'BOZoffaxis': 0.75,
'grating': 3.1,
'F_x': 0.26,
'F_y': 0.32,
'3beams': True
},
'Co': {
'design_nrj': 785,
'BOZwH': 0.8,
'BOZwV': 1.0,
'BOZoffaxis': 0.75,
'grating': 3.1,
'F_x': 0.26,
'F_y': 0.32,
'3beams': True
},
}
class BOZcalc(): class BOZcalc():
def __init__(self): def __init__(self):
...@@ -740,7 +772,7 @@ class BOZcalc(): ...@@ -740,7 +772,7 @@ class BOZcalc():
# BOZ part # BOZ part
self.widgets['Type'] = widgets.Dropdown( self.widgets['Type'] = widgets.Dropdown(
options=list(BOZ_db), options=list(BOZ_FFT_db),
value='Custom', value='Custom',
description='Type:', description='Type:',
style=style, style=style,
...@@ -748,7 +780,11 @@ class BOZcalc(): ...@@ -748,7 +780,11 @@ class BOZcalc():
) )
def BOZtype(change): def BOZtype(change):
v = BOZ_db[change.new] if self.widgets['EndStation'].value == 'FFT':
v = BOZ_FFT_db[change.new]
else:
v = BOZ_CHEM_db[change.new]
self.widgets['nrjD'].value = v['design_nrj'] self.widgets['nrjD'].value = v['design_nrj']
self.widgets['BOZwH'].value = v['BOZwH'] self.widgets['BOZwH'].value = v['BOZwH']
self.widgets['BOZwV'].value = v['BOZwV'] self.widgets['BOZwV'].value = v['BOZwV']
...@@ -772,11 +808,21 @@ class BOZcalc(): ...@@ -772,11 +808,21 @@ class BOZcalc():
disabled=False disabled=False
) )
def switchdb(change):
if change.new == 'FFT':
db = BOZ_FFT_db
else:
db = BOZ_CHEM_db
self.widgets['Type'].options = list(db)
self.widgets['EndStation'].observe(switchdb, names='value')
# hidden nominal zone plate focus # hidden nominal zone plate focus
self.widgets['F_x'] = widgets.BoundedFloatText( self.widgets['F_x'] = widgets.BoundedFloatText(
value=0.25, value=0.25,
min=0, min=0,
max=1, max=1000,
step=0.01, step=0.01,
description='Focal length (m) Horiz.:', description='Focal length (m) Horiz.:',
style=style, style=style,
...@@ -785,7 +831,7 @@ class BOZcalc(): ...@@ -785,7 +831,7 @@ class BOZcalc():
self.widgets['F_y'] = widgets.BoundedFloatText( self.widgets['F_y'] = widgets.BoundedFloatText(
value=0.25, value=0.25,
min=0, min=0,
max=1, max=1000,
step=0.01, step=0.01,
description='Vert.:', description='Vert.:',
style=style, style=style,
...@@ -794,7 +840,7 @@ class BOZcalc(): ...@@ -794,7 +840,7 @@ class BOZcalc():
self.widgets['nrjL'] = widgets.BoundedIntText( self.widgets['nrjL'] = widgets.BoundedIntText(
value=840, value=840,
min=450, min=250,
max=3200, max=3200,
step=1, step=1,
description='Low:', description='Low:',
...@@ -803,7 +849,7 @@ class BOZcalc(): ...@@ -803,7 +849,7 @@ class BOZcalc():
) )
self.widgets['nrjH'] = widgets.BoundedIntText( self.widgets['nrjH'] = widgets.BoundedIntText(
value=880, value=880,
min=450, min=250,
max=3200, max=3200,
step=1, step=1,
description='High:', description='High:',
...@@ -812,7 +858,7 @@ class BOZcalc(): ...@@ -812,7 +858,7 @@ class BOZcalc():
) )
self.widgets['nrjD'] = widgets.BoundedIntText( self.widgets['nrjD'] = widgets.BoundedIntText(
value=860, value=860,
min=450, min=250,
max=3200, max=3200,
step=1, step=1,
width=4, width=4,
...@@ -866,8 +912,8 @@ class BOZcalc(): ...@@ -866,8 +912,8 @@ class BOZcalc():
self.widgets['dr_label_y'] = widgets.Label(value='dr_y') self.widgets['dr_label_y'] = widgets.Label(value='dr_y')
self.widgets['d_label'] = widgets.Label(value='dr') self.widgets['d_label'] = widgets.Label(value='dr')
BOZTab = VBox([ BOZTab = VBox([
HBox([self.widgets['Type'], HBox([self.widgets['EndStation'],
self.widgets['EndStation']]), self.widgets['Type']]),
HBox([self.widgets['nrjD'], HBox([self.widgets['nrjD'],
self.widgets['F_x'], self.widgets['F_x'],
self.widgets['F_y'] self.widgets['F_y']
...@@ -877,6 +923,7 @@ class BOZcalc(): ...@@ -877,6 +923,7 @@ class BOZcalc():
self.widgets['3beams']]), self.widgets['3beams']]),
HBox([self.widgets['dr_label_x'], HBox([self.widgets['dr_label_x'],
self.widgets['dr_label_y']]), self.widgets['dr_label_y']]),
self.widgets['d_label'],
HBox([widgets.Label(value='Optics (mm):'), HBox([widgets.Label(value='Optics (mm):'),
self.widgets['BOZwH'], self.widgets['BOZwH'],
self.widgets['BOZwV']]), self.widgets['BOZwV']]),
......