From patchwork Tue May 12 00:03:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3778 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BAE2060E1F for ; Tue, 12 May 2020 02:03:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="no+m6j8/"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 429CC33E; Tue, 12 May 2020 02:03:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1589241828; bh=fKAq1+3vTnfpj7NUbvogQ3/xjDGKdWwswTm/IuswWZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=no+m6j8/ulreQLtE7XY9syuk5VqZO3NduuUW7JM6lfzlAoSFUqXH/SRAeTDKHk3cL iSpS0uPHhuwb2H38udECRE8HasoRnM2ry40m+iBRCdgDlNtLldQRCaMPejkYdwiko1 jQVYBnsG//idMM8a0XMJFpX0v/dYyIly+ZPryhU0= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 12 May 2020 03:03:22 +0300 Message-Id: <20200512000322.11753-25-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200512000322.11753-1-laurent.pinchart@ideasonboard.com> References: <20200512000322.11753-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 24/24] utils: raspberrypi: ctt: Fix pycodestyle E302 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2020 00:03:49 -0000 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 --- 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(+) diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py index 02f1d8531269..81c724aeb2e0 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 b988f565f245..89e86469a78e 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 834d4dec2742..3c8cd9027a1a 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 dd660e40bb66..cebecfc248a6 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 d24b216389df..2aa668f133a8 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 240d68f984a2..66adb23733d7 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 ab367cae37d7..4e7785ef35e1 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 6567490c5539..35c848072a08 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 ba57f1d1d2c5..0afcf8f850cc 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 fac9e98ba9dd..73383ea09665 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 392275445c14..11515a4fab08 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 d5d64d47d25b..48e0aac26a1f 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