feat!: pushes type checking earlier in the docket
All checks were successful
gitea-physics/pyewjn/pipeline/head This commit looks good

This commit is contained in:
2022-03-28 20:01:00 -05:00
parent 71a969aeda
commit d2dd960000
3 changed files with 50 additions and 15 deletions

View File

@@ -27,13 +27,13 @@ class CalculationParams(object):
def __init__(
self,
omega: float = None,
omega_p: float = None,
tau: float = None,
v_f: float = None,
t_rel: float = None,
t_c: float = None,
dipole_moment: float = None,
omega: float,
omega_p: float,
tau: float,
v_f: float,
t_rel: float = 0.8,
t_c: float = 1e-11,
dipole_moment: float = 1,
):
"""Creates parameter object, SI units
@@ -46,6 +46,19 @@ class CalculationParams(object):
:param dipole_moment:
"""
if omega is None:
raise ValueError("omega expected to not be None")
if v_f is None:
raise ValueError("v_f expected to not be None")
if omega_p is None:
raise ValueError("omega_p expected to not be None")
if tau is None:
raise ValueError("tau expected to not be None")
if t_rel is None:
raise ValueError("relative temp expected to not be None")
if t_c is None:
raise ValueError("critical temp expected to not be None")
self.omega = omega
self.omega_p = omega_p
self.tau = tau

View File

@@ -11,14 +11,6 @@ class LindhardDielectric(object):
constants: CalculationConstants = CalculationConstants(),
thres=LINDHARD_SERIES_THRESHOLD,
):
if params.omega is None:
raise ValueError("omega expected to not be None")
if params.v_f is None:
raise ValueError("v_f expected to not be None")
if params.omega_p is None:
raise ValueError("omega_p expected to not be None")
if params.tau is None:
raise ValueError("tau expected to not be None")
self.series_threshold = thres
self.omega = params.omega

View File

@@ -146,3 +146,33 @@ def get_nam_dielectric(
constants.c_light,
)
return coeffs.eps(u_c)
def get_unapproximated_nam_dielectric(
u_c: float,
params: CalculationParams,
constants: CalculationConstants = CalculationConstants(),
):
if params.omega is None:
raise ValueError("omega expected to not be None")
if params.v_f is None:
raise ValueError("v_f expected to not be None")
if params.omega_p is None:
raise ValueError("omega_p expected to not be None")
if params.tau is None:
raise ValueError("tau expected to not be None")
if params.t_rel is None:
raise ValueError("relative temp expected to not be None")
if params.t_c is None:
raise ValueError("critical temp expected to not be None")
sigma_n = params.omega_p**2 * params.tau / (4 * np.pi)
coeffs = get_nam_dielectric_coefficients(
params.omega,
sigma_n,
params.tau,
params.v_f,
params.t_rel * params.t_c,
params.t_c,
constants.c_light,
)
return coeffs.eps(u_c)