Skip to content
Snippets Groups Projects
Commit f3ea47fb authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME
Browse files

Test with reference arrays

parent 8f6b2c07
Branches
Tags
2 merge requests!54Refactors the score loading and scripts functionality,!50Generic loading input file
Pipeline #
File added
...@@ -35,7 +35,7 @@ def split(filename): ...@@ -35,7 +35,7 @@ def split(filename):
try: try:
columns = numpy.loadtxt(filename) columns = numpy.loadtxt(filename)
neg_pos = columns[:, 0] neg_pos = columns[:, 0]
scores = columns[:, 0] scores = columns[:, 1]
except: except:
LOGGER.error('''Cannot read {}. This file must be a two columns file with LOGGER.error('''Cannot read {}. This file must be a two columns file with
the first column containing -1 or 1 (i.e. negative or the first column containing -1 or 1 (i.e. negative or
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
from nose.tools import assert_equal from nose.tools import assert_equal
import bob.measure.load import bob.measure.load
import bob.io.base.test_utils import bob.io.base.test_utils
import bob.io.base
import numpy
def test_split(): def test_split():
...@@ -22,3 +25,12 @@ def test_split(): ...@@ -22,3 +25,12 @@ def test_split():
assert neg is not None assert neg is not None
assert_equal(len(neg), 521) assert_equal(len(neg), 521)
assert_equal(len(pos), 479) assert_equal(len(pos), 479)
test_ref_file_path = bob.io.base.test_utils.datafile(
'two-cols.hdf5', 'bob.measure')
test_ref = bob.io.base.HDF5File(test_ref_file_path)
neg_ref = test_ref.read('negatives')
pos_ref = test_ref.read('positives')
del test_ref
assert numpy.array_equal(numpy.nan_to_num(neg_ref), numpy.nan_to_num(neg))
assert numpy.array_equal(numpy.nan_to_num(pos_ref), numpy.nan_to_num(pos))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment