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


Populating the interactive namespace from numpy and matplotlib

Playing with util functions


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)


Play with new fakespikes things


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]:
3

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]:
221

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??


0.0293301830548

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]:
<matplotlib.text.Text at 0x7f95d1546490>

Trying to get my head around xi


In [11]:
%run ../xi_test.py


ERROR: File `u'../xi_test.py'` not found.

In [12]:
hist(states.x[0])


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-12-6c92d0afb1af> in <module>()
----> 1 hist(states.x[0])

NameError: name 'states' is not defined

In [ ]: