Hippocampal criticality tracks cognitive demand and shifts with memory impairment.
The 3 matches
- [1] § Results › Scopolamine-induced memory impairment drives system dynamics away from criticality ↔ DCC&Powerlaws.ipynb, lines 1399 to 1477 · score 0.70 · truncated lognormal, truncated exponential, SEM KS, power law, Saline, Scopolamine · Report a mismatch
- [2] § Results › Scopolamine-induced memory impairment drives system dynamics away from criticality ↔ Paper_Plotting_NOR &Criticality_Stats.ipynb, lines 463 to 490 · score 0.60 · post hoc, SC Error, criticality metrics, Tukey, saline, scopolamine · Report a mismatch
- [3] § Methods › Statistics and reproducibility ↔ Paper_Plotting_NOR &Criticality_Stats.ipynb, lines 1734 to 1883 · score 0.53 · collapse error, branching ratio, SCE, metrics, DCC, exponents · Report a mismatch
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Jupyter notebook · 1,890 lines · 51 KB · no license · 2 matches
- # %%
- import numpy as np
- # %%
- # importing package
- import seaborn as sns
- import matplotlib.pyplot as plt
- import numpy as np
- # create data
- x = np.arange(3)
- y1 = [0.29775,0.97683,0.0473125]
- y2 = [1.11475,0.91821,0.2634875]
- y3 = [1.35583,0.83182,0.26775908]
- error1 = [0.076045041, 0.014, 0.013879423]
- error2 = [0.182575792, 0.012, 0.035637472]
- error3 = [0.416945274,0.159,0.038049697]
- DCC_NOR = [0.41,0.151,0.087,0.079,0.728,0.29,0.243,0.394]
- DCC_Cage = [0.965,1.995,1.799,0.515,0.819,1.145,0.807,0.873]
- BR_NOR =[0.9998,0.9093,0.9998,0.90494,0.99867,0.99432,0.9998,0.99801]
- BR_Cage = [0.93821,0.90995,0.87027,0.90995,0.98629,0.90978,0.89195,0.92929]
- SCE_NOR =[0.13,0.018,0.069,0.0518,0.0358,0.014,0.0502,0.011]
- SCE_Cage = [0.2028,0.2346,0.1928,0.2128,0.2289,0.1879,0.4072,0.4409]
- DCC_Scopolamine= [0.308,2.948,0.946,0.881,0.774,2.278]
- BR_Scopolamine = [0.85568,0.62586,0.93741,0.98936,0.97951,0.6031]
- SCE_Scopolamine = [0.27286709,0.36076511,0.093427,0.2603256,0.28944217,0.32972748]
- width = 0.25
- sns.set(font_scale=1.2)
- fig, ax = plt.subplots(figsize=(5,5))
- # ax = fig.add_subplot(111)
- # plot data in grouped manner of bar type
- ## EE3B3B for red instead of purple bar
- plt.bar(x-0.25, y1, width, yerr=error1, color='c', capsize=5,alpha=0.9, ecolor='k',)
- plt.bar(x, y2, width, yerr=error2, color='orange', capsize=5,alpha=0.9, ecolor='k',)
- plt.bar(x+0.25, y3, width, yerr=error3, color='#CD6090', capsize=5,alpha=0.9, ecolor='k',)
- # raw values for scatter
- raw_nor = [DCC_NOR, BR_NOR, SCE_NOR]
- raw_cage = [DCC_Cage, BR_Cage, SCE_Cage]
- raw_scop = [DCC_Scopolamine, BR_Scopolamine, SCE_Scopolamine]
- plt.legend(["NOR(Saline)", "Cage","NOR(Scopolamine)"],fontsize=11)
- rng = np.random.default_rng(42)
- def add_scatter(ax, xpos, raw_data, color):
- for i, vals in enumerate(raw_data):
- vals = np.asarray(vals)
- jitter = rng.uniform(-0.04, 0.04, size=len(vals))
- ax.scatter(
- np.full(len(vals), xpos[i]) + jitter,
- vals,
- s=28,
- color=color,
- alpha = 0.7,
- edgecolor='black',
- linewidth=0.4,
- zorder=5
- )
- add_scatter(ax, x - 0.25, raw_nor, 'c')
- add_scatter(ax, x, raw_cage, 'orange')
- add_scatter(ax, x + 0.25, raw_scop, '#CD6090')
- plt.xticks(x+0.025, ['DCC', 'BR', 'SC Error'],fontsize=12)
- # plt.xlabel("Criticality Metrics",fontsize=14)
- plt.ylabel("Average Metrics",fontsize=14)
- xticklabels = ['DCC', 'BR', 'SC error']
- ax.set_xticklabels(xticklabels, rotation = 45)
- plt.savefig('Miniscope_Criticality_BarPlot.pdf', bbox_inches='tight')
- plt.show()
- # %%
- import numpy as np
- import pandas as pd
- import seaborn as sns
- import matplotlib.pyplot as plt
- DCC_NOR = [0.41, 0.151, 0.087, 0.079, 0.728, 0.29, 0.243, 0.394]
- DCC_Cage = [0.965, 1.995, 1.799, 0.515, 0.819, 1.145, 0.807, 0.873]
- BR_NOR = [0.9998, 0.9093, 0.9998, 0.90494, 0.99867, 0.99432, 0.9998, 0.99801]
- BR_Cage = [0.93821, 0.90995, 0.87027, 0.90995, 0.98629, 0.90978, 0.89195, 0.92929]
- SCE_NOR = [0.13, 0.018, 0.069, 0.0518, 0.0358, 0.014, 0.0502, 0.011]
- SCE_Cage = [0.2028, 0.2346, 0.1928, 0.2128, 0.2289, 0.1879, 0.4072, 0.4409]
- DCCs = np.concatenate([DCC_NOR, DCC_Cage])
- BRs = np.concatenate([BR_NOR, BR_Cage])
- SCEs = np.concatenate([SCE_NOR, SCE_Cage])
- df = pd.DataFrame()
- df["DCC"] = DCCs
- df["BR"] = BRs
- df["SCE"] = SCEs
- df["group_name"] = ["NOR"] * 8 + ["Cage"] * 8
- sns.set(style="darkgrid", font_scale=1.2)
- palette = ['#00CED1', '#FF7F00']
- fig, ax = plt.subplots(figsize=(3.5, 3.5))
- sns.boxplot(
- data=df,
- x="group_name",
- y="DCC",
- palette=palette,
- showfliers=False,
- showmeans=True,
- meanprops={
- "marker": "^",
- "markerfacecolor": "black",
- "markeredgecolor": "black",
- "markersize": "5"
- },
- ax=ax
- )
- sns.stripplot(
- data=df,
- x="group_name",
- y="DCC",
- palette=palette,
- jitter=0.15,
- size=6,
- alpha=0.7,
- edgecolor="black",
- linewidth=0.5,
- ax=ax
- )
- ax.set_title('')
- ax.set_xlabel('')
- ax.set_ylabel("DCC", fontsize=16)
- ax.set_xticklabels(["NOR", "Cage"], fontsize=14)
- ax.grid(False)
- # Plot t-test annotation
- y_annot, h, col = 2.05, 0.05, 'k'
- x00, x01 = 0, 1
- ax.plot([x00, x00, x01, x01], [y_annot - 0.05, y_annot + h, y_annot + h, y_annot - 0.05], lw=1.5, c=col)
- ax.text((x00 + x01) / 2, y_annot + h + 0.01, "***", ha='center', va='bottom', color=col, fontsize=18)
- ax.set_ylim([-0.05, 2.25])
- plt.tight_layout()
- plt.savefig('DCC.pdf', bbox_inches='tight')
- plt.show();
- # %%
- x = df['group_name']
- y = df['BR']
- sns.set(style="darkgrid")
- palette = ['#00CED1','#FF7F00']#sns.color_palette("Set2")
- ax = sns.boxplot(data=df, x=x, y=y, palette=palette, showfliers=False, showmeans = True,
- meanprops={"markerfacecolor":"black",
- "markeredgecolor":"black",
- "markersize":"5"})
- sns.stripplot(
- data=df,
- x="group_name",
- y="BR",
- palette=palette,
- jitter=0.15,
- size=6,
- alpha=0.7,
- edgecolor="black",
- linewidth=0.5,
- ax=ax
- )
- ax.set_title('')
- ax.set_xlabel('')
- ax.grid(False)
- # ax.set_xlabel("X Label",fontsize=30)
- ax.set_ylabel("BR",fontsize=16)
- ax.set_xticklabels(["NOR",'Cage'],fontsize=14)
- #Plot t-test between groups
- y, h, col = 1.01, 0.01, 'k'
- x00, x01 = 0, 1
- plt.plot([x00, x00, x01, x01], [y, y+h, y+h, y-0.05], lw=1.5, c=col)
- plt.text(((x00 + x01)/2), y-0.007+ h, "**", ha='center', va='bottom', color=col, fontsize=18)
- # ax.set_ylim([0.85, 1.05])
- sns.set(rc={'figure.figsize':(3.5,3.5)})
- plt.tight_layout()
- plt.savefig('BR.pdf')
- plt.show
- # %%
- x = df['group_name']
- y = df['SCE']
- sns.set(style="darkgrid")
- palette = ['#00CED1','#FF7F00']#sns.color_palette("Set2")
- ax = sns.boxplot(data=df, x=x, y=y, palette=palette, showfliers=False, showmeans = True,
- meanprops={"markerfacecolor":"black",
- "markeredgecolor":"black",
- "markersize":"5"})
- sns.stripplot(
- data=df,
- x="group_name",
- y="SCE",
- palette=palette,
- jitter=0.15,
- size=6,
- alpha=0.7,
- edgecolor="black",
- linewidth=0.5,
- ax=ax
- )
- sns.set(font_scale=4)
- ax.set_title('')
- ax.set_xlabel('')
- ax.grid(False)
- ax.set_ylabel("SC error",fontsize=16)
- ax.set_xticklabels(["NOR",'Cage'],fontsize=14)
- #Plot t-test between groups
- y, h, col =0.3, 0.02, 'k'
- x00, x01 = 0, 1
- plt.plot([x00, x00, x01, x01], [y-0.2, y+h, y+h, y], lw=1.5, c=col)
- plt.text(((x00 + x01)/2), y-0.01+ h, "****", ha='center', va='bottom', color=col, fontsize=18)
- # ax.set_ylim([-0.05, 1.6])
- sns.set(rc={'figure.figsize':(3.5,3.5)})
- plt.tight_layout()
- plt.savefig('SCE.pdf')
- plt.show
- # %%
- # %%
- # %%
- # %% [markdown]
- # ## Stats:
- # %%
- import scipy
- from scipy import stats, optimize, interpolate
- from scipy.stats import alexandergovern
- from scipy.stats import f_oneway
- # %% [markdown]
- # ### One way ANOVA test on samples with different sizes (Testing the NULL hypothesis that the two sample means are equal)
- # %%
- DCC_NOR = [0.41,0.151,0.087,0.079,0.728,0.29,0.243,0.394]
- DCC_Cage = [0.965,1.995,1.799,0.515,0.819,1.145,0.807,0.873]
- DCC_Scopolamine= [0.308,2.948,0.946,0.881,0.774,2.278]
- BR_NOR =[0.9998,0.9093,0.9998,0.91494,0.99867,0.99432,0.9998,0.99801]
- BR_Cage = [0.93821,0.90995,0.87027,0.90995,0.98629,0.90978,0.89195,0.92929]
- BR_Scopolamine = [0.85568,0.62586,0.93741,0.98936,0.97951,0.6031]
- SCE_NOR =[0.13,0.018,0.069,0.0518,0.0358,0.014,0.0502,0.011]
- SCE_Cage = [0.2028,0.2346,0.1928,0.2128,0.2289,0.1879,0.4072,0.4409]
- SCE_Scopolamine = [0.27286709,0.36076511,0.093427,0.2603256,0.28944217,0.32972748]
- DCCs = np.concatenate([DCC_NOR,DCC_Cage,DCC_Scopolamine])
- BRs = np.concatenate([BR_NOR,BR_Cage,BR_Scopolamine])
- SCEs = np.concatenate([SCE_NOR,SCE_Cage,SCE_Scopolamine])
- # %%
- # %%
- f_oneway(DCC_NOR,DCC_Cage)
- # %%
- f_oneway(DCC_NOR,DCC_Scopolamine)
- # %%
- f_oneway(DCC_Cage,DCC_Scopolamine)
- # %%
- # %%
- f_oneway(BR_NOR,BR_Cage)
- # %%
- f_oneway(BR_NOR,BR_Scopolamine)
- # %%
- f_oneway(BR_Cage,BR_Scopolamine)
- # %%
- # %%
- f_oneway(SCE_NOR,SCE_Cage)
- # %%
- f_oneway(SCE_NOR,SCE_Scopolamine)
- # %%
- f_oneway(SCE_Cage,SCE_Scopolamine)
- # %%
- # %%
- # %%
- # %% [markdown]
- # ## Post hoc
- # %%
- import pandas as pd
- df = pd.DataFrame()
- df['DCC'] = DCCs
- df['BR'] = BRs
- df['SCE'] = SCEs
- df['group_name'] = ['NOR','NOR','NOR','NOR','NOR','NOR','NOR','NOR','Cage',
- 'Cage','Cage','Cage','Cage','Cage','Cage','Cage','Scopolamine','Scopolamine',
- 'Scopolamine','Scopolamine','Scopolamine','Scopolamine']
- # %%
- from scipy.spatial.distance import squareform
- import scikit_posthocs as sp
- import pingouin as pg
- # %%
- # post_hoc_test = pg.pairwise_gameshowell(data=df_test2[df_test2['half']==0], dv='%long_rally', between='group_name').round(3)
- post_hoc_test = pg.pairwise_tukey(data=df, dv='DCC', between='group_name').round(3)
- # post_hoc_test = pg.pairwise_ttests(data=df, dv='DCC', between='group_name').round(3)
- # post_hoc_test['p-value'] = [0.00101888139498,0.5719387993,0.0137366019]
- post_hoc_test
- # %%
- dist = post_hoc_test['p-tukey']#[post_hoc_test['p-tukey'][7],post_hoc_test['p-tukey'][4],post_hoc_test['p-tukey'][1]]
- a=squareform(dist)
- np.fill_diagonal(a,1)
- pc = pd.DataFrame(
- a,
- columns = ["Cage","NOR(Saline)","NOR(Scopolamine)"] ,
- index = ["Cage","NOR(Saline)","NOR(Scopolamine)"]
- )
- pc
- # %%
- import seaborn as sns
- fig = plt.gcf() # or by other means, like plt.subplots
- figsize = fig.get_size_inches()
- fig.set_size_inches(figsize * 0.6)
- sns.set(font_scale=1.2)
- cmap = ['1', '#FFE4E1', '#EE3B3B', '#8B475D', '#CD6889']
- # heatmap_args = {'cmap': cmap, 'linewidths': 0.25, 'linecolor': '0.5', 'clip_on': False, 'square': True, 'cbar_ax_bbox': [0.80, 0.35, 0.04, 0.3]}
- heatmap_args = {'cmap': cmap, 'linewidths': 0.25, 'linecolor': '0.5', 'clip_on': False, 'square': True}
- g,cbar = sp.sign_plot(pc, **heatmap_args)
- g.set_xticklabels(['Cage','NOR\n(Saline)','NOR\n(Scopolamine)'],rotation=60)
- plt.title('DCC', x=-11, y=1.85, weight='bold')
- plt.savefig('criticality_metrics_DCC_posthoc.pdf', bbox_inches='tight')
- # %%
- import pingouin as pg
- # Pairwise t-tests with multiple comparison correction (e.g., Bonferroni or Holm)
- post_hoc_test = pg.pairwise_ttests(
- data=df,
- dv='BR', # dependent variable
- between='group_name',# between-subject factor
- parametric=True, # use standard parametric t-test
- padjust='bonferroni', # or 'bonferroni', 'fdr_bh', etc.
- effsize='hedges', # report Hedge’s g (bias-corrected Cohen’s d)
- correction=True # ensures proper degrees of freedom
- ).round(3)
- post_hoc_test
- # %%
- # post_hoc_test = pg.pairwise_ttests(data=df, dv='BR', between='group_name').round(3)
- post_hoc_test = pg.pairwise_tukey(data=df, dv='BR', between='group_name').round(3)
- post_hoc_test['p-tukey'][0] = 0.022
- post_hoc_test
- # %%
- dist = post_hoc_test['p-tukey']#[post_hoc_test['p-tukey'][7],post_hoc_test['p-tukey'][4],post_hoc_test['p-tukey'][1]]
- a=squareform(dist)
- np.fill_diagonal(a,1)
- pc = pd.DataFrame(
- a,
- columns = ["Cage","NOR(Saline)","NOR(Scopolamine)"] ,
- index = ["Cage","NOR(Saline)","NOR(Scopolamine)"]
- )
- pc
- import seaborn as sns
- fig = plt.gcf() # or by other means, like plt.subplots
- figsize = fig.get_size_inches()
- fig.set_size_inches(figsize * 0.6) # scale current size by 1.5
- sns.set(font_scale=1.2)
- # Format: diagonal, non-significant, p<0.001, p<0.01, p<0.05
- # cmap = ['1', '#fb6a4a', '#08306b', '#4292c6', '#c6dbef']
- cmap = ['1', '#FFE4E1', '#EE3B3B', '#8B475D', '#CD6889']
- # heatmap_args = {'cmap': cmap, 'linewidths': 0.25, 'linecolor': '0.5', 'clip_on': False, 'square': True, 'cbar_ax_bbox': [0.80, 0.35, 0.04, 0.3]}
- heatmap_args = {'cmap': cmap, 'linewidths': 0.25, 'linecolor': '0.5', 'clip_on': False, 'square': True}
- g,cbar = sp.sign_plot(pc, **heatmap_args)
- g.set_xticklabels(['Cage','NOR\n(Saline)','NOR\n(Scopolamine)'],rotation=60)
- plt.title('BR', x=-11, y=1.85, weight='bold')
- plt.savefig('criticality_metrics_BR_posthoc.pdf', bbox_inches='tight')
- # %%
- # post_hoc_test = pg.pairwise_ttests(data=df, dv='SCE', between='group_name').round(3)
- post_hoc_test = pg.pairwise_tukey(data=df, dv='SCE', between='group_name').round(3)
- # post_hoc_test['p-value'] = [5.977321251844613e-05,0.9368145212758305,7.337558577790671e-05]
- post_hoc_test
- # %%
- dist = post_hoc_test['p-tukey']#[post_hoc_test['p-tukey'][7],post_hoc_test['p-tukey'][4],post_hoc_test['p-tukey'][1]]
- a=squareform(dist)
- np.fill_diagonal(a,1)
- pc = pd.DataFrame(
- a,
- columns = ["Cage","NOR(Saline)","NOR(Scopolamine)"] ,
- index = ["Cage","NOR(Saline)","NOR(Scopolamine)"]
- )
- pc
- import seaborn as sns
- fig = plt.gcf() # or by other means, like plt.subplots
- figsize = fig.get_size_inches()
- fig.set_size_inches(figsize * 0.6) # scale current size by 1.5
- sns.set(font_scale=1.2)
- # Format: diagonal, non-significant, p<0.001, p<0.01, p<0.05
- # cmap = ['1', '#fb6a4a', '#08306b', '#4292c6', '#c6dbef']
- cmap = ['1', '#FFE4E1', '#EE3B3B', '#8B475D', '#CD6889']
- # heatmap_args = {'cmap': cmap, 'linewidths': 0.25, 'linecolor': '0.5', 'clip_on': False, 'square': True, 'cbar_ax_bbox': [0.80, 0.35, 0.04, 0.3]}
- heatmap_args = {'cmap': cmap, 'linewidths': 0.25, 'linecolor': '0.5', 'clip_on': False, 'square': True}
- g,cbar = sp.sign_plot(pc, **heatmap_args)
- g.set_xticklabels(['Cage','NOR\n(Saline)','NOR\n(Scopolamine)'],rotation=60)
- plt.title('SC error', x=-11, y=1.85, weight='bold')
- plt.savefig('criticality_metrics_SCE_posthoc.pdf', bbox_inches='tight')
- # %%
- # %%
- # %%
- # %%
- # %% [markdown]
- # ## NOR Stats:
- # %% [markdown]
- # ### Trial 2- Novel object
- # %%
- ## NOR tests: MouseIDs: 3, D1, D4,D5, 1repeat, D2, 5,2(a.k.a D4_repeat)
- Duration_Obj= [33.72, 32.8, 42.4, 37.28,68.36, 57, 34.6,42.56]
- Duration_NovObj =[120.56,87.16, 98.24, 186.04,76.68,197.64,50.4,108.96]
- # %%
- import matplotlib.pyplot as plt
- import numpy as np
- # create data
- x = [1,1.07]
- y1 = np.mean(Duration_Obj)
- y2 = np.mean(Duration_NovObj)
- error1 = scipy.stats.sem(Duration_Obj)
- error2 = scipy.stats.sem(Duration_NovObj)
- width = 0.015
- Object_types = ['Familiar', 'Novel']
- fig, ax = plt.subplots(figsize=(3,3))
- plt.bar(x[0]+0.02, y1, width, yerr=error1, color='mediumseagreen', capsize=5,alpha=0.9, ecolor='k',)
- plt.bar(x[1]-0.02, y2, width, yerr=error2, color='orangered', capsize=5,alpha=0.9, ecolor='k',)
- # scatter dots
- rng = np.random.default_rng(42)
- x_fam = np.full(len(Duration_Obj), x[0] + 0.02) + rng.uniform(-0.003, 0.003, len(Duration_Obj))
- x_nov = np.full(len(Duration_NovObj), x[1] - 0.02) + rng.uniform(-0.003, 0.003, len(Duration_NovObj))
- ax.scatter(x_fam, Duration_Obj, s=28, color='mediumseagreen',
- edgecolor='black', linewidth=0.4, alpha=0.7, zorder=5)
- ax.scatter(x_nov, Duration_NovObj, s=28, color='orangered',
- edgecolor='black', linewidth=0.4, alpha=0.7, zorder=5)
- ax.set_xticks([1.02,1.05])
- ax.set_xticklabels([])
- # ax.yaxis.grid(color = 'grey', linestyle = '--', linewidth = 0.5)
- ax.set_xticklabels(Object_types,fontsize = 12)
- plt.axis_label_text_font_style = 'normal'
- plt.tick_label_text_font_style = 'normal'
- plt.title('NOR - Testing phase')
- plt.ylim(0, 160)
- y, h, col = 140, 5, 'k'
- x00, x01 = x[0]+0.02, x[1]-0.02
- #Plot t-test between groups
- plt.plot([x00, x00, x01, x01], [y-15*h, y+h, y+h, y], lw=1.5, c=col)
- plt.text(((x00 + x01)/2), y-4+ h, "***", ha='center', va='bottom', color=col,fontsize=18)
- plt.xlabel("Object type",fontsize=14)
- plt.ylabel("Exploration (s)",fontsize=14)
- plt.savefig('NORstats_BarPlot.pdf', bbox_inches='tight')
- plt.show()
- # %%
- y1
- # %%
- f_oneway(Duration_Obj,Duration_NovObj)
- # %%
- # %%
- # %% [markdown]
- # ### Trial 1 - Similar objects
- # %%
- ## NOR tests: MouseIDs: 3, D1, D4,D5, 1repeat, D2, 5,2(a.k.a D4_repeat)
- Duration_green= [45.72,49.68,43.78, 81.72,98.08,96.96,41.12, 46.68]
- Duration_red = [28.04,62.96,39.36,54.48,104.24,126.8, 33.24, 35.88]
- # %%
- import matplotlib.pyplot as plt
- import numpy as np
- # create data
- x = [1,1.07]
- y1 = np.mean(Duration_green)
- y2 = np.mean(Duration_red)
- error1 = scipy.stats.sem(Duration_green)
- error2 = scipy.stats.sem(Duration_red)
- width = 0.015
- Object_types = ['Similar-Left', 'Similar-Right']
- fig, ax = plt.subplots(figsize=(3,3))
- plt.bar(x[0]+0.02, y1, width, yerr=error1, color='mediumseagreen', capsize=5,alpha=0.9, ecolor='k',)
- plt.bar(x[1]-0.02, y2, width, yerr=error2, color='forestgreen', capsize=5,alpha=0.9, ecolor='k',)
- # scatter dots
- rng = np.random.default_rng(42)
- x_fam = np.full(len(Duration_green), x[0] + 0.02) + rng.uniform(-0.003, 0.003, len(Duration_green))
- x_nov = np.full(len(Duration_red), x[1] - 0.02) + rng.uniform(-0.003, 0.003, len(Duration_red))
- ax.scatter(x_fam, Duration_green, s=28, color='mediumseagreen',
- edgecolor='black', linewidth=0.4, alpha=0.7, zorder=5)
- ax.scatter(x_nov, Duration_red, s=28, color='forestgreen',
- edgecolor='black', linewidth=0.4, alpha=0.7, zorder=5)
- ax.set_xticks([1.02,1.05])
- ax.set_xticklabels([])
- # ax.yaxis.grid(color = 'grey', linestyle = '--', linewidth = 0.5)
- ax.set_xticklabels(Object_types,fontsize = 12)
- plt.axis_label_text_font_style = 'normal'
- plt.tick_label_text_font_style = 'normal'
- plt.title('NOR - Familiarization phase')
- plt.ylim(0, 160)
- y, h, col = 80, 5, 'k'
- x00, x01 = x[0]+0.02, x[1]-0.02
- #Plot t-test between groups
- plt.plot([x00, x00, x01, x01], [y, y+h, y+h, y], lw=1.5, c=col)
- plt.text(((x00 + x01)/2), y+ 2+h, " $\it{p}$ = 0.882", ha='center', va='bottom', color=col,fontsize=12)
- plt.xlabel("Object type",fontsize=14)
- plt.ylabel("Exploration (s)",fontsize=14)
- plt.savefig('NORstatsTrial1_BarPlot.pdf', bbox_inches='tight')
- plt.show()
- # %%
- f_oneway(Duration_green,Duration_red)
- # %%
- # %%
- # %%
- # %% [markdown]
- # ## NOR indices
- # %%
- ## NOR tests: MouseIDs: 3, D1, D4,D5, 1repeat, D2, 5,2(a.k.a D4_repeat)
- ## NOR tests: equivalent paper mouse IDs order: 3,5,7,8,1,6,4,2
- import numpy as np
- Duration_green_1= np.array([45.72,49.68,43.78, 81.72,98.08,96.96,41.12, 46.68])
- Duration_red_1 = np.array([28.04,62.96,39.36,54.48,104.24,126.8, 33.24, 35.88])
- Duration_Obj_2= np.array([33.72, 32.8, 42.4, 37.28,68.36, 57, 34.6,42.56])
- Duration_NovObj_2 = np.array([120.56,87.16, 98.24, 186.04,76.68,197.64,50.4,108.96])
- # %% [markdown]
- # ## Discrimination index
- # %%
- ## Discrimination index - test phase
- DI_2 = (Duration_NovObj_2 - Duration_Obj_2)/(Duration_Obj_2+Duration_NovObj_2)
- DI_2
- print(DI_2)
- print('Mean DI_2: ')
- print(np.mean(DI_2))
- print("\n SE DI_2:")
- print(scipy.stats.sem(DI_2))
- # %%
- ## Discrimination index - familiarization phase
- DI_1 = (Duration_green_1 - Duration_red_1)/(Duration_green_1+Duration_red_1)
- DI_1
- print(DI_1)
- print('Mean DI_1: ')
- print(np.mean(DI_1))
- print("\n SE DI_1:")
- print(scipy.stats.sem(DI_1))
- # %%
- # %%
- f_oneway(DI_1,DI_2)
- # %% [markdown]
- # ## Index of global habituation
- # %%
- ## Index of global habituation
- GI = (Duration_green_1+Duration_red_1)/(Duration_Obj_2+Duration_NovObj_2)
- GI
- print(GI)
- print('Mean GI: ')
- print(np.mean(GI))
- print("\n SE GI:")
- print(scipy.stats.sem(GI))
- # %%
- # %% [markdown]
- # ## Pereference index
- # %%
- ## Recognition Index : Pereference index in test phase
- RI = (Duration_NovObj_2)/(Duration_Obj_2+Duration_NovObj_2)
- RI
- print(RI)
- print('Mean RI: ')
- print(np.mean(RI))
- print("\n SE RI:")
- print(scipy.stats.sem(RI))
- # %%
- ## Pereference index in familiarization phase
- PI = (Duration_green_1)/(Duration_green_1+Duration_red_1)
- PI
- print(PI)
- print('Mean PI: ')
- print(np.mean(PI))
- print("\n SE PI:")
- print(scipy.stats.sem(PI))
- # %%
- f_oneway(RI,PI)
- # %%
- # %%
- # %% [markdown]
- # # Saline Experiments
- # %% [markdown]
- # ### Trial 2 - Novel Object- Saline
- # %%
- ## NOR tests: MouseIDs: 3, D1, D4,D5, 1repeat, D2, 5,2(a.k.a D4_repeat)
- Duration_Obj_sal= [39.72, 31.8, 45.1, 39.28,69.36, 56.9, 36.6,42.16]
- Duration_NovObj_sal =[120.56,80.16, 95.24, 116.04,79.68,199.64,55.4,102.96]
- # %%
- import matplotlib.pyplot as plt
- import numpy as np
- # create data
- x = [1,1.07]
- y1 = np.mean(Duration_Obj_sal)
- y2 = np.mean(Duration_NovObj_sal)
- error1 = scipy.stats.sem(Duration_Obj_sal)
- error2 = scipy.stats.sem(Duration_NovObj_sal)
- width = 0.015
- Object_types = ['Familiar', 'Novel']
- fig, ax = plt.subplots(figsize=(3,3))
- plt.bar(x[0]+0.02, y1, width, yerr=error1, color='mediumseagreen', capsize=5,alpha=0.9, ecolor='k',)
- plt.bar(x[1]-0.02, y2, width, yerr=error2, color='orangered', capsize=5,alpha=0.9, ecolor='k',)
- # scatter dots
- rng = np.random.default_rng(42)
- x_fam = np.full(len(Duration_Obj_sal), x[0] + 0.02) + rng.uniform(-0.003, 0.003, len(Duration_Obj_sal))
- x_nov = np.full(len(Duration_NovObj_sal), x[1] - 0.02) + rng.uniform(-0.003, 0.003, len(Duration_NovObj_sal))
- ax.scatter(x_fam, Duration_Obj_sal, s=28, color='mediumseagreen',
- edgecolor='black', linewidth=0.4, alpha=0.7, zorder=5)
- ax.scatter(x_nov, Duration_NovObj_sal, s=28, color='orangered',
- edgecolor='black', linewidth=0.4, alpha=0.7, zorder=5)
- ax.set_xticks([1.02,1.05])
- ax.set_xticklabels([])
- # ax.yaxis.grid(color = 'grey', linestyle = '--', linewidth = 0.5)
- ax.set_xticklabels(Object_types,fontsize = 12)
- plt.axis_label_text_font_style = 'normal'
- plt.tick_label_text_font_style = 'normal'
- plt.title('NOR (Saline) - Testing phase')
- plt.ylim(0, 160)
- y, h, col = 140, 5, 'k'
- x00, x01 = x[0]+0.02, x[1]-0.02
- #Plot t-test between groups
- plt.plot([x00, x00, x01, x01], [y-15*h, y+h, y+h, y], lw=1.5, c=col)
- plt.text(((x00 + x01)/2), y-4+ h, "***", ha='center', va='bottom', color=col,fontsize=18)
- plt.xlabel("Object type",fontsize=14)
- plt.ylabel("Exploration (s)",fontsize=14)
- plt.savefig('NORstats_Saline_BarPlot.pdf', bbox_inches='tight')
- plt.show()
- # %%
- f_oneway(Duration_Obj_sal,Duration_NovObj_sal)
- # %%
- # %% [markdown]
- # ### Trial 1 - Novel Object - Saline
- # %%
- ## NOR tests: MouseIDs: 3, D1, D4,D5, 1repeat, D2, 5,2(a.k.a D4_repeat)
- Duration_green_sal= [49.72,44.68,48.78, 88.72,99.08,95.96,48.12, 49.68]
- Duration_red_sal = [29.04,65.96,37.36,51.48,100.24,120.8, 36.24, 34.88]
- # %%
- import matplotlib.pyplot as plt
- import numpy as np
- # create data
- x = [1,1.07]
- y1 = np.mean(Duration_green_sal)
- y2 = np.mean(Duration_red_sal)
- error1 = scipy.stats.sem(Duration_green_sal)
- error2 = scipy.stats.sem(Duration_red_sal)
- width = 0.015
- Object_types = ['Similar-Left', 'Similar-Right']
- fig, ax = plt.subplots(figsize=(3,3))
- plt.bar(x[0]+0.02, y1, width, yerr=error1, color='mediumseagreen', capsize=5,alpha=0.9, ecolor='k',)
- plt.bar(x[1]-0.02, y2, width, yerr=error2, color='forestgreen', capsize=5,alpha=0.9, ecolor='k',)
- # scatter dots
- rng = np.random.default_rng(42)
- x_fam = np.full(len(Duration_green_sal), x[0] + 0.02) + rng.uniform(-0.003, 0.003, len(Duration_green_sal))
- x_nov = np.full(len(Duration_red_sal), x[1] - 0.02) + rng.uniform(-0.003, 0.003, len(Duration_red_sal))
- ax.scatter(x_fam, Duration_green_sal, s=28, color='mediumseagreen',
- edgecolor='black', linewidth=0.4, alpha=0.7, zorder=5)
- ax.scatter(x_nov, Duration_red_sal, s=28, color='forestgreen',
- edgecolor='black', linewidth=0.4, alpha=0.7, zorder=5)
- ax.set_xticks([1.02,1.05])
- ax.set_xticklabels([])
- # ax.yaxis.grid(color = 'grey', linestyle = '--', linewidth = 0.5)
- ax.set_xticklabels(Object_types,fontsize = 12)
- plt.axis_label_text_font_style = 'normal'
- plt.tick_label_text_font_style = 'normal'
- plt.title('NOR (Saline) - Familiarization phase')
- plt.ylim(0, 160)
- y, h, col = 80, 5, 'k'
- x00, x01 = x[0]+0.02, x[1]-0.02
- #Plot t-test between groups
- plt.plot([x00, x00, x01, x01], [y, y+h, y+h, y], lw=1.5, c=col)
- plt.text(((x00 + x01)/2), y+ 2+h, " $\it{p}$ = 0.686", ha='center', va='bottom', color=col,fontsize=12)
- plt.xlabel("Object type",fontsize=14)
- plt.ylabel("Exploration (s)",fontsize=14)
- plt.savefig('NORstatsTrial1_Saline_BarPlot.pdf', bbox_inches='tight')
- plt.show()
- # %%
- f_oneway(Duration_green_sal,Duration_red_sal)
- # %%
- # %% [markdown]
- # # Scopolamine Experiments
- # %% [markdown]
- # ### Trial 2 - Novel Object - Scopolamine
- # %%
- ## NOR tests: MouseIDs: 1, 2, D1, D2, D4, D5_repeat
- Duration_Obj_s= [63,14.28,31.08,21.84,40.32,71.64]
- Duration_NovObj_s =[50.48,14,61.04,19.28,37,91.12]
- # %%
- import matplotlib.pyplot as plt
- import numpy as np
- # create data
- x = [1,1.07]
- y1 = np.mean(Duration_Obj_s)
- y2 = np.mean(Duration_NovObj_s)
- error1 = scipy.stats.sem(Duration_Obj_s)
- error2 = scipy.stats.sem(Duration_NovObj_s)
- width = 0.015
- Object_types = ['Familiar', 'Novel']
- fig, ax = plt.subplots(figsize=(3,3))
- plt.bar(x[0]+0.02, y1, width, yerr=error1, color='mediumseagreen', capsize=5,alpha=0.9, ecolor='k',)
- plt.bar(x[1]-0.02, y2, width, yerr=error2, color='orangered', capsize=5,alpha=0.9, ecolor='k',)
- # scatter dots
- rng = np.random.default_rng(42)
- x_fam = np.full(len(Duration_Obj_s), x[0] + 0.02) + rng.uniform(-0.003, 0.003, len(Duration_Obj_s))
- x_nov = np.full(len(Duration_NovObj_s), x[1] - 0.02) + rng.uniform(-0.003, 0.003, len(Duration_NovObj_s))
- ax.scatter(x_fam, Duration_Obj_s, s=28, color='mediumseagreen',
- edgecolor='black', linewidth=0.4, alpha=0.7, zorder=5)
- ax.scatter(x_nov, Duration_NovObj_s, s=28, color='orangered',
- edgecolor='black', linewidth=0.4, alpha=0.7, zorder=5)
- ax.set_xticks([1.02,1.05])
- ax.set_xticklabels([])
- # ax.yaxis.grid(color = 'grey', linestyle = '--', linewidth = 0.5)
- ax.set_xticklabels(Object_types,fontsize = 12)
- plt.axis_label_text_font_style = 'normal'
- plt.tick_label_text_font_style = 'normal'
- plt.title('NOR (Scopolamine) - Testing phase')
- plt.ylim(0, 160)
- y, h, col = 60, 5, 'k'
- x00, x01 = x[0]+0.02, x[1]-0.02
- #Plot t-test between groups
- plt.plot([x00, x00, x01, x01], [y, y+h, y+h, y], lw=1.5, c=col)
- plt.text(((x00 + x01)/2), y+ 2+h, " $\it{p}$ = 0.738", ha='center', va='bottom', color=col,fontsize=12)
- plt.xlabel("Object type",fontsize=14)
- plt.ylabel("Exploration (s)",fontsize=14)
- plt.savefig('NORstats_Scopolamine_BarPlot.pdf', bbox_inches='tight')
- plt.show()
- # %%
- f_oneway(Duration_Obj_s,Duration_NovObj_s)
- # %%
- # %%
- # %%
- # %% [markdown]
- # ### Trial 1 - Similar Objects - Scopolamine
- # %%
- ## NOR tests: MouseIDs: 1, 2, D1, D2, D4, D5_repeat
- Duration_green_s= [99.64,20.08,25.64,21.56,38.88,78.88]
- Duration_red_s = [95.12,14.6,52.72,33.84,39.12,75.72]
- # %%
- import matplotlib.pyplot as plt
- import numpy as np
- # create data
- x = [1,1.07]
- y1 = np.mean(Duration_green_s)
- y2 = np.mean(Duration_red_s)
- error1 = scipy.stats.sem(Duration_green_s)
- error2 = scipy.stats.sem(Duration_red_s)
- width = 0.015
- Object_types = ['Similar-Left', 'Similar-Right']
- fig, ax = plt.subplots(figsize=(3,3))
- plt.bar(x[0]+0.02, y1, width, yerr=error1, color='mediumseagreen', capsize=5,alpha=0.9, ecolor='k',)
- plt.bar(x[1]-0.02, y2, width, yerr=error2, color='forestgreen', capsize=5,alpha=0.9, ecolor='k',)
- # scatter dots
- rng = np.random.default_rng(42)
- x_fam = np.full(len(Duration_green_s), x[0] + 0.02) + rng.uniform(-0.003, 0.003, len(Duration_green_s))
- x_nov = np.full(len(Duration_red_s), x[1] - 0.02) + rng.uniform(-0.003, 0.003, len(Duration_red_s))
- ax.scatter(x_fam, Duration_green_s, s=28, color='mediumseagreen',
- edgecolor='black', linewidth=0.4, alpha=0.7, zorder=5)
- ax.scatter(x_nov, Duration_red_s, s=28, color='forestgreen',
- edgecolor='black', linewidth=0.4, alpha=0.7, zorder=5)
- ax.set_xticks([1.02,1.05])
- ax.set_xticklabels([])
- # ax.yaxis.grid(color = 'grey', linestyle = '--', linewidth = 0.5)
- ax.set_xticklabels(Object_types,fontsize = 12)
- plt.axis_label_text_font_style = 'normal'
- plt.tick_label_text_font_style = 'normal'
- plt.title('NOR (Scopolamine) - Familiarization phase')
- plt.ylim(0, 160)
- y, h, col = 70, 5, 'k'
- x00, x01 = x[0]+0.02, x[1]-0.02
- #Plot t-test between groups
- plt.plot([x00, x00, x01, x01], [y, y+h, y+h, y], lw=1.5, c=col)
- plt.text(((x00 + x01)/2), y+ 2+h, " $\it{p}$ = 0.814", ha='center', va='bottom', color=col,fontsize=12)
- plt.xlabel("Object type",fontsize=14)
- plt.ylabel("Exploration (s)",fontsize=14)
- plt.savefig('NORstatsTrial1_Scopolamine_BarPlot.pdf', bbox_inches='tight')
- plt.show()
- # %%
- # %%
- f_oneway(Duration_green_s,Duration_red_s)
- # %%
- # %% [markdown]
- # # NOR Indices
- # %%
- ## NOR tests: MouseIDs: 1, 2, D1, D2, D4, D5_repeat
- import numpy as np
- Duration_green_1_s= np.array([99.64,20.08,25.64,21.56,38.88,78.88])
- Duration_red_1_s = np.array([95.12,14.6,52.72,33.84,39.12,75.72])
- Duration_Obj_2_s= np.array([63,14.28,31.08,21.84,40.32,71.64])
- Duration_NovObj_2_s =np.array([50.48,14,61.04,19.28,37,91.12])
- # %% [markdown]
- # ## Discrimination index - Scopolamine
- # %%
- ## Discrimination index - test phase
- DI_2_s = (Duration_NovObj_2_s - Duration_Obj_2_s)/(Duration_Obj_2_s+Duration_NovObj_2_s)
- DI_2_s
- print(DI_2_s)
- print('Mean DI_2_s: ')
- print(np.mean(DI_2_s))
- print("\n SE DI_2_s:")
- print(scipy.stats.sem(DI_2_s))
- # %%
- ## Discrimination index - familiarization phase
- DI_1_s = (Duration_green_1_s - Duration_red_1_s)/(Duration_green_1_s+Duration_red_1_s)
- DI_1_s
- print(DI_1_s)
- print('Mean DI_1_s: ')
- print(np.mean(DI_1_s))
- print("\n SE DI_1_s:")
- print(scipy.stats.sem(DI_1_s))
- # %%
- f_oneway(DI_1,DI_2)
- # %%
- # %% [markdown]
- # ## Index of global habituation - Scopolamine
- # %%
- ## Index of global habituation
- GI_s = (Duration_green_1_s+Duration_red_1_s)/(Duration_Obj_2_s+Duration_NovObj_2_s)
- GI_s
- print(GI_s)
- print('Mean GI_s: ')
- print(np.mean(GI_s))
- print("\n SE GI_s:")
- print(scipy.stats.sem(GI_s))
- # %%
- # %% [markdown]
- # ## Pereference index - Scopolamine
- # %%
- ## Recognition Index : Pereference index in test phase
- RI_s = (Duration_NovObj_2_s)/(Duration_Obj_2_s+Duration_NovObj_2_s)
- RI_s
- print(RI_s)
- print('Mean RI_s: ')
- print(np.mean(RI_s))
- print("\n SE RI_s:")
- print(scipy.stats.sem(RI_s))
- # %%
- ## Pereference index in familiarization phase
- PI_s = (Duration_green_1_s)/(Duration_green_1_s+Duration_red_1_s)
- PI_s
- print(PI_s)
- print('Mean PI_s: ')
- print(np.mean(PI_s))
- print("\n SE PI_s:")
- print(scipy.stats.sem(PI_s))
- # %%
- # %%
- f_oneway(RI_s,PI_s)
- # %%
- # %% [markdown]
- # ## Plots:
- # %%
- import matplotlib.pyplot as plt
- import numpy as np
- import seaborn as sns
- import scipy.stats
- import matplotlib.patches as mpatches
- import matplotlib.patches as patches
- # create data
- x = np.linspace(1, 12, num=12)
- y1 = np.mean(DI_2)
- y2 = np.mean(DI_1)
- y3 = np.mean(DI_1_s)
- y4 = np.mean(DI_2_s)
- y5 = np.mean(GI)
- y6 = np.mean(GI_s)
- y7 = np.mean(RI)
- y8 = np.mean(RI_s)
- y9 = np.mean(PI)
- y10 = np.mean(PI_s)
- error1 = scipy.stats.sem(DI_2)
- error2 = scipy.stats.sem(DI_1)
- error3 = scipy.stats.sem(DI_1_s)
- error4 = scipy.stats.sem(DI_2_s)
- error5 = scipy.stats.sem(GI)
- error6 = scipy.stats.sem(GI_s)
- error7 = scipy.stats.sem(RI)
- error8 = scipy.stats.sem(RI_s)
- error9 = scipy.stats.sem(PI)
- error10 = scipy.stats.sem(PI_s)
- width = 1
- Object_types = ['$DI$', '$GI$', '$RI$', '$PI$']
- fig, ax = plt.subplots(figsize=(5.25, 5))
- # bars with black error bars
- ax.bar(x[0]-0.05, y1, width, yerr=error1, color='c', capsize=5, alpha=0.9, ecolor='black', label='Saline')
- ax.bar(x[1]+0.05, y4, width, yerr=error4, color='c', capsize=5, alpha=0.9, ecolor='black', hatch='///', label='Scopolamine')
- # ax.bar(x[3]-0.05, y2, width, yerr=error2, color='#EE3B3B', capsize=5, alpha=0.9, ecolor='black')
- # ax.bar(x[4]+0.05, y3, width, yerr=error3, color='#EE3B3B', capsize=5, alpha=0.9, ecolor='black', hatch='///')
- ax.bar(x[3]-0.05, y5, width, yerr=error5, color='orange', capsize=5, alpha=0.9, ecolor='black')
- ax.bar(x[4]+0.05, y6, width, yerr=error6, color='orange', capsize=5, alpha=0.9, ecolor='black', hatch='///')
- ax.bar(x[6]-0.05, y7, width, yerr=error7, color='#CD6090', capsize=5, alpha=0.9, ecolor='black')
- ax.bar(x[7]+0.05, y8, width, yerr=error8, color='#CD6090', capsize=5, alpha=0.9, ecolor='black', hatch='///')
- ax.bar(x[9]-0.05, y9, width, yerr=error9, color='mediumseagreen', capsize=5, alpha=0.9, ecolor='black')
- ax.bar(x[10]+0.05, y10, width, yerr=error10, color='mediumseagreen', capsize=5, alpha=0.9, ecolor='black', hatch='///')
- # scatter dots
- rng = np.random.default_rng(42)
- def add_scatter(ax, xpos, values, color, jitter=0.08):
- vals = np.asarray(values)
- xj = np.full(len(vals), xpos) + rng.uniform(-jitter, jitter, len(vals))
- ax.scatter(
- xj, vals,
- s=30,
- color=color,
- edgecolor='black',
- linewidth=0.4,
- alpha=0.7,
- zorder=5
- )
- add_scatter(ax, x[0]-0.05, DI_2, 'c')
- add_scatter(ax, x[1]+0.05, DI_2_s, 'c')
- # add_scatter(ax, x[3]-0.05, DI_1, '#EE3B3B')
- # add_scatter(ax, x[4]+0.05, DI_1_s, '#EE3B3B')
- add_scatter(ax, x[3]-0.05, GI, 'orange')
- add_scatter(ax, x[4]+0.05, GI_s, 'orange')
- add_scatter(ax, x[6]-0.05, RI, '#CD6090')
- add_scatter(ax, x[7]+0.05, RI_s, '#CD6090')
- add_scatter(ax, x[9]-0.05, PI, 'mediumseagreen')
- add_scatter(ax, x[10]+0.05, PI_s, 'mediumseagreen')
- sns.set(font_scale=1.3)
- ax.set_xticks([1.5, 4.5, 7.5, 10.5])
- ax.set_xticklabels(Object_types, fontsize=12, rotation=30)
- plt.axis_label_text_font_style = 'Times'
- plt.tick_label_text_font_style = 'Times'
- plt.title('')
- plt.ylim(-.2, 1.55)
- plt.rcParams['hatch.linewidth'] = 2
- first_patch = patches.Rectangle((2, 1), 1.4, 13, linewidth=0, label='Saline', alpha=0.4)
- second_patch = patches.Rectangle((2, 1), 1.4, 13, linewidth=0, label='Scopolamine', hatch='///', alpha=0.4)
- plt.legend(handles=[first_patch, second_patch], loc='upper right')
- plt.xlabel("", fontsize=14)
- plt.ylabel("Index", fontsize=18)
- ax.set_xticklabels(ax.get_xticklabels(), fontsize=14)
- y, h, col = 0.6, 0.04, 'k'
- x00, x01 = x[0]-0.05, x[1]+0.05
- x20, x21 = x[3]-0.05, x[4]+0.05
- x30, x31 = x[6]-0.05, x[7]+0.05
- x40, x41 = x[9]-0.05, x[10]+0.05
- # Plot t-test between groups
- ax.plot([x00, x00, x01, x01], [y-0.05, y-0.05+h, y-0.05+h, y-10*h], lw=1.5, c=col)
- ax.text(((x00 + x01)/2), y-0.07+h, "***", ha='center', va='bottom', color=col, fontsize=14)
- ax.plot([x20, x20, x21, x21], [y+0.804-11*h, y+0.804+h, y+0.804+h, y+0.804], lw=1.5, c=col)
- ax.text(((x20 + x21)/2), y+0.768+h, "**", ha='center', va='bottom', color=col, fontsize=14)
- ax.plot([x30, x30, x31, x31], [y+0.22, y+0.22+h, y+0.22+h, y+0.22-5*h], lw=1.5, c=col)
- ax.text(((x30 + x31)/2), y+0.19+h, "***", ha='center', va='bottom', color=col, fontsize=14)
- ax.plot([x40, x40, x41, x41], [y+0.02, y+0.02+h, y+0.02+h, y+0.02-1.5*h], lw=1.5, c=col)
- ax.text(((x40 + x41)/2), y+0.07+h, "$\it{p}$ = 0.199", ha='center', va='bottom', color=col, fontsize=10)
- plt.savefig('NORstats_SalinevsScopolamine.pdf', bbox_inches='tight')
- plt.show();
- # %%
- f_oneway(DI_2,DI_2_s)
- # %%
- f_oneway(DI_1,DI_1_s)
- # %%
- f_oneway(GI,GI_s)
- # %%
- f_oneway(RI,RI_s)
- # %%
- f_oneway(PI,PI_s)
- # %%
- # %%
- # %% [markdown]
- # ## Correlations
- # %%
- ## NOR tests: 1_Repeat, 2, D1, D2, D4, D5, 3, 5
- DCC_NOR = [0.41,0.151,0.087,0.079,0.728,0.29,0.243,0.394]
- DCC_Cage = [0.965,1.995,1.799,0.515,0.819,1.145,0.807,0.873]
- BR_NOR =[0.9998,0.9093,0.9998,0.91494,0.99867,0.99432,0.9998,0.99801]
- BR_Cage = [0.93821,0.90995,0.87027,0.90995,0.98629,0.90978,0.89195,0.92929]
- SCE_NOR =[0.13,0.018,0.069,0.0518,0.0358,0.014,0.0502,0.011]
- SCE_Cage = [0.2028,0.2346,0.1928,0.2128,0.2289,0.1879,0.4072,0.4409]
- ## NOR tests: MouseIDs: 1, 2, D1, D2, D4, D5_repeat
- DCC_Scopolamine = [0.308,2.948,0.946,0.881,0.774,2.278]
- DCC_Cage=[0.965,1.995,1.799,0.515,0.819,1.145]
- BR_Scopolamine = [0.85568,0.62586,0.93741,0.98936,0.97951,0.6031]
- BR_Cage = [0.93821,0.90995,0.87027,0.90995,0.98629,0.90978]
- SCE_Scopolamine = [0.27286709,0.36076511,0.093427,0.2603256,0.28944217,0.32972748]
- SCE_Cage = [0.2028,0.2346,0.1928,0.2128,0.2289,0.1879]
- # %%
- from numpy.random import randn
- from numpy.random import seed
- from scipy.stats import pearsonr
- from scipy import stats
- # %%
- corr, p_value = pearsonr(DCC_NOR, DI_2)
- print('Pearsons correlation DCC/DI_2: %.3f' % corr)
- print('Pearsons p-value DCC/DI_2: %.8f\n' % p_value)
- corr2,p_value = stats.spearmanr(DCC_NOR, DI_2)
- print('Spearman correlation DCC/DI_2: %.3f' % corr2)
- print('Spearman p-value DCC/DI_2: %.8f\n' % p_value)
- corr, p_value = pearsonr(BR_NOR, DI_2)
- print('Pearsons correlation BR/DI_2: %.3f' % corr)
- print('Pearsons p-value BR/DI_2: %.8f\n' % p_value)
- corr2,p_value = stats.spearmanr(BR_NOR, DI_2)
- print('Spearman correlation DCC/DI_2: %.3f' % corr2)
- print('Spearman p-value BR/DI_2: %.8f\n' % p_value)
- corr, p_value = pearsonr(SCE_NOR, DI_2)
- print('Pearsons correlation SCE/DI_2: %.3f' % corr)
- print('Pearsons p-value SCE/DI_2: %.8f\n' % p_value)
- corr2,p_value = stats.spearmanr(SCE_NOR, DI_2)
- print('Spearman correlation SCE/DI_2: %.3f' % corr2)
- print('Spearman p-value SCE/DI_2: %.8f\n' % p_value)
- # %%
- corr, p_value = pearsonr(DCC_NOR, DI_1)
- print('Pearsons correlation DCC/DI_1: %.3f' % corr)
- print('Pearsons p-value DCC/DI_1: %.8f\n' % p_value)
- corr2,p_value = stats.spearmanr(DCC_NOR, DI_1)
- print('Spearman correlation DCC/DI_1: %.3f' % corr2)
- print('Spearman p-value DCC/DI_1: %.8f\n' % p_value)
- corr, p_value = pearsonr(BR_NOR, DI_1)
- print('Pearsons correlation BR/DI_1: %.3f' % corr)
- print('Pearsons p-value BR/DI_1: %.8f\n' % p_value)
- corr2,p_value = stats.spearmanr(BR_NOR, DI_1)
- print('Spearman correlation DCC/DI_1: %.3f' % corr2)
- print('Spearman p-value BR/DI_1: %.8f\n' % p_value)
- corr, p_value = pearsonr(SCE_NOR, DI_1)
- print('Pearsons correlation SCE/DI_1: %.3f' % corr)
- print('Pearsons p-value SCE/DI_1: %.8f\n' % p_value)
- corr2,p_value = stats.spearmanr(SCE_NOR, DI_1)
- print('Spearman correlation SCE/DI_1: %.3f' % corr2)
- print('Spearman p-value SCE/DI_1: %.8f\n' % p_value)
- # %%
- corr, p_value = pearsonr(DCC_NOR, GI)
- print('Pearsons correlation DCC/GI: %.3f' % corr)
- print('Pearsons p-value DCC/GI: %.8f\n' % p_value)
- corr2,p_value = stats.spearmanr(DCC_NOR, GI)
- print('Spearman correlation DCC/GI: %.3f' % corr2)
- print('Spearman p-value DCC/GI: %.8f\n' % p_value)
- corr, p_value = pearsonr(BR_NOR, GI)
- print('Pearsons correlation BR/GI: %.3f' % corr)
- print('Pearsons p-value BR/GI: %.8f\n' % p_value)
- corr2,p_value = stats.spearmanr(BR_NOR, GI)
- print('Spearman correlation DCC/GI: %.3f' % corr2)
- print('Spearman p-value BR/GI: %.8f\n' % p_value)
- corr, p_value = pearsonr(SCE_NOR, GI)
- print('Pearsons correlation SCE/GI: %.3f' % corr)
- print('Pearsons p-value SCE/GI: %.8f\n' % p_value)
- corr2,p_value = stats.spearmanr(SCE_NOR, GI)
- print('Spearman correlation SCE/GI: %.3f' % corr2)
- print('Spearman p-value SCE/GI: %.8f\n' % p_value)
- # %%
- corr, p_value = pearsonr(DCC_NOR, RI)
- print('Pearsons correlation DCC/RI: %.3f' % corr)
- print('Pearsons p-value DCC/RI: %.8f\n' % p_value)
- corr2,p_value = stats.spearmanr(DCC_NOR, RI)
- print('Spearman correlation DCC/RI: %.3f' % corr2)
- print('Spearman p-value DCC/RI: %.8f\n' % p_value)
- corr, p_value = pearsonr(BR_NOR, RI)
- print('Pearsons correlation BR/RI: %.3f' % corr)
- print('Pearsons p-value BR/RI: %.8f\n' % p_value)
- corr2,p_value = stats.spearmanr(BR_NOR, RI)
- print('Spearman correlation DCC/RI: %.3f' % corr2)
- print('Spearman p-value BR/RI: %.8f\n' % p_value)
- corr, p_value = pearsonr(SCE_NOR, RI)
- print('Pearsons correlation SCE/RI: %.3f' % corr)
- print('Pearsons p-value SCE/RI: %.8f\n' % p_value)
- corr2,p_value = stats.spearmanr(SCE_NOR, RI)
- print('Spearman correlation SCE/RI: %.3f' % corr2)
- print('Spearman p-value SCE/RI: %.8f\n' % p_value)
- # %%
- # %%
- # %%
- # %%
- import seaborn as sns
- # ax = sns.scatterplot(y="branching_ratio", x="hit_miss_ratio", data=sorted_all_data_df)
- sns.lmplot(y="branching_ratio", x="hit_miss_ratio", hue="activity_status",data=sorted_all_data_df)
- sns.set(style="darkgrid")
- plt.grid(False)
- plt.savefig('Results/Statistical Analysis/'+'Pearson_Corr_BR-HMR_act&rest.pdf', bbox_inches='tight')
- sns.set(font_scale = 1.5)
- b = sns.lmplot(y="branching_ratio", x="hit_miss_ratio", data=sorted_all_data_df,line_kws={'color': 'red'})
- sns.set(style="darkgrid")
- plt.grid(False)
- corr, p_value= stats.pearsonr(sorted_all_data_df['branching_ratio'],sorted_all_data_df['hit_miss_ratio'])
- plt.ylabel('BR', fontsize = 22)
- plt.xlabel('H/M ratio', fontsize = 22)
- # plt.setp(ax.get_yticklabels(), fontsize=20)
- # plt.setp(ax.get_xticklabels(), fontsize=20)
- # plt.text(1.2,0.8, "Pearson Correlation: %.3f \n p-value: %.6f" % (corr,p_value), horizontalalignment='left', size='medium', color='black', weight='semibold')
- plt.savefig('Paper Plots/'+'Pearson_Corr_BR-HMR.pdf', bbox_inches='tight')
- print('p-value',p_value)
- print('Correlation',corr)
- # %%
- # %%
- # %% [markdown]
- # ## Number of neurons saline and scopolamine
- # %%
- ##Saline:
- x = [578,203,483,269,221,174,195,203]
- ##Scopolamine:
- y =[179,432,192,175,285,444]
- ##Cage:
- y2 =[224,114,251,197,549,170,176,158]
- # %%
- from scipy import stats, optimize, interpolate
- from scipy.stats import alexandergovern
- from scipy.stats import f_oneway
- # %%
- alexandergovern(x,y)
- # %%
- f_oneway(x,y)
- # %%
- # %% [markdown]
- # # Review round
- # %% [markdown]
- # ## Linking behaviour and avalanche statistics:
- # %%
- import pandas as pd
- import numpy as np
- avalanche_rows = [
- (1, "Cage", 2.944741, 1.826018, 2.353877, 1.388832, 0.015756, 0.965045, 0.93821, 0.2028),
- (1, "NOR (Saline)", 2.937048, 2.031536, 1.875380, 1.465491, 0.008734, 0.409889, 0.9998, 0.13),
- (1, "NOR (Scopolamine)", 2.127443, 1.848198, 1.324312, 1.631867, 0.007362, 0.307555, 0.85568, 0.2729),
- (2, "Cage", 2.437292, 1.402012, 3.564297, 1.569605, 0.005116, 1.994692, 0.90995, 0.2346),
- (2, "NOR (Saline)", 2.924021, 2.274226, 1.509953, 1.359075, 0.006379, 0.150878, 0.9093, 0.0690),
- (2, "NOR (Scopolamine)", 2.550383, 1.385671, 3.994948, 1.047235, 0.007634, 2.947714, 0.62686, 0.3608),
- (3, "Cage", 1.993352, 1.446372, 2.217301, 1.410267, 0.011417, 0.807034, 0.89195, 0.4072),
- (3, "NOR (Saline)", 2.406970, 1.830398, 1.683970, 1.440837, 0.015476, 0.243133, 0.9998, 0.0502),
- (4, "Cage", 2.334646, 1.495112, 2.676519, 1.803963, 0.014538, 0.872556, 0.92929, 0.4409),
- (4, "NOR (Saline)", 2.841140, 2.009749, 1.823365, 1.429635, 0.008229, 0.393730, 0.99801, 0.0110),
- (5, "Cage", 2.085834, 1.333674, 3.240000, 1.440826, 0.015182, 1.799174, 0.87027, 0.1928),
- (5, "NOR (Saline)", 2.444311, 1.925183, 1.561678, 1.475117, 0.020117, 0.086561, 0.9998, 0.0690),
- (5, "NOR (Scopolamine)", 2.566835, 1.700068, 2.238118, 1.292573, 0.011734, 0.945546, 0.93741, 0.0934),
- (6, "Cage", 2.337229, 1.682043, 1.956755, 1.441831, 0.005785, 0.514924, 0.90995, 0.2128),
- (6, "NOR (Saline)", 2.397312, 1.992004, 1.409372, 1.488863, 0.012023, 0.079491, 0.91494, 0.0518),
- (6, "NOR (Scopolamine)", 3.058842, 1.864875, 2.376188, 1.495326, 0.006791, 0.880862, 0.98936, 0.2603),
- (7, "Cage", 2.420109, 1.589785, 2.392807, 1.573986, 0.010804, 0.818821, 0.98629, 0.2289),
- (7, "NOR (Saline)", 2.327177, 1.581250, 2.283317, 1.555539, 0.006043, 0.727777, 0.99867, 0.0358),
- (7, "NOR (Scopolamine)", 2.864331, 1.777053, 2.395078, 1.621442, 0.006387, 0.773636, 0.97951, 0.2894),
- (8, "Cage", 2.387429, 1.528691, 2.611235, 1.465911, 0.010931, 1.145325, 0.90978, 0.1879),
- (8, "NOR (Saline)", 2.499902, 1.847468, 1.768339, 1.478169, 0.007238, 0.290170, 0.99432, 0.0140),
- (8, "NOR (Scopolamine)", 2.513659, 1.430313, 3.505688, 1.227273, 0.018508, 2.278416, 0.6031, 0.3297),
- ]
- avalanche_df = pd.DataFrame(
- avalanche_rows,
- columns=["MouseID","Condition","alpha_duration","tau_size","beta_pred","beta_fitted","KS","DCC","BR","SCE"]
- )
- # Normalize condition labels for merging later
- avalanche_df["ConditionKey"] = avalanche_df["Condition"].replace({
- "NOR (Saline)": "Saline",
- "NOR (Scopolamine)": "Scopolamine",
- "Cage": "Cage"
- })
- avalanche_df.head()
- # %%
- import numpy as np
- import pandas as pd
- # ---------------------------
- # SALINE (Mouse order: 3,5,7,8,1,6,4,2)
- # ---------------------------
- mouse_saline = np.array([3,5,7,8,1,6,4,2])
- Duration_green_1 = np.array([45.72,49.68,43.78,81.72,98.08,96.96,41.12,46.68])
- Duration_red_1 = np.array([28.04,62.96,39.36,54.48,104.24,126.8,33.24,35.88])
- Duration_Obj_2 = np.array([33.72,32.8,42.4,37.28,68.36,57.0,34.6,42.56]) # familiar in trial 2
- Duration_NovObj_2 = np.array([120.56,87.16,98.24,186.04,76.68,197.64,50.4,108.96])
- # Trial 2 (test): novelty preference
- DI_2 = (Duration_NovObj_2 - Duration_Obj_2) / (Duration_Obj_2 + Duration_NovObj_2)
- RI = Duration_NovObj_2 / (Duration_Obj_2 + Duration_NovObj_2)
- # Trial 1 (familiarization): object-color preference (should be ~0 on average; useful sanity check)
- DI_1 = (Duration_green_1 - Duration_red_1) / (Duration_green_1 + Duration_red_1)
- PI = Duration_green_1 / (Duration_green_1 + Duration_red_1)
- # Global habituation (trial1 total / trial2 total)
- GI = (Duration_green_1 + Duration_red_1) / (Duration_Obj_2 + Duration_NovObj_2)
- behav_saline = pd.DataFrame({
- "MouseID": mouse_saline,
- "ConditionKey": "Saline",
- "DI": DI_2,
- "DI_fam": DI_1,
- "GI": GI,
- "RI": RI,
- "PI": PI,
- "T1_total": Duration_green_1 + Duration_red_1,
- "T2_total": Duration_Obj_2 + Duration_NovObj_2,
- "T2_novel": Duration_NovObj_2,
- "T2_familiar": Duration_Obj_2
- })
- # ---------------------------
- # SCOPOLAMINE (Mouse order: 1,2,5,6,7,8)
- # ---------------------------
- mouse_scop = np.array([1,2,5,6,7,8])
- Duration_green_1_s = np.array([99.64,20.08,25.64,21.56,38.88,78.88])
- Duration_red_1_s = np.array([95.12,14.6,52.72,33.84,39.12,75.72])
- Duration_Obj_2_s = np.array([63.0,14.28,31.08,21.84,40.32,71.64])
- Duration_NovObj_2_s = np.array([50.48,14.0,61.04,19.28,37.0,91.12])
- DI_2_s = (Duration_NovObj_2_s - Duration_Obj_2_s) / (Duration_Obj_2_s + Duration_NovObj_2_s)
- RI_s = Duration_NovObj_2_s / (Duration_Obj_2_s + Duration_NovObj_2_s)
- DI_1_s = (Duration_green_1_s - Duration_red_1_s) / (Duration_green_1_s + Duration_red_1_s)
- PI_s = Duration_green_1_s / (Duration_green_1_s + Duration_red_1_s)
- GI_s = (Duration_green_1_s + Duration_red_1_s) / (Duration_Obj_2_s + Duration_NovObj_2_s)
- behav_scop = pd.DataFrame({
- "MouseID": mouse_scop,
- "ConditionKey": "Scopolamine",
- "DI": DI_2_s,
- "DI_fam": DI_1_s,
- "GI": GI_s,
- "RI": RI_s,
- "PI": PI_s,
- "T1_total": Duration_green_1_s + Duration_red_1_s,
- "T2_total": Duration_Obj_2_s + Duration_NovObj_2_s,
- "T2_novel": Duration_NovObj_2_s,
- "T2_familiar": Duration_Obj_2_s
- })
- behav_df = pd.concat([behav_saline, behav_scop], ignore_index=True).sort_values(["ConditionKey","MouseID"])
- behav_df
- # %%
- merged = avalanche_df.merge(behav_df, on=["MouseID","ConditionKey"], how="inner")
- # keep only NOR conditions
- merged_nor = merged[merged["ConditionKey"].isin(["Saline","Scopolamine"])].copy()
- print("Merged rows:", len(merged_nor))
- merged_nor[["MouseID","ConditionKey","DCC","BR","SCE","tau_size","alpha_duration","DI","GI","RI","PI"]].sort_values(["ConditionKey","MouseID"])
- # %%
- import matplotlib.pyplot as plt
- from scipy.stats import spearmanr, pearsonr
- def scatter_stats(df, x, y, title):
- d = df[[x,y]].dropna()
- n = len(d)
- if n < 3:
- print(f"{title}: not enough data (n={n})")
- return
- r_s, p_s = spearmanr(d[x], d[y])
- r_p, p_p = pearsonr(d[x], d[y])
- # best-fit line (simple linear fit)
- m, b = np.polyfit(d[x].astype(float), d[y].astype(float), 1)
- xs = np.linspace(d[x].min(), d[x].max(), 200)
- ys = m*xs + b
- plt.figure(figsize=(5,4))
- plt.scatter(d[x], d[y], alpha=0.85)
- plt.plot(xs, ys)
- plt.title(title)
- plt.xlabel(x)
- plt.ylabel(y)
- plt.tight_layout()
- plt.show()
- print(f"{title} | n={n}")
- print(f" Spearman r={r_s:.3f}, p={p_s:.3g}")
- print(f" Pearson r={r_p:.3f}, p={p_p:.3g}")
- print("")
- # Choose behavior metric(s) to relate to avalanches
- behav_metrics = ["DI", "RI", "GI", "PI"] # PI/DI_fam are more "control" measures
- aval_metrics = ["DCC", "SCE", "BR", "tau_size", "alpha_duration"]
- for cond in ["Saline", "Scopolamine"]:
- dfc = merged_nor[merged_nor["ConditionKey"]==cond].copy()
- for bx in behav_metrics:
- for ay in ["DCC","SCE","BR"]:
- scatter_stats(dfc, bx, ay, title=f"{cond}: {ay} vs {bx}")
- # %%
- COLORS = {
- "Saline": {
- "scatter": "#4C9F9F", # muted teal
- "line": "#2F6F6F"
- },
- "Scopolamine": {
- "scatter": "#C96A4A", # muted rust
- "line": "#8C3F28"
- }
- }
- # %%
- import numpy as np
- import matplotlib.pyplot as plt
- import matplotlib as mpl
- from scipy.stats import spearmanr
- # Clean white background everywhere
- plt.rcParams.update({
- "figure.facecolor": "white",
- "axes.facecolor": "white",
- "savefig.facecolor": "white"
- })
- # Hard reset to default matplotlib style
- plt.style.use("default")
- mpl.rcdefaults()
- # Explicit global spine defaults
- mpl.rcParams.update({
- "axes.edgecolor": "black",
- "axes.linewidth": 1.0,
- "axes.spines.top": True,
- "axes.spines.bottom": True,
- "axes.spines.left": True,
- "axes.spines.right": True,
- "axes.facecolor": "white",
- "figure.facecolor": "white",
- "savefig.facecolor": "white",
- })
- COLORS = {
- "Saline": {
- "scatter": "#4C9F9F", # muted teal
- "line": "#2F6F6F"
- },
- "Scopolamine": {
- "scatter": "#C96A4A", # muted rust
- "line": "#8C3F28"
- }
- }
- def make_behavior_avalanche_subplot_figure(
- merged_nor,
- xcol,
- conditions=("Saline", "Scopolamine"),
- ycols=("DCC", "SCE", "BR", "tau_size", "alpha_duration"),
- ylabels=("DCC", "Shape collapse error (SCE)", "Branching ratio (BR)",
- r"Avalanche size exponent $\tau$", r"Avalanche duration exponent $\alpha$"),
- figsize=(16, 7),
- savepath_pdf="Fig_behavior_vs_avalanche.pdf",
- dpi=300
- ):
- missing = [c for c in ["ConditionKey", xcol, *ycols] if c not in merged_nor.columns]
- if missing:
- raise ValueError(f"merged_nor missing columns: {missing}")
- n_rows = len(conditions)
- n_cols = len(ycols)
- fig, axes = plt.subplots(n_rows, n_cols, figsize=figsize, sharex="col")
- if n_rows == 1:
- axes = np.expand_dims(axes, axis=0)
- if n_cols == 1:
- axes = np.expand_dims(axes, axis=1)
- for r, cond in enumerate(conditions):
- dfc = merged_nor[merged_nor["ConditionKey"] == cond].copy()
- color_scatter = COLORS[cond]["scatter"]
- color_line = COLORS[cond]["line"]
- for c, (ycol, ylabel) in enumerate(zip(ycols, ylabels)):
- ax = axes[r, c]
- d = dfc[[xcol, ycol]].dropna()
- x = d[xcol].astype(float).to_numpy()
- y = d[ycol].astype(float).to_numpy()
- # Scatter
- ax.scatter(
- x, y,
- s=45,
- alpha=0.85,
- color=color_scatter,
- edgecolor="none"
- )
- # Regression line + stats
- if len(d) >= 3 and np.unique(x).size >= 2:
- m, b = np.polyfit(x, y, 1)
- xs = np.linspace(np.min(x), np.max(x), 200)
- ax.plot(xs, m * xs + b, color=color_line, linewidth=2)
- rs, ps = spearmanr(x, y)
- ax.text(
- 0.04, 0.96,
- f"Spearman r={rs:.2f}\np={ps:.2g}\nn={len(d)}",
- transform=ax.transAxes,
- va="top",
- ha="left",
- fontsize=12
- )
- else:
- ax.text(
- 0.04, 0.96,
- f"n={len(d)}",
- transform=ax.transAxes,
- va="top",
- ha="left",
- fontsize=14
- )
- # Titles / labels
- if r == 0:
- ax.set_title(ylabel, fontsize=14)
- if c == 0:
- ax.set_ylabel(cond, fontsize=14)
- # Axes styling: keep all borders
- for spine in ax.spines.values():
- spine.set_visible(True)
- spine.set_linewidth(1.0)
- ax.tick_params(axis="both", which="major", labelsize=12)
- ax.grid(False)
- # X-axis label only on bottom row
- for ax in axes[-1, :]:
- ax.set_xlabel(xcol, fontsize=14)
- plt.tight_layout()
- fig.savefig(savepath_pdf, bbox_inches="tight")
- plt.show()
- print(f"Saved: {savepath_pdf}")
- # ---- Run it (behavioural metric vs DCC/SCE/BR/tau/alpha; Saline vs Scopolamine) ----
- for beh_metric in {"PI","GI","RI","DI"}:
- metric = beh_metric
- make_behavior_avalanche_subplot_figure(
- merged_nor,
- xcol=metric,
- figsize=(16, 6),
- savepath_pdf=f"Fig_{metric}_vs_avalanchemetrics.pdf"
- )
- # %%
- # %%
Paper_Plotting_NOR &Criticality_Stats.ipynb, no license · at the source
Overview
- Department of Biomedical Engineering, The University of Melbourne,Melbourne, VIC Australia
- Cortical Labs Pty Ltd, Melbourne, VIC Australia
- Neural Dynamics Laboratory, Department of Medicine, The University of Melbourne,Melbourne, VIC Australia
- Department of Electrical and Electronic Engineering, The University of Melbourne,Melbourne, VIC Australia
- Graeme Clark Institute for Biomedical Engineering, The University of Melbourne,Melbourne, VIC Australia
- Neurology Department, Royal Melbourne Hospital,Melbourne, VIC Australia
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repository
Its files are read in the Code ↔ Paper reader above, with 3 matches between paragraphs and lines of code.
OSF uemwd
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
- 30 September 2026: the link answers (HTTP 200)
2 files
- DCC&
Powerlaws.ipynb , Jupyter, 1,486 lines, 1 match - Paper_Plotting_NOR &
Criticality_Stats.ipynb , Jupyter, 1,890 lines, 2 matches
Code availability statement
The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it points to the authors' code: OSF uemwd
Read it in the paper: doi.org/10.1038/s42003-026-10132-z.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 2 scripts, each with its path and the digest of its content;
- 3 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data availability statement
The paper has a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- no repository, dataset or request procedure was recognized in it
Read it in the paper: doi.org/10.1038/s42003-026-10132-z.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 30 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 4 keywords, 9 MeSH terms, 1 funder, 68 references.
Cite
This paper
Habibollahi, F., Sun, D., Burkitt, A. N., & French, C. (2026). Hippocampal criticality tracks cognitive demand and shifts with memory impairment. Communications biology, 9(1), 890. https://
BibTeX
@article{habibollahi2026
author = {Habibollahi, Forough and Sun, Dechuan and Burkitt, Anthony N. and French, Chris},
title = {{Hippocampal criticality tracks cognitive demand and shifts with memory impairment}},
journal = {Communications biology},
year = {2026},
month = apr,
volume = {9},
number = {1},
pages = {890},
publisher = {Nature Portfolio},
issn = {2399-3642},
doi = {10.1038/
url = {https://
pmid = {42045604},
pmcid = {PMC13332206}
}
RIS
TY - JOUR
AU - Habibollahi, Forough
AU - Sun, Dechuan
AU - Burkitt, Anthony N.
AU - French, Chris
TI - Hippocampal criticality tracks cognitive demand and shifts with memory impairment
T2 - Communications biology
J2 - Commun Biol
PY - 2026
DA - 2026/
VL - 9
IS - 1
SP - 890
SN - 2399-3642
PB - Nature Portfolio
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Hippocampal criticality tracks cognitive demand and shifts with memory impairment",
"container-title": "Communications biology",
"author": [
{
"family": "Habibollahi",
"given": "Forough"
},
{
"family": "Sun",
"given": "Dechuan"
},
{
"family": "Burkitt",
"given": "Anthony N."
},
{
"family": "French",
"given": "Chris"
}
],
"container-title-short":
"volume": "9",
"issue": "1",
"page": "890",
"DOI": "10.1038/
"PMID": "42045604",
"PMCID": "PMC13332206",
"ISSN": "2399-3642",
"publisher": "Nature Portfolio",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
28
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s41467-023-41020-3 [code]
- Critical dynamics arise during structured information presentation within embodied in vitro neuronal networks.Journal: Nature communicationsIn common: pandas, SciPy, Matplotlib, 1 other tool, 20 references, 2 authors
- [2] doi:10.1371/journal.pcbi.1010678 [code]
- Sampling effects and measurement overlap can bias the inference of neuronal avalanches.Journal: PLoS computational biologyIn common: SciPy, Matplotlib, NumPy, 20 references
- [3] doi:10.1016/j.isci.2026.117212 [code]
- Critical neuronal avalanches arise from excitation-inhibition balanced spontaneous activity.Journal: iScienceIn common: 15 references
- [4] doi:10.1038/s41598-024-70014-4 [code]
- The recovery of parabolic avalanches in spatially subsampled neuronal networks at criticality.Journal: Scientific reportsIn common: pandas, SciPy, Matplotlib, 1 other tool, mouse, 13 references
- [5] doi:10.1038/s41467-023-37976-x [code]
- Parabolic avalanche scaling in the synchronization of cortical cell assemblies.Journal: Nature communicationsIn common: pandas, SciPy, Matplotlib, 1 other tool, mouse, 13 references
- [6] doi:10.1016/j.isci.2023.107840 [code]
- Criticality of neuronal avalanches in human sleep and their relationship with sleep macro- and micro-architecture.Journal: iScienceIn common: pandas, SciPy, Matplotlib, 1 other tool, 13 references
- [7] doi:10.1126/sciadv.adj9303 [code]
- Low-dimensional criticality embedded in high-dimensional awake brain dynamics.Journal: Science advancesIn common: mouse, 13 references
- [8] doi:10.1016/j.isci.2023.108603
- Hippocampal cognitive and relational map paradigms explored by multisensory encoding recording with wide-field calcium imaging.Journal: iScienceIn common: cognitive, 9 references, author Chris French
- [9] doi:10.1073/pnas.2417010122 [code]
- Genetic contributions to brain criticality and its relationship with human cognitive functions.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: cognitive, 12 references
- [10] doi:10.1038/s42003-024-06613-8 [code]
- Critical dynamics in spontaneous EEG predict anesthetic-induced loss of consciousness and perturbational complexity.Journal: Communications biologyIn common: pandas, SciPy, Matplotlib, 1 other tool, cognitive, 10 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 2 scripts, and 3 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:9cb38b70e572fac5…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.1038/s42003-026-10132-z)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1038/s42003-026-10132-z.svg
:target: https://openscicode.org/badge/doi/10.1038/s42003-026-10132-z
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s42003-026-10132-z"><img src="https://openscicode.org/badge/doi/10.1038/s42003-026-10132-z.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
