Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
labcode
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CST
labcode
Commits
ab8167d1
Commit
ab8167d1
authored
5 months ago
by
Alexandros Asonitis
Browse files
Options
Downloads
Patches
Plain Diff
Values extraction from measurement data
parent
40a2c579
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
hp4194/cv.py
+77
-20
77 additions, 20 deletions
hp4194/cv.py
hp4194/values.ipynb
+307
-0
307 additions, 0 deletions
hp4194/values.ipynb
with
384 additions
and
20 deletions
hp4194/cv.py
+
77
−
20
View file @
ab8167d1
...
...
@@ -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
"
)
...
...
This diff is collapsed.
Click to expand it.
hp4194/values.ipynb
0 → 100644
+
307
−
0
View file @
ab8167d1
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "9d2dbd8f-ac4a-4923-a059-6e377324f4d0",
"metadata": {},
"outputs": [],
"source": [
"import cmath\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "6e2ff0c9-edda-4ea4-9776-857438f4243a",
"metadata": {},
"outputs": [],
"source": [
"# test values with the labview programm"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "59c934ec-e8f1-4a8a-883e-c7401923fa7f",
"metadata": {},
"outputs": [],
"source": [
"# test inputs\n",
"G_p = 1.27e-5\n",
"B_p = 0.0001507\n",
"U = -1.65\n",
"f = 1e6\n",
"area = 7.854E-5"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "39a3c711-b8c8-4b64-a3c5-2f2f7867eb48",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6.0\n"
]
}
],
"source": [
"log_f = np.log10(f)\n",
"print(log_f)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "31bb2ff6-3844-4e93-8992-e71fe3b72b4f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6283185.307179586\n"
]
}
],
"source": [
"omega = 2*np.pi*f\n",
"print(omega)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "2a63cc3d-9eb8-4280-b0dc-3de3619b6139",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6.798179868358115\n"
]
}
],
"source": [
"log_omega = np.log10(omega)\n",
"print(log_omega)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "3f1c119e-79ce-4a6c-9eae-7bded626e847",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(6612.26145303364, -1.4867215934478906)\n",
"<class 'tuple'>\n"
]
}
],
"source": [
"polar = cmath.polar(1/complex(G_p,B_p))\n",
"print(polar)\n",
"print(type(polar))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "a28da13f-41c5-49df-9edc-c390801b6b08",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6612.26145303364\n",
"-85.18287261552875\n"
]
}
],
"source": [
"Z = polar[0]\n",
"phi = 180/np.pi * polar[1] #in deg\n",
"\n",
"print(Z)\n",
"print(phi)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "57eb43ca-de5a-49eb-b9fd-107c42f76dc9",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.08427339084273391\n"
]
}
],
"source": [
"D = G_p/B_p\n",
"print(D)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "61ab4235-1027-42d6-825c-226c7d0b441f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2.398464992394863e-11\n"
]
}
],
"source": [
"C_p = B_p/omega\n",
"print(C_p)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "79865b7e-23c7-4ec9-a0d3-c755a6ac39c7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2.415498901334008e-11\n"
]
}
],
"source": [
"C_s = C_p*(1+D**(2))\n",
"print(C_s)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "1ed7e1d7-2f95-463f-abed-d8add9939408",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3.0538133338360874e-07\n",
"3.0755015295823884e-07\n"
]
}
],
"source": [
"C_p_area = C_p/area\n",
"print(C_p_area)\n",
"\n",
"C_s_area = C_s/area\n",
"print(C_s_area)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "b8bd3e45-b71c-4238-8703-6ae62d73d0b5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(555.2694193455862-6588.905629557473j)\n",
"555.2694193455862\n",
"-6588.905629557473\n"
]
}
],
"source": [
"Z_complex = cmath.rect(polar[0],polar[1])\n",
"print(Z_complex)\n",
"\n",
"Rez = Z_complex.real\n",
"print(Rez)\n",
"\n",
"Imz = Z_complex.imag\n",
"print(Imz)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "6d3b45a3-129b-4937-b516-bddc1a0de10e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2.573552046431208e-08\n"
]
}
],
"source": [
"G_f_omega = G_p/area/omega\n",
"\n",
"print(G_f_omega)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "bc553d3e-f346-4f86-9fb9-8467ccf814f1",
"metadata": {},
"outputs": [],
"source": [
"# values pass all the tests"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b449ceb5-5b6a-4904-8455-78f143abb050",
"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
}
%% 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
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment