From 7e010fda1dce1c2dfff67d434873fef478cf5970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Sat, 10 Aug 2019 10:34:55 +0300 Subject: [PATCH] More specific imports Former-commit-id: 47a8ca8ef3375d0bffa1776b923cc06bf7496b94 --- qpms/cybspec.pxd | 2 +- qpms/cybspec.pyx | 6 +++--- qpms/cycommon.pyx | 2 +- qpms/cymaterials.pxd | 2 +- qpms/cymaterials.pyx | 6 ++---- qpms/cyquaternions.pxd | 2 +- qpms/cyquaternions.pyx | 3 ++- qpms/cytmatrices.pxd | 4 ++-- qpms/cytmatrices.pyx | 10 +++++----- qpms/cytranslations.pyx | 2 +- qpms/qpms_c.pxd | 2 +- qpms/qpms_c.pyx | 13 ++++++------- 12 files changed, 26 insertions(+), 28 deletions(-) diff --git a/qpms/cybspec.pxd b/qpms/cybspec.pxd index bc5cdf5..853c372 100644 --- a/qpms/cybspec.pxd +++ b/qpms/cybspec.pxd @@ -1,4 +1,4 @@ -from qpms_cdefs cimport * +from .qpms_cdefs cimport * cimport numpy as np diff --git a/qpms/cybspec.pyx b/qpms/cybspec.pyx index 780baf2..2faf05b 100644 --- a/qpms/cybspec.pyx +++ b/qpms/cybspec.pyx @@ -1,6 +1,6 @@ import numpy as np import enum -import cycommon +from .cycommon import get_mn_y, tlm2uvswfi class VSWFNorm(enum.IntEnum): # TODO try to make this an enum.IntFlag if supported @@ -30,12 +30,12 @@ cdef class BaseSpec: if len(args) == 0: if 'lMax' in kwargs.keys(): # if only lMax is specified, create the 'usual' definition in ('E','M') order lMax = kwargs['lMax'] - my, ny = cycommon.get_mn_y(lMax) + my, ny = get_mn_y(lMax) nelem = len(my) tlist = nelem * (QPMS_VSWF_ELECTRIC,) + nelem * (QPMS_VSWF_MAGNETIC,) mlist = 2*list(my) llist = 2*list(ny) - ilist = cycommon.tlm2uvswfi(tlist,llist,mlist) + ilist = tlm2uvswfi(tlist,llist,mlist) else: raise ValueError else: # len(args) > 0: diff --git a/qpms/cycommon.pyx b/qpms/cycommon.pyx index 83b3a28..118c047 100644 --- a/qpms/cycommon.pyx +++ b/qpms/cycommon.pyx @@ -1,5 +1,5 @@ import numpy as np -from qpms_cdefs cimport * +from .qpms_cdefs cimport * from libc.stdlib cimport malloc cimport cython import enum diff --git a/qpms/cymaterials.pxd b/qpms/cymaterials.pxd index c3b90e5..3a295b6 100644 --- a/qpms/cymaterials.pxd +++ b/qpms/cymaterials.pxd @@ -1,4 +1,4 @@ -from qpms_cdefs cimport qpms_permittivity_interpolator_t +from .qpms_cdefs cimport qpms_permittivity_interpolator_t cdef class MaterialInterpolator: cdef qpms_permittivity_interpolator_t *interp diff --git a/qpms/cymaterials.pyx b/qpms/cymaterials.pyx index 5c35447..26c0af4 100644 --- a/qpms/cymaterials.pyx +++ b/qpms/cymaterials.pyx @@ -3,10 +3,8 @@ import numpy as np import cmath -from qpms_cdefs cimport * -from cybspec cimport * -from cycommon import * -from cycommon cimport make_c_string +from .qpms_cdefs cimport qpms_permittivity_interpolator_from_yml, qpms_permittivity_interpolator_free, qpms_permittivity_interpolator_omega_min, qpms_permittivity_interpolator_omega_max, gsl_interp_type, qpms_permittivity_interpolator_t, gsl_interp_cspline, qpms_permittivity_interpolator_eps_at_omega +from .cycommon cimport make_c_string cimport cython import enum import warnings diff --git a/qpms/cyquaternions.pxd b/qpms/cyquaternions.pxd index 4855d3d..79dc61b 100644 --- a/qpms/cyquaternions.pxd +++ b/qpms/cyquaternions.pxd @@ -1,4 +1,4 @@ -from qpms_cdefs cimport * +from .qpms_cdefs cimport qpms_quat_t, qpms_irot3_t cdef class CQuat: cdef readonly qpms_quat_t q diff --git a/qpms/cyquaternions.pyx b/qpms/cyquaternions.pyx index b57c025..823b82c 100644 --- a/qpms/cyquaternions.pyx +++ b/qpms/cyquaternions.pyx @@ -1,4 +1,5 @@ -from cybspec cimport BaseSpec +from .cybspec cimport BaseSpec +from .qpms_cdefs cimport * import cmath import math diff --git a/qpms/cytmatrices.pxd b/qpms/cytmatrices.pxd index b267d85..c955257 100644 --- a/qpms/cytmatrices.pxd +++ b/qpms/cytmatrices.pxd @@ -1,6 +1,6 @@ cimport numpy as np -from qpms_cdefs cimport qpms_tmatrix_t, cdouble, qpms_tmatrix_interpolator_t -from cybspec cimport BaseSpec +from .qpms_cdefs cimport qpms_tmatrix_t, cdouble, qpms_tmatrix_interpolator_t +from .cybspec cimport BaseSpec cdef class TMatrixInterpolator: #cdef readonly np.ndarray m # Numpy array holding the matrix data diff --git a/qpms/cytmatrices.pyx b/qpms/cytmatrices.pyx index c14c088..fb19961 100644 --- a/qpms/cytmatrices.pyx +++ b/qpms/cytmatrices.pyx @@ -1,9 +1,9 @@ import numpy as np -from qpms_cdefs cimport * -from cybspec cimport BaseSpec -from cycommon import * -from cycommon cimport make_c_string -from qpms_c cimport FinitePointGroup +from .qpms_cdefs cimport * +from .cybspec cimport BaseSpec +from .cycommon import * +from .cycommon cimport make_c_string +from .qpms_c cimport FinitePointGroup import warnings import os from libc.stdlib cimport free diff --git a/qpms/cytranslations.pyx b/qpms/cytranslations.pyx index f1f0484..ab41a64 100644 --- a/qpms/cytranslations.pyx +++ b/qpms/cytranslations.pyx @@ -1,6 +1,6 @@ import numpy as np import cmath -from qpms_cdefs cimport * +from .qpms_cdefs cimport * from .cycommon import * from .cybspec cimport * cimport cython diff --git a/qpms/qpms_c.pxd b/qpms/qpms_c.pxd index 19424f0..a0fb85a 100644 --- a/qpms/qpms_c.pxd +++ b/qpms/qpms_c.pxd @@ -1,4 +1,4 @@ -from qpms_cdefs cimport qpms_finite_group_t +from .qpms_cdefs cimport qpms_finite_group_t cdef class FinitePointGroup: cdef readonly bint owns_data diff --git a/qpms/qpms_c.pyx b/qpms/qpms_c.pyx index 57aba57..cd23411 100644 --- a/qpms/qpms_c.pyx +++ b/qpms/qpms_c.pyx @@ -8,13 +8,12 @@ to make them available in Python. # ----------------------------- import numpy as np -from qpms_cdefs cimport * -from cyquaternions cimport IRot3, CQuat -from cybspec cimport BaseSpec -from cycommon cimport make_c_string -from cycommon import string_c2py, PointGroupClass -#import cycommon # Just to link make_c_string -from cytmatrices cimport CTMatrix +from .qpms_cdefs cimport * +from .cyquaternions cimport IRot3, CQuat +from .cybspec cimport BaseSpec +from .cycommon cimport make_c_string +from .cycommon import string_c2py, PointGroupClass +from .cytmatrices cimport CTMatrix from libc.stdlib cimport malloc, free, calloc cdef class PointGroup: