-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_bmdiff.py
37 lines (27 loc) · 961 Bytes
/
test_bmdiff.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import numpy as np
import bmdiff
bmdiff.logger.setLevel(logging.INFO)
def test_difference():
print("TESTING DIFFERENCE")
inputbm = bmdiff.read_bm("data/ibm.dat", "k")
filters = [
bmdiff.read_bm(flt, band="k")
for flt in ("data/flt0.dat", "data/flt1.dat")]
expected = np.loadtxt("data/diff.dat")
diff = bmdiff.difference(inputbm, filters, band="k")
for de, ee in zip(diff, expected):
np.testing.assert_array_equal(
np.asarray(de.tolist()), ee)
def test_union():
print("TESTING UNION")
bms = filters = [
bmdiff.read_bm(flt, band="k")
for flt in ("data/union0.dat", "data/union1.dat", "data/union2.dat")]
expected = np.loadtxt("data/union.dat")
union = bmdiff.union(bms, band="k")
for de, ee in zip(union, expected):
np.testing.assert_array_equal(
np.asarray(de.tolist()), ee)