QuLab 2.0.6__tar.gz → 2.0.7__tar.gz
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.6 → qulab-2.0.7}/PKG-INFO +1 -1
- {qulab-2.0.6 → qulab-2.0.7}/QuLab.egg-info/PKG-INFO +1 -1
- {qulab-2.0.6 → qulab-2.0.7}/qulab/scan/scan.py +62 -11
- qulab-2.0.7/qulab/version.py +1 -0
- qulab-2.0.6/qulab/version.py +0 -1
- {qulab-2.0.6 → qulab-2.0.7}/LICENSE +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/MANIFEST.in +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/QuLab.egg-info/SOURCES.txt +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/QuLab.egg-info/dependency_links.txt +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/QuLab.egg-info/entry_points.txt +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/QuLab.egg-info/requires.txt +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/QuLab.egg-info/top_level.txt +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/README.md +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/pyproject.toml +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/__init__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/__main__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/monitor/__init__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/monitor/__main__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/monitor/config.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/monitor/dataset.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/monitor/event_queue.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/monitor/mainwindow.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/monitor/monitor.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/monitor/ploter.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/monitor/qt_compat.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/monitor/toolbar.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/scan/__init__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/scan/curd.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/scan/expression.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/scan/models.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/scan/optimize.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/scan/query_record.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/scan/recorder.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/scan/server.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/scan/utils.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/__init__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/__main__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/backend/__init__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/backend/redis.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/base_dataset.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/chunk.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/dataset.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/file.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/models/__init__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/models/base.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/models/config.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/models/file.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/models/ipy.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/models/models.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/models/record.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/models/report.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/models/tag.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/storage/storage.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/__init__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/chat.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/device/__init__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/device/basedevice.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/device/loader.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/device/utils.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/drivers/FakeInstrument.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/drivers/__init__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/ipy_events.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/net/__init__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/net/bencoder.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/net/cli.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/net/dhcp.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/net/dhcpd.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/net/kad.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/net/kcp.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/net/nginx.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/progress.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/rpc/__init__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/rpc/client.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/rpc/exceptions.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/rpc/msgpack.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/rpc/msgpack.pyi +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/rpc/rpc.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/rpc/serialize.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/rpc/server.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/rpc/socket.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/rpc/utils.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/rpc/worker.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/sys/rpc/zmq_socket.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/visualization/__init__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/visualization/__main__.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/visualization/_autoplot.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/visualization/plot_layout.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/visualization/plot_seq.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/visualization/qdat.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/qulab/visualization/widgets.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/setup.cfg +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/setup.py +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/src/qulab.h +0 -0
- {qulab-2.0.6 → qulab-2.0.7}/tests/test_scan.py +0 -0
|
@@ -185,6 +185,8 @@ class Scan():
|
|
|
185
185
|
'loops': {},
|
|
186
186
|
'consts': {},
|
|
187
187
|
'functions': {},
|
|
188
|
+
'getters': {},
|
|
189
|
+
'setters': {},
|
|
188
190
|
'optimizers': {},
|
|
189
191
|
'namespace': {} if dump_globals else None,
|
|
190
192
|
'actions': {},
|
|
@@ -342,7 +344,7 @@ class Scan():
|
|
|
342
344
|
self.description['filters'][level] = []
|
|
343
345
|
self.description['filters'][level].append(func)
|
|
344
346
|
|
|
345
|
-
def set(self, name: str, value):
|
|
347
|
+
def set(self, name: str, value, setter: Callable | None = None):
|
|
346
348
|
try:
|
|
347
349
|
dill.dumps(value)
|
|
348
350
|
except:
|
|
@@ -355,8 +357,14 @@ class Scan():
|
|
|
355
357
|
self.description['functions'][name] = value
|
|
356
358
|
else:
|
|
357
359
|
self.description['consts'][name] = value
|
|
358
|
-
|
|
359
|
-
|
|
360
|
+
if setter:
|
|
361
|
+
self.description['setters'][name] = setter
|
|
362
|
+
|
|
363
|
+
def search(self,
|
|
364
|
+
name: str,
|
|
365
|
+
range: Iterable | Expression | Callable | OptimizeSpace,
|
|
366
|
+
level: int | None = None,
|
|
367
|
+
setter: Callable | None = None):
|
|
360
368
|
if level is not None:
|
|
361
369
|
assert level >= 0, 'level must be greater than or equal to 0.'
|
|
362
370
|
if isinstance(range, OptimizeSpace):
|
|
@@ -370,12 +378,23 @@ class Scan():
|
|
|
370
378
|
self._add_loop_var(name, level, range)
|
|
371
379
|
if isinstance(range, Expression) or callable(range):
|
|
372
380
|
self.add_depends(name, range.symbols())
|
|
381
|
+
if setter:
|
|
382
|
+
self.description['setters'][name] = setter
|
|
383
|
+
|
|
384
|
+
def trace(self,
|
|
385
|
+
name: str,
|
|
386
|
+
depends: list[str],
|
|
387
|
+
getter: Callable | None = None):
|
|
388
|
+
self.add_depends(name, depends)
|
|
389
|
+
if getter:
|
|
390
|
+
self.description['getters'][name] = getter
|
|
373
391
|
|
|
374
392
|
def minimize(self,
|
|
375
393
|
name: str,
|
|
376
394
|
level: int,
|
|
377
395
|
method=NgOptimizer,
|
|
378
396
|
maxiter=100,
|
|
397
|
+
getter: Callable | None = None,
|
|
379
398
|
**kwds) -> Optimizer:
|
|
380
399
|
assert level >= 0, 'level must be greater than or equal to 0.'
|
|
381
400
|
opt = Optimizer(self,
|
|
@@ -386,6 +405,8 @@ class Scan():
|
|
|
386
405
|
minimize=True,
|
|
387
406
|
**kwds)
|
|
388
407
|
self.description['optimizers'][name] = opt
|
|
408
|
+
if getter:
|
|
409
|
+
self.description['getters'][name] = getter
|
|
389
410
|
return opt
|
|
390
411
|
|
|
391
412
|
def maximize(self,
|
|
@@ -393,6 +414,7 @@ class Scan():
|
|
|
393
414
|
level: int,
|
|
394
415
|
method=NgOptimizer,
|
|
395
416
|
maxiter=100,
|
|
417
|
+
getter: Callable | None = None,
|
|
396
418
|
**kwds) -> Optimizer:
|
|
397
419
|
assert level >= 0, 'level must be greater than or equal to 0.'
|
|
398
420
|
opt = Optimizer(self,
|
|
@@ -403,6 +425,8 @@ class Scan():
|
|
|
403
425
|
minimize=False,
|
|
404
426
|
**kwds)
|
|
405
427
|
self.description['optimizers'][name] = opt
|
|
428
|
+
if getter:
|
|
429
|
+
self.description['getters'][name] = getter
|
|
406
430
|
return opt
|
|
407
431
|
|
|
408
432
|
async def _update_progress(self):
|
|
@@ -418,7 +442,8 @@ class Scan():
|
|
|
418
442
|
task = asyncio.create_task(self._update_progress())
|
|
419
443
|
self._task_pool.append(task)
|
|
420
444
|
self._variables = {'self': self}
|
|
421
|
-
self._variables
|
|
445
|
+
await _update_variables(self._variables, self.description['consts'],
|
|
446
|
+
self.description['setters'])
|
|
422
447
|
for level, total in self.description['total'].items():
|
|
423
448
|
if total == np.inf:
|
|
424
449
|
total = None
|
|
@@ -428,6 +453,11 @@ class Scan():
|
|
|
428
453
|
if name in self.description['functions']:
|
|
429
454
|
self.variables[name] = await call_function(
|
|
430
455
|
self.description['functions'][name], self.variables)
|
|
456
|
+
if name in self.description['setters']:
|
|
457
|
+
coro = self.description['setters'][name](
|
|
458
|
+
self.variables[name])
|
|
459
|
+
if inspect.isawaitable(coro):
|
|
460
|
+
await coro
|
|
431
461
|
if isinstance(
|
|
432
462
|
self.description['database'],
|
|
433
463
|
str) and self.description['database'].startswith("tcp://"):
|
|
@@ -505,7 +535,8 @@ class Scan():
|
|
|
505
535
|
self.variables,
|
|
506
536
|
self.description['loops'].get(self.current_level, []),
|
|
507
537
|
self.description['order'].get(self.current_level, []),
|
|
508
|
-
self.description['functions'], self.description['optimizers']
|
|
538
|
+
self.description['functions'], self.description['optimizers'],
|
|
539
|
+
self.description['setters'], self.description['getters']):
|
|
509
540
|
self._current_level += 1
|
|
510
541
|
if await self._filter(variables, self.current_level - 1):
|
|
511
542
|
yield variables
|
|
@@ -744,12 +775,23 @@ def assymbly(description):
|
|
|
744
775
|
return description
|
|
745
776
|
|
|
746
777
|
|
|
778
|
+
async def _update_variables(variables, updates, setters):
|
|
779
|
+
for name, value in updates.items():
|
|
780
|
+
if name in setters:
|
|
781
|
+
coro = setters[name](value)
|
|
782
|
+
if inspect.isawaitable(coro):
|
|
783
|
+
await coro
|
|
784
|
+
variables[name] = value
|
|
785
|
+
|
|
786
|
+
|
|
747
787
|
async def _iter_level(variables,
|
|
748
788
|
iters: list[tuple[str, Iterable | Expression | Callable
|
|
749
789
|
| OptimizeSpace]],
|
|
750
790
|
order: list[list[str]],
|
|
751
791
|
functions: dict[str, Callable | Expression],
|
|
752
|
-
optimizers: dict[str, Optimizer]
|
|
792
|
+
optimizers: dict[str, Optimizer],
|
|
793
|
+
setters: dict[str, Callable] = {},
|
|
794
|
+
getters: dict[str, Callable] = {}):
|
|
753
795
|
iters_d = {}
|
|
754
796
|
env = Env()
|
|
755
797
|
env.variables = variables
|
|
@@ -772,23 +814,32 @@ async def _iter_level(variables,
|
|
|
772
814
|
maxiter = min(maxiter, opt_cfg.maxiter)
|
|
773
815
|
|
|
774
816
|
async for args in async_zip(*iters_d.values(), range(maxiter)):
|
|
775
|
-
variables
|
|
817
|
+
await _update_variables(variables, dict(zip(iters_d.keys(),
|
|
818
|
+
args[:-1])), setters)
|
|
776
819
|
for name, opt in opts.items():
|
|
777
820
|
args = opt.ask()
|
|
778
821
|
opt_cfg = optimizers[name]
|
|
779
|
-
variables
|
|
822
|
+
await _update_variables(variables, {
|
|
780
823
|
n: v
|
|
781
824
|
for n, v in zip(opt_cfg.dimensions.keys(), args)
|
|
782
|
-
})
|
|
825
|
+
}, setters)
|
|
783
826
|
|
|
784
827
|
for group in order:
|
|
785
828
|
for name in group:
|
|
786
829
|
if name in functions:
|
|
787
|
-
|
|
788
|
-
|
|
830
|
+
await _update_variables(variables, {
|
|
831
|
+
name:
|
|
832
|
+
await call_function(functions[name], variables)
|
|
833
|
+
}, setters)
|
|
789
834
|
|
|
790
835
|
yield variables
|
|
791
836
|
|
|
837
|
+
for group in order:
|
|
838
|
+
for name in group:
|
|
839
|
+
if name in getters:
|
|
840
|
+
variables[name] = await call_function(
|
|
841
|
+
getters[name], variables)
|
|
842
|
+
|
|
792
843
|
for name, opt in opts.items():
|
|
793
844
|
opt_cfg = optimizers[name]
|
|
794
845
|
args = [variables[n] for n in opt_cfg.dimensions.keys()]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.0.7"
|
qulab-2.0.6/qulab/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.0.6"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|