forked from M-Labs/artiq
pdq2: pep8
This commit is contained in:
parent
ea0773ccb5
commit
88ad4fbf23
|
@ -123,8 +123,8 @@ class Pdq2:
|
|||
return self.write(self.cmd(cmd))
|
||||
|
||||
def escape(self, data):
|
||||
return data.replace(self.escape_char, self.escape_char +
|
||||
self.escape_char)
|
||||
return data.replace(self.escape_char,
|
||||
self.escape_char + self.escape_char)
|
||||
|
||||
def write(self, *segments):
|
||||
"""
|
||||
|
@ -244,12 +244,14 @@ class Pdq2:
|
|||
if stop:
|
||||
if p is not None:
|
||||
frame += struct.pack("<HH hiihih H ii", (15 << 0) | (1 << 4) |
|
||||
(silence<<7) | (end<<13) | (wait<<15),
|
||||
(silence << 7) |
|
||||
(end << 13) |
|
||||
(wait << 15),
|
||||
1, int(v[-1]*2**15), 0, 0, 0, 0, 0,
|
||||
int(p[-1]*2**16), int(f[-1]*2**31), 0)
|
||||
else:
|
||||
frame += struct.pack("<HH h", (2<<0) |
|
||||
(silence<<7) | (end<<13) | (wait << 15),
|
||||
frame += struct.pack("<HH h", (2 << 0) | (silence << 7) |
|
||||
(end << 13) | (wait << 15),
|
||||
1, int(v[-1]*2**15))
|
||||
return frame
|
||||
|
||||
|
|
|
@ -35,12 +35,14 @@ def _main():
|
|||
default="(1-np.cos(t/t[-1]*2*np.pi))/2",
|
||||
help="sample voltages (V) [%(default)s]")
|
||||
parser.add_argument("-o", "--order", default=3, type=int,
|
||||
help="interpolation (0: const, 1: lin, 2: quad, 3: cubic)"
|
||||
help="interpolation"
|
||||
" (0: const, 1: lin, 2: quad, 3: cubic)"
|
||||
" [%(default)s]")
|
||||
parser.add_argument("-m", "--dcm", default=None, type=int,
|
||||
help="choose fast 100MHz clock [%(default)s]")
|
||||
parser.add_argument("-x", "--demo", default=False, action="store_true",
|
||||
help="demo mode: pulse and chirp, 1V*ch+0.1V*frame [%(default)s]")
|
||||
help="demo mode: pulse and chirp,"
|
||||
" 1V*ch+0.1V*frame [%(default)s]")
|
||||
parser.add_argument("-p", "--plot", help="plot to file [%(default)s]")
|
||||
parser.add_argument("-d", "--debug", default=False,
|
||||
action="store_true", help="debug communications")
|
||||
|
@ -104,7 +106,8 @@ def _main():
|
|||
# print(t, v)
|
||||
for channel in range(dev.num_channels):
|
||||
dev.write_data(dev.multi_frame([(t, v)], channel=channel,
|
||||
order=0, map=map, shift=15, stop=False, trigger=False))
|
||||
order=0, map=map, shift=15,
|
||||
stop=False, trigger=False))
|
||||
else:
|
||||
tv = [(times, voltages)]
|
||||
map = [None] * dev.num_frames
|
||||
|
|
Loading…
Reference in New Issue