

def itilbert(x, h, period=None, _cache=_cache):
    '\n    Return inverse h-Tilbert transform of a periodic sequence x.\n\n    If ``x_j`` and ``y_j`` are Fourier coefficients of periodic functions x\n    and y, respectively, then::\n\n      y_j = -sqrt(-1)*tanh(j*h*2*pi/period) * x_j\n      y_0 = 0\n\n    For more details, see `tilbert`.\n\n    '
    tmp = asarray(x)
    if iscomplexobj(tmp):
        return (itilbert(tmp.real, h, period) + (1j * itilbert(tmp.imag, h, period)))
    if (period is not None):
        h = (((h * 2) * pi) / period)
    n = len(x)
    omega = _cache.get((n, h))
    if (omega is None):
        if (len(_cache) > 20):
            while _cache:
                _cache.popitem()

        def kernel(k, h=h):
            if k:
                return (- tanh((h * k)))
            return 0
        omega = convolve.init_convolution_kernel(n, kernel, d=1)
        _cache[(n, h)] = omega
    overwrite_x = _datacopied(tmp, x)
    return convolve.convolve(tmp, omega, swap_real_imag=1, overwrite_x=overwrite_x)

dataset/ETHPy150Open scipy/scipy/scipy/fftpack/pseudo_diffs.py itilbert/original