From e6b6ade36fcdd2f5f684deb5b52c9af53802d13c Mon Sep 17 00:00:00 2001 From: alex-rakowski Date: Thu, 9 Nov 2023 21:06:56 -0800 Subject: [PATCH] black --- py4DSTEM/braggvectors/diskdetection_aiml.py | 17 +++++++++++------ .../braggvectors/diskdetection_aiml_cuda.py | 2 +- py4DSTEM/process/polar/polar_peaks.py | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/py4DSTEM/braggvectors/diskdetection_aiml.py b/py4DSTEM/braggvectors/diskdetection_aiml.py index 4a59fd59e..36fc2858e 100644 --- a/py4DSTEM/braggvectors/diskdetection_aiml.py +++ b/py4DSTEM/braggvectors/diskdetection_aiml.py @@ -104,7 +104,9 @@ def find_Bragg_disks_aiml_single_DP( try: import crystal4D except ModuleNotFoundError: - raise ModuleNotFoundError("Import Error: Please install crystal4D before proceeding") + raise ModuleNotFoundError( + "Import Error: Please install crystal4D before proceeding" + ) try: import tensorflow as tf except ModuleNotFoundError: @@ -257,7 +259,9 @@ def find_Bragg_disks_aiml_selected( try: import crystal4D except ModuleNotFoundError: - raise ModuleNotFoundError("Import Error: Please install crystal4D before proceeding") + raise ModuleNotFoundError( + "Import Error: Please install crystal4D before proceeding" + ) assert len(Rx) == len(Ry) peaks = [] @@ -434,7 +438,9 @@ def find_Bragg_disks_aiml_serial( try: import crystal4D except ModuleNotFoundError: - raise ModuleNotFoundError("Import Error: Please install crystal4D before proceeding") + raise ModuleNotFoundError( + "Import Error: Please install crystal4D before proceeding" + ) # Make the peaks PointListArray # dtype = [('qx',float),('qy',float),('intensity',float)] @@ -895,7 +901,7 @@ def _get_latest_model(model_path=None): except FileExistsError: pass except Exception as e: - # TODO work out if I want to pass or raise + # TODO work out if I want to pass or raise pass # raise e # download the json file with the meta data @@ -910,13 +916,12 @@ def _get_latest_model(model_path=None): with open("./tmp/model_metadata_old.json") as f_old: metaold = json.load(f_old) file_id_old = metaold["file_id"] - # TODO Double check this is correct Error + # TODO Double check this is correct Error except FileNotFoundError: file_id_old = file_id except Exception: file_id_old = file_id - if os.path.exists(file_path) and file_id == file_id_old: print( "Latest model weight is already available in the local system. Loading the model... \n" diff --git a/py4DSTEM/braggvectors/diskdetection_aiml_cuda.py b/py4DSTEM/braggvectors/diskdetection_aiml_cuda.py index 316c18ee9..c00240092 100644 --- a/py4DSTEM/braggvectors/diskdetection_aiml_cuda.py +++ b/py4DSTEM/braggvectors/diskdetection_aiml_cuda.py @@ -637,7 +637,7 @@ def upsampled_correlation_cp(imageCorr, upsampleFactor, xyShift): ) dx = (icc[2, 1] - icc[0, 1]) / (4 * icc[1, 1] - 2 * icc[2, 1] - 2 * icc[0, 1]) dy = (icc[1, 2] - icc[1, 0]) / (4 * icc[1, 1] - 2 * icc[1, 2] - 2 * icc[1, 0]) - # TODO I think this is just the IndexError + # TODO I think this is just the IndexError except Exception: dx, dy = ( 0, diff --git a/py4DSTEM/process/polar/polar_peaks.py b/py4DSTEM/process/polar/polar_peaks.py index 7cc453544..8ee0db12c 100644 --- a/py4DSTEM/process/polar/polar_peaks.py +++ b/py4DSTEM/process/polar/polar_peaks.py @@ -602,7 +602,7 @@ def refine_peaks_local( self.peaks[rx, ry]["qr"][a0] = p0[2] / q_step self.peaks[rx, ry]["sigma_annular"][a0] = p0[3] / t_step self.peaks[rx, ry]["sigma_radial"][a0] = p0[4] / q_step - # TODO work out what error is raised + # TODO work out what error is raised except Exception: pass @@ -643,7 +643,7 @@ def refine_peaks_local( self.peaks[rx, ry]["qr"][a0] = p0[2] / q_step self.peaks[rx, ry]["sigma_annular"][a0] = p0[3] / t_step self.peaks[rx, ry]["sigma_radial"][a0] = p0[4] / q_step - # TODO work out what exception is raised + # TODO work out what exception is raised except Exception: pass