コード例 #1
0
ファイル: test_misc.py プロジェクト: kingjr/pytftb
 def test_altes(self):
     ideal = np.array([
         0.00200822, -0.21928398, 0.66719239, 0.66719239, -0.17666382,
         -0.17009953, -0.038399, -0.00083597
     ])
     actual = misc.altes(8, 0.1, 0.5)
     np.testing.assert_allclose(ideal, actual, atol=1e-8, rtol=1e-8)
コード例 #2
0
ファイル: ambiguity.py プロジェクト: fmarrabal/pytftb
            tau_start, tau_end = -(n - 1) / 2, (n + 1) / 2
        lag = np.arange(tau_start, tau_end)
    taucol = lag.shape[0]

    if n_fbins is None:
        n_fbins = signal.shape[0]

    naf = np.zeros((n_fbins, taucol), dtype=complex)
    for icol in range(taucol):
        taui = lag[icol]
        t = np.arange(abs(taui), n - abs(taui))
        naf[t, icol] = signal[t + taui] * np.conj(signal[t - taui])
    naf = np.fft.fft(naf, axis=0)

    _ix1 = np.arange((n_fbins + (n_fbins % 2)) / 2, n_fbins)
    _ix2 = np.arange((n_fbins + (n_fbins % 2)) / 2)

    _xi1 = -(n_fbins - (n_fbins % 2)) / 2
    _xi2 = ((n_fbins + (n_fbins % 2)) / 2 - 1)
    xi = np.arange(_xi1, _xi2 + 1, dtype=float) / n_fbins
    naf = naf[np.hstack((_ix1, _ix2)), :]
    return naf, lag, xi

if __name__ == '__main__':
    from tftb.generators.misc import altes
    sig = altes(128, 0.1, 0.45)
    waf, tau, theta = wide_band(sig)
    from matplotlib.pyplot import contour, show
    contour(tau, theta, np.abs(waf) ** 2)
    show()
コード例 #3
0
        lag = np.arange(tau_start, tau_end)
    taucol = lag.shape[0]

    if n_fbins is None:
        n_fbins = signal.shape[0]

    naf = np.zeros((n_fbins, taucol), dtype=complex)
    for icol in range(taucol):
        taui = int(lag[icol])
        t = np.arange(abs(taui), n - abs(taui)).astype(int)
        naf[t, icol] = signal[t + taui] * np.conj(signal[t - taui])
    naf = np.fft.fft(naf, axis=0)

    _ix1 = np.arange((n_fbins + (n_fbins % 2)) // 2, n_fbins)
    _ix2 = np.arange((n_fbins + (n_fbins % 2)) // 2)

    _xi1 = -(n_fbins - (n_fbins % 2)) // 2
    _xi2 = ((n_fbins + (n_fbins % 2)) // 2 - 1)
    xi = np.arange(_xi1, _xi2 + 1, dtype=float) / n_fbins
    naf = naf[np.hstack((_ix1, _ix2)), :]
    return naf, lag, xi


if __name__ == '__main__':
    from tftb.generators.misc import altes
    sig = altes(128, 0.1, 0.45)
    waf, tau, theta = wide_band(sig)
    from matplotlib.pyplot import contour, show
    contour(tau, theta, np.abs(waf)**2)
    show()
コード例 #4
0
ファイル: test_misc.py プロジェクト: souravsingh/pytftb
 def test_altes(self):
     ideal = np.array([0.00200822, -0.21928398, 0.66719239, 0.66719239,
                       -0.17666382, -0.17009953, -0.038399, -0.00083597])
     actual = misc.altes(8, 0.1, 0.5)
     np.testing.assert_allclose(ideal, actual, atol=1e-8, rtol=1e-8)