From dbfa1b27944b8bc6e87e806aa76f4364fa5d4773 Mon Sep 17 00:00:00 2001 From: alex-rakowski Date: Fri, 10 Nov 2023 14:59:58 -0800 Subject: [PATCH] adding KeyError to correct place ... --- py4DSTEM/io/filereaders/read_K2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py4DSTEM/io/filereaders/read_K2.py b/py4DSTEM/io/filereaders/read_K2.py index 5673a9d84..0de69d399 100644 --- a/py4DSTEM/io/filereaders/read_K2.py +++ b/py4DSTEM/io/filereaders/read_K2.py @@ -115,7 +115,7 @@ def __init__( try: R_Ny = gtg.allTags[".SI Dimensions.Size Y"] R_Nx = gtg.allTags[".SI Dimensions.Size X"] - except (ValueError,KeyError): + except ValueError: print("Warning: scan shape not detected. Please check/set manually.") R_Nx = self._guess_number_frames() // 32 R_Ny = 1 @@ -125,7 +125,7 @@ def __init__( Q_Nx = gtg.allTags[".SI Image Tags.Acquisition.Parameters.Detector.height"] Q_Ny = gtg.allTags[".SI Image Tags.Acquisition.Parameters.Detector.width"] # TODO check this is the correct error type - except ValueError: + except (ValueError, KeyError): print("Warning: diffraction pattern shape not detected!") print("Assuming 1920x1792 as the diffraction pattern size!") Q_Nx = 1792