Convenience methods in cymaterials
Former-commit-id: dc27285f1d23c0cda3c9d80fe073aafc86f77277
This commit is contained in:
parent
5a9219a4f6
commit
4bbdfbfbfc
|
@ -9,7 +9,7 @@ cimport cython
|
||||||
import enum
|
import enum
|
||||||
import warnings
|
import warnings
|
||||||
import os
|
import os
|
||||||
from scipy.constants import e as eV, hbar
|
from scipy.constants import e as eV, hbar, c
|
||||||
from libc.stdlib cimport malloc, free, calloc, abort
|
from libc.stdlib cimport malloc, free, calloc, abort
|
||||||
|
|
||||||
class EpsMuGeneratorType(enum.Enum):
|
class EpsMuGeneratorType(enum.Enum):
|
||||||
|
@ -35,6 +35,15 @@ cdef class EpsMu:
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return 'EpsMu(' + repr(self.em.eps) + ', ' + repr(self.em.mu) + ')'
|
return 'EpsMu(' + repr(self.em.eps) + ', ' + repr(self.em.mu) + ')'
|
||||||
|
|
||||||
|
def k(self, omega):
|
||||||
|
return self.n * omega / c
|
||||||
|
property n:
|
||||||
|
def __get__(self):
|
||||||
|
return (self.em.eps * self.em.mu)**.5
|
||||||
|
property Z:
|
||||||
|
def __get__(self):
|
||||||
|
return (self.em.mu / self.em.eps)**.5
|
||||||
|
|
||||||
cdef class LorentzDrudeModel:
|
cdef class LorentzDrudeModel:
|
||||||
def __cinit__(self, eps_inf, omega_p, f_arr, omega_arr, gamma_arr):
|
def __cinit__(self, eps_inf, omega_p, f_arr, omega_arr, gamma_arr):
|
||||||
cdef size_t n = len(omega_arr)
|
cdef size_t n = len(omega_arr)
|
||||||
|
@ -129,6 +138,13 @@ cdef class EpsMuGenerator:
|
||||||
em = self.g.function(omega, self.g.params)
|
em = self.g.function(omega, self.g.params)
|
||||||
return EpsMu(em.eps, em.mu)
|
return EpsMu(em.eps, em.mu)
|
||||||
|
|
||||||
|
def n(self, omega):
|
||||||
|
return self(omega).n
|
||||||
|
def Z(self, omega):
|
||||||
|
return self(omega).Z
|
||||||
|
def k(self, omega):
|
||||||
|
return self(omega).k(omega)
|
||||||
|
|
||||||
cdef qpms_epsmu_generator_t raw(self):
|
cdef qpms_epsmu_generator_t raw(self):
|
||||||
return self.g
|
return self.g
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue