Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-rakowski committed Nov 10, 2023
1 parent 08957ff commit e6b6ade
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
17 changes: 11 additions & 6 deletions py4DSTEM/braggvectors/diskdetection_aiml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion py4DSTEM/braggvectors/diskdetection_aiml_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions py4DSTEM/process/polar/polar_peaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit e6b6ade

Please sign in to comment.