-
Notifications
You must be signed in to change notification settings - Fork 0
/
TLeCroy.py
executable file
·70 lines (52 loc) · 1.52 KB
/
TLeCroy.py
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
import iotool as io
class TLeCroy:
def __init__(self, fname, debug=None, raw=None):
self._FileName = fname
if raw:
self._Raw = raw
else:
self._Raw = False
self._Info = dict()
self._Header = dict()
self._x, self._y, self._Header, self._Info = io.readTrc(self._FileName, raw = self._Raw)
if debug:
self._Debug = debug
else:
self._Debug = False
def PrintPrivate(self):
print(" *** INFO::lecroy:PrintPrivate ***")
print(" self._FileName " + str(self._FileName))
print(" self._Debug " + str(self._Debug))
print(" self._Raw " + str(self._Raw))
print(" ---")
print(" self._Header")
for item in self._Header.items():
print(item)
print(" ---")
print(" self._Info")
for item in self._Info.items():
print(item)
print(" ------------------------")
if self._Debug:
print(type(self._y[0]))
def GetTrace(self):
return self._x, self._y
def GetY(self):
return self._y
def GetHeader(self):
return self._Header
def GetInfo(self):
return self._Info
def PlotTrace(self, raw=True):
import matplotlib.pyplot as plt
if raw:
plt.plot(self._x, self._y, 'k', label=self._FileName)
plt.ylabel('amplitude (a.u.)')
plt.xlabel('time (a.u.)')
else:
milli = 1/1000.0
plt.plot(self._x, self._y / milli, 'k', label=self._FileName)
plt.ylabel('volts (mV)')
plt.xlabel('time (s)')
plt.title(self._FileName)
plt.show()