nsqdriver 0.12.17__cp313-cp313-manylinux2014_x86_64.manylinux_2_17_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.
Files changed (41) hide show
  1. nsqdriver/NS_CST.py +260 -0
  2. nsqdriver/NS_DDS_v3.py +591 -0
  3. nsqdriver/NS_DDS_v4.py +778 -0
  4. nsqdriver/NS_MCI.py +597 -0
  5. nsqdriver/NS_QSYNC.py +812 -0
  6. nsqdriver/__init__.py +10 -0
  7. nsqdriver/common.py +20 -0
  8. nsqdriver/compiler/__init__.py +0 -0
  9. nsqdriver/compiler/assembler.cpython-313-x86_64-linux-gnu.so +0 -0
  10. nsqdriver/compiler/ns_wave.cpython-313-x86_64-linux-gnu.so +0 -0
  11. nsqdriver/compiler/ns_wave.pyi +151 -0
  12. nsqdriver/compiler/py_wave_asm.cpython-313-x86_64-linux-gnu.so +0 -0
  13. nsqdriver/compiler/py_wave_asm.pyi +29 -0
  14. nsqdriver/nswave/__init__.py +9 -0
  15. nsqdriver/nswave/_asm.pyi +97 -0
  16. nsqdriver/nswave/_checkers.cpython-313-x86_64-linux-gnu.so +0 -0
  17. nsqdriver/nswave/_checkers.pyi +47 -0
  18. nsqdriver/nswave/_errors.cpython-313-x86_64-linux-gnu.so +0 -0
  19. nsqdriver/nswave/_errors.pyi +24 -0
  20. nsqdriver/nswave/_functions.cpython-313-x86_64-linux-gnu.so +0 -0
  21. nsqdriver/nswave/_functions.pyi +34 -0
  22. nsqdriver/nswave/_ir.cpython-313-x86_64-linux-gnu.so +0 -0
  23. nsqdriver/nswave/_ir.pyi +283 -0
  24. nsqdriver/nswave/_ir_pass.cpython-313-x86_64-linux-gnu.so +0 -0
  25. nsqdriver/nswave/_ir_pass.pyi +7 -0
  26. nsqdriver/nswave/_optimizations.cpython-313-x86_64-linux-gnu.so +0 -0
  27. nsqdriver/nswave/_optimizations.pyi +16 -0
  28. nsqdriver/nswave/_rules.cpython-313-x86_64-linux-gnu.so +0 -0
  29. nsqdriver/nswave/_rules.pyi +56 -0
  30. nsqdriver/nswave/_simulator.cpython-313-x86_64-linux-gnu.so +0 -0
  31. nsqdriver/nswave/_translate.cpython-313-x86_64-linux-gnu.so +0 -0
  32. nsqdriver/nswave/_translate.pyi +12 -0
  33. nsqdriver/nswave/kernel.cpython-313-x86_64-linux-gnu.so +0 -0
  34. nsqdriver/nswave/kernel.pyi +57 -0
  35. nsqdriver/wrapper/AWG_ADC.py +534 -0
  36. nsqdriver/wrapper/ND_NSMCI.py +245 -0
  37. nsqdriver/wrapper/__init__.py +0 -0
  38. nsqdriver-0.12.17.dist-info/METADATA +117 -0
  39. nsqdriver-0.12.17.dist-info/RECORD +41 -0
  40. nsqdriver-0.12.17.dist-info/WHEEL +6 -0
  41. nsqdriver-0.12.17.dist-info/top_level.txt +1 -0
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, 12, 17)
8
+
9
+ __version__ = '.'.join(str(_) for _ in version_pack)
10
+ __all__ = ['MCIDriver', 'QSYNCDriver', 'CSTDriver']
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: ...
@@ -0,0 +1,9 @@
1
+ from .kernel import *
2
+ from ._functions import *
3
+ from ._ir_pass import ir_pass as ir_pass
4
+ import nsqdriver.nswave._rules as rules
5
+ import nsqdriver.nswave._checkers as checkers
6
+ import nsqdriver.nswave._translate as translator
7
+
8
+
9
+ __all__ = ['Kernel', 'ir_pass', 'rules', 'checkers', 'translator', 'form_kernel']
@@ -0,0 +1,97 @@
1
+ import numpy as np
2
+ from _typeshed import Incomplete
3
+
4
+ __all__ = ['AssemblyError', 'GenTagMixin', 'NSQCommand', 'QInsFrame', 'nsw_config', 'QInsEnvelope', 'QInsWait', 'QInsNop', 'QInsJumpImmediate', 'QInsPlayImm', 'QInsWaitTrig', 'QInsFrameRst', 'QInsWaitTrig', 'QInsFrameAdd', 'QInsCapture']
5
+
6
+ def nsw_config(name, value) -> None: ...
7
+
8
+ class QNumber:
9
+ value: int
10
+ def __init__(self) -> None: ...
11
+ def __int__(self) -> int: ...
12
+ def __float__(self) -> float: ...
13
+ def __bool__(self) -> bool: ...
14
+
15
+ class AssemblyError(RuntimeError): ...
16
+
17
+ class GenTagMixin:
18
+ @property
19
+ def generate_tag(self): ...
20
+
21
+ class NSQCommand(GenTagMixin):
22
+ tag: Incomplete
23
+ def __init__(self) -> None: ...
24
+ @property
25
+ def overhead(self): ...
26
+ @classmethod
27
+ def compile(cls, inst_list: list[Self]) -> tuple[np.ndarray, str]: ...
28
+
29
+ class QInsFrame(NSQCommand):
30
+ freq: Incomplete
31
+ phase: Incomplete
32
+ idx: Incomplete
33
+ line: Incomplete
34
+ def __init__(self, freq, phase, idx, line) -> None: ...
35
+ @property
36
+ def overhead(self): ...
37
+
38
+ class QInsEnvelope(NSQCommand):
39
+ envelope: Incomplete
40
+ envelop_slice: Incomplete
41
+ def __init__(self, envelope: np.ndarray) -> None: ...
42
+ def __len__(self) -> int: ...
43
+ def __bytes__(self) -> bytes: ...
44
+
45
+ class QInsFrameRst(NSQCommand):
46
+ @property
47
+ def overhead(self): ...
48
+
49
+ class QInsFrameAdd(NSQCommand):
50
+ frames: Incomplete
51
+ frequency: Incomplete
52
+ phase: Incomplete
53
+ def __init__(self, frames: list[QInsFrame], frequency: float, phase: float) -> None: ...
54
+ @property
55
+ def overhead(self): ...
56
+
57
+ class QInsWait(NSQCommand):
58
+ width: Incomplete
59
+ def __init__(self, width) -> None: ...
60
+ @property
61
+ def overhead(self): ...
62
+
63
+ class QInsWaitTrig(NSQCommand):
64
+ def __init__(self) -> None: ...
65
+ @property
66
+ def overhead(self): ...
67
+
68
+ class QInsNop(NSQCommand):
69
+ @property
70
+ def overhead(self): ...
71
+
72
+ class QInsJumpImmediate(NSQCommand):
73
+ idx: Incomplete
74
+ def __init__(self, idx: int) -> None: ...
75
+ @property
76
+ def overhead(self): ...
77
+
78
+ class QInsCapture(NSQCommand):
79
+ fre: Incomplete
80
+ acq_width: Incomplete
81
+ delay_width: Incomplete
82
+ play_width: Incomplete
83
+ para: Incomplete
84
+ def __init__(self, fre: list[int], acq_width: float, delay_width: float, play_width: float, raw_data_store: bool, iq_data_store: bool, judge_data_store: bool, double_fre_mode: bool) -> None: ...
85
+ @property
86
+ def overhead(self): ...
87
+
88
+ class QInsPlayImm(NSQCommand):
89
+ frame: Incomplete
90
+ freq: Incomplete
91
+ amp: Incomplete
92
+ bias: Incomplete
93
+ envelope: Incomplete
94
+ phase: Incomplete
95
+ def __init__(self, frame: QInsFrame, envelope: QInsEnvelope, amp, bias, freq, phase) -> None: ...
96
+ @property
97
+ def overhead(self): ...
@@ -0,0 +1,47 @@
1
+ from ._ir import *
2
+ from _typeshed import Incomplete
3
+
4
+ __all__ = ['BaseChecker', 'OverlapChecker', 'EnvelopeChecker', 'TwoCapiChecker', 'SequenceChecker', 'PlyChecker', 'DrstChecker', 'CapiChecker', 'FmsiChecker', 'IRNumberChecker']
5
+
6
+ class BaseChecker:
7
+ warnings_instruction: Incomplete
8
+ error_instruction: Incomplete
9
+ IR_list: Incomplete
10
+ def __init__(self) -> None: ...
11
+ def check_ir(self, IR_list) -> list: ...
12
+
13
+ class OverlapChecker(BaseChecker):
14
+ def __init__(self) -> None: ...
15
+ def check_ir(self, ir_list: list): ...
16
+
17
+ class SequenceChecker(BaseChecker):
18
+ def __init__(self) -> None: ...
19
+ def check_ir(self, ir_list) -> list: ...
20
+
21
+ class EnvelopeChecker(BaseChecker):
22
+ def __init__(self) -> None: ...
23
+ def check_ir(self, ir_list): ...
24
+
25
+ class PlyChecker(BaseChecker):
26
+ def __init__(self) -> None: ...
27
+ def check_ir(self, ir_list): ...
28
+
29
+ class DrstChecker(BaseChecker):
30
+ def __init__(self) -> None: ...
31
+ def check_ir(self, ir_list): ...
32
+
33
+ class CapiChecker(BaseChecker):
34
+ def __init__(self) -> None: ...
35
+ def check_ir(self, ir_list): ...
36
+
37
+ class FmsiChecker(BaseChecker):
38
+ def __init__(self) -> None: ...
39
+ def check_ir(self, ir_list): ...
40
+
41
+ class IRNumberChecker(BaseChecker):
42
+ def __init__(self) -> None: ...
43
+ def check_ir(self, ir_list): ...
44
+
45
+ class TwoCapiChecker(BaseChecker):
46
+ def __init__(self) -> None: ...
47
+ def check_ir(self, ir_list): ...
@@ -0,0 +1,24 @@
1
+ from _typeshed import Incomplete
2
+
3
+ class WaitError(Exception): ...
4
+ class TimingError(Exception): ...
5
+ class PlayError(Exception): ...
6
+ class CaptureError(Exception): ...
7
+
8
+ class MultipleErrorsException(Exception):
9
+ errors: Incomplete
10
+ def __init__(self, errors) -> None: ...
11
+
12
+ class BaseError:
13
+ IR_list: Incomplete
14
+ def __init__(self) -> None: ...
15
+ def query_ir(self, error_list): ...
16
+
17
+ class Errors(BaseError):
18
+ errors: Incomplete
19
+ def __init__(self) -> None: ...
20
+ def quire_ir(self, error_list) -> None: ...
21
+ def check_errors(self) -> None: ...
22
+
23
+ class Warnings(BaseError):
24
+ def inquire_ir(self, warning_list): ...
@@ -0,0 +1,34 @@
1
+ import numpy as np
2
+ from ._ir import IRArbWaveform, IRBase, IREnvelope, IRFrame
3
+ from _typeshed import Incomplete
4
+ from typing import Iterable, TypeVar
5
+
6
+ __all__ = ['Frame', 'Envelope', 'Int', 'Var', 'set_judge', 'Reg', 'ArbWave', 'receive', 'send', 'init_arbwave', 'play_arb', 'wait_for_trigger', 'ins_envelope', 'init_frame', 'evlp_gaussian', 'evlp_square', 'evlp_cospulse', 'inc_phase', 'inc_frequency', 'reset_frame', 'play_wave', 'wait', 'capture']
7
+
8
+ Frame = TypeVar('Frame', bound=IRFrame)
9
+ Reg = TypeVar('Reg')
10
+ Envelope = TypeVar('Envelope', bound=IREnvelope)
11
+ ArbWave = TypeVar('ArbWave', bound=IRArbWaveform)
12
+ Placeholder = TypeVar('Placeholder', bound=IRBase)
13
+ Var = TypeVar('Var')
14
+ Int = TypeVar('Int')
15
+ Uint = TypeVar('Uint')
16
+ Float = TypeVar('Float')
17
+
18
+ def init_frame(freq: float, phase: float, *, idx: int = None) -> IRFrame: ...
19
+ def ins_envelope(envelope: np.ndarray | complex) -> IREnvelope: ...
20
+ def init_arbwave(wlist: dict[str, np.ndarray], arb_name: str) -> IRArbWaveform: ...
21
+ def evlp_gaussian(width: float, srate: float = 8000000000.0, amp: int = 1) -> IREnvelope: ...
22
+ def evlp_cospulse(width: float, srate: float = 8000000000.0, amp: int = 1) -> IREnvelope: ...
23
+ def evlp_square(width: float, srate: float = 8000000000.0, amp: int = 1) -> IREnvelope: ...
24
+ def reset_frame() -> Placeholder: ...
25
+ def wait_for_trigger() -> Placeholder: ...
26
+ def inc_phase(phase: float) -> Placeholder: ...
27
+ def inc_frequency(frame_list: Iterable[Frame], freq: float) -> Placeholder: ...
28
+ def play_wave(envelope: IREnvelope, amp: int = 1, freq: int = 0, phase: int = 0) -> Placeholder: ...
29
+ def play_arb(wave: IRArbWaveform): ...
30
+ def wait(width) -> Placeholder: ...
31
+ def capture(acq_width: float, delay_width: float, play_width: float, freq_list: Incomplete | None = None) -> Int: ...
32
+ def set_judge(rotation: complex, threshold: int, freq_list: list = None) -> tuple[IRBase, IRBase]: ...
33
+ def send(judge_reg) -> IRBase: ...
34
+ def receive(feedback_rd_chnl: int = 0) -> IRBase: ...