An error occurred while loading the file. Please try again.
-
Olivier Kaufmann authored46ced919
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
from ohmpi import OhmPi
import matplotlib.pyplot as plt
import numpy as np
a = np.arange(13) + 1
b = a + 3
m = a + 1
n = a + 2
seq = np.c_[a, b, m, n]
k = OhmPi(idps=False)
k.settings['injection_duration'] = 1
k.settings['nb_stack'] = 1
k.settings['nbr_meas'] = 1
k.sequence = seq
k.reset_mux()
k.switch_mux_on([1, 4, 2, 3])
#k.switch_mux_on([12, 15, 13, 14])
#k.measure(strategy='vmax')
#print('vab', k.compute_tx_volt(strategy='vmin'))
#k.rs_check()
out = k.run_measurement(quad=[3, 3, 3, 3], nb_stack=1, tx_volt=12, strategy='constant', autogain=True)
#k.reset_mux()
#k.rs_check(tx_volt=12)
# x = []
#for i in range(3):
# out = k.run_measurement(injection_duration=2, nb_stack=2, strategy='constant', tx_volt=5, autogain=False)
#x.append(out['R [ohm]'])
#k.append_and_save('out.csv', out)
data = out['fulldata']
inan = ~np.isnan(data[:,0])
if True:
fig, axs = plt.subplots(2, 1, sharex=True)
ax = axs[0]
ax.plot(data[inan,2], data[inan,0], 'r.-', label='current [mA]')
ax.set_ylabel('Current AB [mA]')
ax = axs[1]
ax.plot(data[inan,2], data[inan,1], '.-', label='voltage [mV]')
ax.set_ylabel('Voltage MN [mV]')
ax.set_xlabel('Time [s]')
plt.show()
# fig,ax=plt.subplots()
#
#
# ax.plot(data[inan,2], data[inan,0], label='current [mA]', marker="o")
# ax2=ax.twinx()
# ax2.plot(data[inan,2], data[inan,1],'r.-' , label='current [mV]')
# ax2.set_ylabel('Voltage [mV]', color='r')
# ymin=-50
# ymax=50
# ymin1=-4500
# ymax1= 4500
# ax.set_ylim([ymin,ymax])
# ax2.set_ylim([ymin1,ymax1])
#
# plt.show()
if False:
from numpy.fft import fft, ifft
x = data[inan, 1][10:300]
t = np.linspace(0, len(x)*4, len(x))
sr = 1/0.004
X = fft(x)
N = len(X)
n = np.arange(N)
T = N/sr
freq = n/T
plt.figure(figsize = (12, 6))
plt.subplot(121)
plt.stem(freq, np.abs(X), 'b', \
markerfmt=" ", basefmt="-b")
plt.xlabel('Freq (Hz)')
plt.ylabel('FFT Amplitude |X(freq)|')
#plt.xlim(0, 10)
plt.subplot(122)
plt.plot(t, ifft(X), 'r')
plt.xlabel('Time (s)')
plt.ylabel('Amplitude')
plt.tight_layout()
plt.show()