adding zeta stuff

This commit is contained in:
2020-07-14 08:22:18 -05:00
parent 8b8a06490a
commit ab61ba5713
7 changed files with 51 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
import numpy as np
from numpy.lib.scimath import sqrt as csqrt
import pynam.util.complex_quad
import pynam.util
def g(w, wp):
@@ -35,7 +35,7 @@ def i2(w, wp, k, v):
def a(w, k, v, t):
return pynam.util.complex_quad.complex_quad(
return pynam.util.complex_quad(
lambda wp: np.tanh((w + wp) / (2 * t)) * (i1(w, wp, k, v)),
1 - w, 1
)[0]
@@ -46,7 +46,7 @@ def b_int(wp, w, k, v, t):
def b(w, k, v, t, b_max=np.inf):
return pynam.util.complex_quad.complex_quad(
return pynam.util.complex_quad(
lambda wp: b_int(wp, w, k, v, t), 1, b_max
)[0]

View File

@@ -41,7 +41,7 @@ def i2(w, wp, k, v):
def a(w, k, v, t):
result = pynam.util.complex_quad.complex_quad(
result = pynam.util.complex_quad(
lambda wp: np.tanh((w + wp) / (2 * t)) * (i1(w, wp, k, v)),
1 - w, 1,
epsabs=1e-10

View File

@@ -12,7 +12,7 @@ def get_zeta_p_integrand(eps: Callable[[float], complex]) -> Callable[[float, fl
:param eps:
:return:
"""
def zeta_p_integrand(u: float, y: float) -> complex:
def zeta_p_integrand(y: float, u: float) -> complex:
"""
Here y and u are in units of vacuum wavelength, coming from Ford-Weber / from the EWJN noise expressions.
:param u:
@@ -31,15 +31,15 @@ def get_zeta_p_integrand(eps: Callable[[float], complex]) -> Callable[[float, fl
return zeta_p_integrand
# def get_zeta_p_function(eps: Callable[[float], complex]):
# def zeta_p(u: float) -> complex:
# zeta_p_integrand = get_zeta_integrand(eps)
#
# integral_result = pynam.util.complex_quad(zeta_p_integrand, 0, np.inf)
#
# print(integral_result)
# integral = integral_result[0]
#
# return integral * 2j
#
# return zeta_p
def get_zeta_p_function(eps: Callable[[float], complex]):
def zeta_p(u: float) -> complex:
zeta_p_integrand = get_zeta_p_integrand(eps)
integral_result = pynam.util.complex_quad(lambda y: zeta_p_integrand(y, u), 0, np.inf)
print(integral_result)
integral = integral_result[0]
return integral * 2j
return zeta_p

View File

@@ -1 +1 @@
from pynam.util.complex_quad import complex_quad, complex_quadrature
from pynam.util.complex_integrate import complex_quad, complex_quadrature

View File

@@ -15,6 +15,7 @@ def complex_quad(func, a, b, **kwargs):
return real_integral[0] + 1j * imag_integral[0], real_integral[1:], imag_integral[1:]
def complex_quadrature(func, a, b, **kwargs):
def real_func(x):