From ef118d2d88fb03a56aaa0d5d368acbf5df89101e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Mon, 22 Jul 2019 12:13:22 +0300 Subject: [PATCH] Access BaseSpec normalisation convention; minor tweaks Former-commit-id: 3000084f187ac4d3f5e74c1ad27dd70097b9edd1 --- qpms/qpms_c.pyx | 16 +++++++++++++++- qpms/qpms_cdefs.pxd | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/qpms/qpms_c.pyx b/qpms/qpms_c.pyx index 2907fb7..b607488 100644 --- a/qpms/qpms_c.pyx +++ b/qpms/qpms_c.pyx @@ -25,6 +25,13 @@ class VSWFType(enum.IntEnum): N = QPMS_VSWF_ELECTRIC L = QPMS_VSWF_LONGITUDINAL +class BesselType(enum.IntEnum): + UNDEF = QPMS_BESSEL_UNDEF + REGULAR = QPMS_BESSEL_REGULAR + SINGULAR = QPMS_BESSEL_SINGULAR + HANKEL_PLUS = QPMS_HANKEL_PLUS + HANKEL_MINUS = QPMS_HANKEL_MINUS + class VSWFNorm(enum.IntEnum): # TODO try to make this an enum.IntFlag if supported # TODO add the other flags from qpms_normalisation_t as well @@ -672,7 +679,8 @@ cdef class trans_calculator: return a, b def get_trans_array_bspec_sph(self, BaseSpec destspec, BaseSpec srcspec, - double k, kdlj, qpms_bessel_t J = QPMS_HANKEL_PLUS): + kdlj, qpms_bessel_t J = QPMS_HANKEL_PLUS): + kdlj = np.array(kdlj) if kdlj.shape != (3,): raise ValueError("Array of shape (3,) with spherical coordinates of the translation expected") cdef size_t destn = len(destspec) @@ -691,6 +699,8 @@ cdef class trans_calculator: def get_trans_array_bspec_c3pos(self, BaseSpec destspec, BaseSpec srcspec, double k, destpos, srcpos, qpms_bessel_t J = QPMS_HANKEL_PLUS): + destpos = np.array(destpos) + srcpos = np.array(srcpos) if destpos.shape != (3,) or srcpos.shape != (3,): raise ValueError("Array of shape (3,) with cartesian coordinates of the particle position expected") cdef size_t destn = len(destspec) @@ -827,6 +837,10 @@ cdef class BaseSpec: property rawpointer: def __get__(self): return &(self.s) + + property norm: + def __get__(self): + return VSWFNorm(self.s.norm) # Quaternions from wigner.h # (mainly for testing; use moble's quaternions in python) diff --git a/qpms/qpms_cdefs.pxd b/qpms/qpms_cdefs.pxd index 16f8407..64f8b0f 100644 --- a/qpms/qpms_cdefs.pxd +++ b/qpms/qpms_cdefs.pxd @@ -61,7 +61,7 @@ cdef extern from "qpms_types.h": QPMS_BESSEL_SINGULAR QPMS_HANKEL_PLUS QPMS_HANKEL_MINUS - QPMS_HANKEL_UNDEF + QPMS_BESSEL_UNDEF ctypedef int qpms_lm_t ctypedef int qpms_l_t ctypedef int qpms_m_t