Skip to content

Commit

Permalink
adding else to trys
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-rakowski committed Nov 21, 2023
1 parent 78523ab commit 72b4184
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 2 deletions.
4 changes: 4 additions & 0 deletions py4DSTEM/braggvectors/diskdetection_aiml_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
cp = np

try:
import tensorflow as tf
Expand All @@ -32,6 +34,8 @@
from cupyx.scipy.ndimage import gaussian_filter
except (ModuleNotFoundError,ImportError,Exception) as e:
pass
else:
pass

def find_Bragg_disks_aiml_CUDA(
datacube,
Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/braggvectors/diskdetection_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import cupyx.scipy.fft as cufft
except (Exception,ModuleNotFoundError,ImportError):
pass
else:
pass
from time import time
import numba

Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/braggvectors/kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import cupy as cp
except Exception:
pass
else:
pass

__all__ = ["kernels"]

Expand Down
3 changes: 2 additions & 1 deletion py4DSTEM/preprocess/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np

else:
pass

def bin2D(array, factor, dtype=np.float64):
"""
Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/process/diffraction/crystal_ACOM.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError):
cp = None
else:
cp = None


def orientation_plan(
Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/process/phase/iterative_base_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
cp = np

from emdfile import Array, Custom, Metadata, _read_metadata, tqdmnd
from py4DSTEM.data import Calibration
Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/process/phase/iterative_dpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
cp = np

from emdfile import Array, Custom, Metadata, _read_metadata, tqdmnd
from py4DSTEM.data import Calibration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
cp = np

from emdfile import Custom, tqdmnd
from py4DSTEM import DataCube
Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/process/phase/iterative_mixedstate_ptychography.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
pass

from emdfile import Custom, tqdmnd
from py4DSTEM import DataCube
Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/process/phase/iterative_multislice_ptychography.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
cp = np

from emdfile import Custom, tqdmnd
from py4DSTEM import DataCube
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
cp = np

from emdfile import Custom, tqdmnd
from py4DSTEM import DataCube
Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/process/phase/iterative_overlap_tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
cp = np

from emdfile import Custom, tqdmnd
from py4DSTEM import DataCube
Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/process/phase/iterative_parallax.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
cp = np

warnings.simplefilter(action="always", category=UserWarning)

Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/process/phase/iterative_simultaneous_ptychography.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
cp = np

from emdfile import Custom, tqdmnd
from py4DSTEM import DataCube
Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/process/phase/iterative_singleslice_ptychography.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
cp = np

from emdfile import Custom, tqdmnd
from py4DSTEM.datacube import DataCube
Expand Down
3 changes: 3 additions & 0 deletions py4DSTEM/process/phase/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
except (ImportError, ModuleNotFoundError,Exception):
cp = None
from scipy.fft import dstn, idstn
else:
cp = None
from scipy.fft import dstn, idstn

from py4DSTEM.process.utils import get_CoM
from py4DSTEM.process.utils.cross_correlate import align_and_shift_images
Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/process/utils/cross_correlate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
cp = np


def get_cross_correlation(ar, template, corrPower=1, _returnval="real"):
Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/process/utils/multicorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np
else:
cp = np


def upsampled_correlation(imageCorr, upsampleFactor, xyShift, device="cpu"):
Expand Down
3 changes: 2 additions & 1 deletion py4DSTEM/process/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def clear_output(wait=True):
import cupy as cp
except (ImportError,ModuleNotFoundError,Exception):
cp = np

else:
cp = np

def radial_reduction(ar, x0, y0, binsize=1, fn=np.mean, coords=None):
"""
Expand Down

0 comments on commit 72b4184

Please sign in to comment.