QuLab 2.10.6__cp311-cp311-win_amd64.whl → 2.10.9__cp311-cp311-win_amd64.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/__init__.py CHANGED
@@ -1,3 +1,27 @@
1
+ from qlisp import (CR, CX, CZ, SWAP, A, B, BellPhiM, BellPhiP, BellPsiM,
2
+ BellPsiP, H, S, Sdag, SQiSWAP, T, Tdag, U, Unitary2Angles,
3
+ applySeq, draw, fSim, iSWAP, kak_decomposition, kak_vector,
4
+ make_immutable, measure, phiminus, phiplus, psiminus,
5
+ psiplus, regesterGateMatrix, rfUnitary, seq2mat, sigmaI,
6
+ sigmaM, sigmaP, sigmaX, sigmaY, sigmaZ,
7
+ synchronize_global_phase)
8
+ from qlispc import (COMMAND, FREE, NOTSET, PUSH, READ, SYNC, TRIG, WRITE,
9
+ compile, get_arch, libraries, mapping_qubits,
10
+ register_arch)
11
+ from qlispc.kernel_utils import qcompile
12
+ from wath import (Interval, Primes, Transmon, Z2probs, complex_amp_to_real,
13
+ effective_temperature, exception, find_axis_of_symmetry,
14
+ find_center_of_symmetry, find_cross_point, fit_circle,
15
+ fit_cosine, fit_k, fit_max, fit_peaks, fit_pole, getFTMatrix,
16
+ graph, inv_poly, lin_fit, point_in_ellipse, point_in_polygon,
17
+ point_on_ellipse, point_on_segment, poly_fit, probs2Z,
18
+ relative_delay_to_absolute, thermal_excitation, viterbi_hmm)
19
+ from waveforms import (D, chirp, const, cos, cosh, coshPulse, cosPulse, cut,
20
+ drag, drag_sin, drag_sinx, exp, function, gaussian,
21
+ general_cosine, hanning, interp, mixing, one, poly,
22
+ registerBaseFunc, registerDerivative, samplingPoints,
23
+ sign, sin, sinc, sinh, square, step, t, wave_eval, zero)
24
+
1
25
  from .executor.analyze import manual_analysis
2
26
  from .executor.registry import Registry
3
27
  from .executor.storage import find_report
qulab/expression.py CHANGED
@@ -4,10 +4,11 @@ import operator
4
4
 
5
5
  import numpy as np
6
6
  from pyparsing import (CaselessKeyword, Combine, Forward, Group, Keyword,
7
- Literal, Optional, ParserElement, ParseResults,
8
- Suppress, Word, alphanums, alphas, delimitedList,
9
- infixNotation, nums, oneOf, opAssoc, pyparsing_common,
10
- restOfLine, srange, stringEnd, stringStart)
7
+ Literal, MatchFirst, Optional, ParserElement,
8
+ ParseResults, Regex, Suppress, Word, ZeroOrMore,
9
+ alphanums, alphas, delimitedList, infixNotation, nums,
10
+ oneOf, opAssoc, pyparsing_common, restOfLine, srange,
11
+ stringEnd, stringStart)
11
12
  from scipy import special
12
13
 
13
14
  # 启用 Packrat 优化以提高解析效率
@@ -37,7 +38,23 @@ def symbol_parse_action(t):
37
38
  return Symbol(t[0])
38
39
 
39
40
 
40
- SYMBOL = Word(alphas, alphanums + "_").setParseAction(symbol_parse_action)
41
+ SYMBOL = Word(alphas + "_",
42
+ alphanums + "_").setParseAction(symbol_parse_action)
43
+
44
+
45
+ # 定义查询语法:$a.b.c 或 $a.b 或 $a
46
+ def query_parse_action(t):
47
+ return Query(t[0])
48
+
49
+
50
+ attr_chain = ZeroOrMore(Combine(Literal('.') + SYMBOL))
51
+ dollar_named_chain = Combine(Literal('$') + SYMBOL + attr_chain)
52
+ dollar_dotN_chain = Combine(
53
+ Literal('$') + Regex(r'\.{1,}') + SYMBOL + attr_chain)
54
+ dollar_simple = Combine(Literal('$') + SYMBOL)
55
+
56
+ QUERY = MatchFirst([dollar_dotN_chain, dollar_named_chain,
57
+ dollar_simple]).setParseAction(lambda s, l, t: Query(t[0]))
41
58
 
42
59
  #------------------------------------------------------------------------------
43
60
  # 定义运算表达式的解析动作转换函数
@@ -97,7 +114,7 @@ expr = Forward()
97
114
  #------------------------------------------------------------------------------
98
115
  # 构造基元表达式:包括数值、标识符、括号内表达式
99
116
  atom = (
100
- FLOAT | INT | OCT | HEX | SYMBOL |
117
+ FLOAT | INT | OCT | HEX | SYMBOL | QUERY |
101
118
  (LPAREN + expr + RPAREN) # 注意:后面我们将使用递归定义 expr
102
119
  )
103
120
 
@@ -173,6 +190,7 @@ class Env():
173
190
  self.consts = {}
174
191
  self.variables = {}
175
192
  self.refs = {}
193
+ self.nested = {}
176
194
  self.functions = {
177
195
  'sin': np.sin,
178
196
  'cos': np.cos,
@@ -745,6 +763,15 @@ class Symbol(Expression):
745
763
  return self.name
746
764
 
747
765
 
766
+ class Query(Symbol):
767
+
768
+ def derivative(self, x):
769
+ return 0
770
+
771
+ def eval(self, env):
772
+ return super().eval(env)
773
+
774
+
748
775
  sin = Symbol('sin')
749
776
  cos = Symbol('cos')
750
777
  tan = Symbol('tan')
@@ -773,7 +800,7 @@ erf = Symbol('erf')
773
800
  erfc = Symbol('erfc')
774
801
 
775
802
 
776
- def calc(exp: str | Expression, **kwargs) -> Expression:
803
+ def calc(exp: str | Expression, env: Env = None, **kwargs) -> Expression:
777
804
  """
778
805
  Calculate the expression.
779
806
 
@@ -791,7 +818,8 @@ def calc(exp: str | Expression, **kwargs) -> Expression:
791
818
  Expression
792
819
  The calculated expression.
793
820
  """
794
- env = Env()
821
+ if env is None:
822
+ env = Env()
795
823
  for k, v in kwargs.items():
796
824
  env[k] = v
797
825
  if isinstance(exp, str):
Binary file
qulab/monitor/monitor.py CHANGED
@@ -91,3 +91,25 @@ def get_monitor(auto_open=True):
91
91
  _monitor = Monitor()
92
92
 
93
93
  return _monitor
94
+
95
+
96
+ if __name__ == "__main__":
97
+ import time
98
+
99
+ import numpy as np
100
+
101
+ for i in range(3):
102
+ index = 0
103
+ while True:
104
+ if index >= 100:
105
+ break
106
+
107
+ m = get_monitor()
108
+
109
+ if index == 0:
110
+ m.set_column_names("index", "H", "S")
111
+ m.set_plots("(index,H);(index,S)")
112
+ m.roll()
113
+ m.add_point(index, np.random.randn(), np.sin(index / 20))
114
+ index += 1
115
+ time.sleep(0.2)
qulab/scan/query.py CHANGED
@@ -372,3 +372,16 @@ def lookup_list(*, full=False):
372
372
  return __query_state.table['body']
373
373
  else:
374
374
  return [r[0] for r in __query_state.table['body']]
375
+
376
+
377
+ def ping(database=default_server, timeout=1, socket=None):
378
+ with ZMQContextManager(zmq.DEALER,
379
+ connect=database,
380
+ socket=socket,
381
+ timeout=timeout) as socket:
382
+
383
+ socket.send_pyobj({'method': 'ping'})
384
+ try:
385
+ return socket.recv_pyobj()
386
+ except zmq.Again:
387
+ raise TimeoutError(f"No response from server within {timeout} s")
qulab/scan/scan.py CHANGED
@@ -1164,4 +1164,3 @@ def assymbly(description):
1164
1164
  _make_axis(description)
1165
1165
 
1166
1166
  return description
1167
- return description
qulab/scan/server.py CHANGED
@@ -23,15 +23,16 @@ from .models import Session, create_engine, create_tables, sessionmaker, utcnow
23
23
  from .record import BufferList, Record, random_path
24
24
  from .utils import dump_dict, load_dict
25
25
 
26
- try:
27
- default_record_port = int(os.getenv('QULAB_RECORD_PORT', 6789))
28
- except:
29
- default_record_port = 6789
30
-
31
- if os.getenv('QULAB_RECORD_PATH'):
32
- datapath = Path(os.getenv('QULAB_RECORD_PATH'))
33
- else:
34
- datapath = Path.home() / 'qulab' / 'data'
26
+ default_record_port = get_config_value('port',
27
+ int,
28
+ command_name='server',
29
+ default=6789)
30
+
31
+ datapath = get_config_value('data',
32
+ Path,
33
+ command_name='server',
34
+ default=Path.home() / 'qulab' / 'data')
35
+
35
36
  datapath.mkdir(parents=True, exist_ok=True)
36
37
 
37
38
  namespace = uuid.uuid4()
@@ -376,6 +377,7 @@ async def serv(port,
376
377
  url='',
377
378
  buffer_size=1024 * 1024 * 1024,
378
379
  interval=60):
380
+ datapath.mkdir(parents=True, exist_ok=True)
379
381
  logger.debug('Creating socket...')
380
382
  async with ZMQContextManager(zmq.ROUTER, bind=f"tcp://*:{port}") as sock:
381
383
  logger.info(f'Server started at port {port}.')
qulab/scan/utils.py CHANGED
@@ -198,8 +198,13 @@ def yapf_reformat(cell_text):
198
198
  return '\n'.join(lines)
199
199
 
200
200
  cell_text = re.sub('^%', '#%#', cell_text, flags=re.M)
201
- reformated_text = unwrap(
202
- yapf.yapflib.yapf_api.FormatCode(wrap(isort.code(cell_text)))[0])
201
+ try:
202
+ reformated_text = yapf.yapflib.yapf_api.FormatCode(
203
+ isort.code(cell_text))[0]
204
+ except:
205
+ reformated_text = unwrap(
206
+ yapf.yapflib.yapf_api.FormatCode(wrap(
207
+ isort.code(cell_text)))[0])
203
208
  return re.sub('^#%#', '%', reformated_text, flags=re.M)
204
209
  except:
205
210
  return cell_text
@@ -99,7 +99,8 @@ class ZMQContextManager:
99
99
  secret_key: Optional[bytes] = None,
100
100
  public_key: Optional[bytes] = None,
101
101
  server_public_key: Optional[bytes] = None,
102
- socket: Optional[zmq.Socket] = None):
102
+ socket: Optional[zmq.Socket] = None,
103
+ timeout: Optional[float] = None):
103
104
  self.socket_type = socket_type
104
105
  if bind is None and connect is None:
105
106
  raise ValueError("Either 'bind' or 'connect' must be specified.")
@@ -110,6 +111,7 @@ class ZMQContextManager:
110
111
  self.secret_key = secret_key
111
112
  self.public_key = public_key
112
113
  self.server_public_key = server_public_key
114
+ self.timeout = timeout
113
115
 
114
116
  if secret_key_file:
115
117
  self.public_key, self.secret_key = zmq.auth.load_certificate(
@@ -150,7 +152,7 @@ class ZMQContextManager:
150
152
  if asyncio:
151
153
  self.context = zmq.asyncio.Context()
152
154
  else:
153
- self.context = zmq.Context.instance()
155
+ self.context = zmq.Context()
154
156
 
155
157
  self.socket = self.context.socket(self.socket_type)
156
158
  self.auth = None
@@ -175,6 +177,11 @@ class ZMQContextManager:
175
177
  if self.server_public_key:
176
178
  self.socket.curve_serverkey = self.server_public_key
177
179
  self.socket.connect(self.connect)
180
+ if self.timeout:
181
+ timeout_ms = int(self.timeout * 1000)
182
+ self.socket.setsockopt(zmq.RCVTIMEO, timeout_ms)
183
+ self.socket.setsockopt(zmq.SNDTIMEO, timeout_ms)
184
+ self.socket.setsockopt(zmq.LINGER, 0)
178
185
  return self.socket
179
186
 
180
187
  def reload_certificates(self):
qulab/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.10.6"
1
+ __version__ = "2.10.9"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: QuLab
3
- Version: 2.10.6
3
+ Version: 2.10.9
4
4
  Summary: contral instruments and manage data
5
5
  Author-email: feihoo87 <feihoo87@gmail.com>
6
6
  Maintainer-email: feihoo87 <feihoo87@gmail.com>
@@ -38,10 +38,13 @@ Requires-Dist: numpy>=1.13.3
38
38
  Requires-Dist: ply>=3.11
39
39
  Requires-Dist: pyperclip>=1.8.2
40
40
  Requires-Dist: pyzmq>=25.1.0
41
+ Requires-Dist: qlisp>=1.1.4
42
+ Requires-Dist: qlispc>=1.1.8
41
43
  Requires-Dist: scipy>=1.0.0
42
44
  Requires-Dist: scikit-optimize>=0.9.0
43
45
  Requires-Dist: SQLAlchemy>=2.0.19
44
46
  Requires-Dist: watchdog>=4.0.0
47
+ Requires-Dist: wath>=1.1.6
45
48
  Requires-Dist: waveforms>=1.9.4
46
49
  Provides-Extra: full
47
50
  Requires-Dist: uvloop>=0.19.0; extra == "full"
@@ -1,11 +1,11 @@
1
- qulab/__init__.py,sha256=-tTI2n3lAFU3sRFEu-Z_ihgiHbyyaQeuLDWfLFHlPvc,416
1
+ qulab/__init__.py,sha256=SH37FtgS2bJcM5G5-BzwZ0EGK08vnv51YS450XENrv0,2060
2
2
  qulab/__main__.py,sha256=FL4YsGZL1jEtmcPc5WbleArzhOHLMsWl7OH3O-1d1ss,72
3
3
  qulab/dicttree.py,sha256=hYjVWjNYFmtzMWcIjIH6NJNDzpIW-g4TZbn2EBarpzg,14759
4
- qulab/expression.py,sha256=pfp3usiHCMHIbSBRqSCSDXA2f0gDDIZ9PMrkxf8yWjY,25777
5
- qulab/fun.cp311-win_amd64.pyd,sha256=7v3obsPOENgF6ZqXV3iXt7CmC8Y_kLV2wX4DN4d-WIw,31744
4
+ qulab/expression.py,sha256=XuB3Au582g5OhxprvKmZkF4ctvqBUsEVOpGAFzcS_uA,26578
5
+ qulab/fun.cp311-win_amd64.pyd,sha256=CNGzGUnwKNL8GwGTbMwXEk8QHRMJJRJAsIX0RdJe3lM,31744
6
6
  qulab/typing.py,sha256=PRtwbCHWY2ROKK8GHq4Bo8llXrIGo6xC73DrQf7S9os,71
7
7
  qulab/utils.py,sha256=65N2Xj7kqRsQ4epoLNY6tL-i5ts6Wk8YuJYee3Te6zI,3077
8
- qulab/version.py,sha256=9LJkGNy79PoPvb-ypqzJeCk2XlpeUgkGouuN08RGMH4,22
8
+ qulab/version.py,sha256=PGIDpdetzgVvxJ_Xq3E443ODmUUNp350X1Y164xoNio,22
9
9
  qulab/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  qulab/cli/commands.py,sha256=ZTs32yQjvwPIsFjXYWNr4KqEvly0NISIqyh--96qCAY,627
11
11
  qulab/cli/config.py,sha256=A3UnyaRtiofpokyzYkJnUdwzcsYX7H-xZvBVduIOSdg,5617
@@ -25,7 +25,7 @@ qulab/monitor/config.py,sha256=y_5StMkdrbZO1ziyKBrvIkB7Jclp9RCPK1QbsOhCxnY,785
25
25
  qulab/monitor/dataset.py,sha256=199kx7A08XKDnUN8MUZ7Cl4bWf52M0Mx7jrZLRyTwhw,2532
26
26
  qulab/monitor/event_queue.py,sha256=0fj-iP4g6rKaxyom-bL-NoecwPe48V1LlVLoRuGgX_Q,1877
27
27
  qulab/monitor/mainwindow.py,sha256=qqw7O9PTTrPjKgZAi7fS14S-fylTK9pzO1tAXtaNNAA,8033
28
- qulab/monitor/monitor.py,sha256=2AP-hhg1T6-38mieDm5_ONTIXnXYlIrSyOiAOxDKy0I,2398
28
+ qulab/monitor/monitor.py,sha256=yPgUG1_hNbqdFJWyMSepf5-Xayq9hOFdEq_o9pDLUrM,2912
29
29
  qulab/monitor/ploter.py,sha256=dg7W28XTwEbBxHVtdPkFV135OQgoQwTi-NJCZQF-HYU,3724
30
30
  qulab/monitor/qt_compat.py,sha256=Eq7zlA4_XstB92NhtAqebtWU_Btw4lcwFO30YxZ-TPE,804
31
31
  qulab/monitor/toolbar.py,sha256=HxqG6ywKFyQJM2Q1s7SnhuzjbyeROczAZKwxztD1WJ8,8213
@@ -33,12 +33,12 @@ qulab/scan/__init__.py,sha256=ZUwe6GvaaEmelsvAwM6yTWF1DYG8klAFvya6nD_BGI4,89
33
33
  qulab/scan/curd.py,sha256=m1MiW7Q_UActxpXor8n6PTck6A6O0_GRWHjVTJ3jBM4,7109
34
34
  qulab/scan/models.py,sha256=LMMWNfty9T1CoO07pN1wloq6Gob7taeOxWTBJFjGXLI,18180
35
35
  qulab/scan/optimize.py,sha256=zOR4Wp96bLarTSiPJ-cTAfT-V_MU-YEgB-XqYsBhS30,2637
36
- qulab/scan/query.py,sha256=RM8bG4Tcx_PaNk8tv9HdlTZ1dGuuSr3sZVkYVq2BtfQ,12183
36
+ qulab/scan/query.py,sha256=cyv72pYfnWIAHZHtlXYtkyC1BtsuOHD0AHkLEPVuqYQ,12641
37
37
  qulab/scan/record.py,sha256=MVmxhIzwmOju7eWxJEWsqJZlVgrDeRXGMfNvXImj7Ms,21883
38
- qulab/scan/scan.py,sha256=IcPckASWJc1qtoBTRApp9l7wjIQKbBP8vXxjn-znyEg,40663
39
- qulab/scan/server.py,sha256=rNYdf53TysNjT8RvL5LGcO9YRbBrwOWCl1gwd7wBtaE,17443
38
+ qulab/scan/scan.py,sha256=c9lWdcSS4O4JUhOpDkzn6mUQhwOK0ikvRtmIE9ExXzQ,40639
39
+ qulab/scan/server.py,sha256=lWDBnwYuVrSrDvTnrP-mAlDCkCNFpVDXZra3lfkpQ7s,17638
40
40
  qulab/scan/space.py,sha256=t8caa_gKlnhaAIEksJyxINUTecOS7lMWAz1HDKlVcds,6909
41
- qulab/scan/utils.py,sha256=MpuNPJZJThFS2dze1ZfQ3_zvtfgG5wBL4Ic9-1xR_5E,6354
41
+ qulab/scan/utils.py,sha256=yH8pvYoX9AvNkwWUGEh2MF2lHGzTsEQDgn2v2Xmlqhg,6523
42
42
  qulab/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  qulab/storage/__main__.py,sha256=6-EjN0waX1yfcMPJXqpIr9UlrIEsSCFApm5G-ZeaPMQ,1742
44
44
  qulab/storage/base_dataset.py,sha256=28y3-OZrqJ52p5sbirEpUgjb7hqwLLpd38KU9DCkD24,12217
@@ -87,7 +87,7 @@ qulab/sys/rpc/server.py,sha256=W3bPwe8um1IeR_3HLx-ad6iCcbeuUQcSg11Ze4w6DJg,742
87
87
  qulab/sys/rpc/socket.py,sha256=W3bPwe8um1IeR_3HLx-ad6iCcbeuUQcSg11Ze4w6DJg,742
88
88
  qulab/sys/rpc/utils.py,sha256=BurIcqh8CS-Hsk1dYP6IiefK4qHivaEqD9_rBY083SA,619
89
89
  qulab/sys/rpc/worker.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
90
- qulab/sys/rpc/zmq_socket.py,sha256=aoIm-C-IdJjm9_PQXckvbqTxc9kCeJrT4PyYytoDIHo,8492
90
+ qulab/sys/rpc/zmq_socket.py,sha256=jFhcXJNONOl369uE1NkAvMkLl0oUP9q9Jwn_6SGY7k4,8814
91
91
  qulab/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
92
92
  qulab/tools/connection_helper.py,sha256=-qZJcLsfueyHMihcbMp3HU3VRwz8zB0wnlosSjKp6R0,985
93
93
  qulab/visualization/__init__.py,sha256=Bkt9AK5c45d6HFLlT-f8cIppywXziHtJqhDtVxOoKKo,6317
@@ -99,9 +99,9 @@ qulab/visualization/plot_seq.py,sha256=Uo1-dB1YE9IN_A9tuaOs9ZG3S5dKDQ_l98iD2Wbxp
99
99
  qulab/visualization/qdat.py,sha256=HubXFu4nfcA7iUzghJGle1C86G6221hicLR0b-GqhKQ,5887
100
100
  qulab/visualization/rot3d.py,sha256=jGHJcqj1lEWBUV-W4GUGONGacqjrYvuFoFCwPse5h1Y,757
101
101
  qulab/visualization/widgets.py,sha256=HcYwdhDtLreJiYaZuN3LfofjJmZcLwjMfP5aasebgDo,3266
102
- qulab-2.10.6.dist-info/licenses/LICENSE,sha256=b4NRQ-GFVpJMT7RuExW3NwhfbrYsX7AcdB7Gudok-fs,1086
103
- qulab-2.10.6.dist-info/METADATA,sha256=2uAIz5ZYxwC2THY2cVecR0o46JP_WXkAg2g46CgZHEM,3860
104
- qulab-2.10.6.dist-info/WHEEL,sha256=_ZWIY2n7n6SpiuIFl1-RvcMp4Ty36T57FKf-7NzqZHM,101
105
- qulab-2.10.6.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
106
- qulab-2.10.6.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
107
- qulab-2.10.6.dist-info/RECORD,,
102
+ qulab-2.10.9.dist-info/licenses/LICENSE,sha256=b4NRQ-GFVpJMT7RuExW3NwhfbrYsX7AcdB7Gudok-fs,1086
103
+ qulab-2.10.9.dist-info/METADATA,sha256=uzj8VXbXeR474K_o5yYYJdNfubDAKxN427cbqCLu5RM,3947
104
+ qulab-2.10.9.dist-info/WHEEL,sha256=fWq2Ny-ILPpur8yMAYhVFY_9RLasIpo77AGvi3AUunY,101
105
+ qulab-2.10.9.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
106
+ qulab-2.10.9.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
107
+ qulab-2.10.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.3.1)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp311-cp311-win_amd64
5
5