-
Notifications
You must be signed in to change notification settings - Fork 11
/
conftest.py
71 lines (51 loc) · 1.22 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import numpy
import scipy
import pytest
import mdct
import mdct.slow
import random as rand
import functools
@pytest.fixture
def random():
rand.seed(0)
numpy.random.seed(0)
@pytest.fixture(params=(5, 6))
def length(request):
return request.param
@pytest.fixture
def N(length):
# must be multiple of 1024 b/c of stft
return length * 1024
@pytest.fixture
def sig(N, random):
return numpy.random.rand(N)
@pytest.fixture(params=(256, 1024, 2048))
def framelength(request):
return request.param
@pytest.fixture
def backsig(N, random, odd):
if odd:
return numpy.random.rand(N)
else:
return numpy.random.rand(N + 1)
@pytest.fixture
def spectrum(framelength, random, length, odd):
if odd:
return numpy.random.rand(framelength // 2, length * 2 + 1)
else:
return numpy.random.rand(framelength // 2 + 1, length * 2 + 1)
@pytest.fixture(params=(
mdct.fast,
mdct.slow,
))
def module(request):
return request.param
@pytest.fixture(params=(True, False))
def odd(request):
return request.param
@pytest.fixture(params=(
scipy.signal.cosine,
functools.partial(mdct.windows.kaiser_derived, beta=4.)
))
def window(request):
return request.param