Access BaseSpec normalisation convention; minor tweaks

Former-commit-id: 3000084f187ac4d3f5e74c1ad27dd70097b9edd1
This commit is contained in:
Marek Nečada 2019-07-22 12:13:22 +03:00
parent c6e666f4e6
commit ef118d2d88
2 changed files with 16 additions and 2 deletions

View File

@ -25,6 +25,13 @@ class VSWFType(enum.IntEnum):
N = QPMS_VSWF_ELECTRIC N = QPMS_VSWF_ELECTRIC
L = QPMS_VSWF_LONGITUDINAL 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): class VSWFNorm(enum.IntEnum):
# TODO try to make this an enum.IntFlag if supported # TODO try to make this an enum.IntFlag if supported
# TODO add the other flags from qpms_normalisation_t as well # TODO add the other flags from qpms_normalisation_t as well
@ -672,7 +679,8 @@ cdef class trans_calculator:
return a, b return a, b
def get_trans_array_bspec_sph(self, BaseSpec destspec, BaseSpec srcspec, 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,): if kdlj.shape != (3,):
raise ValueError("Array of shape (3,) with spherical coordinates of the translation expected") raise ValueError("Array of shape (3,) with spherical coordinates of the translation expected")
cdef size_t destn = len(destspec) 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, def get_trans_array_bspec_c3pos(self, BaseSpec destspec, BaseSpec srcspec,
double k, destpos, srcpos, qpms_bessel_t J = QPMS_HANKEL_PLUS): 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,): if destpos.shape != (3,) or srcpos.shape != (3,):
raise ValueError("Array of shape (3,) with cartesian coordinates of the particle position expected") raise ValueError("Array of shape (3,) with cartesian coordinates of the particle position expected")
cdef size_t destn = len(destspec) cdef size_t destn = len(destspec)
@ -828,6 +838,10 @@ cdef class BaseSpec:
def __get__(self): def __get__(self):
return <uintptr_t> &(self.s) return <uintptr_t> &(self.s)
property norm:
def __get__(self):
return VSWFNorm(self.s.norm)
# Quaternions from wigner.h # Quaternions from wigner.h
# (mainly for testing; use moble's quaternions in python) # (mainly for testing; use moble's quaternions in python)

View File

@ -61,7 +61,7 @@ cdef extern from "qpms_types.h":
QPMS_BESSEL_SINGULAR QPMS_BESSEL_SINGULAR
QPMS_HANKEL_PLUS QPMS_HANKEL_PLUS
QPMS_HANKEL_MINUS QPMS_HANKEL_MINUS
QPMS_HANKEL_UNDEF QPMS_BESSEL_UNDEF
ctypedef int qpms_lm_t ctypedef int qpms_lm_t
ctypedef int qpms_l_t ctypedef int qpms_l_t
ctypedef int qpms_m_t ctypedef int qpms_m_t