Commit 4f990b3e authored by lucas_miranda's avatar lucas_miranda
Browse files

Refactored single_behaviour_analysis and added tests

parent 6b10609e
......@@ -643,7 +643,17 @@ def single_behaviour_analysis(
if stat_tests:
stat_dict = {}
for i in combinations(treatment_dict.keys(), 2):
stat_dict[i] = stats.mannwhitneyu(beh_dict[i[0]], beh_dict[i[1]])
# Solves issue with automatically generated examples
if (
beh_dict[i[0]] == beh_dict[i[1]]
or np.var(beh_dict[i[0]]) == 0
or np.var(beh_dict[i[1]]) == 0
):
stat_dict[i] = "Identical sources. Couldn't run"
else:
stat_dict[i] = stats.mannwhitneyu(
beh_dict[i[0]], beh_dict[i[1]], alternative="two-sided"
)
return_list.append(stat_dict)
return return_list
......
......@@ -593,8 +593,6 @@ def test_single_behaviour_analysis(sampler):
values=data_frames(
index=range_indexes(min_size=50, max_size=50),
columns=columns(behaviours, dtype=bool),
).map(
lambda x: 0 * x + np.array(np.random.randint(0, 2, x.shape), dtype=bool)
),
)
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment