From 4f16526ca0d927239a5cefb0a24993acbfa18053 Mon Sep 17 00:00:00 2001 From: rachel Date: Thu, 9 Nov 2023 14:35:33 -0800 Subject: [PATCH] fixed some PEP8 things --- hexrd/nf_config/experiment.py | 11 +++++++---- hexrd/nf_config/images.py | 1 + hexrd/nf_config/multiprocessing.py | 8 ++++---- hexrd/nf_config/reconstruction.py | 10 +++++----- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/hexrd/nf_config/experiment.py b/hexrd/nf_config/experiment.py index 9ab849b64..3abfadab6 100644 --- a/hexrd/nf_config/experiment.py +++ b/hexrd/nf_config/experiment.py @@ -37,7 +37,8 @@ def comp_thresh(self): elif np.logical_and(temp <= 1.0, temp > 0.0): return temp else: - raise RuntimeError('comp_thresh must be None or a number between 0 and 1') + raise RuntimeError( + 'comp_thresh must be None or a number between 0 and 1') @property def chi2_thresh(self): @@ -47,14 +48,16 @@ def chi2_thresh(self): elif np.logical_and(temp <= 1.0, temp > 0.0): return temp else: - raise RuntimeError('chi2_thresh must be None or a number between 0 and 1') + raise RuntimeError( + 'chi2_thresh must be None or a number between 0 and 1') @property def misorientation(self): - key = self._cfg.get('experiment:misorientation:use_misorientation', False) + key = self._cfg.get( + 'experiment:misorientation:use_misorientation', False) if key is True: parms = dict(misorientation_bnd=self.get('experiment:misorientation:bnd', 0.0), - misorientation_spacing=self.get('experiment:misorientation:spacing', 0.25)) + misorientation_spacing=self.get('experiment:misorientation:spacing', 0.25)) return parms else: return diff --git a/hexrd/nf_config/images.py b/hexrd/nf_config/images.py index faa5a16e8..433c6c6b5 100644 --- a/hexrd/nf_config/images.py +++ b/hexrd/nf_config/images.py @@ -10,6 +10,7 @@ 'gaussian': dict(sigma=2.0, size=3.0), 'dilations_only': dict(num_erosions=2, num_dilations=3)} + class ImagesConfig(Config): @property diff --git a/hexrd/nf_config/multiprocessing.py b/hexrd/nf_config/multiprocessing.py index 2cc37d2be..60fc9288a 100644 --- a/hexrd/nf_config/multiprocessing.py +++ b/hexrd/nf_config/multiprocessing.py @@ -27,7 +27,7 @@ def num_cpus(self): logger.warning( 'Requested %s processes, %d available', multiproc, ncpus - ) + ) res = ncpus else: res = multiproc if multiproc else 1 @@ -37,7 +37,7 @@ def num_cpus(self): logger.warning( 'Cannot use less than 1 process, requested %d of %d', temp, ncpus - ) + ) res = 1 else: res = temp @@ -46,7 +46,7 @@ def num_cpus(self): logger.warning( "Invalid value %s for multiprocessing", multiproc - ) + ) res = temp return res @@ -60,7 +60,7 @@ def num_cpus(self, val): raise RuntimeError( '"num_cpus": must be 1:%d, got %s' % (mp.cpu_count(), val) - ) + ) @property def check(self): diff --git a/hexrd/nf_config/reconstruction.py b/hexrd/nf_config/reconstruction.py index ccc8c3318..1e689bfac 100644 --- a/hexrd/nf_config/reconstruction.py +++ b/hexrd/nf_config/reconstruction.py @@ -12,10 +12,10 @@ class ReconstructionConfig(Config): def tomography(self): key = self._cfg.get('NF_reconstruction:tomography:use_mask', False) if key is True: - parms = dict(use_mask = True, - mask_data_file='NF_reconstruction:tomography:mask_data_file', - mask_vert_offset='NF_reconstruction:tomography:mask_vert_offset', - project_single_layer = 'NF_reconstruction:tomography:project_single_layer') + parms = dict(use_mask=True, + mask_data_file='NF_reconstruction:tomography:mask_data_file', + mask_vert_offset='NF_reconstruction:tomography:mask_vert_offset', + project_single_layer='NF_reconstruction:tomography:project_single_layer') return parms else: return @@ -30,7 +30,7 @@ def voxel_spacing(self): @property def v_bnds(self): - return self._cfg.get('NF_reconstruction:v_bnds',[0.0,0.0]) + return self._cfg.get('NF_reconstruction:v_bnds', [0.0, 0.0]) @property def beam_stop_y_cen(self):