forked from mrahim/post_learning_analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
behavior_plotting.py
35 lines (31 loc) · 1021 Bytes
/
behavior_plotting.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
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 7 16:12:05 2015
@author: mehdi.rahim@cea.fr
"""
import numpy as np
from loader import load_dynacomp, list_of_dicts_to_key_list
import matplotlib.pyplot as plt
# Load dataset
dataset = load_dynacomp()
groups = ['av', 'v', 'avn']
# Behavior data
behav_data = dataset.behavior
# Add deltas
for i in range(len(behav_data)):
for key in ['Thresh', 'RT', 'HIT_RT', 'Perf', 'Conf_mean']:
behav_data[i]['delta' + key] = behav_data[i]['post' + key] - \
behav_data[i]['pre' + key]
# for each behav score
for key in behav_data[0].keys():
scores = []
# for each group
for group in groups:
bd = np.array(behav_data)
scores.append(list_of_dicts_to_key_list(\
bd[dataset.group_indices[group]], key))
plt.figure()
plt.boxplot(scores)
plt.xticks(range(1,4), groups, fontsize=16)
plt.title(key, fontsize=16)
plt.grid(axis='y')