diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-05-02 03:32:00 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-05-13 16:58:32 +0300 |
commit | 863e31fa52b837d30d38de9ba5d7e30096297b0c (patch) | |
tree | bd0e6c3277b9ebf67a6ae9534e260584c53fee1e /utils | |
parent | 641c6ebe9b278e0b00f0125133eebe9c0037ab88 (diff) |
utils: raspberrypi: ctt: Fix pycodestyle E228
E228 missing whitespace around modulo operator
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/raspberrypi/ctt/ctt_alsc.py | 12 | ||||
-rw-r--r-- | utils/raspberrypi/ctt/ctt_awb.py | 10 | ||||
-rw-r--r-- | utils/raspberrypi/ctt/ctt_ccm.py | 4 | ||||
-rw-r--r-- | utils/raspberrypi/ctt/ctt_image_load.py | 12 | ||||
-rw-r--r-- | utils/raspberrypi/ctt/ctt_tools.py | 2 |
5 files changed, 20 insertions, 20 deletions
diff --git a/utils/raspberrypi/ctt/ctt_alsc.py b/utils/raspberrypi/ctt/ctt_alsc.py index d6e1020f..e768f8d6 100644 --- a/utils/raspberrypi/ctt/ctt_alsc.py +++ b/utils/raspberrypi/ctt/ctt_alsc.py @@ -61,10 +61,10 @@ def alsc_all(Cam, do_alsc_colour, plot): """ force numbers to be stored to 3dp.... :( """ - t_r = np.where((100*t_r)%1 <= 0.05, t_r+0.001, t_r) - t_b = np.where((100*t_b)%1 <= 0.05, t_b+0.001, t_b) - t_r = np.where((100*t_r)%1 >= 0.95, t_r-0.001, t_r) - t_b = np.where((100*t_b)%1 >= 0.95, t_b-0.001, t_b) + t_r = np.where((100*t_r) % 1 <= 0.05, t_r+0.001, t_r) + t_b = np.where((100*t_b) % 1 <= 0.05, t_b+0.001, t_b) + t_r = np.where((100*t_r) % 1 >= 0.95, t_r-0.001, t_r) + t_b = np.where((100*t_b) % 1 >= 0.95, t_b-0.001, t_b) t_r = np.round(t_r, 3) t_b = np.round(t_b, 3) r_corners = (t_r[0], t_r[15], t_r[-1], t_r[-16]) @@ -95,8 +95,8 @@ def alsc_all(Cam, do_alsc_colour, plot): average all values for luminance shading and return one table for all temperatures """ lum_lut = np.mean(list_cg, axis=0) - lum_lut = np.where((100*lum_lut)%1 <= 0.05, lum_lut+0.001, lum_lut) - lum_lut = np.where((100*lum_lut)%1 >= 0.95, lum_lut-0.001, lum_lut) + lum_lut = np.where((100*lum_lut) % 1 <= 0.05, lum_lut+0.001, lum_lut) + lum_lut = np.where((100*lum_lut) % 1 >= 0.95, lum_lut-0.001, lum_lut) lum_lut = list(np.round(lum_lut, 3)) """ diff --git a/utils/raspberrypi/ctt/ctt_awb.py b/utils/raspberrypi/ctt/ctt_awb.py index 3abafbf5..58ef8432 100644 --- a/utils/raspberrypi/ctt/ctt_awb.py +++ b/utils/raspberrypi/ctt/ctt_awb.py @@ -183,10 +183,10 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot): """ round to 4dp """ - r_fit = np.where((1000*r_fit)%1 <= 0.05, r_fit+0.0001, r_fit) - r_fit = np.where((1000*r_fit)%1 >= 0.95, r_fit-0.0001, r_fit) - b_fit = np.where((1000*b_fit)%1 <= 0.05, b_fit+0.0001, b_fit) - b_fit = np.where((1000*b_fit)%1 >= 0.95, b_fit-0.0001, b_fit) + r_fit = np.where((1000*r_fit) % 1 <= 0.05, r_fit+0.0001, r_fit) + r_fit = np.where((1000*r_fit) % 1 >= 0.95, r_fit-0.0001, r_fit) + b_fit = np.where((1000*b_fit) % 1 <= 0.05, b_fit+0.0001, b_fit) + b_fit = np.where((1000*b_fit) % 1 >= 0.95, b_fit-0.0001, b_fit) r_fit = np.round(r_fit, 4) b_fit = np.round(b_fit, 4) """ @@ -326,7 +326,7 @@ def get_alsc_patches(Img, colour_cals, grey=True): if img colour is below minimum or above maximum alsc calibration colour, simply pick extreme closest to img colour """ - if pos%(len(cts)) == 0: + if pos % len(cts) == 0: """ this works because -0 = 0 = first and -1 = last index """ diff --git a/utils/raspberrypi/ctt/ctt_ccm.py b/utils/raspberrypi/ctt/ctt_ccm.py index 52fd9744..adc4d290 100644 --- a/utils/raspberrypi/ctt/ctt_ccm.py +++ b/utils/raspberrypi/ctt/ctt_ccm.py @@ -135,8 +135,8 @@ def ccm(Cam, cal_cr_list, cal_cb_list): """ for k, v in ccm_tab.items(): tab = np.mean(v, axis=0) - tab = np.where((10000*tab)%1 <= 0.05, tab+0.00001, tab) - tab = np.where((10000*tab)%1 >= 0.95, tab-0.00001, tab) + tab = np.where((10000*tab) % 1 <= 0.05, tab+0.00001, tab) + tab = np.where((10000*tab) % 1 >= 0.95, tab-0.00001, tab) ccm_tab[k] = list(np.round(tab, 5)) Cam.log += '\nMatrix calculated for colour temperature of {} K'.format(k) diff --git a/utils/raspberrypi/ctt/ctt_image_load.py b/utils/raspberrypi/ctt/ctt_image_load.py index 035256e3..584e0f8e 100644 --- a/utils/raspberrypi/ctt/ctt_image_load.py +++ b/utils/raspberrypi/ctt/ctt_image_load.py @@ -112,10 +112,10 @@ class Image: """ assemble 10 bit numbers """ - ch0 = np.left_shift((np.left_shift(ba0, 2) + (ba4%4)), 6) - ch1 = np.left_shift((np.left_shift(ba1, 2) + (np.right_shift(ba4, 2)%4)), 6) - ch2 = np.left_shift((np.left_shift(ba2, 2) + (np.right_shift(ba4, 4)%4)), 6) - ch3 = np.left_shift((np.left_shift(ba3, 2) + (np.right_shift(ba4, 6)%4)), 6) + ch0 = np.left_shift((np.left_shift(ba0, 2) + (ba4 % 4)), 6) + ch1 = np.left_shift((np.left_shift(ba1, 2) + (np.right_shift(ba4, 2) % 4)), 6) + ch2 = np.left_shift((np.left_shift(ba2, 2) + (np.right_shift(ba4, 4) % 4)), 6) + ch3 = np.left_shift((np.left_shift(ba3, 2) + (np.right_shift(ba4, 6) % 4)), 6) """ interleave bits """ @@ -146,8 +146,8 @@ class Image: ba0 = raw[..., 0:3*((self.w+1)>>1):3] ba1 = raw[..., 1:3*((self.w+1)>>1):3] ba2 = raw[..., 2:3*((self.w+1)>>1):3] - ch0 = np.left_shift((np.left_shift(ba0, 4) + ba2%16), 4) - ch1 = np.left_shift((np.left_shift(ba1, 4) + (np.right_shift(ba2, 4))%16), 4) + ch0 = np.left_shift((np.left_shift(ba0, 4) + ba2 % 16), 4) + ch1 = np.left_shift((np.left_shift(ba1, 4) + (np.right_shift(ba2, 4)) % 16), 4) mat = np.empty((self.h, self.w), dtype=ch0.dtype) mat[..., 0::2] = ch0 mat[..., 1::2] = ch1 diff --git a/utils/raspberrypi/ctt/ctt_tools.py b/utils/raspberrypi/ctt/ctt_tools.py index f00f2bbc..e5871b60 100644 --- a/utils/raspberrypi/ctt/ctt_tools.py +++ b/utils/raspberrypi/ctt/ctt_tools.py @@ -53,7 +53,7 @@ argument parser """ def parse_input(): arguments = sys.argv[1:] - if len(arguments)%2 != 0: + if len(arguments) % 2 != 0: raise ArgError('\n\nERROR! Enter value for each arguent passed.') params = arguments[0::2] vals = arguments[1::2] |