[pointprocesses] figures store data
This commit is contained in:
parent
25dd6ac2c7
commit
1fbb04860d
512
pointprocesses/lecture/fanoexamples.json
Normal file
512
pointprocesses/lecture/fanoexamples.json
Normal file
@ -0,0 +1,512 @@
|
||||
{
|
||||
"inh_mean_counts": [
|
||||
0.019790539581079163,
|
||||
0.021220735104578375,
|
||||
0.02275429204781155,
|
||||
0.024398678386941673,
|
||||
0.026161922211558546,
|
||||
0.028052531609684187,
|
||||
0.030079856276940473,
|
||||
0.03225362212552356,
|
||||
0.03458450709147974,
|
||||
0.03708354257703291,
|
||||
0.03976375421436924,
|
||||
0.04263742087823543,
|
||||
0.04571863535977971,
|
||||
0.04902204607381719,
|
||||
0.05256472913103067,
|
||||
0.05636367261148674,
|
||||
0.0604368857915921,
|
||||
0.06480431194823566,
|
||||
0.06948757382321753,
|
||||
0.07450942742688474,
|
||||
0.07989350278152325,
|
||||
0.08566741121673332,
|
||||
0.09185813351157156,
|
||||
0.09849643145101084,
|
||||
0.1056147934678194,
|
||||
0.11324734480864311,
|
||||
0.12143102580779756,
|
||||
0.13020659253898284,
|
||||
0.13961663821201303,
|
||||
0.14970800490188663,
|
||||
0.1605252911975601,
|
||||
0.17212413241254546,
|
||||
0.18456437804263892,
|
||||
0.19789995799916,
|
||||
0.21220566159125026,
|
||||
0.22753926460781382,
|
||||
0.2439823947134826,
|
||||
0.2616159479681675,
|
||||
0.2805253160968419,
|
||||
0.3007888497081712,
|
||||
0.32252843964927147,
|
||||
0.34583202264863167,
|
||||
0.37082786793089234,
|
||||
0.3976331123166566,
|
||||
0.4263584263368811,
|
||||
0.45717090976297187,
|
||||
0.49022046073817194,
|
||||
0.525634827879303,
|
||||
0.5636257476502421,
|
||||
0.6043519423405814,
|
||||
0.6480319601807584,
|
||||
0.6948700842696629,
|
||||
0.7450753012048192,
|
||||
0.7989180460234154,
|
||||
0.8566493506493507,
|
||||
0.9185712959524693,
|
||||
0.984954210631097,
|
||||
1.0561479346781941,
|
||||
1.132442485979169,
|
||||
1.2142488954344623,
|
||||
1.3020331622581918,
|
||||
1.3961408212219557,
|
||||
1.4969813890149797,
|
||||
1.605215768981181,
|
||||
1.7211290883785664,
|
||||
1.845597836224585,
|
||||
1.9788457691538308,
|
||||
2.1220566159125025,
|
||||
2.2752184912603495,
|
||||
2.4396424167694204,
|
||||
2.616049709148599,
|
||||
2.8050609583215196,
|
||||
3.0076771055031926,
|
||||
3.2249429409846755,
|
||||
3.458318769660958,
|
||||
3.708114692653673,
|
||||
3.9759646302250804,
|
||||
4.263189655172414,
|
||||
4.571464879852126,
|
||||
4.901660059464817,
|
||||
5.2558979808714135,
|
||||
5.635698005698005,
|
||||
6.043158216249236,
|
||||
6.4796199213630405,
|
||||
6.9487008426966295,
|
||||
7.450753012048192,
|
||||
7.988529886914378,
|
||||
8.566493506493506,
|
||||
9.185004642525534,
|
||||
9.84835657370518,
|
||||
10.562446581196582,
|
||||
11.324971363115694,
|
||||
12.144840294840295,
|
||||
13.022463768115943,
|
||||
13.963771186440677,
|
||||
14.970075757575758,
|
||||
16.050487012987013,
|
||||
17.211062717770034,
|
||||
18.4544776119403,
|
||||
19.785470941883766
|
||||
],
|
||||
"wins": [
|
||||
0.001,
|
||||
0.0010722672220103231,
|
||||
0.0011497569953977356,
|
||||
0.0012328467394420659,
|
||||
0.0013219411484660286,
|
||||
0.0014174741629268048,
|
||||
0.0015199110829529332,
|
||||
0.0016297508346206436,
|
||||
0.001747528400007683,
|
||||
0.001873817422860383,
|
||||
0.002009233002565048,
|
||||
0.0021544346900318843,
|
||||
0.0023101297000831605,
|
||||
0.0024770763559917113,
|
||||
0.0026560877829466868,
|
||||
0.002848035868435802,
|
||||
0.0030538555088334154,
|
||||
0.0032745491628777285,
|
||||
0.003511191734215131,
|
||||
0.0037649358067924675,
|
||||
0.004037017258596553,
|
||||
0.004328761281083057,
|
||||
0.004641588833612782,
|
||||
0.004977023564332114,
|
||||
0.005336699231206312,
|
||||
0.00572236765935022,
|
||||
0.006135907273413176,
|
||||
0.006579332246575682,
|
||||
0.007054802310718645,
|
||||
0.007564633275546291,
|
||||
0.008111308307896872,
|
||||
0.008697490026177835,
|
||||
0.0093260334688322,
|
||||
0.01,
|
||||
0.010722672220103232,
|
||||
0.011497569953977356,
|
||||
0.012328467394420659,
|
||||
0.013219411484660293,
|
||||
0.014174741629268055,
|
||||
0.01519911082952934,
|
||||
0.016297508346206444,
|
||||
0.01747528400007684,
|
||||
0.01873817422860384,
|
||||
0.02009233002565047,
|
||||
0.021544346900318846,
|
||||
0.023101297000831605,
|
||||
0.024770763559917114,
|
||||
0.026560877829466867,
|
||||
0.02848035868435802,
|
||||
0.030538555088334154,
|
||||
0.03274549162877728,
|
||||
0.03511191734215131,
|
||||
0.037649358067924674,
|
||||
0.04037017258596556,
|
||||
0.04328761281083059,
|
||||
0.046415888336127795,
|
||||
0.049770235643321115,
|
||||
0.0533669923120631,
|
||||
0.05722367659350217,
|
||||
0.06135907273413173,
|
||||
0.06579332246575682,
|
||||
0.07054802310718646,
|
||||
0.07564633275546291,
|
||||
0.08111308307896872,
|
||||
0.08697490026177834,
|
||||
0.093260334688322,
|
||||
0.1,
|
||||
0.10722672220103231,
|
||||
0.11497569953977356,
|
||||
0.12328467394420659,
|
||||
0.13219411484660287,
|
||||
0.14174741629268048,
|
||||
0.1519911082952933,
|
||||
0.16297508346206452,
|
||||
0.1747528400007685,
|
||||
0.1873817422860385,
|
||||
0.2009233002565048,
|
||||
0.21544346900318845,
|
||||
0.23101297000831603,
|
||||
0.24770763559917114,
|
||||
0.26560877829466867,
|
||||
0.2848035868435802,
|
||||
0.30538555088334157,
|
||||
0.32745491628777285,
|
||||
0.3511191734215131,
|
||||
0.37649358067924676,
|
||||
0.40370172585965536,
|
||||
0.4328761281083057,
|
||||
0.4641588833612782,
|
||||
0.49770235643321137,
|
||||
0.5336699231206312,
|
||||
0.572236765935022,
|
||||
0.6135907273413176,
|
||||
0.6579332246575682,
|
||||
0.7054802310718645,
|
||||
0.7564633275546291,
|
||||
0.8111308307896873,
|
||||
0.8697490026177834,
|
||||
0.9326033468832199,
|
||||
1.0
|
||||
],
|
||||
"hom_var_counts": [
|
||||
0.019960203319696106,
|
||||
0.021393729336037434,
|
||||
0.022932883891871352,
|
||||
0.02460887746082514,
|
||||
0.026392310701531273,
|
||||
0.028270118330402827,
|
||||
0.030335779074429487,
|
||||
0.0325266300255233,
|
||||
0.03487371286608718,
|
||||
0.03738351895321295,
|
||||
0.04006364725042021,
|
||||
0.042982849456623985,
|
||||
0.04607171673667813,
|
||||
0.04942672589215484,
|
||||
0.05299875048702153,
|
||||
0.05676125968508563,
|
||||
0.06094132210771772,
|
||||
0.06533329462071842,
|
||||
0.0699800836530626,
|
||||
0.07509261325468682,
|
||||
0.08049070466668483,
|
||||
0.0863264902500648,
|
||||
0.09256732510818605,
|
||||
0.09929794705140856,
|
||||
0.10635752225470883,
|
||||
0.11409908339015139,
|
||||
0.12215470525490818,
|
||||
0.13103073079827432,
|
||||
0.14046578796300208,
|
||||
0.15053394854618773,
|
||||
0.161376552344716,
|
||||
0.17320632409122239,
|
||||
0.1854479584181762,
|
||||
0.1992342039905711,
|
||||
0.2130520968167179,
|
||||
0.22891557004056046,
|
||||
0.24510829435184317,
|
||||
0.262690525233963,
|
||||
0.2819517321984315,
|
||||
0.30219525471471637,
|
||||
0.32440111405400035,
|
||||
0.3473699419132105,
|
||||
0.37233004469004843,
|
||||
0.3997074854978267,
|
||||
0.4276198401514896,
|
||||
0.4587879262250209,
|
||||
0.4925933223410117,
|
||||
0.5303939748774075,
|
||||
0.5665775132005841,
|
||||
0.6078323036788995,
|
||||
0.6521278492455747,
|
||||
0.6981320175428077,
|
||||
0.748376829851074,
|
||||
0.8034705291769709,
|
||||
0.8610126505109857,
|
||||
0.9209880074546468,
|
||||
0.9863885176320218,
|
||||
1.064538648629557,
|
||||
1.1356220694261256,
|
||||
1.2236709364716802,
|
||||
1.308711440361914,
|
||||
1.4017218749177778,
|
||||
1.5082768042423274,
|
||||
1.613459900246843,
|
||||
1.730632084474219,
|
||||
1.866146170041664,
|
||||
1.999911905867173,
|
||||
2.1427070012051805,
|
||||
2.290526398452783,
|
||||
2.468783921904605,
|
||||
2.63572590922397,
|
||||
2.8304855103742974,
|
||||
3.0413196819779444,
|
||||
3.265523783368671,
|
||||
3.4792145182825793,
|
||||
3.7472183384503475,
|
||||
4.009167831957711,
|
||||
4.3096866077394855,
|
||||
4.622408735427651,
|
||||
4.918284448265054,
|
||||
5.310714966639323,
|
||||
5.689521009571992,
|
||||
6.106135800324062,
|
||||
6.555272411232507,
|
||||
7.014325349546841,
|
||||
7.470137804607197,
|
||||
8.005725789877005,
|
||||
8.632000981989899,
|
||||
9.24258607854538,
|
||||
10.018873023841117,
|
||||
10.480787025622112,
|
||||
11.327376110212553,
|
||||
12.21918514449198,
|
||||
13.145470736754136,
|
||||
13.990502709150853,
|
||||
14.832651463496616,
|
||||
16.23873592063434,
|
||||
17.28248824648821,
|
||||
18.361068366771864,
|
||||
19.671988305269288
|
||||
],
|
||||
"hom_mean_counts": [
|
||||
0.019938339876679752,
|
||||
0.021379216428873197,
|
||||
0.022924226327625932,
|
||||
0.024580893321662373,
|
||||
0.026357305456189473,
|
||||
0.028262034359584964,
|
||||
0.03030449955314531,
|
||||
0.03249449958441304,
|
||||
0.03484279213471365,
|
||||
0.037360868554981747,
|
||||
0.04006071906482192,
|
||||
0.04295584693143283,
|
||||
0.046060072630499264,
|
||||
0.049388902650483034,
|
||||
0.05295809738321133,
|
||||
0.05678518332868152,
|
||||
0.06088885767161189,
|
||||
0.06528927514211616,
|
||||
0.07000758421640298,
|
||||
0.07506663955904942,
|
||||
0.08049179268972088,
|
||||
0.08630850345436601,
|
||||
0.09254602166708441,
|
||||
0.0992340311165527,
|
||||
0.10640516597288932,
|
||||
0.11409483153268632,
|
||||
0.12234037331108029,
|
||||
0.13118165668794,
|
||||
0.14066146487378833,
|
||||
0.15082605867134666,
|
||||
0.16172658252490185,
|
||||
0.173412249726025,
|
||||
0.1859465055117229,
|
||||
0.1993829876597532,
|
||||
0.21379262277503752,
|
||||
0.22924322211235543,
|
||||
0.24580703225170136,
|
||||
0.26357375142109296,
|
||||
0.28262034359584964,
|
||||
0.30304444309338524,
|
||||
0.3249437726131882,
|
||||
0.3484236831987697,
|
||||
0.3736067908406101,
|
||||
0.4006088004822182,
|
||||
0.429551428448313,
|
||||
0.4605969597560412,
|
||||
0.4938890265048303,
|
||||
0.5295739481512962,
|
||||
0.5678353745371689,
|
||||
0.6088749083801612,
|
||||
0.6528882048595193,
|
||||
0.7000702247191011,
|
||||
0.7506551204819277,
|
||||
0.80490109002826,
|
||||
0.8630562770562771,
|
||||
0.9254502413665058,
|
||||
0.9923302807087397,
|
||||
1.0640516597288932,
|
||||
1.1409064896417536,
|
||||
1.2233676975945018,
|
||||
1.311764705882353,
|
||||
1.4065824749541413,
|
||||
1.5082387653200182,
|
||||
1.6172452952628165,
|
||||
1.73410751565762,
|
||||
1.85939190449543,
|
||||
1.9938287657531506,
|
||||
2.137926227750375,
|
||||
2.292398804047838,
|
||||
2.4580641183723797,
|
||||
2.6356425171866738,
|
||||
2.8261270201304223,
|
||||
3.030449984797811,
|
||||
3.2494131072709487,
|
||||
3.4841663753932193,
|
||||
3.7360194902548725,
|
||||
4.006028938906752,
|
||||
4.295495689655173,
|
||||
4.6059842883548985,
|
||||
4.93882556987116,
|
||||
5.295722635494156,
|
||||
5.6783760683760685,
|
||||
6.088790470372633,
|
||||
6.5286697247706424,
|
||||
7.000702247191011,
|
||||
7.506551204819277,
|
||||
8.048909531502423,
|
||||
8.63056277056277,
|
||||
9.254549675023213,
|
||||
9.92300796812749,
|
||||
10.638995726495727,
|
||||
11.407617411225658,
|
||||
12.232186732186733,
|
||||
13.116139657444005,
|
||||
14.064265536723164,
|
||||
15.079772727272728,
|
||||
16.171834415584417,
|
||||
17.33806620209059,
|
||||
18.594309701492538,
|
||||
19.935470941883768
|
||||
],
|
||||
"inh_var_counts": [
|
||||
0.01939887412695772,
|
||||
0.020770415508847798,
|
||||
0.02223653424529905,
|
||||
0.023803382881664323,
|
||||
0.025477476034306678,
|
||||
0.02726558707763956,
|
||||
0.029175058521120806,
|
||||
0.03121332598193535,
|
||||
0.03338841895643638,
|
||||
0.0357083534475556,
|
||||
0.03818259806714428,
|
||||
0.040819471221077167,
|
||||
0.04362844174314787,
|
||||
0.04661888507276921,
|
||||
0.04980167838527015,
|
||||
0.053186809024636676,
|
||||
0.056784268624775536,
|
||||
0.06060471310315914,
|
||||
0.06465905090530752,
|
||||
0.06895777265337268,
|
||||
0.07351053099661864,
|
||||
0.07832850587455076,
|
||||
0.08342021682094802,
|
||||
0.08879488444286426,
|
||||
0.09446030886653425,
|
||||
0.10042238369945232,
|
||||
0.10668553178055554,
|
||||
0.11325283579889839,
|
||||
0.12012383254557651,
|
||||
0.12729551816999657,
|
||||
0.13475692208502688,
|
||||
0.14249741545304714,
|
||||
0.15050036839961184,
|
||||
0.15873556462203425,
|
||||
0.16717441877997627,
|
||||
0.17576514766628382,
|
||||
0.18445498578340594,
|
||||
0.1931730437373695,
|
||||
0.201830863123379,
|
||||
0.21031795748427692,
|
||||
0.21851036438512575,
|
||||
0.2262881573054429,
|
||||
0.23352443175061463,
|
||||
0.24005949730146073,
|
||||
0.24614110184846782,
|
||||
0.25151086147060503,
|
||||
0.256572678671552,
|
||||
0.262613148841502,
|
||||
0.26852652926093534,
|
||||
0.2779880237044444,
|
||||
0.2875992769924568,
|
||||
0.30061413340163257,
|
||||
0.318010385895822,
|
||||
0.3371679856134181,
|
||||
0.3603943142746392,
|
||||
0.3867085789298046,
|
||||
0.41553611675673074,
|
||||
0.4479788001866543,
|
||||
0.4853833326477201,
|
||||
0.5268146420274435,
|
||||
0.5721987876880225,
|
||||
0.6246372867879774,
|
||||
0.6859116021649339,
|
||||
0.7509997263178535,
|
||||
0.8247101378233508,
|
||||
0.9059771701065815,
|
||||
0.9942814443067973,
|
||||
1.0962859697738576,
|
||||
1.2063499982608168,
|
||||
1.3357281088787307,
|
||||
1.4713553100633523,
|
||||
1.6261467711646544,
|
||||
1.8179860605307483,
|
||||
1.9939719155576006,
|
||||
2.1634671489979955,
|
||||
2.4287272552114043,
|
||||
2.6598322688454354,
|
||||
2.9126277571340524,
|
||||
3.249051735827017,
|
||||
3.5261320311198183,
|
||||
3.915493906701363,
|
||||
4.277796877460168,
|
||||
4.5997561832753195,
|
||||
5.175141664189715,
|
||||
5.650563621178341,
|
||||
6.2348488305633705,
|
||||
6.63484420387276,
|
||||
7.266704154720004,
|
||||
7.883368454016868,
|
||||
8.6484684146875,
|
||||
9.469711535607642,
|
||||
10.300120990015513,
|
||||
10.744254704223849,
|
||||
11.63882344236306,
|
||||
13.24353210583636,
|
||||
13.670392418503376,
|
||||
13.898749762818095,
|
||||
16.141602354951313,
|
||||
17.3643456226336,
|
||||
19.51580093051825
|
||||
]
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
import os
|
||||
import json
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.ticker as mpt
|
||||
@ -6,7 +8,7 @@ from plotstyle import *
|
||||
|
||||
rate = 20.0
|
||||
trials = 20
|
||||
duration = 100.0
|
||||
duration = 500.0
|
||||
dt = 0.001
|
||||
drate = 50.0
|
||||
tau = 0.1;
|
||||
@ -65,8 +67,7 @@ def oupifspikes(rate, trials, duration, dt, D, drate, tau):
|
||||
return spikes
|
||||
|
||||
|
||||
def plot_count_fano(ax1, ax2, spikes):
|
||||
wins = np.logspace(-2, 0.0, 200)
|
||||
def count_stats(spikes, wins):
|
||||
mean_counts = np.zeros(len(wins))
|
||||
var_counts = np.zeros(len(wins))
|
||||
for k, win in enumerate(wins):
|
||||
@ -76,6 +77,10 @@ def plot_count_fano(ax1, ax2, spikes):
|
||||
counts.extend(c)
|
||||
mean_counts[k] = np.mean(counts)
|
||||
var_counts[k] = np.var(counts)
|
||||
return mean_counts, var_counts
|
||||
|
||||
|
||||
def plot_count_fano(ax1, ax2, wins, mean_counts, var_counts):
|
||||
ax1.plot(mean_counts, var_counts, zorder=100, **lsA)
|
||||
ax1.set_xlabel('Mean count')
|
||||
ax1.set_xlim(0.0, 20.0)
|
||||
@ -92,37 +97,47 @@ def plot_count_fano(ax1, ax2, spikes):
|
||||
ax2.set_yticks(np.arange(0.0, 1.2, 0.5))
|
||||
|
||||
|
||||
def plot_fano(ax, spikes):
|
||||
wins = np.logspace(-2, 0.0, 200)
|
||||
mean_counts = np.zeros(len(wins))
|
||||
var_counts = np.zeros(len(wins))
|
||||
for k, win in enumerate(wins):
|
||||
counts = []
|
||||
for times in spikes:
|
||||
c, _ = np.histogram(times, np.arange(0.0, duration, win))
|
||||
counts.extend(c)
|
||||
mean_counts[k] = np.mean(counts)
|
||||
var_counts[k] = np.var(counts)
|
||||
def plot_fano(ax, wins, mean_counts, var_counts):
|
||||
ax.plot(1000.0*wins, var_counts/mean_counts, **lsB)
|
||||
ax.set_xlabel('Window', 'ms')
|
||||
ax.set_ylim(0.0, 1.2)
|
||||
ax.set_xscale('log')
|
||||
ax.set_xticks([10, 100, 1000])
|
||||
ax.set_xticklabels(['10', '100', '1000'])
|
||||
ax.set_xticks([1, 10, 100, 1000])
|
||||
ax.set_xticklabels(['1', '10', '100', '1000'])
|
||||
ax.xaxis.set_minor_locator(mpt.NullLocator())
|
||||
ax.set_yticks(np.arange(0.0, 1.2, 0.5))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not os.path.exists('fanoexamples.json'):
|
||||
homspikes = hompoisson(rate, trials, duration)
|
||||
inhspikes = oupifspikes(rate, trials, duration, dt, 0.3, drate, tau)
|
||||
wins = np.logspace(-3, 0.0, 100)
|
||||
hom_mean_counts, hom_var_counts = count_stats(homspikes, wins)
|
||||
inh_mean_counts, inh_var_counts = count_stats(inhspikes, wins)
|
||||
with open('fanoexamples.json', 'w') as df:
|
||||
json.dump({'wins': wins.tolist(),
|
||||
'hom_mean_counts': hom_mean_counts.tolist(),
|
||||
'hom_var_counts': hom_var_counts.tolist(),
|
||||
'inh_mean_counts': inh_mean_counts.tolist(),
|
||||
'inh_var_counts': inh_var_counts.tolist()}, df, indent=4)
|
||||
else:
|
||||
with open('fanoexamples.json', 'r') as sf:
|
||||
data = json.load(sf)
|
||||
wins = np.array(data['wins'])
|
||||
hom_mean_counts = np.array(data['hom_mean_counts'])
|
||||
hom_var_counts = np.array(data['hom_var_counts'])
|
||||
inh_mean_counts = np.array(data['inh_mean_counts'])
|
||||
inh_var_counts = np.array(data['inh_var_counts'])
|
||||
fig, (ax1, ax2) = plt.subplots(1, 2)
|
||||
fig.subplots_adjust(**adjust_fs(fig, top=0.5, right=2.0))
|
||||
plot_fano(ax1, homspikes)
|
||||
plot_fano(ax1, wins, hom_mean_counts, hom_var_counts)
|
||||
ax1.set_ylabel('Fano factor')
|
||||
ax1.text(0.1, 0.95, 'Poisson', transform=ax1.transAxes)
|
||||
plot_fano(ax2, inhspikes)
|
||||
ax2.axhline(1.0, **lsGrid)
|
||||
plot_fano(ax2, wins, inh_mean_counts, inh_var_counts)
|
||||
ax2.annotate('', xy=(45.0, 0.0), xytext=(45.0, 0.4), arrowprops=dict(arrowstyle="->"))
|
||||
ax2.text(60.0, 0.25, 'most\nreliable', va='center')
|
||||
ax2.text(0.1, 0.95, 'OU noise', transform=ax2.transAxes)
|
||||
plt.savefig('fanoexamples.pdf')
|
||||
plt.close()
|
||||
|
398126
pointprocesses/lecture/serialcorrexamples.json
Normal file
398126
pointprocesses/lecture/serialcorrexamples.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,5 @@
|
||||
import os
|
||||
import json
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from plotstyle import *
|
||||
@ -5,7 +7,7 @@ from plotstyle import *
|
||||
|
||||
# parameter:
|
||||
rate = 20.0
|
||||
trials = 10
|
||||
trials = 20
|
||||
duration = 500.0
|
||||
dt = 0.001
|
||||
drate = 50.0
|
||||
@ -91,41 +93,59 @@ def plotserialcorr(ax, isis, maxlag=10) :
|
||||
ax.set_xlim(0.0, maxlag)
|
||||
ax.set_ylim(-1.0, 1.0)
|
||||
ax.plot([0, 10], [0.0, 0.0], **lsGrid)
|
||||
ax.plot(lags, corr, clip_on=False, zorder=100, **lpsAm)
|
||||
ax.plot(lags, corr, clip_on=False, zorder=100, **lpsBm)
|
||||
|
||||
|
||||
def plot_hom_returnmap(ax, spikes):
|
||||
plotreturnmap(ax, isis(spikes)[:200], 1, 0.3)
|
||||
def plot_hom_returnmap(ax, isis):
|
||||
plotreturnmap(ax, isis[:200], 1, 0.3)
|
||||
ax.set_xticks(np.arange(0.0, 301.0, 100.0))
|
||||
ax.set_yticks(np.arange(0.0, 301.0, 100.0))
|
||||
|
||||
|
||||
def plot_inhom_returnmap(ax, spikes):
|
||||
plotreturnmap(ax, isis(spikes)[:200], 1, 0.3)
|
||||
def plot_inhom_returnmap(ax, isis):
|
||||
plotreturnmap(ax, isis[:200], 1, 0.3)
|
||||
ax.set_ylabel('')
|
||||
ax.set_xticks(np.arange(0.0, 301.0, 100.0))
|
||||
ax.set_yticks(np.arange(0.0, 301.0, 100.0))
|
||||
|
||||
|
||||
def plot_hom_serialcorr(ax, spikes):
|
||||
plotserialcorr(ax, isis(spikes))
|
||||
def plot_hom_serialcorr(ax, isis):
|
||||
plotserialcorr(ax, isis)
|
||||
ax.annotate('independent\nintervals', xy=(2.5, 0.05), xytext=(4.0, 0.4),
|
||||
arrowprops=dict(arrowstyle="->", relpos=(0.0,0.0),
|
||||
connectionstyle="angle3,angleA=20,angleB=70"))
|
||||
ax.set_ylim(-0.2, 1.0)
|
||||
|
||||
|
||||
def plot_inhom_serialcorr(ax, spikes):
|
||||
plotserialcorr(ax, isis(spikes))
|
||||
def plot_inhom_serialcorr(ax, isis):
|
||||
plotserialcorr(ax, isis)
|
||||
ax.annotate('positive\ncorrelations', xy=(1.5, 0.28), xytext=(3.5, 0.5),
|
||||
arrowprops=dict(arrowstyle="->", relpos=(0.0,0.4),
|
||||
connectionstyle="angle3,angleA=20,angleB=60"))
|
||||
ax.set_ylabel('')
|
||||
ax.set_ylim(-0.2, 1.0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
data_file = 'serialcorrexamples.json'
|
||||
if not os.path.exists(data_file):
|
||||
homspikes = hompoisson(rate, trials, duration)
|
||||
inhomspikes = oupifspikes(rate, trials, duration, dt, 0.3, drate, tau)
|
||||
homisis = isis(homspikes)
|
||||
inhomisis = isis(inhomspikes)
|
||||
with open(data_file, 'w') as df:
|
||||
json.dump({'homisis': homisis.tolist(),
|
||||
'inhomisis': inhomisis.tolist()}, df, indent=4)
|
||||
else:
|
||||
with open(data_file, 'r') as sf:
|
||||
data = json.load(sf)
|
||||
homisis = np.array(data['homisis'])
|
||||
inhomisis = np.array(data['inhomisis'])
|
||||
fig, axs = plt.subplots(2, 2, figsize=cm_size(figure_width, 1.8*figure_height))
|
||||
fig.subplots_adjust(**adjust_fs(fig, left=6.5, right=1.5))
|
||||
plot_hom_returnmap(axs[0,0], homspikes)
|
||||
plot_inhom_returnmap(axs[0,1], inhomspikes)
|
||||
plot_hom_serialcorr(axs[1,0], homspikes)
|
||||
plot_inhom_serialcorr(axs[1,1], inhomspikes)
|
||||
plot_hom_returnmap(axs[0,0], homisis)
|
||||
plot_inhom_returnmap(axs[0,1], inhomisis)
|
||||
plot_hom_serialcorr(axs[1,0], homisis)
|
||||
plot_inhom_serialcorr(axs[1,1], inhomisis)
|
||||
plt.savefig('serialcorrexamples.pdf')
|
||||
plt.close()
|
||||
|
Reference in New Issue
Block a user