Skip to content
Snippets Groups Projects
Commit d0d9abf8 authored by JupyterHub User's avatar JupyterHub User
Browse files

implemented new I-V measurement

alsmost nothing is available to the user and data are exported to csv file
parent ee97361d
No related branches found
No related tags found
No related merge requests found
Showing
with 572 additions and 5 deletions
,Voltage(V),Current(A)
0,0.0,-2.0172e-07
1,0.05,1.7837e-05
2,0.1,3.7577e-05
3,0.15,6.0445e-05
4,0.2,8.5833e-05
5,0.25,0.000113797
6,0.3,0.00014604
7,0.35,0.0001823
8,0.4,0.00022479
9,0.45,0.00027261
10,0.5,0.00032461
11,0.55,0.00038161
12,0.6,0.00044615
13,0.65,0.00051651
14,0.7,0.00059047
15,0.75,0.00066731
16,0.8,0.00075451
17,0.85,0.0008448
18,0.9,0.00093602
19,0.95,0.00102376
20,1.0,0.0011258
21,1.05,0.0012281
22,1.1,0.0013295
23,1.15,0.0014353
24,1.2,0.0015563
25,1.25,0.0016701
26,1.3,0.0017803
27,1.35,0.0018951
28,1.4,0.002029
29,1.45,0.0021518
30,1.5,0.0022691
31,1.55,0.0023878
32,1.6,0.0025273
33,1.65,0.0026616
34,1.7,0.0027876
35,1.75,0.002916
36,1.8,0.0030592
37,1.85,0.0032063
38,1.9,0.0033439
39,1.95,0.003475
40,2.0,0.0036308
41,2.05,0.0037965
42,2.1,0.0039297
43,2.15,0.0040698
44,2.2,0.0042341
45,2.25,0.004404
46,2.3,0.0045565
47,2.35,0.0046994
48,2.4,0.0048693
49,2.45,0.0050476
50,2.5,0.0052095
51,2.55,0.0053543
52,2.6,0.0055203
53,2.65,0.0057068
54,2.7,0.0058664
55,2.75,0.0060137
56,2.8,0.0061811
57,2.85,0.0063717
58,2.9,0.0065344
59,2.95,0.0066796
60,3.0,0.0068391
61,3.05,0.0070318
62,3.1,0.0072005
63,3.15,0.0073433
64,3.2,0.0074938
65,3.25,0.0076875
66,3.3,0.0078528
67,3.35,0.0079939
68,3.4,0.0081331
69,3.45,0.008324
70,3.5,0.0084877
71,3.55,0.0086322
72,3.6,0.0087642
73,3.65,0.0089491
74,3.7,0.0091169
75,3.75,0.0092587
76,3.8,0.0094001
77,3.85,0.0095756
78,3.9,0.0097471
79,3.95,0.0098836
80,4.0,0.0100007
81,4.05,0.0101695
82,4.1,0.0103403
83,4.15,0.0104739
84,4.2,0.0105835
85,4.25,0.010747
86,4.3,0.0109165
87,4.35,0.0110492
88,4.4,0.0111549
89,4.45,0.0113035
90,4.5,0.011437
91,4.55,0.011582
92,4.6,0.011752
93,4.65,0.011885
94,4.7,0.01199
95,4.75,0.012118
96,4.8,0.012294
97,4.85,0.012424
98,4.9,0.012515
99,4.95,0.012631
100,5.0,0.012812
101,5.05,0.012943
102,5.1,0.013039
103,5.15,0.013146
104,5.2,0.013317
105,5.25,0.01345
106,5.3,0.013551
107,5.35,0.013645
108,5.4,0.013811
109,5.45,0.01394
110,5.5,0.014039
111,5.55,0.014122
112,5.6,0.014289
113,5.65,0.014246
114,5.7,0.014127
115,5.75,0.014193
116,5.8,0.014335
117,5.85,0.014895
118,5.9,0.014997
119,5.95,0.015063
120,6.0,0.01521
121,6.05,0.01535
122,6.1,0.015448
123,6.15,0.015513
124,6.2,0.015641
125,6.25,0.015792
126,6.3,0.015895
127,6.35,0.015949
128,6.4,0.016056
129,6.45,0.016203
130,6.5,0.016302
131,6.55,0.016362
132,6.6,0.016492
133,6.65,0.016636
134,6.7,0.016745
135,6.75,0.016774
136,6.8,0.016874
137,6.85,0.017036
138,6.9,0.017124
139,6.95,0.017172
140,7.0,0.017251
141,7.05,0.01741
142,7.1,0.017513
143,7.15,0.017609
144,7.2,0.017646
145,7.25,0.017794
146,7.3,0.017869
147,7.35,0.017955
148,7.4,0.01802
149,7.45,0.018137
150,7.5,0.018244
151,7.55,0.018323
152,7.6,0.018396
153,7.65,0.018502
154,7.7,0.018611
155,7.75,0.018682
156,7.8,0.018713
157,7.85,0.018826
158,7.9,0.018934
159,7.95,0.019005
160,8.0,0.019042
161,8.05,0.019156
162,8.1,0.019268
163,8.15,0.019344
164,8.2,0.019375
165,8.25,0.019478
166,8.3,0.019604
167,8.35,0.019675
168,8.4,0.019701
169,8.45,0.019793
170,8.5,0.019926
171,8.55,0.019996
172,8.6,0.020026
173,8.65,0.020103
174,8.7,0.020242
175,8.75,0.020314
176,8.8,0.020345
177,8.85,0.020408
178,8.9,0.020549
179,8.95,0.020624
180,9.0,0.021077
181,9.05,0.020751
182,9.1,0.020862
183,9.15,0.02093
184,9.2,0.020973
185,9.25,0.021014
186,9.3,0.021131
187,9.35,0.021219
188,9.4,0.021269
189,9.45,0.021204
190,9.5,0.02139
191,9.55,0.02151
192,9.6,0.021572
193,9.65,0.02159
194,9.7,0.021701
195,9.75,0.021798
196,9.8,0.021869
197,9.85,0.021896
198,9.9,0.021991
199,9.95,0.022039
200,10.0,0.022167
%% Cell type:code id:8b118521-4ded-405e-95fd-3c5642ef8585 tags:
``` python
import measurements
from measurements import *
```
%% Cell type:code id:2d031d5e-a683-4def-8bc0-9008e5ae87eb tags:
``` python
start = 0
step = 0.05
stop = 10
I_V_Measurement(start,stop,step)
```
%% Output
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/tmp/ipykernel_16728/3105077528.py in <module>
3 stop = 10
4
----> 5 I_V_Measurement(start,stop,step)
~/cst/labcode/hp4155/measurements.py in I_V_Measurement(start, stop, step)
9 def I_V_Measurement(start,stop,step):
10
---> 11 device = module.HP4155a('GPIB0::17::INSTR')
12 device.inst.write(":PAGE:MEAS")
13 device.inst.write(":PAGE:CHAN:MODE SWEEP") #go to sweep page and prepare sweep measurement
~/cst/labcode/hp4155/module.py in __init__(self, adress)
5 def __init__(self,adress):
6 self.adress = adress
----> 7 self.rm = pyvisa.ResourceManager()
8 self.inst = self.rm.open_resource(adress)
9 self.inst.timeout = None
/opt/conda/lib/python3.9/site-packages/pyvisa/highlevel.py in __new__(cls, visa_library)
2990 """
2991 if not isinstance(visa_library, VisaLibraryBase):
-> 2992 visa_library = open_visa_library(visa_library)
2993
2994 if visa_library.resource_manager is not None:
/opt/conda/lib/python3.9/site-packages/pyvisa/highlevel.py in open_visa_library(specification)
2897 wrapper = "ivi"
2898 else:
-> 2899 wrapper = _get_default_wrapper()
2900
2901 cls = get_wrapper_class(wrapper)
/opt/conda/lib/python3.9/site-packages/pyvisa/highlevel.py in _get_default_wrapper()
2856 except ValueError:
2857 logger.debug("Did not find pyvisa-py package")
-> 2858 raise ValueError(
2859 "Could not locate a VISA implementation. Install either the IVI binary or pyvisa-py."
2860 )
ValueError: Could not locate a VISA implementation. Install either the IVI binary or pyvisa-py.
%% Cell type:code id:2bcfdbc2-8b0a-4d41-b8bf-fca0da5b1e08 tags:
``` python
```
File added
File added
# this is a python file that minimizes the amount of code seen to the user
import module
import matplotlib.pyplot as plt
import pandas as pd
from datetime import datetime
def I_V_Measurement(start,stop,step):
device = module.HP4155a('GPIB0::17::INSTR')
device.inst.write(":PAGE:MEAS")
device.inst.write(":PAGE:CHAN:MODE SWEEP") #go to sweep page and prepare sweep measurement
#setup sweep
device.inst.write(":PAGE:CHAN:MODE SWEEP") #go to sweep page and prepare sweep measurement
#smu2 and smu4 are disabled
device.smu_disable_sweep(2)
device.smu_disable_sweep(4)
#smu1 is constant and common
device.smu_mode_meas(1,'COMM')
device.smu_function_sweep(1,'CONS')
#smu3 is VAR1 and V
device.smu_mode_meas(3,'V')
device.smu_function_sweep(3,'VAR1')
#define start-step-stop
device.start_value_sweep(start)
device.step_sweep(step)
device.stop_value_sweep(stop)
#start measurement
device.single_measurement()
while device.operation_completed() == False:
pass
voltage_values = device.return_data('V3')
current_values = device.return_data('I3')
# show plot
plt.plot(voltage_values,current_values)
plt.show()
#export data to csv file
#add title to the results
header = ['Voltage(V)', 'Current(A)']
data = {header[0]:voltage_values,header[1]:current_values}
df = pd.DataFrame(data)
date = str(datetime.today().replace(microsecond=0))
print(df)
#exporting the data frame in an excel file
file_name = 'results '+date+'.csv'
df.to_csv(file_name)
del device
\ No newline at end of file
......@@ -154,3 +154,20 @@ class HP4155a(object):
def measurement_mode(self,mode):
command =f":PAGE:CHAN:MODE {mode}"
self.inst.write(command)
#this is a method that returns data from a variable and converts them to a list of real numbers
def return_data(self, variable):
#send command to instrument returns a string of comma seperated values
command = f":DATA? '{variable}'"
data = self.inst.query(command)
# separate the string to a list of strings
values = data.replace("\n",",").split(",")
values.pop()
#convert the string to float numbers
for i in range(len(values)):
values[i] = float(values[i])
return values
\ No newline at end of file
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
File moved
File moved
File moved
Source diff could not be displayed: it is too large. Options to address this: view the blob.
,Voltage(V),Current(A)
0,0.0,-2.0172e-07
1,0.05,1.7837e-05
2,0.1,3.7577e-05
3,0.15,6.0445e-05
4,0.2,8.5833e-05
5,0.25,0.000113797
6,0.3,0.00014604
7,0.35,0.0001823
8,0.4,0.00022479
9,0.45,0.00027261
10,0.5,0.00032461
11,0.55,0.00038161
12,0.6,0.00044615
13,0.65,0.00051651
14,0.7,0.00059047
15,0.75,0.00066731
16,0.8,0.00075451
17,0.85,0.0008448
18,0.9,0.00093602
19,0.95,0.00102376
20,1.0,0.0011258
21,1.05,0.0012281
22,1.1,0.0013295
23,1.15,0.0014353
24,1.2,0.0015563
25,1.25,0.0016701
26,1.3,0.0017803
27,1.35,0.0018951
28,1.4,0.002029
29,1.45,0.0021518
30,1.5,0.0022691
31,1.55,0.0023878
32,1.6,0.0025273
33,1.65,0.0026616
34,1.7,0.0027876
35,1.75,0.002916
36,1.8,0.0030592
37,1.85,0.0032063
38,1.9,0.0033439
39,1.95,0.003475
40,2.0,0.0036308
41,2.05,0.0037965
42,2.1,0.0039297
43,2.15,0.0040698
44,2.2,0.0042341
45,2.25,0.004404
46,2.3,0.0045565
47,2.35,0.0046994
48,2.4,0.0048693
49,2.45,0.0050476
50,2.5,0.0052095
51,2.55,0.0053543
52,2.6,0.0055203
53,2.65,0.0057068
54,2.7,0.0058664
55,2.75,0.0060137
56,2.8,0.0061811
57,2.85,0.0063717
58,2.9,0.0065344
59,2.95,0.0066796
60,3.0,0.0068391
61,3.05,0.0070318
62,3.1,0.0072005
63,3.15,0.0073433
64,3.2,0.0074938
65,3.25,0.0076875
66,3.3,0.0078528
67,3.35,0.0079939
68,3.4,0.0081331
69,3.45,0.008324
70,3.5,0.0084877
71,3.55,0.0086322
72,3.6,0.0087642
73,3.65,0.0089491
74,3.7,0.0091169
75,3.75,0.0092587
76,3.8,0.0094001
77,3.85,0.0095756
78,3.9,0.0097471
79,3.95,0.0098836
80,4.0,0.0100007
81,4.05,0.0101695
82,4.1,0.0103403
83,4.15,0.0104739
84,4.2,0.0105835
85,4.25,0.010747
86,4.3,0.0109165
87,4.35,0.0110492
88,4.4,0.0111549
89,4.45,0.0113035
90,4.5,0.011437
91,4.55,0.011582
92,4.6,0.011752
93,4.65,0.011885
94,4.7,0.01199
95,4.75,0.012118
96,4.8,0.012294
97,4.85,0.012424
98,4.9,0.012515
99,4.95,0.012631
100,5.0,0.012812
101,5.05,0.012943
102,5.1,0.013039
103,5.15,0.013146
104,5.2,0.013317
105,5.25,0.01345
106,5.3,0.013551
107,5.35,0.013645
108,5.4,0.013811
109,5.45,0.01394
110,5.5,0.014039
111,5.55,0.014122
112,5.6,0.014289
113,5.65,0.014246
114,5.7,0.014127
115,5.75,0.014193
116,5.8,0.014335
117,5.85,0.014895
118,5.9,0.014997
119,5.95,0.015063
120,6.0,0.01521
121,6.05,0.01535
122,6.1,0.015448
123,6.15,0.015513
124,6.2,0.015641
125,6.25,0.015792
126,6.3,0.015895
127,6.35,0.015949
128,6.4,0.016056
129,6.45,0.016203
130,6.5,0.016302
131,6.55,0.016362
132,6.6,0.016492
133,6.65,0.016636
134,6.7,0.016745
135,6.75,0.016774
136,6.8,0.016874
137,6.85,0.017036
138,6.9,0.017124
139,6.95,0.017172
140,7.0,0.017251
141,7.05,0.01741
142,7.1,0.017513
143,7.15,0.017609
144,7.2,0.017646
145,7.25,0.017794
146,7.3,0.017869
147,7.35,0.017955
148,7.4,0.01802
149,7.45,0.018137
150,7.5,0.018244
151,7.55,0.018323
152,7.6,0.018396
153,7.65,0.018502
154,7.7,0.018611
155,7.75,0.018682
156,7.8,0.018713
157,7.85,0.018826
158,7.9,0.018934
159,7.95,0.019005
160,8.0,0.019042
161,8.05,0.019156
162,8.1,0.019268
163,8.15,0.019344
164,8.2,0.019375
165,8.25,0.019478
166,8.3,0.019604
167,8.35,0.019675
168,8.4,0.019701
169,8.45,0.019793
170,8.5,0.019926
171,8.55,0.019996
172,8.6,0.020026
173,8.65,0.020103
174,8.7,0.020242
175,8.75,0.020314
176,8.8,0.020345
177,8.85,0.020408
178,8.9,0.020549
179,8.95,0.020624
180,9.0,0.021077
181,9.05,0.020751
182,9.1,0.020862
183,9.15,0.02093
184,9.2,0.020973
185,9.25,0.021014
186,9.3,0.021131
187,9.35,0.021219
188,9.4,0.021269
189,9.45,0.021204
190,9.5,0.02139
191,9.55,0.02151
192,9.6,0.021572
193,9.65,0.02159
194,9.7,0.021701
195,9.75,0.021798
196,9.8,0.021869
197,9.85,0.021896
198,9.9,0.021991
199,9.95,0.022039
200,10.0,0.022167
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment