From 13a67ffd2a57d02ab1bf853f1433d1ce266e6479 Mon Sep 17 00:00:00 2001 From: Megan Sosey Date: Mon, 30 Mar 2020 00:17:17 -0400 Subject: [PATCH] update extension location --- imexam/__init__.py | 2 +- imexam/connect.py | 2 +- imexam/ds9_viewer.py | 2 +- imexam/imexam_defpars.py | 2 +- imexam/imexamine.py | 8 ++++---- imexam/tests/test_imexamine.py | 2 -- imexam/util.py | 2 +- imexam/xpa_wrap.py | 2 +- setup.py | 14 +++----------- 9 files changed, 13 insertions(+), 23 deletions(-) diff --git a/imexam/__init__.py b/imexam/__init__.py index c7d4b810..84a8a721 100644 --- a/imexam/__init__.py +++ b/imexam/__init__.py @@ -16,7 +16,7 @@ try: - from .xpa_wrap import XPA + from . import imexamxpa _have_xpa = True except ImportError: _have_xpa = False diff --git a/imexam/connect.py b/imexam/connect.py index ec21b280..cfddc66e 100644 --- a/imexam/connect.py +++ b/imexam/connect.py @@ -18,7 +18,7 @@ have_ginga = False try: - import imexamxpa + from . import imexamxpa have_xpa = True from .ds9_viewer import ds9 except ImportError: diff --git a/imexam/ds9_viewer.py b/imexam/ds9_viewer.py index 6099b65c..e8e3a501 100644 --- a/imexam/ds9_viewer.py +++ b/imexam/ds9_viewer.py @@ -40,7 +40,7 @@ # The XPA class controls interaction with DS9 from .xpa_wrap import XPA -from imexamxpa import XpaException +from .imexamxpa import XpaException from . import util from astropy.io import fits diff --git a/imexam/imexam_defpars.py b/imexam/imexam_defpars.py index 19945d0f..c70b3436 100644 --- a/imexam/imexam_defpars.py +++ b/imexam/imexam_defpars.py @@ -25,7 +25,7 @@ com_center_pars = {"function": ["com_center",], "delta": [10, "bounding box size"], - "oversample": [1., "oversample pixels by"], + "oversampling": [1., "oversample pixels by"], } # box statistics diff --git a/imexam/imexamine.py b/imexam/imexamine.py index 5a940c3e..c101b138 100644 --- a/imexam/imexamine.py +++ b/imexam/imexamine.py @@ -110,7 +110,7 @@ def __init__(self): # save the backend that is in use for plotting reference self._mpl_backend = get_backend().lower() - def setlog(self, filename=None, on=True, level=logging.WARNING): + def setlog(self, filename=None, on=True, level=logging.INFO): """Turn on and off logging to a logfile or the screen. Parameters @@ -920,7 +920,7 @@ def column_fit(self, x, y, data=None, form=None, genplot=True, fig=None): if not genplot: return result - def com_center(self, x, y, data=None, delta=None, oversample=1.): + def com_center(self, x, y, data=None, delta=None, oversampling=1.): """ Return the center of mass of the object at x,y Parameters @@ -934,7 +934,7 @@ def com_center(self, x, y, data=None, delta=None, oversample=1.): delta: int The range of data values (bounding box) to use around the x,y location for calculating the center - oversample: int + oversampling: int Oversampling factors of pixel indices. If oversampling is a scalar this is treated as both x and y directions having the same oversampling factor; otherwise it is @@ -961,7 +961,7 @@ def com_center(self, x, y, data=None, delta=None, oversample=1.): chunk = data[yy - delta:yy + delta, xx - delta:xx + delta] try: - xcenter, ycenter = centroid_com(chunk, oversample=oversample) + xcenter, ycenter = centroid_com(chunk, oversampling=oversampling) pstr = f"xc={(xcenter + xx - delta):.4f}\tyc={(ycenter + yy - delta):.4f}" except AttributeError: diff --git a/imexam/tests/test_imexamine.py b/imexam/tests/test_imexamine.py index f67574b3..c0096f00 100644 --- a/imexam/tests/test_imexamine.py +++ b/imexam/tests/test_imexamine.py @@ -2,8 +2,6 @@ Make sure that the basic plots in imexamine are working as expected. """ -from __future__ import (absolute_import, division, print_function, - unicode_literals) import pytest import numpy as np from numpy.testing import assert_allclose, assert_equal, assert_array_equal diff --git a/imexam/util.py b/imexam/util.py index 5d137f91..f411ae25 100644 --- a/imexam/util.py +++ b/imexam/util.py @@ -135,7 +135,7 @@ def display_xpa_help(): # Set up logging ability for the user # consider making a private logging level for data retension -def set_logging(filename=None, on=True, level=logging.WARNING): +def set_logging(filename=None, on=True, level=logging.INFO): """Turn on or off logging to file or stdout. Parameters diff --git a/imexam/xpa_wrap.py b/imexam/xpa_wrap.py index d57aabe4..1a9bd7db 100644 --- a/imexam/xpa_wrap.py +++ b/imexam/xpa_wrap.py @@ -1,6 +1,6 @@ """Licensed under a 3-clause BSD style license - see LICENSE.rst.""" -from imexamxpa import xpa +from .imexamxpa import xpa class XPA(xpa): diff --git a/setup.py b/setup.py index 8400daa2..dbd93f58 100644 --- a/setup.py +++ b/setup.py @@ -156,13 +156,13 @@ def run(self): package_data[PACKAGENAME].extend(XPA_FILES) suffix_lib = importlib.machinery.EXTENSION_SUFFIXES[0] - package_data[PACKAGENAME].extend(XPA_LIBNAME+suffix_lib) + package_data[PACKAGENAME].append(XPA_LIBNAME+suffix_lib) XPA_SOURCES = [os.path.join(XPALIB_DIR, c) for c in XPA_FILES] XPALIB_DEFINES = [("HAVE_CONFIG_H", "1")] XPA_SOURCES.append(CYTHON_SOURCE) - xpa_module = Extension(XPA_LIBNAME, + xpa_module = Extension("imexam."+XPA_LIBNAME, sources=XPA_SOURCES, include_dirs=[XPALIB_DIR], define_macros=XPALIB_DEFINES, @@ -254,13 +254,6 @@ def run(self): exit(1) install.run(self) - class MyBuildPy(build_py): - def finalize_options(self): - super().finalize_options() - self.package_data = package_data - def run(self): - build_py.run(self) - class BuildExtWithConfigure(build_ext): """Configure, build, and install the aXe C code.""" @@ -285,7 +278,6 @@ def run(self): cmdclass.update({'install' : InstallWithRemake, 'clean' : my_clean, - 'build_py': MyBuildPy, 'build_ext' : BuildExtWithConfigure, }) @@ -307,6 +299,6 @@ def run(self): zip_safe=False, cmdclass=cmdclass, package_data=package_data, - package_dir={'': '.'}, + package_dir={'imexam': 'imexam'}, ext_modules=ext, ) \ No newline at end of file