From 88ad4fbf236c7d8e4b20099348755954c158c933 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 14 Oct 2014 17:02:25 +0800 Subject: [PATCH] pdq2: pep8 --- artiq/devices/pdq2com.py | 94 ++++++++++++++++++++-------------------- frontend/pdq2 | 51 ++++++++++++---------- 2 files changed, 75 insertions(+), 70 deletions(-) diff --git a/artiq/devices/pdq2com.py b/artiq/devices/pdq2com.py index 9d2ff2d3d..7b02ce5eb 100644 --- a/artiq/devices/pdq2com.py +++ b/artiq/devices/pdq2com.py @@ -24,7 +24,7 @@ try: written = self.dev.write(data) if written < 0: raise pylibftdi.FtdiError(written, - self.dev.get_error_string()) + self.dev.get_error_string()) return written def close(self): @@ -82,31 +82,31 @@ class Pdq2: """ PDQ DAC (a.k.a. QC_Waveform) """ - max_val = 1<<15 # signed 16 bit DAC + max_val = 1 << 15 # signed 16 bit DAC max_out = 10. - freq = 50e6 # samples/s - max_time = 1<<16 # unsigned 16 bit timer + freq = 50e6 # samples/s + max_time = 1 << 16 # unsigned 16 bit timer num_dacs = 3 num_frames = 8 num_channels = 9 - max_data = 4*(1<<10) # 8kx16 8kx16 4kx16 + max_data = 4*(1 << 10) # 8kx16 8kx16 4kx16 escape_char = b"\xa5" cordic_gain = 1. for i in range(16): cordic_gain *= np.sqrt(1 + 2**(-2*i)) commands = { - "RESET_EN": b"\x00", - "RESET_DIS": b"\x01", - "TRIGGER_EN": b"\x02", - "TRIGGER_DIS": b"\x03", - "ARM_EN": b"\x04", - "ARM_DIS": b"\x05", - "DCM_EN": b"\x06", - "DCM_DIS": b"\x07", - "START_EN": b"\x08", - "START_DIS": b"\x09", - } + "RESET_EN": b"\x00", + "RESET_DIS": b"\x01", + "TRIGGER_EN": b"\x02", + "TRIGGER_DIS": b"\x03", + "ARM_EN": b"\x04", + "ARM_DIS": b"\x05", + "DCM_EN": b"\x06", + "DCM_DIS": b"\x07", + "START_EN": b"\x08", + "START_DIS": b"\x09", + } def __init__(self, serial=None): self.serial = serial @@ -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): """ @@ -158,13 +158,13 @@ class Pdq2: if tr is None: tr = t dv = [interpolate.splev(tr[:-1], spline, der=i) - for i in range(order + 1)] + for i in range(order + 1)] # correct for adder chain latency correction_map = [ - (1, -1/2., 2), - (1, -1/6., 3), - (2, -1., 3), - ] + (1, -1/2., 2), + (1, -1/6., 3), + (2, -1., 3), + ] for i, c, j in correction_map: if j >= len(dv): break @@ -180,14 +180,14 @@ class Pdq2: frame.append((part >> 32).astype("