[pointprocesses] update exercise

This commit is contained in:
Jan Benda 2018-11-26 19:47:06 +01:00
parent acf7fc8c81
commit 9075fe1be2
3 changed files with 22 additions and 1 deletions

View File

@ -15,7 +15,7 @@
\else
\newcommand{\stitle}{}
\fi
\header{{\bfseries\large Exercise 8\stitle}}{{\bfseries\large Point processes}}{{\bfseries\large November 27th, 2017}}
\header{{\bfseries\large Exercise 8\stitle}}{{\bfseries\large Point processes}}{{\bfseries\large December 3th, 2018}}
\firstpagefooter{Prof. Dr. Jan Benda}{Phone: 29 74573}{Email:
jan.benda@uni-tuebingen.de}
\runningfooter{}{\thepage}{}

View File

@ -0,0 +1,21 @@
import sys
import numpy as np
import scipy.io as io
file = sys.argv[1]
with open(file, 'r') as sf:
x = []
for line in sf:
line = line.strip()
if len(line) > 0 and line[0] != '#':
x.append(float(line))
spikes = np.array(x)*0.001
# break the single spiketrain in trials of 5 seconds:
trials = []
w = 5.0
for t0 in np.arange(0.0, spikes[-1], w):
trials.append(spikes[(spikes>=t0)&(spikes<t0+w)]-t0)
data = {'spikes': trials}
io.savemat(file.replace('.dat', '.mat'), data)

Binary file not shown.