canns 1.0.0__py3-none-any.whl → 1.0.1__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.
- canns/__init__.py +25 -6
- canns/__main__.py +69 -0
- canns/analyzer/data/asa/cohospace_scatter.py +0 -1
- canns/analyzer/data/cell_classification/visualization/btn_plots.py +0 -2
- canns/analyzer/visualization/theta_sweep_plots.py +1 -3
- {canns-1.0.0.dist-info → canns-1.0.1.dist-info}/METADATA +36 -10
- {canns-1.0.0.dist-info → canns-1.0.1.dist-info}/RECORD +10 -9
- {canns-1.0.0.dist-info → canns-1.0.1.dist-info}/entry_points.txt +1 -1
- {canns-1.0.0.dist-info → canns-1.0.1.dist-info}/WHEEL +0 -0
- {canns-1.0.0.dist-info → canns-1.0.1.dist-info}/licenses/LICENSE +0 -0
canns/__init__.py
CHANGED
|
@@ -11,12 +11,10 @@ Examples:
|
|
|
11
11
|
>>> print(list(canns.data.DATASETS))
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
-
from
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
from
|
|
18
|
-
from . import trainer as trainer
|
|
19
|
-
from . import utils as utils
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import importlib
|
|
17
|
+
from typing import TYPE_CHECKING
|
|
20
18
|
|
|
21
19
|
# Version information
|
|
22
20
|
try:
|
|
@@ -49,6 +47,27 @@ Examples:
|
|
|
49
47
|
>>> print(canns.version_info)
|
|
50
48
|
"""
|
|
51
49
|
|
|
50
|
+
_LAZY_SUBMODULES = {
|
|
51
|
+
"analyzer",
|
|
52
|
+
"data",
|
|
53
|
+
"models",
|
|
54
|
+
"pipeline",
|
|
55
|
+
"trainer",
|
|
56
|
+
"utils",
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
60
|
+
from . import analyzer, data, models, pipeline, trainer, utils
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def __getattr__(name: str):
|
|
64
|
+
if name in _LAZY_SUBMODULES:
|
|
65
|
+
module = importlib.import_module(f"{__name__}.{name}")
|
|
66
|
+
globals()[name] = module
|
|
67
|
+
return module
|
|
68
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
69
|
+
|
|
70
|
+
|
|
52
71
|
__all__ = [
|
|
53
72
|
"analyzer",
|
|
54
73
|
"data",
|
canns/__main__.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""Command-line entry point for the CANNs toolkit.
|
|
2
|
+
|
|
3
|
+
`pip/uv install canns` installs several console scripts:
|
|
4
|
+
- `canns`: convenience wrapper (this module)
|
|
5
|
+
- `canns-tui`: Textual launcher (ASA / Gallery)
|
|
6
|
+
- `canns-gallery`: Gallery TUI
|
|
7
|
+
- `canns-gui`: ASA GUI (requires `canns[gui]`)
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import argparse
|
|
13
|
+
import sys
|
|
14
|
+
from collections.abc import Sequence
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def main(argv: Sequence[str] | None = None) -> int:
|
|
18
|
+
parser = argparse.ArgumentParser(prog="canns", description="CANNs toolkit entry point.")
|
|
19
|
+
parser.add_argument(
|
|
20
|
+
"--version",
|
|
21
|
+
action="store_true",
|
|
22
|
+
help="Print installed CANNs version and exit.",
|
|
23
|
+
)
|
|
24
|
+
group = parser.add_mutually_exclusive_group()
|
|
25
|
+
group.add_argument("--asa", action="store_true", help="Run the ASA TUI directly.")
|
|
26
|
+
group.add_argument("--gallery", action="store_true", help="Run the model gallery TUI directly.")
|
|
27
|
+
group.add_argument("--gui", action="store_true", help="Run the ASA GUI (requires canns[gui]).")
|
|
28
|
+
|
|
29
|
+
args = parser.parse_args(list(argv) if argv is not None else None)
|
|
30
|
+
|
|
31
|
+
if args.version:
|
|
32
|
+
try:
|
|
33
|
+
from importlib.metadata import version
|
|
34
|
+
|
|
35
|
+
print(version("canns"))
|
|
36
|
+
except Exception:
|
|
37
|
+
try:
|
|
38
|
+
from canns._version import __version__
|
|
39
|
+
|
|
40
|
+
print(__version__)
|
|
41
|
+
except Exception:
|
|
42
|
+
print("unknown")
|
|
43
|
+
return 0
|
|
44
|
+
|
|
45
|
+
if args.gui:
|
|
46
|
+
from canns.pipeline.asa_gui import main as gui_main
|
|
47
|
+
|
|
48
|
+
return int(gui_main())
|
|
49
|
+
|
|
50
|
+
if args.gallery:
|
|
51
|
+
from canns.pipeline.gallery import main as gallery_main
|
|
52
|
+
|
|
53
|
+
gallery_main()
|
|
54
|
+
return 0
|
|
55
|
+
|
|
56
|
+
if args.asa:
|
|
57
|
+
from canns.pipeline.asa import main as asa_main
|
|
58
|
+
|
|
59
|
+
asa_main()
|
|
60
|
+
return 0
|
|
61
|
+
|
|
62
|
+
from canns.pipeline.launcher import main as launcher_main
|
|
63
|
+
|
|
64
|
+
launcher_main()
|
|
65
|
+
return 0
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if __name__ == "__main__":
|
|
69
|
+
raise SystemExit(main(sys.argv[1:]))
|
|
@@ -10,7 +10,6 @@ from ...visualization.core import PlotConfig, finalize_figure
|
|
|
10
10
|
from .path import _align_activity_to_coords, skew_transform
|
|
11
11
|
from .utils import _ensure_parent_dir, _ensure_plot_config
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
# =====================================================================
|
|
15
14
|
# CohoSpace visualization and selectivity metrics (CohoScore)
|
|
16
15
|
# =====================================================================
|
|
@@ -792,9 +792,7 @@ def plot_internal_position_trajectory(
|
|
|
792
792
|
tuple: ``(figure, axis)`` objects.
|
|
793
793
|
"""
|
|
794
794
|
if internal_position.ndim != 2 or internal_position.shape[1] != 2:
|
|
795
|
-
raise ValueError(
|
|
796
|
-
f"internal_position must be (T, 2), got shape {internal_position.shape}"
|
|
797
|
-
)
|
|
795
|
+
raise ValueError(f"internal_position must be (T, 2), got shape {internal_position.shape}")
|
|
798
796
|
if position.ndim != 2 or position.shape[1] != 2:
|
|
799
797
|
raise ValueError(f"position must be (T, 2), got shape {position.shape}")
|
|
800
798
|
if internal_position.shape[0] != position.shape[0]:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: canns
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.1
|
|
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>
|
|
@@ -60,7 +60,7 @@ Description-Content-Type: text/markdown
|
|
|
60
60
|
[<img src="https://badges.ws/maintenance/yes/2026" />](https://github.com/routhleck/canns)
|
|
61
61
|
<picture><img src="https://badges.ws/github/release/routhleck/canns" /></picture>
|
|
62
62
|
<picture><img src="https://badges.ws/github/license/routhleck/canns" /></picture>
|
|
63
|
-
[](https://doi.org/10.5281/zenodo.18453893)
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
<picture><img src="https://badges.ws/github/stars/routhleck/canns?logo=github" /></picture>
|
|
@@ -77,9 +77,9 @@ CANNs (Continuous Attractor Neural Networks toolkit) is a research toolkit built
|
|
|
77
77
|
## Architecture
|
|
78
78
|
|
|
79
79
|
<p align="center">
|
|
80
|
-
<img src="
|
|
80
|
+
<img src="docs/_static/architecture.png" alt="CANNs Architecture" width="900">
|
|
81
81
|
<br>
|
|
82
|
-
<span style="color: grey; font-size: 14px;">
|
|
82
|
+
<span style="color: grey; font-size: 14px;">Layer hierarchy of the CANNs library showing five levels: Application (Pipeline orchestration), Functional (Task, Trainer, Analyzer, Utils modules), Core Models (CANN implementations), Foundation (BrainPy/JAX and Rust FFI backends), and Hardware (CPU/GPU/TPU support)</span>
|
|
83
83
|
</p>
|
|
84
84
|
|
|
85
85
|
The CANNs library follows a modular architecture guided by two core principles: **separation of concerns** and **extensibility through
|
|
@@ -115,12 +115,12 @@ seamlessly integrate with the built-in ecosystem.
|
|
|
115
115
|
</p>
|
|
116
116
|
|
|
117
117
|
<p align="center">
|
|
118
|
-
<img src="
|
|
118
|
+
<img src="docs/_static/analyzer-display.png" alt="Analyzer Display" width="900">
|
|
119
119
|
<br>
|
|
120
120
|
<span style="color: grey; font-size: 14px;">Rich Analyzer Visualization Results</span>
|
|
121
121
|
</p>
|
|
122
122
|
<p align="center">
|
|
123
|
-
<img src="
|
|
123
|
+
<img src="docs/_static/asa-gui.gif" alt="ASA GUI Preview" width="720">
|
|
124
124
|
<br>
|
|
125
125
|
<span style="color: grey; font-size: 14px;">ASA GUI preview</span>
|
|
126
126
|
</p>
|
|
@@ -229,12 +229,12 @@ energy_landscape_1d_animation(
|
|
|
229
229
|
pip install canns
|
|
230
230
|
|
|
231
231
|
# Optional accelerators (Linux)
|
|
232
|
-
pip install
|
|
233
|
-
pip install
|
|
234
|
-
pip install
|
|
232
|
+
pip install canns[cuda12]
|
|
233
|
+
pip install canns[cuda13]
|
|
234
|
+
pip install canns[tpu]
|
|
235
235
|
|
|
236
236
|
# GUI (ASA Pipeline)
|
|
237
|
-
pip install
|
|
237
|
+
pip install canns[gui]
|
|
238
238
|
```
|
|
239
239
|
|
|
240
240
|
Optional (uv):
|
|
@@ -250,6 +250,32 @@ uv pip install canns
|
|
|
250
250
|
- Sphinx docs and notebooks: `docs/`
|
|
251
251
|
- ASA GUI entry: `canns-gui`
|
|
252
252
|
|
|
253
|
+
## Citation
|
|
254
|
+
|
|
255
|
+
If you use CANNs in your research, please cite:
|
|
256
|
+
|
|
257
|
+
```bibtex
|
|
258
|
+
@software{he_2026_canns,
|
|
259
|
+
author = {He, Sichao and
|
|
260
|
+
Tuerhong, Aiersi and
|
|
261
|
+
She, Shangjun and
|
|
262
|
+
Chu, Tianhao and
|
|
263
|
+
Wu, Yuling and
|
|
264
|
+
Zuo, Junfeng and
|
|
265
|
+
Wu, Si},
|
|
266
|
+
title = {CANNs: Continuous Attractor Neural Networks Toolkit},
|
|
267
|
+
month = feb,
|
|
268
|
+
year = 2026,
|
|
269
|
+
publisher = {Zenodo},
|
|
270
|
+
version = {v1.0.0},
|
|
271
|
+
doi = {10.5281/zenodo.18453893},
|
|
272
|
+
url = {https://doi.org/10.5281/zenodo.18453893}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Plain text:**
|
|
277
|
+
> He, S., Tuerhong, A., She, S., Chu, T., Wu, Y., Zuo, J., & Wu, S. (2026). CANNs: Continuous Attractor Neural Networks Toolkit (v1.0.0). Zenodo. https://doi.org/10.5281/zenodo.18453893
|
|
278
|
+
|
|
253
279
|
## Contributing & License
|
|
254
280
|
|
|
255
281
|
Contributions are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a PR.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
canns/__init__.py,sha256=
|
|
1
|
+
canns/__init__.py,sha256=eCaDbHtym4aHmDS2O1SK-ls_UhQKGVZt2PbtWMCUkeo,1892
|
|
2
|
+
canns/__main__.py,sha256=wdQDN2YCLNtzG0pOV_gZXX5ZFQ4afHphcET97nqbD4E,1931
|
|
2
3
|
canns/_version.py,sha256=zIvJPOGBFvo4VV6f586rlO_bvhuFp1fsxjf6xhsqkJY,1547
|
|
3
4
|
canns/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
5
|
canns/analyzer/__init__.py,sha256=EQ02fYHkpMADp-ojpVCVtapuSPkl6j5WVfdPy0mOTs4,506
|
|
@@ -9,7 +10,7 @@ canns/analyzer/data/asa/cohomap.py,sha256=ZIiH1Mu306jg1lLmeV-akEzbojXQQVKW3nl0Pb
|
|
|
9
10
|
canns/analyzer/data/asa/cohomap_vectors.py,sha256=o2eHMqiAvmhZfebOvHZ1zypqZKKgvZu0WLs3KD3Nfis,11273
|
|
10
11
|
canns/analyzer/data/asa/cohospace.py,sha256=8sq1Z0QGDxzC-5YY1n-nDEtqH3vnIsVA0Q1ST7egxTE,6701
|
|
11
12
|
canns/analyzer/data/asa/cohospace_phase_centers.py,sha256=ZQDhd_cBv8SFcVxgGM0nJabTLjKQZ1mg9Ho6duUG0xY,3738
|
|
12
|
-
canns/analyzer/data/asa/cohospace_scatter.py,sha256=
|
|
13
|
+
canns/analyzer/data/asa/cohospace_scatter.py,sha256=PTogCGIBk7QzkXOnEmtojyvmS0vfCqQ_Nl8sNVbB38k,33892
|
|
13
14
|
canns/analyzer/data/asa/config.py,sha256=qm0k0nt0xuDUK5t63MG7ii7fgs2XbxyLxKOaOKJuB_s,6398
|
|
14
15
|
canns/analyzer/data/asa/decode.py,sha256=NG8vVx2cPG7uSJDovnC2vzk0dsqU8oR4jaNPxxrvCc0,16501
|
|
15
16
|
canns/analyzer/data/asa/embedding.py,sha256=V1TzOD4wzyx3xmwCBHLLWgX92rBkMjWkFz-F-4xPPxo,9581
|
|
@@ -34,7 +35,7 @@ canns/analyzer/data/cell_classification/utils/correlation.py,sha256=57Ckn8OQGLip
|
|
|
34
35
|
canns/analyzer/data/cell_classification/utils/geometry.py,sha256=jOLh3GeO-riR5a7r7Q7uON3HU_bYOZZJLbokU5bjCOQ,12683
|
|
35
36
|
canns/analyzer/data/cell_classification/utils/image_processing.py,sha256=o9bLT4ycJ_IF7SKBe2RqSWIQwNcpi9v4AI-N5vpm_jM,12805
|
|
36
37
|
canns/analyzer/data/cell_classification/visualization/__init__.py,sha256=fmEHZBcurW6y6FwySLoq65b6CH2kNUB02NCVw2ou6Nc,590
|
|
37
|
-
canns/analyzer/data/cell_classification/visualization/btn_plots.py,sha256=
|
|
38
|
+
canns/analyzer/data/cell_classification/visualization/btn_plots.py,sha256=bIViutAZZn5Yn_BTSEaXSqB4lCavXmDZonGJQvsPxmU,7321
|
|
38
39
|
canns/analyzer/data/cell_classification/visualization/grid_plots.py,sha256=NFtyYOe2Szt0EOIwQmZradwEvvRjjm7mm6VnnGThDQ0,7914
|
|
39
40
|
canns/analyzer/data/cell_classification/visualization/hd_plots.py,sha256=nzw1jck3VHvAFsJAGelhrJf1q27A5PI0r3NKVgeea8U,5670
|
|
40
41
|
canns/analyzer/metrics/__init__.py,sha256=DTsrv1HW133_RgvhWzz7Gx-bP2hOZbPO2unCPPyf9gs,178
|
|
@@ -52,7 +53,7 @@ canns/analyzer/visualization/__init__.py,sha256=_4a8mrVOr8TR63LZbXym-djYbW-6vxxI
|
|
|
52
53
|
canns/analyzer/visualization/energy_plots.py,sha256=u0TOLzd7AWEfs-tRYZg1UBwsGYGPF_eWsMip1ZG9jPA,35671
|
|
53
54
|
canns/analyzer/visualization/spatial_plots.py,sha256=30m02xhYkZfEETCtvBSwLix9SEOPcLZTg0AGGFvPc2w,34605
|
|
54
55
|
canns/analyzer/visualization/spike_plots.py,sha256=wOm4gh_3obJy6gwo31maoaiZ7O8rsoYeFdhseoVmX78,12280
|
|
55
|
-
canns/analyzer/visualization/theta_sweep_plots.py,sha256=
|
|
56
|
+
canns/analyzer/visualization/theta_sweep_plots.py,sha256=lRye8-VgdQIkNNXNDSsdMy7pHgSXE5U-_mLYGl8cTZg,67701
|
|
56
57
|
canns/analyzer/visualization/tuning_plots.py,sha256=9JOeC4dlulVzpHQWDVy3dlJnxcBZiOPeapPdVFR-7Zk,5178
|
|
57
58
|
canns/analyzer/visualization/core/__init__.py,sha256=Vngm2A05cTu9ZVEYepTF7lVpuwQvMRjXs9XPLfZzedI,1928
|
|
58
59
|
canns/analyzer/visualization/core/animation.py,sha256=qfBYMd81_GwWEw4MHOu3GrVXJtHS9W1xxtmOx-J5ZyM,7664
|
|
@@ -165,8 +166,8 @@ canns/trainer/utils.py,sha256=ZdoLiRqFLfKXsWi0KX3wGUp0OqFikwiou8dPf3xvFhE,2847
|
|
|
165
166
|
canns/typing/__init__.py,sha256=mXySdfmD8fA56WqZTb1Nj-ZovcejwLzNjuk6PRfTwmA,156
|
|
166
167
|
canns/utils/__init__.py,sha256=OMyZ5jqZAIUS2Jr0qcnvvrx6YM-BZ1EJy5uZYeA3HC0,366
|
|
167
168
|
canns/utils/benchmark.py,sha256=oJ7nvbvnQMh4_MZh7z160NPLp-197X0rEnmnLHYlev4,1361
|
|
168
|
-
canns-1.0.
|
|
169
|
-
canns-1.0.
|
|
170
|
-
canns-1.0.
|
|
171
|
-
canns-1.0.
|
|
172
|
-
canns-1.0.
|
|
169
|
+
canns-1.0.1.dist-info/METADATA,sha256=wUN31Ys4HPf-MUlTB3RpFB_ZBKZp5RYIge7hPaEqBek,10679
|
|
170
|
+
canns-1.0.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
171
|
+
canns-1.0.1.dist-info/entry_points.txt,sha256=1JdX22E0SfCquorOBNkaj5Ekal5cQ_D0fUS8_2lo4-A,171
|
|
172
|
+
canns-1.0.1.dist-info/licenses/LICENSE,sha256=u6NJ1N-QSnf5yTwSk5UvFAdU2yKD0jxG0Xa91n1cPO4,11306
|
|
173
|
+
canns-1.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|