Skip to content

Commit

Permalink
setting environment params for pylops
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-rakowski committed Nov 22, 2023
1 parent 155e1e9 commit 1cdc541
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
if IN_COLAB is False:
try:
import cupy as cp
import pylops
except (ImportError,ModuleNotFoundError,Exception):
cp = np


else:
# I need to set some envrionment variables so pylops doesnt try to load cupy
import os
os.environ["CUPY_PYLOPS"] = "0"
#CUSIGNAL_PYLOPS
os.environ["CUSIGNAL_PYLOPS"] = "0"
import pylops
from emdfile import Custom, tqdmnd
from py4DSTEM import DataCube
from py4DSTEM.process.phase.iterative_base_class import PtychographicReconstruction
Expand Down
9 changes: 7 additions & 2 deletions py4DSTEM/process/phase/iterative_multislice_ptychography.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
if IN_COLAB is False:
try:
import cupy as cp
import pylops
except (ImportError,ModuleNotFoundError,Exception):
cp = np

else:
# I need to set some envrionment variables so pylops doesnt try to load cupy
import os
os.environ["CUPY_PYLOPS"] = "0"
#CUSIGNAL_PYLOPS
os.environ["CUSIGNAL_PYLOPS"] = "0"
import pylops
from emdfile import Custom, tqdmnd
from py4DSTEM import DataCube
from py4DSTEM.process.phase.iterative_base_class import PtychographicReconstruction
Expand Down
10 changes: 8 additions & 2 deletions py4DSTEM/process/phase/iterative_overlap_magnetic_tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@
if IN_COLAB is False:
try:
import cupy as cp
import pylops
except (ImportError,ModuleNotFoundError,Exception):
cp = np

else:
# I need to set some envrionment variables so pylops doesnt try to load cupy
import os
os.environ["CUPY_PYLOPS"] = "0"
#CUSIGNAL_PYLOPS
os.environ["CUSIGNAL_PYLOPS"] = "0"

import pylops
from emdfile import Custom, tqdmnd
from py4DSTEM import DataCube
from py4DSTEM.process.phase.iterative_base_class import PtychographicReconstruction
Expand Down
11 changes: 9 additions & 2 deletions py4DSTEM/process/phase/iterative_overlap_tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@
if IN_COLAB is False:
try:
import cupy as cp
import pylops

except (ImportError,ModuleNotFoundError,Exception):
cp = np

else:
# I need to set some envrionment variables so pylops doesnt try to load cupy
import os
os.environ["CUPY_PYLOPS"] = "0"
#CUSIGNAL_PYLOPS
os.environ["CUSIGNAL_PYLOPS"] = "0"

import pylops

from emdfile import Custom, tqdmnd
from py4DSTEM import DataCube
Expand Down
9 changes: 7 additions & 2 deletions py4DSTEM/process/phase/iterative_ptychographic_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
from py4DSTEM.process.utils import get_CoM
import sys
IN_COLAB = 'google.colab' in sys.modules
if IN_COLAB is False:
import pylops
if IN_COLAB is True:
import os
# I need to set some envrionment variables so pylops doesnt try to load cupy
os.environ["CUPY_PYLOPS"] = "0"
#CUSIGNAL_PYLOPS
os.environ["CUSIGNAL_PYLOPS"] = "0"
import pylops


class PtychographicConstraints:
Expand Down

0 comments on commit 1cdc541

Please sign in to comment.