diff --git a/TLM_tool/interface.py b/TLM_tool/interface.py new file mode 100644 index 0000000000000000000000000000000000000000..950913416ef0e388a0df1bded1976389530b4851 --- /dev/null +++ b/TLM_tool/interface.py @@ -0,0 +1,133 @@ +import ipywidgets as widgets +from ipywidgets import GridspecLayout,Layout +from IPython.display import clear_output +import sys + +# Interface to collect information about the sample +def sample_interface(): + width = "90%" + height = "auto" + style = {'description_width': 'initial'} + + sample = GridspecLayout(6,2) + + sample[0,0] = widgets.Label("Sample Information") + sample[0,0].style.font_weight = 'bold' + + #iterate over the first two columns + for i in range(1,6,2): + sample[i:i+2,0]= widgets.Text(layout=Layout(height=height, width=width),style = style) + + + sample[1:3,0].description = "Processing Number:" + sample[3:5,0].description = "Sample Series:" + sample[5:7,0].description = "Field:" + + + #measurement information in the next columns + sample[1:3,1]= widgets.Dropdown(options=["TLM","CTLM"],value ='TLM',layout=Layout(height=height, width='60%'),description="Type:") #TLM or CTLM + sample[3:5,1]= widgets.BoundedIntText(value=50,min=1,max=sys.maxsize,step=1,layout=Layout(height=height, width=width),description="Contactlength(um):",style = style) + sample[5:7,1]= widgets.BoundedIntText(value=100,min=1,max=sys.maxsize,step=1,layout=Layout(height=height, width='60%'),description="Width(um):",style = style) + + + def on_type_change(change): + if change['new'] =="TLM": + sample[3:5,1].value = 50 + sample[3:5,1].description = 'Contactlength(um)' + else: + sample[3:5,1].value = 55 + sample[3:5,1].description = 'Inner Radius(um)' + + sample[1:3,1].observe(on_type_change, names='value') + display(sample) + print() + + sample_dict = { + 'processing_number':sample[1:3,0], + 'sample_series':sample[3:5,0], + 'field':sample[5:7,0], + 'type':sample[1:3,1], + 'length':sample[3:5,1], + 'width':sample[5:7,1], + } + + return sample_dict + +#function to get interface from measurement parameters +def parameters_interface(): + width = "60%" + height = "auto" + style = {'description_width': 'initial'} + + parameters_title=widgets.Label("Parameters",layout=Layout(height=height, width='50%')) + parameters_title.style.font_weight='bold' + + parameters = GridspecLayout(2,4) + + # Constant Value + parameters[0,0]=widgets.HTML("Source (A)<br>0nA to 101 mA",layout=Layout(height=height, width=width)) + parameters[0,1]=widgets.BoundedFloatText(value=1e-4,min=0,max=0.101,step=1e-3,layout=Layout(height=height, width=width)) + + + #compliance value + parameters[0,2] = widgets.HTML("V-compliance (V)<br>1 to 105V",layout=Layout(height=height, width=width)) + parameters[0,3] = widgets.BoundedFloatText(value=20,min=1,max=105,step=1,layout=Layout(height=height, width=width)) + + # Dwell time + parameters[1,0]=widgets.HTML("dwell time (sec)<br>50ms to 999.9s",layout=Layout(height=height, width=width)) + parameters[1,1]=widgets.BoundedFloatText(value=50e-3,min=-0.1,max=0.1,step=1e-3,layout=Layout(height=height, width=width)) + + + display(parameters_title) + display(parameters) + print() + + parameters_dict = { + 'source':parameters[0,1], + 'comp':parameters[0,3], + 'dwell':parameters[1,1], + + } + return parameters_dict + +def measured_values(): + + title = widgets.Label("Measured Values",layout=Layout(height='auto', width='auto')) + title.style.font_weight='bold' + + values = GridspecLayout(6,3) + + # Title of each column + values[0,0] = widgets.HTML("Distance <br> (µm)",layout=Layout(height='auto', width='auto')) + values[0,1] = widgets.HTML("Voltage <br> (V)",layout=Layout(height='auto', width='auto')) + values[0,2] = widgets.HTML("Resistance <br> (Ohm)",layout=Layout(height='auto', width='auto')) + + + # iterate over the first colmumn for the distances + distances = [5,10,15,20,50] + + for i,distance in enumerate(distances): + values[i+1,0]= widgets.BoundedIntText(value=int(distance),min=1,max=sys.maxsize,step=1,layout=Layout(height='auto', width='auto')) + + # Iterate over voltage and resistance column + for j in range(1,3): # The 2 columns + for i in range(1,6): # The 5 Values + values[i,j] = widgets.FloatText(value = 0, layout=Layout(height='auto', width='auto'),disabled = True) + + display(title) + display(values) + print() + + values_dict = dict() + for j in range(0,3): # The 3 columns + for i in range(1,6): # The 5 rows + if j == 0: + key = f"d{i}" + elif j == 1: + key = f"V{i}" + else: # j== 2 + key = f"R{i}" + values_dict[key] = values[i,j] + + return values_dict + diff --git a/TLM_tool/test_interface.ipynb b/TLM_tool/test_interface.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..2e7503f3d9f63e637a97d7e4174b2077b2328036 --- /dev/null +++ b/TLM_tool/test_interface.ipynb @@ -0,0 +1,139 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "32c13f8d-a4af-47dc-918c-134211f95ed7", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "29f755243aeb4ae89c76c5c6167251e3", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridspecLayout(children=(Label(value='Sample Information', layout=Layout(grid_area='widget001'), style=LabelSt…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "7ba6af02abeb4dd88a3fcaf271eba4c5", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Label(value='Parameters', layout=Layout(height='auto', width='50%'), style=LabelStyle(font_weight='bold'))" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "a05818b9bf6649c9a23248905224838b", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridspecLayout(children=(HTML(value='Source (A)<br>0nA to 101 mA', layout=Layout(grid_area='widget001', height…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "01f72c0605e54a489da361a2988c9faa", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Label(value='Measured Values', layout=Layout(height='auto', width='auto'), style=LabelStyle(font_weight='bold'…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "b51e9f94476844d48b4027fb47b21ae6", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridspecLayout(children=(HTML(value='Distance <br> (µm)', layout=Layout(grid_area='widget001', height='auto', …" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "from interface import *\n", + "#the interface\n", + "sample = sample_interface()\n", + "parameters = parameters_interface()\n", + "results = measured_values()\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "486dd859-bcaa-48b7-9e30-ab91884777c5", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/TLM_tool/TLM_test.ipynb b/TLM_tool/tests/TLM_test.ipynb similarity index 100% rename from TLM_tool/TLM_test.ipynb rename to TLM_tool/tests/TLM_test.ipynb diff --git a/TLM_tool/check_plug-ins.ipynb b/TLM_tool/tests/check_plug-ins.ipynb similarity index 100% rename from TLM_tool/check_plug-ins.ipynb rename to TLM_tool/tests/check_plug-ins.ipynb diff --git a/TLM_tool/contact_check.ipynb b/TLM_tool/tests/contact_check.ipynb similarity index 100% rename from TLM_tool/contact_check.ipynb rename to TLM_tool/tests/contact_check.ipynb diff --git a/TLM_tool/convert_test.ipynb b/TLM_tool/tests/convert_test.ipynb similarity index 100% rename from TLM_tool/convert_test.ipynb rename to TLM_tool/tests/convert_test.ipynb diff --git a/TLM_tool/keithley_first.ipynb b/TLM_tool/tests/keithley_first.ipynb similarity index 100% rename from TLM_tool/keithley_first.ipynb rename to TLM_tool/tests/keithley_first.ipynb diff --git a/TLM_tool/test_DAQ_class.ipynb b/TLM_tool/tests/test_DAQ_class.ipynb similarity index 100% rename from TLM_tool/test_DAQ_class.ipynb rename to TLM_tool/tests/test_DAQ_class.ipynb