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
SampleN = 7
# Database of existing zone plates parameters
BOZ_db = {
BOZ_FFT_db = {
'Custom': {
'design_nrj': 860,
'BOZwH': 1,
......@@ -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():
def __init__(self):
......@@ -740,7 +772,7 @@ class BOZcalc():
# BOZ part
self.widgets['Type'] = widgets.Dropdown(
options=list(BOZ_db),
options=list(BOZ_FFT_db),
value='Custom',
description='Type:',
style=style,
......@@ -748,7 +780,11 @@ class BOZcalc():
)
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['BOZwH'].value = v['BOZwH']
self.widgets['BOZwV'].value = v['BOZwV']
......@@ -772,11 +808,21 @@ class BOZcalc():
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
self.widgets['F_x'] = widgets.BoundedFloatText(
value=0.25,
min=0,
max=1,
max=1000,
step=0.01,
description='Focal length (m) Horiz.:',
style=style,
......@@ -785,7 +831,7 @@ class BOZcalc():
self.widgets['F_y'] = widgets.BoundedFloatText(
value=0.25,
min=0,
max=1,
max=1000,
step=0.01,
description='Vert.:',
style=style,
......@@ -794,7 +840,7 @@ class BOZcalc():
self.widgets['nrjL'] = widgets.BoundedIntText(
value=840,
min=450,
min=250,
max=3200,
step=1,
description='Low:',
......@@ -803,7 +849,7 @@ class BOZcalc():
)
self.widgets['nrjH'] = widgets.BoundedIntText(
value=880,
min=450,
min=250,
max=3200,
step=1,
description='High:',
......@@ -812,7 +858,7 @@ class BOZcalc():
)
self.widgets['nrjD'] = widgets.BoundedIntText(
value=860,
min=450,
min=250,
max=3200,
step=1,
width=4,
......@@ -866,8 +912,8 @@ class BOZcalc():
self.widgets['dr_label_y'] = widgets.Label(value='dr_y')
self.widgets['d_label'] = widgets.Label(value='dr')
BOZTab = VBox([
HBox([self.widgets['Type'],
self.widgets['EndStation']]),
HBox([self.widgets['EndStation'],
self.widgets['Type']]),
HBox([self.widgets['nrjD'],
self.widgets['F_x'],
self.widgets['F_y']
......@@ -877,6 +923,7 @@ class BOZcalc():
self.widgets['3beams']]),
HBox([self.widgets['dr_label_x'],
self.widgets['dr_label_y']]),
self.widgets['d_label'],
HBox([widgets.Label(value='Optics (mm):'),
self.widgets['BOZwH'],
self.widgets['BOZwV']]),
......