mirror of
https://github.com/vale981/stocproc
synced 2025-03-04 17:21:42 -05:00
do not use context managers for pool because that breaks coverage
This commit is contained in:
parent
5b0cfd6046
commit
0bccc3e7dc
2 changed files with 20 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
[tool.poetry]
|
||||
description = "Generate continuous time stationary stochastic processes from a given auto correlation function."
|
||||
name = "stocproc"
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
authors = ["Richard Hartmann <richard.hartmann@tu-dresden.de>"]
|
||||
license = "BSD (3 clause)"
|
||||
classifiers = [
|
||||
|
|
|
@ -215,8 +215,14 @@ def _fourier_sum(tau, x, w, f):
|
|||
def fourier_integral_TanhSinh(f, x_max, n, tau_l, t_max_ts):
|
||||
x, w = get_x_w_and_dt(n, x_max, t_max_ts)
|
||||
_f = partial(_fourier_sum, x=x, w=w, f=f)
|
||||
with Pool() as pool:
|
||||
|
||||
pool = Pool()
|
||||
try:
|
||||
I = pool.map(_f, tau_l)
|
||||
finally:
|
||||
pool.close()
|
||||
pool.join()
|
||||
|
||||
I = np.asarray(I)
|
||||
return I
|
||||
|
||||
|
@ -525,13 +531,23 @@ def get_dt_for_accurate_interpolation(t_max, tol, ft_ref, diff_method=_absDiff):
|
|||
|
||||
ft_ref_n[::2] = ft_ref_n_old
|
||||
|
||||
with Pool() as pool:
|
||||
pool = Pool()
|
||||
try:
|
||||
ft_ref_n_new = np.asarray(pool.map(ft_ref, tau[1::2]))
|
||||
finally:
|
||||
pool.close()
|
||||
pool.join()
|
||||
|
||||
ft_ref_n[1::2] = ft_ref_n_new
|
||||
|
||||
ft_intp = fcSpline.FCS(x_low=0, x_high=t_max, y=ft_ref_n_old)
|
||||
with Pool() as pool:
|
||||
|
||||
pool = Pool()
|
||||
try:
|
||||
ft_intp_n_new = np.asarray(pool.map(ft_intp, tau[1::2]))
|
||||
finally:
|
||||
pool.close()
|
||||
pool.join()
|
||||
|
||||
ft_ref_n_new /= ft_ref_0
|
||||
ft_intp_n_new /= ft_ref_0
|
||||
|
|
Loading…
Add table
Reference in a new issue