[libcamera-devel] [PATCH 24/24] utils: raspberrypi: ctt: Fix pycodestyle E302
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Tue May 12 02:03:22 CEST 2020
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 <laurent.pinchart at ideasonboard.com>
---
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
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list