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

Values extraction from measurement data

parent 40a2c579
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ add_widgets_to_list(view,all_widgets)
add_widgets_to_list(sweep_parameter_dict,all_widgets)
add_widgets_to_list(messparameter_dict,all_widgets)
fig, axs =
def on_measure_clicked(b):
with out:
clear_output()
......@@ -65,6 +65,7 @@ def on_measure_clicked(b):
device.set_parameter('set_delay_time',sweep_parameter_dict['d_time'].value)
device.set_parameter('set_delay_apperture',sweep_parameter_dict['d_apperture'].value)
device.set_parameter('aver_num',sweep_parameter_dict['averaging'].value)
device.write(sweep_parameter_dict["integration"].value) # Set integration number
# Now that we have set the frequency values ask user for calibration
answer = ask_for_calibration()
......@@ -72,11 +73,8 @@ def on_measure_clicked(b):
device.write('start_open_cal')
device.wait()
device.write('open_cal_on') #data saved in registers OG and OB
print(device.read_register('reg_open_offset_G'))
print(device.read_register('reg_open_offset_B'))
print(device.read_register('reg_open_offset_G'))
print(device.read_register('reg_open_offset_B'))
# open the file dialog
default_filename = f"{sample_dict['wafer'].value}_{sample_dict['sample'].value}_{sample_dict['field'].value}_CV.txt"
file = save_file(default_filename)
......@@ -86,13 +84,26 @@ def on_measure_clicked(b):
device.write('autoscale_B') # Autoscale B
# create the numpy list with the biases
# create the arrays with frequency, G and B
frequency = []
G = []
B = []
# create the arrays with everything that needs to be saved into the array
f_values = []
G_values = []
B_values = []
log_f = []
omega = []
Z = []
phi = []
D = []
Cs =[]
Cp =[]
Cp_area =[]
Cs_area = []
ReZ = []
ImZ = []
G_f_omega = []
num_of_points =int(abs(messparameter_dict["stop"].value-messparameter_dict["start"].value)/abs(messparameter_dict["step"].value) + 1)
num_of_points =int(abs(messparameter_dict["stop"].value-messparameter_dict["start"].value)/abs(messparameter_dict["step"].value) + 1)
area = np.pi * radius**2
biases = np.linspace(messparameter_dict["start"].value,messparameter_dict["stop"].value,num_of_points,endpoint = True)
for bias in biases:
......@@ -102,12 +113,36 @@ def on_measure_clicked(b):
# read the registers
current_freq = device.read_register('reg_sweep')
current_G = device.read_register('reg_A')
current_B = device.read_register('reg_B')
freq = device.read_register('reg_sweep')
G = device.read_register('reg_A')
B = device.read_register('reg_B')
time.sleep(messparameter_dict["sleep"].value)
#do the calculations
f_values.extend(freq)
G_values.extend(G)
B_vlaues.extend(B)
for i in range(len(freq)):
log_f.append(np.log10(freq[i]))
omega.append(2*np.pi*freq[i])
log_omega.append(np.log10(omega))
polar = cmath.polar(1/complex(G[i],B[i]))
Z .append(polar[0])
phi.append(180/np.pi * polar[1]) #in deg
D.append(G[i]/B[i])
Cp.append(B[i]/omega)
Cs.append(Cp*(1+D**(2)))
Cp_area.append(Cp/area)
Cs_area.append(Cs/area)
Z_complex = cmath.rect(polar[0],polar[1])
ReZ.append(Z_complex.real)
ImZ.append(Z_complex.imag)
G_f_omega.append(G_p/area/omega)
# Do A test plot
fig,ax1 = plt.subplots()
......@@ -136,25 +171,47 @@ def on_measure_clicked(b):
# read the registers
current_freq = device.read_register('reg_sweep')
current_G = device.read_register('reg_A')
current_B = device.read_register('reg_B')
freq = device.read_register('reg_sweep')
G = device.read_register('reg_A')
B = device.read_register('reg_B')
time.sleep(messparameter_dict["sleep"].value)
f_values.extend(freq)
G_values.extend(G)
B_vlaues.extend(B)
#do the calculations
for i in range(len(freq)):
log_f.append(np.log10(freq[i]))
omega.append(2*np.pi*freq[i])
log_omega.append(np.log10(omega))
polar = cmath.polar(1/complex(G[i],B[i]))
Z.append(polar[0])
phi.append(180/np.pi * polar[1]) #in deg
D.append(G[i]/B[i])
Cp.append(B[i]/omega)
Cs.append(Cp*(1+D**(2)))
Cp_area.append(Cp/area)
Cs_area.append(Cs/area)
Z_complex = cmath.rect(polar[0],polar[1])
ReZ.append(Z_complex.real)
ImZ.append(Z_complex.imag)
G_f_omega.append(G_p/area/omega)
# Do A test plot
fig,ax1 = plt.subplots()
color = 'b'
ax1.set_xlabel('Frequency (Hz)')
ax1.set_ylabel('G (S)', color=color)
ax1.plot(current_freq,current_G , color=color)
ax1.plot(freq,G , color=color)
ax1.tick_params(axis='y', labelcolor=color)
ax2 = ax1.twinx()
color = 'y'
ax2.set_ylabel('B (S)', color=color) # we already handled the x-label with ax1
ax2.plot(current_freq,current_B, color=color)
ax2.plot(freq,B, color=color)
ax2.tick_params(axis='y', labelcolor=color)
fig.suptitle(f"Results for Bias = {bias}V")
......
%% Cell type:code id:9d2dbd8f-ac4a-4923-a059-6e377324f4d0 tags:
``` python
import cmath
import numpy as np
```
%% Cell type:code id:6e2ff0c9-edda-4ea4-9776-857438f4243a tags:
``` python
# test values with the labview programm
```
%% Cell type:code id:59c934ec-e8f1-4a8a-883e-c7401923fa7f tags:
``` python
# test inputs
G_p = 1.27e-5
B_p = 0.0001507
U = -1.65
f = 1e6
area = 7.854E-5
```
%% Cell type:code id:39a3c711-b8c8-4b64-a3c5-2f2f7867eb48 tags:
``` python
log_f = np.log10(f)
print(log_f)
```
%% Output
6.0
%% Cell type:code id:31bb2ff6-3844-4e93-8992-e71fe3b72b4f tags:
``` python
omega = 2*np.pi*f
print(omega)
```
%% Output
6283185.307179586
%% Cell type:code id:2a63cc3d-9eb8-4280-b0dc-3de3619b6139 tags:
``` python
log_omega = np.log10(omega)
print(log_omega)
```
%% Output
6.798179868358115
%% Cell type:code id:3f1c119e-79ce-4a6c-9eae-7bded626e847 tags:
``` python
polar = cmath.polar(1/complex(G_p,B_p))
print(polar)
print(type(polar))
```
%% Output
(6612.26145303364, -1.4867215934478906)
<class 'tuple'>
%% Cell type:code id:a28da13f-41c5-49df-9edc-c390801b6b08 tags:
``` python
Z = polar[0]
phi = 180/np.pi * polar[1] #in deg
print(Z)
print(phi)
```
%% Output
6612.26145303364
-85.18287261552875
%% Cell type:code id:57eb43ca-de5a-49eb-b9fd-107c42f76dc9 tags:
``` python
D = G_p/B_p
print(D)
```
%% Output
0.08427339084273391
%% Cell type:code id:61ab4235-1027-42d6-825c-226c7d0b441f tags:
``` python
C_p = B_p/omega
print(C_p)
```
%% Output
2.398464992394863e-11
%% Cell type:code id:79865b7e-23c7-4ec9-a0d3-c755a6ac39c7 tags:
``` python
C_s = C_p*(1+D**(2))
print(C_s)
```
%% Output
2.415498901334008e-11
%% Cell type:code id:1ed7e1d7-2f95-463f-abed-d8add9939408 tags:
``` python
C_p_area = C_p/area
print(C_p_area)
C_s_area = C_s/area
print(C_s_area)
```
%% Output
3.0538133338360874e-07
3.0755015295823884e-07
%% Cell type:code id:b8bd3e45-b71c-4238-8703-6ae62d73d0b5 tags:
``` python
Z_complex = cmath.rect(polar[0],polar[1])
print(Z_complex)
Rez = Z_complex.real
print(Rez)
Imz = Z_complex.imag
print(Imz)
```
%% Output
(555.2694193455862-6588.905629557473j)
555.2694193455862
-6588.905629557473
%% Cell type:code id:6d3b45a3-129b-4937-b516-bddc1a0de10e tags:
``` python
G_f_omega = G_p/area/omega
print(G_f_omega)
```
%% Output
2.573552046431208e-08
%% Cell type:code id:bc553d3e-f346-4f86-9fb9-8467ccf814f1 tags:
``` python
# values pass all the tests
```
%% Cell type:code id:b449ceb5-5b6a-4904-8455-78f143abb050 tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment