Skip to content
Snippets Groups Projects
Commit aed21f07 authored by Alexandros Asonitis's avatar Alexandros Asonitis
Browse files

added resistance to the data frame

parent 320d915c
No related branches found
No related tags found
No related merge requests found
...@@ -111,8 +111,8 @@ def initialize_file(sample_series,field,DUT,file_path): ...@@ -111,8 +111,8 @@ def initialize_file(sample_series,field,DUT,file_path):
return file return file
def create_data_frame(x,y): def create_data_frame(x,y):
header = ['V(V)','ABSV(V)',"I(A)",'ABSI(A)'] header = ['V(V)','ABSV(V)',"I(A)",'ABSI(A)',"R(Ohm)"]
data = {header[0]:x,header[1]:np.absolute(x),header[2]:y,header[3]:np.absolute(y)} data = {header[0]:x,header[1]:np.absolute(x),header[2]:y,header[3]:np.absolute(y),header[4]:np.divide(x,y)}
df = pd.DataFrame(data) df = pd.DataFrame(data)
print(df) print(df)
return df return df
......
%% Cell type:code id:6d955a9f-629b-4bf5-be97-b4ae534824a0 tags: %% Cell type:code id:6d955a9f-629b-4bf5-be97-b4ae534824a0 tags:
``` python ``` python
import ipywidgets as widgets import ipywidgets as widgets
from ipyfilechooser import FileChooser from ipyfilechooser import FileChooser
import sys import sys
``` ```
%% Cell type:code id:b0ed6115-9df5-4ff7-b4dc-146c83fe50c5 tags: %% Cell type:code id:b0ed6115-9df5-4ff7-b4dc-146c83fe50c5 tags:
``` python ``` python
reset=widgets.Button(description='RESET') reset=widgets.Button(description='RESET')
set=widgets.Button(description='SET') set=widgets.Button(description='SET')
sampling=widgets.Checkbox(description='sampling check') sampling=widgets.Checkbox(description='sampling check')
full=widgets.Checkbox(description='full sweep') full=widgets.Checkbox(description='full sweep')
``` ```
%% Cell type:code id:ed90b452-1aa0-4b8d-892c-87f161d9c81f tags: %% Cell type:code id:ed90b452-1aa0-4b8d-892c-87f161d9c81f tags:
``` python ``` python
line1=widgets.HBox([set,sampling]) line1=widgets.HBox([set,sampling])
``` ```
%% Cell type:code id:256f987e-04fd-4089-8e4f-c86ae9360c98 tags: %% Cell type:code id:256f987e-04fd-4089-8e4f-c86ae9360c98 tags:
``` python ``` python
line2=widgets.HBox([reset,full]) line2=widgets.HBox([reset,full])
``` ```
%% Cell type:code id:720bf813-db95-46c6-a426-4b04d0e87677 tags: %% Cell type:code id:720bf813-db95-46c6-a426-4b04d0e87677 tags:
``` python ``` python
all = widgets.VBox([line1,line2]) all = widgets.VBox([line1,line2])
output = widgets.Output() output = widgets.Output()
``` ```
%% Cell type:code id:ac715ba2-fac6-421d-901d-de7ee250bc89 tags: %% Cell type:code id:ac715ba2-fac6-421d-901d-de7ee250bc89 tags:
``` python ``` python
display(all,output) display(all,output)
``` ```
%% Output %% Output
%% Cell type:code id:fd0ccb93-6b61-4e49-9952-f6bb6dd3c471 tags: %% Cell type:code id:fd0ccb93-6b61-4e49-9952-f6bb6dd3c471 tags:
``` python ``` python
sampling.value sampling.value
sampling.disabled=True sampling.disabled=True
``` ```
%% Cell type:code id:a7fa339d-8d0f-4d4c-800a-5d8d52ff11d5 tags: %% Cell type:code id:a7fa339d-8d0f-4d4c-800a-5d8d52ff11d5 tags:
``` python ``` python
sampling.value sampling.value
``` ```
%% Output %% Output
False False
%% Cell type:code id:f10795c4-76b1-40a4-a28d-b6b354d1afe3 tags: %% Cell type:code id:f10795c4-76b1-40a4-a28d-b6b354d1afe3 tags:
``` python ``` python
# the three naming fields # the three naming fields
sample_series= widgets.Text( sample_series= widgets.Text(
value= '', value= '',
placeholder ='Enter text here:', placeholder ='Enter text here:',
description = 'sample series:', description = 'sample series:',
style = {'description_width': 'initial'} style = {'description_width': 'initial'}
) )
``` ```
%% Cell type:code id:0e6e7449-275f-43fc-bd8e-048c72033713 tags: %% Cell type:code id:0e6e7449-275f-43fc-bd8e-048c72033713 tags:
``` python ``` python
display(sample_series) display(sample_series)
``` ```
%% Output %% Output
%% Cell type:code id:df28834c-de9e-4072-a18b-6b1fdf246b01 tags: %% Cell type:code id:df28834c-de9e-4072-a18b-6b1fdf246b01 tags:
``` python ``` python
sample_series.disabled = False sample_series.disabled = False
``` ```
%% Cell type:code id:26a809a8-5f8e-4a4f-a390-9a119978a223 tags: %% Cell type:code id:26a809a8-5f8e-4a4f-a390-9a119978a223 tags:
``` python ``` python
field = widgets.Text( field = widgets.Text(
value= '', value= '',
placeholder ='Enter text here:', placeholder ='Enter text here:',
description = 'Field:', description = 'Field:',
style = {'description_width': 'initial'}, style = {'description_width': 'initial'},
) )
``` ```
%% Cell type:code id:9e41b95e-3961-44e8-b80e-707a71c98ffd tags: %% Cell type:code id:9e41b95e-3961-44e8-b80e-707a71c98ffd tags:
``` python ``` python
display(field) display(field)
``` ```
%% Output %% Output
%% Cell type:code id:f1284c6d-a847-4104-8208-a2f785c4fb3d tags: %% Cell type:code id:f1284c6d-a847-4104-8208-a2f785c4fb3d tags:
``` python ``` python
DUT = widgets.Text( DUT = widgets.Text(
value= '', value= '',
placeholder ='Enter text here:', placeholder ='Enter text here:',
description = 'DUT:', description = 'DUT:',
style = {'description_width': 'initial'}, style = {'description_width': 'initial'},
) )
``` ```
%% Cell type:code id:71204ea2-3b7b-4a69-9639-1ace2fb7b9ec tags: %% Cell type:code id:71204ea2-3b7b-4a69-9639-1ace2fb7b9ec tags:
``` python ``` python
display(DUT) display(DUT)
``` ```
%% Output %% Output
%% Cell type:code id:dc107383-f558-4cea-95cb-7b4aa0ff2cef tags: %% Cell type:code id:dc107383-f558-4cea-95cb-7b4aa0ff2cef tags:
``` python ``` python
all_text_boxes = widgets.VBox([sample_series,field,DUT]) all_text_boxes = widgets.VBox([sample_series,field,DUT])
``` ```
%% Cell type:code id:d9e2b71f-68c4-4228-a6ec-12439e57938c tags: %% Cell type:code id:d9e2b71f-68c4-4228-a6ec-12439e57938c tags:
``` python ``` python
display(all_text_boxes) display(all_text_boxes)
``` ```
%% Output %% Output
%% Cell type:code id:342522c9-0d49-421f-bd36-bd6143de783c tags: %% Cell type:code id:342522c9-0d49-421f-bd36-bd6143de783c tags:
``` python ``` python
all_text_boxes.disabled= False all_text_boxes.disabled= False
``` ```
%% Cell type:code id:f76363a2-f9e4-4cf3-81cb-9b2d12c6ce28 tags: %% Cell type:code id:f76363a2-f9e4-4cf3-81cb-9b2d12c6ce28 tags:
``` python ``` python
pc = FileChooser(select_desc="save results") pc = FileChooser(select_desc="save results")
pc.default_path = r"\\FILESERVER\public" pc.default_path = r"\\FILESERVER\public"
pc.show_only_dirs = True pc.show_only_dirs = True
display(pc) display(pc)
``` ```
%% Output %% Output
%% Cell type:code id:bd697c90-2c85-4f88-993f-02767474f004 tags: %% Cell type:code id:bd697c90-2c85-4f88-993f-02767474f004 tags:
``` python ``` python
#final version of buttons #final version of buttons
#filechooser #filechooser
fc = FileChooser(select_desc='load .ini') fc = FileChooser(select_desc='load .ini')
fc.default_path = r"\\FILESERVER\public" fc.default_path = r"\\FILESERVER\public"
fc.filter_pattern = '*.ini' fc.filter_pattern = '*.ini'
display(fc) display(fc)
#pathchooser #pathchooser
pc = FileChooser(select_desc="save path") pc = FileChooser(select_desc="save path")
pc.default_path = r"\\FILESERVER\public" pc.default_path = r"\\FILESERVER\public"
pc.show_only_dirs = True pc.show_only_dirs = True
display(pc) display(pc)
print() print()
# the three naming fields # the three naming fields
sample_series= widgets.Text( sample_series= widgets.Text(
value= '', value= '',
placeholder ='Enter text here:', placeholder ='Enter text here:',
description = 'sample series:', description = 'sample series:',
style = {'description_width': 'initial'} style = {'description_width': 'initial'}
) )
field = widgets.Text( field = widgets.Text(
value= '', value= '',
placeholder ='Enter text here:', placeholder ='Enter text here:',
description = 'Field:', description = 'Field:',
style = {'description_width': 'initial'}, style = {'description_width': 'initial'},
) )
DUT = widgets.Text( DUT = widgets.Text(
value= '', value= '',
placeholder ='Enter text here:', placeholder ='Enter text here:',
description = 'DUT:', description = 'DUT:',
style = {'description_width': 'initial'}, style = {'description_width': 'initial'},
) )
all_text_boxes = widgets.VBox([sample_series,field,DUT]) all_text_boxes = widgets.VBox([sample_series,field,DUT])
display(all_text_boxes) display(all_text_boxes)
print() print()
#create buttons as it shown in the how_buttons_look #create buttons as it shown in the how_buttons_look
set=widgets.Button(description='SET') set=widgets.Button(description='SET')
reset=widgets.Button(description='RESET') reset=widgets.Button(description='RESET')
sampling=widgets.Checkbox(description='sampling check') sampling=widgets.Checkbox(description='sampling check')
full=widgets.Checkbox(description='full sweep') full=widgets.Checkbox(description='full sweep')
#align a button with a checkbox horizontaly #align a button with a checkbox horizontaly
line1 = widgets.HBox([set,sampling]) line1 = widgets.HBox([set,sampling])
line2 = widgets.HBox([reset,full]) line2 = widgets.HBox([reset,full])
#pack them into a single vertical box #pack them into a single vertical box
all = widgets.VBox([line1,line2]) all = widgets.VBox([line1,line2])
output = widgets.Output() output = widgets.Output()
#dispaly them all #dispaly them all
display(all,output) display(all,output)
``` ```
%% Output %% Output
%% Cell type:code id:4ee60013-352b-4d32-b137-2a0fa0b9953e tags: %% Cell type:code id:4ee60013-352b-4d32-b137-2a0fa0b9953e tags:
``` python ``` python
sample_series= widgets.Text( sample_series= widgets.Text(
value= '', value= '',
placeholder ='Enter text here:', placeholder ='Enter text here:',
description = 'sample series:', description = 'sample series:',
style = {'description_width': 'initial'} style = {'description_width': 'initial'}
) )
field = widgets.Text( field = widgets.Text(
value= '', value= '',
placeholder ='Enter text here:', placeholder ='Enter text here:',
description = 'Field:', description = 'Field:',
style = {'description_width': 'initial'}, style = {'description_width': 'initial'},
) )
DUT = widgets.Text( DUT = widgets.Text(
value= '', value= '',
placeholder ='Enter text here:', placeholder ='Enter text here:',
description = 'DUT:', description = 'DUT:',
style = {'description_width': 'initial'}, style = {'description_width': 'initial'},
) )
all_text_boxes = widgets.VBox([sample_series,field,DUT]) all_text_boxes = widgets.VBox([sample_series,field,DUT])
display(all_text_boxes) display(all_text_boxes)
print() print()
# THE BUTTONS # THE BUTTONS
#create buttons as it shown in the how_buttons_look #create buttons as it shown in the how_buttons_look
set=widgets.Button(description='SET') set=widgets.Button(description='SET')
reset=widgets.Button(description='RESET') reset=widgets.Button(description='RESET')
sampling=widgets.Checkbox(description='sampling check') sampling=widgets.Checkbox(description='sampling check')
full=widgets.Button(description='full sweep') full=widgets.Button(description='full sweep')
number = widgets.BoundedIntText(value=1,min=1,max=sys.maxsize,step=1,description='full sweeps:',disabled=False) #number of measuremts for the full sweep number = widgets.BoundedIntText(value=1,min=1,max=sys.maxsize,step=1,description='full sweeps:',disabled=False) #number of measuremts for the full sweep
#align a button with a checkbox or integer bounded texts horizontaly #align a button with a checkbox or integer bounded texts horizontaly
line1 = widgets.HBox([set,sampling]) line1 = widgets.HBox([set,sampling])
line3 = widgets.HBox([full,number]) line3 = widgets.HBox([full,number])
#pack them into a single vertical box #pack them into a single vertical box
all = widgets.VBox([line1,reset,line3]) all = widgets.VBox([line1,reset,line3])
output = widgets.Output() output = widgets.Output()
#dispaly them all #dispaly them all
display(all,output) display(all,output)
``` ```
%% Output %% Output
%% Cell type:code id:4df29b64-60b0-482b-b64f-4041afee042f tags: %% Cell type:code id:4df29b64-60b0-482b-b64f-4041afee042f tags:
``` python ``` python
number.disabled = True number.disabled = True
print(number.value) print(number.value)
print(type(number.value)) print(type(number.value))
``` ```
%% Output %% Output
1 1
<class 'int'> <class 'int'>
%% Cell type:code id:2063a5db-1b3e-4563-9031-3e8866a1293f tags: %% Cell type:code id:2063a5db-1b3e-4563-9031-3e8866a1293f tags:
``` python ``` python
pc= None pc= None
def create(): def create():
def druck(): def druck():
print(pc.selected) print(pc.selected)
``` ```
%% Cell type:code id:410ac261-0419-4422-9930-a4daf24bdb41 tags: %% Cell type:code id:410ac261-0419-4422-9930-a4daf24bdb41 tags:
``` python ``` python
druck() druck()
``` ```
%% Output %% Output
None None
%% Cell type:code id:047ae36a-204c-4b4b-be15-343d1b3c9f46 tags: %% Cell type:code id:047ae36a-204c-4b4b-be15-343d1b3c9f46 tags:
``` python ``` python
import numpy as np
x1 = np.array([0,1,3])
x2 = np.array([0,1,2])
```
%% Cell type:code id:8d280dcc-fcf8-4afa-b405-aefed48422f4 tags:
``` python
print(x1)
print(x2)
```
%% Output
[0 1 3]
[0 1 2]
%% Cell type:code id:91ebd23b-0cfd-4cc1-b800-47d6ab89f857 tags:
``` python
x3 = np.divide(x1,x2)
```
%% Output
C:\Users\user\AppData\Local\Temp\ipykernel_2700\2797304533.py:1: RuntimeWarning: invalid value encountered in divide
x3 = np.divide(x1,x2)
%% Cell type:code id:09b1b543-aba6-4514-ad89-43c54b62a602 tags:
``` python
print(x3)
```
%% Output
[nan 1. 1.5]
%% Cell type:code id:5d01fa30-0c1d-4e89-9fb5-74e9e3af6511 tags:
``` python
``` ```
......
...@@ -291,8 +291,8 @@ def memristor(): ...@@ -291,8 +291,8 @@ def memristor():
#update plot #update plot
clear_output(wait = True) clear_output(wait = True)
print(df)
display(fig) display(fig)
print(df)
#check for loop termination #check for loop termination
if stop == True: if stop == True:
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{ {
"data": { "data": {
"application/vnd.jupyter.widget-view+json": { "application/vnd.jupyter.widget-view+json": {
"model_id": "c14f1c65cb75400e9f3ce8c3703d7a99", "model_id": "af4e65d1af3f4099b7987c6357e5b52c",
"version_major": 2, "version_major": 2,
"version_minor": 0 "version_minor": 0
}, },
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
{ {
"data": { "data": {
"application/vnd.jupyter.widget-view+json": { "application/vnd.jupyter.widget-view+json": {
"model_id": "12bcdd599fbb404ba1d55569550ca2ce", "model_id": "10e14d983dba4495bc479456a03d3009",
"version_major": 2, "version_major": 2,
"version_minor": 0 "version_minor": 0
}, },
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
{ {
"data": { "data": {
"application/vnd.jupyter.widget-view+json": { "application/vnd.jupyter.widget-view+json": {
"model_id": "4d15574dd8a8446cbb853b71056069d6", "model_id": "aa2abc45856c4a60943ac9e9e114827d",
"version_major": 2, "version_major": 2,
"version_minor": 0 "version_minor": 0
}, },
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
{ {
"data": { "data": {
"application/vnd.jupyter.widget-view+json": { "application/vnd.jupyter.widget-view+json": {
"model_id": "79f012dfd31d4ed4ae00b100d7a48586", "model_id": "4f611a8934e345e78eb6190b4fac8517",
"version_major": 2, "version_major": 2,
"version_minor": 0 "version_minor": 0
}, },
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
{ {
"data": { "data": {
"application/vnd.jupyter.widget-view+json": { "application/vnd.jupyter.widget-view+json": {
"model_id": "9d266524e5f14609b48f0e698acf2476", "model_id": "4375a6d2b950483da7bd5cc5cf3b8f8d",
"version_major": 2, "version_major": 2,
"version_minor": 0 "version_minor": 0
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment