OSCR

Modulation of habenula axon terminals supports action-outcome associations in larval zebrafish.

Code ↔ Paper

1 match 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.

The 1 match
  1. [1] § Methods › Data analysis › r-dHb thermal reward response dynamics ↔ FigS5__S7_BC.ipynb, lines 208 to 227 · score 0.65 · 0–2 seconds, 8 seconds, 8–10 seconds, angle · 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 · 469 lines · 16 KB · no license · 1 match

  1. # %%
  2. %matplotlib widget
  3. # %%
  4. from Functions_imaging import *
  5. # %%
  6. c_laser = "#AF2413"
  7. save_fig = Path(os.getcwd())
  8. file = Path(open(str(save_fig / "path.txt"), 'r').readlines()[0])
  9. path = list((file / "S5").glob("*"))
  10. # %%
  11. window=10*5
  12. pre_baseline = 10*5
  13. bins_square = np.linspace(-.1,1,15)
  14. nan_at_transition = True
  15. th_bouts = np.deg2rad(10)
  16. # %%
  17. p = path[-2]
  18. processed_data = np.load(p / "smartdeltaF.npy",allow_pickle=True)[()]
  19. traces = processed_data["traces"]
  20. time_vector_imaging = processed_data["time_vector"]
  21. exp = EmbeddedExperiment(p / "behavior")
  22. bouts = exp.get_bout_properties(threshold=.01)
  23. laser_state = np.interp(processed_data["time_vector"],
  24. exp.stimulus_log.t.values,
  25. exp.stimulus_log.seamless_image_state.values)
  26. bias_behav = get_behav(bouts,processed_data.copy())
  27. # %%
  28. correlations = np.zeros(traces.shape[0])
  29. for i_trace in range(traces.shape[0]):
  30. c_ = fast_pearson(traces[i_trace,:],laser_state)
  31. correlations[i_trace] = c_
  32. # %%
  33. correlation_sorting = np.argsort(correlations)
  34. # %%
  35. c_laser = "#AF2413"
  36. offon = np.where(np.diff(laser_state)>0.5)[0]
  37. onoff = np.where(np.diff(laser_state)<-0.5)[0]
  38. f,a = plt.subplots()
  39. for s_,e_ in zip(offon,onoff):
  40. a.axvspan(time_vector_imaging[s_],time_vector_imaging[e_],
  41. color=c_laser,lw=0,alpha=.3)
  42. off_ = 0
  43. for i in [correlation_sorting[-1],correlation_sorting[0]]:
  44. a.plot(time_vector_imaging,traces[i,:]+off_,c="k",lw=1.5) #3,6,7 ,16,18,19
  45. off_+= np.nanmax(traces[i,:])+.5
  46. a.plot(time_vector_imaging,bias_behav-2,"k",lw=1)
  47. a.set_xlim([0,time_vector_imaging[-1]])
  48. a.set_yticks([])
  49. a.set_xticks([])
  50. f.set_size_inches([8,3])
  51. plt.tight_layout()
  52. sns.despine(left=True,bottom=True)
  53. plt.show()
  54. plt.savefig(save_fig / "S5_B.png",dpi=800,bbox_inches="tight")
  55. # %% [markdown]
  56. # ## temperature responses
  57. # %%
  58. window=20*5
  59. pre_baseline = 10*5
  60. nan_at_transition = True
  61. pooled_ttas = []
  62. region_ids = []
  63. pooled_coordinates = []
  64. fractions = []
  65. for p in path:
  66. processed_data = np.load(p / "smartdeltaF.npy",allow_pickle=True)[()]
  67. traces = processed_data["traces"]
  68. time_vector_imaging = processed_data["time_vector"]
  69. exp = EmbeddedExperiment(p / "behavior")
  70. laser_state = np.interp(processed_data["time_vector"],
  71. exp.stimulus_log.t.values,
  72. exp.stimulus_log.seamless_image_state.values)
  73. ttas = []
  74. for i_trace in range(traces.shape[0]):
  75. if np.nanmax(traces[i_trace,:])<50:
  76. tta = temperature_tta(traces[i_trace,:],laser_state,pre_=pre_baseline,post_=window)
  77. ttas.append(tta)
  78. ttas_ = np.stack(ttas)
  79. pooled_ttas.append(ttas_)
  80. pooled_ttas = np.concatenate(pooled_ttas,0)
  81. # %%
  82. cmap_ = ["Oranges","Blues"]
  83. vmin_ = -.00
  84. vmax_ = 2
  85. time_vector = np.linspace(pre_baseline/5,window/5,pre_baseline+window)
  86. labels_stim = ["temp\nincr.","temp\ndecr."]
  87. f,a = plt.subplots(1,2)
  88. sorting_ = np.argsort(np.nanmean(pooled_ttas[:,1,:],1)-np.nanmean(pooled_ttas[:,0,:],1))
  89. for i_stim in [0,1]:
  90. a[i_stim].imshow(pooled_ttas[:,i_stim,:][sorting_,:],
  91. aspect="auto",extent=[-pre_baseline/5,window/5,0,pooled_ttas.shape[0]],
  92. vmin=vmin_,vmax=vmax_,cmap=cmap_[i_stim],interpolation=None)
  93. if i_stim == 0:
  94. a[i_stim].set_yticks([0,pooled_ttas.shape[0]])
  95. a[i_stim].set_yticklabels(["0 ",pooled_ttas.shape[0]],fontsize=20)
  96. a[i_stim].set_ylabel("r-Hb neurons",fontsize=20)
  97. else: a[i_stim].set_yticks([])
  98. a[i_stim].set_xticks([-pre_baseline/5,0,window/5])
  99. a[i_stim].set_xticklabels([-pre_baseline/5,0,window/5],fontsize=20)
  100. a[i_stim].set_xlabel("time (s)",fontsize=20)
  101. if region_id == 1: a[i_stim].set_title(labels_stim[i_stim],fontsize=20)
  102. f.set_size_inches([7.5,5])
  103. plt.tight_layout()
  104. plt.show()
  105. plt.savefig(save_fig / "S5_C.png",dpi=800,bbox_inches="tight")
  106. # %%
  107. pval_th = 0.05
  108. shuffles = 1000
  109. window=10*5
  110. pre_baseline = 1*5
  111. fractions = []
  112. significant_traces_ON = []
  113. significant_traces_OFF = []
  114. pvals = []
  115. for p in path:
  116. processed_data = np.load(p / "smartdeltaF.npy",allow_pickle=True)[()]
  117. traces = processed_data["traces"]
  118. traces = traces[np.nanmax(traces,1)<10,:]
  119. time_vector_imaging = processed_data["time_vector"]
  120. exp = EmbeddedExperiment(p / "behavior")
  121. laser_state = np.interp(processed_data["time_vector"],
  122. exp.stimulus_log.t.values,
  123. exp.stimulus_log.seamless_image_state.values)
  124. ttas = []
  125. for i_trace in range(traces.shape[0]):
  126. tta = temperature_tta(traces[i_trace,:],laser_state,pre_=pre_baseline,post_=window)
  127. ttas.append(tta)
  128. ttas_ = np.stack(ttas)
  129. real_responses = np.nanmean(ttas_[:,:,pre_baseline:],-1)
  130. pvalues = np.zeros((traces.shape[0],2))
  131. for i_trace in range(traces.shape[0]):
  132. shuffle_distribution = np.zeros((shuffles,2))
  133. for i_shuffle in range(shuffles):
  134. shuffle_distribution[i_shuffle,:] = np.nanmean(temperature_tta(np.roll(traces[i_trace,:],np.random.randint(traces.shape[1])),
  135. laser_state,pre_=pre_baseline,post_=window)[:,pre_baseline:],1)
  136. for i in range(2):
  137. pvalues[i_trace,i] = np.sum(shuffle_distribution[:,i]>real_responses[i_trace,i])/shuffles
  138. pvals.append(pvalues[:,0])
  139. fractions_ = np.array([np.sum(pvalues[:,0]<pval_th)/ttas_.shape[0],
  140. np.sum(pvalues[:,1]<pval_th)/ttas_.shape[0]])
  141. fractions.append(fractions_)
  142. significant_traces_ON.append(ttas_[pvalues[:,0]<pval_th,:,:])
  143. significant_traces_OFF.append(ttas_[pvalues[:,1]<pval_th,:,:])
  144. fractions = np.stack(fractions,0)
  145. pvals = np.concatenate(pvals)
  146. significant_traces_ON = np.concatenate(significant_traces_ON,0)
  147. significant_traces_OFF = np.concatenate(significant_traces_OFF,0)
  148. # %%
  149. wilcoxon(fractions[:,0],fractions[:,1])
  150. # %%
  151. f,a = plt.subplots()
  152. positions = [0,1]
  153. medians = np.nanmedian(fractions*100,0)
  154. for pos_,pos__ in enumerate(positions):
  155. if (pos_%2)==0:
  156. c = cm.Oranges(245)
  157. else:
  158. c = cm.Blues(245)
  159. a.bar([pos__],medians[pos_],color=c)
  160. a.scatter(((np.random.random(fractions.shape[0])-.5)/5)+pos__,
  161. fractions[:,pos_]*100,lw=0,c="gray",alpha=.6,s=100,edgecolors=(0,0,0,1))
  162. a.set_ylabel("Percentage of neurons",fontsize=20)
  163. a.set_yticks([0,20,40,60,80,100])
  164. a.set_yticklabels([0,20,40,60,80,100],fontsize=20)
  165. a.set_xticks([.5])
  166. a.set_xticklabels(["r-dHb"],fontsize=20)
  167. a.set_ylim([0,100])
  168. a.set_xlim([-.5,1.5])
  169. f.set_size_inches([2.6,5])
  170. plt.tight_layout()
  171. sns.despine()
  172. plt.show()
  173. plt.savefig(save_fig / "S5_D.png",dpi=800,bbox_inches="tight")
  174. plt.savefig(save_fig / "S5_D.svg",dpi=800,bbox_inches="tight")
  175. # %% [markdown]
  176. # ## clustering responses
  177. # %%
  178. start = significant_traces_ON[:,0,5:15].max(1)
  179. end = significant_traces_ON[:,0,-10:].max(1)
  180. angle = np.arctan2(start,end)
  181. # %%
  182. f,a = plt.subplots()
  183. a.scatter(start,end,c=angle,s=100)
  184. a.set_yticks([0,1,2,3,4])
  185. a.set_yticklabels([0,1,2,3,4],fontsize=20)
  186. a.set_xticks([0,1,2,3,4])
  187. a.set_xticklabels([0,1,2,3,4],fontsize=20)
  188. a.set_ylim([-.5,4])
  189. a.set_xlim([-.5,4])
  190. a.set_xlabel("ΔF/F 0-2 sec.",fontsize=20)
  191. a.set_ylabel("ΔF/F 8-10 sec.",fontsize=20)
  192. sns.despine()
  193. f.set_size_inches([5,5])
  194. plt.tight_layout()
  195. plt.show()
  196. plt.savefig(save_fig / "S5_E.png",dpi=800,bbox_inches="tight")
  197. plt.savefig(save_fig / "S5_E.svg",dpi=800,bbox_inches="tight")
  198. # %%
  199. time_vector_plot = np.linspace(-1,10,55)
  200. f,a = plt.subplots(1,2)
  201. data_list = [significant_traces_ON[:,0,:],
  202. significant_traces_ON[:,1,:]]
  203. color_list = [cm.Oranges(245),cm.Oranges(245)]
  204. labels_list = [np.digitize(angle,np.linspace(-.2,2,4)),np.digitize(angle,np.linspace(-.2,2,4))]
  205. on_labels = [1,0,0,0,0,0]
  206. axis_list = [0,1,2,3,4,5]
  207. for i_axis,c,data,lab,olab in zip(axis_list,color_list,data_list,labels_list,on_labels):
  208. off_ = 0
  209. for i in np.unique(lab):
  210. if olab==1:
  211. a[i_axis].axvspan(0,10,color=c_laser,lw=0,alpha=.1)
  212. else:
  213. a[i_axis].axvspan(-10,0,color=c_laser,lw=0,alpha=.1)
  214. a[i_axis].plot([-5,10],[off_,off_],"--",c="gray")
  215. a[i_axis].fill_between(time_vector_plot,
  216. np.nanmean(data[lab==i,:]+off_,0)-(sem(data[lab==i,:]+off_,nan_policy="omit")),
  217. np.nanmean(data[lab==i,:]+off_,0)+(sem(data[lab==i,:]+off_,nan_policy="omit")),
  218. color="gray",alpha=.6,lw=0)
  219. a[i_axis].plot(time_vector_plot,np.nanmean(data[lab==i,0:],0)+off_,c=c,lw=2)
  220. off_+=1.5
  221. a[i_axis].set_xticks([0,10])
  222. a[i_axis].set_xticklabels([0,10],fontsize=20)
  223. label_titles = ["temp.\nincr.","temp.\ndecr."]
  224. for i in range(2):
  225. a[i].set_ylim([-1,4])
  226. a[i].set_xlim([-1,10])
  227. a[i].set_yticks([])
  228. a[i].set_xlabel("Time\n(sec.)",fontsize=20)
  229. a[i].set_title(label_titles[i],fontsize=20)
  230. f.set_size_inches([2.5,5])
  231. plt.tight_layout()
  232. sns.despine(left=True)
  233. plt.show()
  234. plt.savefig(save_fig / "S5_G.png",dpi=800,bbox_inches="tight")
  235. plt.savefig(save_fig / "S5_G.svg",dpi=800,bbox_inches="tight")
  236. # %%
  237. labels = np.digitize(angle,np.linspace(-.2,2,4))
  238. for i in range(1,4):
  239. print((labels==i).sum()/labels.size)
  240. # %%
  241. f,a = plt.subplots()
  242. a.hist(angle,np.linspace(-.5,2,20),color="k")
  243. a.set_yticks([0,20,40,60])
  244. a.set_yticklabels([0,20,40,60],fontsize=20)
  245. a.set_xticks([-0.5,0,.5,1,1.5,2])
  246. a.set_xticklabels([-0.5,0,.5,1,1.5,2],fontsize=20)
  247. a.set_ylabel("Counts",fontsize=20)
  248. a.set_xlabel("Polar angle (rad.)",fontsize=20)
  249. f.set_size_inches([4,5])
  250. sns.despine()
  251. plt.tight_layout()
  252. plt.show()
  253. plt.savefig(save_fig / "S5_F.png",dpi=800,bbox_inches="tight")
  254. plt.savefig(save_fig / "S5_F.svg",dpi=800,bbox_inches="tight")
  255. # %% [markdown]
  256. # ## motor modulation index
  257. # %%
  258. recompute = False
  259. mmis_dhb = []
  260. triggers_dhb = []
  261. print("dHb...")
  262. for p in tqdm(path):
  263. if recompute or (not(recompute) and not((p / "mmi_res.npy").exists())):
  264. processed_data = np.load(p / "smartdeltaF.npy",allow_pickle=True)[()]
  265. traces = processed_data["traces"]
  266. traces = traces[np.nanmax(traces,1)<10,:]
  267. time_vector_imaging = processed_data["time_vector"]
  268. exp = EmbeddedExperiment(p / "behavior")
  269. laser_state = np.interp(processed_data["time_vector"],
  270. exp.stimulus_log.t.values,
  271. exp.stimulus_log.seamless_image_state.values)
  272. bouts = exp.get_bout_properties(threshold=.01)
  273. bias_behav = get_behav(bouts,processed_data.copy())
  274. stim_x_behav = get_laser_x_swims(processed_data.copy(),laser_state,bias_behav)
  275. stim_x_behav[(stim_x_behav<0)&(stim_x_behav>-1)] = -1
  276. stim_x_behav[(stim_x_behav>0)&(stim_x_behav<1)] = 1
  277. result,trigg = mmi_analysis_temppval(traces,laser_state,stim_x_behav,bias_behav,pre_=10*5,post_=10*5,
  278. th_bout=np.deg2rad(10),pval_th=0.05,n_shuffles=1000,fract_th=.3,min_samples=4)
  279. np.save(p / "mmi_res.npy",{"result":result,"trigg":trigg})
  280. else:
  281. data = np.load(p / "mmi_res.npy",allow_pickle=True)[()]
  282. result = data["result"]
  283. trigg = data["trigg"]
  284. mmis_dhb.append(result)
  285. triggers_dhb.append(trigg)
  286. # %%
  287. recompute = False
  288. path = list((file / "S7_BC").glob("*"))
  289. mmis_IPN = []
  290. triggers_IPN = []
  291. tuning_sideiIPN = []
  292. print("iIPN...")
  293. for p in tqdm(path):
  294. if recompute or (not(recompute) and not((p / "mmi_res.npy").exists())):
  295. processed_data = np.load(p /"imaging" / "processed.npy",allow_pickle=True)[()]
  296. params = np.load(p / "params_med.npy",allow_pickle=True)[()]
  297. traces = params["shell_deltaF"]
  298. result,trigg = mmi_analysis_temppval(traces,params["laser_state"],
  299. params["stim_x_behav"],
  300. params["bias_behav"],pre_=10*5,post_=10*5,
  301. th_bout=np.deg2rad(10),pval_th=0.05,n_shuffles=1000,fract_th=.3,min_samples=4)
  302. np.save(p / "mmi_res.npy",{"result":result,"trigg":trigg})
  303. else:
  304. params = np.load(p / "params_med.npy",allow_pickle=True)[()]
  305. data = np.load(p / "mmi_res.npy",allow_pickle=True)[()]
  306. result = data["result"]
  307. trigg = data["trigg"]
  308. mmis_IPN.append(result)
  309. triggers_IPN.append(trigg)
  310. tuning_sideiIPN.append(np.array([np.nanmedian(result[np.sign(params["shell_coords"][:,0])==1,1]),
  311. np.nanmedian(result[np.sign(params["shell_coords"][:,0])==-1,1])
  312. ]))
  313. tuning_sideiIPN = np.stack(tuning_sideiIPN)
  314. # %%
  315. bins = np.linspace(-10,10,100)
  316. mmis_dhb_all = np.concatenate(mmis_dhb)[:,0]
  317. mmis_IPN_all = np.concatenate(mmis_IPN)[:,0]
  318. mmis_dhb_avg = []
  319. for i in mmis_dhb:
  320. mmis_dhb_avg.append(np.nanmedian(i[:,0]))
  321. mmis_dhb_avg = np.stack(mmis_dhb_avg)
  322. mmis_IPN_avg = []
  323. for i in mmis_IPN:
  324. mmis_IPN_avg.append(np.nanmedian(i[:,0]))
  325. mmis_IPN_avg = np.stack(mmis_IPN_avg)
  326. # %%
  327. print(np.nanmedian(mmis_dhb_avg[np.isfinite(mmis_dhb_avg)]),
  328. mannwhitneyu(mmis_dhb_avg[np.isfinite(mmis_dhb_avg)],
  329. mmis_IPN_avg[np.isfinite(mmis_IPN_avg)]))
  330. # %%
  331. points_ = np.linspace(-6,6,1000)
  332. binw = .3
  333. f,a = plt.subplots()
  334. d = kernel_density_estimation(mmis_dhb_all[np.isfinite(mmis_dhb_all)],binw,points_)
  335. a.plot(points_,d[1],"gray")
  336. a.fill_between(points_,d[1],color="gray",alpha=.3)
  337. a.plot([np.nanmedian(mmis_dhb_all[np.isfinite(mmis_dhb_all)]),
  338. np.nanmedian(mmis_dhb_all[np.isfinite(mmis_dhb_all)])],[0,.3],"--",c="gray",lw=2)
  339. d = kernel_density_estimation(mmis_IPN_all[np.isfinite(mmis_IPN_all)],binw,points_)
  340. a.plot(points_,d[1],"k")
  341. a.fill_between(points_,d[1],color="k",alpha=.3)
  342. a.plot([np.nanmedian(mmis_IPN_all[np.isfinite(mmis_IPN_all)]),
  343. np.nanmedian(mmis_IPN_all[np.isfinite(mmis_IPN_all)])],[0,.3],"--",c="k",lw=2)
  344. a.set_ylabel("Density",fontsize=20)
  345. a.set_xlabel("Multiplication\nindex",fontsize=20)
  346. a.set_ylim([0,.3])
  347. a.set_xlim([-6,6])
  348. a.set_yticks([0,.1,.2,.3])
  349. a.set_yticklabels([0,.1,.2,.3],fontsize=20)
  350. a.set_xticks([-6,-3,0,3,6])
  351. a.set_xticklabels([-6,-3,0,3,6],fontsize=20)
  352. sns.despine()
  353. f.set_size_inches([3.5,5])
  354. plt.tight_layout()
  355. plt.show()
  356. plt.savefig(save_fig / "S7_B.png",dpi=800,bbox_inches="tight")
  357. plt.savefig(save_fig / "S7_B.svg",dpi=800,bbox_inches="tight")
  358. # %%
  359. mannwhitneyu(mmis_dhb_all[np.isfinite(mmis_dhb_all)],
  360. mmis_IPN_all[np.isfinite(mmis_IPN_all)])
  361. # %%
  362. print(np.nanmedian(mmis_IPN_all[np.isfinite(mmis_IPN_all)]),
  363. np.nanmedian(mmis_dhb_all[np.isfinite(mmis_dhb_all)]))
  364. # %%
  365. bins = np.linspace(-8,8,6)
  366. mmis_dhb_hist = []
  367. for i in mmis_dhb:
  368. c,_ = np.histogram(i[:,0],bins)
  369. c = c / np.sum(c)
  370. mmis_dhb_hist.append(c)
  371. mmis_dhb_hist = np.stack(mmis_dhb_hist)
  372. mmis_IPN_hist = []
  373. for i in mmis_IPN:
  374. c,_ = np.histogram(i[:,0],bins)
  375. c = c / np.sum(c)
  376. mmis_IPN_hist.append(c)
  377. mmis_IPN_hist = np.stack(mmis_IPN_hist)
  378. # %%
  379. bins_plot = (bins[:-1]+bins[1:])/2
  380. f,a = plt.subplots()
  381. a.plot(bins_plot,np.nanmean(mmis_dhb_hist,0),c="gray",lw=3)
  382. a.fill_between(bins_plot, np.nanmean(mmis_dhb_hist,0)-sem(mmis_dhb_hist,0,nan_policy="omit"),
  383. np.nanmean(mmis_dhb_hist,0)+sem(mmis_dhb_hist,0,nan_policy="omit"),lw=0,alpha=.3,color="gray")
  384. a.plot(bins_plot,np.nanmean(mmis_IPN_hist,0),c="k",lw=3)
  385. a.fill_between(bins_plot, np.nanmean(mmis_IPN_hist,0)-sem(mmis_IPN_hist,0,nan_policy="omit"),
  386. np.nanmean(mmis_IPN_hist,0)+sem(mmis_IPN_hist,0,nan_policy="omit"),lw=0,alpha=.2,color="k")
  387. a.set_ylim([0,1])
  388. a.set_xlim([bins_plot[0],bins_plot[-1]])
  389. a.set_ylabel("Relative frequency",fontsize=20)
  390. a.set_xlabel("Multiplication\nindex",fontsize=20)
  391. a.set_yticks([0,.2,.4,.6,.8,1])
  392. a.set_yticklabels([0,.2,.4,.6,.8,1],fontsize=20)
  393. a.set_xticks([-6,-3,0,3,6])
  394. a.set_xticklabels([-6,-3,0,3,6],fontsize=20)
  395. sns.despine()
  396. f.set_size_inches([3,5])
  397. plt.tight_layout()
  398. plt.show()
  399. plt.savefig(save_fig / "S7_C.png",dpi=800,bbox_inches="tight")
  400. plt.savefig(save_fig / "S7_C.svg",dpi=800,bbox_inches="tight")
  401. # %%
  402. for i_bin in range(mmis_IPN_hist.shape[1]):
  403. print(np.round(np.nanmean(mmis_IPN_hist[:,i_bin]),3),
  404. np.round(sem(mmis_IPN_hist[:,i_bin],0,nan_policy="omit"),3),
  405. np.round(np.nanmean(mmis_dhb_hist[:,i_bin]),3),
  406. np.round(sem(mmis_dhb_hist[:,i_bin],0,nan_policy="omit"),3))
  407. # %%
  408. for i_bin in range(mmis_IPN_hist.shape[1]):
  409. sel_IPN = np.isfinite(mmis_IPN_hist[:,i_bin])
  410. sel_dhb = np.isfinite(mmis_dhb_hist[:,i_bin])
  411. print(mannwhitneyu(mmis_IPN_hist[sel_IPN,i_bin],mmis_dhb_hist[sel_dhb,i_bin])[1]*mmis_IPN_hist.shape[1])

FigS5__S7_BC.ipynb at commit 7e49434, no license · at the source

Overview

Authors: Emanuele Paoli1,2, Virginia Palieri1,2, Amey Shenoy1, Ruben Portugues1,3,4,5,6
  1. Institute of Neuroscience, Technical University of Munich, Munich, Germany
  2. Present Address: Champalimaud Neuroscience Programme, Champalimaud Foundation, Lisbon, Portugal
  3. SyNergy Excellence Cluster, Munich, Germany
  4. Bernstein Center for Computational Neuroscience, Munich, Germany
  5. Max Planck Fellow Group - Mechanisms of Cognition, MPI Psychiatry, Munich, Germany
  6. Present Address: Department of Neurobiology and Behavior, Cornell University, Ithaca, NY USA
Journal: Nature communications, volume 17, issue 1, article 8093
Dates: received 20 June 2025; accepted 23 July 2026; published online 7 August 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41467-026-76267-z · PMID 42575891 · PMCID PMC13457560 · OpenAlex W7201881351
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: zebrafish (organism)
Methods: Connectivity, Smoothing, state filtering, decompositions, Preprocessing, fMRI & imaging, Single-unit activity, calcium imaging
Keywords: Reward, Navigation
MeSH: Axons*, Habenula*, Presynaptic Terminals*, Zebrafish*, Animals, Animals, Genetically Modified, Behavior, Animal, Interpeduncular Nucleus, Larva, Neurons, Receptors, GABA-B, Reward (* major topic)
Topic: Zebrafish Biomedical Research Applications (Cell Biology, Biochemistry, Genetics and Molecular Biology), according to OpenAlex
Funding: Deutsche Forschungsgemeinschaft (German Research Foundation) (EXC 2145 SyNergy, identifier 390857198, SPP 2205 (project 430156228), "Enhanced resolution microscopy" (project 518284373))
Citations: not cited yet (Europe PMC); 64 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 1 match between paragraphs and lines of code.

portugueslab/brunoise

License: GPL-3.0
State: the link answers, verified on 4 November 2026
Evidence: files inventoried
Commit: 0a883ebf07b75b0f83c87a00f6b66c7ca44d5298, 13 September 2024
Languages: Python (14), Jupyter (2)
Size: 27 files, 16 scripts
Software Heritage: archived
Found in: the text, “Two-photon microscopy”
Holds: README, license file, environment (environment.yml, pyproject.toml, requirements.txt, setup.cfg, setup.py), continuous integration, 2 notebooks
Not found: CITATION.cff, tests, documentation
Tools: NumPy (6 files), Matplotlib (1 file), Numba (1 file), Pillow (1 file)
Availability: 2 checks, the latest on 4 November 2026: the link answers
  • 4 November 2026: the link answers
  • 27 September 2026: the link answers
18 files

portugueslab/Paoli_et_al_2025

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 7e494341249294af0737e2a0b00d39352e468622, 27 June 2025
Languages: Jupyter (10), Python (3)
Size: 15 files, 13 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, 10 notebooks
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (3 files), SciPy (3 files), Matplotlib (2 files), seaborn (2 files), imageio (1 file), pandas (1 file), scikit-learn (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
14 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/s41467-026-76267-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:

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

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:

Read it in the paper: doi.org/10.1038/s41467-026-76267-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, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 2 keywords, 12 MeSH terms, 1 funder, 63 references.

Cite

This paper

Paoli, E., Palieri, V., Shenoy, A., & Portugues, R. (2026). Modulation of habenula axon terminals supports action-outcome associations in larval zebrafish. Nature communications, 17(1), 8093. https://doi.org/10.1038/s41467-026-76267-z

BibTeX

@article{paoli2026modulation,
author = {Paoli, Emanuele and Palieri, Virginia and Shenoy, Amey and Portugues, Ruben},
title = {{Modulation of habenula axon terminals supports action-outcome associations in larval zebrafish}},
journal = {Nature communications},
year = {2026},
month = aug,
volume = {17},
number = {1},
pages = {8093},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/s41467-026-76267-z},
url = {https://doi.org/10.1038/s41467-026-76267-z},
pmid = {42575891},
pmcid = {PMC13457560}
}

RIS

TY - JOUR
AU - Paoli, Emanuele
AU - Palieri, Virginia
AU - Shenoy, Amey
AU - Portugues, Ruben
TI - Modulation of habenula axon terminals supports action-outcome associations in larval zebrafish
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/08/07
VL - 17
IS - 1
SP - 8093
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/s41467-026-76267-z
UR - https://doi.org/10.1038/s41467-026-76267-z
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-76267-z",
"type": "article-journal",
"title": "Modulation of habenula axon terminals supports action-outcome associations in larval zebrafish",
"container-title": "Nature communications",
"author": [
{
"family": "Paoli",
"given": "Emanuele"
},
{
"family": "Palieri",
"given": "Virginia"
},
{
"family": "Shenoy",
"given": "Amey"
},
{
"family": "Portugues",
"given": "Ruben"
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "8093",
"DOI": "10.1038/s41467-026-76267-z",
"PMID": "42575891",
"PMCID": "PMC13457560",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41467-026-76267-z",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
7
]
]
}
}

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.cub.2023.12.030 [code]
The preoptic area and dorsal habenula jointly support homeostatic navigation in larval zebrafish.
Journal: Current biology : CB
In common: imageio, Numba, seaborn, 5 other tools, zebrafish, 19 references, 3 authors
[2] doi:10.1038/s41467-025-66084-1 [code]
Visual motion and landmark position align with heading direction in the zebrafish interpeduncular nucleus.
Journal: Nature communications
In common: Numba, Pillow, seaborn, 4 other tools, zebrafish, 15 references, author Ruben Portugues
[3] doi:10.1038/s41593-023-01308-5 [code]
Neural dynamics and architecture of the heading direction circuit in zebrafish.
Journal: Nature neuroscience
In common: Numba, Pillow, seaborn, 5 other tools, zebrafish, 11 references, author Ruben Portugues
[4] doi:10.1038/s41586-025-09888-x [code]
Plastic landmark anchoring in zebrafish compass neurons.
Journal: Nature
In common: scikit-learn, SciPy, Matplotlib, 1 other tool, zebrafish, 12 references, author Ruben Portugues
[5] doi:10.1038/s41467-025-62115-z [code]
Inhibition mediated by group III metabotropic glutamate receptors regulates habenula activity and defensive behaviors.
Journal: Nature communications
In common: zebrafish, 16 references
[6] doi:10.1038/s41467-026-69633-4 [code]
Visuomotor decision-making through multifeature convergence in the larval zebrafish hindbrain.
Journal: Nature communications
In common: imageio, Pillow, seaborn, 5 other tools, zebrafish, 11 references
[7] doi:10.1016/j.cub.2025.09.053 [code]
Behavioral and circuit principles of temperature gradient navigation.
Journal: Current biology : CB
In common: Numba, Pillow, seaborn, 5 other tools, zebrafish, 7 references
[8] doi:10.1371/journal.pcbi.1013134 [code]
Sensorimotor integration enhances temperature stimulus processing.
Journal: PLoS computational biology
In common: Numba, seaborn, scikit-learn, 4 other tools, zebrafish, 7 references
[9] doi:10.1016/j.cell.2022.11.022 [code]
A brainstem integrator for self-location memory and positional homeostasis in zebrafish.
Journal: Cell
In common: scikit-learn, pandas, SciPy, 2 other tools, zebrafish, 9 references
[10] doi:10.1038/s41467-026-75490-y [code]
Topographically organized dorsal raphe activity modulates forebrain sensory-motor representations and contributes to defensive behaviors.
Journal: Nature communications
In common: zebrafish, 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.

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/s41467-026-76267-z.svg)](https://openscicode.org/badge/doi/10.1038/s41467-026-76267-z)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1038/s41467-026-76267-z.svg
   :target: https://openscicode.org/badge/doi/10.1038/s41467-026-76267-z
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41467-026-76267-z"><img src="https://openscicode.org/badge/doi/10.1038/s41467-026-76267-z.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.