Skip to content

Commit 59bf9cb

Browse files
committed
updated L2ROCs unit test
1 parent 5c676d9 commit 59bf9cb

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

conftest.py

-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
import sys, os
33

44
def pytest_sessionstart(session):
5-
print 'testing...'
6-
print os.path.realpath(__file__)
75
sys.path.append(os.path.dirname(__file__))

unit_tests/output/L2ROCs.png

30.2 KB
Loading

unit_tests/prepare.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import os
2-
os.chdir('..')
1+
import os, sys
32

43
import numpy as np
54

@@ -9,8 +8,9 @@
98
from signals import Trajectory
109
from PRFstats.interface import L2ROCs
1110

11+
os.chdir('..')
12+
sys.path.append(os.path.dirname(__file__))
1213

13-
# test_TS #
1414
def prepare_TS():
1515
sig = TimeSeries(
1616
'unit_tests/data/40-clarinet.txt',
@@ -21,7 +21,6 @@ def prepare_TS():
2121
np.save('unit_tests/ref/TS.npy', sig.windows)
2222

2323

24-
# test_Traj #
2524
def prepare_Traj():
2625
sig = Trajectory(
2726
'unit_tests/data/ellipse-test.txt',
@@ -31,8 +30,7 @@ def prepare_Traj():
3130
)
3231
np.save('unit_tests/ref/Traj.npy', sig.windows)
3332

34-
# test_L2MeanPRF_ROCs #
35-
def prepare_L2MeanPRF_ROCs():
33+
def prepare_L2ROCs():
3634
filt_params = dfp.copy()
3735
ts1 = TimeSeries(
3836
'unit_tests/data/40-clarinet.txt',
@@ -59,15 +57,16 @@ def prepare_L2MeanPRF_ROCs():
5957
out = L2ROCs(
6058
traj1, traj2,
6159
'clarinet', 'viol',
62-
'unit_tests/output/L2MeanPRF.png',
60+
'unit_tests/output/L2ROCs.png',
6361
filt_params,
6462
k=(0, 5.01, .1),
6563
load_saved_filts=False,
6664
quiet=True
6765
)
68-
np.save('unit_tests/ref/L2MeanPRF_ROC.npy', out)
66+
np.save('unit_tests/ref/L2ROCs.npy', out)
6967

7068

7169
if __name__ == '__main__':
72-
# prepare_L2MeanPRF_ROCs()
70+
prepare_L2ROCs()
7371
pass
72+

unit_tests/test_all.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_Traj():
3232
assert np.array_equal(sig.windows, np.load('unit_tests/ref/Traj.npy'))
3333

3434

35-
def test_L2MeanPRF_ROCs():
35+
def test_L2ROCs():
3636
filt_params = dfp.copy()
3737
ts1 = TimeSeries(
3838
'unit_tests/data/40-clarinet.txt',
@@ -56,7 +56,7 @@ def test_L2MeanPRF_ROCs():
5656
'num_divisions': 5,
5757
'ds_rate': 120
5858
})
59-
out = L2ROCs(
59+
result = L2ROCs(
6060
traj1, traj2,
6161
'clarinet', 'viol',
6262
'unit_tests/output/L2MeanPRF.png',
@@ -65,4 +65,6 @@ def test_L2MeanPRF_ROCs():
6565
load_saved_filts=False,
6666
quiet=True
6767
)
68-
assert np.array_equal(out, np.load('unit_tests/ref/L2MeanPRF_ROC.npy'))
68+
69+
ref = np.load('unit_tests/ref/L2ROCs.npy')
70+
assert np.array_equal(result, ref)

0 commit comments

Comments
 (0)