OSCR

A context-free model of savings in motor learning.

Code ↔ Paper

3 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 3 matches
  1. [1] § Methods › Growing up training phase ↔ task.py, lines 22–139 · score 0.79 · 100–300 ms, random uniform, catch trial, starting positions, go cue, joint
  2. [2] § Methods › RNN model ↔ utils.py, lines 19–67 · score 0.55 · rigid tendon Hill, muscle
  3. [3] § Methods › Targeted dimensionality reduction ↔ tdr.py, lines 4–30 · score 0.55 · Gram Schmidt orthogonalization, matrix

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

Python · 279 lines · 9.2 KB · no license · 1 match

  1. import motornet as mn
  2. import torch as th
  3. import numpy as np
  4. from typing import Any
  5. from typing import Union
  6. go_time = 0.44
  7. #go_time = 0.10
  8. class CentreOutFF(mn.environment.Environment):
  9. """A reach to a random target from a random starting position."""
  10. def __init__(self, *args, **kwargs):
  11. # pass everything as-is to the parent Environment class
  12. super().__init__(*args, **kwargs)
  13. self.__name__ = "CentreOutFF"
  14. # check if we have K and B in kwargs
  15. self.K = kwargs.get('K', 150)
  16. self.B = kwargs.get('B', 0.5)
  17. def reset(self, *,
  18. seed: int | None = None,
  19. ff_coefficient: float = 0.,
  20. condition: str = 'train',
  21. catch_trial_perc: float = 50,
  22. go_cue_random = None,
  23. is_channel: bool = False,
  24. calc_endpoint_force: bool = False,
  25. go_cue_range: Union[list, tuple, np.ndarray] = (0.1, 0.3),
  26. options: dict[str, Any] | None = None) -> tuple[Any, dict[str, Any]]:
  27. self._set_generator(seed)
  28. options = {} if options is None else options
  29. batch_size: int = options.get('batch_size', 1)
  30. joint_state: th.Tensor | np.ndarray | None = options.get('joint_state', None)
  31. deterministic: bool = options.get('deterministic', False)
  32. self.calc_endpoint_force = calc_endpoint_force
  33. self.batch_size = batch_size
  34. self.catch_trial_perc = catch_trial_perc
  35. self.ff_coefficient = ff_coefficient
  36. self.go_cue_range = go_cue_range # in seconds
  37. self.is_channel = is_channel
  38. if (condition=='train'): # train net to reach to random targets
  39. joint_state = None
  40. goal = self.joint2cartesian(self.effector.draw_random_uniform_states(batch_size)).chunk(2, dim=-1)[0]
  41. self.goal = goal if self.differentiable else self.detach(goal)
  42. # specify go cue time
  43. if go_cue_random is None:
  44. go_cue_time = np.random.uniform(self.go_cue_range[0],self.go_cue_range[1],batch_size)
  45. else:
  46. if go_cue_random:
  47. go_cue_time = np.random.uniform(self.go_cue_range[0],self.go_cue_range[1],batch_size)
  48. else:
  49. go_cue_time = np.tile(go_time,batch_size)
  50. self.go_cue_time = go_cue_time
  51. elif (condition=='test'): # centre-out reaches to each target
  52. angle_set = np.deg2rad(np.arange(0,360,45)) # 8 directions
  53. reps = int(np.ceil(batch_size / len(angle_set)))
  54. angle = np.tile(angle_set, reps=reps)
  55. batch_size = reps * len(angle_set)
  56. reaching_distance = 0.10
  57. lb = np.array(self.effector.pos_lower_bound)
  58. ub = np.array(self.effector.pos_upper_bound)
  59. start_position = lb + (ub - lb) / 2
  60. start_position = np.array([1.047, 1.570])
  61. start_position = start_position.reshape(1,-1)
  62. start_jpv = th.from_numpy(np.concatenate([start_position, np.zeros_like(start_position)], axis=1)) # joint position and velocity
  63. start_cpv = self.joint2cartesian(start_jpv).numpy()
  64. end_cp = reaching_distance * np.stack([np.cos(angle), np.sin(angle)], axis=-1)
  65. goal_states = start_cpv + np.concatenate([end_cp, np.zeros_like(end_cp)], axis=-1)
  66. goal_states = goal_states[:,:2]
  67. goal_states = goal_states.astype(np.float32)
  68. joint_state = th.from_numpy(np.tile(start_jpv,(batch_size,1)))
  69. goal = th.from_numpy(goal_states)
  70. self.goal = goal if self.differentiable else self.detach(goal)
  71. # specify go cue time
  72. if go_cue_random is None:
  73. go_cue_time = np.tile(go_time,batch_size)
  74. else:
  75. if go_cue_random:
  76. go_cue_time = np.random.uniform(self.go_cue_range[0],self.go_cue_range[1],batch_size)
  77. else:
  78. go_cue_time = np.tile(go_time,batch_size)
  79. self.go_cue_time = go_cue_time
  80. self.effector.reset(options={"batch_size": batch_size,"joint_state": joint_state})
  81. self.elapsed = 0.
  82. action = th.zeros((batch_size, self.muscle.n_muscles)).to(self.device)
  83. self.obs_buffer["proprioception"] = [self.get_proprioception()] * len(self.obs_buffer["proprioception"])
  84. self.obs_buffer["vision"] = [self.get_vision()] * len(self.obs_buffer["vision"])
  85. self.obs_buffer["action"] = [action] * self.action_frame_stacking
  86. # specify catch trials
  87. catch_trial = np.zeros(batch_size, dtype='float32')
  88. p = int(np.floor(batch_size * self.catch_trial_perc / 100))
  89. catch_trial[np.random.permutation(catch_trial.size)[:p]] = 1.
  90. self.catch_trial = catch_trial
  91. # specify go cue time
  92. self.go_cue_time[self.catch_trial==1] = self.max_ep_duration
  93. self.go_cue = th.zeros((batch_size,1)).to(self.device)
  94. self.init = self.states['fingertip']
  95. obs = self.get_obs(deterministic=deterministic)
  96. self.endpoint_load = th.zeros((batch_size,2)).to(self.device)
  97. self.endpoint_force = th.zeros((batch_size,2)).to(self.device)
  98. info = {
  99. "states": self.states,
  100. "endpoint_load": self.endpoint_load,
  101. "endpoint_force": self.endpoint_force,
  102. "action": action,
  103. "noisy action": action, # no noise here so it is the same
  104. "goal": self.goal * self.go_cue + self.init * (1-self.go_cue), # target
  105. }
  106. return obs, info
  107. def step(self, action, deterministic: bool = False):
  108. self.elapsed += self.dt
  109. if deterministic is False:
  110. noisy_action = self.apply_noise(action, noise=self.action_noise)
  111. else:
  112. noisy_action = action
  113. self.effector.step(noisy_action,endpoint_load=self.endpoint_load)
  114. # calculate endpoint force (External force)
  115. self.endpoint_load = get_endpoint_load(self)
  116. mask = self.elapsed < (self.go_cue_time + (self.vision_delay) * self.dt)
  117. self.endpoint_load[mask] = 0
  118. # calculate endpoint force (Internal force)
  119. self.endpoint_force = get_endpoint_force(self)
  120. # specify go cue time
  121. #mask = self.elapsed >= (self.go_cue_time + (self.vision_delay-1) * self.dt)
  122. mask = self.elapsed > (self.go_cue_time + (self.vision_delay) * self.dt)
  123. self.go_cue[mask] = 1
  124. obs = self.get_obs(action=noisy_action)
  125. terminated = bool(self.elapsed >= self.max_ep_duration)
  126. info = {
  127. "states": self.states,
  128. "endpoint_load": self.endpoint_load,
  129. "endpoint_force": self.endpoint_force,
  130. "action": action,
  131. "noisy action": noisy_action,
  132. "goal": self.goal * self.go_cue + self.init * (1-self.go_cue),
  133. }
  134. return obs, terminated, info
  135. def get_proprioception(self):
  136. mlen = self.states["muscle"][:, 1:2, :] / self.muscle.l0_ce
  137. mvel = self.states["muscle"][:, 2:3, :] / self.muscle.vmax
  138. prop = th.concatenate([mlen, mvel], dim=-1).squeeze(dim=1)
  139. return self.apply_noise(prop, self.proprioception_noise)
  140. def get_vision(self):
  141. vis = self.states["fingertip"]
  142. return self.apply_noise(vis, self.vision_noise)
  143. def get_obs(self, action=None, deterministic: bool = False):
  144. self.update_obs_buffer(action=action)
  145. obs_as_list = [
  146. self.obs_buffer["vision"][0], # oldest element
  147. self.obs_buffer["proprioception"][0], # oldest element
  148. self.goal, # goal #self.init, # initial position
  149. self.go_cue, # sepcify go cue as an input to the network
  150. ]
  151. obs = th.cat(obs_as_list, dim=-1)
  152. if deterministic is False:
  153. obs = self.apply_noise(obs, noise=self.obs_noise)
  154. return obs
  155. def get_endpoint_force(self):
  156. """Internal force
  157. """
  158. endpoint_force = th.zeros((self.batch_size, 2)).to(self.device)
  159. if self.calc_endpoint_force:
  160. L1 = self.skeleton.L1
  161. L2 = self.skeleton.L2
  162. pos0, pos1 = self.states['joint'][:,0], self.states['joint'][:,1]
  163. pos_sum = pos0 + pos1
  164. c1 = th.cos(pos0)
  165. c12 = th.cos(pos_sum)
  166. s1 = th.sin(pos0)
  167. s12 = th.sin(pos_sum)
  168. jacobian_11 = -L1*s1 - L2*s12
  169. jacobian_12 = -L2*s12
  170. jacobian_21 = L1*c1 + L2*c12
  171. jacobian_22 = L2*c12
  172. forces = self.states['muscle'][:, self.muscle.state_name.index('force'):self.muscle.state_name.index('force')+1, :]
  173. moments = self.states["geometry"][:, 2:, :]
  174. torque = -th.sum(forces * moments, dim=-1)
  175. for i in range(self.batch_size):
  176. jacobian_i = th.tensor([[jacobian_11[i], jacobian_12[i]], [jacobian_21[i], jacobian_22[i]]])
  177. endpoint_force[i] = torque[i] @ th.inverse(jacobian_i)
  178. return endpoint_force
  179. else:
  180. return endpoint_force
  181. def get_endpoint_load(self):
  182. """External force
  183. """
  184. # Calculate endpoiont_load
  185. vel = self.states["cartesian"][:,2:]
  186. # TODO
  187. self.goal = self.goal.clone()
  188. self.init = self.init.clone()
  189. endpoint_load = th.zeros((self.batch_size,2)).to(self.device)
  190. if self.is_channel:
  191. X2 = self.goal
  192. X1 = self.init
  193. # vector that connect initial position to the target
  194. line_vector = X2 - X1
  195. xy = self.states["cartesian"][:,2:]
  196. xy = xy - X1
  197. projection = th.sum(line_vector * xy, axis=-1)/th.sum(line_vector * line_vector, axis=-1)
  198. projection = line_vector * projection[:,None]
  199. err = xy - projection
  200. projection = th.sum(line_vector * vel, axis=-1)/th.sum(line_vector * line_vector, axis=-1)
  201. projection = line_vector * projection[:,None]
  202. err_d = vel - projection
  203. F = -1*(self.B*err+self.K*err_d)
  204. endpoint_load = F
  205. else:
  206. FF_matvel = th.tensor([[0, 1], [-1, 0]], dtype=th.float32)
  207. endpoint_load = self.ff_coefficient * (vel@FF_matvel.T)
  208. return endpoint_load

task.py at commit 2bb2883, no license · at the source

Overview

  1. Department of Psychology, Western University, London, Canada
  2. Mila–Québec Artificial Intelligence Institute, Montréal, Canada
  3. Department of Neuroscience, Université de Montréal, Montréal, Canada
  4. Department of Physiology and Pharmacology, Schulich School of Medicine and Dentistry, London, Canada
  5. School of Kinesiology and Health Science, Faculty of Health, York University, Toronto, Canada
Journal: eLife, volume 14, article RP107423
Dates: published online 13 May 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.7554/elife.107423 · PMID 42126916 · PMCID PMC13171098 · OpenAlex W4413342903
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: behavior only (modality), human (organism)
Methods: Machine learning
Keywords: None
MeSH: Learning*, Models, Neurological*, Motor Skills*, Recurrent Neural Networks*, Biomechanical Phenomena, Humans, Models, Anatomic, Movement, Reaction Time, Upper Extremity (* major topic)
Topic: Motor Control and Adaptation (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Natural Sciences and Engineering Research Council of Canada (RGPIN/05458-2018)
Citations: not cited yet (Europe PMC); 59 references in the paper

Abstract

Learning to adapt voluntary movements to an external perturbation, whether mechanical or visual, is faster during a second encounter than during the first. The mechanisms underlying this phenomenon, known as savings, remain unclear. Recent studies propose that the high dimensionality of neural control enables the retention of learning traces that may facilitate savings. To test this idea, we used MotorNet, a framework for training recurrent neural networks (RNNs) to control biomechanical models of the human upper limb. RNNs were trained to perform reaching movements with a velocity-dependent force field (FF) and without (NF) in the sequence NF1 (baseline), FF1 (adaptation), NF2 (washout), and FF2 (re-adaptation). RNNs showed behaviural signatures of savings in the absence of any explicit contextual input signalling the presence or absence of the FF. Savings was more robust in RNNs with larger numbers of units. We identified a component of RNN activity associated with savings—a shift in preparatory activity that persisted even after washout. Displacing this preparatory activity in the direction of the shift enhanced savings, whereas perturbations in the opposite direction reduced or eliminated savings. These findings suggest a potential neural basis for motor memory retention underlying savings that is reliant on the high dimensionality of neural circuits for control, and is independent of cognitive or strategic learning.

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

mshahbazi1997/MotorSavingModel

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 2bb2883bff69eef97d7a65a461003babb4f6c79d, 17 March 2026
Languages: Python (8), Jupyter (8)
Size: 21 files, 16 scripts
Software Heritage: not archived
Found in: “Data availability”
Holds: README, environment (requirements.txt), 8 notebooks
Not found: license file, CITATION.cff, tests, continuous integration, documentation
Tools: NumPy (12 files), Matplotlib (10 files), PyTorch (9 files), pandas (6 files), seaborn (6 files), SciPy (4 files), scikit-learn (3 files), statsmodels (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
17 files

The paper's code and data availability statement is in the Data section.

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;
  • 16 scripts, each with its path and the digest of its content;
  • 3 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data availability

Python code to reproduce the simulations and analyses described here is available on GitHub at the following repository: https://github.com/mshahbazi1997/MotorSavingModel (copy archived at Shahbazi, 2026).

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

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, pages, dates, 4 authors, 1 keyword, 10 MeSH terms, 1 funder, 56 references.

Cite

This paper

Shahbazi, M., Codol, O., Michaels, J. A., & Gribble, P. L. (2026). A context-free model of savings in motor learning. eLife, 14, RP107423. https://doi.org/10.7554/elife.107423

BibTeX

@article{shahbazi2026context,
author = {Shahbazi, Mahdiyar and Codol, Olivier and Michaels, Jonathan A and Gribble, Paul L},
title = {{A context-free model of savings in motor learning}},
journal = {eLife},
year = {2026},
month = may,
volume = {14},
pages = {RP107423},
publisher = {eLife Sciences Publications, Ltd},
issn = {2050-084X},
doi = {10.7554/elife.107423},
url = {https://doi.org/10.7554/elife.107423},
pmid = {42126916},
pmcid = {PMC13171098}
}

RIS

TY - JOUR
AU - Shahbazi, Mahdiyar
AU - Codol, Olivier
AU - Michaels, Jonathan A
AU - Gribble, Paul L
TI - A context-free model of savings in motor learning
T2 - eLife
J2 - eLife
PY - 2026
DA - 2026/05/13
VL - 14
SP - RP107423
SN - 2050-084X
PB - eLife Sciences Publications, Ltd
DO - 10.7554/elife.107423
UR - https://doi.org/10.7554/elife.107423
LA - en
ER -

CSL-JSON

{
"id": "10.7554/elife.107423",
"type": "article-journal",
"title": "A context-free model of savings in motor learning",
"container-title": "eLife",
"author": [
{
"family": "Shahbazi",
"given": "Mahdiyar"
},
{
"family": "Codol",
"given": "Olivier"
},
{
"family": "Michaels",
"given": "Jonathan A"
},
{
"family": "Gribble",
"given": "Paul L"
}
],
"container-title-short": "eLife",
"volume": "14",
"page": "RP107423",
"DOI": "10.7554/elife.107423",
"PMID": "42126916",
"PMCID": "PMC13171098",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://doi.org/10.7554/elife.107423",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
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.3390/biomimetics11080569 [code]
Pretraining of Embodied Recurrent Networks Bridges the Gap Between Artificial and Cortical Neural Activities.
Journal: Biomimetics (Basel, Switzerland)
In common: PyTorch, scikit-learn, SciPy, 2 other tools, 6 references
[2] doi:10.1038/s41467-026-75455-1 [code]
Shared latent representations of speech production for cross-patient speech decoding.
Journal: Nature communications
In common: statsmodels, PyTorch, seaborn, 5 other tools, 1 reference
[3] doi:10.1162/imag.a.1266 [code]
Multimodal subspace independent vector analysis effectively captures latent relationships between brain structure and function.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: statsmodels, seaborn, scikit-learn, 4 other tools, 2 references
[4] doi:10.1038/s41467-026-74347-8 [code]
Compositionality of social gaze in the prefrontal-amygdala circuits.
Journal: Nature communications
In common: statsmodels, seaborn, scikit-learn, 4 other tools, 2 references
[5] doi:10.1371/journal.pcbi.1014162 [code]
Exploring neural manifolds across a wide range of intrinsic dimensions.
Journal: PLoS computational biology
In common: scikit-learn, pandas, SciPy, 2 other tools, 3 references
[6] doi:10.1371/journal.pbio.3003831 [code]
Disinhibitory signaling enables flexible coding of top-down information in cortical networks.
Journal: PLoS biology
In common: PyTorch, scikit-learn, pandas, 3 other tools, 2 references
[7] doi:10.1038/s41467-026-75653-x [code]
Concept2Brain: an AI model for predicting neurophysiological responses to text and pictures.
Journal: Nature communications
In common: PyTorch, scikit-learn, pandas, 3 other tools, 2 references
[8] doi:10.1038/s41467-026-76109-y [code]
Assistive algorithms influence neural representations in motor brain-computer interfaces.
Journal: Nature communications
In common: seaborn, scikit-learn, pandas, 3 other tools, 2 references
[9] doi:10.1016/j.neuron.2026.07.016 [code]
Inferring brain-wide interactions using data-constrained recurrent neural network models.
Journal: Neuron
In common: Matplotlib, NumPy, 4 references
[10] doi:10.1038/s41593-026-02333-w [code]
Learning shapes neural geometry in the primate prefrontal cortex.
Journal: Nature neuroscience
In common: seaborn, scikit-learn, pandas, 3 other tools, 2 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.

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.