93663c2cc8c0c8bc3c6f28c27679707305948c80,tests/test_texture.py,,test_cooccurence,#,4
Before Change
def test_cooccurence():
cooccurence = mahotas._texture.cooccurence
f = np.array([
[0,1,1,1],
[0,0,1,1],
[2,2,2,2],
])
res = np.zeros((5,5), np.long)
cooccurence(f, res, 0)
assert res[0,0] == 1
assert res[0,1] == 2
assert res[1,0] == 0
assert res[1,1] == 3
assert res[2,2] == 3
assert not np.any(res[2,:2])
assert not np.any(res[:2,2])
res[:3,:3] = 0
assert not np.any(res)
res = np.zeros((5,5), np.long)
cooccurence(f, res, 1)
assert res[0,0] == 1
assert res[0,1] == 0
After Change
f = np.random.rand(32, 32)
f = (f * 255).astype(np.int32)
assert np.all(mahotas.texture.cooccurence(f, 0) == brute_force(f, 0, 1))
assert np.all(mahotas.texture.cooccurence(f, 1) == brute_force(f, 1, 1))
assert np.all(mahotas.texture.cooccurence(f, 2) == brute_force(f, 1, 0))
assert np.all(mahotas.texture.cooccurence(f, 3) == brute_force(f, 1, -1))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: luispedro/mahotas
Commit Name: 93663c2cc8c0c8bc3c6f28c27679707305948c80
Time: 2010-05-11
Author: lpc@cmu.edu
File Name: tests/test_texture.py
Class Name:
Method Name: test_cooccurence
Project Name: pandas-dev/pandas
Commit Name: ff628b17ccfcaf14ceefeb438aafa56d3849937c
Time: 2021-01-19
Author: jorisvandenbossche@gmail.com
File Name: pandas/tests/frame/test_ufunc.py
Class Name:
Method Name: test_binary_input_aligns_index
Project Name: luispedro/mahotas
Commit Name: 93663c2cc8c0c8bc3c6f28c27679707305948c80
Time: 2010-05-11
Author: lpc@cmu.edu
File Name: tests/test_texture.py
Class Name:
Method Name: test_cooccurence
Project Name: pandas-dev/pandas
Commit Name: ff628b17ccfcaf14ceefeb438aafa56d3849937c
Time: 2021-01-19
Author: jorisvandenbossche@gmail.com
File Name: pandas/tests/frame/test_ufunc.py
Class Name:
Method Name: test_binary_input_aligns_columns