diff options
Diffstat (limited to 'utils/raspberrypi/ctt')
-rwxr-xr-x | utils/raspberrypi/ctt/ctt.py | 18 | ||||
-rw-r--r-- | utils/raspberrypi/ctt/ctt_awb.py | 4 | ||||
-rw-r--r-- | utils/raspberrypi/ctt/ctt_ccm.py | 2 | ||||
-rw-r--r-- | utils/raspberrypi/ctt/ctt_image_load.py | 4 | ||||
-rw-r--r-- | utils/raspberrypi/ctt/ctt_macbeth_locator.py | 2 | ||||
-rw-r--r-- | utils/raspberrypi/ctt/ctt_tools.py | 4 |
6 files changed, 17 insertions, 17 deletions
diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py index 6fedef89..2c908e15 100755 --- a/utils/raspberrypi/ctt/ctt.py +++ b/utils/raspberrypi/ctt/ctt.py @@ -534,17 +534,17 @@ class Camera: self.log_new_sec('User Arguments', cal=False) self.log += '\nJson file output: ' + json_output self.log += '\nCalibration images directory: ' + directory - if config == None: + if config is None: self.log += '\nNo configuration file input... using default options' - elif config == False: + elif config is False: self.log += '\nWARNING: Invalid configuration file path...' self.log += ' using default options' - elif config == True: + elif config is True: self.log += '\nWARNING: Invalid syntax in configuration file...' self.log += ' using default options' else: self.log += '\nConfiguration file: ' + config - if log_output == None: + if log_output is None: self.log += '\nNo log file path input... using default: ctt_log.txt' else: self.log += '\nLog file output: ' + log_output @@ -555,7 +555,7 @@ class Camera: write log file """ def write_log(self, filename): - if filename == None: + if filename is None: filename = 'ctt_log.txt' self.log += '\n' + self.log_separator with open(filename, 'w') as logfile: @@ -604,7 +604,7 @@ class Camera: """ check that image colour temperature has been successfuly obtained """ - elif col != None: + elif col is not None: """ if successful, append to list and continue to next image """ @@ -627,7 +627,7 @@ class Camera: if image isn't an alsc correction then it must have a lux and a colour temperature value to be useful """ - if lux == None: + if lux is None: print('DISCARDED') self.log += '\nWARNING: Error reading lux value' self.log += '\nImage discarded!' @@ -707,7 +707,7 @@ def run_ctt(json_output, directory, config, log_output): """ if json_output[-5:] != '.json': raise ArgError('\n\nError: Output must be a json file!') - if config != None: + if config is not None: """ check if config file is actually a json """ @@ -790,7 +790,7 @@ def run_ctt(json_output, directory, config, log_output): Cam.write_json() Cam.write_log(log_output) print('\nCalibrations written to: '+json_output) - if log_output == None: + if log_output is None: log_output = 'ctt_log.txt' print('Log file written to: '+log_output) pass diff --git a/utils/raspberrypi/ctt/ctt_awb.py b/utils/raspberrypi/ctt/ctt_awb.py index 63feef24..71ad6b0e 100644 --- a/utils/raspberrypi/ctt/ctt_awb.py +++ b/utils/raspberrypi/ctt/ctt_awb.py @@ -17,7 +17,7 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot): """ condense alsc calibration tables into one dictionary """ - if cal_cr_list == None: + if cal_cr_list is None: colour_cals = None else: colour_cals = {} @@ -315,7 +315,7 @@ def get_alsc_patches(Img, colour_cals, grey=True): b_patchs = patches[3] - Img.blacklevel_16 g_patchs = (patches[1]+patches[2])/2 - Img.blacklevel_16 - if colour_cals == None: + if colour_cals is None: return r_patchs, b_patchs, g_patchs """ find where image colour fits in alsc colour calibration tables diff --git a/utils/raspberrypi/ctt/ctt_ccm.py b/utils/raspberrypi/ctt/ctt_ccm.py index adc4d290..21be4d6f 100644 --- a/utils/raspberrypi/ctt/ctt_ccm.py +++ b/utils/raspberrypi/ctt/ctt_ccm.py @@ -64,7 +64,7 @@ def ccm(Cam, cal_cr_list, cal_cb_list): reformat alsc correction tables or set colour_cals to None if alsc is deactivated """ - if cal_cr_list == None: + if cal_cr_list is None: colour_cals = None else: colour_cals = {} diff --git a/utils/raspberrypi/ctt/ctt_image_load.py b/utils/raspberrypi/ctt/ctt_image_load.py index 38026c7a..78730750 100644 --- a/utils/raspberrypi/ctt/ctt_image_load.py +++ b/utils/raspberrypi/ctt/ctt_image_load.py @@ -232,7 +232,7 @@ def brcm_load_image(Cam, im_str): """ return error if problem reading file """ - if f == None: + if f is None: print('\nERROR:\nProblem reading file') Cam.log += '\nWARNING: Problem readin file' return 0 @@ -376,7 +376,7 @@ def load_image(Cam, im_str, mac_config=None, show=False, mac=True, show_meta=Fal """ if no macbeth found return error """ - if macbeth == None: + if macbeth is None: print('\nERROR: No macbeth chart found') return 0 mac_cen_coords = macbeth[1] diff --git a/utils/raspberrypi/ctt/ctt_macbeth_locator.py b/utils/raspberrypi/ctt/ctt_macbeth_locator.py index 94bbf580..05d1bd43 100644 --- a/utils/raspberrypi/ctt/ctt_macbeth_locator.py +++ b/utils/raspberrypi/ctt/ctt_macbeth_locator.py @@ -258,7 +258,7 @@ def find_macbeth(Cam, img, mac_config=(0, 0)): """ extract data from coords_fit and plot on original image """ - if show and coords_fit != None: + if show and coords_fit is not None: copy = img.copy() verts = coords_fit[0][0] cents = coords_fit[1][0] diff --git a/utils/raspberrypi/ctt/ctt_tools.py b/utils/raspberrypi/ctt/ctt_tools.py index e5871b60..27080de0 100644 --- a/utils/raspberrypi/ctt/ctt_tools.py +++ b/utils/raspberrypi/ctt/ctt_tools.py @@ -62,9 +62,9 @@ def parse_input(): directory = get_config(args_dict, '-i', None, 'string') config = get_config(args_dict, '-c', None, 'string') log_path = get_config(args_dict, '-l', None, 'string') - if directory == None: + if directory is None: raise ArgError('\n\nERROR! No input directory given.') - if json_output == None: + if json_output is None: raise ArgError('\n\nERROR! No output json given.') return json_output, directory, config, log_path """ |