mirror of
https://github.com/vale981/stocproc
synced 2025-03-05 17:51:42 -05:00
changed spline to fcSpline
This commit is contained in:
parent
8392f20951
commit
34778d76e6
2 changed files with 4 additions and 7 deletions
|
@ -44,7 +44,7 @@ import time
|
||||||
from . import method_kle
|
from . import method_kle
|
||||||
from . import method_fft
|
from . import method_fft
|
||||||
from . import stocproc_c
|
from . import stocproc_c
|
||||||
from .tools import ComplexInterpolatedUnivariateSpline
|
import fcSpline
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -105,7 +105,7 @@ class _absStocProc(abc.ABC):
|
||||||
else:
|
else:
|
||||||
if self._interpolator is None:
|
if self._interpolator is None:
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
self._interpolator = ComplexInterpolatedUnivariateSpline(self.t, self._z, k=3)
|
self._interpolator = fcSpline.FCS(x_low=0, x_high=self.t_max, y=self._z)
|
||||||
log.debug("created interpolator [{:.2e}s]".format(time.time() - t0))
|
log.debug("created interpolator [{:.2e}s]".format(time.time() - t0))
|
||||||
return self._interpolator(t)
|
return self._interpolator(t)
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
from scipy.interpolate import InterpolatedUnivariateSpline
|
|
||||||
from scipy.integrate import quad
|
from scipy.integrate import quad
|
||||||
from scipy.optimize import bisect
|
from scipy.optimize import bisect
|
||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from .stocproc_c import auto_correlation as auto_correlation_c
|
from .stocproc_c import auto_correlation as auto_correlation_c
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from warnings import warn
|
from warnings import warn
|
||||||
sys.path.append(os.path.dirname(__file__))
|
sys.path.append(os.path.dirname(__file__))
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.linalg import eigh as scipy_eigh
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
stocproc_key_type = namedtuple(typename = 'stocproc_key_type',
|
stocproc_key_type = namedtuple(typename = 'stocproc_key_type',
|
||||||
|
@ -20,9 +16,10 @@ stocproc_key_type = namedtuple(typename = 'stocproc_key_type',
|
||||||
|
|
||||||
class ComplexInterpolatedUnivariateSpline(object):
|
class ComplexInterpolatedUnivariateSpline(object):
|
||||||
def __init__(self, x, y, k=3):
|
def __init__(self, x, y, k=3):
|
||||||
|
raise DeprecationWarning("use fast cubic Spline (fcSpline) instead")
|
||||||
|
from scipy.interpolate import InterpolatedUnivariateSpline
|
||||||
self.re_spline = InterpolatedUnivariateSpline(x, np.real(y))
|
self.re_spline = InterpolatedUnivariateSpline(x, np.real(y))
|
||||||
self.im_spline = InterpolatedUnivariateSpline(x, np.imag(y))
|
self.im_spline = InterpolatedUnivariateSpline(x, np.imag(y))
|
||||||
|
|
||||||
def __call__(self, t):
|
def __call__(self, t):
|
||||||
return self.re_spline(t) + 1j * self.im_spline(t)
|
return self.re_spline(t) + 1j * self.im_spline(t)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue