Exemplo n.º 1
0
from __future__ import division

import numpy as np

from src.data_interface import trd

suc = 0

for t in trd.trial_id_list:
    v = trd.get_trial(t).IsAlert.view()
    if v.min() == v.max() == 0:
        suc += 1

print suc/len(trd.trial_id_list)
Exemplo n.º 2
0
import numpy as np
import matplotlib.pyplot as plt

from src.utils2 import get_path
from src.data_interface import trd, L


path = get_path(__file__) + '/..'

for fname in L[2:]:
    for tid in trd.trial_id_list:
        v = trd.get_trial(tid).get_feature(fname).view()
        plt.plot(range(len(v)), v, 'b-', alpha=0.1)
    ax = plt.gca()
    ax.set_xlim(0,1200)
    ax.set_xlabel('Observation number')
    ax.set_ylabel(fname)
    ax.set_title('{0} in 500 trials overlayed'.format(fname))
    plot_path = '{0}/plots/naive_{1}.'.format(path, fname)
    plt.savefig(plot_path + 'png', format='png', dpi=300)
    plt.savefig(plot_path + 'pdf', format='pdf')
    plt.cla()
Exemplo n.º 3
0
import matplotlib.pyplot as plt
import numpy as np

from src.data_interface import trd
from src.utils2 import get_path


path = get_path(__file__) + '/..'

trials = trd.trial_id_list

means = [trd.get_trial(i).get_feature('V1').view().mean() for i in trials]

plt.title('Mean pr. trial of feature V1')
plt.plot(range(len(trials)), means)
plt.gca().set_xticklabels(trials)
plt.savefig('{0}/plots/mean_pr_trial_v1.pdf'.format(path), format="pdf")
plt.cla()
Exemplo n.º 4
0
from json import dump
import numpy as np

from src.data_interface import trd, L
from src.utils import get_path


sess_root = get_path(__file__) + '/..'

features_to_calculate = L[2:]
trials = list(trd.trial_id_list)
calculations = {}

for feature_name in features_to_calculate:
    tmp = {"trial_results": {}}
    for trial_id in trials:
        unique_values = np.unique(
                trd.get_trial(trial_id).get_feature(feature_name).view())
        tmp["trial_results"][trial_id] = unique_values.size
    tmp["max"] = max(tmp["trial_results"].values())
    tmp["min"] = min(tmp["trial_results"].values())
    calculations[feature_name] = tmp

f = open(sess_root + '/src/unique_values_pr_trial.json', 'w')
dump(calculations, f, indent=4)
f.close()