Xmas version
This commit is contained in:
@ -28,12 +28,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 137,
|
||||
"execution_count": 1,
|
||||
"id": "7425242d-3c91-4c1e-a424-08625a38ee7a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"### Initial packages import ###################################################\n",
|
||||
"\n",
|
||||
"import ipywidgets as widgets\n",
|
||||
"\n",
|
||||
"import numpy as np\n",
|
||||
"import scipy.constants as cons\n",
|
||||
"import plotly.graph_objects as go\n",
|
||||
@ -42,7 +45,7 @@
|
||||
"from pandas import read_excel\n",
|
||||
"from IPython.display import display\n",
|
||||
"from plotly.subplots import make_subplots\n",
|
||||
"from ipywidgets import interactive_output, HBox, VBox, Layout, Label, Valid, ToggleButtons, RadioButtons, Dropdown, IntSlider, Checkbox, Button, ButtonStyle, GridBox,IntSlider\n",
|
||||
"from ipywidgets import interactive_output, HBox, VBox, Layout, Label, Valid, ToggleButtons, RadioButtons, Dropdown, IntSlider, Checkbox, Button, ButtonStyle, GridBox,IntSlider,Combobox\n",
|
||||
"\n",
|
||||
"### Function definitions ###################################################\n",
|
||||
"calib = r'calibrations.xlsx' # Path to the calibration file\n",
|
||||
@ -301,42 +304,18 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "66e552e4-5954-4f3f-a59f-66c5affb69b6",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "125969b5-b128-4869-ae27-4aa7d8949d48",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 213,
|
||||
"execution_count": 60,
|
||||
"id": "8055b802-cf83-4250-aea9-54e3e6b73db0",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"2\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"### CONTROLS ##########################################\n",
|
||||
"ali = dict(style = {'description_width': '110px','button_width': '55px', 'font_weight': 'bold'}, button_style='',disabled = False)\n",
|
||||
"ali = dict(style = {'description_width': '110px','button_width': '55px', 'font_weight': 'bold'}, button_style='', disabled = False)\n",
|
||||
"ali2 = dict(style = {'description_width': '60px','button_width': '90px', 'font_weight': 'bold'}, button_style='',disabled = False)\n",
|
||||
"ali3 = dict(style = {'description_width': '110px','button_width': '45px', 'font_weight': 'bold'}, button_style='',disabled = False)\n",
|
||||
"# header = Button(description='Control panel',layout=Layout(width='auto', grid_area='header'), style=ButtonStyle(button_color='navy', font_weight= 'bold',font_size= '20px',font_variant='small-caps',text_color='white'),disabled = False)\n",
|
||||
"\n",
|
||||
"beam_set = Button(description='Electron beam settings',layout=Layout(width='95%', grid_area='beam_set'), style=ButtonStyle(button_color='#0d48a1', font_weight= 'bold',font_size= '16px',font_variant='small-caps',text_color='white'),disabled = False) \n",
|
||||
"beam_set = Button(description='Electron beam settings',layout=Layout(width='95%', grid_area='beam_set'), style=ButtonStyle(button_color='#222261', font_weight= 'bold',font_size= '16px',text_color='white'),disabled = False) \n",
|
||||
"beam = Dropdown(options=opt.energies(), value=200,description='Beam energy (keV)', layout=Layout(width='95%', grid_area='beam_set1'), **ali )\n",
|
||||
"aperture_name = Label(value = 'Aperture',layout=Layout(width='95%', grid_area='aperture_name'),)\n",
|
||||
"if len(opt.apertures())>5:\n",
|
||||
@ -347,22 +326,19 @@
|
||||
"probe = Dropdown(options=opt.probes(), value='8C', description='Probe', layout=Layout(width='95%', grid_area='beam_set3'), **ali)\n",
|
||||
"defocus = IntSlider(description='Defocus (nm)', value=0, min=0, max=1000, step=1, continuous_update=False, layout=Layout(width='95%', grid_area='beam_set4'), **ali)\n",
|
||||
"\n",
|
||||
"scanning_set = Button(description='Scanning parameters',layout=Layout(width='95%', grid_area='scanning_set'),style=ButtonStyle(button_color='#0d48a1', font_weight= 'bold',font_size= '16px',font_variant='small-caps',text_color='white'),disabled = False)\n",
|
||||
"scanning_set = Button(description='Scanning parameters',layout=Layout(width='95%', grid_area='scanning_set'),style=ButtonStyle(button_color='#222261', font_weight= 'bold',font_size= '16px',text_color='white'),disabled = False)\n",
|
||||
"mag = Dropdown(options=opt.magnifications(),value=3,description='Magnification Mx', layout=Layout(width='95%', grid_area='scanning_set1'), **ali)\n",
|
||||
"matrix = Dropdown(options=opt.mappings(), value=2048, description='Matrix', layout=Layout(width='95%', grid_area='scanning_set2'), **ali)\n",
|
||||
"dwell_time = Dropdown(options=opt.dwelltimes(), value=10, description='Dwell time (μs)', layout=Layout(width='95%', grid_area='scanning_set3'), **ali)\n",
|
||||
"print(len(opt.detectors()))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"camera_set = Button(description='Detection',layout=Layout(width='95%', grid_area='camera_set'),style=ButtonStyle(button_color='#0d48a1', font_weight= 'bold',font_size= '16px',font_variant='small-caps',text_color='white'),disabled = False)\n",
|
||||
"camera_set = Button(description='Detection',layout=Layout(width='95%', grid_area='camera_set'),style=ButtonStyle(button_color='#222261', font_weight= 'bold',font_size= '16px',text_color='white'),disabled = False)\n",
|
||||
"cl = Dropdown(options=opt.cameralengths(), value=12, description='Nominal CL (cm)', layout=Layout(width='95%', grid_area='cl_set1'), **ali3)\n",
|
||||
"camera_name = Label(value = 'Detector',layout=Layout(width='95%', grid_area='camera_name'),)\n",
|
||||
"camera = ToggleButtons(options=opt.detectors(), description='', layout=Layout(width='95%', grid_area='camera_set1'), style = {'description_width': '60px','button_width': str(100/len(opt.detectors())-len(opt.detectors()))+'%', 'font_weight': 'bold'}, button_style='')\n",
|
||||
"restriction_name = Label(value = 'PAAR',layout=Layout(width='95%', grid_area='restriction_name'),)\n",
|
||||
"restriction = ToggleButtons(options=[('.',False), ('..',True)], value = False, description='',icons = ['times','check'], layout=Layout(width='95%', grid_area='camera_set2'),style = {'description_width': '80px','button_width': '48%', 'font_weight': 'bold'}, button_style='')\n",
|
||||
"restriction = ToggleButtons(options=[('.',False), ('..',True)], value = False, description='',icons = ['ban','check'], layout=Layout(width='95%', grid_area='camera_set2'),style = {'description_width': '80px','button_width': '48%', 'font_weight': 'bold'}, button_style='')\n",
|
||||
"binning_name = Label(value = 'Binning',layout=Layout(width='95%', grid_area='binning_name'),)\n",
|
||||
"binning = ToggleButtons(options=[('.',1), ('2',2), ('4',4), ('8',8), ('16',16)], value=1, description='', icons = ['times','',''], layout=Layout(width='auto', grid_area='camera_set3'), **ali3)\n",
|
||||
"binning = ToggleButtons(options=[('.',1), ('2',2), ('4',4), ('8',8), ('16',16)], value=1, description='', icons = ['ban','',''], layout=Layout(width='95%', grid_area='camera_set3'), **ali3)\n",
|
||||
"\n",
|
||||
"beam_res = Label(value = f'λ (pm) '+ str(\"{:.1f}\".format(pty.get_wavelength(beam.value)*1e12)),layout=Layout(width='auto', grid_area='sidebar1'),)\n",
|
||||
"beam.observe(inte.show_wavelength, names='value') \n",
|
||||
@ -375,77 +351,71 @@
|
||||
"dwell_time_res = Label(value = f'Rate (kHz) '+ str(\"{:.1f}\".format(pty.get_aq_frec(dwell_time.value))),layout=Layout(width='auto', grid_area='sidebar4'),) \n",
|
||||
"dwell_time.observe(inte.show_frame_rate, names='value') \n",
|
||||
"\n",
|
||||
"footer = Button(description='',layout=Layout(width='auto', grid_area='footer'),style=ButtonStyle(button_color='navy', font_weight= 'bold',font_size= '16px',font_variant='small-caps',text_color='white'))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"controls = GridBox(children=[beam_set, beam,aperture_name, aperture, probe, defocus, scanning_set, mag,matrix,dwell_time, cl,camera_set, camera,camera_name, restriction_name, restriction, binning_name, binning, beam_res, aperture_res,aperture_res2,fov_res, dwell_time_res],\n",
|
||||
" layout=Layout(width='325px', grid_template_rows='35px 35px 35px 35px 30px 30px 35px 35px 35px 35px 35px 35px 35px 35px 35px 35px', grid_template_columns='20% 40% 15% 25%', grid_template_areas='''\n",
|
||||
" \"beam_set beam_set beam_set beam_set \" \n",
|
||||
" \"beam_set1 beam_set1 beam_set1 beam_set1 \"\n",
|
||||
" \"beam_set3 beam_set3 beam_set3 beam_set3 \"\n",
|
||||
" \"beam_set4 beam_set4 beam_set4 beam_set4 \"\n",
|
||||
" \"aperture_name beam_set2 beam_set2 beam_set2 \"\n",
|
||||
" \". sidebar2 sidebar2 sidebar5 \"\n",
|
||||
" \"scanning_set scanning_set scanning_set scanning_set \" \n",
|
||||
" \"scanning_set1 scanning_set1 scanning_set1 scanning_set1 \"\n",
|
||||
" \"scanning_set2 scanning_set2 scanning_set2 scanning_set2 \"\n",
|
||||
" \"scanning_set3 scanning_set3 scanning_set3 scanning_set3 \"\n",
|
||||
" \"camera_set camera_set camera_set camera_set \"\n",
|
||||
" \"cl_set1 cl_set1 cl_set1 cl_set1 \"\n",
|
||||
" \"camera_name camera_set1 camera_set1 camera_set1 \"\n",
|
||||
" \"restriction_name camera_set2 camera_set2 camera_set2 \"\n",
|
||||
" \"binning_name camera_set3 camera_set3 camera_set3 \"\n",
|
||||
"file = open(\"./logo.png\", \"rb\")\n",
|
||||
"image = file.read()\n",
|
||||
"logo1 = widgets.Image(value=image, format='png', width=200, height=100,layout=Layout(grid_area='logo1'))\n",
|
||||
"\n",
|
||||
"file = open(\"./logo3.png\", \"rb\")\n",
|
||||
"image = file.read()\n",
|
||||
"logo2 = widgets.Image(value=image,format='png',width=200, height=100,layout=Layout(grid_area='logo2'))\n",
|
||||
"\n",
|
||||
"method = ToggleButtons(options=[('SSB ','direct'), ('Iter ','iterative')], description='', icons = ['opera','refresh'], tooltips=['Single side band ptychography', 'Iterative reconstruction methods (PIE, ML, DM)'],\n",
|
||||
" layout=Layout(width='95%', grid_area='methods2'), style = {'font_weight': 'bold'}, button_style='',disabled=False,)\n",
|
||||
"\n",
|
||||
"name1 = Button(description='Graphs (%)',layout=Layout(width='95%', grid_area='name1'),style=ButtonStyle(button_color='white', font_weight= 'bold',text_color='black'), disabled = False)\n",
|
||||
"graph_size = IntSlider(value=100,min=75,max=125,step=5, description='', layout=Layout(width='95%', grid_area='gr_size2'), button_style='primary',disabled=False,)\n",
|
||||
"\n",
|
||||
"chart = ToggleButtons(options=[('L ','micr'), ('R ','dedic'),('L+R ','both')],value = 'both',icons = ['columns','columns','columns'], description='',\n",
|
||||
" layout=Layout(width='95%', grid_area='charts'), style = {'button_width': '30%', 'font_weight': 'bold'}, button_style='',disabled=False,)\n",
|
||||
"\n",
|
||||
"header3 = Button(description='CL checks',layout=Layout(width='95%', grid_area='header3'),style=ButtonStyle(button_color='white', font_weight= 'bold',text_color='black'),disabled = True)\n",
|
||||
"header4 = Button(description='x-axis in',layout=Layout(width='95%', grid_area='header4'),style=ButtonStyle(button_color='white', text_color='black'),disabled = True)\n",
|
||||
"header5 = Button(description='CL guide',layout=Layout(width='95%', grid_area='header5'),style=ButtonStyle(button_color='white', font_weight= 'bold', text_color='black'),disabled = True)\n",
|
||||
"ctf_xaxis = ToggleButtons(options=['α','mrad', 'A'], layout=Layout(width='95%', grid_area='ctxaxis'), style = {'button_width': '50px'}, disabled=False)\n",
|
||||
"\n",
|
||||
"check0name = 'None'\n",
|
||||
"check1name = 'Low anlge approximation'\n",
|
||||
"check2name = 'Ptycho pixel < step size'\n",
|
||||
"check3name = 'Beam fits in probe window'\n",
|
||||
"check4name = 'Detector cover < 1α'\n",
|
||||
"check5name = 'Detector cover > 6α'\n",
|
||||
"\n",
|
||||
"cl_checks = widgets.SelectMultiple(options=[check0name, check1name, check2name, check3name, check4name, check5name],rows=6,disabled=False,layout=Layout(width='95%', grid_area='checks_cl'))\n",
|
||||
"\n",
|
||||
"controls = GridBox(children=[logo1,logo2,method, beam_set, beam,aperture_name, aperture, probe, defocus, scanning_set, mag,matrix,dwell_time, cl,camera_set, \n",
|
||||
" camera,camera_name, restriction_name, restriction, binning_name, binning, beam_res, aperture_res,aperture_res2,fov_res, dwell_time_res, graph_size,name1, chart,cl_checks,header5],\n",
|
||||
" layout=Layout(width='325px', grid_template_rows='40px 40px 35px 35px 35px 35px 35px 30px 30px 35px 35px 35px 35px 35px 35px 35px 35px 150px 220px 35px', grid_template_columns='20% 10% 30% 15% 25%', grid_template_areas='''\n",
|
||||
" \"logo1 logo1 . logo2 logo2 \" \n",
|
||||
" \"methods2 methods2 methods2 methods2 methods2\"\n",
|
||||
" \"beam_set beam_set beam_set beam_set beam_set\" \n",
|
||||
" \"beam_set1 beam_set1 beam_set1 beam_set1 beam_set1\"\n",
|
||||
" \"beam_set3 beam_set3 beam_set3 beam_set3 beam_set3\"\n",
|
||||
" \"beam_set4 beam_set4 beam_set4 beam_set4 beam_set4\"\n",
|
||||
" \"aperture_name beam_set2 beam_set2 beam_set2 beam_set2\"\n",
|
||||
" \". sidebar2 sidebar2 sidebar2 sidebar5\"\n",
|
||||
" \"scanning_set scanning_set scanning_set scanning_set scanning_set\" \n",
|
||||
" \"scanning_set1 scanning_set1 scanning_set1 scanning_set1 scanning_set1\"\n",
|
||||
" \"scanning_set2 scanning_set2 scanning_set2 scanning_set2 scanning_set2\"\n",
|
||||
" \"scanning_set3 scanning_set3 scanning_set3 scanning_set3 scanning_set3\"\n",
|
||||
" \"camera_set camera_set camera_set camera_set camera_set\"\n",
|
||||
" \"cl_set1 cl_set1 cl_set1 cl_set1 cl_set1\"\n",
|
||||
" \"camera_name camera_set1 camera_set1 camera_set1 camera_set1\"\n",
|
||||
" \"restriction_name camera_set2 camera_set2 camera_set2 camera_set2\"\n",
|
||||
" \"binning_name camera_set3 camera_set3 camera_set3 camera_set3\"\n",
|
||||
" \". . . . .\"\n",
|
||||
" \"header5 header5 checks_cl checks_cl checks_cl\"\n",
|
||||
" \" name1 name1 gr_size2 gr_size2 gr_size2\"\n",
|
||||
" \" charts charts charts charts charts\"\n",
|
||||
" '''))\n",
|
||||
"\n",
|
||||
"# SMALL CONTROLS\n",
|
||||
"descr = '75px'\n",
|
||||
"butt = '100px'\n",
|
||||
"butt2 = '150px'\n",
|
||||
"\n",
|
||||
"header3 = Button(description='CL limitations',layout=Layout(width='auto', grid_area='header3'),style=ButtonStyle(button_color='white', font_weight= 'bold',text_color='black'),disabled = False)\n",
|
||||
"method = ToggleButtons(options=[('SSB','direct'), ('Reconstruction ','iterative')], description='', icons = ['','refresh'], tooltips=['Single side band ptychography', 'Iterative reconstruction methods (PIE, ML, DM)'],\n",
|
||||
" layout=Layout(width='auto', grid_area='methods'), style = {'description_width': descr, 'button_width': '48.5%', 'font_weight': 'bold'}, button_style='',disabled=False,)\n",
|
||||
"\n",
|
||||
"ctf_xaxis = RadioButtons(options=['α','mrad', 'A'], description='CTF graph x-axis:', layout=Layout(width='auto', grid_area='ctxaxis'), style = {'description_width': descr,'button_width': butt}, disabled=False)\n",
|
||||
"\n",
|
||||
"cl_check_laa = Checkbox(value=True, description='Low anlge approximation', indent=False, layout=Layout(width='auto', grid_area='check1'), disabled=False,) # Low angle approximation check - scattering angle < 10 deg\n",
|
||||
"cl_check_pix = Checkbox(value=True, description='Ptycho pixel < step size',indent=False, layout=Layout(width='auto', grid_area='check2'), disabled=False,) # Reconstructed pixel size < scanning step size \n",
|
||||
"cl_check_def = Checkbox(value=True, description='Beam fits in probe window', indent=False, layout=Layout(width='auto', grid_area='check3'), disabled=False,) # Is probe window big enough to accomodate defocused probe?\n",
|
||||
"cl_check_1bf = Checkbox(value=True, description='Detector cover < 1α', indent=False, layout=Layout(width='auto', grid_area='check4'), disabled=False,) # Detector cover is lower than 1 α\n",
|
||||
"cl_check_nbf = Checkbox(value=True, description='Detector cover > 6α', indent=False, layout=Layout(width='auto', grid_area='check5'), disabled=False,) # Detector cover is higher than 6 α\n",
|
||||
"small_controls1 = GridBox(children=[header4, ctf_xaxis], layout=Layout(width='95%', grid_template_rows='auto', grid_template_columns='67% 75px 23%', grid_template_areas='''\". header4 ctxaxis \"'''))\n",
|
||||
"top_set = Button(description='',layout=Layout(width='99%', grid_area='scanning_set'), style=ButtonStyle(button_color='white', font_weight= 'bold',font_size= '16px',text_color='#0d48a1'),disabled = True)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"small_controls1 = GridBox(children=[header3, method, ctf_xaxis, cl_check_laa,cl_check_pix,cl_check_def, cl_check_1bf, cl_check_nbf],\n",
|
||||
" layout=Layout(width='100%',\n",
|
||||
" grid_template_rows='auto auto auto auto',\n",
|
||||
" grid_template_columns='2.5% 25% 2.5% 10% 20% 20% 20%',\n",
|
||||
" grid_template_areas='''\n",
|
||||
" \". methods . ctxaxis header3 header3 header3 \"\n",
|
||||
" \". . . ctxaxis check1 check2 check3\"\n",
|
||||
" \". . . ctxaxis check4 check5 . \"\n",
|
||||
" '''))\n",
|
||||
"header1 = Button(description='Graph selection',layout=Layout(width='auto', grid_area='header1'),style=ButtonStyle(button_color='white', font_weight= 'bold',text_color='black'), disabled = False)\n",
|
||||
"chart = ToggleButtons(options=[('Scheme ','micr'), ('Charts ','dedic'),('Both ','both')],value = 'both',icons = ['eye','eye','eye'], description='',\n",
|
||||
" layout=Layout(width='auto', grid_area='charts'), style = {'description_width': descr,'button_width': '32%', 'font_weight': 'bold'}, button_style='',disabled=False,)\n",
|
||||
"\n",
|
||||
"name1 = Button(description='Graphs size (%)',layout=Layout(width='auto', grid_area='name1'),style=ButtonStyle(button_color='white', font_weight= 'bold',text_color='black'), disabled = False)\n",
|
||||
"\n",
|
||||
"graph_size = IntSlider(value=100,min=50,max=150,step=5, description='', layout=Layout(width='auto', grid_area='gr_size'), style = {'description_width': descr,'button_width': butt}, button_style='primary',disabled=False,)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"small_controls2 = GridBox(children=[header1, chart, name1, graph_size],\n",
|
||||
" layout=Layout(width='100%',\n",
|
||||
" grid_template_rows='auto auto auto auto',\n",
|
||||
" grid_template_columns='15% 30% 15% 30%',\n",
|
||||
" grid_template_areas='''\n",
|
||||
" \"header1 charts name1 gr_size \"\n",
|
||||
" '''))\n",
|
||||
"\n",
|
||||
"def ptycho_interact(beam, aperture, aperture_res, aperture_res2, probe, cl, matrix, defocus, mag, camera, binning, dwell_time, restriction, method, ctf_xaxis, cl_check_laa, cl_check_pix, cl_check_def, cl_check_1bf, cl_check_nbf, graph_size, chart):\n",
|
||||
"def ptycho_interact(beam, aperture, aperture_res, aperture_res2, probe, cl, matrix, defocus, mag, camera, binning, dwell_time, restriction, method, ctf_xaxis, graph_size, chart, cl_checks):\n",
|
||||
" \n",
|
||||
" ### SINGLE SETTING PARAMETERS ###\n",
|
||||
" wavelength = pty.get_wavelength(beam)*1e12\n",
|
||||
@ -526,7 +496,7 @@
|
||||
" fig5.update_yaxes(range=[0, 100], showgrid=False, showticklabels=False, secondary_y=True)\n",
|
||||
" fig5.update_yaxes(title_text=\"Overlap %\", showgrid=False, showticklabels=True, tickvals = [-4*step_size_corr, -2*step_size_corr, 0, 2*step_size_corr, 4*step_size_corr],ticktext = ['0', '25', '50', '75', '100'], secondary_y=False)\n",
|
||||
" fig5.update_layout(title={'text': \"Sample\",'y': 0.975, 'x': 0.30,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig5.update_layout(width=4.25*graph_size, height=3.0*graph_size, margin =dict(l=1.3*graph_size, r=0.3*graph_size, t=0.1*graph_size, b=0))\n",
|
||||
" fig5.update_layout(width=5.25*graph_size, height=3.9*graph_size, margin =dict(l=1.3*graph_size, r=0.3*graph_size, t=0.1*graph_size, b=0))\n",
|
||||
"\n",
|
||||
" \n",
|
||||
" ### DETECTOR PLANE ##########################################\n",
|
||||
@ -543,13 +513,13 @@
|
||||
" fig6.add_annotation(x=num_pixels/2, y=num_pixels/10, text=\"Real pixel size = \"+str(np.round(size_pixel,2))+\" μm\", showarrow=False, yshift=0)\n",
|
||||
" fig6.add_trace(go.Scatter(showlegend=True,x=[-1], y=[-1], marker_color='red', name = \"BF disk\"),secondary_y=False)\n",
|
||||
" fig6.add_trace(go.Scatter(showlegend=False,x=[-1], y=[-1]),secondary_y=True)\n",
|
||||
" fig6.update_layout(legend=dict(orientation=\"h\",yanchor=\"bottom\",y=1.00,xanchor=\"right\",x=0.9))\n",
|
||||
" fig6.update_layout(title={'text': \"Detector\",'y':0.975, 'x':0.11,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig6.update_layout(legend=dict(orientation=\"h\",yanchor=\"bottom\",y=0.85,xanchor=\"right\",x=0.9))\n",
|
||||
" # fig6.update_layout(title={'text': \"Detector\",'y':0.975, 'x':0.11,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig6.update_xaxes(title_text=\"Pixels\", range=[1, num_pixels], zeroline=False, tickvals = [1, num_pixels/4, num_pixels/2, 3*num_pixels/4, num_pixels]) \n",
|
||||
" fig6.update_yaxes(range=[1, num_pixels], showticklabels=False, showgrid=False, secondary_y=False)\n",
|
||||
" fig6.update_yaxes(title_text=\"Angular cover (mrad)\", range=[1, num_pixels], showticklabels=True, tickvals = [1, num_pixels/4, num_pixels/2, 3*num_pixels/4, num_pixels],\n",
|
||||
" ticktext = ['', np.round(detector_cover/4,1), np.round(detector_cover/2,1), np.round(3*detector_cover/4,1), np.round(detector_cover,1)], secondary_y=True) \n",
|
||||
" fig6.update_layout(width=3.35*graph_size, height=3*graph_size, margin = dict(l=0.35*graph_size, r=0.48*graph_size, t=0.3*graph_size, b=0))\n",
|
||||
" fig6.update_layout(width=3.85*graph_size, height=2.8*graph_size, margin = dict(l=0.6*graph_size, r=0.48*graph_size, t=0*graph_size, b=0))\n",
|
||||
"\n",
|
||||
" \n",
|
||||
" focusdepth = wavelength/(semi_angle_corr/1000)**2/1000\n",
|
||||
@ -628,7 +598,7 @@
|
||||
" \n",
|
||||
" fig8.update_xaxes(title_text=\"\")\n",
|
||||
" # fig8.update_layout(title={'text': \"Microscope\" ,'y':1, 'x':0.10,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig8.update_layout(width=3.0*graph_size, height=7.2*graph_size, margin = dict(l=0, r=0, t=0.2*graph_size, b=0))\n",
|
||||
" fig8.update_layout(width=3.5*graph_size, height=7.2*graph_size, margin = dict(l=0.3*graph_size, r=0, t=0.0*graph_size, b=0))\n",
|
||||
" fig8.update_layout(plot_bgcolor='white')\n",
|
||||
" \n",
|
||||
" ### FINAL CHECKS ########################################## \n",
|
||||
@ -669,7 +639,7 @@
|
||||
"\n",
|
||||
" fig.update_layout(legend=dict(orientation=\"h\",yanchor=\"bottom\",y=0.75,xanchor=\"right\",x=1))\n",
|
||||
" # fig3.update_layout(title={'text': \"CTF\",'y':0.93, 'x':0.12,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig.update_layout(width=7.65*graph_size, height=2.25*graph_size, margin = dict(l=1.3*graph_size, r=0.3*graph_size, t=0.3*graph_size, b=0.3*graph_size))\n",
|
||||
" fig.update_layout(width=5*graph_size, height=2.5*graph_size, margin = dict(l=1.3*graph_size, r=0.3*graph_size, t=0.0*graph_size, b=0.3*graph_size))\n",
|
||||
" \n",
|
||||
" ### CAMERA LENGTH GRAPH ##########################################\n",
|
||||
" fig4 = make_subplots(specs=[[{\"secondary_y\": True}]])\n",
|
||||
@ -677,32 +647,37 @@
|
||||
" fig4.add_trace(go.Scatter(showlegend=False, x=opt.cameralengths(), y=detector_cover_a_all,marker_color='gray'), secondary_y=True,)\n",
|
||||
" fig4.add_trace(go.Scatter(x=np.array(cl), y=np.array(covered_alfas), marker_size=12, marker_color='red', name = str(np.round(detector_cover,1))+ \" mrad; \"+str(np.round(covered_alfas,2))+ \" α\"), secondary_y=True,) \n",
|
||||
" fig4.add_trace(go.Scatter(x=np.array(ssb_cl), y=np.array(kolik),marker_size=12, marker_color='green', name = \"Recommended CL\"), secondary_y=True,) \n",
|
||||
" fig4.update_layout(legend=dict(orientation=\"v\",yanchor=\"bottom\",y=0.65,xanchor=\"right\",x=0.9))\n",
|
||||
" fig4.update_layout(legend=dict(orientation=\"v\",yanchor=\"bottom\",y=0.75,xanchor=\"right\",x=0.9))\n",
|
||||
" # fig4.update_layout(title={'text': \"CL to α\",'y':0.93, 'x':0.12,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig4.update_xaxes(title_text=\"Nominal camera length (cm)\", type=\"log\", tickvals = opt.cameralengths())\n",
|
||||
" fig4.update_layout(xaxis = dict(tickmode = 'array', tickvals = [1, num_pixels/4, num_pixels/2, 3*num_pixels/4, num_pixels]))\n",
|
||||
" fig4.update_yaxes(title_text=\" Cover angle (mrad)\", range=[0, 1.1*np.max(detector_cover_all)], secondary_y=False)\n",
|
||||
" fig4.update_yaxes(title_text=\" Cover angle (α)\", range=[0, 1.1*np.max(detector_cover_a_all)], showgrid=False, secondary_y=True)\n",
|
||||
" fig4.update_layout(xaxis = dict(tickmode = 'array', tickvals = opt.cameralengths()))\n",
|
||||
" fig4.update_layout(width=8.0*graph_size, height=2.25*graph_size, margin =dict(l=1.3*graph_size, r=0.25*graph_size, t=0.3*graph_size, b=0.3*graph_size))\n",
|
||||
" fig4.update_layout(width=5.25*graph_size, height=3*graph_size, margin =dict(l=1.3*graph_size, r=0.25*graph_size, t=0.3*graph_size, b=0.3*graph_size))\n",
|
||||
"\n",
|
||||
" ### SHOWING ###\n",
|
||||
" if chart == 'micr':\n",
|
||||
" left_column = VBox([go.FigureWidget(fig8)])\n",
|
||||
" left_column = VBox([go.FigureWidget(fig8),go.FigureWidget(fig6)])\n",
|
||||
" total = HBox([left_column]) \n",
|
||||
" \n",
|
||||
" elif chart == 'dedic':\n",
|
||||
" right_column = VBox([go.FigureWidget(fig) ,HBox([go.FigureWidget(fig5),go.FigureWidget(fig6)]),go.FigureWidget(fig4)])\n",
|
||||
" right_column = VBox([go.FigureWidget(fig) ,HBox([go.FigureWidget(fig5)]),go.FigureWidget(fig4)])\n",
|
||||
" total = HBox([right_column])\n",
|
||||
" \n",
|
||||
" else: \n",
|
||||
" right_column = VBox([go.FigureWidget(fig) ,HBox([go.FigureWidget(fig5),go.FigureWidget(fig6)]),go.FigureWidget(fig4)])\n",
|
||||
" left_column = VBox([go.FigureWidget(fig8)])\n",
|
||||
" right_column = VBox([go.FigureWidget(fig) ,HBox([go.FigureWidget(fig5)]),go.FigureWidget(fig4)])\n",
|
||||
" left_column = VBox([go.FigureWidget(fig8),go.FigureWidget(fig6)])\n",
|
||||
" total = HBox([left_column, right_column])\n",
|
||||
" \n",
|
||||
" total.layout = Layout(border='solid 0px gray',margin='0px 0px 0px 20px', padding='0px 0px 0px 0px') \n",
|
||||
" display(total)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" if method == 'iterative': \n",
|
||||
" ### PROBE ##########################################\n",
|
||||
@ -740,12 +715,12 @@
|
||||
" fig.add_trace(go.Scatter(x=xx, y=pctf_new, marker_color='red', name=str(np.round(semi_angle_corr,2))+ ' mrad',))\n",
|
||||
" fig.update_xaxes(title_text=\"Real space distance (Å)\",range=[-0.5, 2], type=\"log\", zeroline=False) # \n",
|
||||
"\n",
|
||||
" fig.update_layout(legend=dict(orientation=\"h\",yanchor=\"bottom\",y=0.75,xanchor=\"right\",x=1))\n",
|
||||
" fig.update_layout(legend=dict(orientation=\"h\",yanchor=\"bottom\",y=0.8,xanchor=\"right\",x=0.95))\n",
|
||||
" # fig3.update_layout(title={'text': \"CTF\",'y':0.93, 'x':0.12,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig.update_layout(width=7.65*graph_size, height=2.25*graph_size, margin = dict(l=1.3*graph_size, r=0.3*graph_size, t=0.3*graph_size, b=0.3*graph_size))\n",
|
||||
" fig.update_layout(width=9.25*graph_size, height=2.2*graph_size, margin = dict(l=1.3*graph_size, r=0.3*graph_size, t=0.0*graph_size, b=0.6*graph_size))\n",
|
||||
" \n",
|
||||
" checks = VBox([Label('Final checks'),check1, check2, check3]) \n",
|
||||
" checks.layout = Layout(border='dashed 1px gray', margin='30px 0px 50px 40px', padding='5px 5px 5px 5px')\n",
|
||||
" checks.layout = Layout(border='dashed 1px gray', margin='0px 30px 20px 120px', padding='5px 5px 5px 5px')\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" ### PROBE WINDOW ##########################################\n",
|
||||
@ -769,40 +744,50 @@
|
||||
" fig7.update_yaxes(range=[0, probe_window], showticklabels=False,)\n",
|
||||
" fig7.update_layout(legend=dict(orientation=\"v\",yanchor=\"bottom\",y=1.0,xanchor=\"right\",x=1))\n",
|
||||
" fig7.update_layout(title={'text': \"Probe\",'y':0.975, 'x':0.10,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig7.update_layout(width=3.0*graph_size, height=3.0*graph_size, margin =dict(l=0.3*graph_size, r=0.3*graph_size, t=0.1*graph_size, b=0)) \n",
|
||||
" fig7.update_layout(width=4*graph_size, height=4*graph_size, margin =dict(l=0.3*graph_size, r=0.3*graph_size, t=0.1*graph_size, b=0)) \n",
|
||||
" \n",
|
||||
" ### CAMERA LENGTH TABLE ########################################## \n",
|
||||
" dictionary = {}\n",
|
||||
" tab = np.array([np.round(ptycho_pixel_size_all,2),np.round(detector_cover_all,1), np.round(detector_cover_a_all,1), np.round(max_defocus_all,1), opt.cameralengths()])\n",
|
||||
"\n",
|
||||
" align6 = dict(layout=Layout(width=str(int(graph_size/100*62))+'px') , style = {'description_width': '0px','button_width': str(int(graph_size/100*60))+'px'}, disabled=True,)\n",
|
||||
" align7 = dict(layout=Layout(width='140px') , style = {'description_width': '0px','button_width': \"120px\"}, disabled=True,)\n",
|
||||
" align6 = dict(layout=Layout(width=str(int(graph_size/100*54))+'px') , style = {'description_width': '0px','button_width': str(int(graph_size/100*53))+'px'}, disabled=True,)\n",
|
||||
" align7 = dict(layout=Layout(width='125px') , style = {'description_width': '0px','button_width': \"120px\"}, disabled=True,)\n",
|
||||
" \n",
|
||||
" for i in range(0,12):\n",
|
||||
" button_style = 'success'\n",
|
||||
" data = tab[:,int(i)] # 0. ptycho pix, 1.det cov 2.det cov a, 3.max def, 4.cl\n",
|
||||
" data_tuple = tuple(tab[0:4,int(i)]) + (\"\",tab[4,int(i)])\n",
|
||||
" icons=['','','','','']\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# check1name = 'Low anlge approximation'\n",
|
||||
"# check2name = 'Ptycho pixel < step size'\n",
|
||||
"# check3name = 'Beam fits in probe window'\n",
|
||||
"# check4name = 'Detector cover < 1α'\n",
|
||||
"# check5name = 'Detector cover > 6α'\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" \n",
|
||||
" if cl_check_nbf == True: \n",
|
||||
" if data[2] > 6:\n",
|
||||
" button_style = 'warning' \n",
|
||||
" \n",
|
||||
" if cl_check_laa == True:\n",
|
||||
" if check1name in cl_checks:\n",
|
||||
" if data[1] > 1000*np.radians(10):\n",
|
||||
" button_style = 'danger' \n",
|
||||
" \n",
|
||||
" if cl_check_pix == True: \n",
|
||||
" if check2name in cl_checks: \n",
|
||||
" if data[0] > step_size_corr*10:\n",
|
||||
" button_style = 'danger'\n",
|
||||
" \n",
|
||||
" if cl_check_def == True: \n",
|
||||
" if check3name in cl_checks: \n",
|
||||
" if data[3] < defocus:\n",
|
||||
" button_style = 'danger'\n",
|
||||
" \n",
|
||||
" if cl_check_1bf == True: \n",
|
||||
" if check4name in cl_checks: \n",
|
||||
" if data[2] < 1:\n",
|
||||
" button_style = 'danger' \n",
|
||||
"\n",
|
||||
" if check5name in cl_checks: \n",
|
||||
" if data[2] > 6:\n",
|
||||
" button_style = 'warning' \n",
|
||||
" \n",
|
||||
" if cl == data[4]:\n",
|
||||
" icons=['','','','','check'] \n",
|
||||
@ -820,14 +805,14 @@
|
||||
" ### SHOWING ###\n",
|
||||
" match chart:\n",
|
||||
" case 'micr':\n",
|
||||
" total = VBox([go.FigureWidget(fig8)])\n",
|
||||
" total = VBox([go.FigureWidget(fig8),go.FigureWidget(fig6)])\n",
|
||||
" case 'dedic':\n",
|
||||
" sample_overlap = HBox([go.FigureWidget(fig5), go.FigureWidget(fig7), go.FigureWidget(fig6)]) \n",
|
||||
" total = VBox([HBox([go.FigureWidget(fig),checks]), sample_overlap, cltab]) \n",
|
||||
" sample_overlap = HBox([go.FigureWidget(fig5), go.FigureWidget(fig7)]) \n",
|
||||
" total = VBox([HBox([go.FigureWidget(fig)]), sample_overlap, cltab,checks]) \n",
|
||||
" case _:\n",
|
||||
" sample_overlap = HBox([go.FigureWidget(fig5), go.FigureWidget(fig7), go.FigureWidget(fig6)]) \n",
|
||||
" right_column = VBox([HBox([go.FigureWidget(fig),checks]), sample_overlap, cltab]) \n",
|
||||
" left_column = go.FigureWidget(fig8)\n",
|
||||
" sample_overlap = HBox([go.FigureWidget(fig5), go.FigureWidget(fig7)]) \n",
|
||||
" right_column = VBox([HBox([go.FigureWidget(fig)]), sample_overlap, cltab,checks]) \n",
|
||||
" left_column = VBox([go.FigureWidget(fig8), go.FigureWidget(fig6)]) \n",
|
||||
" total = HBox([left_column, right_column]) \n",
|
||||
" \n",
|
||||
" total.layout = Layout(border='solid 0px gray',margin='0px 0px 0px 10px', padding='0px 0px 0px 10px') \n",
|
||||
@ -837,8 +822,7 @@
|
||||
" return \n",
|
||||
" \n",
|
||||
"gui = interactive_output(ptycho_interact, {\"beam\": beam, \"aperture\": aperture,\"aperture_res\": aperture_res,\"aperture_res2\": aperture_res2, \"probe\": probe, \"cl\": cl, \"matrix\": matrix, \"defocus\": defocus, \"mag\": mag, \"camera\": camera,\n",
|
||||
" \"binning\": binning, \"dwell_time\": dwell_time, \"restriction\": restriction, \"method\": method, \"ctf_xaxis\": ctf_xaxis, \"cl_check_laa\":cl_check_laa, \"cl_check_pix\": cl_check_pix, \"cl_check_def\": cl_check_def,\n",
|
||||
" \"cl_check_1bf\": cl_check_1bf, \"cl_check_nbf\": cl_check_nbf, \"graph_size\": graph_size,\"chart\": chart}) \n"
|
||||
" \"binning\": binning, \"dwell_time\": dwell_time, \"restriction\": restriction, \"method\": method, \"ctf_xaxis\": ctf_xaxis, \"graph_size\": graph_size,\"chart\": chart,\"cl_checks\": cl_checks}) \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -871,19 +855,19 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 214,
|
||||
"execution_count": 61,
|
||||
"id": "7937f054-fcd0-4e67-a20f-7696f5903a94",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "59e5c62c96044e0c8cc325a6e1686415",
|
||||
"model_id": "6cbafcca9b904589bc6e7b05cc937013",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"HBox(children=(GridBox(children=(Button(description='Electron beam settings', layout=Layout(grid_area='beam_se…"
|
||||
"VBox(children=(Button(disabled=True, layout=Layout(grid_area='scanning_set', width='99%'), style=ButtonStyle(b…"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -891,7 +875,7 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"display(HBox([controls, VBox([small_controls1, gui, small_controls2])]))"
|
||||
"display(VBox([top_set, HBox([controls, VBox([top_set,small_controls1, gui])])]))"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
Binary file not shown.
@ -28,12 +28,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 137,
|
||||
"execution_count": 1,
|
||||
"id": "7425242d-3c91-4c1e-a424-08625a38ee7a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"### Initial packages import ###################################################\n",
|
||||
"\n",
|
||||
"import ipywidgets as widgets\n",
|
||||
"\n",
|
||||
"import numpy as np\n",
|
||||
"import scipy.constants as cons\n",
|
||||
"import plotly.graph_objects as go\n",
|
||||
@ -42,7 +45,7 @@
|
||||
"from pandas import read_excel\n",
|
||||
"from IPython.display import display\n",
|
||||
"from plotly.subplots import make_subplots\n",
|
||||
"from ipywidgets import interactive_output, HBox, VBox, Layout, Label, Valid, ToggleButtons, RadioButtons, Dropdown, IntSlider, Checkbox, Button, ButtonStyle, GridBox,IntSlider\n",
|
||||
"from ipywidgets import interactive_output, HBox, VBox, Layout, Label, Valid, ToggleButtons, RadioButtons, Dropdown, IntSlider, Checkbox, Button, ButtonStyle, GridBox,IntSlider,Combobox\n",
|
||||
"\n",
|
||||
"### Function definitions ###################################################\n",
|
||||
"calib = r'calibrations.xlsx' # Path to the calibration file\n",
|
||||
@ -301,42 +304,18 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "66e552e4-5954-4f3f-a59f-66c5affb69b6",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "125969b5-b128-4869-ae27-4aa7d8949d48",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 213,
|
||||
"execution_count": 2,
|
||||
"id": "8055b802-cf83-4250-aea9-54e3e6b73db0",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"2\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"### CONTROLS ##########################################\n",
|
||||
"ali = dict(style = {'description_width': '110px','button_width': '55px', 'font_weight': 'bold'}, button_style='',disabled = False)\n",
|
||||
"ali = dict(style = {'description_width': '110px','button_width': '55px', 'font_weight': 'bold'}, button_style='', disabled = False)\n",
|
||||
"ali2 = dict(style = {'description_width': '60px','button_width': '90px', 'font_weight': 'bold'}, button_style='',disabled = False)\n",
|
||||
"ali3 = dict(style = {'description_width': '110px','button_width': '45px', 'font_weight': 'bold'}, button_style='',disabled = False)\n",
|
||||
"# header = Button(description='Control panel',layout=Layout(width='auto', grid_area='header'), style=ButtonStyle(button_color='navy', font_weight= 'bold',font_size= '20px',font_variant='small-caps',text_color='white'),disabled = False)\n",
|
||||
"\n",
|
||||
"beam_set = Button(description='Electron beam settings',layout=Layout(width='95%', grid_area='beam_set'), style=ButtonStyle(button_color='#0d48a1', font_weight= 'bold',font_size= '16px',font_variant='small-caps',text_color='white'),disabled = False) \n",
|
||||
"beam_set = Button(description='Electron beam settings',layout=Layout(width='95%', grid_area='beam_set'), style=ButtonStyle(button_color='#222261', font_weight= 'bold',font_size= '16px',text_color='white'),disabled = False) \n",
|
||||
"beam = Dropdown(options=opt.energies(), value=200,description='Beam energy (keV)', layout=Layout(width='95%', grid_area='beam_set1'), **ali )\n",
|
||||
"aperture_name = Label(value = 'Aperture',layout=Layout(width='95%', grid_area='aperture_name'),)\n",
|
||||
"if len(opt.apertures())>5:\n",
|
||||
@ -347,22 +326,19 @@
|
||||
"probe = Dropdown(options=opt.probes(), value='8C', description='Probe', layout=Layout(width='95%', grid_area='beam_set3'), **ali)\n",
|
||||
"defocus = IntSlider(description='Defocus (nm)', value=0, min=0, max=1000, step=1, continuous_update=False, layout=Layout(width='95%', grid_area='beam_set4'), **ali)\n",
|
||||
"\n",
|
||||
"scanning_set = Button(description='Scanning parameters',layout=Layout(width='95%', grid_area='scanning_set'),style=ButtonStyle(button_color='#0d48a1', font_weight= 'bold',font_size= '16px',font_variant='small-caps',text_color='white'),disabled = False)\n",
|
||||
"scanning_set = Button(description='Scanning parameters',layout=Layout(width='95%', grid_area='scanning_set'),style=ButtonStyle(button_color='#222261', font_weight= 'bold',font_size= '16px',text_color='white'),disabled = False)\n",
|
||||
"mag = Dropdown(options=opt.magnifications(),value=3,description='Magnification Mx', layout=Layout(width='95%', grid_area='scanning_set1'), **ali)\n",
|
||||
"matrix = Dropdown(options=opt.mappings(), value=2048, description='Matrix', layout=Layout(width='95%', grid_area='scanning_set2'), **ali)\n",
|
||||
"dwell_time = Dropdown(options=opt.dwelltimes(), value=10, description='Dwell time (μs)', layout=Layout(width='95%', grid_area='scanning_set3'), **ali)\n",
|
||||
"print(len(opt.detectors()))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"camera_set = Button(description='Detection',layout=Layout(width='95%', grid_area='camera_set'),style=ButtonStyle(button_color='#0d48a1', font_weight= 'bold',font_size= '16px',font_variant='small-caps',text_color='white'),disabled = False)\n",
|
||||
"camera_set = Button(description='Detection',layout=Layout(width='95%', grid_area='camera_set'),style=ButtonStyle(button_color='#222261', font_weight= 'bold',font_size= '16px',text_color='white'),disabled = False)\n",
|
||||
"cl = Dropdown(options=opt.cameralengths(), value=12, description='Nominal CL (cm)', layout=Layout(width='95%', grid_area='cl_set1'), **ali3)\n",
|
||||
"camera_name = Label(value = 'Detector',layout=Layout(width='95%', grid_area='camera_name'),)\n",
|
||||
"camera = ToggleButtons(options=opt.detectors(), description='', layout=Layout(width='95%', grid_area='camera_set1'), style = {'description_width': '60px','button_width': str(100/len(opt.detectors())-len(opt.detectors()))+'%', 'font_weight': 'bold'}, button_style='')\n",
|
||||
"restriction_name = Label(value = 'PAAR',layout=Layout(width='95%', grid_area='restriction_name'),)\n",
|
||||
"restriction = ToggleButtons(options=[('.',False), ('..',True)], value = False, description='',icons = ['times','check'], layout=Layout(width='95%', grid_area='camera_set2'),style = {'description_width': '80px','button_width': '48%', 'font_weight': 'bold'}, button_style='')\n",
|
||||
"restriction = ToggleButtons(options=[('.',False), ('..',True)], value = False, description='',icons = ['ban','check'], layout=Layout(width='95%', grid_area='camera_set2'),style = {'description_width': '80px','button_width': '48%', 'font_weight': 'bold'}, button_style='')\n",
|
||||
"binning_name = Label(value = 'Binning',layout=Layout(width='95%', grid_area='binning_name'),)\n",
|
||||
"binning = ToggleButtons(options=[('.',1), ('2',2), ('4',4), ('8',8), ('16',16)], value=1, description='', icons = ['times','',''], layout=Layout(width='auto', grid_area='camera_set3'), **ali3)\n",
|
||||
"binning = ToggleButtons(options=[('.',1), ('2',2), ('4',4), ('8',8), ('16',16)], value=1, description='', icons = ['ban','',''], layout=Layout(width='95%', grid_area='camera_set3'), **ali3)\n",
|
||||
"\n",
|
||||
"beam_res = Label(value = f'λ (pm) '+ str(\"{:.1f}\".format(pty.get_wavelength(beam.value)*1e12)),layout=Layout(width='auto', grid_area='sidebar1'),)\n",
|
||||
"beam.observe(inte.show_wavelength, names='value') \n",
|
||||
@ -375,77 +351,71 @@
|
||||
"dwell_time_res = Label(value = f'Rate (kHz) '+ str(\"{:.1f}\".format(pty.get_aq_frec(dwell_time.value))),layout=Layout(width='auto', grid_area='sidebar4'),) \n",
|
||||
"dwell_time.observe(inte.show_frame_rate, names='value') \n",
|
||||
"\n",
|
||||
"footer = Button(description='',layout=Layout(width='auto', grid_area='footer'),style=ButtonStyle(button_color='navy', font_weight= 'bold',font_size= '16px',font_variant='small-caps',text_color='white'))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"controls = GridBox(children=[beam_set, beam,aperture_name, aperture, probe, defocus, scanning_set, mag,matrix,dwell_time, cl,camera_set, camera,camera_name, restriction_name, restriction, binning_name, binning, beam_res, aperture_res,aperture_res2,fov_res, dwell_time_res],\n",
|
||||
" layout=Layout(width='325px', grid_template_rows='35px 35px 35px 35px 30px 30px 35px 35px 35px 35px 35px 35px 35px 35px 35px 35px', grid_template_columns='20% 40% 15% 25%', grid_template_areas='''\n",
|
||||
" \"beam_set beam_set beam_set beam_set \" \n",
|
||||
" \"beam_set1 beam_set1 beam_set1 beam_set1 \"\n",
|
||||
" \"beam_set3 beam_set3 beam_set3 beam_set3 \"\n",
|
||||
" \"beam_set4 beam_set4 beam_set4 beam_set4 \"\n",
|
||||
" \"aperture_name beam_set2 beam_set2 beam_set2 \"\n",
|
||||
" \". sidebar2 sidebar2 sidebar5 \"\n",
|
||||
" \"scanning_set scanning_set scanning_set scanning_set \" \n",
|
||||
" \"scanning_set1 scanning_set1 scanning_set1 scanning_set1 \"\n",
|
||||
" \"scanning_set2 scanning_set2 scanning_set2 scanning_set2 \"\n",
|
||||
" \"scanning_set3 scanning_set3 scanning_set3 scanning_set3 \"\n",
|
||||
" \"camera_set camera_set camera_set camera_set \"\n",
|
||||
" \"cl_set1 cl_set1 cl_set1 cl_set1 \"\n",
|
||||
" \"camera_name camera_set1 camera_set1 camera_set1 \"\n",
|
||||
" \"restriction_name camera_set2 camera_set2 camera_set2 \"\n",
|
||||
" \"binning_name camera_set3 camera_set3 camera_set3 \"\n",
|
||||
"file = open(\"./logo.png\", \"rb\")\n",
|
||||
"image = file.read()\n",
|
||||
"logo1 = widgets.Image(value=image, format='png', width=200, height=100,layout=Layout(grid_area='logo1'))\n",
|
||||
"\n",
|
||||
"file = open(\"./logo3.png\", \"rb\")\n",
|
||||
"image = file.read()\n",
|
||||
"logo2 = widgets.Image(value=image,format='png',width=200, height=100,layout=Layout(grid_area='logo2'))\n",
|
||||
"\n",
|
||||
"method = ToggleButtons(options=[('SSB ','direct'), ('Iter ','iterative')], description='', icons = ['opera','refresh'], tooltips=['Single side band ptychography', 'Iterative reconstruction methods (PIE, ML, DM)'],\n",
|
||||
" layout=Layout(width='95%', grid_area='methods2'), style = {'font_weight': 'bold'}, button_style='',disabled=False,)\n",
|
||||
"\n",
|
||||
"name1 = Button(description='Graphs (%)',layout=Layout(width='95%', grid_area='name1'),style=ButtonStyle(button_color='white', font_weight= 'bold',text_color='black'), disabled = False)\n",
|
||||
"graph_size = IntSlider(value=100,min=75,max=125,step=5, description='', layout=Layout(width='95%', grid_area='gr_size2'), button_style='primary',disabled=False,)\n",
|
||||
"\n",
|
||||
"chart = ToggleButtons(options=[('L ','micr'), ('R ','dedic'),('L+R ','both')],value = 'both',icons = ['columns','columns','columns'], description='',\n",
|
||||
" layout=Layout(width='95%', grid_area='charts'), style = {'button_width': '30%', 'font_weight': 'bold'}, button_style='',disabled=False,)\n",
|
||||
"\n",
|
||||
"header3 = Button(description='CL checks',layout=Layout(width='95%', grid_area='header3'),style=ButtonStyle(button_color='white', font_weight= 'bold',text_color='black'),disabled = True)\n",
|
||||
"header4 = Button(description='x-axis in',layout=Layout(width='95%', grid_area='header4'),style=ButtonStyle(button_color='white', text_color='black'),disabled = True)\n",
|
||||
"header5 = Button(description='CL guide',layout=Layout(width='95%', grid_area='header5'),style=ButtonStyle(button_color='white', font_weight= 'bold', text_color='black'),disabled = True)\n",
|
||||
"ctf_xaxis = ToggleButtons(options=['α','mrad', 'A'], layout=Layout(width='95%', grid_area='ctxaxis'), style = {'button_width': '50px'}, disabled=False)\n",
|
||||
"\n",
|
||||
"check0name = 'None'\n",
|
||||
"check1name = 'Low anlge approximation'\n",
|
||||
"check2name = 'Ptycho pixel < step size'\n",
|
||||
"check3name = 'Beam fits in probe window'\n",
|
||||
"check4name = 'Detector cover < 1α'\n",
|
||||
"check5name = 'Detector cover > 6α'\n",
|
||||
"\n",
|
||||
"cl_checks = widgets.SelectMultiple(options=[check0name, check1name, check2name, check3name, check4name, check5name],rows=6,disabled=False,layout=Layout(width='95%', grid_area='checks_cl'))\n",
|
||||
"\n",
|
||||
"controls = GridBox(children=[logo1,logo2,method, beam_set, beam,aperture_name, aperture, probe, defocus, scanning_set, mag,matrix,dwell_time, cl,camera_set, \n",
|
||||
" camera,camera_name, restriction_name, restriction, binning_name, binning, beam_res, aperture_res,aperture_res2,fov_res, dwell_time_res, graph_size,name1, chart,cl_checks,header5],\n",
|
||||
" layout=Layout(width='325px', grid_template_rows='40px 40px 35px 35px 35px 35px 35px 30px 30px 35px 35px 35px 35px 35px 35px 35px 35px 150px 220px 35px', grid_template_columns='20% 10% 30% 15% 25%', grid_template_areas='''\n",
|
||||
" \"logo1 logo1 . logo2 logo2 \" \n",
|
||||
" \"methods2 methods2 methods2 methods2 methods2\"\n",
|
||||
" \"beam_set beam_set beam_set beam_set beam_set\" \n",
|
||||
" \"beam_set1 beam_set1 beam_set1 beam_set1 beam_set1\"\n",
|
||||
" \"beam_set3 beam_set3 beam_set3 beam_set3 beam_set3\"\n",
|
||||
" \"beam_set4 beam_set4 beam_set4 beam_set4 beam_set4\"\n",
|
||||
" \"aperture_name beam_set2 beam_set2 beam_set2 beam_set2\"\n",
|
||||
" \". sidebar2 sidebar2 sidebar2 sidebar5\"\n",
|
||||
" \"scanning_set scanning_set scanning_set scanning_set scanning_set\" \n",
|
||||
" \"scanning_set1 scanning_set1 scanning_set1 scanning_set1 scanning_set1\"\n",
|
||||
" \"scanning_set2 scanning_set2 scanning_set2 scanning_set2 scanning_set2\"\n",
|
||||
" \"scanning_set3 scanning_set3 scanning_set3 scanning_set3 scanning_set3\"\n",
|
||||
" \"camera_set camera_set camera_set camera_set camera_set\"\n",
|
||||
" \"cl_set1 cl_set1 cl_set1 cl_set1 cl_set1\"\n",
|
||||
" \"camera_name camera_set1 camera_set1 camera_set1 camera_set1\"\n",
|
||||
" \"restriction_name camera_set2 camera_set2 camera_set2 camera_set2\"\n",
|
||||
" \"binning_name camera_set3 camera_set3 camera_set3 camera_set3\"\n",
|
||||
" \". . . . .\"\n",
|
||||
" \"header5 header5 checks_cl checks_cl checks_cl\"\n",
|
||||
" \" name1 name1 gr_size2 gr_size2 gr_size2\"\n",
|
||||
" \" charts charts charts charts charts\"\n",
|
||||
" '''))\n",
|
||||
"\n",
|
||||
"# SMALL CONTROLS\n",
|
||||
"descr = '75px'\n",
|
||||
"butt = '100px'\n",
|
||||
"butt2 = '150px'\n",
|
||||
"\n",
|
||||
"header3 = Button(description='CL limitations',layout=Layout(width='auto', grid_area='header3'),style=ButtonStyle(button_color='white', font_weight= 'bold',text_color='black'),disabled = False)\n",
|
||||
"method = ToggleButtons(options=[('SSB','direct'), ('Reconstruction ','iterative')], description='', icons = ['','refresh'], tooltips=['Single side band ptychography', 'Iterative reconstruction methods (PIE, ML, DM)'],\n",
|
||||
" layout=Layout(width='auto', grid_area='methods'), style = {'description_width': descr, 'button_width': '48.5%', 'font_weight': 'bold'}, button_style='',disabled=False,)\n",
|
||||
"\n",
|
||||
"ctf_xaxis = RadioButtons(options=['α','mrad', 'A'], description='CTF graph x-axis:', layout=Layout(width='auto', grid_area='ctxaxis'), style = {'description_width': descr,'button_width': butt}, disabled=False)\n",
|
||||
"\n",
|
||||
"cl_check_laa = Checkbox(value=True, description='Low anlge approximation', indent=False, layout=Layout(width='auto', grid_area='check1'), disabled=False,) # Low angle approximation check - scattering angle < 10 deg\n",
|
||||
"cl_check_pix = Checkbox(value=True, description='Ptycho pixel < step size',indent=False, layout=Layout(width='auto', grid_area='check2'), disabled=False,) # Reconstructed pixel size < scanning step size \n",
|
||||
"cl_check_def = Checkbox(value=True, description='Beam fits in probe window', indent=False, layout=Layout(width='auto', grid_area='check3'), disabled=False,) # Is probe window big enough to accomodate defocused probe?\n",
|
||||
"cl_check_1bf = Checkbox(value=True, description='Detector cover < 1α', indent=False, layout=Layout(width='auto', grid_area='check4'), disabled=False,) # Detector cover is lower than 1 α\n",
|
||||
"cl_check_nbf = Checkbox(value=True, description='Detector cover > 6α', indent=False, layout=Layout(width='auto', grid_area='check5'), disabled=False,) # Detector cover is higher than 6 α\n",
|
||||
"small_controls1 = GridBox(children=[header4, ctf_xaxis], layout=Layout(width='95%', grid_template_rows='auto', grid_template_columns='67% 75px 23%', grid_template_areas='''\". header4 ctxaxis \"'''))\n",
|
||||
"top_set = Button(description='',layout=Layout(width='99%', grid_area='scanning_set'), style=ButtonStyle(button_color='white', font_weight= 'bold',font_size= '16px',text_color='#0d48a1'),disabled = True)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"small_controls1 = GridBox(children=[header3, method, ctf_xaxis, cl_check_laa,cl_check_pix,cl_check_def, cl_check_1bf, cl_check_nbf],\n",
|
||||
" layout=Layout(width='100%',\n",
|
||||
" grid_template_rows='auto auto auto auto',\n",
|
||||
" grid_template_columns='2.5% 25% 2.5% 10% 20% 20% 20%',\n",
|
||||
" grid_template_areas='''\n",
|
||||
" \". methods . ctxaxis header3 header3 header3 \"\n",
|
||||
" \". . . ctxaxis check1 check2 check3\"\n",
|
||||
" \". . . ctxaxis check4 check5 . \"\n",
|
||||
" '''))\n",
|
||||
"header1 = Button(description='Graph selection',layout=Layout(width='auto', grid_area='header1'),style=ButtonStyle(button_color='white', font_weight= 'bold',text_color='black'), disabled = False)\n",
|
||||
"chart = ToggleButtons(options=[('Scheme ','micr'), ('Charts ','dedic'),('Both ','both')],value = 'both',icons = ['eye','eye','eye'], description='',\n",
|
||||
" layout=Layout(width='auto', grid_area='charts'), style = {'description_width': descr,'button_width': '32%', 'font_weight': 'bold'}, button_style='',disabled=False,)\n",
|
||||
"\n",
|
||||
"name1 = Button(description='Graphs size (%)',layout=Layout(width='auto', grid_area='name1'),style=ButtonStyle(button_color='white', font_weight= 'bold',text_color='black'), disabled = False)\n",
|
||||
"\n",
|
||||
"graph_size = IntSlider(value=100,min=50,max=150,step=5, description='', layout=Layout(width='auto', grid_area='gr_size'), style = {'description_width': descr,'button_width': butt}, button_style='primary',disabled=False,)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"small_controls2 = GridBox(children=[header1, chart, name1, graph_size],\n",
|
||||
" layout=Layout(width='100%',\n",
|
||||
" grid_template_rows='auto auto auto auto',\n",
|
||||
" grid_template_columns='15% 30% 15% 30%',\n",
|
||||
" grid_template_areas='''\n",
|
||||
" \"header1 charts name1 gr_size \"\n",
|
||||
" '''))\n",
|
||||
"\n",
|
||||
"def ptycho_interact(beam, aperture, aperture_res, aperture_res2, probe, cl, matrix, defocus, mag, camera, binning, dwell_time, restriction, method, ctf_xaxis, cl_check_laa, cl_check_pix, cl_check_def, cl_check_1bf, cl_check_nbf, graph_size, chart):\n",
|
||||
"def ptycho_interact(beam, aperture, aperture_res, aperture_res2, probe, cl, matrix, defocus, mag, camera, binning, dwell_time, restriction, method, ctf_xaxis, graph_size, chart, cl_checks):\n",
|
||||
" \n",
|
||||
" ### SINGLE SETTING PARAMETERS ###\n",
|
||||
" wavelength = pty.get_wavelength(beam)*1e12\n",
|
||||
@ -526,7 +496,7 @@
|
||||
" fig5.update_yaxes(range=[0, 100], showgrid=False, showticklabels=False, secondary_y=True)\n",
|
||||
" fig5.update_yaxes(title_text=\"Overlap %\", showgrid=False, showticklabels=True, tickvals = [-4*step_size_corr, -2*step_size_corr, 0, 2*step_size_corr, 4*step_size_corr],ticktext = ['0', '25', '50', '75', '100'], secondary_y=False)\n",
|
||||
" fig5.update_layout(title={'text': \"Sample\",'y': 0.975, 'x': 0.30,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig5.update_layout(width=4.25*graph_size, height=3.0*graph_size, margin =dict(l=1.3*graph_size, r=0.3*graph_size, t=0.1*graph_size, b=0))\n",
|
||||
" fig5.update_layout(width=5.25*graph_size, height=3.9*graph_size, margin =dict(l=1.3*graph_size, r=0.3*graph_size, t=0.1*graph_size, b=0))\n",
|
||||
"\n",
|
||||
" \n",
|
||||
" ### DETECTOR PLANE ##########################################\n",
|
||||
@ -543,13 +513,13 @@
|
||||
" fig6.add_annotation(x=num_pixels/2, y=num_pixels/10, text=\"Real pixel size = \"+str(np.round(size_pixel,2))+\" μm\", showarrow=False, yshift=0)\n",
|
||||
" fig6.add_trace(go.Scatter(showlegend=True,x=[-1], y=[-1], marker_color='red', name = \"BF disk\"),secondary_y=False)\n",
|
||||
" fig6.add_trace(go.Scatter(showlegend=False,x=[-1], y=[-1]),secondary_y=True)\n",
|
||||
" fig6.update_layout(legend=dict(orientation=\"h\",yanchor=\"bottom\",y=1.00,xanchor=\"right\",x=0.9))\n",
|
||||
" fig6.update_layout(title={'text': \"Detector\",'y':0.975, 'x':0.11,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig6.update_layout(legend=dict(orientation=\"h\",yanchor=\"bottom\",y=0.85,xanchor=\"right\",x=0.9))\n",
|
||||
" # fig6.update_layout(title={'text': \"Detector\",'y':0.975, 'x':0.11,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig6.update_xaxes(title_text=\"Pixels\", range=[1, num_pixels], zeroline=False, tickvals = [1, num_pixels/4, num_pixels/2, 3*num_pixels/4, num_pixels]) \n",
|
||||
" fig6.update_yaxes(range=[1, num_pixels], showticklabels=False, showgrid=False, secondary_y=False)\n",
|
||||
" fig6.update_yaxes(title_text=\"Angular cover (mrad)\", range=[1, num_pixels], showticklabels=True, tickvals = [1, num_pixels/4, num_pixels/2, 3*num_pixels/4, num_pixels],\n",
|
||||
" ticktext = ['', np.round(detector_cover/4,1), np.round(detector_cover/2,1), np.round(3*detector_cover/4,1), np.round(detector_cover,1)], secondary_y=True) \n",
|
||||
" fig6.update_layout(width=3.35*graph_size, height=3*graph_size, margin = dict(l=0.35*graph_size, r=0.48*graph_size, t=0.3*graph_size, b=0))\n",
|
||||
" fig6.update_layout(width=3.85*graph_size, height=2.8*graph_size, margin = dict(l=0.6*graph_size, r=0.48*graph_size, t=0*graph_size, b=0))\n",
|
||||
"\n",
|
||||
" \n",
|
||||
" focusdepth = wavelength/(semi_angle_corr/1000)**2/1000\n",
|
||||
@ -628,7 +598,7 @@
|
||||
" \n",
|
||||
" fig8.update_xaxes(title_text=\"\")\n",
|
||||
" # fig8.update_layout(title={'text': \"Microscope\" ,'y':1, 'x':0.10,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig8.update_layout(width=3.0*graph_size, height=7.2*graph_size, margin = dict(l=0, r=0, t=0.2*graph_size, b=0))\n",
|
||||
" fig8.update_layout(width=3.5*graph_size, height=7.2*graph_size, margin = dict(l=0.3*graph_size, r=0, t=0.0*graph_size, b=0))\n",
|
||||
" fig8.update_layout(plot_bgcolor='white')\n",
|
||||
" \n",
|
||||
" ### FINAL CHECKS ########################################## \n",
|
||||
@ -669,7 +639,7 @@
|
||||
"\n",
|
||||
" fig.update_layout(legend=dict(orientation=\"h\",yanchor=\"bottom\",y=0.75,xanchor=\"right\",x=1))\n",
|
||||
" # fig3.update_layout(title={'text': \"CTF\",'y':0.93, 'x':0.12,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig.update_layout(width=7.65*graph_size, height=2.25*graph_size, margin = dict(l=1.3*graph_size, r=0.3*graph_size, t=0.3*graph_size, b=0.3*graph_size))\n",
|
||||
" fig.update_layout(width=5*graph_size, height=2.5*graph_size, margin = dict(l=1.3*graph_size, r=0.3*graph_size, t=0.0*graph_size, b=0.3*graph_size))\n",
|
||||
" \n",
|
||||
" ### CAMERA LENGTH GRAPH ##########################################\n",
|
||||
" fig4 = make_subplots(specs=[[{\"secondary_y\": True}]])\n",
|
||||
@ -677,32 +647,37 @@
|
||||
" fig4.add_trace(go.Scatter(showlegend=False, x=opt.cameralengths(), y=detector_cover_a_all,marker_color='gray'), secondary_y=True,)\n",
|
||||
" fig4.add_trace(go.Scatter(x=np.array(cl), y=np.array(covered_alfas), marker_size=12, marker_color='red', name = str(np.round(detector_cover,1))+ \" mrad; \"+str(np.round(covered_alfas,2))+ \" α\"), secondary_y=True,) \n",
|
||||
" fig4.add_trace(go.Scatter(x=np.array(ssb_cl), y=np.array(kolik),marker_size=12, marker_color='green', name = \"Recommended CL\"), secondary_y=True,) \n",
|
||||
" fig4.update_layout(legend=dict(orientation=\"v\",yanchor=\"bottom\",y=0.65,xanchor=\"right\",x=0.9))\n",
|
||||
" fig4.update_layout(legend=dict(orientation=\"v\",yanchor=\"bottom\",y=0.75,xanchor=\"right\",x=0.9))\n",
|
||||
" # fig4.update_layout(title={'text': \"CL to α\",'y':0.93, 'x':0.12,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig4.update_xaxes(title_text=\"Nominal camera length (cm)\", type=\"log\", tickvals = opt.cameralengths())\n",
|
||||
" fig4.update_layout(xaxis = dict(tickmode = 'array', tickvals = [1, num_pixels/4, num_pixels/2, 3*num_pixels/4, num_pixels]))\n",
|
||||
" fig4.update_yaxes(title_text=\" Cover angle (mrad)\", range=[0, 1.1*np.max(detector_cover_all)], secondary_y=False)\n",
|
||||
" fig4.update_yaxes(title_text=\" Cover angle (α)\", range=[0, 1.1*np.max(detector_cover_a_all)], showgrid=False, secondary_y=True)\n",
|
||||
" fig4.update_layout(xaxis = dict(tickmode = 'array', tickvals = opt.cameralengths()))\n",
|
||||
" fig4.update_layout(width=8.0*graph_size, height=2.25*graph_size, margin =dict(l=1.3*graph_size, r=0.25*graph_size, t=0.3*graph_size, b=0.3*graph_size))\n",
|
||||
" fig4.update_layout(width=5.25*graph_size, height=3*graph_size, margin =dict(l=1.3*graph_size, r=0.25*graph_size, t=0.3*graph_size, b=0.3*graph_size))\n",
|
||||
"\n",
|
||||
" ### SHOWING ###\n",
|
||||
" if chart == 'micr':\n",
|
||||
" left_column = VBox([go.FigureWidget(fig8)])\n",
|
||||
" left_column = VBox([go.FigureWidget(fig8),go.FigureWidget(fig6)])\n",
|
||||
" total = HBox([left_column]) \n",
|
||||
" \n",
|
||||
" elif chart == 'dedic':\n",
|
||||
" right_column = VBox([go.FigureWidget(fig) ,HBox([go.FigureWidget(fig5),go.FigureWidget(fig6)]),go.FigureWidget(fig4)])\n",
|
||||
" right_column = VBox([go.FigureWidget(fig) ,HBox([go.FigureWidget(fig5)]),go.FigureWidget(fig4)])\n",
|
||||
" total = HBox([right_column])\n",
|
||||
" \n",
|
||||
" else: \n",
|
||||
" right_column = VBox([go.FigureWidget(fig) ,HBox([go.FigureWidget(fig5),go.FigureWidget(fig6)]),go.FigureWidget(fig4)])\n",
|
||||
" left_column = VBox([go.FigureWidget(fig8)])\n",
|
||||
" right_column = VBox([go.FigureWidget(fig) ,HBox([go.FigureWidget(fig5)]),go.FigureWidget(fig4)])\n",
|
||||
" left_column = VBox([go.FigureWidget(fig8),go.FigureWidget(fig6)])\n",
|
||||
" total = HBox([left_column, right_column])\n",
|
||||
" \n",
|
||||
" total.layout = Layout(border='solid 0px gray',margin='0px 0px 0px 20px', padding='0px 0px 0px 0px') \n",
|
||||
" display(total)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" if method == 'iterative': \n",
|
||||
" ### PROBE ##########################################\n",
|
||||
@ -740,12 +715,12 @@
|
||||
" fig.add_trace(go.Scatter(x=xx, y=pctf_new, marker_color='red', name=str(np.round(semi_angle_corr,2))+ ' mrad',))\n",
|
||||
" fig.update_xaxes(title_text=\"Real space distance (Å)\",range=[-0.5, 2], type=\"log\", zeroline=False) # \n",
|
||||
"\n",
|
||||
" fig.update_layout(legend=dict(orientation=\"h\",yanchor=\"bottom\",y=0.75,xanchor=\"right\",x=1))\n",
|
||||
" fig.update_layout(legend=dict(orientation=\"h\",yanchor=\"bottom\",y=0.8,xanchor=\"right\",x=0.95))\n",
|
||||
" # fig3.update_layout(title={'text': \"CTF\",'y':0.93, 'x':0.12,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig.update_layout(width=7.65*graph_size, height=2.25*graph_size, margin = dict(l=1.3*graph_size, r=0.3*graph_size, t=0.3*graph_size, b=0.3*graph_size))\n",
|
||||
" fig.update_layout(width=9.25*graph_size, height=2.2*graph_size, margin = dict(l=1.3*graph_size, r=0.3*graph_size, t=0.0*graph_size, b=0.6*graph_size))\n",
|
||||
" \n",
|
||||
" checks = VBox([Label('Final checks'),check1, check2, check3]) \n",
|
||||
" checks.layout = Layout(border='dashed 1px gray', margin='30px 0px 50px 40px', padding='5px 5px 5px 5px')\n",
|
||||
" checks.layout = Layout(border='dashed 1px gray', margin='0px 30px 20px 120px', padding='5px 5px 5px 5px')\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" ### PROBE WINDOW ##########################################\n",
|
||||
@ -769,40 +744,50 @@
|
||||
" fig7.update_yaxes(range=[0, probe_window], showticklabels=False,)\n",
|
||||
" fig7.update_layout(legend=dict(orientation=\"v\",yanchor=\"bottom\",y=1.0,xanchor=\"right\",x=1))\n",
|
||||
" fig7.update_layout(title={'text': \"Probe\",'y':0.975, 'x':0.10,'xanchor': 'left','yanchor': 'top'})\n",
|
||||
" fig7.update_layout(width=3.0*graph_size, height=3.0*graph_size, margin =dict(l=0.3*graph_size, r=0.3*graph_size, t=0.1*graph_size, b=0)) \n",
|
||||
" fig7.update_layout(width=4*graph_size, height=4*graph_size, margin =dict(l=0.3*graph_size, r=0.3*graph_size, t=0.1*graph_size, b=0)) \n",
|
||||
" \n",
|
||||
" ### CAMERA LENGTH TABLE ########################################## \n",
|
||||
" dictionary = {}\n",
|
||||
" tab = np.array([np.round(ptycho_pixel_size_all,2),np.round(detector_cover_all,1), np.round(detector_cover_a_all,1), np.round(max_defocus_all,1), opt.cameralengths()])\n",
|
||||
"\n",
|
||||
" align6 = dict(layout=Layout(width=str(int(graph_size/100*62))+'px') , style = {'description_width': '0px','button_width': str(int(graph_size/100*60))+'px'}, disabled=True,)\n",
|
||||
" align7 = dict(layout=Layout(width='140px') , style = {'description_width': '0px','button_width': \"120px\"}, disabled=True,)\n",
|
||||
" align6 = dict(layout=Layout(width=str(int(graph_size/100*54))+'px') , style = {'description_width': '0px','button_width': str(int(graph_size/100*53))+'px'}, disabled=True,)\n",
|
||||
" align7 = dict(layout=Layout(width='125px') , style = {'description_width': '0px','button_width': \"120px\"}, disabled=True,)\n",
|
||||
" \n",
|
||||
" for i in range(0,12):\n",
|
||||
" button_style = 'success'\n",
|
||||
" data = tab[:,int(i)] # 0. ptycho pix, 1.det cov 2.det cov a, 3.max def, 4.cl\n",
|
||||
" data_tuple = tuple(tab[0:4,int(i)]) + (\"\",tab[4,int(i)])\n",
|
||||
" icons=['','','','','']\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# check1name = 'Low anlge approximation'\n",
|
||||
"# check2name = 'Ptycho pixel < step size'\n",
|
||||
"# check3name = 'Beam fits in probe window'\n",
|
||||
"# check4name = 'Detector cover < 1α'\n",
|
||||
"# check5name = 'Detector cover > 6α'\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" \n",
|
||||
" if cl_check_nbf == True: \n",
|
||||
" if data[2] > 6:\n",
|
||||
" button_style = 'warning' \n",
|
||||
" \n",
|
||||
" if cl_check_laa == True:\n",
|
||||
" if check1name in cl_checks:\n",
|
||||
" if data[1] > 1000*np.radians(10):\n",
|
||||
" button_style = 'danger' \n",
|
||||
" \n",
|
||||
" if cl_check_pix == True: \n",
|
||||
" if check2name in cl_checks: \n",
|
||||
" if data[0] > step_size_corr*10:\n",
|
||||
" button_style = 'danger'\n",
|
||||
" \n",
|
||||
" if cl_check_def == True: \n",
|
||||
" if check3name in cl_checks: \n",
|
||||
" if data[3] < defocus:\n",
|
||||
" button_style = 'danger'\n",
|
||||
" \n",
|
||||
" if cl_check_1bf == True: \n",
|
||||
" if check4name in cl_checks: \n",
|
||||
" if data[2] < 1:\n",
|
||||
" button_style = 'danger' \n",
|
||||
"\n",
|
||||
" if check5name in cl_checks: \n",
|
||||
" if data[2] > 6:\n",
|
||||
" button_style = 'warning' \n",
|
||||
" \n",
|
||||
" if cl == data[4]:\n",
|
||||
" icons=['','','','','check'] \n",
|
||||
@ -820,14 +805,14 @@
|
||||
" ### SHOWING ###\n",
|
||||
" match chart:\n",
|
||||
" case 'micr':\n",
|
||||
" total = VBox([go.FigureWidget(fig8)])\n",
|
||||
" total = VBox([go.FigureWidget(fig8),go.FigureWidget(fig6)])\n",
|
||||
" case 'dedic':\n",
|
||||
" sample_overlap = HBox([go.FigureWidget(fig5), go.FigureWidget(fig7), go.FigureWidget(fig6)]) \n",
|
||||
" total = VBox([HBox([go.FigureWidget(fig),checks]), sample_overlap, cltab]) \n",
|
||||
" sample_overlap = HBox([go.FigureWidget(fig5), go.FigureWidget(fig7)]) \n",
|
||||
" total = VBox([HBox([go.FigureWidget(fig)]), sample_overlap, cltab,checks]) \n",
|
||||
" case _:\n",
|
||||
" sample_overlap = HBox([go.FigureWidget(fig5), go.FigureWidget(fig7), go.FigureWidget(fig6)]) \n",
|
||||
" right_column = VBox([HBox([go.FigureWidget(fig),checks]), sample_overlap, cltab]) \n",
|
||||
" left_column = go.FigureWidget(fig8)\n",
|
||||
" sample_overlap = HBox([go.FigureWidget(fig5), go.FigureWidget(fig7)]) \n",
|
||||
" right_column = VBox([HBox([go.FigureWidget(fig)]), sample_overlap, cltab,checks]) \n",
|
||||
" left_column = VBox([go.FigureWidget(fig8), go.FigureWidget(fig6)]) \n",
|
||||
" total = HBox([left_column, right_column]) \n",
|
||||
" \n",
|
||||
" total.layout = Layout(border='solid 0px gray',margin='0px 0px 0px 10px', padding='0px 0px 0px 10px') \n",
|
||||
@ -837,8 +822,7 @@
|
||||
" return \n",
|
||||
" \n",
|
||||
"gui = interactive_output(ptycho_interact, {\"beam\": beam, \"aperture\": aperture,\"aperture_res\": aperture_res,\"aperture_res2\": aperture_res2, \"probe\": probe, \"cl\": cl, \"matrix\": matrix, \"defocus\": defocus, \"mag\": mag, \"camera\": camera,\n",
|
||||
" \"binning\": binning, \"dwell_time\": dwell_time, \"restriction\": restriction, \"method\": method, \"ctf_xaxis\": ctf_xaxis, \"cl_check_laa\":cl_check_laa, \"cl_check_pix\": cl_check_pix, \"cl_check_def\": cl_check_def,\n",
|
||||
" \"cl_check_1bf\": cl_check_1bf, \"cl_check_nbf\": cl_check_nbf, \"graph_size\": graph_size,\"chart\": chart}) \n"
|
||||
" \"binning\": binning, \"dwell_time\": dwell_time, \"restriction\": restriction, \"method\": method, \"ctf_xaxis\": ctf_xaxis, \"graph_size\": graph_size,\"chart\": chart,\"cl_checks\": cl_checks}) \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -871,19 +855,19 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 214,
|
||||
"execution_count": 3,
|
||||
"id": "7937f054-fcd0-4e67-a20f-7696f5903a94",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "59e5c62c96044e0c8cc325a6e1686415",
|
||||
"model_id": "a62e254754ef4b12b7434bdd4a3f7b23",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"HBox(children=(GridBox(children=(Button(description='Electron beam settings', layout=Layout(grid_area='beam_se…"
|
||||
"VBox(children=(Button(disabled=True, layout=Layout(grid_area='scanning_set', width='99%'), style=ButtonStyle(b…"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -891,7 +875,7 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"display(HBox([controls, VBox([small_controls1, gui, small_controls2])]))"
|
||||
"display(VBox([top_set, HBox([controls, VBox([top_set,small_controls1, gui])])]))"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
Reference in New Issue
Block a user