From e8655c2161a97261971ef19621a34651980b76d6 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 2 May 2020 03:32:00 +0300 Subject: utils: raspberrypi: ctt: Fix pycodestyle E302 E302 expected 2 blank lines, found 0 Note that issues are still flagged, due to the use of docstrings as multi-lines comments. This will be addressed separately. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: David Plowman --- utils/raspberrypi/ctt/ctt.py | 2 ++ utils/raspberrypi/ctt/ctt_alsc.py | 1 + utils/raspberrypi/ctt/ctt_awb.py | 1 + utils/raspberrypi/ctt/ctt_ccm.py | 1 + utils/raspberrypi/ctt/ctt_geq.py | 1 + utils/raspberrypi/ctt/ctt_image_load.py | 2 ++ utils/raspberrypi/ctt/ctt_lux.py | 2 ++ utils/raspberrypi/ctt/ctt_macbeth_locator.py | 2 ++ utils/raspberrypi/ctt/ctt_noise.py | 1 + utils/raspberrypi/ctt/ctt_pretty_print_json.py | 4 ++++ utils/raspberrypi/ctt/ctt_ransac.py | 2 ++ utils/raspberrypi/ctt/ctt_tools.py | 1 + 12 files changed, 20 insertions(+) (limited to 'utils/raspberrypi/ctt') diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py index ed34bfaa..d7e38c31 100755 --- a/utils/raspberrypi/ctt/ctt.py +++ b/utils/raspberrypi/ctt/ctt.py @@ -34,6 +34,7 @@ blank json file. This has been done to avoid reproducing the entire json file in the code here, thereby avoiding unecessary clutter. """ + """ Get the colour and lux values from the strings of each inidvidual image """ @@ -702,6 +703,7 @@ class Camera: self.log += '\nERROR: Images are from different cameras' return 0 + def run_ctt(json_output, directory, config, log_output): """ check input files are jsons diff --git a/utils/raspberrypi/ctt/ctt_alsc.py b/utils/raspberrypi/ctt/ctt_alsc.py index b988f565..89e86469 100644 --- a/utils/raspberrypi/ctt/ctt_alsc.py +++ b/utils/raspberrypi/ctt/ctt_alsc.py @@ -9,6 +9,7 @@ import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D + """ preform alsc calibration on a set of images """ diff --git a/utils/raspberrypi/ctt/ctt_awb.py b/utils/raspberrypi/ctt/ctt_awb.py index 96de004c..7055b863 100644 --- a/utils/raspberrypi/ctt/ctt_awb.py +++ b/utils/raspberrypi/ctt/ctt_awb.py @@ -9,6 +9,7 @@ import matplotlib.pyplot as plt from bisect import bisect_left from scipy.optimize import fmin + """ obtain piecewise linear approximation for colour curve """ diff --git a/utils/raspberrypi/ctt/ctt_ccm.py b/utils/raspberrypi/ctt/ctt_ccm.py index dd660e40..cebecfc2 100644 --- a/utils/raspberrypi/ctt/ctt_ccm.py +++ b/utils/raspberrypi/ctt/ctt_ccm.py @@ -7,6 +7,7 @@ from ctt_image_load import * from ctt_awb import get_alsc_patches + """ takes 8-bit macbeth chart values, degammas and returns 16 bit """ diff --git a/utils/raspberrypi/ctt/ctt_geq.py b/utils/raspberrypi/ctt/ctt_geq.py index d24b2163..2aa668f1 100644 --- a/utils/raspberrypi/ctt/ctt_geq.py +++ b/utils/raspberrypi/ctt/ctt_geq.py @@ -8,6 +8,7 @@ from ctt_tools import * import matplotlib.pyplot as plt import scipy.optimize as optimize + """ Uses green differences in macbeth patches to fit green equalisation threshold model. Ideally, all macbeth chart centres would fall below the threshold as diff --git a/utils/raspberrypi/ctt/ctt_image_load.py b/utils/raspberrypi/ctt/ctt_image_load.py index 240d68f9..66adb237 100644 --- a/utils/raspberrypi/ctt/ctt_image_load.py +++ b/utils/raspberrypi/ctt/ctt_image_load.py @@ -210,6 +210,7 @@ class Image: self.patches = all_patches return 1 + def brcm_load_image(Cam, im_str): """ Load image where raw data and metadata is in the BRCM format @@ -290,6 +291,7 @@ def brcm_load_image(Cam, im_str): return Img + def dng_load_image(Cam, im_str): try: Img = Image(None) diff --git a/utils/raspberrypi/ctt/ctt_lux.py b/utils/raspberrypi/ctt/ctt_lux.py index ab367cae..4e7785ef 100644 --- a/utils/raspberrypi/ctt/ctt_lux.py +++ b/utils/raspberrypi/ctt/ctt_lux.py @@ -5,6 +5,8 @@ # ctt_lux.py - camera tuning tool for lux level from ctt_tools import * + + """ Find lux values from metadata and calculate Y """ diff --git a/utils/raspberrypi/ctt/ctt_macbeth_locator.py b/utils/raspberrypi/ctt/ctt_macbeth_locator.py index 6567490c..35c84807 100644 --- a/utils/raspberrypi/ctt/ctt_macbeth_locator.py +++ b/utils/raspberrypi/ctt/ctt_macbeth_locator.py @@ -13,6 +13,7 @@ NOTE: some custom functions have been used here to make the code more readable. These are defined in tools.py if they are needed for reference. """ + """ Some inconsistencies between packages cause runtime warnings when running the clustering algorithm. This catches these warnings so they don't flood the @@ -291,6 +292,7 @@ def find_macbeth(Cam, img, mac_config=(0, 0)): return(coords_fit) + def get_macbeth_chart(img, ref_data): """ function returns coordinates of macbeth chart vertices and square centres, diff --git a/utils/raspberrypi/ctt/ctt_noise.py b/utils/raspberrypi/ctt/ctt_noise.py index ba57f1d1..0afcf8f8 100644 --- a/utils/raspberrypi/ctt/ctt_noise.py +++ b/utils/raspberrypi/ctt/ctt_noise.py @@ -7,6 +7,7 @@ from ctt_image_load import * import matplotlib.pyplot as plt + """ Find noise standard deviation and fit to model: diff --git a/utils/raspberrypi/ctt/ctt_pretty_print_json.py b/utils/raspberrypi/ctt/ctt_pretty_print_json.py index fac9e98b..73383ea0 100644 --- a/utils/raspberrypi/ctt/ctt_pretty_print_json.py +++ b/utils/raspberrypi/ctt/ctt_pretty_print_json.py @@ -4,6 +4,7 @@ # # ctt_pretty_print_json.py - camera tuning tool JSON formatter + """ takes a collapsed json file and makes it more readable """ @@ -11,10 +12,12 @@ def process_file(string, fout, state): for c in string: process_char(c, fout, state) + def print_newline(fout, state): fout.write('\n') fout.write(' '*state["indent"]*4) + def process_char(c, fout, state): if c == '{': if not state["skipnewline"]: @@ -61,6 +64,7 @@ def process_char(c, fout, state): fout.write(c) state["skipnewline"] = (c == '[') + def pretty_print_json(str_in, output_filename): state = {"indent": 0, "inarray": [False], "arraycount": [], "skipnewline": True} with open(output_filename, "w") as fout: diff --git a/utils/raspberrypi/ctt/ctt_ransac.py b/utils/raspberrypi/ctt/ctt_ransac.py index 39227544..11515a4f 100644 --- a/utils/raspberrypi/ctt/ctt_ransac.py +++ b/utils/raspberrypi/ctt/ctt_ransac.py @@ -8,6 +8,7 @@ import numpy as np scale = 2 + """ constructs normalised macbeth chart corners for ransac algorithm """ @@ -57,6 +58,7 @@ def get_square_verts(c_err=0.05, scale=scale): # print(square_verts) return np.array(square_verts, np.float32), mac_norm + def get_square_centres(c_err=0.05, scale=scale): """ define macbeth square centres diff --git a/utils/raspberrypi/ctt/ctt_tools.py b/utils/raspberrypi/ctt/ctt_tools.py index d5d64d47..48e0aac2 100644 --- a/utils/raspberrypi/ctt/ctt_tools.py +++ b/utils/raspberrypi/ctt/ctt_tools.py @@ -22,6 +22,7 @@ understanding of the code. They ar collated here to attempt to improve code readability in the main files. """ + """ obtain config values, unless it doesnt exist, in which case pick default Furthermore, it can check if the input is the correct type -- cgit v1.2.1