OSCR

Path integration in complex number space.

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] § paragraph 7 ↔ generate_figure2.py, lines 1–11 · score 0.71 · cross species, PI model, angular errors, Computational cost, Bracket, simulation

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 · 170 lines · 7.2 KB · no license · 1 match

  1. #!/usr/bin/env python3
  2. """
  3. Figure 2 — PNAS Brief Report. Craddock, Miossec & Bouchekioua.
  4. Panel A: Placeholder for Müller & Wehner 1988 Fig. 1
  5. Panel B: PI Model simulation (seed=9798, 100 steps, raw waypoints)
  6. Panel C: Angular error histogram with verified cross-species bracket
  7. Panel D: Computational cost comparison
  8. """
  9. import numpy as np
  10. import matplotlib.pyplot as plt
  11. from matplotlib.lines import Line2D
  12. def complex_mult(a_re, a_im, b_re, b_im):
  13. return (a_re * b_re - a_im * b_im, a_re * b_im + a_im * b_re)
  14. def run_outward(num_steps, rng):
  15. traj = [{"x": 0.0, "y": 0.0, "I_re": 1.0, "I_im": 0.0}]
  16. z1_re, z1_im = 1.0, 1.0
  17. for _ in range(num_steps):
  18. prev = traj[-1]
  19. if rng.random() < 0.5: i_n_re, i_n_im = 0.0, 1.0
  20. else: i_n_re, i_n_im = 0.0, -1.0
  21. newI_re, newI_im = complex_mult(prev["I_re"], prev["I_im"], i_n_re, i_n_im)
  22. if i_n_im == 1.0:
  23. zd_re = 0.5 + rng.random() * 0.5; zd_im = rng.random() * 0.5
  24. else:
  25. zd_re = rng.random() * 0.5; zd_im = 0.5 + rng.random() * 0.5
  26. Iz1_re, Iz1_im = complex_mult(newI_re, newI_im, z1_re, z1_im)
  27. traj.append({"x": prev["x"] + Iz1_im + zd_im, "y": prev["y"] + Iz1_re + zd_re,
  28. "I_re": newI_re, "I_im": newI_im})
  29. return traj
  30. def run_return(traj, rng):
  31. last = traj[-1]
  32. X_n, Y_n = last["x"], last["y"]
  33. path = []
  34. for _ in range(10000):
  35. if X_n + Y_n < 1.0: break
  36. prevX, prevY = X_n, Y_n
  37. epsilon = -0.5 + rng.random()
  38. denom = prevX + prevY
  39. if abs(denom) > 0.001:
  40. X_n = prevX - (prevX / denom) + epsilon
  41. Y_n = prevY - (prevY / denom) + epsilon
  42. else: break
  43. path.append((X_n, Y_n))
  44. path.append((0.0, 0.0))
  45. return path
  46. def compute_ae(traj, ret):
  47. xs = np.array([p["x"] for p in traj])
  48. ys = np.array([p["y"] for p in traj])
  49. ideal = np.arctan2(-ys[-1], -xs[-1])
  50. if len(ret) > 1:
  51. dx, dy = ret[0][0] - xs[-1], ret[0][1] - ys[-1]
  52. ae = np.degrees(np.arctan2(dy, dx) - ideal)
  53. ae = ((ae + 180) % 360) - 180
  54. return abs(ae)
  55. return np.nan
  56. # ═══ Panel B: seed=9798, 100 steps, tort=3.10 ═══
  57. rng = np.random.default_rng(9798)
  58. traj = run_outward(100, rng)
  59. ret = run_return(traj, rng)
  60. xs_out = np.array([p["x"] for p in traj])
  61. ys_out = np.array([p["y"] for p in traj])
  62. ret_xs = [xs_out[-1]] + [p[0] for p in ret]
  63. ret_ys = [ys_out[-1]] + [p[1] for p in ret]
  64. pl = np.sum(np.sqrt(np.diff(xs_out)**2 + np.diff(ys_out)**2))
  65. d = np.sqrt(xs_out[-1]**2 + ys_out[-1]**2)
  66. print(f"Panel B: seed=9798, steps=100, tort={pl/d:.2f}, disp={d:.1f}")
  67. # ═══ Panel C: n=1000 ═══
  68. rng_c = np.random.default_rng(42)
  69. all_ae = []
  70. for _ in range(1000):
  71. t = run_outward(20, rng_c); r = run_return(t, rng_c)
  72. ae = compute_ae(t, r)
  73. if not np.isnan(ae): all_ae.append(ae)
  74. med_ae = np.median(all_ae); mean_ae = np.mean(all_ae)
  75. print(f"Panel C: n={len(all_ae)}, median={med_ae:.1f}, mean={mean_ae:.1f}")
  76. # ═══ FIGURE: 2x2 layout ═══
  77. fig = plt.figure(figsize=(7.5, 9))
  78. gs = fig.add_gridspec(2, 2, height_ratios=[1.2, 1], hspace=0.35, wspace=0.35)
  79. # ── Panel A: Placeholder ──
  80. ax_a = fig.add_subplot(gs[0, 0])
  81. ax_a.text(0.5, 0.5, 'Müller & Wehner\n(1988) Fig. 1\n\n[To be inserted\nwith permission]',
  82. ha='center', va='center', fontsize=9, fontstyle='italic',
  83. color='#666666', transform=ax_a.transAxes)
  84. ax_a.set_xlim(0, 1); ax_a.set_ylim(0, 1)
  85. for spine in ax_a.spines.values(): spine.set_linestyle('--'); spine.set_color('#aaa')
  86. ax_a.set_xticks([]); ax_a.set_yticks([])
  87. ax_a.set_title('(A) C. fortis', fontsize=9, fontweight='bold',
  88. loc='left', fontstyle='italic', pad=6)
  89. # ── Panel B: Raw trajectory ──
  90. ax_b = fig.add_subplot(gs[0, 1])
  91. ax_b.plot(xs_out, ys_out, color='black', linewidth=0.4, solid_capstyle='round', zorder=2)
  92. ax_b.plot(ret_xs, ret_ys, color='black', linewidth=0.6,
  93. linestyle=(0, (2, 2)), zorder=3)
  94. ax_b.plot(0, 0, 'ks', markersize=4, zorder=5)
  95. ax_b.annotate('N', (0, 0), textcoords="offset points", xytext=(-12, -8),
  96. fontsize=11, fontweight='bold', fontstyle='italic')
  97. ax_b.plot(xs_out[-1], ys_out[-1], 'ko', markersize=4, zorder=5)
  98. ax_b.annotate('F', (xs_out[-1], ys_out[-1]), textcoords="offset points",
  99. xytext=(6, 4), fontsize=11, fontweight='bold', fontstyle='italic')
  100. ax_b.set_aspect('equal'); ax_b.axis('off')
  101. ax_b.set_title('(B) PI Model simulation', fontsize=9,
  102. fontweight='bold', loc='left', pad=6)
  103. leg_b = [Line2D([0],[0], color='k', lw=0.4, label='Outbound'),
  104. Line2D([0],[0], color='k', lw=0.6, ls='--', label='Homeward')]
  105. ax_b.legend(handles=leg_b, loc='upper left', fontsize=6.5, frameon=False)
  106. # ── Panel C: Angular error histogram ──
  107. ax_c = fig.add_subplot(gs[1, 0])
  108. ax_c.hist(all_ae, bins=40, color='#888888', edgecolor='white',
  109. linewidth=0.3, alpha=0.85, zorder=2)
  110. ax_c.axvline(med_ae, color='black', linewidth=1.2, linestyle='-', zorder=4)
  111. ax_c.axvline(mean_ae, color='black', linewidth=1.2, linestyle='--', zorder=4)
  112. # Single verified cross-species bracket
  113. y_pos = 310 * 0.68
  114. ax_c.plot([10, 25], [y_pos, y_pos], 'k-', linewidth=1.2, zorder=5)
  115. ax_c.plot([10, 10], [y_pos - 7, y_pos + 7], 'k-', linewidth=0.9, zorder=5)
  116. ax_c.plot([25, 25], [y_pos - 7, y_pos + 7], 'k-', linewidth=0.9, zorder=5)
  117. ax_c.text(26.5, y_pos, 'Cross-species PI error\n(Etienne & Jeffery 2004, Fig. 3)',
  118. fontsize=6, fontstyle='italic', va='center', ha='left')
  119. leg_c = [
  120. plt.Rectangle((0,0), 1, 1, fc='#888888', alpha=0.85, label='Model (n = 1,000)'),
  121. Line2D([0],[0], color='black', lw=1.2, ls='-', label=f'Median ({med_ae:.1f}\u00b0)'),
  122. Line2D([0],[0], color='black', lw=1.2, ls='--', label=f'Mean ({mean_ae:.1f}\u00b0)'),
  123. ]
  124. ax_c.legend(handles=leg_c, loc='upper right', fontsize=5.5, frameon=True,
  125. framealpha=0.95, edgecolor='#ccc')
  126. ax_c.set_xlabel('Absolute angular error (\u00b0)', fontsize=8)
  127. ax_c.set_ylabel('Count', fontsize=8)
  128. ax_c.set_xlim(0, 75)
  129. ax_c.set_ylim(0, 320)
  130. ax_c.tick_params(labelsize=7)
  131. ax_c.spines['top'].set_visible(False); ax_c.spines['right'].set_visible(False)
  132. ax_c.set_title('(C) Homing angular error', fontsize=9,
  133. fontweight='bold', loc='left', pad=6)
  134. # ── Panel D: Computational cost ──
  135. ax_d = fig.add_subplot(gs[1, 1])
  136. models = ['Complex\nnumber\n(this study)', 'Cartesian\nvector', 'Polar\ncoord.']
  137. arith_ops = [10, 5, 5]
  138. trig_cost = [0, 24, 48]
  139. x = np.arange(len(models))
  140. width = 0.30
  141. ax_d.bar(x - width/2, arith_ops, width, color='black', label='Arithmetic', zorder=2)
  142. ax_d.bar(x + width/2, trig_cost, width, color='#aaaaaa', label='Trigonometric', zorder=2)
  143. ax_d.set_xticks(x)
  144. ax_d.set_xticklabels(models, fontsize=6.5)
  145. ax_d.set_ylabel('Operations per step', fontsize=8)
  146. ax_d.tick_params(labelsize=7)
  147. ax_d.spines['top'].set_visible(False); ax_d.spines['right'].set_visible(False)
  148. ax_d.legend(fontsize=6, loc='upper left', framealpha=0.9, edgecolor='#ccc')
  149. ax_d.set_ylim(0, 55)
  150. ax_d.set_title('(D) Computational cost', fontsize=9,
  151. fontweight='bold', loc='left', pad=6)
  152. plt.savefig('figure2_pnas.png', dpi=600, bbox_inches='tight', facecolor='white')
  153. plt.savefig('figure2_pnas.tiff', dpi=600, bbox_inches='tight', facecolor='white')
  154. print("\nSaved: figure2_pnas.png / .tiff")

generate_figure2.py at commit a561537, no license · at the source

Overview

Authors: Paul Craddock1, Yannick Miossec1, Youcef Bouchekioua2
  1. Department of Psychology, University of Lille, Villeneuve d’Ascq 59653, France
  2. Division of Engineering in Medicine, Department of Medicine, Brigham and Women’s Hospital, Harvard Medical School, Boston, MA 02115
Institutions: Université de Lille (France); Brigham and Women's Hospital (United States); Harvard University (United States)
Dates: received 31 January 2026; accepted 29 April 2026; published online 29 May 2026; in print 2 June 2026
Type: Brief report · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1073/pnas.2603690123 · PMID 42213748 · PMCID PMC13229285 · OpenAlex W7162805726
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: other (organism)
Keywords: path integration, complex numbers, spatial navigation, head direction cells
MeSH: Spatial Navigation*, Animals, Ants, Brain Stem, Hippocampus, Models, Neurological, Neurons (* major topic)
Topic: Memory and Neural Mechanisms (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: not cited yet (Europe PMC); 15 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.

YuYuB/Path_Integration_Simulation_Dr.Craddock_2026

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: a56153753ad9b662b8f786e410d3f63d98f37499, 25 March 2026
Languages: Python (2)
Size: 3 files, 2 scripts
Software Heritage: not archived
Found in: “Data, Materials, and Software Availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Matplotlib (2 files), NumPy (2 files)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
2 files

Zenodo 19262464

License: CC-BY-4.0
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: “Data, Materials, and Software Availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Matplotlib (2 files), NumPy (2 files)
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
  • 28 September 2026: the link answers (HTTP 200)
2 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:

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

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

Code and data availability statement

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

Read it in the paper: doi.org/10.1073/pnas.2603690123.

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, 3 authors, 4 keywords, 7 MeSH terms, 12 references.

Cite

This paper

Craddock, P., Miossec, Y., & Bouchekioua, Y. (2026). Path integration in complex number space. Proceedings of the National Academy of Sciences of the United States of America, 123(22), e2603690123. https://doi.org/10.1073/pnas.2603690123

BibTeX

@article{craddock2026path,
author = {Craddock, Paul and Miossec, Yannick and Bouchekioua, Youcef},
title = {{Path integration in complex number space}},
journal = {Proceedings of the National Academy of Sciences of the United States of America},
year = {2026},
month = may,
volume = {123},
number = {22},
pages = {e2603690123},
publisher = {National Academy of Sciences},
issn = {0027-8424},
doi = {10.1073/pnas.2603690123},
url = {https://doi.org/10.1073/pnas.2603690123},
pmid = {42213748},
pmcid = {PMC13229285}
}

RIS

TY - JOUR
AU - Craddock, Paul
AU - Miossec, Yannick
AU - Bouchekioua, Youcef
TI - Path integration in complex number space
T2 - Proceedings of the National Academy of Sciences of the United States of America
J2 - Proc Natl Acad Sci U S A
PY - 2026
DA - 2026/05/29
VL - 123
IS - 22
SP - e2603690123
SN - 0027-8424
PB - National Academy of Sciences
DO - 10.1073/pnas.2603690123
UR - https://doi.org/10.1073/pnas.2603690123
LA - en
ER -

CSL-JSON

{
"id": "10.1073/pnas.2603690123",
"type": "article-journal",
"title": "Path integration in complex number space",
"container-title": "Proceedings of the National Academy of Sciences of the United States of America",
"author": [
{
"family": "Craddock",
"given": "Paul"
},
{
"family": "Miossec",
"given": "Yannick"
},
{
"family": "Bouchekioua",
"given": "Youcef"
}
],
"container-title-short": "Proc Natl Acad Sci U S A",
"volume": "123",
"issue": "22",
"page": "e2603690123",
"DOI": "10.1073/pnas.2603690123",
"PMID": "42213748",
"PMCID": "PMC13229285",
"ISSN": "0027-8424",
"publisher": "National Academy of Sciences",
"URL": "https://doi.org/10.1073/pnas.2603690123",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
29
]
]
}
}

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.1371/journal.pcbi.1014577 [code]
Combining sampling and attractor dynamics in spiking models of head direction systems.
Journal: PLoS computational biology
In common: Matplotlib, NumPy, 2 references
[2] doi:10.1126/sciadv.aea1037 [code]
Distinct cortical spatial representations learned along disparate visual pathways.
Journal: Science advances
In common: Matplotlib, NumPy, 2 references
[3] doi:10.1038/s42256-026-01254-4 [code]
Neural sampling from cognitive maps enables goal-directed imagination and planning.
Journal: Nature machine intelligence
In common: Matplotlib, NumPy, 2 references
[4] doi:10.1038/s41593-026-02365-2 [code]
Hippocampal theta sweeps indicate goal direction during navigation.
Journal: Nature neuroscience
In common: Matplotlib, NumPy, 2 references
[5] doi:10.1038/s41467-026-76522-3 [code]
Transcriptomic analysis of spinal V1 interneurons informs their multifunctional role in motor output.
Journal: Nature communications
In common: Matplotlib, NumPy, 1 reference
[6] doi:10.1080/26941899.2026.2619222
Neurodatascience: Past, Present, and Future.
Journal: Data science in science
In common: 2 references
[7] doi:10.1038/s41467-026-73263-1 [code]
Distributed neural codes of the 3D position in the marmoset frontal cortex and hippocampus.
Journal: Nature communications
In common: 2 references
[8] doi:10.1016/j.celrep.2026.117505 [code]
Impaired spatial coding and neuronal hyperactivity in the medial entorhinal cortex of aged APP knock-in mice.
Journal: Cell reports
In common: Matplotlib, NumPy, 1 reference
[9] doi:10.1126/sciadv.aeg6797 [code]
Dorsoventral gradient of theta sweeps in the medial entorhinal cortex.
Journal: Science advances
In common: Matplotlib, NumPy, 1 reference
[10] doi:10.1002/hipo.70131 [code]
Decoding Medial Entorhinal Cortical Dynamics Produces Planning-Like Alternations in Hippocampal theta Sequences.
Journal: Hippocampus
In common: Matplotlib, NumPy, 1 reference

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.