In [1]:
%%javascript
if($(IPython.toolbar.selector.concat(' > #kill-run-all')).length == 0){
IPython.toolbar.add_buttons_group([
{
'label' : 'kill and run-all',
'icon' : 'fa fa-angle-double-down',
'callback': function(){
IPython.notebook.kernel.restart();
$(IPython.events).one('kernel_ready.Kernel',
function(){IPython.notebook.execute_all_cells();});
}
}
], 'kill-run-all');
}
In [2]:
import seaborn as sns
from foof.util import create_psd
# I did a bad
%pylab inline
In [3]:
from syncological import inputs as util
In [4]:
t = 1
window = 500/1000.
t_min = t - window/2
t_max = t + window/2
stdev = 100/1000. # 100 ms
N = 50
rate = 10
k = N * (rate / 2)
ts, idxs = util.gaussian_impulse(t, t_min, t_max, stdev, N, k, decimals=4)
subplot(211)
plot(ts, idxs, 'o')
xlim(.75, 1.25)
subplot(212)
_ = hist(ts)
In [5]:
from fakespikes import util as futil
In [6]:
x1 = 'ac'
x2 = 'abc'
x1 = [2,4, 1,5,10]
x2 = [1,4, 10]
futil.levenshtein(x2, x1)
Out[6]:
In [7]:
# Practice comparing codes
dt = 1/10000.
ts1, ns1 = util.gaussian_impulse(t, t_min, t_max, stdev, N, k, decimals=4)
ts2, ns2 = util.gaussian_impulse(t, t_min, t_max, stdev, N, k, decimals=4)
ordered1, _ = futil.ts_sort(ns1, ts1)
ordered2, _ = futil.ts_sort(ns2, ts2)
futil.levenshtein(list(ordered1), list(ordered2))
Out[7]:
In [8]:
n_sample = int((t_max - t_min) * (1.0 / dt))
ts1, ns1 = util.gaussian_impulse(t, t_min, t_max, stdev, N, k, decimals=4)
bt, b1 = futil.bin_times(ts1, (t_min, t_max), dt)
subplot(211)
plot(bt, b1, color='k')
subplot(212)
_ = hist(ts1, color='k')
In [13]:
# Fun with kappa
dt = 1/10000.
ts1, ns1 = util.gaussian_impulse(t, t_min, t_max, stdev, N, k, decimals=4)
ts2, ns2 = util.gaussian_impulse(t, t_min, t_max, stdev, N, k, decimals=4)
r = futil.kappa(ns1, ts1, ns1, ts1, (t_min, t_max), dt*10)
print(r)
futil.kappa??
In [10]:
# Fun with fano
dt = 1/10000.
ts1, ns1 = util.gaussian_impulse(t, t_min, t_max, stdev, N, k, decimals=4)
fanos = futil.fano(ns1, ts1)
_ = hist(fanos.values(), color='k')
xlabel("Fano")
ylabel("Counts")
Out[10]:
In [11]:
%run ../xi_test.py
In [12]:
hist(states.x[0])
In [ ]: