OSCR

Induction of cortical on/off periods in awake mice fulfills sleep functions.

Code ↔ Paper

7 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

One block of code here has a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 7 matches
  1. [1] § Methods › Statistical analysis ↔ Analysis_code_and_source_data/synchrony/single_units/statistical_source_data/lme_sttc.R, lines 1 to 49 · score 0.85 · Kenward Roger, lmerTest, lmerMultiMember, lme4, pbkrtest, dyadic · block oscr:b:XKJE9PTJP8SN7-C · Report a mismatch
  2. [2] § Methods › SD and optogenetics ↔ Analysis_code_and_source_data/nor_behavior/during_stim/emg_pausing.ipynb, lines 318 to 366 · score 0.83 · RMS envelope, Detected pauses, scored RMS, Raw EMG, window, thresholding · Report a mismatch
  3. [3] § Methods › SD and optogenetics ↔ Analysis_code_and_source_data/nor_behavior/during_stim/emg_pausing_ACR.ipynb, lines 322 to 370 · score 0.83 · RMS envelope, Detected pauses, scored RMS, Raw EMG, window, thresholding · Report a mismatch
  4. [4] § Methods › Statistical analysis ↔ Analysis_code_and_source_data/swa/full_spg_stats_summary.ipynb, lines 35 to 73 · score 0.79 · Wilcoxon signed rank, Benjamini Hochberg, discovery rate, bins · Report a mismatch
  5. [5] § Methods › Electrophysiology acquisition and analysis › Off-period detection and synchrony analyses ↔ Analysis_code_and_source_data/synchrony/field_potentials/halo/lfp_slope__HALO__tonic.ipynb, lines 77 to 152 · score 0.57 · initiation slope, termination slope, field potential, filter, channel, synchrony · Report a mismatch
  6. [6] § Methods › FTR task ↔ Analysis_code_and_source_data/nor_behavior/individual_scatter_plots.ipynb, lines 350 to 389 · score 0.57 · 10–15 min, 10 min · Report a mismatch
  7. [7] § Methods › FTR task ↔ Analysis_code_and_source_data/nor_behavior/individual_scatter_plots.ipynb, lines 267 to 342 · score 0.55 · arena position, nodes, tail, nose, DLC, video · 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 · 430 lines · 17 KB · MIT · 2 matches

  1. # %%
  2. %reload_ext autoreload
  3. %autoreload 2
  4. import pandas as pd
  5. import os
  6. pd.options.mode.chained_assignment = None
  7. import matplotlib.pyplot as plt
  8. import seaborn as sns
  9. import sys
  10. from acr.nor import *
  11. import acr
  12. from acr.utils import PAPER_FIGURE_ROOT
  13. import numpy as np
  14. from acr.utils import NREM_RED, NNXR_GRAY
  15. # %%
  16. acr.plots.lrg()
  17. # %%
  18. def display_colormap(cmap):
  19. """Display the colormap"""
  20. gradient = np.linspace(0, 1, 256)
  21. gradient = np.vstack((gradient, gradient))
  22. fig, ax = plt.subplots(figsize=(30, 2))
  23. ax.imshow(gradient, aspect='auto', cmap=cmap)
  24. ax.set_axis_off()
  25. return fig, ax
  26. # %%
  27. import numpy as np
  28. import matplotlib.pyplot as plt
  29. import matplotlib.colors as mcolors
  30. from matplotlib.colors import LinearSegmentedColormap
  31. import colorsys
  32. from acr.utils import SOM_BLUE
  33. import matplotlib as mpl
  34. # your base color
  35. base_hex = SOM_BLUE
  36. base_rgb = mcolors.hex2color(base_hex)
  37. # helper to adjust lightness (factor >1 → lighter; <1 → darker)
  38. def adjust_lightness(rgb, factor):
  39. h, l, s = colorsys.rgb_to_hls(*rgb)
  40. l = max(0, min(1, l * factor))
  41. return colorsys.hls_to_rgb(h, l, s)
  42. # make a lighter and a darker variant
  43. low_rgb = adjust_lightness(base_rgb, 2.3) # light end
  44. high_rgb = adjust_lightness(base_rgb, 0.2) # dark end
  45. # build the colormap: low → base (mid) → high
  46. colors = [low_rgb, base_rgb, high_rgb]
  47. custom_diverging = LinearSegmentedColormap.from_list(
  48. "custom_divergent", colors, N=256
  49. )
  50. mpl.colormaps.register(custom_diverging, name="som", force=True)
  51. # usage:
  52. # plt.scatter(x, y, c=values, cmap="custom_divergent")
  53. # plt.colorbar(); plt.show()
  54. f, ax = display_colormap(custom_diverging)
  55. plt.savefig(f'{PAPER_FIGURE_ROOT}/nor_behavior/som_colormap.png', dpi=600, bbox_inches='tight', transparent=True)
  56. # %%
  57. # your base color
  58. base_hex = '#f24f4f'
  59. base_rgb = mcolors.hex2color(base_hex)
  60. # helper to adjust lightness (factor >1 → lighter; <1 → darker)
  61. def adjust_lightness(rgb, factor):
  62. h, l, s = colorsys.rgb_to_hls(*rgb)
  63. l = max(0, min(1, l * factor))
  64. return colorsys.hls_to_rgb(h, l, s)
  65. # make a lighter and a darker variant
  66. low_rgb = adjust_lightness(base_rgb, 1.3) # light end
  67. high_rgb = adjust_lightness(base_rgb, 0.2) # dark end
  68. # build the colormap: low → base (mid) → high
  69. colors = [low_rgb, base_rgb, high_rgb]
  70. custom_diverging = LinearSegmentedColormap.from_list(
  71. "custom_divergent", colors, N=256
  72. )
  73. mpl.colormaps.register(custom_diverging, name="nrem_red_map", force=True)
  74. # usage:
  75. # plt.scatter(x, y, c=values, cmap="custom_divergent")
  76. # plt.colorbar(); plt.show()
  77. f, ax = display_colormap(custom_diverging)
  78. plt.savefig(f'{PAPER_FIGURE_ROOT}/nor_behavior/nrem_red_colormap.png', dpi=600, bbox_inches='tight', transparent=True)
  79. # %%
  80. # your base color
  81. base_hex = '#7f7f7f'
  82. base_rgb = mcolors.hex2color(base_hex)
  83. # helper to adjust lightness (factor >1 → lighter; <1 → darker)
  84. def adjust_lightness(rgb, factor):
  85. h, l, s = colorsys.rgb_to_hls(*rgb)
  86. l = max(0, min(1, l * factor))
  87. return colorsys.hls_to_rgb(h, l, s)
  88. # make a lighter and a darker variant
  89. low_rgb = adjust_lightness(base_rgb, 1.5) # light end
  90. high_rgb = adjust_lightness(base_rgb, 0.1) # dark end
  91. # build the colormap: low → base (mid) → high
  92. colors = [low_rgb, base_rgb, high_rgb]
  93. custom_diverging = LinearSegmentedColormap.from_list(
  94. "custom_divergent", colors, N=256
  95. )
  96. mpl.colormaps.register(custom_diverging, name="sd_gray", force=True)
  97. # usage:
  98. # plt.scatter(x, y, c=values, cmap="custom_divergent")
  99. # plt.colorbar(); plt.show()
  100. f, ax = display_colormap(custom_diverging)
  101. plt.savefig(f'{PAPER_FIGURE_ROOT}/nor_behavior/sd_gray_colormap.png', dpi=600, bbox_inches='tight', transparent=True)
  102. # %%
  103. for sub in sleep_subjects:
  104. t = get_subject_type(sub)
  105. df = load_subject_node(sub, 'nose', conds=['test'], type=t)
  106. arena_df = acr.nor.get_arena_df(sub, 'test')
  107. plt.rcdefaults()
  108. acr.plots.lrg()
  109. plt.rcParams['axes.spines.left'] = False
  110. plt.rcParams['axes.spines.bottom'] = False
  111. plt.rcParams['xtick.bottom'] = False
  112. plt.rcParams['ytick.left'] = False
  113. f, ax = acr.nor.create_arena_plot_streamlined(arena_df, buffer=20)
  114. sns.scatterplot(x='x', y='y', data=df, hue='side', hue_order=['familiar', 'novel'], palette=['black', 'green'], ax=ax, alpha=0.5, s=300, c='b')
  115. ax.set_title(f'{sub}')
  116. # %%
  117. sub = 'NOR_54'
  118. t = get_subject_type(sub)
  119. df = load_subject_node(sub, 'nose', conds=['test'], type=t)
  120. arena_df = acr.nor.get_arena_df(sub, 'test')
  121. plt.rcdefaults()
  122. acr.plots.lrg()
  123. plt.rcParams['axes.spines.left'] = False
  124. plt.rcParams['axes.spines.bottom'] = False
  125. plt.rcParams['xtick.bottom'] = False
  126. plt.rcParams['ytick.left'] = False
  127. f, ax, bounds = acr.nor.create_arena_plot_streamlined(arena_df, buffer_lr=20, buffer_ud=20, return_bounds=True)
  128. sns.scatterplot(x='x', y='y', data=df,
  129. hue='frame', palette='som',
  130. #style='side', style_order=['familiar', 'novel'], markers=['X', 'o'],
  131. ax=ax, alpha=0.75, s=300
  132. )
  133. # Remove the legend from the plot
  134. ax.get_legend().remove()
  135. ax.set_xlim(bounds[0]-2, bounds[1]+2)
  136. ax.set_ylim(bounds[2]-2, bounds[3]+2)
  137. f.savefig(f'{PAPER_FIGURE_ROOT}/nor_behavior/NOR54-test-scatter__novel-left.png', dpi=600, bbox_inches='tight', transparent=True)
  138. # %%
  139. # X HISTOGRAM
  140. midline_x = (arena_df.loc[arena_df['node']=='midline_upper']['x'].values[0] + arena_df.loc[arena_df['node']=='midline_lower']['x'].values[0]) / 2
  141. f, ax = plt.subplots(figsize=(30, 3))
  142. sns.histplot(df, x='x', bins=200, ax=ax, color=SOM_BLUE)
  143. plt.tight_layout()
  144. ax.set_xlim(df['x'].min(), df['x'].max())
  145. f.savefig(f'{PAPER_FIGURE_ROOT}/nor_behavior/NOR54-Xhisto.png', dpi=600, bbox_inches='tight', transparent=True)
  146. # Y HISTOGRAM
  147. upper_arena_y = arena_df.loc[arena_df['node']=='midline_upper']['y'].values[0]
  148. lower_arena_y = arena_df.loc[arena_df['node']=='midline_lower']['y'].values[0]
  149. midline_y = (upper_arena_y + lower_arena_y) / 2
  150. f, ax = plt.subplots(figsize=(30, 4.95))
  151. sns.histplot(df, x='y', bins=200, ax=ax, color=SOM_BLUE)
  152. plt.tight_layout()
  153. ax.set_xlim(df['y'].min(), df['y'].max())
  154. f.savefig(f'{PAPER_FIGURE_ROOT}/nor_behavior/NOR54-Yhisto.png', dpi=600, bbox_inches='tight', transparent=True)
  155. # %%
  156. sub = 'NOR_18'
  157. t = get_subject_type(sub)
  158. df = load_subject_node(sub, 'nose', conds=['test'], type=t)
  159. arena_df = acr.nor.get_arena_df(sub, 'test')
  160. plt.rcdefaults()
  161. acr.plots.lrg()
  162. plt.rcParams['axes.spines.left'] = False
  163. plt.rcParams['axes.spines.bottom'] = False
  164. plt.rcParams['xtick.bottom'] = False
  165. plt.rcParams['ytick.left'] = False
  166. f, ax, bounds = acr.nor.create_arena_plot_streamlined(arena_df, buffer_lr=20, buffer_ud=20, return_bounds=True)
  167. sns.scatterplot(x='x', y='y', data=df,
  168. hue='frame', palette='nrem_red_map',
  169. #style='side', style_order=['familiar', 'novel'], markers=['X', 'o'],
  170. ax=ax, alpha=0.75, s=300
  171. )
  172. # Remove the legend from the plot
  173. ax.get_legend().remove()
  174. ax.set_xlim(bounds[0]-2, bounds[1]+2)
  175. ax.set_ylim(bounds[2]-2, bounds[3]+2)
  176. f.savefig(f'{PAPER_FIGURE_ROOT}/nor_behavior/NOR18-test-scatter__novel-right.png', dpi=600, bbox_inches='tight', transparent=True)
  177. # %%
  178. # X HISTOGRAM
  179. midline_x = (arena_df.loc[arena_df['node']=='midline_upper']['x'].values[0] + arena_df.loc[arena_df['node']=='midline_lower']['x'].values[0]) / 2
  180. f, ax = plt.subplots(figsize=(30, 3))
  181. sns.histplot(df, x='x', bins=200, ax=ax, color=NREM_RED)
  182. plt.tight_layout()
  183. ax.set_xlim(df['x'].min(), df['x'].max())
  184. f.savefig(f'{PAPER_FIGURE_ROOT}/nor_behavior/NOR18-Xhisto.png', dpi=600, bbox_inches='tight', transparent=True)
  185. # Y HISTOGRAM
  186. upper_arena_y = arena_df.loc[arena_df['node']=='midline_upper']['y'].values[0]
  187. lower_arena_y = arena_df.loc[arena_df['node']=='midline_lower']['y'].values[0]
  188. midline_y = (upper_arena_y + lower_arena_y) / 2
  189. f, ax = plt.subplots(figsize=(30, 4.95))
  190. sns.histplot(df, x='y', bins=200, ax=ax, color=NREM_RED)
  191. plt.tight_layout()
  192. ax.set_xlim(df['y'].min(), df['y'].max())
  193. f.savefig(f'{PAPER_FIGURE_ROOT}/nor_behavior/NOR18-Yhisto.png', dpi=600, bbox_inches='tight', transparent=True)
  194. # %%
  195. sub = 'NOR_19'
  196. t = get_subject_type(sub)
  197. df = load_subject_node(sub, 'nose', conds=['test'], type=t)
  198. arena_df = acr.nor.get_arena_df(sub, 'test')
  199. plt.rcdefaults()
  200. acr.plots.lrg()
  201. plt.rcParams['axes.spines.left'] = False
  202. plt.rcParams['axes.spines.bottom'] = False
  203. plt.rcParams['xtick.bottom'] = False
  204. plt.rcParams['ytick.left'] = False
  205. f, ax, bounds = acr.nor.create_arena_plot_streamlined(arena_df, buffer_lr=20, buffer_ud=20, return_bounds=True)
  206. sns.scatterplot(x='x', y='y', data=df,
  207. hue='frame', palette='sd_gray',
  208. #style='side', style_order=['familiar', 'novel'], markers=['X', 'o'],
  209. ax=ax, alpha=0.75, s=300
  210. )
  211. # Remove the legend from the plot
  212. ax.get_legend().remove()
  213. ax.set_xlim(bounds[0]-2, bounds[1]+2)
  214. ax.set_ylim(bounds[2]-2, bounds[3]+2)
  215. f.savefig(f'{PAPER_FIGURE_ROOT}/nor_behavior/NOR19-test-scatter__novel-left.png', dpi=600, bbox_inches='tight', transparent=True)
  216. # %%
  217. # X HISTOGRAM
  218. midline_x = (arena_df.loc[arena_df['node']=='midline_upper']['x'].values[0] + arena_df.loc[arena_df['node']=='midline_lower']['x'].values[0]) / 2
  219. f, ax = plt.subplots(figsize=(30, 3))
  220. sns.histplot(df, x='x', bins=200, ax=ax, color=NNXR_GRAY)
  221. plt.tight_layout()
  222. ax.set_xlim(df['x'].min(), df['x'].max())
  223. f.savefig(f'{PAPER_FIGURE_ROOT}/nor_behavior/NOR19-Xhisto.png', dpi=600, bbox_inches='tight', transparent=True)
  224. # Y HISTOGRAM
  225. upper_arena_y = arena_df.loc[arena_df['node']=='midline_upper']['y'].values[0]
  226. lower_arena_y = arena_df.loc[arena_df['node']=='midline_lower']['y'].values[0]
  227. midline_y = (upper_arena_y + lower_arena_y) / 2
  228. f, ax = plt.subplots(figsize=(30, 4.95))
  229. sns.histplot(df, x='y', bins=200, ax=ax, color=NNXR_GRAY)
  230. plt.tight_layout()
  231. ax.set_xlim(df['y'].min(), df['y'].max())
  232. f.savefig(f'{PAPER_FIGURE_ROOT}/nor_behavior/NOR19-Yhisto.png', dpi=600, bbox_inches='tight', transparent=True)
  233. # %% [markdown]
  234. # # DEPRECATED
  235. # %%
  236. arena_nodes = ['midline_upper',
  237. 'midline_lower',
  238. 'arena_upper_left',
  239. 'arena_upper_right',
  240. 'arena_lower_left',
  241. 'arena_lower_right']
  242. conditions = ['acq', 'test']
  243. subject = 'NOR_13'
  244. ni = load_nor_info()
  245. data = {}
  246. data_root = '/Volumes/neuropixel_archive/Data/acr_archive/NOR_videos/DLC_project_files/NOR_ROUND_2--analysis_results'
  247. for condition in conditions:
  248. path = f"{data_root}/{subject}-{condition}DLC_Resnet50_nor_single_subJun25shuffle0_snapshot_250_filtered.csv"
  249. data[condition] = pd.read_csv(path)
  250. # Orgainze data into dataframes for each node
  251. arena_dfs = {}
  252. nose_dfs = {}
  253. base_dfs = {}
  254. center_dfs = {}
  255. for condition in conditions:
  256. print(condition)
  257. arena_dfs[condition] = []
  258. nose_dfs[condition] = []
  259. base_dfs[condition] = []
  260. center_dfs[condition] = []
  261. for node in arena_nodes:
  262. df = data[condition].loc[:, data[condition].loc[0] == node]
  263. df = clean_df(df)
  264. arena_dfs[condition].append(df)
  265. nose = data[condition].loc[:, data[condition].loc[0] == 'nose']
  266. nose = clean_df(nose)
  267. nose_dfs[condition] = nose
  268. base = data[condition].loc[:, data[condition].loc[0] == 'tail_base']
  269. base = clean_df(base)
  270. base_dfs[condition] = base
  271. center = data[condition].loc[:, data[condition].loc[0] == 'mid_body']
  272. center = clean_df(center)
  273. center_dfs[condition] = center
  274. arena_dfs[condition] = pd.concat(arena_dfs[condition])
  275. # get the median position for each arena node in each condition
  276. arena_positions = {}
  277. for condition in conditions:
  278. arena_positions[condition] = arena_dfs[condition].groupby('node').median(numeric_only=True)
  279. def create_arena_plot(arena_positions, condition='acq'):
  280. f, ax = plt.subplots(figsize=(25, 15))
  281. midline_x = (arena_positions[condition].loc['midline_upper']['x'] + arena_positions[condition].loc['midline_lower']['x']) / 2
  282. upper_arena_y = arena_positions[condition].loc['midline_upper']['y']
  283. lower_arena_y = arena_positions[condition].loc['midline_lower']['y']
  284. left_arena_x = (arena_positions[condition].loc['arena_upper_left']['x'] + arena_positions[condition].loc['arena_lower_left']['x']) / 2
  285. right_arena_x = (arena_positions[condition].loc['arena_upper_right']['x'] + arena_positions[condition].loc['arena_lower_right']['x']) / 2
  286. ax.axvline(midline_x, color='r', linestyle='--')
  287. ax.axhline(upper_arena_y, color='r', linestyle='--')
  288. ax.axhline(lower_arena_y, color='r', linestyle='--')
  289. ax.axvline(left_arena_x, color='r', linestyle='--')
  290. ax.axvline(right_arena_x, color='r', linestyle='--')
  291. sns.scatterplot(x='x', y='y', data=arena_positions[condition], ax=ax, s=100, c='r')
  292. return f, ax
  293. condition = 'acq'
  294. novel_side = ni[subject]['novel']
  295. locdf = nose_dfs[condition]
  296. midline_x = (arena_positions[condition].loc['midline_upper']['x'] + arena_positions[condition].loc['midline_lower']['x']) / 2
  297. if novel_side == 'left':
  298. locdf.loc[locdf['x']>midline_x, 'side'] = 'familiar'
  299. locdf.loc[locdf['x']<midline_x, 'side'] = 'novel'
  300. else:
  301. locdf.loc[locdf['x']>midline_x, 'side'] = 'novel'
  302. locdf.loc[locdf['x']<midline_x, 'side'] = 'familiar'
  303. locdf = locdf.loc[locdf['frame']<6000]
  304. f, ax = create_arena_plot(arena_positions, 'acq')
  305. sns.scatterplot(x='x', y='y', data=locdf, hue='side', hue_order=['familiar', 'novel'], palette=['black', 'green'], ax=ax, alpha=0.5, s=30, c='b')
  306. # %%
  307. 2236/6000
  308. # %%
  309. locdf.groupby('side').count()
  310. # %%
  311. sz = 20
  312. alpha = 0.4
  313. f, ax = plt.subplots(3, 1, figsize=(12, 27))
  314. condition = 'acq'
  315. novel_side = ni[subject]['novel']
  316. test_df = center_dfs[condition]
  317. midline_x = (arena_positions[condition].loc['midline_upper']['x'] + arena_positions[condition].loc['midline_lower']['x']) / 2
  318. if novel_side == 'left':
  319. test_df.loc[test_df['x']>midline_x, 'side'] = 'familiar'
  320. test_df.loc[test_df['x']<midline_x, 'side'] = 'novel'
  321. else:
  322. test_df.loc[test_df['x']>midline_x, 'side'] = 'novel'
  323. test_df.loc[test_df['x']<midline_x, 'side'] = 'familiar'
  324. for i, border in enumerate([0, 6000, 12000]):
  325. data_to_plot = test_df.loc[(test_df['frame']>border) & (test_df['frame']<border+6000)]
  326. sns.scatterplot(x='x', y='y', data=data_to_plot, hue='side', hue_order=['familiar', 'novel'], palette=['black', 'green'], ax=ax[i], alpha=alpha, s=sz, c='b')
  327. sns.scatterplot(x='x', y='y', data=arena_positions[condition], ax=ax[i], s=sz*3, c='r')
  328. midline_x = (arena_positions[condition].loc['midline_upper']['x'] + arena_positions[condition].loc['midline_lower']['x']) / 2
  329. upper_arena_y = arena_positions[condition].loc['midline_upper']['y']
  330. lower_arena_y = arena_positions[condition].loc['midline_lower']['y']
  331. left_arena_x = (arena_positions[condition].loc['arena_upper_left']['x'] + arena_positions[condition].loc['arena_lower_left']['x']) / 2
  332. right_arena_x = (arena_positions[condition].loc['arena_upper_right']['x'] + arena_positions[condition].loc['arena_lower_right']['x']) / 2
  333. if i == 0:
  334. tit = 'ACQ PERIOD, 0-5 min'
  335. elif i ==1:
  336. tit = 'ACQ PERIOD, 5-10 min'
  337. else:
  338. tit = 'ACQ PERIOD, 10-15 min'
  339. ax[i].set_title(tit, fontsize=20)
  340. ax[i].axvline(midline_x, color='r', linestyle='--')
  341. ax[i].axhline(upper_arena_y, color='r', linestyle='--')
  342. ax[i].axhline(lower_arena_y, color='r', linestyle='--')
  343. ax[i].axvline(left_arena_x, color='r', linestyle='--')
  344. ax[i].axvline(right_arena_x, color='r', linestyle='--')
  345. f.suptitle(f'{subject} | Body (center) positions and arena boundaries')
  346. f.tight_layout(rect=[0, 0.03, 1, 0.97])
  347. #plt.savefig(f'./plots/{subject}_BODY--scatter_all_frames-ACQ.png')
  348. # %%
  349. sz = 20
  350. alpha = 0.4
  351. f, ax = plt.subplots(3, 1, figsize=(12, 27))
  352. condition = 'test'
  353. novel_side = ni[subject]['novel']
  354. test_df = center_dfs[condition]
  355. midline_x = (arena_positions[condition].loc['midline_upper']['x'] + arena_positions[condition].loc['midline_lower']['x']) / 2
  356. if novel_side == 'left':
  357. test_df.loc[test_df['x']>midline_x, 'side'] = 'familiar'
  358. test_df.loc[test_df['x']<midline_x, 'side'] = 'novel'
  359. else:
  360. test_df.loc[test_df['x']>midline_x, 'side'] = 'novel'
  361. test_df.loc[test_df['x']<midline_x, 'side'] = 'familiar'
  362. for i, border in enumerate([0, 6000, 12000]):
  363. data_to_plot = test_df.loc[(test_df['frame']>border) & (test_df['frame']<border+6000)]
  364. sns.scatterplot(x='x', y='y', data=data_to_plot, hue='side', hue_order=['familiar', 'novel'], palette=['black', 'green'], ax=ax[i], alpha=alpha, s=sz, c='b')
  365. sns.scatterplot(x='x', y='y', data=arena_positions[condition], ax=ax[i], s=sz*3, c='r')
  366. midline_x = (arena_positions[condition].loc['midline_upper']['x'] + arena_positions[condition].loc['midline_lower']['x']) / 2
  367. upper_arena_y = arena_positions[condition].loc['midline_upper']['y']
  368. lower_arena_y = arena_positions[condition].loc['midline_lower']['y']
  369. left_arena_x = (arena_positions[condition].loc['arena_upper_left']['x'] + arena_positions[condition].loc['arena_lower_left']['x']) / 2
  370. right_arena_x = (arena_positions[condition].loc['arena_upper_right']['x'] + arena_positions[condition].loc['arena_lower_right']['x']) / 2
  371. if i == 0:
  372. tit = 'TESTING PERIOD, 0-5 min'
  373. elif i ==1:
  374. tit = 'TESTING PERIOD, 5-10 min'
  375. else:
  376. tit = 'TESTING PERIOD, 10-15 min'
  377. ax[i].set_title(tit, fontsize=20)
  378. ax[i].axvline(midline_x, color='r', linestyle='--')
  379. ax[i].axhline(upper_arena_y, color='r', linestyle='--')
  380. ax[i].axhline(lower_arena_y, color='r', linestyle='--')
  381. ax[i].axvline(left_arena_x, color='r', linestyle='--')
  382. ax[i].axvline(right_arena_x, color='r', linestyle='--')
  383. f.suptitle(f'{subject} | Body (center) positions and arena boundaries')
  384. f.tight_layout(rect=[0, 0.03, 1, 0.97])
  385. #plt.savefig(f'./plots/{subject}_BODY--scatter_all_frames-TEST.png')

individual_scatter_plots.ipynb at commit d62bc21, under MIT · at the source

Overview

  1. Department of Psychiatry, University of Wisconsin–Madison,Madison, WI USA
  2. Neuroscience Training Program, University of Wisconsin–Madison,Madison, WI USA
Institutions: University of Wisconsin–Madison (United States)
Journal: Nature neuroscience, volume 29, issue 8, pages 1954-1965
Dates: received 24 September 2025; accepted 23 April 2026; published online 8 June 2026; in print 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41593-026-02318-9 · PMID 42260219 · PMCID PMC13433317 · OpenAlex W4414870360
Open access: hybrid, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: mouse (organism)
Methods: Spectral & time-frequency, Connectivity, Statistics, Preprocessing, Evoked potentials, Single-unit activity, calcium imaging, Physiology & signal measures
Keywords: Circadian rhythms and sleep, Non-REM sleep, Slow-wave sleep, Sleep deprivation, Neuroscience
MeSH: Cerebral Cortex*, Sleep*, Sleep, Slow-Wave*, Wakefulness*, Animals, Male, Memory Consolidation, Mice, Mice, Inbred C57BL, Mice, Transgenic, Neurons, Optogenetics, Sleep Deprivation (* major topic)
Topic: Sleep and Wakefulness Research (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: cited by 3 papers (Europe PMC); 86 references in the paper

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.

Repositories

Its files are read in the Code ↔ Paper reader above, with 7 matches between paragraphs and lines of code.

CSC-UW/OFF_PERIOD_INDUCTION_MATERIALS

License: MIT
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: d62bc2112a74efa7b389ff7593bacda7791b769c, 24 February 2026
Languages: Jupyter (75), Python (2), R (1)
Size: 235 files, 78 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, license file, 75 notebooks
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Matplotlib (77 files), pandas (76 files), seaborn (76 files), SciPy (64 files), Pingouin (63 files), NumPy (53 files), xarray (29 files), statsmodels (7 files), SpikeInterface (3 files), Plotly (2 files), YASA (2 files), data.table (1 file), lme4 (1 file), lmerTest (1 file), OpenCV (1 file), tidyverse (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
80 files

CSC-UW/sleepscore

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 2d63d1814a54c266a74d41df65fad17ddb783a47, 27 January 2022
Languages: Python (11)
Size: 16 files, 11 scripts
Software Heritage: not archived
Found in: the text, “Sleep scoring”
Holds: README, environment (environment.yml, requirements.txt, setup.py)
Not found: license file, CITATION.cff, tests, continuous integration, documentation
Tools: NumPy (5 files), Matplotlib (1 file), pandas (1 file), SciPy (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
12 files

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:

Read it in the paper: doi.org/10.1038/s41593-026-02318-9.

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:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 89 scripts, each with its path and the digest of its content;
  • 7 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

Datasets cited

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41593-026-02318-9.

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 2, 28 September 2026

  • Publisher: n/a → Nature Portfolio

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 5 keywords, 13 MeSH terms, 1 funder, 86 references.

Cite

This paper

Driessen, K., Squarcio, F., Tononi, G., & Cirelli, C. (2026). Induction of cortical on/off periods in awake mice fulfills sleep functions. Nature neuroscience, 29(8), 1954-1965. https://doi.org/10.1038/s41593-026-02318-9

BibTeX

@article{driessen2026induction,
author = {Driessen, Kort and Squarcio, Fabio and Tononi, Giulio and Cirelli, Chiara},
title = {{Induction of cortical on/off periods in awake mice fulfills sleep functions}},
journal = {Nature neuroscience},
year = {2026},
month = jun,
volume = {29},
number = {8},
pages = {1954--1965},
publisher = {Nature Portfolio},
issn = {1097-6256},
doi = {10.1038/s41593-026-02318-9},
url = {https://doi.org/10.1038/s41593-026-02318-9},
pmid = {42260219},
pmcid = {PMC13433317}
}

RIS

TY - JOUR
AU - Driessen, Kort
AU - Squarcio, Fabio
AU - Tononi, Giulio
AU - Cirelli, Chiara
TI - Induction of cortical on/off periods in awake mice fulfills sleep functions
T2 - Nature neuroscience
J2 - Nat Neurosci
PY - 2026
DA - 2026/06/08
VL - 29
IS - 8
SP - 1954
EP - 1965
SN - 1097-6256
PB - Nature Portfolio
DO - 10.1038/s41593-026-02318-9
UR - https://doi.org/10.1038/s41593-026-02318-9
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41593-026-02318-9",
"type": "article-journal",
"title": "Induction of cortical on/off periods in awake mice fulfills sleep functions",
"container-title": "Nature neuroscience",
"author": [
{
"family": "Driessen",
"given": "Kort"
},
{
"family": "Squarcio",
"given": "Fabio"
},
{
"family": "Tononi",
"given": "Giulio"
},
{
"family": "Cirelli",
"given": "Chiara"
}
],
"container-title-short": "Nat Neurosci",
"volume": "29",
"issue": "8",
"page": "1954-1965",
"DOI": "10.1038/s41593-026-02318-9",
"PMID": "42260219",
"PMCID": "PMC13433317",
"ISSN": "1097-6256",
"publisher": "Nature Portfolio",
"URL": "https://doi.org/10.1038/s41593-026-02318-9",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
8
]
]
}
}

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.1016/j.isci.2023.106186 [code]
Sleep/wake changes in perturbational complexity in rats and mice.
Journal: iScience
In common: SciPy, NumPy, mouse, 7 references, 2 authors
[2] doi:10.1038/s41467-024-53477-x [code]
The human claustrum tracks slow waves during sleep.
Journal: Nature communications
In common: YASA, SpikeInterface, xarray, 10 other tools, 3 references
[3] doi:10.1093/braincomms/fcae354 [code]
Non-rapid eye movement sleep slow-wave activity features are associated with amyloid accumulation in older adults with obstructive sleep apnoea.
Journal: Brain communications
In common: seaborn, pandas, SciPy, 2 other tools, 11 references
[4] doi:10.1371/journal.pbio.3002768 [code]
Slow-wave sleep drives sleep-dependent renormalization of synaptic AMPA receptor levels in the hypothalamus.
Journal: PLoS biology
In common: 13 references
[5] doi:10.1523/eneuro.0280-21.2021 [code]
Measuring Stimulus-Evoked Neurophysiological Differentiation in Distinct Populations of Neurons in Mouse Visual Cortex.
Journal: eNeuro
In common: lme4, seaborn, tidyverse, 4 other tools, mouse, 2 references, 2 authors
[6] doi:10.1038/s41586-025-08888-1 [code]
Adversarial testing of global neuronal workspace and integrated information theories of consciousness.
Journal: Nature
In common: xarray, Pingouin, lmerTest, 7 other tools, 2 references, author Giulio Tononi
[7] doi:10.1038/s41586-024-07367-3 [code]
Sleep pressure modulates single-neuron synapse number in zebrafish.
Journal: Nature
In common: Plotly, lme4, data.table, 6 other tools, 5 references
[8] doi:10.1093/pnasnexus/pgac286 [code]
Information maximization explains state-dependent synaptic plasticity and memory reorganization during non-rapid eye movement sleep.
Journal: PNAS nexus
In common: SciPy, Matplotlib, NumPy, 9 references
[9] doi:10.1038/s42003-024-06941-9 [code]
Coordinated NREM sleep oscillations among hippocampal subfields modulate synaptic plasticity in humans.
Journal: Communications biology
In common: 11 references
[10] doi:10.1073/pnas.2123426119 [code]
Multiple traces and altered signal-to-noise in systems consolidation: Evidence from the 7T fMRI Natural Scenes Dataset.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: 3 references, 2 authors

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.

Add the badge to the code's README

OSCR: the badge of this paper

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 -->
[![OSCR](https://openscicode.org/badge/doi/10.1038/s41593-026-02318-9.svg)](https://openscicode.org/badge/doi/10.1038/s41593-026-02318-9)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1038/s41593-026-02318-9.svg
   :target: https://openscicode.org/badge/doi/10.1038/s41593-026-02318-9
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41593-026-02318-9"><img src="https://openscicode.org/badge/doi/10.1038/s41593-026-02318-9.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

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)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.