OSCR

Learning and Motivation State Fluctuations from Motoric and Neurophysiologic Metrics during a Somatosensory Task in Mice.

Code ↔ Paper

16 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.

The 16 matches · 7 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
  1. [1] § Materials and Methods › Pretraining surgeries › Surgery 1: intrinsic optical imaging ↔ HeadFixation/BarrelPiezoCamera.m, lines 1–98 · score 0.94 · Bpod State Machine, high power LED, MV1 D1024E, whisker stimulation, piezo, camera
  2. [2] § Materials and Methods › Pretraining surgeries › Surgery 1: intrinsic optical imaging ↔ HeadFixation/BarrelAveraging.m, the whole file · a weak match · score 0.89 · high power LED, blood vessels, anatomical reference, snapshot, curvature, illumination
  3. [3] § Materials and Methods › Whisker stimulation ↔ HeadFixation/PoleLocation.m, lines 1–91 · score 0.87 · Bpod State Machine, whisker imaging, head fixation, pole, Zaber, actuator
  4. [4] § Materials and Methods › Data analysis › State prediction based on nonperformance variables ↔ LearningMotivationStudy/LearnMotivStudy_StateClassif.m, the whole file · a weak match · score 0.84 · Classification Learner, template tree, learning cycles, decision tree, bagged, fitcensemble
  5. [5] § Materials and Methods › Head fixation, wheel running, and licking ↔ HeadFixation/PoleLocation.m, lines 1–91 · score 0.79 · Bpod Console, head fixation, daily sessions, Sanworks, interface, delivery
  6. [6] § Materials and Methods › Pretraining surgeries › Surgery 1: intrinsic optical imaging ↔ HeadFixation/BarrelAveraging.m, the whole file · a weak match · score 0.76 · red illuminated frames, blood vessel, snapshots, pixels, stimulation, interval
  7. [7] § Materials and Methods › Whisker stimulation ↔ HeadFixation/PassivePiezo.m, lines 1–100 · score 0.74 · Bpod State Machine, whisker stimulator, head fixation, passively, commands
  8. [8] § Materials and Methods › Pretraining surgeries › Surgery 1: intrinsic optical imaging ↔ HeadFixation/BarrelPiezoCamera.m, lines 1–98 · score 0.73 · skull transparency, S1 barrel, Intrinsic, anesthetized, glass, stimulation
  9. [9] § Materials and Methods › Data analysis › State prediction based on nonperformance variables ↔ LearningMotivationStudy/LearnMotivStudy_StateClassif.m, the whole file · a weak match · score 0.72 · vice versa, categorical vector, randomize, chronological, split, blocks
  10. [10] § Materials and Methods › Electrophysiology, data integration, and somatotopy check ↔ HeadFixation/PassivePiezo.m, lines 1–100 · score 0.69 · whisker stimulation, head fixation, RHD2000, Intan, interface, Bpod
  11. [11] § Materials and Methods › Data analysis › Summary values per session ↔ HumanREMinfraslow/humanREMinfraslow_SpectrPhaseQuantif.m, lines 1–82 · score 0.63 · power spectral density, PSD, pwelch, spaced, epoch, window
  12. [12] § Materials and Methods › Pretraining surgeries › Surgery 2: imaging-guided silicon probe implantation ↔ General/channelReMapping.m, the whole file · a weak match · score 0.60 · NeuroNexus, linear shank, Intan, probe, electrode
  13. [13] § Materials and Methods › Data analysis › Electrophysiologic signs of learning within states and trial outcomes ↔ HumanREMinfraslow/humanREMinfraslow_BetaPowerFluct.m, the whole file · a weak match · score 0.59 · temporal smoothing, frequency bins, spectrogram, spaced, sum, power
  14. [14] § Materials and Methods › Go/no-go training ↔ HeadFixation/PoleLocation.m, lines 525–639 · score 0.56 · light cue, onset, rewarded, water, alarm, hit
  15. [15] § Materials and Methods › Data analysis › Summary values per session ↔ REMinfraslow/Preproc/REM_DLCcoordsSingleEpoch.m, the whole file · a weak match · score 0.54 · video frames, DeepLabCut, pixel
  16. [16] § Results › Experimental design, summary of dataset, and study objects ↔ HeadFixation/PiezoDiscrimination.m, lines 248–337 · score 0.54 · correct rejection, go trials, discriminate, alarm, hit, head

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

MATLAB · 639 lines · 24 KB · no license · 3 matches

  1. function PoleLocation
  2. % Trains head-fixed mice to discriminate pole locations through whisking.
  3. % The user is prompted to select one of two phases before each session.
  4. % Before starting this training, mice should be pre-trained for water
  5. % consumption at the lickometer.
  6. %
  7. % - Phase 1 (string 't'): two-location discrimination training (usually
  8. % 5-10 daily sessions of ~60 min).
  9. %
  10. % - Phase 2 (string 'm'): multiple location test (can be made just once or
  11. % twice, during post-training neurophysiological recordings).
  12. %
  13. %
  14. %
  15. % NECESSARY HARDWARE ______________________________________________________
  16. % - Bpod State Machine combined with Bpod Analog Output Module: reads task
  17. % parameters, controls trial loops, sends commands to Zaber actuators,
  18. % gets mouse responses at the lickometer (beam breaks), activates water
  19. % valve for rewards (or punishment time outs), provides timestamps to
  20. % Intan, displays behavioral performance during the session, and saves
  21. % trial outcomes.
  22. %
  23. % - Zaber X-MCB2: responds to inputs from both Bpod devices through
  24. % triggers configured by another script in C# (PoleLocTriggers.cs, also
  25. % available in this repository).
  26. %
  27. %
  28. %
  29. % OPTIONAL HARDWARE _______________________________________________________
  30. % - Intan RHD2000: acquires digital and analog events to be used as
  31. % timestamps during analysis.
  32. %
  33. % - Whisker imaging camera (Mikrotron, EoSens) and frame grabber
  34. % (Teledyne Dalsa Xtium): not described here.
  35. %
  36. % - Pupil imaging camera (Flea3) and PCIe card: not described here.
  37. %
  38. %
  39. %
  40. % TASK DESIGN (GO/NO-GO) __________________________________________________
  41. % - Inspired mostly by: - O'Connor et al. (2010) - J Neurosci 30,
  42. % - Schriver et al. (2018) - J Neurophysiol 120, and
  43. % - lab discussions
  44. %
  45. % - Whisker (pole) stimulation -> response window -> inter-trial interval
  46. %
  47. % - Up to five pole locations along the whisker pad, named according to the
  48. % anterior-posterior axis as below:
  49. % - PP: extreme posterior (both 't' and 'm' phases)
  50. % - P : intermediate posterior (phase 'm' only)
  51. % - H : halfway (phase 'm' only)
  52. % - A : intermediate anterior (phase 'm' only)
  53. % - AA: extreme anterior (both 't' and 'm' phases)
  54. %
  55. % - Locations PP and P: go trials
  56. % - Trial outcomes: hit (lick) or miss (no lick)
  57. % - Hit: water is delivered
  58. % - Miss: nothing happens (inter-trial interval)
  59. %
  60. % - Locations AA and A: no-go trials
  61. % - Trial outcomes: false alarm (lick) or corr rejection (no lick)
  62. % - False alarm: punishment (light-cued time out)
  63. % - Corr rejection: nothing happens (punishment is avoided)
  64. %
  65. % - Halfway: either go or no-go randomly (50% chance)
  66. %
  67. % - Locations vary at constant distances in the rostral-caudal direction.
  68. % See PoleLocTriggers.cs for distances along the whisker pad.
  69. %
  70. % - The multiple location test is hypothesized to yield sigmoid
  71. % psychometric fits.
  72. %
  73. % See the second section of this script ("Sets parameters") for stimulus
  74. % durations, trial length, etc.
  75. %
  76. %
  77. %
  78. % USAGE ___________________________________________________________________
  79. % Step 1: Load the Zaber Console software, open the X-MCB2 device, and run
  80. % PoleLocTriggers.cs. Check if "completed" is displayed in the Script
  81. % Output Area. Still in the Zaber Console, go to the "Simple" tab, and set
  82. % axis 1 position to zero, and axis 2 to the halfway (see
  83. % PoleLocTriggers.cs for the halfway position in microsteps).
  84. %
  85. % Step 2: Go back to Matlab, enter "Bpod" in the Command Window, and wait
  86. % until the Bpod Console is ready. Then enter "PoleLocation", and respond
  87. % to the prompt(s). With appropriate cabling, digital and analog events
  88. % should be visible in the Intan RHD interface.
  89. %
  90. % LSBuenoJr and MXDing, with inputs from the Sanworks Support Forum _______
  91. %% Sets base path, asks user about saving a previous session (if present in
  92. % the working directory), and asks user to specify the training phase.
  93. global BpodSystem;
  94. basepath = cd;
  95. if ~isempty(BpodSystem.Data) || exist('SessionData.mat') %#ok<EXIST>
  96. prompt = 'Save previous session? (y/n)';
  97. prompt = input(prompt,'s');
  98. if strcmp(prompt,'y')
  99. SessionData = BpodSystem.Data;
  100. save(fullfile(basepath,...
  101. 'PoleLocPreviousSession.mat'),'SessionData','-v6');
  102. end
  103. BpodSystem.Data = [];
  104. end
  105. prompt = ...
  106. 'Two locations (t), or Multiple locations (m)? ';
  107. prompt = input(prompt,'s');
  108. %% Configures square pulses to be sent from the Analog Output Module to
  109. % Zaber. They will trigger five different pole location stimuli. This
  110. % had to be done given the limited number of output channels offered by the
  111. % Bpod State Machine.
  112. W = BpodWavePlayer('COM6'); % If not this communication port, go to:
  113. % Control Panel -> Devices and Printers, then
  114. % left-click X-MCB2 to set properties.
  115. W.TriggerMode = 'Normal';
  116. W.TriggerProfileEnable = 'On';
  117. W.TriggerProfiles(1,1:5) = [1 4 4 4 4]; % Out of BNC #1 (Location PP)
  118. W.TriggerProfiles(2,1:5) = [4 2 4 4 4]; % ... #2 (Location P)
  119. W.TriggerProfiles(3,1:5) = [4 4 2 4 4]; % ... #3 (Location A)
  120. W.TriggerProfiles(4,1:5) = [4 4 4 1 4]; % ... #4 (Location AA)
  121. W.TriggerProfiles(5,1:5) = [4 4 4 4 3]; % ... #5 (Halfway location)
  122. PoleMovement = 0.8; % Period it takes for the pole to reach the whisker
  123. % level. This will be added to a 0.1 s trial onset
  124. % digital event for a total of 0.9 s (see the
  125. % first use of Bpod AddState function, in the last
  126. % section of this script). Durations were defined by
  127. % high-speed videography of pole movements.
  128. W.loadWaveform(1,...
  129. ones(1,W.SamplingRate*PoleMovement)*3); % Locations PP and AA; no
  130. % latency before pole movement
  131. % 3 volts
  132. W.loadWaveform(2,...
  133. [ones(1,W.SamplingRate*0.1)*0.5 ... % Latency of 0.1 s, 3 volts
  134. ones(1,W.SamplingRate*(PoleMovement-0.1))*3]); % Locations P and A
  135. W.loadWaveform(3,...
  136. [ones(1,W.SamplingRate*0.3)*0.5 ... % Latency of 0.3 s, 3 volts
  137. ones(1,W.SamplingRate*(PoleMovement+1.5))*3]); % Halfway location
  138. W.loadWaveform(4,...
  139. zeros(1,W.SamplingRate*PoleMovement)); % Nothing, just flat voltage.
  140. %% Sets parameters (e.g., stimulus durations, inter-trial intervals, etc.).
  141. S.GUI.TrialLength_seconds = 6; % In seconds
  142. S.GUI.RewardAmount_mL = 5; % In microliters
  143. S.GUI.WaterValveTime = GetValveTimes(S.GUI.RewardAmount_mL,1);
  144. S.GUI.PreStimPeriod = PoleMovement;
  145. S.GUI.RespPeriod = 1.5;
  146. S.GUI.PunishmentPeriod = 9;
  147. S.GUIPanels.Durations_and_RewardAmount = {...
  148. 'TrialLength_seconds',...
  149. 'WaterValveTime',...
  150. 'PreStimPeriod',...
  151. 'RespPeriod',...
  152. 'PunishmentPeriod',...
  153. 'RewardAmount_mL',...
  154. };
  155. BpodParameterGUI('init',S);clear ans
  156. %% Generates the sequence of trials upon user input.
  157. switch prompt
  158. case 'm'
  159. TrialSeq = [ones(1,50)+1 nan(1,995)];
  160. % TrialTypes = 1:6;
  161. % for i = 6:length(TrialSeq)
  162. % PickTrialType = randi(length(TrialTypes));
  163. % TrialSeq(i) = TrialTypes(PickTrialType);
  164. % end
  165. case 't'
  166. MaxSameTrial = 3; % Limits trial type repetition to three consecutive.
  167. TrialSeq = [zeros(1,5) nan(1,995)]; % Pre-defines five initial trials.
  168. for i = 6:length(TrialSeq)
  169. if i > MaxSameTrial
  170. if sum(TrialSeq((i-MaxSameTrial):(i-1))) == ...
  171. 0
  172. TrialSeq(i) = 1;
  173. elseif sum(TrialSeq((i-MaxSameTrial):(i-1))) == ...
  174. MaxSameTrial
  175. TrialSeq(i) = 0;
  176. else
  177. TrialSeq(i) = round(rand(1));
  178. end
  179. else
  180. TrialSeq(i) = round(rand(1));
  181. end
  182. end
  183. TrialSeq = TrialSeq+1;
  184. end
  185. BpodSystem.Data.TrialSeq = TrialSeq;
  186. BpodSystem.Data.SessionData = nan(size(TrialSeq));
  187. %% Configures the outcome plot to display the behavioral performance
  188. % during the session.
  189. BpodSystem.ProtocolFigures.GoNogoPerfOutcomePlotFig = figure(...
  190. 'Position',[200 100 1400 200],...
  191. 'name','Outcome plot',...
  192. 'numbertitle','off',...
  193. 'MenuBar', 'none',...
  194. 'Resize', 'off',...
  195. 'Color', [1 1 1]);
  196. BpodSystem.GUIHandles.GoNogoPerfOutcomePlot = axes(...
  197. 'Position',[.2 .2 .75 .7]);
  198. uicontrol(....
  199. 'Style','text',...
  200. 'String','nDisplay',...
  201. 'Position',[10 170 45 15],...
  202. 'HorizontalAlignment','left',...
  203. 'BackgroundColor', [1 1 1]);
  204. BpodSystem.GUIHandles.DisplayNTrials = uicontrol(...
  205. 'Style','edit',...
  206. 'string','90',...
  207. 'Position',[55 170 40 15],...
  208. 'HorizontalAlignment','left',...
  209. 'BackgroundColor',[1 1 1]);
  210. uicontrol(...
  211. 'Style','text',...
  212. 'String','Correct % (all): ',...
  213. 'Position',[10 140 80 15],...
  214. 'HorizontalAlignment','left',...
  215. 'BackgroundColor',[1 1 1]);
  216. BpodSystem.GUIHandles.hitpct = uicontrol(...
  217. 'Style','text',...
  218. 'string','0',...
  219. 'Position',[95 140 40 15],...
  220. 'HorizontalAlignment','left',...
  221. 'BackgroundColor',[1 1 1]);
  222. uicontrol(...
  223. 'Style','text',...
  224. 'String','Correct % (40): ',...
  225. 'Position',[10 120 80 15],...
  226. 'HorizontalAlignment','left',...
  227. 'BackgroundColor',[1 1 1]);
  228. BpodSystem.GUIHandles.hitpctrecent = uicontrol(...
  229. 'Style','text',...
  230. 'string','0',...
  231. 'Position',[95 120 40 15],...
  232. 'HorizontalAlignment','left',...
  233. 'BackgroundColor',[1 1 1]);
  234. uicontrol(...
  235. 'Style','text',...
  236. 'String','Corr rej %: ',...
  237. 'Position',[10 90 80 15],...
  238. 'HorizontalAlignment','left',...
  239. 'BackgroundColor',[1 1 1]);
  240. BpodSystem.GUIHandles.hitpctnogo = uicontrol(...
  241. 'Style','text',...
  242. 'string','0',...
  243. 'Position',[95 90 40 15],...
  244. 'HorizontalAlignment','left',...
  245. 'BackgroundColor',[1 1 1]);
  246. uicontrol(...
  247. 'Style','text',...
  248. 'String','Hit % : ',...
  249. 'Position',[10 70 80 15],...
  250. 'HorizontalAlignment','left',...
  251. 'BackgroundColor',[1 1 1]);
  252. BpodSystem.GUIHandles.hitpctgo = uicontrol(...
  253. 'Style','text',...
  254. 'string','0',...
  255. 'Position',[95 70 40 15],...
  256. 'HorizontalAlignment','left',...
  257. 'BackgroundColor',[1 1 1]);
  258. uicontrol(...
  259. 'Style','text',...
  260. 'String','Trials: ',...
  261. 'Position',[10 40 80 15],...
  262. 'HorizontalAlignment','left',...
  263. 'BackgroundColor', [1 1 1]);
  264. BpodSystem.GUIHandles.numtrials = uicontrol(...
  265. 'Style','text',...
  266. 'string','0',...
  267. 'Position',[95 40 40 15],...
  268. 'HorizontalAlignment','left',...
  269. 'BackgroundColor',[1 1 1]);
  270. uicontrol(...
  271. 'Style','text',...
  272. 'String','Rewards: ',...
  273. 'Position',[10 20 80 15],...
  274. 'HorizontalAlignment','left',...
  275. 'BackgroundColor',[1 1 1]);
  276. BpodSystem.GUIHandles.numrewards = uicontrol(...
  277. 'Style','text',...
  278. 'string','0',...
  279. 'Position',[95 20 40 15],...
  280. 'HorizontalAlignment','left',...
  281. 'BackgroundColor', [1 1 1]);
  282. BpodSystem.GUIHandles.CxnDisplay = uicontrol(...
  283. 'Style','text',...
  284. 'string','Playing',...
  285. 'Position',[130 90 70 20],...
  286. 'HorizontalAlignment','left',...
  287. 'BackgroundColor', [1 1 1]);
  288. TrialTypeOutcomePlot(BpodSystem.GUIHandles.GoNogoPerfOutcomePlot,...
  289. 'init',BpodSystem.Data.TrialSeq);
  290. %% Main loop
  291. Outcomes = nan(size(TrialSeq));StimType = cell(1);Action = cell(1);
  292. for i = 1:length(TrialSeq)
  293. % Synchronizes with BpodParameterGUI plugin and outcome plot.
  294. S = BpodParameterGUI('sync',S);
  295. TrialTypeOutcomePlot(...
  296. BpodSystem.GUIHandles.GoNogoPerfOutcomePlot,'update',...
  297. i,BpodSystem.Data.TrialSeq,Outcomes);
  298. % Displays trials on the command window and saves trials settings. For
  299. % multiple pole locations, trials are identified from 1 to 6. For two
  300. % pole locations, trials are identified as either 1 or 2. This latter
  301. % avoids an empty space between 1 and 6 on the outcome plot Y axis.
  302. switch prompt
  303. case 'm'
  304. if TrialSeq(i) == 1
  305. str = 'Go (Location PP)';
  306. StimType{i} = 'Location_PP';
  307. Action{i} = 'Hit_PP'; % Posterior defined as "go"
  308. % based on O'Connor et al.
  309. % (2010) - J Neurosci 30.
  310. elseif TrialSeq(i) == 2
  311. str = 'Go (Location P)';
  312. StimType{i} = 'Location_P';
  313. Action{i} = 'Hit_P';
  314. elseif TrialSeq(i) == 3
  315. str = 'Go (Halfway)';
  316. StimType{i} = 'Go_Halfway';
  317. Action{i} = 'Hit_H';
  318. elseif TrialSeq(i) == 4
  319. str = 'Nogo (Halfway)';
  320. StimType{i} = 'Nogo_Halfway';
  321. Action{i} = 'FalseAlarm_H';
  322. elseif TrialSeq(i) == 5
  323. str = 'Nogo (Location A)';
  324. StimType{i} = 'Location_A';
  325. Action{i} = 'FalseAlarm_A';
  326. elseif TrialSeq(i) == 6
  327. str = 'Nogo (Location AA)';
  328. StimType{i} = 'Location_AA';
  329. Action{i} = 'FalseAlarm_AA';
  330. end
  331. case 't'
  332. if TrialSeq(i) == 1
  333. str = 'Go (Location PP)';
  334. StimType{i} = 'Location_PP';
  335. Action{i} = 'Hit_PP';
  336. elseif TrialSeq(i) == 2
  337. str = 'Nogo (Location AA)';
  338. StimType{i} = 'Location_AA';
  339. Action{i} = 'FalseAlarm_AA';
  340. end
  341. end
  342. disp(['Trial #' num2str(i) ...
  343. ', ' str ' (' num2str(TrialSeq(i)) ')'])
  344. BpodSystem.Data.TrialSettings(i) = S;
  345. % Sets Bpod state matrix using the locations ("StimType{i}"), and
  346. % hits or false alarms ("Action{i}") defined above.
  347. sma = NewStateMatrix();
  348. sma = PoleLocation_Matrix(sma,S,Action{i},StimType{i});
  349. SendStateMachine(sma);
  350. RawEvents = RunStateMachine;
  351. % Allocates trials as states into the "BpodSystem.Data" structure.
  352. if ~isempty(fieldnames(RawEvents))
  353. BpodSystem.Data = AddTrialEvents(BpodSystem.Data,RawEvents);
  354. switch prompt
  355. case 'm'
  356. if TrialSeq(i) == 1 % Go trial PP
  357. if ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  358. States.Hit_PP(1))
  359. Outcomes(i) = 1; % Hit
  360. elseif ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  361. States.TimeOut(1))
  362. Outcomes(i) = -1; % Miss
  363. else
  364. end
  365. elseif TrialSeq(i) == 2 % Go trial P
  366. if ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  367. States.Hit_P(1))
  368. Outcomes(i) = 1; % Hit
  369. elseif ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  370. States.TimeOut(1))
  371. Outcomes(i) = -1; % Miss
  372. else
  373. end
  374. elseif TrialSeq(i) == 3 % Go trial halfway
  375. if ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  376. States.Hit_H(1))
  377. Outcomes(i) = 1; % Hit
  378. elseif ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  379. States.TimeOut(1))
  380. Outcomes(i) = -1; % Miss
  381. else
  382. end
  383. elseif TrialSeq(i) == 4 % Nogo trial halfway
  384. if ~isnan(BpodSystem.Data.RawEvents.Trial{i}.States. ...
  385. FalseAlarm_H(1))
  386. Outcomes(i) = 0; % False alarm
  387. elseif ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ....
  388. States.TimeOut(1))
  389. Outcomes(i) = 2; % Correct rejection
  390. else
  391. end
  392. elseif TrialSeq(i) == 5 % Nogo trial A
  393. if ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  394. States.FalseAlarm_A(1))
  395. Outcomes(i) = 0; % False alarm
  396. elseif ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  397. States.TimeOut(1))
  398. Outcomes(i) = 2; % Correct rejection
  399. else
  400. end
  401. elseif TrialSeq(i) == 6 % Nogo trial AA
  402. if ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  403. States.FalseAlarm_AA(1))
  404. Outcomes(i) = 0; % False alarm
  405. elseif ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  406. States.TimeOut(1))
  407. Outcomes(i) = 2; % Correct rejection
  408. else
  409. end
  410. end
  411. case 't'
  412. if TrialSeq(i) == 1 % Go trial PP
  413. if ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  414. States.Hit_PP(1))
  415. Outcomes(i) = 1; % Hit
  416. elseif ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  417. States.TimeOut(1))
  418. Outcomes(i) = -1; % Miss
  419. else
  420. end
  421. elseif TrialSeq(i) == 2 % Nogo trial AA
  422. if ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  423. States.FalseAlarm_AA(1))
  424. Outcomes(i) = 0; % False alarm
  425. elseif ~isnan(BpodSystem.Data.RawEvents.Trial{i}. ...
  426. States.TimeOut(1))
  427. Outcomes(i) = 2; % Correct rejection
  428. else
  429. end
  430. end
  431. end
  432. BpodSystem.Data.SessionData(i) = Outcomes(i);
  433. BpodSystem.ProtocolSettings = S;
  434. % Saves trial outcomes and timestamps.
  435. SessionData = BpodSystem.Data;
  436. save(fullfile(basepath,'SessionData.mat'),'SessionData','-v6');
  437. end
  438. if BpodSystem.Status.BeingUsed == 0;return;end
  439. correct = Outcomes == 1 | Outcomes == 2;
  440. hitgo = Outcomes == 1;
  441. hitnogo = Outcomes == 2;
  442. correctpct = 100.*sum(correct)./i;
  443. hitpctgo = 100.*sum(hitgo)./sum(TrialSeq(1:i));
  444. hitpctnogo = 100.*sum(hitnogo)./sum(TrialSeq(1:i) == 0);
  445. inds40 = max(1,i-40+1):i;
  446. correctpctrecent = 100.*sum(correct(inds40))./numel(inds40);
  447. set(BpodSystem.GUIHandles.hitpct,...
  448. 'String', num2str(correctpct));
  449. set(BpodSystem.GUIHandles.hitpctrecent,...
  450. 'String', num2str(correctpctrecent));
  451. set(BpodSystem.GUIHandles.hitpctgo,...
  452. 'String', num2str(hitpctgo));
  453. set(BpodSystem.GUIHandles.hitpctnogo,...
  454. 'String', num2str(hitpctnogo));
  455. set(BpodSystem.GUIHandles.numtrials,...
  456. 'String',num2str(i));
  457. set(BpodSystem.GUIHandles.numrewards,...
  458. 'String', num2str(sum(hitgo)));
  459. if BpodSystem.Status.BeingUsed == 0
  460. return
  461. end
  462. end
  463. %% Bpod conversation via state matrix
  464. function sma = PoleLocation_Matrix(sma,S,CurrentAction,CurrentStimType)
  465. % Communicates the State Machine with the Analog Output Module.
  466. LoadSerialMessages('WavePlayer1',{['P' 0],['P' 1],['P' 2],['P' 3],['P' 4]});
  467. % Sets states and their timers, subsequent events, and output actions.
  468. sma = SetGlobalTimer(sma,...
  469. 'TimerID',1,...
  470. 'Duration',S.GUI.TrialLength_seconds);
  471. sma = AddState(sma,'Name','TrialStart',...
  472. 'Timer',0.1,...
  473. 'StateChangeConditions',{'Tup',CurrentStimType},...
  474. 'OutputActions',{'GlobalTimerTrig',1,'Wire1',1}); % Digital event out
  475. % of wire #1 to Intan
  476. sma = AddState(sma,'Name','Location_PP',...
  477. 'Timer',S.GUI.PreStimPeriod,...
  478. 'StateChangeConditions',{'Tup','ResponseWindow'},...
  479. 'OutputActions',{'WavePlayer1',1}); % BNC #1 of the Analog Output
  480. % Module controls X-MCB2, and sends
  481. % a copy of the event to Intan.
  482. sma = AddState(sma,'Name','Location_P',...
  483. 'Timer', S.GUI.PreStimPeriod,...
  484. 'StateChangeConditions',{'Tup','ResponseWindow'},...
  485. 'OutputActions',{'WavePlayer1',2}); % As above; BNC #2
  486. sma = AddState(sma,'Name','Location_A',...
  487. 'Timer', S.GUI.PreStimPeriod,...
  488. 'StateChangeConditions',{'Tup','ResponseWindow'},...
  489. 'OutputActions',{'WavePlayer1',3}); % As above; BNC #3
  490. sma = AddState(sma,'Name','Location_AA',...
  491. 'Timer', S.GUI.PreStimPeriod,...
  492. 'StateChangeConditions',{'Tup','ResponseWindow'},...
  493. 'OutputActions',{'WavePlayer1',4}); % As above; BNC #4
  494. sma = AddState(sma,'Name','Nogo_Halfway',...
  495. 'Timer', S.GUI.PreStimPeriod,...
  496. 'StateChangeConditions',{'Tup','ResponseWindow'},...
  497. 'OutputActions',{'WavePlayer1',5}); % As above; BNC #5
  498. sma = AddState(sma,'Name','Go_Halfway',...
  499. 'Timer', S.GUI.PreStimPeriod,...
  500. 'StateChangeConditions',{'Tup','ResponseWindow'},...
  501. 'OutputActions',{'WavePlayer1',5}); % As above; also BNC #5
  502. sma = AddState(sma,'Name','ResponseWindow',...
  503. 'Timer',S.GUI.RespPeriod,...
  504. 'StateChangeConditions',{'Port1In',CurrentAction,'Tup','TimeOut'},...
  505. 'OutputActions',{'Wire1',1,'BNC2',1}); % Response window out of wire #1
  506. % (to Intan) and BNC #2 (for
  507. % triggering the whisker camera)
  508. sma = AddState(sma,'Name','Hit_PP',...
  509. 'Timer',S.GUI.WaterValveTime,...
  510. 'StateChangeConditions',{'Tup','TimeOut'},...
  511. 'OutputActions',{'ValveState',1,'BNC1',1}); % Rewarded response, and
  512. % corresponding event out
  513. % of the State Machine
  514. % (BNC #1) to Intan
  515. sma = AddState(sma,'Name','Hit_P',...
  516. 'Timer',S.GUI.WaterValveTime,...
  517. 'StateChangeConditions',{'Tup','TimeOut'},...
  518. 'OutputActions',{'ValveState',1,'BNC1',1}); % As above
  519. sma = AddState(sma,'Name','Hit_H',...
  520. 'Timer',S.GUI.WaterValveTime,...
  521. 'StateChangeConditions',{'Tup','TimeOut'},...
  522. 'OutputActions',{'ValveState',1,'BNC1',1}); % As above
  523. sma = AddState(sma,'Name','FalseAlarm_H',...
  524. 'Timer',0.1,...
  525. 'StateChangeConditions',{'Tup','FalseAlarm_H_timeout'},...
  526. 'OutputActions',{'BNC1',1,'PWM1',200}); % Onset of punishment time out
  527. % from BNC #1 of State Machine
  528. % to Intan, along with a
  529. % 0.1 s light cue
  530. sma = AddState(sma,'Name','FalseAlarm_H_timeout',...
  531. 'Timer',S.GUI.PunishmentPeriod-0.1,...
  532. 'StateChangeConditions',{'Tup','exit','Port1In','FalseAlarm_H_timeout'},...
  533. 'OutputActions',{'BNC1',1}); % Remaining time out period
  534. sma = AddState(sma,'Name','FalseAlarm_A',...
  535. 'Timer',0.1,...
  536. 'StateChangeConditions',{'Tup','FalseAlarm_A_timeout'},...
  537. 'OutputActions',{'BNC1',1,'PWM1',200}); % As above
  538. sma = AddState(sma,'Name','FalseAlarm_A_timeout',...
  539. 'Timer',S.GUI.PunishmentPeriod-0.1,...
  540. 'StateChangeConditions',{'Tup','exit','Port1In','FalseAlarm_A_timeout'},...
  541. 'OutputActions',{'BNC1',1}); % As above
  542. sma = AddState(sma,'Name','FalseAlarm_AA',...
  543. 'Timer',0.1,...
  544. 'StateChangeConditions',{'Tup','FalseAlarm_AA_timeout'},...
  545. 'OutputActions',{'BNC1',1,'PWM1',200}); % As above
  546. sma = AddState(sma,'Name','FalseAlarm_AA_timeout',...
  547. 'Timer',S.GUI.PunishmentPeriod-0.1,...
  548. 'StateChangeConditions',{'Tup','exit','Port1In','FalseAlarm_AA_timeout'},...
  549. 'OutputActions',{'BNC1',1}); % As above
  550. sma = AddState(sma,'Name','TimeOut',...
  551. 'Timer',10,...
  552. 'StateChangeConditions',{'GlobalTimer1_End','exit'},...
  553. 'OutputActions',{});
  554. end
  555. end

PoleLocation.m at commit 6323dd1, no license · at the source

Overview

  1. Department of Psychiatry, University of Michigan Medical School, Ann Arbor, Michigan 48109
  2. Department of Psychology, Brandeis University, Waltham, Massachusetts 02453
Institutions: University of Michigan (United States); Michigan Medicine (United States); Brandeis University (United States)
Journal: eNeuro, volume 13, issue 5, pages ENEURO.0417-25.2026
Dates: received 25 September 2025; accepted 27 April 2026; published online 26 May 2026; in print May 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1523/eneuro.0417-25.2026 · PMID 42140702 · PMCID PMC13220975 · OpenAlex W7161249088
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: behavior only (modality), mouse (organism)
Methods: Connectivity, Spectral & time-frequency, Statistics, Preprocessing, fMRI & imaging, Smoothing, state filtering, decompositions, Physiology & signal measures
Keywords: eye movements, laminar neocortical activity, motivation fluctuations, performance variations, wheel running, whisker stimulation
MeSH: Behavior, Animal*, Learning*, Motivation*, Motor Activity*, Psychomotor Performance*, Somatosensory Cortex*, Touch Perception*, Animals, Male, Mice, Mice, Inbred C57BL, Vibrissae (* major topic)
Topic: Transcranial Magnetic Stimulation Studies (Neurology, Neuroscience), according to OpenAlex
Funding: Pritzker Neuropsychiatric Disorders Research Consortium; University of Michigan Neuroscience Scholars
Citations: not cited yet (Europe PMC); 61 references in the paper

Abstract

Animal learning can be analyzed on two timescales: task acquisition across training sessions and motivation fluctuations within training sessions. How do variations in motor and neurophysiologic activity relate to task performance over these timescales? Here, this question was examined in head-fixed mice performing a whisker-based sensory discrimination task. Male mice were trained for 12–14 daily sessions on a go/no-go task, each lasting ∼1 h to capture spontaneous performance fluctuations over minutes. Simultaneous to task performance, “nonperformance variables” were tracked, including wheel running, pupil size, eyelid aperture, and sensory cortical activity. First, motivation states were defined based on performance tendencies over minutes, leading to three state categories: persistent, disengaged, or attentive. Nonperformance variables were found to predict these states independent of task correctness. Then, when further parsing these states by the go/no-go outcomes of hit, miss, false alarm, or correct rejection, learning-like changes were detected in wheel running, eye movements, and brain activity. Thus, learning over days and motivation fluctuations over minutes form a continuum, as evidenced by changes in motor and physiologic activity variables not directly controlled by task contingencies, even during periods of suboptimal performance in well-trained subjects. These findings improve the understanding of performance variations and implicit learning, in addition to contributing a framework for the analysis of task performance indirectly from motor and neurophysiologic activity.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

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

brendonw1/watsonlabcode

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 6323dd12e4266536b899a2676fcf92aa49d605b6, 9 September 2026
Languages: MATLAB (1957), C (73), C++ (2), Shell (2), Python (1)
Size: 2,630 files, 2,035 scripts
Software Heritage: not archived
Found in: “Code accessibility”
Holds: README, tests, documentation, 6 notebooks
Not found: license file, CITATION.cff, environment file, continuous integration
Tools: Statistics and Machine Learning Toolbox (156 files), Signal Processing Toolbox (40 files), Image Processing Toolbox (17 files), boundedline (11 files), Chronux (5 files), Optimization Toolbox (5 files), CircStat (2 files)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
2,000 files

Code accessibility

The code for classification of motivation states was developed interactively using the Classification Learner App in MATLAB and is freely available at https://github.com/brendonw1/WatsonLabCode/tree/master/LearningMotivationStudy.

Reproduced under the paper's license (CC BY), from the paper cited above.

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;
  • 1,999 scripts, each with its path and the digest of its content;
  • 16 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.

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, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 6 keywords, 12 MeSH terms, 2 funders, 60 references.

Cite

This paper

Bueno-Junior, L. S., Ghimire, A., Ding, M., & Watson, B. O. (2026). Learning and Motivation State Fluctuations from Motoric and Neurophysiologic Metrics during a Somatosensory Task in Mice. eNeuro, 13(5), ENEURO.0417-25.2026. https://doi.org/10.1523/eneuro.0417-25.2026

BibTeX

@article{buenojunior2026learning,
author = {Bueno-Junior, Lezio S and Ghimire, Anjesh and Ding, Mingxin and Watson, Brendon O},
title = {{Learning and Motivation State Fluctuations from Motoric and Neurophysiologic Metrics during a Somatosensory Task in Mice}},
journal = {eNeuro},
year = {2026},
month = may,
volume = {13},
number = {5},
pages = {ENEURO.0417--25.2026},
publisher = {Society for Neuroscience},
issn = {2373-2822},
doi = {10.1523/eneuro.0417-25.2026},
url = {https://doi.org/10.1523/eneuro.0417-25.2026},
pmid = {42140702},
pmcid = {PMC13220975}
}

RIS

TY - JOUR
AU - Bueno-Junior, Lezio S
AU - Ghimire, Anjesh
AU - Ding, Mingxin
AU - Watson, Brendon O
TI - Learning and Motivation State Fluctuations from Motoric and Neurophysiologic Metrics during a Somatosensory Task in Mice
T2 - eNeuro
J2 - eNeuro
PY - 2026
DA - 2026/05/27
VL - 13
IS - 5
SP - ENEURO.0417
EP - 25.2026
SN - 2373-2822
PB - Society for Neuroscience
DO - 10.1523/eneuro.0417-25.2026
UR - https://doi.org/10.1523/eneuro.0417-25.2026
LA - en
ER -

CSL-JSON

{
"id": "10.1523/eneuro.0417-25.2026",
"type": "article-journal",
"title": "Learning and Motivation State Fluctuations from Motoric and Neurophysiologic Metrics during a Somatosensory Task in Mice",
"container-title": "eNeuro",
"author": [
{
"family": "Bueno-Junior",
"given": "Lezio S"
},
{
"family": "Ghimire",
"given": "Anjesh"
},
{
"family": "Ding",
"given": "Mingxin"
},
{
"family": "Watson",
"given": "Brendon O"
}
],
"container-title-short": "eNeuro",
"volume": "13",
"issue": "5",
"page": "ENEURO.0417-25.2026",
"DOI": "10.1523/eneuro.0417-25.2026",
"PMID": "42140702",
"PMCID": "PMC13220975",
"ISSN": "2373-2822",
"publisher": "Society for Neuroscience",
"URL": "https://doi.org/10.1523/eneuro.0417-25.2026",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
27
]
]
}
}

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-026-75347-4 [code]
Sleep reveals dynamics integrating and segregating movement and stimulus representations in V1.
Journal: Nature communications
In common: Chronux, boundedline, CircStat, 4 other tools, mouse, 3 references
[2] doi:10.1126/sciadv.adz6495
Pupil-linked arousal heterogeneously modulates cell-type-specific sensory processing.
Journal: Science advances
In common: mouse, 9 references
[3] doi:10.1038/s41467-026-73106-z [code]
Respiratory pauses highlight sleep architecture in mice.
Journal: Nature communications
In common: Chronux, boundedline, CircStat, 4 other tools, mouse, 1 reference
[4] doi:10.1016/j.celrep.2026.117646 [code]
Medial entorhinal-hippocampal desynchronization parallels the emergence of memory impairment in a mouse model of Alzheimer's disease pathology.
Journal: Cell reports
In common: Chronux, boundedline, CircStat, 4 other tools, mouse
[5] doi:10.1016/j.neuron.2026.03.034 [code]
Dentate gyrus interneurons modulate winner-take-all network dynamics in freely behaving mice.
Journal: Neuron
In common: Chronux, boundedline, CircStat, 4 other tools, mouse
[6] doi:10.7554/elife.110795 [code]
REM sleep prefrontal high-frequency oscillation chains mediate distinct cortical - hippocampal reactivation patterns compared to NREM sleep.
Journal: eLife
In common: Chronux, boundedline, CircStat, 3 other tools, 1 reference
[7] doi:10.1038/s41593-026-02357-2 [code]
Experience reorganizes content-specific memory traces in macaques.
Journal: Nature neuroscience
In common: Chronux, boundedline, CircStat, 4 other tools
[8] doi:10.1038/s41562-026-02533-1 [code]
Fluctuations in arousal reflect latent state transitions that facilitate behavioural optimization.
Journal: Nature human behaviour
In common: CircStat, Optimization Toolbox, Statistics and Machine Learning Toolbox, 5 references
[9] doi:10.1126/sciadv.adv5652 [code]
The anterior cingulate cortex modulates pupil-linked arousal.
Journal: Science advances
In common: 8 references
[10] doi:10.64898/2026.03.10.710908 [code]
Toroidal topology of grid-cell activity precedes spatial navigation during development
Journal: bioRxiv (preprint)
In common: Chronux, boundedline, CircStat, 3 other tools

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.

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: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

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