OSCR

Open-Source Platform for Adjustable Training Regimes in Freely Moving and Head-Fixed Mice.

Code ↔ Paper

5 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 5 matches
  1. [1] § Materials and Methods › Synchronization across devices › Pupillometry ↔ PupilTracking/ResNetModel/notebooks/Training.ipynb, lines 106–166 · score 0.71 · training loss, validation loss, training epoch, model, accuracy, class
  2. [2] § Materials and Methods › Synchronization across devices › Pupillometry ↔ PupilTracking/ResNetModel/notebooks/Predictions.ipynb, lines 42–96 · score 0.70 · ResNet model, occluded eye, open eye, predict, class, pupil
  3. [3] § Materials and Methods › Freely moving operant conditioning visual discrimination task › Freely moving luminance discrimination task ↔ BehavioralTasks/CirclesDiscrimination/TaskCode/Circles_Discrimination_vGitHub.m, lines 349–461 · score 0.65 · correct reject, trial initiation, alarm, hit, probability, consecutive
  4. [4] § Materials and Methods › Closed-loop two-choice visual discrimination task › Performance and side-bias analysis ↔ BehavioralTasks/GratingDiscrimination2AC/DataOut/dataStructGenerator.m, lines 299–371 · score 0.53 · reward zone, licked left, incorrectly, grating, mouse
  5. [5] § Materials and Methods › Freely moving operant conditioning visual discrimination task › Acclimation to task environment ↔ BehavioralTasks/CirclesDiscrimination/DataOut/DataStructGenerator.m, lines 38–118 · score 0.53 · white circles, mouse licked, touching, transitioned, water, stimulus

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

Jupyter notebook · 166 lines · 5.4 KB · BSD-3-Clause · 1 match

  1. # %%
  2. import torch
  3. import argparse
  4. import torch.nn as nn
  5. import torch.optim as optim
  6. import time
  7. from tqdm.auto import tqdm
  8. from google.colab import drive
  9. drive.mount('/content/drive')
  10. import sys
  11. sys.path.append('/content/drive/MyDrive/ResNetModel/src')
  12. from model import build_model
  13. from findmydatasets import get_datasets, get_data_loaders
  14. from utils import save_model, save_plots
  15. # %%
  16. seed = 45
  17. torch.manual_seed(seed)
  18. torch.cuda.manual_seed(seed)
  19. torch.backends.cudnn.deterministic = True
  20. torch.backends.cudnn.benchmark = True
  21. # %%
  22. from google.colab import drive
  23. drive.mount('/content/drive')
  24. # %%
  25. # Construct the argument parser.
  26. parser = argparse.ArgumentParser()
  27. parser.add_argument(
  28. '-e', '--epochs', type=int, default=35,
  29. help='Number of epochs to train our network for'
  30. )
  31. parser.add_argument(
  32. '-lr', '--learning-rate', type=float,
  33. dest='learning_rate', default=0.001,
  34. help='Learning rate for training the model'
  35. )
  36. args = vars(parser.parse_args([]))
  37. # %%
  38. # Training function.
  39. def train(model, trainloader, optimizer, criterion):
  40. model.train()
  41. print('Training')
  42. train_running_loss = 0.0
  43. train_running_correct = 0
  44. counter = 0
  45. for i, data in tqdm(enumerate(trainloader), total=len(trainloader)):
  46. counter += 1
  47. image, labels = data
  48. image = image.to(device)
  49. labels = labels.to(device)
  50. optimizer.zero_grad()
  51. # Forward pass.
  52. outputs = model(image)
  53. # Calculate the loss.
  54. loss = criterion(outputs, labels)
  55. train_running_loss += loss.item()
  56. # Calculate the accuracy.
  57. _, preds = torch.max(outputs.data, 1)
  58. train_running_correct += (preds == labels).sum().item()
  59. # Backpropagation.
  60. loss.backward()
  61. # Update the weights.
  62. optimizer.step()
  63. # Loss and accuracy for the complete epoch.
  64. epoch_loss = train_running_loss / counter
  65. epoch_acc = 100. * (train_running_correct / len(trainloader.dataset))
  66. return epoch_loss, epoch_acc
  67. # %%
  68. # Validation function.
  69. def validate(model, testloader, criterion, class_names):
  70. model.eval()
  71. print('Validation')
  72. valid_running_loss = 0.0
  73. valid_running_correct = 0
  74. counter = 0
  75. with torch.no_grad():
  76. for i, data in tqdm(enumerate(testloader), total=len(testloader)):
  77. counter += 1
  78. image, labels = data
  79. image = image.to(device)
  80. labels = labels.to(device)
  81. # Forward pass.
  82. outputs = model(image)
  83. # Calculate the loss.
  84. loss = criterion(outputs, labels)
  85. valid_running_loss += loss.item()
  86. # Calculate the accuracy.
  87. _, preds = torch.max(outputs.data, 1)
  88. valid_running_correct += (preds == labels).sum().item()
  89. # Loss and accuracy for the complete epoch.
  90. epoch_loss = valid_running_loss / counter
  91. epoch_acc = 100. * (valid_running_correct / len(testloader.dataset))
  92. return epoch_loss, epoch_acc
  93. # %%
  94. if __name__ == '__main__':
  95. # Load the training and validation datasets.
  96. dataset_train, dataset_valid, dataset_classes = get_datasets()
  97. print(f"[INFO]: Number of training images: {len(dataset_train)}")
  98. print(f"[INFO]: Number of validation images: {len(dataset_valid)}")
  99. print(f"[INFO]: Classes: {dataset_classes}")
  100. # Load the training and validation data loaders.
  101. train_loader, valid_loader = get_data_loaders(dataset_train, dataset_valid)
  102. # Learning_parameters.
  103. lr = args['learning_rate']
  104. epochs = args['epochs']
  105. device = ('cuda' if torch.cuda.is_available() else 'cpu')
  106. print(f"Computation device: {device}")
  107. print(f"Learning rate: {lr}")
  108. print(f"Epochs to train for: {epochs}\n")
  109. # Load the model.
  110. model = build_model(
  111. pretrained=True,
  112. fine_tune=True,
  113. num_classes=len(dataset_classes)
  114. ).to(device)
  115. # Total parameters and trainable parameters.
  116. total_params = sum(p.numel() for p in model.parameters())
  117. print(f"{total_params:,} total parameters.")
  118. total_trainable_params = sum(
  119. p.numel() for p in model.parameters() if p.requires_grad)
  120. print(f"{total_trainable_params:,} training parameters.")
  121. # Optimizer.
  122. optimizer = optim.SGD(model.parameters(), lr=lr, momentum=0.9)
  123. # Loss function.
  124. criterion = nn.CrossEntropyLoss()
  125. # Lists to keep track of losses and accuracies.
  126. train_loss, valid_loss = [], []
  127. train_acc, valid_acc = [], []
  128. # Start the training.
  129. for epoch in range(epochs):
  130. print(f"[INFO]: Epoch {epoch+1} of {epochs}")
  131. train_epoch_loss, train_epoch_acc = train(model, train_loader,
  132. optimizer, criterion)
  133. valid_epoch_loss, valid_epoch_acc = validate(model, valid_loader,
  134. criterion, dataset_classes)
  135. train_loss.append(train_epoch_loss)
  136. valid_loss.append(valid_epoch_loss)
  137. train_acc.append(train_epoch_acc)
  138. valid_acc.append(valid_epoch_acc)
  139. print(f"Training loss: {train_epoch_loss:.3f}, training acc: {train_epoch_acc:.3f}")
  140. print(f"Validation loss: {valid_epoch_loss:.3f}, validation acc: {valid_epoch_acc:.3f}")
  141. print('-'*50)
  142. time.sleep(2)
  143. # Save the trained model weights.
  144. save_model(epochs, model, optimizer, criterion)
  145. # Save the loss and accuracy plots.
  146. save_plots(train_acc, valid_acc, train_loss, valid_loss)
  147. print('TRAINING COMPLETE')

Training.ipynb at commit e1b599a, under BSD-3-Clause · at the source

Overview

Authors: Michael D. Crespo1, Sabrina M. Vaillancourt2,3, Elizabeth A. Goldstein2, Maria R. Broderick2, Garrett T. Neske2,3, Sandra J. Kuhlman1,2,3
  1. Department of Biomedical Engineering, University at Buffalo, Buffalo, New York 14260
  2. Department of Physiology, University at Buffalo, Buffalo, New York 14203
  3. Neuroscience Program, University at Buffalo, Buffalo, New York 14203
Journal: eNeuro, volume 13, issue 3, pages ENEURO.0459-25.2026
Dates: received 9 December 2025; accepted 9 February 2026; published online 10 March 2026; in print March 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1523/eneuro.0459-25.2026 · PMID 41735048 · PMCID PMC13045870 · OpenAlex W7131254782
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: optical imaging (calcium, voltage, 2-photon) (modality), mouse (organism)
Methods: Physiology & signal measures
Keywords: 2-photon imaging, calcium imaging, closed-loop, decision-making, perception, skill acquisition
MeSH: Behavior, Animal*, Conditioning, Operant*, Animals, Choice Behavior, Female, Male, Mice, Mice, Inbred C57BL (* major topic)
Journal subjects: Research Article: Methods/New Tools, Novel Tools and Methods
Topic: Neural dynamics and brain function (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: NIH National Eye Institute (R01EY034644, R00EY030550)
Citations: cited by 1 paper (Europe PMC); 41 references in the paper

Abstract

Molecular tools available for rodent research enable detailed interrogation of the neural cell types and circuits that give rise to perception and decision-making during complex behaviors. To take full advantage of these molecular tools and successfully define causal relationships between neural function and overt actions during learning, there is a need for low-cost behavioral platforms with inherent flexibility in the implementation of task details. We present a behavioral platform capable of executing both head-fixed and freely moving task designs. The platform incorporates a user-interactive GUI that allows parameters to be adjusted online, during an acquisition session. Task metrics and performance indicators are acquired and organized into a standardized output, enabling single users to quickly master data analysis across a variety of task designs. To demonstrate the flexibility of the platform, mice of either sex were trained in two discrimination tasks: a head-fixed two-choice task as well as a freely moving operant conditioning task. Furthermore, we demonstrate that the platform can be used to show that mice harboring a mutation associated with autism spectrum disorder are able to perform a basic visual discrimination task in freely moving conditions. The presented work demonstrates the integration of multiple external devices to record task-related variables in a synchronized manner. As a result, the platform provides a valuable tool for affordable and reproducible investigation of behavioral decision-making as well as the neural basis underlying cognitive processes in health and disease.

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 5 matches between paragraphs and lines of code.

Mdcrespo/BehavioralPlatform

License: BSD-3-Clause
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Commit: e1b599ae4ec52f03df315ab318b391f41333d6e2, 4 February 2026
Languages: MATLAB (11), Jupyter (5), Python (3)
Size: 78 files, 19 scripts
Software Heritage: not archived
Found in: “Code accessibility”
Holds: README, license file, 5 notebooks
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Tools: PyTorch (7 files), Psychtoolbox (5 files), OpenCV (4 files), Matplotlib (2 files), NumPy (2 files), Pillow (2 files), Statistics and Machine Learning Toolbox (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers
  • 30 September 2026: the link answers
21 files

Code accessibility

The code/software described in the paper is freely available online at https://github.com/Mdcrespo/BehavioralPlatform.

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;
  • 19 scripts, each with its path and the digest of its content;
  • 5 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, 30 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 6 keywords, 8 MeSH terms, 1 funder, 40 references.

Cite

This paper

Crespo, M. D., Vaillancourt, S. M., Goldstein, E. A., Broderick, M. R., Neske, G. T., & Kuhlman, S. J. (2026). Open-Source Platform for Adjustable Training Regimes in Freely Moving and Head-Fixed Mice. eNeuro, 13(3), ENEURO.0459-25.2026. https://doi.org/10.1523/eneuro.0459-25.2026

BibTeX

@article{crespo2026open,
author = {Crespo, Michael D. and Vaillancourt, Sabrina M. and Goldstein, Elizabeth A. and Broderick, Maria R. and Neske, Garrett T. and Kuhlman, Sandra J.},
title = {{Open-Source Platform for Adjustable Training Regimes in Freely Moving and Head-Fixed Mice}},
journal = {eNeuro},
year = {2026},
month = mar,
volume = {13},
number = {3},
pages = {ENEURO.0459--25.2026},
publisher = {Society for Neuroscience},
issn = {2373-2822},
doi = {10.1523/eneuro.0459-25.2026},
url = {https://doi.org/10.1523/eneuro.0459-25.2026},
pmid = {41735048},
pmcid = {PMC13045870}
}

RIS

TY - JOUR
AU - Crespo, Michael D.
AU - Vaillancourt, Sabrina M.
AU - Goldstein, Elizabeth A.
AU - Broderick, Maria R.
AU - Neske, Garrett T.
AU - Kuhlman, Sandra J.
TI - Open-Source Platform for Adjustable Training Regimes in Freely Moving and Head-Fixed Mice
T2 - eNeuro
J2 - eNeuro
PY - 2026
DA - 2026/03/13
VL - 13
IS - 3
SP - ENEURO.0459
EP - 25.2026
SN - 2373-2822
PB - Society for Neuroscience
DO - 10.1523/eneuro.0459-25.2026
UR - https://doi.org/10.1523/eneuro.0459-25.2026
LA - en
ER -

CSL-JSON

{
"id": "10.1523/eneuro.0459-25.2026",
"type": "article-journal",
"title": "Open-Source Platform for Adjustable Training Regimes in Freely Moving and Head-Fixed Mice",
"container-title": "eNeuro",
"author": [
{
"family": "Crespo",
"given": "Michael D."
},
{
"family": "Vaillancourt",
"given": "Sabrina M."
},
{
"family": "Goldstein",
"given": "Elizabeth A."
},
{
"family": "Broderick",
"given": "Maria R."
},
{
"family": "Neske",
"given": "Garrett T."
},
{
"family": "Kuhlman",
"given": "Sandra J."
}
],
"container-title-short": "eNeuro",
"volume": "13",
"issue": "3",
"page": "ENEURO.0459-25.2026",
"DOI": "10.1523/eneuro.0459-25.2026",
"PMID": "41735048",
"PMCID": "PMC13045870",
"ISSN": "2373-2822",
"publisher": "Society for Neuroscience",
"URL": "https://doi.org/10.1523/eneuro.0459-25.2026",
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
13
]
]
}
}

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.7554/elife.105081 [code]
Movie reconstruction from mouse visual cortex activity.
Journal: eLife
In common: OpenCV, Pillow, PyTorch, 2 other tools, optical imaging (calcium, voltage, 2-photon), mouse, 3 references
[2] doi:10.7554/elife.109717 [code]
Retrosplenial cortex enables context-dependent goal-directed sensorimotor transformation.
Journal: eLife
In common: OpenCV, Pillow, Statistics and Machine Learning Toolbox, 2 other tools, mouse, 2 references
[3] doi:10.1111/ejn.70582 [code]
Multifiber Array-Based Photometry System for Multiregional Functional Mapping in the Mouse Brain.
Journal: The European journal of neuroscience
In common: OpenCV, Pillow, Matplotlib, 1 other tool, optical imaging (calcium, voltage, 2-photon), mouse, 2 references
[4] doi:10.1093/cercor/bhag047 [code]
Association learning drives synaptic plasticity at feedforward synapses in somatosensory cortex.
Journal: Cerebral cortex (New York, N.Y. : 1991)
In common: Matplotlib, NumPy, mouse, 4 references
[5] doi:10.1038/s41597-025-05174-7 [code]
A large-scale MEG and EEG dataset for object recognition in naturalistic scenes
Journal: n/a
In common: Psychtoolbox, OpenCV, Pillow, 3 other tools
[6] doi: [code]
Real-time closed-loop feedback system for mouse mesoscale cortical signal and movement control
Journal: eLife
In common: OpenCV, Pillow, Matplotlib, 1 other tool, optical imaging (calcium, voltage, 2-photon), mouse, 1 reference
[7] doi:10.7554/elife.109313 [code]
Linear and categorical coding units in the mouse gustatory cortex drive population dynamics and behavior in taste decision-making.
Journal: eLife
In common: PyTorch, Statistics and Machine Learning Toolbox, Matplotlib, 1 other tool, mouse, 2 references
[8] doi:10.1126/sciadv.aef0343 [code]
Learning induces activation-mechanism-dependent neural plasticity in an intracortical microstimulation task.
Journal: Science advances
In common: Pillow, Statistics and Machine Learning Toolbox, Matplotlib, 1 other tool, 2 references
[9] doi:10.1038/s42003-026-10957-8 [code]
Brain defence by the extracellular matrix protein Cochlin.
Journal: Communications biology
In common: OpenCV, Pillow, PyTorch, 3 other tools, mouse
[10] doi:10.1371/journal.pbio.3003915 [code]
Noise-invariant representations of sound emerge along the canonical cortical hierarchy.
Journal: PLoS biology
In common: OpenCV, Pillow, PyTorch, 3 other tools, mouse

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.