| 47 | | sta = st1_shot.event_triggered_average(st1, display = True, average = True, ylim = [0.,3.]) |
|---|
| | 52 | sta = st1_shot.event_triggered_average(st1, display = True, average = True) |
|---|
| | 53 | |
|---|
| | 54 | |
|---|
| | 55 | # example parameter space range etc. |
|---|
| | 56 | # parameter scan, c vs. jitter |
|---|
| | 57 | |
|---|
| | 58 | |
|---|
| | 59 | def calc_cc(p): |
|---|
| | 60 | rate_independent = (1-p.c)*p.nu |
|---|
| | 61 | rate_shared = p.c*p.nu |
|---|
| | 62 | |
|---|
| | 63 | st1 = sg.poisson_generator(rate=rate_independent, t_stop = p.duration) |
|---|
| | 64 | st2 = sg.poisson_generator(rate=rate_independent, t_stop = p.duration) |
|---|
| | 65 | if p.c >0: |
|---|
| | 66 | st3 = sg.poisson_generator(rate=rate_shared, t_stop = duration) |
|---|
| | 67 | st1.merge(st3.jitter(p.jitter)) |
|---|
| | 68 | st2.merge(st3.jitter(p.jitter)) |
|---|
| | 69 | |
|---|
| | 70 | cc = numpy.correlate(st1.time_histogram(time_bin = 1.0),st2.time_histogram(time_bin = 1.),mode = 'same') |
|---|
| | 71 | corrcoef = numpy.corrcoef(st1.time_histogram(time_bin = 1.0),st2.time_histogram(time_bin = 1.)) |
|---|
| | 72 | return cc, corrcoef[0][1] |
|---|
| | 73 | |
|---|
| | 74 | |
|---|
| | 75 | |
|---|
| | 76 | from NeuroTools.parameters import ParameterSpace |
|---|
| | 77 | from NeuroTools.parameters import ParameterRange |
|---|
| | 78 | |
|---|
| | 79 | p = ParameterSpace({}) |
|---|
| | 80 | p.nu = 20. # Hz |
|---|
| | 81 | p.c = ParameterRange([0.0,0.01,0.1,0.5]) |
|---|
| | 82 | p.jitter = ParameterRange([0.0,1.0,5.0,]) |
|---|
| | 83 | p.duration = 10000. |
|---|
| | 84 | |
|---|
| | 85 | dims, labels = p.parameter_space_dimension_labels() |
|---|
| | 86 | |
|---|
| | 87 | corrcoef_results = numpy.empty(dims) |
|---|
| | 88 | |
|---|
| | 89 | |
|---|
| | 90 | subplot_index = 1 |
|---|
| | 91 | for experiment in p.iter_inner(): |
|---|
| | 92 | index = p.parameter_space_index(experiment) |
|---|
| | 93 | cc, corrcoef = calc_cc(experiment) |
|---|
| | 94 | corrcoef_results[index] = corrcoef |
|---|
| | 95 | subplot_index = (dims[1]*index[0])+index[1] |
|---|
| | 96 | pylab.subplot(dims[0],dims[1],subplot_index+1) |
|---|
| | 97 | pylab.plot(cc) |
|---|
| | 98 | pylab.title(str(index)) |
|---|
| | 99 | # |
|---|
| | 100 | #subplot_index += 1 |
|---|
| | 101 | |
|---|
| | 102 | |
|---|
| | 103 | |
|---|