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>
This commit is contained in:
parent
641c6ebe9b
commit
863e31fa52
5 changed files with 20 additions and 20 deletions
|
@ -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))
|
||||
|
||||
"""
|
||||
|
|
|
@ -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
|
||||
"""
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue