From 8dca4978395e0d6bf232630983e8887a2f782758 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Mon, 3 Feb 2020 16:26:24 -0500 Subject: [PATCH 1/3] rearrange code structure renamed: nsls2ptycho/core/databroker_api.py -> nsls2ptycho/core/databroker/__init__.py renamed: nsls2ptycho/core/CSX_databroker.py -> nsls2ptycho/core/databroker/CSX_databroker.py renamed: nsls2ptycho/core/HXN_databroker.py -> nsls2ptycho/core/databroker/HXN_databroker.py renamed: nsls2ptycho/core/ptycho_qt_utils.py -> nsls2ptycho/core/qt_utils.py renamed: nsls2ptycho/core/ptycho_recon.py -> nsls2ptycho/core/workers.py --- nsls2ptycho/core/__init__.py | 1 + nsls2ptycho/core/{ => databroker}/CSX_databroker.py | 2 +- nsls2ptycho/core/{ => databroker}/HXN_databroker.py | 2 +- .../core/{databroker_api.py => databroker/__init__.py} | 6 +++--- nsls2ptycho/core/{ptycho_qt_utils.py => qt_utils.py} | 0 nsls2ptycho/core/{ptycho_recon.py => workers.py} | 2 +- nsls2ptycho/ptycho_gui.py | 8 ++++---- nsls2ptycho/roi_gui.py | 4 ++-- 8 files changed, 13 insertions(+), 12 deletions(-) rename nsls2ptycho/core/{ => databroker}/CSX_databroker.py (99%) rename nsls2ptycho/core/{ => databroker}/HXN_databroker.py (99%) rename nsls2ptycho/core/{databroker_api.py => databroker/__init__.py} (91%) rename nsls2ptycho/core/{ptycho_qt_utils.py => qt_utils.py} (100%) rename nsls2ptycho/core/{ptycho_recon.py => workers.py} (99%) diff --git a/nsls2ptycho/core/__init__.py b/nsls2ptycho/core/__init__.py index d96d5e5..23830d3 100644 --- a/nsls2ptycho/core/__init__.py +++ b/nsls2ptycho/core/__init__.py @@ -1,2 +1,3 @@ +import nsls2ptycho.core.databroker import nsls2ptycho.core.ptycho import nsls2ptycho.core.widgets diff --git a/nsls2ptycho/core/CSX_databroker.py b/nsls2ptycho/core/databroker/CSX_databroker.py similarity index 99% rename from nsls2ptycho/core/CSX_databroker.py rename to nsls2ptycho/core/databroker/CSX_databroker.py index 5dad775..cd303aa 100644 --- a/nsls2ptycho/core/CSX_databroker.py +++ b/nsls2ptycho/core/databroker/CSX_databroker.py @@ -17,7 +17,7 @@ # ***************************** "Public API" ***************************** -# The following functions must exist in nsls2ptycho/core/*_databroker.py, +# The following functions must exist in nsls2ptycho.core.databroker, # but the function signatures do not need to agree across modules # (obviously, it is impossible for all beamlines to have the same setup). # - load_metadata diff --git a/nsls2ptycho/core/HXN_databroker.py b/nsls2ptycho/core/databroker/HXN_databroker.py similarity index 99% rename from nsls2ptycho/core/HXN_databroker.py rename to nsls2ptycho/core/databroker/HXN_databroker.py index 4feca28..0316284 100644 --- a/nsls2ptycho/core/HXN_databroker.py +++ b/nsls2ptycho/core/databroker/HXN_databroker.py @@ -20,7 +20,7 @@ # ***************************** "Public API" ***************************** -# The following functions must exist in nsls2ptycho/core/*_databroker.py, +# The following functions must exist in nsls2ptycho.core.databroker, # but the function signatures do not need to agree across modules # (obviously, it is impossible for all beamlines to have the same setup). # - load_metadata diff --git a/nsls2ptycho/core/databroker_api.py b/nsls2ptycho/core/databroker/__init__.py similarity index 91% rename from nsls2ptycho/core/databroker_api.py rename to nsls2ptycho/core/databroker/__init__.py index fab8dd0..0df5fe1 100644 --- a/nsls2ptycho/core/databroker_api.py +++ b/nsls2ptycho/core/databroker/__init__.py @@ -4,7 +4,7 @@ # ***************************** "Public API" ***************************** -# The following functions must exist in nsls2ptycho/core/*_databroker.py, +# The following functions must exist in nsls2ptycho.core.databroker, # but the function signatures do not need to agree across modules # (obviously, it is impossible for all beamlines to have the same setup). # - load_metadata @@ -22,7 +22,7 @@ def _load_HXN(): - import nsls2ptycho.core.HXN_databroker as hxn_databroker + from . import HXN_databroker as hxn_databroker global load_metadata, save_data, get_single_image, get_detector_names, db load_metadata = hxn_databroker.load_metadata save_data = hxn_databroker.save_data @@ -33,7 +33,7 @@ def _load_HXN(): def _load_CSX(): - import nsls2ptycho.core.CSX_databroker as csx_databroker + from . import CSX_databroker as csx_databroker global load_metadata, save_data, get_single_image, get_detector_names, db load_metadata = csx_databroker.load_metadata save_data = csx_databroker.save_data diff --git a/nsls2ptycho/core/ptycho_qt_utils.py b/nsls2ptycho/core/qt_utils.py similarity index 100% rename from nsls2ptycho/core/ptycho_qt_utils.py rename to nsls2ptycho/core/qt_utils.py diff --git a/nsls2ptycho/core/ptycho_recon.py b/nsls2ptycho/core/workers.py similarity index 99% rename from nsls2ptycho/core/ptycho_recon.py rename to nsls2ptycho/core/workers.py index a69b23d..db3e4fc 100644 --- a/nsls2ptycho/core/ptycho_recon.py +++ b/nsls2ptycho/core/workers.py @@ -9,7 +9,7 @@ import numpy as np import traceback -from nsls2ptycho.core.databroker_api import load_metadata, save_data +from nsls2ptycho.core.databroker import load_metadata, save_data from nsls2ptycho.core.utils import use_mpi_machinefile, set_flush_early diff --git a/nsls2ptycho/ptycho_gui.py b/nsls2ptycho/ptycho_gui.py index d012f64..6c87aae 100644 --- a/nsls2ptycho/ptycho_gui.py +++ b/nsls2ptycho/ptycho_gui.py @@ -7,15 +7,15 @@ from nsls2ptycho.ui import ui_ptycho from nsls2ptycho.core.utils import clean_shared_memory, get_mpi_num_processes, parse_range from nsls2ptycho.core.ptycho_param import Param -from nsls2ptycho.core.ptycho_recon import PtychoReconWorker, PtychoReconFakeWorker, HardWorker -from nsls2ptycho.core.ptycho_qt_utils import PtychoStream +from nsls2ptycho.core.workers import PtychoReconWorker, PtychoReconFakeWorker, HardWorker +from nsls2ptycho.core.qt_utils import PtychoStream from nsls2ptycho.core.widgets.list_widget import ListWidget from nsls2ptycho.core.widgets.mplcanvas import load_image_pil from nsls2ptycho.core.ptycho.utils import parse_config from nsls2ptycho._version import __version__ # databroker related -from nsls2ptycho.core.databroker_api import db, load_metadata, get_single_image, get_detector_names, beamline_name +from nsls2ptycho.core.databroker import db, load_metadata, get_single_image, get_detector_names, beamline_name from nsls2ptycho.reconStep_gui import ReconStepWindow from nsls2ptycho.roi_gui import RoiWindow @@ -561,7 +561,7 @@ def start(self, batch_mode=False): else: self._scan_points[0] *= -1.*self.param.x_direction self._scan_points[1] *= self.param.y_direction - # borrowed from nsls2ptycho/core/ptycho_recon.py + # borrowed from nsls2ptycho/core/workers.py if self.param.mpi_file_path == '': if self.param.gpu_flag: num_processes = str(len(self.param.gpus)) diff --git a/nsls2ptycho/roi_gui.py b/nsls2ptycho/roi_gui.py index d46327b..38c42bd 100644 --- a/nsls2ptycho/roi_gui.py +++ b/nsls2ptycho/roi_gui.py @@ -4,9 +4,9 @@ import numpy as np from nsls2ptycho.core.widgets.imgTools import find_outlier_pixels, find_brightest_pixels, rm_outlier_pixels -from nsls2ptycho.core.ptycho_recon import HardWorker +from nsls2ptycho.core.workers import HardWorker from nsls2ptycho.core.widgets.badpixel_dialog import BadPixelDialog -from nsls2ptycho.core.databroker_api import save_data +from nsls2ptycho.core.databroker import save_data class RoiWindow(QtWidgets.QMainWindow, ui_roi.Ui_MainWindow): From d611f8687dce5716a96aa5b342bde5aa1ddc6896 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Mon, 3 Feb 2020 23:02:39 -0500 Subject: [PATCH 2/3] move backend --- .gitmodules | 4 ++-- MANIFEST.in | 2 +- nsls2ptycho/core/__init__.py | 2 +- nsls2ptycho/core/backends/__init__.py | 0 nsls2ptycho/core/{ => backends}/ptycho | 0 nsls2ptycho/core/utils.py | 2 +- nsls2ptycho/core/widgets/mplcanvas.py | 2 +- nsls2ptycho/core/workers.py | 2 +- nsls2ptycho/ptycho_gui.py | 2 +- setup.py | 20 +++++++++++++------- 10 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 nsls2ptycho/core/backends/__init__.py rename nsls2ptycho/core/{ => backends}/ptycho (100%) diff --git a/.gitmodules b/.gitmodules index 3ac5184..53bfde1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "nsls2ptycho/core/ptycho"] - path = nsls2ptycho/core/ptycho +[submodule "nsls2ptycho/core/backends/ptycho"] + path = nsls2ptycho/core/backends/ptycho url = ../ptycho.git diff --git a/MANIFEST.in b/MANIFEST.in index 6de20cc..31e615c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -include nsls2ptycho/core/ptycho/*.cubin +include nsls2ptycho/core/backends/ptycho/*.cubin diff --git a/nsls2ptycho/core/__init__.py b/nsls2ptycho/core/__init__.py index 23830d3..2da1727 100644 --- a/nsls2ptycho/core/__init__.py +++ b/nsls2ptycho/core/__init__.py @@ -1,3 +1,3 @@ +import nsls2ptycho.core.backends.ptycho import nsls2ptycho.core.databroker -import nsls2ptycho.core.ptycho import nsls2ptycho.core.widgets diff --git a/nsls2ptycho/core/backends/__init__.py b/nsls2ptycho/core/backends/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/nsls2ptycho/core/ptycho b/nsls2ptycho/core/backends/ptycho similarity index 100% rename from nsls2ptycho/core/ptycho rename to nsls2ptycho/core/backends/ptycho diff --git a/nsls2ptycho/core/utils.py b/nsls2ptycho/core/utils.py index bfa2381..2eacd09 100644 --- a/nsls2ptycho/core/utils.py +++ b/nsls2ptycho/core/utils.py @@ -11,7 +11,7 @@ mpi4py.rc.initialize = False from mpi4py import MPI -from nsls2ptycho.core.ptycho.utils import split +from nsls2ptycho.core.backends.ptycho.utils import split # DEPRECARED: migrated to nsls2ptycho.core.widgets.mplcanvas diff --git a/nsls2ptycho/core/widgets/mplcanvas.py b/nsls2ptycho/core/widgets/mplcanvas.py index 08b4b25..4992094 100644 --- a/nsls2ptycho/core/widgets/mplcanvas.py +++ b/nsls2ptycho/core/widgets/mplcanvas.py @@ -11,7 +11,7 @@ import numpy as np from PIL import Image -from nsls2ptycho.core.ptycho.utils import split +from nsls2ptycho.core.backends.ptycho.utils import split def load_image_pil(path): diff --git a/nsls2ptycho/core/workers.py b/nsls2ptycho/core/workers.py index db3e4fc..56c0e7b 100644 --- a/nsls2ptycho/core/workers.py +++ b/nsls2ptycho/core/workers.py @@ -81,7 +81,7 @@ def _parse_one_line(self): def recon_api(self, param:Param, update_fcn=None): # "1" is just a placeholder to be overwritten soon - mpirun_command = ["mpirun", "-n", "1", "python", "-W", "ignore", "-m","nsls2ptycho.core.ptycho.recon_ptycho_gui"] + mpirun_command = ["mpirun", "-n", "1", "python", "-W", "ignore", "-m","nsls2ptycho.core.backends.ptycho.recon_ptycho_gui"] if param.mpi_file_path == '': if param.gpu_flag: diff --git a/nsls2ptycho/ptycho_gui.py b/nsls2ptycho/ptycho_gui.py index 6c87aae..6fd12fb 100644 --- a/nsls2ptycho/ptycho_gui.py +++ b/nsls2ptycho/ptycho_gui.py @@ -11,7 +11,7 @@ from nsls2ptycho.core.qt_utils import PtychoStream from nsls2ptycho.core.widgets.list_widget import ListWidget from nsls2ptycho.core.widgets.mplcanvas import load_image_pil -from nsls2ptycho.core.ptycho.utils import parse_config +from nsls2ptycho.core.backends.ptycho.utils import parse_config from nsls2ptycho._version import __version__ # databroker related diff --git a/setup.py b/setup.py index f4b1109..1acd7f3 100644 --- a/setup.py +++ b/setup.py @@ -24,12 +24,12 @@ from glob import glob extensions = [] # this doesn't work because setuptools doesn't support glob pattern... - #extensions = [Extension("*", ["nsls2ptycho/core/ptycho/*.c"])] - for filename in glob("nsls2ptycho/core/ptycho/*.c"): + #extensions = [Extension("*", ["nsls2ptycho/core/backends/ptycho/*.c"])] + for filename in glob("nsls2ptycho/core/backends/ptycho/*.c"): mod = os.path.basename(filename)[:-2] - extensions.append(Extension("nsls2ptycho.core.ptycho."+mod, [filename])) + extensions.append(Extension("nsls2ptycho.core.backends.ptycho."+mod, [filename])) else: - extensions = cythonize("nsls2ptycho/core/ptycho/*.pyx") + extensions = cythonize("nsls2ptycho/core/backends/ptycho/*.pyx") # see if PyQt5 is already installed --- pip and conda use different names... try: @@ -39,7 +39,7 @@ # for generating .cubin files # TODO: add a flag to do this only if GPU support is needed? -import nsls2ptycho.core.ptycho.build_cuda_source as bcs +import nsls2ptycho.core.backends.ptycho.build_cuda_source as bcs cubin_path = bcs.compile() # if GPU support is needed, check if cupy exists @@ -71,10 +71,16 @@ setup(name=NAME, version=__version__, #packages=find_packages(), - packages=["nsls2ptycho", "nsls2ptycho.core", "nsls2ptycho.ui", "nsls2ptycho.core.ptycho", "nsls2ptycho.core.widgets"], + packages=["nsls2ptycho", + "nsls2ptycho.core", + "nsls2ptycho.core.backends", + "nsls2ptycho.core.backends.ptycho", + "nsls2ptycho.core.databroker", + "nsls2ptycho.core.widgets", + "nsls2ptycho.ui"], entry_points={ 'gui_scripts': ['run-ptycho = nsls2ptycho.ptycho_gui:main'], - 'console_scripts': ['run-ptycho-backend = nsls2ptycho.core.ptycho.recon_ptycho_gui:main'] + 'console_scripts': ['run-ptycho-backend = nsls2ptycho.core.backends.ptycho.recon_ptycho_gui:main'] }, install_requires=REQUIREMENTS, #extras_require={'GPU': 'cupy'}, # this will build cupy from source, may not be the best practice! From 00d7b1ed706168527282f3c27cd60d5886d44b6f Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Tue, 4 Feb 2020 12:25:34 -0500 Subject: [PATCH 3/3] re-organize some functionalities databroker is now: nsls2ptycho.databroker ptycho is now: nsls2ptycho.backend.ptycho xcale will be: nsls2ptycho.backend.xcale open question: what should be kept in nsls2ptycho.core? --- .gitmodules | 4 ++-- MANIFEST.in | 2 +- nsls2ptycho/__init__.py | 2 ++ .../{core/backends => backend}/__init__.py | 0 nsls2ptycho/{core/backends => backend}/ptycho | 0 nsls2ptycho/core/__init__.py | 2 -- nsls2ptycho/core/utils.py | 2 +- nsls2ptycho/core/widgets/mplcanvas.py | 2 +- nsls2ptycho/core/workers.py | 11 ++++++----- .../{core => }/databroker/CSX_databroker.py | 2 +- .../{core => }/databroker/HXN_databroker.py | 2 +- nsls2ptycho/{core => }/databroker/__init__.py | 2 +- nsls2ptycho/ptycho_gui.py | 4 ++-- nsls2ptycho/roi_gui.py | 2 +- setup.py | 18 +++++++++--------- 15 files changed, 28 insertions(+), 27 deletions(-) rename nsls2ptycho/{core/backends => backend}/__init__.py (100%) rename nsls2ptycho/{core/backends => backend}/ptycho (100%) rename nsls2ptycho/{core => }/databroker/CSX_databroker.py (99%) rename nsls2ptycho/{core => }/databroker/HXN_databroker.py (99%) rename nsls2ptycho/{core => }/databroker/__init__.py (97%) diff --git a/.gitmodules b/.gitmodules index 53bfde1..0e1f569 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "nsls2ptycho/core/backends/ptycho"] - path = nsls2ptycho/core/backends/ptycho +[submodule "nsls2ptycho/backend/ptycho"] + path = nsls2ptycho/backend/ptycho url = ../ptycho.git diff --git a/MANIFEST.in b/MANIFEST.in index 31e615c..801786b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -include nsls2ptycho/core/backends/ptycho/*.cubin +include nsls2ptycho/backend/ptycho/*.cubin diff --git a/nsls2ptycho/__init__.py b/nsls2ptycho/__init__.py index d37d9c7..f1bedba 100644 --- a/nsls2ptycho/__init__.py +++ b/nsls2ptycho/__init__.py @@ -1,4 +1,6 @@ +import nsls2ptycho.backend import nsls2ptycho.core +import nsls2ptycho.databroker import nsls2ptycho.ui from ._version import __version__ diff --git a/nsls2ptycho/core/backends/__init__.py b/nsls2ptycho/backend/__init__.py similarity index 100% rename from nsls2ptycho/core/backends/__init__.py rename to nsls2ptycho/backend/__init__.py diff --git a/nsls2ptycho/core/backends/ptycho b/nsls2ptycho/backend/ptycho similarity index 100% rename from nsls2ptycho/core/backends/ptycho rename to nsls2ptycho/backend/ptycho diff --git a/nsls2ptycho/core/__init__.py b/nsls2ptycho/core/__init__.py index 2da1727..bee326c 100644 --- a/nsls2ptycho/core/__init__.py +++ b/nsls2ptycho/core/__init__.py @@ -1,3 +1 @@ -import nsls2ptycho.core.backends.ptycho -import nsls2ptycho.core.databroker import nsls2ptycho.core.widgets diff --git a/nsls2ptycho/core/utils.py b/nsls2ptycho/core/utils.py index 2eacd09..3849af3 100644 --- a/nsls2ptycho/core/utils.py +++ b/nsls2ptycho/core/utils.py @@ -11,7 +11,7 @@ mpi4py.rc.initialize = False from mpi4py import MPI -from nsls2ptycho.core.backends.ptycho.utils import split +from nsls2ptycho.backend.ptycho.utils import split # DEPRECARED: migrated to nsls2ptycho.core.widgets.mplcanvas diff --git a/nsls2ptycho/core/widgets/mplcanvas.py b/nsls2ptycho/core/widgets/mplcanvas.py index 4992094..6bf91e1 100644 --- a/nsls2ptycho/core/widgets/mplcanvas.py +++ b/nsls2ptycho/core/widgets/mplcanvas.py @@ -11,7 +11,7 @@ import numpy as np from PIL import Image -from nsls2ptycho.core.backends.ptycho.utils import split +from nsls2ptycho.backend.ptycho.utils import split def load_image_pil(path): diff --git a/nsls2ptycho/core/workers.py b/nsls2ptycho/core/workers.py index 56c0e7b..b7008e0 100644 --- a/nsls2ptycho/core/workers.py +++ b/nsls2ptycho/core/workers.py @@ -1,16 +1,17 @@ -from PyQt5 import QtCore from datetime import datetime -from nsls2ptycho.core.ptycho_param import Param import sys, os import pickle # dump param into disk import subprocess # call mpirun from shell from fcntl import fcntl, F_GETFL, F_SETFL from os import O_NONBLOCK -import numpy as np import traceback -from nsls2ptycho.core.databroker import load_metadata, save_data +import numpy as np +from PyQt5 import QtCore + +from nsls2ptycho.core.ptycho_param import Param from nsls2ptycho.core.utils import use_mpi_machinefile, set_flush_early +from nsls2ptycho.databroker import load_metadata, save_data class PtychoReconWorker(QtCore.QThread): @@ -81,7 +82,7 @@ def _parse_one_line(self): def recon_api(self, param:Param, update_fcn=None): # "1" is just a placeholder to be overwritten soon - mpirun_command = ["mpirun", "-n", "1", "python", "-W", "ignore", "-m","nsls2ptycho.core.backends.ptycho.recon_ptycho_gui"] + mpirun_command = ["mpirun", "-n", "1", "python", "-W", "ignore", "-m","nsls2ptycho.backend.ptycho.recon_ptycho_gui"] if param.mpi_file_path == '': if param.gpu_flag: diff --git a/nsls2ptycho/core/databroker/CSX_databroker.py b/nsls2ptycho/databroker/CSX_databroker.py similarity index 99% rename from nsls2ptycho/core/databroker/CSX_databroker.py rename to nsls2ptycho/databroker/CSX_databroker.py index cd303aa..df7ff7c 100644 --- a/nsls2ptycho/core/databroker/CSX_databroker.py +++ b/nsls2ptycho/databroker/CSX_databroker.py @@ -17,7 +17,7 @@ # ***************************** "Public API" ***************************** -# The following functions must exist in nsls2ptycho.core.databroker, +# The following functions must exist in nsls2ptycho.databroker, # but the function signatures do not need to agree across modules # (obviously, it is impossible for all beamlines to have the same setup). # - load_metadata diff --git a/nsls2ptycho/core/databroker/HXN_databroker.py b/nsls2ptycho/databroker/HXN_databroker.py similarity index 99% rename from nsls2ptycho/core/databroker/HXN_databroker.py rename to nsls2ptycho/databroker/HXN_databroker.py index 0316284..aaf1f94 100644 --- a/nsls2ptycho/core/databroker/HXN_databroker.py +++ b/nsls2ptycho/databroker/HXN_databroker.py @@ -20,7 +20,7 @@ # ***************************** "Public API" ***************************** -# The following functions must exist in nsls2ptycho.core.databroker, +# The following functions must exist in nsls2ptycho.databroker, # but the function signatures do not need to agree across modules # (obviously, it is impossible for all beamlines to have the same setup). # - load_metadata diff --git a/nsls2ptycho/core/databroker/__init__.py b/nsls2ptycho/databroker/__init__.py similarity index 97% rename from nsls2ptycho/core/databroker/__init__.py rename to nsls2ptycho/databroker/__init__.py index 0df5fe1..98dc108 100644 --- a/nsls2ptycho/core/databroker/__init__.py +++ b/nsls2ptycho/databroker/__init__.py @@ -4,7 +4,7 @@ # ***************************** "Public API" ***************************** -# The following functions must exist in nsls2ptycho.core.databroker, +# The following functions must exist in nsls2ptycho.databroker, # but the function signatures do not need to agree across modules # (obviously, it is impossible for all beamlines to have the same setup). # - load_metadata diff --git a/nsls2ptycho/ptycho_gui.py b/nsls2ptycho/ptycho_gui.py index 6fd12fb..79f54b8 100644 --- a/nsls2ptycho/ptycho_gui.py +++ b/nsls2ptycho/ptycho_gui.py @@ -11,11 +11,11 @@ from nsls2ptycho.core.qt_utils import PtychoStream from nsls2ptycho.core.widgets.list_widget import ListWidget from nsls2ptycho.core.widgets.mplcanvas import load_image_pil -from nsls2ptycho.core.backends.ptycho.utils import parse_config +from nsls2ptycho.backend.ptycho.utils import parse_config from nsls2ptycho._version import __version__ # databroker related -from nsls2ptycho.core.databroker import db, load_metadata, get_single_image, get_detector_names, beamline_name +from nsls2ptycho.databroker import db, load_metadata, get_single_image, get_detector_names, beamline_name from nsls2ptycho.reconStep_gui import ReconStepWindow from nsls2ptycho.roi_gui import RoiWindow diff --git a/nsls2ptycho/roi_gui.py b/nsls2ptycho/roi_gui.py index 38c42bd..9589511 100644 --- a/nsls2ptycho/roi_gui.py +++ b/nsls2ptycho/roi_gui.py @@ -6,7 +6,7 @@ from nsls2ptycho.core.widgets.imgTools import find_outlier_pixels, find_brightest_pixels, rm_outlier_pixels from nsls2ptycho.core.workers import HardWorker from nsls2ptycho.core.widgets.badpixel_dialog import BadPixelDialog -from nsls2ptycho.core.databroker import save_data +from nsls2ptycho.databroker import save_data class RoiWindow(QtWidgets.QMainWindow, ui_roi.Ui_MainWindow): diff --git a/setup.py b/setup.py index 1acd7f3..8b23376 100644 --- a/setup.py +++ b/setup.py @@ -24,12 +24,12 @@ from glob import glob extensions = [] # this doesn't work because setuptools doesn't support glob pattern... - #extensions = [Extension("*", ["nsls2ptycho/core/backends/ptycho/*.c"])] - for filename in glob("nsls2ptycho/core/backends/ptycho/*.c"): + #extensions = [Extension("*", ["nsls2ptycho/backend/ptycho/*.c"])] + for filename in glob("nsls2ptycho/backend/ptycho/*.c"): mod = os.path.basename(filename)[:-2] - extensions.append(Extension("nsls2ptycho.core.backends.ptycho."+mod, [filename])) + extensions.append(Extension("nsls2ptycho.backend.ptycho."+mod, [filename])) else: - extensions = cythonize("nsls2ptycho/core/backends/ptycho/*.pyx") + extensions = cythonize("nsls2ptycho/backend/ptycho/*.pyx") # see if PyQt5 is already installed --- pip and conda use different names... try: @@ -39,7 +39,7 @@ # for generating .cubin files # TODO: add a flag to do this only if GPU support is needed? -import nsls2ptycho.core.backends.ptycho.build_cuda_source as bcs +import nsls2ptycho.backend.ptycho.build_cuda_source as bcs cubin_path = bcs.compile() # if GPU support is needed, check if cupy exists @@ -73,14 +73,14 @@ #packages=find_packages(), packages=["nsls2ptycho", "nsls2ptycho.core", - "nsls2ptycho.core.backends", - "nsls2ptycho.core.backends.ptycho", - "nsls2ptycho.core.databroker", + "nsls2ptycho.backend", + "nsls2ptycho.backend.ptycho", + "nsls2ptycho.databroker", "nsls2ptycho.core.widgets", "nsls2ptycho.ui"], entry_points={ 'gui_scripts': ['run-ptycho = nsls2ptycho.ptycho_gui:main'], - 'console_scripts': ['run-ptycho-backend = nsls2ptycho.core.backends.ptycho.recon_ptycho_gui:main'] + 'console_scripts': ['run-ptycho-backend = nsls2ptycho.backend.ptycho.recon_ptycho_gui:main'] }, install_requires=REQUIREMENTS, #extras_require={'GPU': 'cupy'}, # this will build cupy from source, may not be the best practice!