Patch Detail
Show a patch.
GET /api/1.1/patches/3762/?format=api
{ "id": 3762, "url": "https://patchwork.libcamera.org/api/1.1/patches/3762/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3762/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200512000322.11753-9-laurent.pinchart@ideasonboard.com>", "date": "2020-05-12T00:03:06", "name": "[libcamera-devel,08/24] utils: raspberrypi: ctt: Fix pycodestyle E225", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "8c25635d135d6305770c6f22949869941bcd3b3f", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3762/mbox/", "series": [ { "id": 897, "url": "https://patchwork.libcamera.org/api/1.1/series/897/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=897", "date": "2020-05-12T00:02:58", "name": "utils: raspberrypi: ctt: Comply with pycodestyle", "version": 1, "mbox": "https://patchwork.libcamera.org/series/897/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3762/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3762/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C332760E06\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 May 2020 02:03:36 +0200 (CEST)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2F8B633E;\n\tTue, 12 May 2020 02:03:36 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"V/4vdlED\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1589241816;\n\tbh=7/qJinOFixS3KEwhlVNU115ZUmyJbfgzi5M4dr1t1vU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=V/4vdlEDy8K4D83omNP244/8q7ty64SmXYyZYwFsHWakyBYmg3sW/XcJlWfITnAGz\n\t1ZrUlxrXMTeumBV2zmS/9KO2PJ7Mug8FmwfRwqYMYj4xXu0Akdn5jjUxhw8JrbGJpn\n\tCDA39KLHYX7fvxp/5NCwFOXms4gtB6MHlVIGbTsg=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 12 May 2020 03:03:06 +0300", "Message-Id": "<20200512000322.11753-9-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", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 08/24] utils: raspberrypi: ctt: Fix\n\tpycodestyle E225", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "X-List-Received-Date": "Tue, 12 May 2020 00:03:39 -0000" }, "content": "E225 missing whitespace around operator\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/raspberrypi/ctt/ctt.py | 17 +++++++++--------\n utils/raspberrypi/ctt/ctt_alsc.py | 12 ++++++------\n utils/raspberrypi/ctt/ctt_awb.py | 14 +++++++-------\n utils/raspberrypi/ctt/ctt_ccm.py | 8 ++++----\n utils/raspberrypi/ctt/ctt_macbeth_locator.py | 12 ++++++------\n utils/raspberrypi/ctt/ctt_ransac.py | 4 ++--\n 6 files changed, 34 insertions(+), 33 deletions(-)", "diff": "diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py\nindex 46cf92cd75a2..07230fe3f709 100755\n--- a/utils/raspberrypi/ctt/ctt.py\n+++ b/utils/raspberrypi/ctt/ctt.py\n@@ -71,7 +71,7 @@ class Camera:\n self.path = ''\n self.imgs = []\n self.imgs_alsc = []\n- self.log = 'Log created : '+ time.asctime(time.localtime(time.time()))\n+ self.log = 'Log created : ' + time.asctime(time.localtime(time.time()))\n self.log_separator = '\\n'+'-'*70+'\\n'\n self.jf = jfile\n \"\"\"\n@@ -227,7 +227,7 @@ class Camera:\n cal_cb_list = self.json['rpi.alsc']['calibrations_Cb']\n self.log += '\\nALSC tables found successfully'\n except KeyError:\n- cal_cr_list, cal_cb_list=None, None\n+ cal_cr_list, cal_cb_list = None, None\n print('WARNING! No ALSC tables found for CCM!')\n print('Performing CCM calibrations without ALSC correction...')\n self.log += '\\nWARNING: No ALSC tables found.\\nCCM calibration '\n@@ -236,7 +236,7 @@ class Camera:\n \"\"\"\n case where config options result in CCM done without ALSC colour tables\n \"\"\"\n- cal_cr_list, cal_cb_list=None, None\n+ cal_cr_list, cal_cb_list = None, None\n self.log += '\\nWARNING: No ALSC tables found.\\nCCM calibration '\n self.log += 'performed without ALSC correction...'\n \n@@ -292,13 +292,13 @@ class Camera:\n cal_cb_list = self.json['rpi.alsc']['calibrations_Cb']\n self.log += '\\nALSC tables found successfully'\n except KeyError:\n- cal_cr_list, cal_cb_list=None, None\n+ cal_cr_list, cal_cb_list = None, None\n print('ERROR, no ALSC calibrations found for AWB')\n print('Performing AWB without ALSC tables')\n self.log += '\\nWARNING: No ALSC tables found.\\nAWB calibration '\n self.log += 'performed without ALSC correction...'\n else:\n- cal_cr_list, cal_cb_list=None, None\n+ cal_cr_list, cal_cb_list = None, None\n self.log += '\\nWARNING: No ALSC tables found.\\nAWB calibration '\n self.log += 'performed without ALSC correction...'\n \"\"\"\n@@ -502,9 +502,9 @@ class Camera:\n for key in disable:\n try:\n del self.json[key]\n- self.log += '\\nDisabled: '+key\n+ self.log += '\\nDisabled: ' + key\n except KeyError:\n- self.log += '\\nERROR: '+key +' not found!'\n+ self.log += '\\nERROR: ' + key + ' not found!'\n \"\"\"\n writes the json dictionary to the raw json file then make pretty\n \"\"\"\n@@ -685,7 +685,8 @@ class Camera:\n blacklevels = list(set([Img.blacklevel_16 for Img in all_imgs]))\n sizes = list(set([(Img.w, Img.h) for Img in all_imgs]))\n \n- if len(camNames)==1 and len(patterns)==1 and len(sigbitss)==1 and len(blacklevels) ==1 and len(sizes)== 1:\n+ if len(camNames) == 1 and len(patterns) == 1 and len(sigbitss) == 1 and \\\n+ len(blacklevels) == 1 and len(sizes) == 1:\n self.grey = (patterns[0] == 128)\n self.blacklevel_16 = blacklevels[0]\n self.log += '\\nName: {}'.format(camNames[0])\ndiff --git a/utils/raspberrypi/ctt/ctt_alsc.py b/utils/raspberrypi/ctt/ctt_alsc.py\nindex a006f7ffa9c9..d6e1020f1ccc 100644\n--- a/utils/raspberrypi/ctt/ctt_alsc.py\n+++ b/utils/raspberrypi/ctt/ctt_alsc.py\n@@ -61,10 +61,10 @@ def alsc_all(Cam, do_alsc_colour, plot):\n \"\"\"\n force numbers to be stored to 3dp.... :(\n \"\"\"\n- t_r = np.where((100*t_r)%1<=0.05, t_r+0.001, t_r)\n- t_b = np.where((100*t_b)%1<=0.05, t_b+0.001, t_b)\n- t_r = np.where((100*t_r)%1>=0.95, t_r-0.001, t_r)\n- t_b = np.where((100*t_b)%1>=0.95, t_b-0.001, t_b)\n+ t_r = np.where((100*t_r)%1 <= 0.05, t_r+0.001, t_r)\n+ t_b = np.where((100*t_b)%1 <= 0.05, t_b+0.001, t_b)\n+ t_r = np.where((100*t_r)%1 >= 0.95, t_r-0.001, t_r)\n+ t_b = np.where((100*t_b)%1 >= 0.95, t_b-0.001, t_b)\n t_r = np.round(t_r, 3)\n t_b = np.round(t_b, 3)\n r_corners = (t_r[0], t_r[15], t_r[-1], t_r[-16])\n@@ -95,8 +95,8 @@ def alsc_all(Cam, do_alsc_colour, plot):\n average all values for luminance shading and return one table for all temperatures\n \"\"\"\n lum_lut = np.mean(list_cg, axis=0)\n- lum_lut = np.where((100*lum_lut)%1<=0.05, lum_lut+0.001, lum_lut)\n- lum_lut = np.where((100*lum_lut)%1>=0.95, lum_lut-0.001, lum_lut)\n+ lum_lut = np.where((100*lum_lut)%1 <= 0.05, lum_lut+0.001, lum_lut)\n+ lum_lut = np.where((100*lum_lut)%1 >= 0.95, lum_lut-0.001, lum_lut)\n lum_lut = list(np.round(lum_lut, 3))\n \n \"\"\"\ndiff --git a/utils/raspberrypi/ctt/ctt_awb.py b/utils/raspberrypi/ctt/ctt_awb.py\nindex 297ba178b35f..3abafbf550b0 100644\n--- a/utils/raspberrypi/ctt/ctt_awb.py\n+++ b/utils/raspberrypi/ctt/ctt_awb.py\n@@ -27,8 +27,8 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot):\n \"\"\"\n normalise tables so min value is 1\n \"\"\"\n- cr_tab= cr_tab/np.min(cr_tab)\n- cb_tab= cb_tab/np.min(cb_tab)\n+ cr_tab = cr_tab/np.min(cr_tab)\n+ cb_tab = cb_tab/np.min(cb_tab)\n colour_cals[cr['ct']] = [cr_tab, cb_tab]\n \"\"\"\n obtain data from greyscale macbeth patches\n@@ -183,10 +183,10 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot):\n \"\"\"\n round to 4dp\n \"\"\"\n- r_fit = np.where((1000*r_fit)%1<=0.05, r_fit+0.0001, r_fit)\n- r_fit = np.where((1000*r_fit)%1>=0.95, r_fit-0.0001, r_fit)\n- b_fit = np.where((1000*b_fit)%1<=0.05, b_fit+0.0001, b_fit)\n- b_fit = np.where((1000*b_fit)%1>=0.95, b_fit-0.0001, b_fit)\n+ r_fit = np.where((1000*r_fit)%1 <= 0.05, r_fit+0.0001, r_fit)\n+ r_fit = np.where((1000*r_fit)%1 >= 0.95, r_fit-0.0001, r_fit)\n+ b_fit = np.where((1000*b_fit)%1 <= 0.05, b_fit+0.0001, b_fit)\n+ b_fit = np.where((1000*b_fit)%1 >= 0.95, b_fit-0.0001, b_fit)\n r_fit = np.round(r_fit, 4)\n b_fit = np.round(b_fit, 4)\n \"\"\"\n@@ -215,7 +215,7 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot):\n find bad index\n note that in python false = 0 and true = 1\n \"\"\"\n- bad = i - (error_1<error_2)\n+ bad = i - (error_1 < error_2)\n Cam.log += '\\nPoint at {} K deleted as '.format(c_fit[bad])\n Cam.log += 'it is furthest from fit'\n \"\"\"\ndiff --git a/utils/raspberrypi/ctt/ctt_ccm.py b/utils/raspberrypi/ctt/ctt_ccm.py\nindex 769603b947c5..52fd9744332a 100644\n--- a/utils/raspberrypi/ctt/ctt_ccm.py\n+++ b/utils/raspberrypi/ctt/ctt_ccm.py\n@@ -74,8 +74,8 @@ def ccm(Cam, cal_cr_list, cal_cb_list):\n \"\"\"\n normalise tables so min value is 1\n \"\"\"\n- cr_tab= cr_tab/np.min(cr_tab)\n- cb_tab= cb_tab/np.min(cb_tab)\n+ cr_tab = cr_tab/np.min(cr_tab)\n+ cb_tab = cb_tab/np.min(cb_tab)\n colour_cals[cr['ct']] = [cr_tab, cb_tab]\n \n \"\"\"\n@@ -135,8 +135,8 @@ def ccm(Cam, cal_cr_list, cal_cb_list):\n \"\"\"\n for k, v in ccm_tab.items():\n tab = np.mean(v, axis=0)\n- tab = np.where((10000*tab)%1<=0.05, tab+0.00001, tab)\n- tab = np.where((10000*tab)%1>=0.95, tab-0.00001, tab)\n+ tab = np.where((10000*tab)%1 <= 0.05, tab+0.00001, tab)\n+ tab = np.where((10000*tab)%1 >= 0.95, tab-0.00001, tab)\n ccm_tab[k] = list(np.round(tab, 5))\n Cam.log += '\\nMatrix calculated for colour temperature of {} K'.format(k)\n \ndiff --git a/utils/raspberrypi/ctt/ctt_macbeth_locator.py b/utils/raspberrypi/ctt/ctt_macbeth_locator.py\nindex 63dbc4a1f347..c3016f9a3c1d 100644\n--- a/utils/raspberrypi/ctt/ctt_macbeth_locator.py\n+++ b/utils/raspberrypi/ctt/ctt_macbeth_locator.py\n@@ -40,7 +40,7 @@ def find_macbeth(Cam, img, mac_config=(0, 0)):\n Reference macbeth chart is created that will be correlated with the located\n macbeth chart guess to produce a confidence value for the match.\n \"\"\"\n- ref = cv2.imread(Cam.path +'ctt_ref.pgm', flags=cv2.IMREAD_GRAYSCALE)\n+ ref = cv2.imread(Cam.path + 'ctt_ref.pgm', flags=cv2.IMREAD_GRAYSCALE)\n ref_w = 120\n ref_h = 80\n rc1 = (0, 0)\n@@ -328,7 +328,7 @@ def get_macbeth_chart(img, ref_data):\n \"\"\"\n src = img\n src, factor = reshape(src, 200)\n- original=src.copy()\n+ original = src.copy()\n a = 125/np.average(src)\n src_norm = cv2.convertScaleAbs(src, alpha=a, beta=0)\n \"\"\"\n@@ -349,7 +349,7 @@ def get_macbeth_chart(img, ref_data):\n \"\"\"\n obtain image edges\n \"\"\"\n- sigma=2\n+ sigma = 2\n src_bw = cv2.GaussianBlur(src_bw, (0, 0), sigma)\n t1, t2 = 50, 100\n edges = cv2.Canny(src_bw, t1, t2)\n@@ -490,7 +490,7 @@ def get_macbeth_chart(img, ref_data):\n )\n mac_mids_list = [x[0] for x in mac_mids]\n \n- if len(mac_mids_list)==1:\n+ if len(mac_mids_list) == 1:\n \"\"\"\n special case of only one valid centre found (probably not needed)\n \"\"\"\n@@ -508,7 +508,7 @@ def get_macbeth_chart(img, ref_data):\n create list of all clusters\n \"\"\"\n clus_list = []\n- if clustering.n_clusters_ >1:\n+ if clustering.n_clusters_ > 1:\n for i in range(clustering.labels_.max()+1):\n indices = [j for j, x in enumerate(clustering.labels_) if x == i]\n clus = []\n@@ -535,7 +535,7 @@ def get_macbeth_chart(img, ref_data):\n keep only clusters with enough votes\n \"\"\"\n clus_len_max = clus_list[0][1]\n- clus_tol= 0.7\n+ clus_tol = 0.7\n for i in range(len(clus_list)):\n if clus_list[i][1] < clus_len_max * clus_tol:\n clus_list = clus_list[:i]\ndiff --git a/utils/raspberrypi/ctt/ctt_ransac.py b/utils/raspberrypi/ctt/ctt_ransac.py\nindex a1f5e8c95ac1..392275445c14 100644\n--- a/utils/raspberrypi/ctt/ctt_ransac.py\n+++ b/utils/raspberrypi/ctt/ctt_ransac.py\n@@ -42,8 +42,8 @@ def get_square_verts(c_err=0.05, scale=scale):\n for i in range(6):\n shift_i = np.array(((i*side, 0), (i*side, 0),\n (i*side, 0), (i*side, 0)), np.float32)\n- shift_bord =np.array(((i*s_bord, 0), (i*s_bord, 0),\n- (i*s_bord, 0), (i*s_bord, 0)), np.float32)\n+ shift_bord = np.array(((i*s_bord, 0), (i*s_bord, 0),\n+ (i*s_bord, 0), (i*s_bord, 0)), np.float32)\n square_i = square_0 + shift_i + shift_bord\n for j in range(4):\n shift_j = np.array(((0, j*side), (0, j*side),\n", "prefixes": [ "libcamera-devel", "08/24" ] }