コード例 #1
0
ファイル: zero_crossing_tests.py プロジェクト: emd/digidemod
def test_constant():
    # Should detect *no* zero crossings with a constant array
    # Specify `AC_coupled` = False to prevent computation of DC offset,
    # which is only a well-defined operation when there are two or more
    # zero crossings of the same type.
    zc = ZeroCrossing(np.array([1, 1]), 1, auto=False)
    tools.assert_equal(len(zc._getRisingZeroCrossingIndices()), 0)
    tools.assert_equal(len(zc._getRisingZeroCrossingTimesLerp()), 0)
コード例 #2
0
ファイル: zero_crossing_tests.py プロジェクト: emd/digidemod
def test_linear():
    # Should detect *one* rising zero crossing
    # Specify `AC_coupled` = False to prevent computation of DC offset,
    # which is only a well-defined operation when there are two or more
    # zero crossings of the same type.
    zc = ZeroCrossing(np.array([-1, 0, 1]), 1, auto=False)
    tools.assert_equal(zc._getRisingZeroCrossingIndices(), np.array([0]))
    tools.assert_equal(zc._getRisingZeroCrossingTimesLerp(), np.array([1]))