krikkit 0.1.0.dev0__tar.gz
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.
- krikkit-0.1.0.dev0/LICENSE +21 -0
- krikkit-0.1.0.dev0/PKG-INFO +81 -0
- krikkit-0.1.0.dev0/README.md +58 -0
- krikkit-0.1.0.dev0/krikkit/__init__.py +16 -0
- krikkit-0.1.0.dev0/krikkit/adapters/__init__.py +8 -0
- krikkit-0.1.0.dev0/krikkit/dynamics/__init__.py +8 -0
- krikkit-0.1.0.dev0/krikkit/geometry/__init__.py +8 -0
- krikkit-0.1.0.dev0/krikkit/py.typed +0 -0
- krikkit-0.1.0.dev0/krikkit/recovery/__init__.py +9 -0
- krikkit-0.1.0.dev0/krikkit/reference/__init__.py +8 -0
- krikkit-0.1.0.dev0/krikkit/report/__init__.py +9 -0
- krikkit-0.1.0.dev0/krikkit/selection/__init__.py +8 -0
- krikkit-0.1.0.dev0/krikkit/simulate/__init__.py +9 -0
- krikkit-0.1.0.dev0/krikkit/testing/__init__.py +9 -0
- krikkit-0.1.0.dev0/krikkit/validation/__init__.py +9 -0
- krikkit-0.1.0.dev0/pyproject.toml +131 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Darik A O’Neil
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: krikkit
|
|
3
|
+
Version: 0.1.0.dev0
|
|
4
|
+
Summary: Select, validate and interpret latent dynamical-systems models of neural population recordings
|
|
5
|
+
Keywords: neuroscience,dynamical systems,state-space models,model selection,model validation
|
|
6
|
+
Author: Darik A. O'Neil
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Dist: numpy>=2.1
|
|
19
|
+
Requires-Dist: scipy>=1.14
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Project-URL: Repository, https://github.com/darikoneil/krikkit
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# krikkit
|
|
25
|
+
|
|
26
|
+
Select, validate and interpret latent dynamical-systems models fitted to neural population
|
|
27
|
+
recordings.
|
|
28
|
+
|
|
29
|
+
krikkit does not fit models itself. It drives and inspects models fitted by other libraries,
|
|
30
|
+
through a small set of capability protocols, and it reports every result with three labels:
|
|
31
|
+
what the latent inference was allowed to see, which coordinates the quantity lives in, and how
|
|
32
|
+
far it can be trusted.
|
|
33
|
+
|
|
34
|
+
## Status
|
|
35
|
+
|
|
36
|
+
Pre-alpha. The repository holds the scaffold only: packaging, tool configuration, the empty
|
|
37
|
+
subpackages, and a test that enforces the layering between them. No analysis is implemented
|
|
38
|
+
yet.
|
|
39
|
+
|
|
40
|
+
The design is in
|
|
41
|
+
[`docs/specs/2026-11-25-krikkit-design.md`](docs/specs/2026-11-25-krikkit-design.md).
|
|
42
|
+
|
|
43
|
+
## Layout
|
|
44
|
+
|
|
45
|
+
The package directory `krikkit/` sits at the repository root. A module imports only from the
|
|
46
|
+
layers below it, and `tests/test_layering.py` checks every import against that rule.
|
|
47
|
+
|
|
48
|
+
| Layer | Subpackages and modules | Job |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| Foundation | `data`, `splits`, `protocols`, `systems`, `results`, `errors` | The data container, the capability protocols, canonical records and result records |
|
|
51
|
+
| Implementers | `reference`, `simulate` | Reference models and planted systems that implement the protocols |
|
|
52
|
+
| Analyses | `dynamics`, `geometry`, `validation` | What a model implies and whether it predicts, read through the protocols alone |
|
|
53
|
+
| Orchestration | `selection`, `recovery` | Model search, and comparison of a fit with a planted truth |
|
|
54
|
+
| Presentation | `report` | The audit and the optional plots |
|
|
55
|
+
| Tooling | `testing` | The conformance suite for adapters |
|
|
56
|
+
| Adapters | `adapters` | One module per third-party modeling library |
|
|
57
|
+
|
|
58
|
+
The foundation modules are planned and not yet written.
|
|
59
|
+
|
|
60
|
+
## Development
|
|
61
|
+
|
|
62
|
+
You need Python 3.12 or later and [uv](https://docs.astral.sh/uv/).
|
|
63
|
+
|
|
64
|
+
```shell
|
|
65
|
+
git clone https://github.com/darikoneil/krikkit.git
|
|
66
|
+
cd krikkit
|
|
67
|
+
uv sync
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```shell
|
|
71
|
+
uv run pytest # tests
|
|
72
|
+
uv run coverage run # tests under coverage
|
|
73
|
+
uv run coverage report # fails below 85% branch coverage
|
|
74
|
+
uv run ruff format . # format
|
|
75
|
+
uv run ruff check . --output-format concise # lint (the configured format is JSON)
|
|
76
|
+
uv run pyrefly check # type check
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT; see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# krikkit
|
|
2
|
+
|
|
3
|
+
Select, validate and interpret latent dynamical-systems models fitted to neural population
|
|
4
|
+
recordings.
|
|
5
|
+
|
|
6
|
+
krikkit does not fit models itself. It drives and inspects models fitted by other libraries,
|
|
7
|
+
through a small set of capability protocols, and it reports every result with three labels:
|
|
8
|
+
what the latent inference was allowed to see, which coordinates the quantity lives in, and how
|
|
9
|
+
far it can be trusted.
|
|
10
|
+
|
|
11
|
+
## Status
|
|
12
|
+
|
|
13
|
+
Pre-alpha. The repository holds the scaffold only: packaging, tool configuration, the empty
|
|
14
|
+
subpackages, and a test that enforces the layering between them. No analysis is implemented
|
|
15
|
+
yet.
|
|
16
|
+
|
|
17
|
+
The design is in
|
|
18
|
+
[`docs/specs/2026-11-25-krikkit-design.md`](docs/specs/2026-11-25-krikkit-design.md).
|
|
19
|
+
|
|
20
|
+
## Layout
|
|
21
|
+
|
|
22
|
+
The package directory `krikkit/` sits at the repository root. A module imports only from the
|
|
23
|
+
layers below it, and `tests/test_layering.py` checks every import against that rule.
|
|
24
|
+
|
|
25
|
+
| Layer | Subpackages and modules | Job |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| Foundation | `data`, `splits`, `protocols`, `systems`, `results`, `errors` | The data container, the capability protocols, canonical records and result records |
|
|
28
|
+
| Implementers | `reference`, `simulate` | Reference models and planted systems that implement the protocols |
|
|
29
|
+
| Analyses | `dynamics`, `geometry`, `validation` | What a model implies and whether it predicts, read through the protocols alone |
|
|
30
|
+
| Orchestration | `selection`, `recovery` | Model search, and comparison of a fit with a planted truth |
|
|
31
|
+
| Presentation | `report` | The audit and the optional plots |
|
|
32
|
+
| Tooling | `testing` | The conformance suite for adapters |
|
|
33
|
+
| Adapters | `adapters` | One module per third-party modeling library |
|
|
34
|
+
|
|
35
|
+
The foundation modules are planned and not yet written.
|
|
36
|
+
|
|
37
|
+
## Development
|
|
38
|
+
|
|
39
|
+
You need Python 3.12 or later and [uv](https://docs.astral.sh/uv/).
|
|
40
|
+
|
|
41
|
+
```shell
|
|
42
|
+
git clone https://github.com/darikoneil/krikkit.git
|
|
43
|
+
cd krikkit
|
|
44
|
+
uv sync
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```shell
|
|
48
|
+
uv run pytest # tests
|
|
49
|
+
uv run coverage run # tests under coverage
|
|
50
|
+
uv run coverage report # fails below 85% branch coverage
|
|
51
|
+
uv run ruff format . # format
|
|
52
|
+
uv run ruff check . --output-format concise # lint (the configured format is JSON)
|
|
53
|
+
uv run pyrefly check # type check
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT; see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Select, validate and interpret latent dynamical-systems models of neural populations.
|
|
2
|
+
|
|
3
|
+
krikkit does not fit models itself. It drives and inspects models fitted by other
|
|
4
|
+
libraries, through a small set of capability protocols, and it reports every result with
|
|
5
|
+
what the latent inference was allowed to see, which coordinates the quantity lives in,
|
|
6
|
+
and how far it can be trusted.
|
|
7
|
+
|
|
8
|
+
The package is a scaffold for now: its subpackages exist and hold no analyses yet.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from importlib.metadata import version
|
|
12
|
+
|
|
13
|
+
__version__ = version("krikkit")
|
|
14
|
+
"""Version of the installed krikkit distribution."""
|
|
15
|
+
|
|
16
|
+
__all__ = ["__version__"]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Adapters that make models from third-party libraries speak the capability protocols.
|
|
2
|
+
|
|
3
|
+
Each adapter lives in its own module, imports its own third-party library and is imported
|
|
4
|
+
only when a user asks for it, so krikkit itself never depends on a modeling library. An
|
|
5
|
+
adapter imports the foundation modules and nothing else from krikkit.
|
|
6
|
+
|
|
7
|
+
No adapter exists yet.
|
|
8
|
+
"""
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""What a model's dynamics imply: fixed points, stability, sweeps and attractors.
|
|
2
|
+
|
|
3
|
+
The analyses here read a model through the capability protocols alone, exactly where the
|
|
4
|
+
model describes itself with canonical records and numerically where it offers only
|
|
5
|
+
callables. They import the foundation modules and nothing else from krikkit.
|
|
6
|
+
|
|
7
|
+
Nothing is implemented here yet.
|
|
8
|
+
"""
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""The shape of trajectories and subspaces: tangling, alignment and dimensionality.
|
|
2
|
+
|
|
3
|
+
Quantities that depend on the latent basis are computed in a canonical basis tied to the
|
|
4
|
+
observations, so that fits can be compared. The analyses here import the foundation
|
|
5
|
+
modules and nothing else from krikkit.
|
|
6
|
+
|
|
7
|
+
Nothing is implemented here yet.
|
|
8
|
+
"""
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Comparing a fit with a planted truth.
|
|
2
|
+
|
|
3
|
+
Recovery scores need ground truth, which sets them apart from the checks in
|
|
4
|
+
:mod:`krikkit.validation`. One study cell simulates, selects, validates, analyses and
|
|
5
|
+
compares, so this subpackage may import the foundation modules, the analyses, the
|
|
6
|
+
implementers and :mod:`krikkit.selection`.
|
|
7
|
+
|
|
8
|
+
Nothing is implemented here yet.
|
|
9
|
+
"""
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Reference models: simple, exact implementations of the capability protocols.
|
|
2
|
+
|
|
3
|
+
They serve tests, tutorials and checks against known answers, and are not meant for
|
|
4
|
+
analysing recordings. As implementers of the protocols they import only the foundation
|
|
5
|
+
modules of krikkit.
|
|
6
|
+
|
|
7
|
+
Nothing is implemented here yet.
|
|
8
|
+
"""
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""What a reader sees: the audit of a fitted model, and optional plots.
|
|
2
|
+
|
|
3
|
+
The audit gathers what was fitted, what was tested and every caveat into one page. Plots
|
|
4
|
+
are drawn from saved results and need matplotlib, which is imported only inside the
|
|
5
|
+
function that draws. This subpackage may import every other part of krikkit except the
|
|
6
|
+
adapters and the testing tools.
|
|
7
|
+
|
|
8
|
+
Nothing is implemented here yet.
|
|
9
|
+
"""
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Choosing a model: search over hyperparameters, folds and random starts.
|
|
2
|
+
|
|
3
|
+
Every run is kept, the choice follows a paired one-standard-error rule, and the chosen
|
|
4
|
+
model is refitted on all data and compared with its folds. This subpackage orchestrates
|
|
5
|
+
the analyses, so it imports the foundation modules and the analysis subpackages.
|
|
6
|
+
|
|
7
|
+
Nothing is implemented here yet.
|
|
8
|
+
"""
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Simulated recordings with planted dynamics and a machine-checkable truth.
|
|
2
|
+
|
|
3
|
+
A simulation is assembled from latent dynamics, an optional switching rule, an emission
|
|
4
|
+
model and a sampling design. The planted system implements the same capability protocols
|
|
5
|
+
as a fitted model, so the truth goes through the same analyses as a fit. This subpackage
|
|
6
|
+
imports the foundation modules and the reference models.
|
|
7
|
+
|
|
8
|
+
Nothing is implemented here yet.
|
|
9
|
+
"""
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Tools for testing a model against the capability protocols.
|
|
2
|
+
|
|
3
|
+
An ``isinstance`` check against a protocol confirms only that a method exists. The
|
|
4
|
+
conformance suite planned here checks what the method does, and it is meant for krikkit's
|
|
5
|
+
own tests and for the authors of adapters alike. It imports the foundation modules and
|
|
6
|
+
nothing else from krikkit.
|
|
7
|
+
|
|
8
|
+
Nothing is implemented here yet.
|
|
9
|
+
"""
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Checks of a fitted model that need no ground truth.
|
|
2
|
+
|
|
3
|
+
Every score records what the latent inference was allowed to see: which units and which
|
|
4
|
+
time bins. The checks cover co-smoothing, forecasts, held-out likelihood, posterior
|
|
5
|
+
predictive checks and residuals, each against baselines. They import the foundation
|
|
6
|
+
modules and nothing else from krikkit.
|
|
7
|
+
|
|
8
|
+
Nothing is implemented here yet.
|
|
9
|
+
"""
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "krikkit"
|
|
3
|
+
version = "0.1.0.dev0"
|
|
4
|
+
description = "Select, validate and interpret latent dynamical-systems models of neural population recordings"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [{ name = "Darik A. O'Neil" }]
|
|
9
|
+
requires-python = ">=3.12"
|
|
10
|
+
keywords = [
|
|
11
|
+
"neuroscience",
|
|
12
|
+
"dynamical systems",
|
|
13
|
+
"state-space models",
|
|
14
|
+
"model selection",
|
|
15
|
+
"model validation",
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Programming Language :: Python :: 3.14",
|
|
25
|
+
"Topic :: Scientific/Engineering",
|
|
26
|
+
"Typing :: Typed",
|
|
27
|
+
]
|
|
28
|
+
dependencies = [
|
|
29
|
+
"numpy>=2.1",
|
|
30
|
+
"scipy>=1.14",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Repository = "https://github.com/darikoneil/krikkit"
|
|
35
|
+
|
|
36
|
+
[build-system]
|
|
37
|
+
requires = ["uv_build>=0.9.6,<0.10.0"]
|
|
38
|
+
build-backend = "uv_build"
|
|
39
|
+
|
|
40
|
+
[tool.uv.build-backend]
|
|
41
|
+
# Flat layout: the package directory `krikkit/` sits at the repository root, not under `src/`.
|
|
42
|
+
module-root = ""
|
|
43
|
+
|
|
44
|
+
[tool.pytest.ini_options]
|
|
45
|
+
addopts = [
|
|
46
|
+
"--import-mode=importlib",
|
|
47
|
+
"--color=yes",
|
|
48
|
+
"-p no:cacheprovider",
|
|
49
|
+
]
|
|
50
|
+
testpaths = ["tests"]
|
|
51
|
+
|
|
52
|
+
[tool.coverage.run]
|
|
53
|
+
branch = true
|
|
54
|
+
source = ["krikkit"]
|
|
55
|
+
command_line = "-m pytest"
|
|
56
|
+
|
|
57
|
+
[tool.coverage.report]
|
|
58
|
+
fail_under = 85
|
|
59
|
+
exclude_also = [
|
|
60
|
+
"def __repr__",
|
|
61
|
+
"if __name__ == .__main__.:",
|
|
62
|
+
"if TYPE_CHECKING:",
|
|
63
|
+
"raise NotImplementedError",
|
|
64
|
+
"except ImportError",
|
|
65
|
+
"@(abc\\.)?abstractmethod",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
[tool.ruff]
|
|
69
|
+
extend-exclude = ["docs"]
|
|
70
|
+
line-length = 88
|
|
71
|
+
indent-width = 4
|
|
72
|
+
output-format = "json"
|
|
73
|
+
|
|
74
|
+
[tool.ruff.lint]
|
|
75
|
+
select = ["ALL"]
|
|
76
|
+
ignore = [
|
|
77
|
+
# Whole rule families
|
|
78
|
+
"C90", # mccabe complexity
|
|
79
|
+
"CPY", # copyright notice in every file
|
|
80
|
+
"DJ", # django
|
|
81
|
+
"EXE", # flake8-executable
|
|
82
|
+
"PD", # pandas
|
|
83
|
+
"PL", # pylint
|
|
84
|
+
"T10", # debugger
|
|
85
|
+
"TID", # flake8-tidy-imports
|
|
86
|
+
# Specific rules
|
|
87
|
+
"ANN002", # annotations on *args
|
|
88
|
+
"ANN003", # annotations on **kwargs
|
|
89
|
+
"ANN204", # return annotation on special methods
|
|
90
|
+
"ANN401", # typing.Any
|
|
91
|
+
"COM812", # trailing commas, which the formatter handles
|
|
92
|
+
"COM818", # trailing comma on a bare tuple
|
|
93
|
+
"E203", # whitespace before punctuation, which the formatter handles
|
|
94
|
+
"E501", # line length, which the formatter handles
|
|
95
|
+
"E701", # several statements on one line
|
|
96
|
+
"ERA001", # commented-out code
|
|
97
|
+
"FBT001", # boolean positional argument in a definition
|
|
98
|
+
"FBT002", # boolean default in a definition
|
|
99
|
+
"FBT003", # boolean positional value in a call
|
|
100
|
+
"FIX002", # TODO comments
|
|
101
|
+
"FIX004", # HACK comments
|
|
102
|
+
"ICN001", # import aliases
|
|
103
|
+
"RET503", # explicit return None
|
|
104
|
+
"S101", # assert
|
|
105
|
+
"T201", # print
|
|
106
|
+
"TD002", # TODO author
|
|
107
|
+
"TD003", # TODO issue link
|
|
108
|
+
"TRY003", # long messages in exceptions
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
[tool.ruff.lint.pydocstyle]
|
|
112
|
+
convention = "google"
|
|
113
|
+
|
|
114
|
+
[tool.ruff.format]
|
|
115
|
+
quote-style = "double"
|
|
116
|
+
indent-style = "space"
|
|
117
|
+
skip-magic-trailing-comma = false
|
|
118
|
+
line-ending = "auto"
|
|
119
|
+
docstring-code-format = true
|
|
120
|
+
docstring-code-line-length = "dynamic"
|
|
121
|
+
|
|
122
|
+
[tool.pyrefly]
|
|
123
|
+
project-includes = ["krikkit"]
|
|
124
|
+
|
|
125
|
+
[dependency-groups]
|
|
126
|
+
dev = [
|
|
127
|
+
"coverage[toml]>=7.18.0",
|
|
128
|
+
"pyrefly>=1.5.1",
|
|
129
|
+
"pytest>=9.2.0",
|
|
130
|
+
"ruff>=0.17.6",
|
|
131
|
+
]
|