forked from sagarjauhari/BCIpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.py
34 lines (29 loc) · 927 Bytes
/
stats.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
"""
@author: sagar jauhari
General statistics of the EEG data
"""
import argparse, os, datetime, shutil, glob, pickle
from os.path import join, isfile
from slicer import Slicer
import process_series_files, kernel_svm, charts_for_paper, eegml, filters
import data_cleaning, stats
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import numpy as np
import re
import pylab
def plot_task_length(slicer, pdfpages):
tasks = slicer.get_tasks()
X = [slicer.get_time_duration_by_taskid(taskid) for taskid in tasks.index ]
#fig, ax = plt.subplots()
#ax.plot(X)
n, bins, patches = plt.hist(X)
plt.plot(bins)
plt.grid(True)
plt.xlabel("Task Duration (seconds)")
plt.ylabel("Task count")
plt.title("Histogram of task duration")
pdfpages.savefig()
def plot_all(slicer, pdfpages):
print "Generating statistics"
plot_task_length(slicer, pdfpages)