canns 0.12.6__py3-none-any.whl → 0.13.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. canns/__init__.py +39 -3
  2. canns/analyzer/__init__.py +7 -6
  3. canns/analyzer/data/__init__.py +3 -11
  4. canns/analyzer/data/asa/__init__.py +74 -0
  5. canns/analyzer/data/asa/cohospace.py +905 -0
  6. canns/analyzer/data/asa/config.py +246 -0
  7. canns/analyzer/data/asa/decode.py +448 -0
  8. canns/analyzer/data/asa/embedding.py +269 -0
  9. canns/analyzer/data/asa/filters.py +208 -0
  10. canns/analyzer/data/asa/fr.py +439 -0
  11. canns/analyzer/data/asa/path.py +389 -0
  12. canns/analyzer/data/asa/plotting.py +1276 -0
  13. canns/analyzer/data/asa/tda.py +901 -0
  14. canns/analyzer/data/legacy/__init__.py +6 -0
  15. canns/analyzer/data/{cann1d.py → legacy/cann1d.py} +2 -2
  16. canns/analyzer/data/{cann2d.py → legacy/cann2d.py} +3 -3
  17. canns/analyzer/metrics/spatial_metrics.py +70 -100
  18. canns/analyzer/metrics/systematic_ratemap.py +12 -17
  19. canns/analyzer/metrics/utils.py +28 -0
  20. canns/analyzer/model_specific/hopfield.py +19 -16
  21. canns/analyzer/slow_points/checkpoint.py +32 -9
  22. canns/analyzer/slow_points/finder.py +33 -6
  23. canns/analyzer/slow_points/fixed_points.py +12 -0
  24. canns/analyzer/slow_points/visualization.py +22 -10
  25. canns/analyzer/visualization/core/backend.py +15 -26
  26. canns/analyzer/visualization/core/config.py +120 -15
  27. canns/analyzer/visualization/core/jupyter_utils.py +34 -16
  28. canns/analyzer/visualization/core/rendering.py +42 -40
  29. canns/analyzer/visualization/core/writers.py +10 -20
  30. canns/analyzer/visualization/energy_plots.py +78 -28
  31. canns/analyzer/visualization/spatial_plots.py +81 -36
  32. canns/analyzer/visualization/spike_plots.py +27 -7
  33. canns/analyzer/visualization/theta_sweep_plots.py +159 -72
  34. canns/analyzer/visualization/tuning_plots.py +11 -3
  35. canns/data/__init__.py +7 -4
  36. canns/models/__init__.py +10 -0
  37. canns/models/basic/cann.py +102 -40
  38. canns/models/basic/grid_cell.py +9 -8
  39. canns/models/basic/hierarchical_model.py +57 -11
  40. canns/models/brain_inspired/hopfield.py +26 -14
  41. canns/models/brain_inspired/linear.py +15 -16
  42. canns/models/brain_inspired/spiking.py +23 -12
  43. canns/pipeline/__init__.py +4 -8
  44. canns/pipeline/asa/__init__.py +21 -0
  45. canns/pipeline/asa/__main__.py +11 -0
  46. canns/pipeline/asa/app.py +1000 -0
  47. canns/pipeline/asa/runner.py +1095 -0
  48. canns/pipeline/asa/screens.py +215 -0
  49. canns/pipeline/asa/state.py +248 -0
  50. canns/pipeline/asa/styles.tcss +221 -0
  51. canns/pipeline/asa/widgets.py +233 -0
  52. canns/pipeline/gallery/__init__.py +7 -0
  53. canns/task/closed_loop_navigation.py +54 -13
  54. canns/task/open_loop_navigation.py +230 -147
  55. canns/task/tracking.py +156 -24
  56. canns/trainer/__init__.py +8 -5
  57. canns/utils/__init__.py +12 -4
  58. {canns-0.12.6.dist-info → canns-0.13.0.dist-info}/METADATA +6 -3
  59. canns-0.13.0.dist-info/RECORD +91 -0
  60. {canns-0.12.6.dist-info → canns-0.13.0.dist-info}/entry_points.txt +1 -0
  61. canns/pipeline/theta_sweep.py +0 -573
  62. canns-0.12.6.dist-info/RECORD +0 -72
  63. {canns-0.12.6.dist-info → canns-0.13.0.dist-info}/WHEEL +0 -0
  64. {canns-0.12.6.dist-info → canns-0.13.0.dist-info}/licenses/LICENSE +0 -0
canns/trainer/__init__.py CHANGED
@@ -1,9 +1,12 @@
1
- """
2
- Training utilities for CANNs models.
1
+ """Training utilities for CANNs models.
2
+
3
+ This namespace exposes the abstract ``Trainer`` base class and concrete
4
+ implementations of classic brain-inspired learning algorithms such as
5
+ ``HebbianTrainer`` and ``OjaTrainer``.
3
6
 
4
- The module exposes the abstract ``Trainer`` base class and concrete implementations
5
- of classic brain-inspired learning algorithms: ``HebbianTrainer``, ``AntiHebbianTrainer``,
6
- ``OjaTrainer``, ``BCMTrainer``, ``SangerTrainer``, and ``STDPTrainer``.
7
+ Examples:
8
+ >>> from canns import trainer
9
+ >>> print(trainer.Trainer)
7
10
  """
8
11
 
9
12
  from ._base import Trainer
canns/utils/__init__.py CHANGED
@@ -1,8 +1,16 @@
1
- """
2
- General utilities for CANNs.
1
+ """General utilities for CANNs.
2
+
3
+ This namespace provides small helpers that don't fit into a specific domain,
4
+ such as benchmarking utilities.
3
5
 
4
- This module provides general-purpose utilities that don't fit into specific
5
- domain modules, such as benchmarking and performance measurement tools.
6
+ Examples:
7
+ >>> from canns.utils import benchmark
8
+ >>>
9
+ >>> @benchmark(runs=3)
10
+ ... def add():
11
+ ... return 1 + 1
12
+ >>>
13
+ >>> add()
6
14
  """
7
15
 
8
16
  from .benchmark import benchmark
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: canns
3
- Version: 0.12.6
3
+ Version: 0.13.0
4
4
  Summary: A Python Library for Continuous Attractor Neural Networks
5
5
  Project-URL: Repository, https://github.com/routhleck/canns
6
6
  Author-email: Sichao He <sichaohe@outlook.com>
@@ -18,6 +18,7 @@ Classifier: Typing :: Typed
18
18
  Requires-Python: <4.0,>=3.11
19
19
  Requires-Dist: brainpy[cpu]
20
20
  Requires-Dist: canns-lib>=0.6.2
21
+ Requires-Dist: climage>=0.2.2
21
22
  Requires-Dist: furo>=2025.7.19
22
23
  Requires-Dist: imageio[ffmpeg]>=2.37.0
23
24
  Requires-Dist: notebook>=7.4.4
@@ -25,6 +26,7 @@ Requires-Dist: numba>=0.56.0
25
26
  Requires-Dist: numpy<2.3,>=1.24
26
27
  Requires-Dist: scipy>=1.9.0
27
28
  Requires-Dist: seaborn>=0.13.2
29
+ Requires-Dist: textual>=7.3.0
28
30
  Requires-Dist: tqdm
29
31
  Provides-Extra: cpu
30
32
  Requires-Dist: brainpy[cpu]; extra == 'cpu'
@@ -65,7 +67,7 @@ CANNs is a Python library built on top of brainpy with performance‑critical mo
65
67
  - **Task-first API** – `canns.task.tracking` and `canns.task.open_loop_navigation` generate smooth tracking inputs, population coding stimuli, or import experimental trajectories.
66
68
  - **Rich analysis suite** – `canns.analyzer` covers energy landscapes, tuning curves, spike embeddings, UMAP/TDA helpers, and theta-sweep animations.
67
69
  - **Unified training** – `canns.trainer.HebbianTrainer` implements generic Hebbian learning and prediction, layered on the abstract `Trainer` base.
68
- - **Pipelines out of the box** `canns.pipeline.ThetaSweepPipeline` orchestrates navigation tasks, direction/grid-cell networks, and visualisation in a single call.
70
+ - **Pipeline workspace** the ASA TUI (Attractor Structure Analyzer) provides an end-to-end analysis workflow (TDA decode CohoMap/CohoSpace/FR/FRM) for interactive runs.
69
71
  - **Extensible foundations** – base classes (`BasicModel`, `Task`, `Trainer`, `Pipeline`) keep custom components consistent with the built-in ecosystem.
70
72
 
71
73
  ## Visual Gallery
@@ -115,6 +117,7 @@ pip install canns
115
117
  # Optional accelerators (Linux only)
116
118
  pip install canns[cuda12]
117
119
  pip install canns[tpu]
120
+
118
121
  ```
119
122
 
120
123
  ## Quick Start
@@ -150,7 +153,7 @@ us, inputs = bm.for_loop(
150
153
  )
151
154
  ```
152
155
 
153
- For an end-to-end theta sweep workflow, see `examples/pipeline/theta_sweep_from_external_data.py` or the `ThetaSweepPipeline` notebook in the docs.
156
+ For the ASA pipeline, run the TUI via `python -m canns.pipeline.asa` (or the `canns-tui` entrypoint) and point it at your ASA `.npz` inputs.
154
157
 
155
158
  ## Documentation & Notebooks
156
159
 
@@ -0,0 +1,91 @@
1
+ canns/__init__.py,sha256=ZK4buN-csoLKXaKtoDrOoZbNGCoLCNuF2XS96X8LbH8,1523
2
+ canns/_version.py,sha256=zIvJPOGBFvo4VV6f586rlO_bvhuFp1fsxjf6xhsqkJY,1547
3
+ canns/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ canns/analyzer/__init__.py,sha256=EQ02fYHkpMADp-ojpVCVtapuSPkl6j5WVfdPy0mOTs4,506
5
+ canns/analyzer/data/__init__.py,sha256=5LJ8Q4SyDpi6CAzyW3lSpra3I0BgG20kmQMceONw7A4,158
6
+ canns/analyzer/data/asa/__init__.py,sha256=MNsWjFFWFbnDbYPgvF43Kj4Tv8pPpqmdJnlNbK2_fbI,1670
7
+ canns/analyzer/data/asa/cohospace.py,sha256=n6DfPWUH_k67KrPbNMt1EUdxMuRFFmXCaqh4gcuXngM,27847
8
+ canns/analyzer/data/asa/config.py,sha256=zVs-snLkD93hGc97GEX9CkcjTtUqORvMCs3khHhqd64,6288
9
+ canns/analyzer/data/asa/decode.py,sha256=5haC6WclPIDQgPtnDfjKoWFbDwJVyaBzTEiRbdPnbyU,16579
10
+ canns/analyzer/data/asa/embedding.py,sha256=rT3hOHk6BzHF1X5YznIFxE_dDveklbT0fx9GtA2w3z0,9550
11
+ canns/analyzer/data/asa/filters.py,sha256=D-1mDVn4hBEAphKUgx1gQEUfgbghKcNQhZmr4xEExQA,7146
12
+ canns/analyzer/data/asa/fr.py,sha256=VRvruZl5NBfK7QEsRLsqHSftelHFXghzJfBU1nov-YQ,13593
13
+ canns/analyzer/data/asa/path.py,sha256=p3r8EGcJi8NewNFutr3kdO-ekdU_5Icpy6nAoELzSq4,12233
14
+ canns/analyzer/data/asa/plotting.py,sha256=7EfVSUERju6lggXyZ8U_BkJznaoTgwY2w3aVfyoy5rs,40325
15
+ canns/analyzer/data/asa/tda.py,sha256=Hn110SBN4wKgHmcwPRkxHdbQ5DFW2xLdSv26J37_Zxc,30342
16
+ canns/analyzer/data/legacy/__init__.py,sha256=JNFKxWBlT2p4Nf70Ddby67-4UYNaVS7lQFAy5wXEE-8,92
17
+ canns/analyzer/data/legacy/cann1d.py,sha256=QN4vbYXrfcxAVbPhaYiXGoP5QzTc6hWJJGo5ETP_RSU,35793
18
+ canns/analyzer/data/legacy/cann2d.py,sha256=RaibP0byPKK9qGefQme0-uZLwqTKOFGBL3VfmbRZOjk,86659
19
+ canns/analyzer/metrics/__init__.py,sha256=WaTCJE2WhqPtZXYTtMilF_f0LZUfz2h9a25HzwmCwP8,132
20
+ canns/analyzer/metrics/spatial_metrics.py,sha256=ZdS7tGH3lMgNlSYoHlH8IPsCw4XL0KtEnGALg_WHRX8,8965
21
+ canns/analyzer/metrics/systematic_ratemap.py,sha256=MzXfa6_fGgrxD5xEd4hfrZR_fyUmhXQCxnPE3hUonE8,14004
22
+ canns/analyzer/metrics/utils.py,sha256=Ft6lagKdTRJIz6hj9Zmy0i-IU--_Kdrrfzh6xVOQb8g,7402
23
+ canns/analyzer/model_specific/__init__.py,sha256=UCw_MwJJh2AQtnfVeJSzvTVTdVN1ev5oGGoyZtSt1PU,80
24
+ canns/analyzer/model_specific/hopfield.py,sha256=zNPChxX_GuCgc5-KP1KMwHyUDVUh_5EMQzZygOGtIW0,7741
25
+ canns/analyzer/slow_points/__init__.py,sha256=teH7uaVLCXeZGirfez8i3VkbR49pd4isedEtSzweHQs,532
26
+ canns/analyzer/slow_points/checkpoint.py,sha256=s4_-5HZJvmnyFqpK1O9WWYkhAhZj1i5jn9SH6XTGwoY,2980
27
+ canns/analyzer/slow_points/finder.py,sha256=y-YKg-LI7lRM4JMghfcb5NGSYhIM2VPRA37YSCkVK_4,25437
28
+ canns/analyzer/slow_points/fixed_points.py,sha256=Qp-iezwydWWUTchb2hGXJv0QKJqIm9gSG6hh0H9Eb6E,10099
29
+ canns/analyzer/slow_points/visualization.py,sha256=sRmmxs900OSB680MTp0PNIGLpS5i5AmJ58ek20vmrSE,10610
30
+ canns/analyzer/visualization/__init__.py,sha256=pNIokzS8y3ydzEMmVm1FNrOMRALDeuOHbcwZicPUm90,2131
31
+ canns/analyzer/visualization/energy_plots.py,sha256=u0TOLzd7AWEfs-tRYZg1UBwsGYGPF_eWsMip1ZG9jPA,35671
32
+ canns/analyzer/visualization/spatial_plots.py,sha256=30m02xhYkZfEETCtvBSwLix9SEOPcLZTg0AGGFvPc2w,34605
33
+ canns/analyzer/visualization/spike_plots.py,sha256=wOm4gh_3obJy6gwo31maoaiZ7O8rsoYeFdhseoVmX78,12280
34
+ canns/analyzer/visualization/theta_sweep_plots.py,sha256=2kiP7-IizqGm0q-ohQ4HhDZpm3sqs_lgn3GErHEZzbI,62262
35
+ canns/analyzer/visualization/tuning_plots.py,sha256=9JOeC4dlulVzpHQWDVy3dlJnxcBZiOPeapPdVFR-7Zk,5178
36
+ canns/analyzer/visualization/core/__init__.py,sha256=Vngm2A05cTu9ZVEYepTF7lVpuwQvMRjXs9XPLfZzedI,1928
37
+ canns/analyzer/visualization/core/animation.py,sha256=qfBYMd81_GwWEw4MHOu3GrVXJtHS9W1xxtmOx-J5ZyM,7664
38
+ canns/analyzer/visualization/core/backend.py,sha256=Nbk-ARL_xeWlb3nl5SUPrFQNns2wq5BeHU3Q_tAbd_c,9539
39
+ canns/analyzer/visualization/core/config.py,sha256=9_n5hrvJXZgv32OlE_PuNh4JaPgw3dRAp_8LRzYnt_w,24131
40
+ canns/analyzer/visualization/core/jupyter_utils.py,sha256=JD56VeeWb7w9t5DJ8TpgnxRWkUK46ArbbPSTlFdIM10,6034
41
+ canns/analyzer/visualization/core/rendering.py,sha256=YCbiXu8MOAqE9FVb_id5JKr5g9O64sCh-dOs0EK4gnU,18291
42
+ canns/analyzer/visualization/core/writers.py,sha256=HLsP953hgsv140ZX2XPzHfCUTqenjmjbLNrbknKam_s,15607
43
+ canns/data/__init__.py,sha256=BjQWgDYxh4jqtcKzcEZbdTech92AUzt_1KsDU1S88kM,864
44
+ canns/data/datasets.py,sha256=TRHxQGlMPoboiTPKhjTv1AMGbMnIt9T472Juyz4PYS0,13480
45
+ canns/data/loaders.py,sha256=S2JFUN83MsXCN0FBRIrxpJvW_EyXGGptis4QXvS3FSI,13622
46
+ canns/models/__init__.py,sha256=2j5josUkwQQq8Of_gLjecYry65DuC96J8X-RlRqskYs,305
47
+ canns/models/basic/__init__.py,sha256=mNqyGz_z29YNMC345b_VyuVI9hQQ9NFe9mIU9f5KGVU,329
48
+ canns/models/basic/_base.py,sha256=L7oECkO5-5j9r1faaz6RDIqQKHy6DEflHRGHyaW9ARg,3800
49
+ canns/models/basic/cann.py,sha256=uR7j5u71b4qLFK_0xS5pXTZoLyEOa0tvsmT3D0O-CMQ,24588
50
+ canns/models/basic/grid_cell.py,sha256=8nGXgXAh8UDNx3j3taqwBOsgOBVxjIk9u45v9zFSvrE,31955
51
+ canns/models/basic/hierarchical_model.py,sha256=V2QRuTVirT3_7quFC6sJb1JyNIMbo5WlAo7BybV6QKE,53847
52
+ canns/models/basic/theta_sweep_model.py,sha256=GGd3_X81eNzPoguXbleVWO_ID253FzQOqdxEPA5VJUo,34075
53
+ canns/models/brain_inspired/__init__.py,sha256=MuG-adTkIIhOxs63u0f0b0oO6srilGQzR_Gta8qXeXY,620
54
+ canns/models/brain_inspired/_base.py,sha256=YyzgmCh-YzUsK22NbSAapUWHk03jwJ49b1kRCfMWbQk,3820
55
+ canns/models/brain_inspired/hopfield.py,sha256=KQmXWBvUTdQ17t9VG-8Sy_uJznEt4eunONYJsiN5GvY,6903
56
+ canns/models/brain_inspired/linear.py,sha256=oRjJnTqrheAADA5unYBu83RSm4UoUH-BK2Mt_liwDtw,6141
57
+ canns/models/brain_inspired/spiking.py,sha256=hr2w7c6Eobxwp2z6vkV9Yivpv1964-cno-XOfMSh3RU,5557
58
+ canns/models/hybrid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
+ canns/pipeline/__init__.py,sha256=OgFh5UXId99j_W4MkcpTaYD9qpQVXt-v9xN8cCY8sSc,371
60
+ canns/pipeline/_base.py,sha256=bYCmvXQ_0vGF-MEVpi0sUljrqmW6Ax8csQ5fcnX7nAE,1869
61
+ canns/pipeline/asa/__init__.py,sha256=JR4T0onfmkKMOrUq-k0San1RTSb1om6cd27tWovBp0c,466
62
+ canns/pipeline/asa/__main__.py,sha256=_KgAeuGQ2-SXmuZhvZCkRx9luFf7VgKUCuszNlUswyA,197
63
+ canns/pipeline/asa/app.py,sha256=L5al6PrGoEzRNosZlHbn-VaTxXCoVyfKFn0f1e-0FUI,49906
64
+ canns/pipeline/asa/runner.py,sha256=PfHXlI-m3m-IYVFcFRhSODfPoRlCrloDOqEftvAfasg,42723
65
+ canns/pipeline/asa/screens.py,sha256=DbqidxmoKe4KzSLuxuriVv1PIVFn5Z-PfScVfjrIiEA,5954
66
+ canns/pipeline/asa/state.py,sha256=XukidfcFIOmm9ttT226FOTYR5hv2VAY8_DZt7V1Ml2g,6955
67
+ canns/pipeline/asa/styles.tcss,sha256=eaXI3rQeWdBYmWdLJMMiSO6acHtreLRVKKoIHb2-dBk,3349
68
+ canns/pipeline/asa/widgets.py,sha256=9pO6fJ13sQUm4vxETdSpYDXDA7z0mi3yFZO_RDakxpY,8087
69
+ canns/pipeline/gallery/__init__.py,sha256=PPOvxmTRzEnj33jHlsFlaWuEfhrcNe39pMPQkTisjlo,187
70
+ canns/task/__init__.py,sha256=sfo8TBBVAqkx73Nu5lVv77UCwZjKqjt042ezW4Wv2Ec,350
71
+ canns/task/_base.py,sha256=rdRy4mr6x53z4aJv04UJcpqCyv78AxB1k1DhxnriLpg,4401
72
+ canns/task/closed_loop_navigation.py,sha256=QxxLdAg4Zd8763bS001jFqfts3A6_r6hpTTfrh1LdW8,10204
73
+ canns/task/navigation_base.py,sha256=s7mgXKhJyxIEUnSY8zXL3k9kH26MMQDv2xptzObu7Fc,40692
74
+ canns/task/open_loop_navigation.py,sha256=jD77GVIGLaBVm0zKmOfghKk_Vj_9pjkjK8_a40907bU,45402
75
+ canns/task/tracking.py,sha256=KNJ7QkecRimxDa4lLC9JnzTvQGB-c0_lvU-InlmcLOY,31866
76
+ canns/trainer/__init__.py,sha256=ouHRuCuLuwFyrsOWbaotGxHIs5BdiYBtMhqE2k7HcKI,660
77
+ canns/trainer/_base.py,sha256=EQIXnvRvhCo0veTItGQumNeGuerHzsqipxyGZGIt2QI,1536
78
+ canns/trainer/bcm.py,sha256=-KjncsWsVGZVpmcIJIA9BvQf9AFw0M_4PcavAFIwkvA,6349
79
+ canns/trainer/hebbian.py,sha256=b6HcLrYPgcoBJUN6nZSoFILFMFaKYn-cz3FZ9SVOppI,23740
80
+ canns/trainer/oja.py,sha256=I6oCXmZj4wb30_cBVaNrye8YTxPRYLL2cdwULNaaops,5617
81
+ canns/trainer/sanger.py,sha256=cvBB7v9EA-69semVjJu_Pg9AQffZZ5sj0KGnw63CJAo,6638
82
+ canns/trainer/stdp.py,sha256=kH0FYkHbluPhczkTf7TxZrlFME65Y4fRY6b-jqPl10c,8670
83
+ canns/trainer/utils.py,sha256=ZdoLiRqFLfKXsWi0KX3wGUp0OqFikwiou8dPf3xvFhE,2847
84
+ canns/typing/__init__.py,sha256=mXySdfmD8fA56WqZTb1Nj-ZovcejwLzNjuk6PRfTwmA,156
85
+ canns/utils/__init__.py,sha256=OMyZ5jqZAIUS2Jr0qcnvvrx6YM-BZ1EJy5uZYeA3HC0,366
86
+ canns/utils/benchmark.py,sha256=oJ7nvbvnQMh4_MZh7z160NPLp-197X0rEnmnLHYlev4,1361
87
+ canns-0.13.0.dist-info/METADATA,sha256=E-6ivcs7Yrp4Hffey9nfIQttDe6dzWwAbg-sT09auAg,8827
88
+ canns-0.13.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
89
+ canns-0.13.0.dist-info/entry_points.txt,sha256=HDzYp0e9E1wfKYRkYtnUgVKK_u33_7eIn9exgm7t-wg,75
90
+ canns-0.13.0.dist-info/licenses/LICENSE,sha256=u6NJ1N-QSnf5yTwSk5UvFAdU2yKD0jxG0Xa91n1cPO4,11306
91
+ canns-0.13.0.dist-info/RECORD,,
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
2
  canns = canns:master
3
+ canns-tui = canns.pipeline.asa:main