nsqdriver 0.5.7__cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.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.

Potentially problematic release.


This version of nsqdriver might be problematic. Click here for more details.

nsqdriver/__init__.py ADDED
@@ -0,0 +1,10 @@
1
+ from .NS_MCI import Driver as MCIDriver
2
+ from .NS_QSYNC import Driver as QSYNCDriver
3
+ from .NS_CST import Driver as CSTDriver
4
+ from .compiler.ns_wave import InsChannel
5
+ from .compiler.py_wave_asm import nsw_config, AssemblyError
6
+
7
+ version_pack = (0, 5, 7)
8
+
9
+ __version__ = '.'.join(str(_) for _ in version_pack)
10
+ __all__ = ['MCIDriver', 'QSYNCDriver', 'CSTDriver', 'InsChannel']
nsqdriver/common.py ADDED
@@ -0,0 +1,20 @@
1
+ class Quantity(object):
2
+ def __init__(self, name: str, value=None, ch: int = 1, unit: str = ''):
3
+ self.name = name
4
+ self.default = dict(value=value, ch=ch, unit=unit)
5
+
6
+
7
+ class QInteger:
8
+ def __init__(self, name, value=None, unit='', ch=None,
9
+ get_cmd='', set_cmd='',):
10
+ self.name = name
11
+
12
+
13
+ class BaseDriver:
14
+ def __init__(self, addr, timeout, **kw):
15
+ self.addr = addr
16
+ self.timeout = timeout
17
+
18
+
19
+ def get_coef(*args):
20
+ return '', '', '', ''
File without changes
@@ -0,0 +1,151 @@
1
+ import numpy as np
2
+ import waveforms as wf
3
+
4
+ from enum import IntEnum
5
+ from typing import Union, List, Dict
6
+ from nsqdriver.compiler.py_wave_asm import *
7
+
8
+
9
+ class QInsPlaceholder(NSQCommand):
10
+ ...
11
+
12
+
13
+ class Wave(GenTagMixin):
14
+ class Tag(IntEnum): ...
15
+
16
+ def __init__(self, ins_obj: "InstructionQ", ins_id: dict): ...
17
+
18
+ class Frame(Wave):
19
+ def __init__(self, ins_obj: "InstructionQ", ins_id: int, freq: float): ...
20
+
21
+ @property
22
+ def freq(self) -> float: ...
23
+
24
+ @freq.setter
25
+ def freq(self, value: float): ...
26
+
27
+ def __mul__(self, other: Wave) -> Signal: ...
28
+
29
+ def format(self) -> "NSQCommand": ...
30
+
31
+
32
+ class Envelope(Wave):
33
+ def __init__(self, ins_obj: "InstructionQ", ins_id: int, content: "Union[wf.Waveform, np.ndarray]"): ...
34
+
35
+ @property
36
+ def content(self) -> "Union[wf.Waveform, np.ndarray]": ...
37
+
38
+ @content.setter
39
+ def content(self, value: "Union[wf.Waveform, np.ndarray]"): ...
40
+
41
+ def __mul__(self, other: Wave) -> Signal: ...
42
+
43
+ def format(self) -> "NSQCommand": ...
44
+
45
+
46
+ class Signal(Wave):
47
+ def __init__(self, ins_obj: "InstructionQ", ins_id: dict): ...
48
+
49
+
50
+ class InstructionQ(GenTagMixin):
51
+ """!
52
+ 包含各种具体的指令
53
+ """
54
+
55
+ def __init__(self, freqs=None, envelopes=None):
56
+ self.i_set: "List[Union[NSQCommand, InstructionQ]]" = []
57
+ self.f_set: "Dict[int, Frame]" = {}
58
+ self.e_set: "Dict[int, Envelope]" = {}
59
+ self.symbol_set: Dict[str, int] = {}
60
+ self.symbol_idx: int = -1
61
+ self.is_first_trig: bool = True
62
+ self.last_ins: NSQCommand
63
+
64
+ def clear(self) -> None: ...
65
+
66
+ @property
67
+ def length(self) -> int: ...
68
+
69
+ def ins_frame(self, freq, idx=None) -> Frame: ...
70
+
71
+ def ins_envelope(self, envelope: "Union[np.ndarray, wf.Waveform, str]", idx=None) -> Envelope: ...
72
+
73
+ def evlp_gaussian(self, width: float) -> Envelope: ...
74
+
75
+ def evlp_cospulse(self, width: float) -> Envelope: ...
76
+
77
+ def evlp_square(self, width: float) -> Envelope: ...
78
+
79
+ def _append_ins(self, cmd: "Union[NSQCommand, InstructionQ]"): ...
80
+
81
+ def _map_var(self, var: str) -> int: ...
82
+
83
+ def wait_for_trigger(self): ...
84
+
85
+ def ins_variable(self, reg: str, value: int): ...
86
+
87
+ def ins_add(self, reg: str, value: int): ...
88
+
89
+ def ins_reset_frame(self, flag: str, frame: "Frame"): ...
90
+
91
+ def inc_phase(self, frame: "Frame", phase: float): ...
92
+
93
+ def play_wave(self, wave: Signal, amp=1, freq=0, phase=0): ...
94
+
95
+ def play_zero(self, width: float): ...
96
+
97
+ def wait(self): ...
98
+
99
+ def end(self): ...
100
+
101
+ def capture(self, width: float, delay=0.): ...
102
+
103
+
104
+ class InsChannel(InstructionQ):
105
+ def __init__(self, freqs=None, envelopes=None):
106
+ self.if_stack: "List[InsIF]" = []
107
+ self.looping = False
108
+
109
+ def ins_if(self, formula: str) -> "InsIF": ...
110
+
111
+ def ins_else(self) -> "InsElse": ...
112
+
113
+ def ins_loop(self, times: int) -> "InsLoop": ...
114
+
115
+
116
+ class InsIF(InsChannel):
117
+ ch_judge_name = {f'FREQ_{i}': 1<<i for i in range(6)}
118
+
119
+ def __init__(self, freqs=None, envelopes=None):
120
+ self.channel: "InsChannel" = None
121
+ self.key_ins: "NSQCommand" = None
122
+ self.ins_else = None
123
+
124
+ @classmethod
125
+ def from_channel(cls, channel :InsChannel) -> InsIF: ...
126
+
127
+ @property
128
+ def formula(self): ...
129
+
130
+ @formula.setter
131
+ def formula(self, formula: str): ...
132
+
133
+
134
+ class InsElse(InsChannel):
135
+ def __init__(self, freqs=None, envelopes=None): ...
136
+
137
+ @classmethod
138
+ def from_channel(cls, channel: InsChannel) -> InsElse: ...
139
+
140
+ def capture(self, width: float, delay=0): ...
141
+
142
+
143
+ class InsLoop(InsChannel):
144
+ def __init__(self, freqs: float=None, envelopes: "Union[wf.Waveform, np.ndarray]"=None): ...
145
+
146
+ @classmethod
147
+ def from_channel(cls, channel: InsChannel) -> InsLoop: ...
148
+
149
+ def capture(self, width: float, delay=0): ...
150
+
151
+ def _compile(self) -> "List[NSQCommand]": ...
@@ -0,0 +1,29 @@
1
+ from typing import Any
2
+
3
+ import numpy as np
4
+
5
+
6
+ global_config = {
7
+ 'play_zero_step': 4e-9,
8
+ 'OUTSrate': 8e9,
9
+ 'envelope_dtype': np.int16, # 描述包络每个点的数据类型
10
+ 'envelope_step': 64, # 包络步进粒度,单位为bytes
11
+ 'envelope_quant': 16383, # 包络量化范围
12
+ 'envelope_cache': 204800, # 包络缓存大小,单位bytes
13
+ 'envelope_head': np.array([2, 0, 0, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=np.int16), # 包络更新包头
14
+ }
15
+
16
+
17
+ def nsw_config(name: str, value: Any) -> None: ...
18
+
19
+
20
+ class AssemblyError(RuntimeError): ...
21
+
22
+
23
+ class GenTagMixin: ...
24
+
25
+
26
+ class NSQCommand: ...
27
+
28
+
29
+ class Assembler: ...