Cython wrapper over qpms_permittivity_interpolator_t.
Former-commit-id: 38b362b52a8e8f5b6defca688b0589b25a2dfe22
This commit is contained in:
parent
d7a64f5928
commit
8683c69c0e
|
@ -1065,6 +1065,37 @@ cdef class IRot3:
|
||||||
qpms_irot3_uvswfi_dense(&view[0,0], bspec.rawpointer(), self.qd)
|
qpms_irot3_uvswfi_dense(&view[0,0], bspec.rawpointer(), self.qd)
|
||||||
return m
|
return m
|
||||||
|
|
||||||
|
cdef class MaterialInterpolator:
|
||||||
|
'''
|
||||||
|
Wrapper over the qpms_permittivity_interpolator_t structure.
|
||||||
|
'''
|
||||||
|
cdef qpms_permittivity_interpolator_t *interp
|
||||||
|
cdef readonly double omegamin
|
||||||
|
cdef readonly double omegamax
|
||||||
|
|
||||||
|
def __cinit__(self, filename, *args, **kwargs):
|
||||||
|
'''Creates a permittivity interpolator.'''
|
||||||
|
cdef char *cpath = make_c_string(filename)
|
||||||
|
self.interp = qpms_permittivity_interpolator_from_yml(cpath, gsl_interp_cspline)
|
||||||
|
if not self.interp:
|
||||||
|
raise IOError("Could not load permittivity data from %s" % filename)
|
||||||
|
self.omegamin = qpms_permittivity_interpolator_omega_min(self.interp)
|
||||||
|
self.omegamax = qpms_permittivity_interpolator_omega_max(self.interp)
|
||||||
|
|
||||||
|
def __dealloc__(self):
|
||||||
|
qpms_permittivity_interpolator_free(self.interp)
|
||||||
|
|
||||||
|
def __call__(self, double freq):
|
||||||
|
'''Returns interpolated permittivity, corresponding to a given angular frequency.'''
|
||||||
|
if freq < self.omegamin or freq > self.omegamax:
|
||||||
|
raise ValueError("Input frequency %g is outside the interpolator domain (%g, %g)."
|
||||||
|
% (freq, self.minomega, self.freqs[self.maxomega]))
|
||||||
|
return qpms_permittivity_interpolator_eps_at_omega(self.interp, freq)
|
||||||
|
|
||||||
|
property freq_interval:
|
||||||
|
def __get__(self):
|
||||||
|
return [self.omegamin, self.omegamax]
|
||||||
|
|
||||||
cdef class TMatrixInterpolator:
|
cdef class TMatrixInterpolator:
|
||||||
'''
|
'''
|
||||||
Wrapper over the qpms_tmatrix_interpolator_t structure.
|
Wrapper over the qpms_tmatrix_interpolator_t structure.
|
||||||
|
|
|
@ -234,6 +234,8 @@ cdef extern from "gsl/gsl_interp.h":
|
||||||
cdef extern from "tmatrices.h":
|
cdef extern from "tmatrices.h":
|
||||||
struct qpms_tmatrix_interpolator_t:
|
struct qpms_tmatrix_interpolator_t:
|
||||||
const qpms_vswf_set_spec_t *bspec
|
const qpms_vswf_set_spec_t *bspec
|
||||||
|
struct qpms_permittivity_interpolator_t:
|
||||||
|
pass
|
||||||
void qpms_tmatrix_interpolator_free(qpms_tmatrix_interpolator_t *interp)
|
void qpms_tmatrix_interpolator_free(qpms_tmatrix_interpolator_t *interp)
|
||||||
qpms_tmatrix_t *qpms_tmatrix_interpolator_eval(const qpms_tmatrix_interpolator_t *interp, double freq)
|
qpms_tmatrix_t *qpms_tmatrix_interpolator_eval(const qpms_tmatrix_interpolator_t *interp, double freq)
|
||||||
qpms_tmatrix_interpolator_t *qpms_tmatrix_interpolator_create(size_t n, double *freqs,
|
qpms_tmatrix_interpolator_t *qpms_tmatrix_interpolator_create(size_t n, double *freqs,
|
||||||
|
@ -266,10 +268,26 @@ cdef extern from "tmatrices.h":
|
||||||
cdouble **tmdata)
|
cdouble **tmdata)
|
||||||
cdouble *qpms_mie_coefficients_reflection(cdouble *target, const qpms_vswf_set_spec_t *bspec,
|
cdouble *qpms_mie_coefficients_reflection(cdouble *target, const qpms_vswf_set_spec_t *bspec,
|
||||||
double a, cdouble k_i, cdouble k_e, cdouble mu_i, cdouble mu_e, qpms_bessel_t J_ext, qpms_bessel_t J_scat)
|
double a, cdouble k_i, cdouble k_e, cdouble mu_i, cdouble mu_e, qpms_bessel_t J_ext, qpms_bessel_t J_scat)
|
||||||
|
qpms_tmatrix_t *qpms_tmatrix_spherical(const qpms_vswf_set_spec_t *bspec, double a,
|
||||||
|
cdouble k_i, cdouble k_e, cdouble mu_i, cdouble mu_e)
|
||||||
qpms_errno_t qpms_tmatrix_spherical_fill(qpms_tmatrix_t *t, double a,
|
qpms_errno_t qpms_tmatrix_spherical_fill(qpms_tmatrix_t *t, double a,
|
||||||
cdouble k_i, cdouble k_e, cdouble mu_i, cdouble mu_e)
|
cdouble k_i, cdouble k_e, cdouble mu_i, cdouble mu_e)
|
||||||
qpms_tmatrix_t *qpms_tmatrix_spherical(const qpms_vswf_set_spec_t *bspec,
|
qpms_tmatrix_t *qpms_tmatrix_spherical(const qpms_vswf_set_spec_t *bspec,
|
||||||
double a, cdouble k_i, cdouble k_e, cdouble mu_i, cdouble mu_e)
|
double a, cdouble k_i, cdouble k_e, cdouble mu_i, cdouble mu_e)
|
||||||
|
cdouble qpms_drude_epsilon(cdouble eps_inf, cdouble omega_p, cdouble gamma_p, cdouble omega)
|
||||||
|
qpms_errno_t qpms_tmatrix_spherical_mu0_fill(qpms_tmatrix_t *t, double a, double omega,
|
||||||
|
cdouble epsilon_fg, cdouble epsilon_bg)
|
||||||
|
qpms_tmatrix_t *qpms_tmatrix_spherical_mu0(const qpms_vswf_set_spec_t *bspec, double a,
|
||||||
|
double omega, cdouble epsilon_fg, cdouble epsilon_bg)
|
||||||
|
qpms_permittivity_interpolator_t *qpms_permittivity_interpolator_create(const size_t incount,
|
||||||
|
cdouble *wavelength_m, cdouble *n, cdouble *k, const gsl_interp_type *iptype)
|
||||||
|
qpms_permittivity_interpolator_t *qpms_permittivity_interpolator_from_yml(const char *path,
|
||||||
|
const gsl_interp_type *iptype)
|
||||||
|
cdouble qpms_permittivity_interpolator_eps_at_omega(const qpms_permittivity_interpolator_t *interp, double omega_SI)
|
||||||
|
double qpms_permittivity_interpolator_omega_max(const qpms_permittivity_interpolator_t *interp)
|
||||||
|
double qpms_permittivity_interpolator_omega_min(const qpms_permittivity_interpolator_t *interp)
|
||||||
|
void qpms_permittivity_interpolator_free(qpms_permittivity_interpolator_t *interp)
|
||||||
|
|
||||||
|
|
||||||
cdef extern from "scatsystem.h":
|
cdef extern from "scatsystem.h":
|
||||||
struct qpms_particle_t:
|
struct qpms_particle_t:
|
||||||
|
|
Loading…
Reference in New Issue