From f04fd9496e14dbe67ee552f19fec08df7d0cd78d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Sun, 24 Mar 2019 19:30:33 +0200 Subject: [PATCH] Additional functionality to Cython wrappers. Former-commit-id: 69c34b8ff0fb2d59ee6e62414e9999f2717ecfa0 --- qpms/qpms_c.pyx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/qpms/qpms_c.pyx b/qpms/qpms_c.pyx index ff1f3f4..50807d2 100644 --- a/qpms/qpms_c.pyx +++ b/qpms/qpms_c.pyx @@ -1194,9 +1194,14 @@ cdef class CTMatrix: # N.B. there is another type called TMatrix in tmatrices.py def spherical_fill(CTMatrix self, double radius, cdouble k_int, cdouble k_ext, cdouble mu_int = 1, cdouble mu_ext = 1): - ''' Replaces the contents of the T-matrix with those of a spherical particle. ''' + ''' Replaces the contents of the T-matrix with those of a spherical particle.''' qpms_tmatrix_spherical_fill(&self.t, radius, k_int, k_ext, mu_int, mu_ext) - + + def spherical_perm_fill(CTMatrix self, double radius, double freq, cdouble epsilon_int, + cdouble epsilon_ext): + '''Replaces the contenst of the T-matrix with those of a spherical particle.''' + qpms_tmatrix_spherical_mu0_fill(&self.t, radius, freq, epsilon_int, epsilon_ext) + @staticmethod def spherical(BaseSpec spec, double radius, cdouble k_int, cdouble k_ext, cdouble mu_int = 1, cdouble mu_ext = 1): @@ -1204,6 +1209,13 @@ cdef class CTMatrix: # N.B. there is another type called TMatrix in tmatrices.py tm = CTMatrix(spec, 0) tm.spherical_fill(radius, k_int, k_ext, mu_int, mu_ext) return tm + + @staticmethod + def spherical_perm(BaseSpec spec, double radius, double freq, cdouble epsilon_int, cdouble epsilon_ext): + '''Creates a T-matrix of a spherical nanoparticle.''' + tm = CTMatrix(spec, 0) + tm.spherical_perm_fill(radius, freq, epsilon_int, epsilon_ext) + return tm cdef char *make_c_string(pythonstring): '''