コード例 #1
0
ファイル: test_feature.py プロジェクト: yuhongqian/amen
def test_aggregate():
    test_feature = Feature(test_dataframe, aggregate=np.median)
    assert (test_feature.aggregate == np.median)
コード例 #2
0
ファイル: test_feature.py プロジェクト: yuhongqian/amen
from amen.audio import Audio
from amen.feature import Feature
from amen.feature import FeatureCollection
from amen.timing import TimeSlice
from amen.utils import example_audio_file
from amen.exceptions import FeatureError

EXAMPLE_FILE = example_audio_file()
audio = Audio(EXAMPLE_FILE)

test_times = np.linspace(0, 10, num=1000)
test_index = pd.to_timedelta(test_times, unit='s')

test_dataframe = pd.DataFrame(data=audio.analysis_samples[:1000],
                              index=test_index)
test_feature = Feature(test_dataframe)


# Test init
def test_data_validation():
    # Makes sure that we can't pass lousy data.
    assert_raises(AssertionError, Feature, [1, 2, 3])


def test_data():
    assert_frame_equal(test_feature.data, test_dataframe)


def test_default_aggregate():
    assert (test_feature.aggregate == np.mean)
コード例 #3
0
ファイル: test_feature.py プロジェクト: ruohoruotsi/amen
def test_base_validation():
    with pytest.raises(AssertionError):
        f = Feature(test_dataframe, np.mean, [1, 2, 3])
コード例 #4
0
ファイル: test_feature.py プロジェクト: Asudano/amen
from amen.audio import Audio
from amen.feature import Feature
from amen.feature import FeatureCollection
from amen.timing import TimeSlice
from amen.utils import example_audio_file
from amen.exceptions import FeatureError

EXAMPLE_FILE = example_audio_file()
audio = Audio(EXAMPLE_FILE)

test_times = np.linspace(0, 10, num=1000)
test_index = pd.to_timedelta(test_times, unit='s')

test_dataframe = pd.DataFrame(data=audio.analysis_samples[:1000], index=test_index)
test_feature = Feature(test_dataframe)

# Test init
def test_data_validation():
    # Makes sure that we can't pass lousy data.
    assert_raises(AssertionError, Feature, [1, 2, 3])

def test_data():
    assert_frame_equal(test_feature.data, test_dataframe)

def test_default_aggregate():
    assert(test_feature.aggregate == np.mean)

def test_default_base():
    assert(test_feature.base == None)
コード例 #5
0
ファイル: test_feature.py プロジェクト: ruohoruotsi/amen
def test_data_validation():
    with pytest.raises(AssertionError):
        f = Feature([1, 2, 3])