QuLab 2.0.1__cp311-cp311-macosx_10_9_universal2.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- QuLab-2.0.1.dist-info/LICENSE +21 -0
- QuLab-2.0.1.dist-info/METADATA +95 -0
- QuLab-2.0.1.dist-info/RECORD +82 -0
- QuLab-2.0.1.dist-info/WHEEL +5 -0
- QuLab-2.0.1.dist-info/entry_points.txt +2 -0
- QuLab-2.0.1.dist-info/top_level.txt +1 -0
- qulab/__init__.py +1 -0
- qulab/__main__.py +24 -0
- qulab/fun.cpython-311-darwin.so +0 -0
- qulab/monitor/__init__.py +1 -0
- qulab/monitor/__main__.py +8 -0
- qulab/monitor/config.py +41 -0
- qulab/monitor/dataset.py +77 -0
- qulab/monitor/event_queue.py +54 -0
- qulab/monitor/mainwindow.py +234 -0
- qulab/monitor/monitor.py +93 -0
- qulab/monitor/ploter.py +123 -0
- qulab/monitor/qt_compat.py +16 -0
- qulab/monitor/toolbar.py +265 -0
- qulab/scan/__init__.py +4 -0
- qulab/scan/base.py +548 -0
- qulab/scan/dataset.py +0 -0
- qulab/scan/expression.py +472 -0
- qulab/scan/optimize.py +0 -0
- qulab/scan/scanner.py +270 -0
- qulab/scan/transforms.py +16 -0
- qulab/scan/utils.py +37 -0
- qulab/storage/__init__.py +0 -0
- qulab/storage/__main__.py +51 -0
- qulab/storage/backend/__init__.py +0 -0
- qulab/storage/backend/redis.py +204 -0
- qulab/storage/base_dataset.py +352 -0
- qulab/storage/chunk.py +60 -0
- qulab/storage/dataset.py +127 -0
- qulab/storage/file.py +273 -0
- qulab/storage/models/__init__.py +22 -0
- qulab/storage/models/base.py +4 -0
- qulab/storage/models/config.py +28 -0
- qulab/storage/models/file.py +89 -0
- qulab/storage/models/ipy.py +58 -0
- qulab/storage/models/models.py +88 -0
- qulab/storage/models/record.py +161 -0
- qulab/storage/models/report.py +22 -0
- qulab/storage/models/tag.py +93 -0
- qulab/storage/storage.py +95 -0
- qulab/sys/__init__.py +0 -0
- qulab/sys/chat.py +688 -0
- qulab/sys/device/__init__.py +3 -0
- qulab/sys/device/basedevice.py +221 -0
- qulab/sys/device/loader.py +86 -0
- qulab/sys/device/utils.py +46 -0
- qulab/sys/drivers/FakeInstrument.py +52 -0
- qulab/sys/drivers/__init__.py +0 -0
- qulab/sys/ipy_events.py +125 -0
- qulab/sys/net/__init__.py +0 -0
- qulab/sys/net/bencoder.py +205 -0
- qulab/sys/net/cli.py +169 -0
- qulab/sys/net/dhcp.py +543 -0
- qulab/sys/net/dhcpd.py +176 -0
- qulab/sys/net/kad.py +1142 -0
- qulab/sys/net/kcp.py +192 -0
- qulab/sys/net/nginx.py +192 -0
- qulab/sys/progress.py +190 -0
- qulab/sys/rpc/__init__.py +0 -0
- qulab/sys/rpc/client.py +0 -0
- qulab/sys/rpc/exceptions.py +96 -0
- qulab/sys/rpc/msgpack.py +1052 -0
- qulab/sys/rpc/msgpack.pyi +41 -0
- qulab/sys/rpc/rpc.py +412 -0
- qulab/sys/rpc/serialize.py +139 -0
- qulab/sys/rpc/server.py +29 -0
- qulab/sys/rpc/socket.py +29 -0
- qulab/sys/rpc/utils.py +25 -0
- qulab/sys/rpc/worker.py +0 -0
- qulab/version.py +1 -0
- qulab/visualization/__init__.py +188 -0
- qulab/visualization/__main__.py +71 -0
- qulab/visualization/_autoplot.py +457 -0
- qulab/visualization/plot_layout.py +408 -0
- qulab/visualization/plot_seq.py +90 -0
- qulab/visualization/qdat.py +152 -0
- qulab/visualization/widgets.py +86 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import matplotlib.pyplot as plt
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class DataPicker():
|
|
6
|
+
|
|
7
|
+
def __init__(self, ax=None):
|
|
8
|
+
self.points_and_text = {}
|
|
9
|
+
self.points = None
|
|
10
|
+
self.hline = None
|
|
11
|
+
self.vline = None
|
|
12
|
+
self.text = None
|
|
13
|
+
if ax is None:
|
|
14
|
+
ax = plt.gca()
|
|
15
|
+
self.ax = ax
|
|
16
|
+
self.ax.figure.canvas.mpl_connect('button_press_event', self.on_click)
|
|
17
|
+
# self.ax.figure.canvas.mpl_connect('motion_notify_event', self.on_move)
|
|
18
|
+
self.ax.figure.canvas.mpl_connect('key_press_event', self.on_key_press)
|
|
19
|
+
self.mode = 'pick'
|
|
20
|
+
|
|
21
|
+
def on_key_press(self, event):
|
|
22
|
+
if event.key == 'a':
|
|
23
|
+
if self.mode != 'pick':
|
|
24
|
+
self.mode = 'pick'
|
|
25
|
+
else:
|
|
26
|
+
self.mode = 'default'
|
|
27
|
+
|
|
28
|
+
def on_move(self, event):
|
|
29
|
+
if event.inaxes is self.ax:
|
|
30
|
+
# self.hline = self.ax.axhline(y=np.nan, color='r', lw=1)
|
|
31
|
+
# self.vline = self.ax.axvline(x=np.nan, color='r', lw=1)
|
|
32
|
+
# self.text = self.ax.text(0, 0, '', verticalalignment='center')
|
|
33
|
+
self.hline.set_ydata(event.ydata)
|
|
34
|
+
self.vline.set_xdata(event.xdata)
|
|
35
|
+
self.text.set_position((event.xdata, event.ydata))
|
|
36
|
+
self.text.set_text(f'({event.xdata:.2f}, {event.ydata:.2f})')
|
|
37
|
+
self.ax.draw()
|
|
38
|
+
|
|
39
|
+
def on_click(self, event):
|
|
40
|
+
if self.mode != 'pick':
|
|
41
|
+
return
|
|
42
|
+
# 鼠标左键的button值为1
|
|
43
|
+
if event.button == 1 and event.inaxes is self.ax:
|
|
44
|
+
point = (event.xdata, event.ydata)
|
|
45
|
+
text = self.ax.text(point[0],
|
|
46
|
+
point[1],
|
|
47
|
+
f'({point[0]:.2f}, {point[1]:.2f})',
|
|
48
|
+
verticalalignment='center')
|
|
49
|
+
self.points_and_text[point] = text
|
|
50
|
+
x, y = self.get_xy()
|
|
51
|
+
if self.points is None:
|
|
52
|
+
self.points, = self.ax.plot(x, y, 'ro')
|
|
53
|
+
else:
|
|
54
|
+
self.points.set_data(x, y)
|
|
55
|
+
self.ax.draw()
|
|
56
|
+
|
|
57
|
+
elif event.button == 3 and event.inaxes is self.ax:
|
|
58
|
+
for point, text in list(self.points_and_text.items()):
|
|
59
|
+
point_xdisplay, point_ydisplay = self.ax.transData.transform_point(
|
|
60
|
+
point)
|
|
61
|
+
|
|
62
|
+
distance = np.sqrt((point_xdisplay - event.x)**2 +
|
|
63
|
+
(point_ydisplay - event.y)**2)
|
|
64
|
+
if distance < 10:
|
|
65
|
+
text.remove()
|
|
66
|
+
self.points_and_text.pop(point)
|
|
67
|
+
if self.points_and_text:
|
|
68
|
+
x, y = self.get_xy()
|
|
69
|
+
self.points.set_data(x, y)
|
|
70
|
+
else:
|
|
71
|
+
self.points.remove()
|
|
72
|
+
self.points = None
|
|
73
|
+
self.ax.draw()
|
|
74
|
+
break
|
|
75
|
+
|
|
76
|
+
def get_xy(self):
|
|
77
|
+
if self.points_and_text:
|
|
78
|
+
data = np.asarray(list(self.points_and_text.keys()))
|
|
79
|
+
x, y = data[:, 0], data[:, 1]
|
|
80
|
+
|
|
81
|
+
index = np.argsort(x)
|
|
82
|
+
x = np.asarray(x)[index]
|
|
83
|
+
y = np.asarray(y)[index]
|
|
84
|
+
return x, y
|
|
85
|
+
else:
|
|
86
|
+
return np.array([]), np.array([])
|