autodynamics 0.1.0a0__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.
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,183 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+
176
+ # Cursor
177
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
178
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data.
179
+ # refer to https://docs.cursor.com/context/ignore-files
180
+ .cursor/
181
+ .cursorignore
182
+ .cursorindexingignore
183
+ *.canvas.tsx
@@ -0,0 +1,33 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0a0] — 2026-05-05
9
+
10
+ ### Added
11
+
12
+ - Initial pre-alpha release.
13
+ - `ProfileTrajectory`: a recording substrate that stores a sequence of
14
+ `autonometrics.AutonomyProfile` values, exposes axis-wise time series,
15
+ computes pairwise consecutive deltas, and sums the resulting magnitudes
16
+ into a total path length in profile space.
17
+ - `ProfileSnapshot`: a frozen dataclass for a single profile measurement.
18
+ - `ProfileDelta`: a frozen dataclass for the difference between two
19
+ consecutive snapshots, with a Euclidean magnitude over its defined axes.
20
+ - CLI entry point `autodynamics-demo` (`python -m autodynamics.demo`).
21
+ - Runtime dependency on `autonometrics>=0.9.0a0`.
22
+ - Reserves the `autodynamics` name on PyPI.
23
+ - Declares the project's scope as Layer 2 of the
24
+ Autonometrics -> Autodynamics -> Ex-Machina trilogy.
25
+ - Apache License 2.0.
26
+
27
+ ### Notes
28
+
29
+ - `ProfileTrajectory` is a *recording substrate*, not a theory of
30
+ autonomy dynamics. Disclaimer in README applies.
31
+ - Public API in this release is the trio
32
+ (`ProfileTrajectory`, `ProfileSnapshot`, `ProfileDelta`). Anything
33
+ else is internal and may change without notice.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: autodynamics
3
+ Version: 0.1.0a0
4
+ Summary: Modelling autonomy dynamics over the Autonometrics atlas. Ships ProfileTrajectory: a recording substrate for sequences of autonomy profiles. Layer 2 of the Autonometrics -> Autodynamics -> Ex-Machina trilogy.
5
+ Project-URL: Homepage, https://github.com/bugerchip/Autodynamics
6
+ Project-URL: Repository, https://github.com/bugerchip/Autodynamics
7
+ Project-URL: Issues, https://github.com/bugerchip/Autodynamics/issues
8
+ Author: bugerchip
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: autonometrics,autonomy,complex-systems,dynamics,self-determination,trajectories
12
+ Classifier: Development Status :: 2 - Pre-Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: autonometrics>=0.9.0a0
23
+ Requires-Dist: numpy>=1.24
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7; extra == 'dev'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # Autodynamics
29
+
30
+ > **Layer 2 of 3** in the autonomy research trilogy:
31
+ > [Autonometrics](https://github.com/bugerchip/Autonometrics) (measure) -> **Autodynamics** (explain) -> [Ex-Machina](https://github.com/bugerchip/Ex-Machina) (build / emulate)
32
+
33
+ **Status:** Pre-alpha. Ships a recording substrate; no stable theoretical model yet.
34
+
35
+ ## Vision
36
+
37
+ `Autonometrics` quantifies *where* a system sits on the five autonomy axes (closure, memory, constraint closure, persistence, coherence). `Autodynamics` aims to model *how* systems move across that atlas: trajectories, attractors, transitions, and the dynamical regularities that govern changes in autonomy.
38
+
39
+ This package will eventually expose:
40
+
41
+ - Trajectory analysis tools over `AutonomyProfile` time series.
42
+ - Phase-space modelling for systems described by the `AutonomySystem` protocol.
43
+ - Stability and attractor characterisation across the five-axis atlas.
44
+ - Hooks for empirical validation against longitudinal data from biology, AI, and motivational psychology corpora.
45
+
46
+ ## What this package contains today
47
+
48
+ A minimal recording substrate: `ProfileTrajectory`. A class that:
49
+
50
+ 1. Stores a sequence of `AutonomyProfile` values measured at successive moments.
51
+ 2. Exposes axis-wise time series for any of the five canonical axes.
52
+ 3. Computes pairwise consecutive deltas.
53
+ 4. Sums the resulting magnitudes into a total path length in profile space.
54
+
55
+ It is the smallest piece of code that lets you treat **a sequence of autonomy measurements as a trajectory in a metric space** — the precondition for any later dynamical analysis.
56
+
57
+ > **Install with:** `pip install autodynamics`
58
+ > **Import as:** `import autodynamics`
59
+
60
+ ### Quick run
61
+
62
+ ```bash
63
+ pip install autodynamics
64
+ autodynamics-demo --n-states-list 3 4 5 6 8 --n-steps 600
65
+ ```
66
+
67
+ You will see a small table of `(closure, memory)` profiles measured over a sweep of `SimpleAutomaton` configurations, the consecutive deltas between them, and the total path length.
68
+
69
+ ## Toy demo: `ProfileTrajectory`
70
+
71
+ > **Disclaimer.** This is the *recording substrate* of Autodynamics, not its theory. The trajectory class lets you collect, traverse, and compute simple geometric quantities over a sequence of `AutonomyProfile`s. **It does not interpret what those movements mean** — that interpretation is the open research question this package will eventually try to answer. Treat the code as a useful template, not as evidence.
72
+
73
+ ```python
74
+ import autonometrics as anm
75
+ from autodynamics import ProfileTrajectory
76
+
77
+ trajectory = ProfileTrajectory(axes=("closure", "memory"))
78
+
79
+ for n_states in [3, 4, 5, 6, 8]:
80
+ sys = anm.SimpleAutomaton.demo(n_states=n_states, n_steps=600)
81
+ sys.run()
82
+ profile = anm.measure(sys, axes=["closure", "memory"])
83
+ trajectory.append(profile)
84
+
85
+ print(trajectory.axis_series("closure")) # time series of one axis
86
+ print(trajectory.deltas()) # pairwise consecutive movements
87
+ print(trajectory.total_path_length()) # sum of delta magnitudes
88
+ ```
89
+
90
+ ## Roadmap
91
+
92
+ - `v0.1.0a0` *(current)*: Toy trajectory recorder. Reserves name, declares vision, ships demo.
93
+ - `v0.2.x`: First serious dynamics primitives (attractor characterisation, regime classification). Lands after Autonometrics reaches v1.0.
94
+ - `v1.0.0`: Stable trajectory API on top of Autonometrics profiles.
95
+
96
+ ## Position in the trilogy
97
+
98
+ | Layer | Project | Question it answers |
99
+ |---|---|---|
100
+ | 1 | [Autonometrics](https://github.com/bugerchip/Autonometrics) | *Where* does a system sit on the autonomy atlas? |
101
+ | 2 | **Autodynamics** | *How* does it move across the atlas over time? |
102
+ | 3 | [Ex-Machina](https://github.com/bugerchip/Ex-Machina) | *Can we build* a system that occupies a chosen region? |
103
+
104
+ ## License
105
+
106
+ Apache License 2.0 — see [LICENSE](LICENSE).
107
+
108
+ ## Citation
109
+
110
+ If you reference this work, please cite the trilogy as a whole. A formal citation block will be added in `v0.2.x`.
@@ -0,0 +1,83 @@
1
+ # Autodynamics
2
+
3
+ > **Layer 2 of 3** in the autonomy research trilogy:
4
+ > [Autonometrics](https://github.com/bugerchip/Autonometrics) (measure) -> **Autodynamics** (explain) -> [Ex-Machina](https://github.com/bugerchip/Ex-Machina) (build / emulate)
5
+
6
+ **Status:** Pre-alpha. Ships a recording substrate; no stable theoretical model yet.
7
+
8
+ ## Vision
9
+
10
+ `Autonometrics` quantifies *where* a system sits on the five autonomy axes (closure, memory, constraint closure, persistence, coherence). `Autodynamics` aims to model *how* systems move across that atlas: trajectories, attractors, transitions, and the dynamical regularities that govern changes in autonomy.
11
+
12
+ This package will eventually expose:
13
+
14
+ - Trajectory analysis tools over `AutonomyProfile` time series.
15
+ - Phase-space modelling for systems described by the `AutonomySystem` protocol.
16
+ - Stability and attractor characterisation across the five-axis atlas.
17
+ - Hooks for empirical validation against longitudinal data from biology, AI, and motivational psychology corpora.
18
+
19
+ ## What this package contains today
20
+
21
+ A minimal recording substrate: `ProfileTrajectory`. A class that:
22
+
23
+ 1. Stores a sequence of `AutonomyProfile` values measured at successive moments.
24
+ 2. Exposes axis-wise time series for any of the five canonical axes.
25
+ 3. Computes pairwise consecutive deltas.
26
+ 4. Sums the resulting magnitudes into a total path length in profile space.
27
+
28
+ It is the smallest piece of code that lets you treat **a sequence of autonomy measurements as a trajectory in a metric space** — the precondition for any later dynamical analysis.
29
+
30
+ > **Install with:** `pip install autodynamics`
31
+ > **Import as:** `import autodynamics`
32
+
33
+ ### Quick run
34
+
35
+ ```bash
36
+ pip install autodynamics
37
+ autodynamics-demo --n-states-list 3 4 5 6 8 --n-steps 600
38
+ ```
39
+
40
+ You will see a small table of `(closure, memory)` profiles measured over a sweep of `SimpleAutomaton` configurations, the consecutive deltas between them, and the total path length.
41
+
42
+ ## Toy demo: `ProfileTrajectory`
43
+
44
+ > **Disclaimer.** This is the *recording substrate* of Autodynamics, not its theory. The trajectory class lets you collect, traverse, and compute simple geometric quantities over a sequence of `AutonomyProfile`s. **It does not interpret what those movements mean** — that interpretation is the open research question this package will eventually try to answer. Treat the code as a useful template, not as evidence.
45
+
46
+ ```python
47
+ import autonometrics as anm
48
+ from autodynamics import ProfileTrajectory
49
+
50
+ trajectory = ProfileTrajectory(axes=("closure", "memory"))
51
+
52
+ for n_states in [3, 4, 5, 6, 8]:
53
+ sys = anm.SimpleAutomaton.demo(n_states=n_states, n_steps=600)
54
+ sys.run()
55
+ profile = anm.measure(sys, axes=["closure", "memory"])
56
+ trajectory.append(profile)
57
+
58
+ print(trajectory.axis_series("closure")) # time series of one axis
59
+ print(trajectory.deltas()) # pairwise consecutive movements
60
+ print(trajectory.total_path_length()) # sum of delta magnitudes
61
+ ```
62
+
63
+ ## Roadmap
64
+
65
+ - `v0.1.0a0` *(current)*: Toy trajectory recorder. Reserves name, declares vision, ships demo.
66
+ - `v0.2.x`: First serious dynamics primitives (attractor characterisation, regime classification). Lands after Autonometrics reaches v1.0.
67
+ - `v1.0.0`: Stable trajectory API on top of Autonometrics profiles.
68
+
69
+ ## Position in the trilogy
70
+
71
+ | Layer | Project | Question it answers |
72
+ |---|---|---|
73
+ | 1 | [Autonometrics](https://github.com/bugerchip/Autonometrics) | *Where* does a system sit on the autonomy atlas? |
74
+ | 2 | **Autodynamics** | *How* does it move across the atlas over time? |
75
+ | 3 | [Ex-Machina](https://github.com/bugerchip/Ex-Machina) | *Can we build* a system that occupies a chosen region? |
76
+
77
+ ## License
78
+
79
+ Apache License 2.0 — see [LICENSE](LICENSE).
80
+
81
+ ## Citation
82
+
83
+ If you reference this work, please cite the trilogy as a whole. A formal citation block will be added in `v0.2.x`.
@@ -0,0 +1,53 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "autodynamics"
7
+ version = "0.1.0a0"
8
+ description = "Modelling autonomy dynamics over the Autonometrics atlas. Ships ProfileTrajectory: a recording substrate for sequences of autonomy profiles. Layer 2 of the Autonometrics -> Autodynamics -> Ex-Machina trilogy."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "Apache-2.0"
12
+ authors = [{ name = "bugerchip" }]
13
+ keywords = [
14
+ "autonomy",
15
+ "dynamics",
16
+ "complex-systems",
17
+ "self-determination",
18
+ "autonometrics",
19
+ "trajectories",
20
+ ]
21
+ classifiers = [
22
+ "Development Status :: 2 - Pre-Alpha",
23
+ "License :: OSI Approved :: Apache Software License",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3.10",
26
+ "Programming Language :: Python :: 3.11",
27
+ "Programming Language :: Python :: 3.12",
28
+ "Topic :: Scientific/Engineering",
29
+ "Intended Audience :: Science/Research",
30
+ "Operating System :: OS Independent",
31
+ ]
32
+ dependencies = [
33
+ "autonometrics>=0.9.0a0",
34
+ "numpy>=1.24",
35
+ ]
36
+
37
+ [project.optional-dependencies]
38
+ dev = ["pytest>=7"]
39
+
40
+ [project.urls]
41
+ Homepage = "https://github.com/bugerchip/Autodynamics"
42
+ Repository = "https://github.com/bugerchip/Autodynamics"
43
+ Issues = "https://github.com/bugerchip/Autodynamics/issues"
44
+
45
+ [project.scripts]
46
+ autodynamics-demo = "autodynamics.demo:main"
47
+
48
+ [tool.hatch.build.targets.wheel]
49
+ packages = ["src/autodynamics"]
50
+
51
+ [tool.pytest.ini_options]
52
+ testpaths = ["tests"]
53
+ addopts = "-v"
@@ -0,0 +1,34 @@
1
+ """Autodynamics: modelling autonomy dynamics over the Autonometrics atlas.
2
+
3
+ Layer 2 of the Autonometrics -> Autodynamics -> Ex-Machina trilogy.
4
+
5
+ Public API in v0.1.0a0:
6
+
7
+ - :class:`ProfileTrajectory` — a time series of autonomy profiles, with
8
+ utilities to read axis-wise series, compute pairwise consecutive
9
+ deltas, and sum the resulting path length in profile space.
10
+ - :class:`ProfileSnapshot` — a single recorded measurement.
11
+ - :class:`ProfileDelta` — the pairwise difference between two snapshots
12
+ with a Euclidean magnitude over its defined axes.
13
+
14
+ This is the *recording substrate* of Autodynamics, not its theory. The
15
+ trajectory class lets you collect, traverse, and compute simple
16
+ geometric quantities over a sequence of AutonomyProfile values. It does
17
+ not interpret what those movements mean — that interpretation is the
18
+ open research question this package will eventually try to answer.
19
+ """
20
+
21
+ from autodynamics.trajectory import (
22
+ ProfileDelta,
23
+ ProfileSnapshot,
24
+ ProfileTrajectory,
25
+ )
26
+
27
+ __version__ = "0.1.0a0"
28
+
29
+ __all__ = [
30
+ "ProfileDelta",
31
+ "ProfileSnapshot",
32
+ "ProfileTrajectory",
33
+ "__version__",
34
+ ]
@@ -0,0 +1,90 @@
1
+ """Command-line entry point for the toy trajectory recorder demo.
2
+
3
+ Run via ``autodynamics-demo`` (after ``pip install autodynamics``) or
4
+ ``python -m autodynamics.demo``.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import argparse
10
+
11
+ import autonometrics as anm
12
+
13
+ from autodynamics.trajectory import ProfileTrajectory
14
+
15
+
16
+ def main() -> None:
17
+ """Build a trajectory of profiles across a sweep of ``n_states`` and print it."""
18
+ parser = argparse.ArgumentParser(
19
+ prog="autodynamics-demo",
20
+ description=(
21
+ "Record a trajectory of autonomy profiles across a sweep of "
22
+ "SimpleAutomaton configurations and print the resulting "
23
+ "axis time series, deltas, and total path length."
24
+ ),
25
+ )
26
+ parser.add_argument(
27
+ "--n-states-list",
28
+ type=int,
29
+ nargs="+",
30
+ default=[3, 4, 5, 6, 8],
31
+ help="state alphabet sizes to sweep",
32
+ )
33
+ parser.add_argument(
34
+ "--n-steps",
35
+ type=int,
36
+ default=600,
37
+ help="trajectory length per system",
38
+ )
39
+ parser.add_argument("--seed", type=int, default=0, help="RNG seed")
40
+ args = parser.parse_args()
41
+
42
+ trajectory = ProfileTrajectory(axes=("closure", "memory"))
43
+
44
+ print(
45
+ f"Sweeping n_states in {args.n_states_list} with n_steps={args.n_steps}, "
46
+ f"seed={args.seed}\n"
47
+ )
48
+
49
+ for n_states in args.n_states_list:
50
+ sys = anm.SimpleAutomaton.demo(
51
+ n_states=n_states,
52
+ n_steps=args.n_steps,
53
+ seed=args.seed,
54
+ )
55
+ sys.run()
56
+ profile = anm.measure(sys, axes=["closure", "memory"])
57
+ trajectory.append(profile)
58
+
59
+ header = f"{'idx':>4} | {'n_states':>8} | {'closure':>10} | {'memory':>10}"
60
+ print(header)
61
+ print("-" * len(header))
62
+ for snapshot, n_states in zip(trajectory, args.n_states_list, strict=True):
63
+ cl = snapshot.profile.closure
64
+ me = snapshot.profile.memory
65
+ cl_s = f"{cl:.4f}" if cl is not None else " None"
66
+ me_s = f"{me:.4f}" if me is not None else " None"
67
+ print(
68
+ f"{snapshot.index:>4} | {n_states:>8} | "
69
+ f"{cl_s:>10} | {me_s:>10}"
70
+ )
71
+
72
+ print()
73
+ print(f"Number of snapshots: {len(trajectory)}")
74
+ deltas = trajectory.deltas()
75
+ print(f"Number of deltas: {len(deltas)}")
76
+ for delta in deltas:
77
+ mag = delta.magnitude
78
+ mag_s = f"{mag:.4f}" if mag is not None else " None"
79
+ print(
80
+ f" delta {delta.from_index}->{delta.to_index}: "
81
+ f"magnitude={mag_s}"
82
+ )
83
+
84
+ total = trajectory.total_path_length()
85
+ total_s = f"{total:.4f}" if total is not None else "None"
86
+ print(f"\nTotal path length: {total_s}")
87
+
88
+
89
+ if __name__ == "__main__":
90
+ main()
@@ -0,0 +1,227 @@
1
+ """Trajectory recorder for autonomy profiles.
2
+
3
+ This module ships the smallest piece of code that lets a caller treat a
4
+ sequence of :class:`autonometrics.AutonomyProfile` values as a
5
+ trajectory in a metric space: store the sequence, read it axis by axis,
6
+ compute pairwise consecutive deltas, and sum the resulting magnitudes
7
+ into a total path length.
8
+
9
+ The class is the *recording substrate* of Autodynamics; it does not
10
+ interpret what the recorded movements mean. That interpretation is the
11
+ open research question this package will eventually try to answer.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import math
17
+ from collections.abc import Iterable, Iterator
18
+ from dataclasses import dataclass
19
+
20
+ from autonometrics import AutonomyProfile
21
+
22
+ _CANONICAL_AXES: tuple[str, ...] = (
23
+ "closure",
24
+ "memory",
25
+ "constraint",
26
+ "persistence",
27
+ "coherence",
28
+ )
29
+
30
+
31
+ @dataclass(frozen=True)
32
+ class ProfileSnapshot:
33
+ """A single :class:`autonometrics.AutonomyProfile` recorded at an index.
34
+
35
+ Attributes
36
+ ----------
37
+ index:
38
+ Position of this snapshot in the parent
39
+ :class:`ProfileTrajectory` (0-based).
40
+ profile:
41
+ The autonomy profile measured at this point.
42
+ """
43
+
44
+ index: int
45
+ profile: AutonomyProfile
46
+
47
+
48
+ @dataclass(frozen=True)
49
+ class ProfileDelta:
50
+ """Pairwise difference between two consecutive snapshots, axis by axis.
51
+
52
+ The ``deltas`` mapping has one entry per canonical axis tracked by
53
+ the parent :class:`ProfileTrajectory`. Each value is:
54
+
55
+ - ``current_value - previous_value`` if both endpoints have the axis
56
+ defined, or
57
+ - ``None`` if either endpoint reports ``None`` for the axis (mosaic
58
+ dropout policy inherited from Autonometrics).
59
+
60
+ Attributes
61
+ ----------
62
+ from_index:
63
+ Index of the earlier snapshot.
64
+ to_index:
65
+ Index of the later snapshot.
66
+ deltas:
67
+ Mapping ``{canonical_axis: float | None}``.
68
+ """
69
+
70
+ from_index: int
71
+ to_index: int
72
+ deltas: dict[str, float | None]
73
+
74
+ @property
75
+ def magnitude(self) -> float | None:
76
+ """Euclidean magnitude over the fully-defined axes only.
77
+
78
+ Returns ``None`` if every axis in ``deltas`` is ``None``.
79
+ Otherwise returns the Euclidean norm computed over the defined
80
+ deltas, ignoring the ``None`` entries.
81
+ """
82
+ defined = [v for v in self.deltas.values() if v is not None]
83
+ if not defined:
84
+ return None
85
+ return float(math.sqrt(sum(v * v for v in defined)))
86
+
87
+
88
+ class ProfileTrajectory:
89
+ """Time series of autonomy profiles over the same or comparable systems.
90
+
91
+ Stores :class:`ProfileSnapshot` values in append order and exposes
92
+ utilities for reading them as time series, computing pairwise
93
+ consecutive deltas, and summing path length.
94
+
95
+ The class does not interpret what the recorded movements mean — that
96
+ is the open research question this package will eventually try to
97
+ answer. Use it as a recording substrate, not as evidence.
98
+
99
+ Parameters
100
+ ----------
101
+ axes:
102
+ Iterable of canonical axis names this trajectory will report on.
103
+ Defaults to all five canonical axes when ``None``. Profiles
104
+ appended to the trajectory may carry data on other axes; the
105
+ ``axes`` argument only bounds which axes are reported by
106
+ :meth:`axis_series`, :meth:`deltas`, and :meth:`to_dict`.
107
+
108
+ Raises
109
+ ------
110
+ ValueError
111
+ If ``axes`` is a non-``None`` iterable that is empty, contains a
112
+ name not in the canonical set, or contains duplicates.
113
+ """
114
+
115
+ def __init__(self, axes: Iterable[str] | None = None) -> None:
116
+ if axes is None:
117
+ self._axes: tuple[str, ...] = _CANONICAL_AXES
118
+ else:
119
+ seen: set[str] = set()
120
+ normalised: list[str] = []
121
+ for axis in axes:
122
+ if axis not in _CANONICAL_AXES:
123
+ raise ValueError(
124
+ f"Unknown axis {axis!r}. Canonical axes: {_CANONICAL_AXES}"
125
+ )
126
+ if axis in seen:
127
+ raise ValueError(f"Duplicate axis {axis!r} in axes argument")
128
+ seen.add(axis)
129
+ normalised.append(axis)
130
+ if not normalised:
131
+ raise ValueError("axes must contain at least one entry when provided")
132
+ self._axes = tuple(normalised)
133
+ self._snapshots: list[ProfileSnapshot] = []
134
+
135
+ # ------------------------------------------------------------------
136
+ # Sequence-like access
137
+ # ------------------------------------------------------------------
138
+
139
+ def append(self, profile: AutonomyProfile) -> ProfileSnapshot:
140
+ """Append a profile to the trajectory and return its snapshot.
141
+
142
+ The new snapshot's ``index`` is ``len(self)`` *before* the
143
+ append.
144
+ """
145
+ snapshot = ProfileSnapshot(index=len(self._snapshots), profile=profile)
146
+ self._snapshots.append(snapshot)
147
+ return snapshot
148
+
149
+ def __len__(self) -> int:
150
+ return len(self._snapshots)
151
+
152
+ def __getitem__(self, i: int) -> ProfileSnapshot:
153
+ return self._snapshots[i]
154
+
155
+ def __iter__(self) -> Iterator[ProfileSnapshot]:
156
+ return iter(self._snapshots)
157
+
158
+ # ------------------------------------------------------------------
159
+ # Reading the trajectory
160
+ # ------------------------------------------------------------------
161
+
162
+ @property
163
+ def axes(self) -> tuple[str, ...]:
164
+ """Canonical axes this trajectory reports on."""
165
+ return self._axes
166
+
167
+ def axis_series(self, axis: str) -> list[float | None]:
168
+ """Return the time series of a single canonical axis.
169
+
170
+ Each entry is the value of the named axis at the corresponding
171
+ snapshot, or ``None`` if that snapshot reports ``None`` for the
172
+ axis (mosaic dropout).
173
+ """
174
+ if axis not in _CANONICAL_AXES:
175
+ raise ValueError(
176
+ f"Unknown axis {axis!r}. Canonical axes: {_CANONICAL_AXES}"
177
+ )
178
+ return [s.profile[axis] for s in self._snapshots]
179
+
180
+ def deltas(self) -> list[ProfileDelta]:
181
+ """Pairwise consecutive deltas across the configured ``axes``.
182
+
183
+ Returns a list of length ``max(len(self) - 1, 0)``. Empty list
184
+ if fewer than two snapshots have been appended.
185
+ """
186
+ result: list[ProfileDelta] = []
187
+ for i in range(1, len(self._snapshots)):
188
+ prev = self._snapshots[i - 1].profile
189
+ curr = self._snapshots[i].profile
190
+ entries: dict[str, float | None] = {}
191
+ for axis in self._axes:
192
+ pv = prev[axis]
193
+ cv = curr[axis]
194
+ entries[axis] = (
195
+ (cv - pv)
196
+ if (pv is not None and cv is not None)
197
+ else None
198
+ )
199
+ result.append(
200
+ ProfileDelta(from_index=i - 1, to_index=i, deltas=entries)
201
+ )
202
+ return result
203
+
204
+ def total_path_length(self) -> float | None:
205
+ """Sum of consecutive delta magnitudes along the trajectory.
206
+
207
+ Returns ``None`` if the trajectory has fewer than two snapshots
208
+ or if every consecutive delta has no fully-defined axis. Deltas
209
+ whose ``magnitude`` is ``None`` are skipped, never aborting the
210
+ sum.
211
+ """
212
+ deltas = self.deltas()
213
+ if not deltas:
214
+ return None
215
+ magnitudes = [d.magnitude for d in deltas if d.magnitude is not None]
216
+ if not magnitudes:
217
+ return None
218
+ return float(sum(magnitudes))
219
+
220
+ def to_dict(self) -> dict[str, list[float | None]]:
221
+ """Serialise the trajectory to a dictionary of axis-wise series.
222
+
223
+ Output shape: ``{axis_name: [value_or_None_per_snapshot, ...]}``.
224
+ Stable for JSON serialisation (every value is ``float`` or
225
+ ``None``).
226
+ """
227
+ return {axis: self.axis_series(axis) for axis in self._axes}
@@ -0,0 +1,17 @@
1
+ """Smoke tests for the autodynamics package."""
2
+
3
+ import autodynamics
4
+
5
+
6
+ def test_version_is_pinned() -> None:
7
+ assert autodynamics.__version__ == "0.1.0a0"
8
+
9
+
10
+ def test_package_imports() -> None:
11
+ import autodynamics # noqa: F401
12
+
13
+
14
+ def test_public_api_is_exposed() -> None:
15
+ assert hasattr(autodynamics, "ProfileTrajectory")
16
+ assert hasattr(autodynamics, "ProfileSnapshot")
17
+ assert hasattr(autodynamics, "ProfileDelta")
@@ -0,0 +1,164 @@
1
+ """Behavioural tests for ProfileTrajectory and its companions."""
2
+
3
+ import pytest
4
+ from autonometrics import AutonomyProfile
5
+
6
+ from autodynamics import ProfileDelta, ProfileSnapshot, ProfileTrajectory
7
+
8
+
9
+ def _make_profile(
10
+ closure: float | None = None,
11
+ memory: float | None = None,
12
+ coherence: float | None = None,
13
+ ) -> AutonomyProfile:
14
+ return AutonomyProfile(
15
+ ratio_endo_total=closure,
16
+ memory_endo_ratio=memory,
17
+ cba_theil_u=coherence,
18
+ )
19
+
20
+
21
+ def test_empty_trajectory_has_zero_length() -> None:
22
+ traj = ProfileTrajectory()
23
+ assert len(traj) == 0
24
+ assert list(traj) == []
25
+
26
+
27
+ def test_append_returns_snapshot() -> None:
28
+ traj = ProfileTrajectory()
29
+ profile = _make_profile(closure=0.5, memory=0.4)
30
+ snapshot = traj.append(profile)
31
+ assert isinstance(snapshot, ProfileSnapshot)
32
+ assert snapshot.index == 0
33
+ assert snapshot.profile is profile
34
+
35
+
36
+ def test_append_increments_index() -> None:
37
+ traj = ProfileTrajectory()
38
+ s0 = traj.append(_make_profile(closure=0.1))
39
+ s1 = traj.append(_make_profile(closure=0.2))
40
+ s2 = traj.append(_make_profile(closure=0.3))
41
+ assert (s0.index, s1.index, s2.index) == (0, 1, 2)
42
+ assert len(traj) == 3
43
+
44
+
45
+ def test_getitem_returns_snapshot() -> None:
46
+ traj = ProfileTrajectory()
47
+ traj.append(_make_profile(closure=0.5))
48
+ snap = traj[0]
49
+ assert snap.index == 0
50
+ assert snap.profile.closure == 0.5
51
+
52
+
53
+ def test_iteration_yields_snapshots_in_order() -> None:
54
+ traj = ProfileTrajectory()
55
+ for v in (0.1, 0.2, 0.3):
56
+ traj.append(_make_profile(closure=v))
57
+ indices = [s.index for s in traj]
58
+ closures = [s.profile.closure for s in traj]
59
+ assert indices == [0, 1, 2]
60
+ assert closures == [0.1, 0.2, 0.3]
61
+
62
+
63
+ def test_axis_series_returns_values_and_nones() -> None:
64
+ traj = ProfileTrajectory()
65
+ traj.append(_make_profile(closure=0.5, memory=None))
66
+ traj.append(_make_profile(closure=0.6, memory=0.4))
67
+ assert traj.axis_series("closure") == [0.5, 0.6]
68
+ assert traj.axis_series("memory") == [None, 0.4]
69
+
70
+
71
+ def test_axis_series_rejects_unknown_axis() -> None:
72
+ traj = ProfileTrajectory()
73
+ with pytest.raises(ValueError):
74
+ traj.axis_series("nonsense")
75
+
76
+
77
+ def test_deltas_returns_consecutive_pairs() -> None:
78
+ traj = ProfileTrajectory(axes=("closure",))
79
+ traj.append(_make_profile(closure=0.1))
80
+ traj.append(_make_profile(closure=0.4))
81
+ traj.append(_make_profile(closure=0.6))
82
+ deltas = traj.deltas()
83
+ assert len(deltas) == 2
84
+ assert deltas[0].from_index == 0 and deltas[0].to_index == 1
85
+ assert deltas[0].deltas["closure"] == pytest.approx(0.3)
86
+ assert deltas[1].from_index == 1 and deltas[1].to_index == 2
87
+ assert deltas[1].deltas["closure"] == pytest.approx(0.2)
88
+
89
+
90
+ def test_deltas_yield_none_when_endpoint_is_none() -> None:
91
+ traj = ProfileTrajectory(axes=("closure", "memory"))
92
+ traj.append(_make_profile(closure=0.5, memory=None))
93
+ traj.append(_make_profile(closure=0.6, memory=0.4))
94
+ deltas = traj.deltas()
95
+ assert deltas[0].deltas["closure"] == pytest.approx(0.1)
96
+ assert deltas[0].deltas["memory"] is None
97
+
98
+
99
+ def test_delta_magnitude_uses_only_defined_axes() -> None:
100
+ delta = ProfileDelta(
101
+ from_index=0,
102
+ to_index=1,
103
+ deltas={"closure": 0.3, "memory": 0.4, "coherence": None},
104
+ )
105
+ assert delta.magnitude == pytest.approx(0.5)
106
+
107
+
108
+ def test_delta_magnitude_returns_none_when_all_axes_none() -> None:
109
+ delta = ProfileDelta(
110
+ from_index=0,
111
+ to_index=1,
112
+ deltas={"closure": None, "memory": None},
113
+ )
114
+ assert delta.magnitude is None
115
+
116
+
117
+ def test_empty_trajectory_path_length_is_none() -> None:
118
+ traj = ProfileTrajectory()
119
+ assert traj.total_path_length() is None
120
+
121
+
122
+ def test_single_snapshot_path_length_is_none() -> None:
123
+ traj = ProfileTrajectory()
124
+ traj.append(_make_profile(closure=0.5))
125
+ assert traj.total_path_length() is None
126
+
127
+
128
+ def test_total_path_length_sums_magnitudes() -> None:
129
+ traj = ProfileTrajectory(axes=("closure",))
130
+ traj.append(_make_profile(closure=0.0))
131
+ traj.append(_make_profile(closure=0.3))
132
+ traj.append(_make_profile(closure=0.7))
133
+ # |0.3 - 0.0| + |0.7 - 0.3| = 0.3 + 0.4 = 0.7
134
+ assert traj.total_path_length() == pytest.approx(0.7)
135
+
136
+
137
+ def test_to_dict_returns_axis_series_per_axis() -> None:
138
+ traj = ProfileTrajectory(axes=("closure", "memory"))
139
+ traj.append(_make_profile(closure=0.5, memory=0.4))
140
+ traj.append(_make_profile(closure=0.6, memory=None))
141
+ result = traj.to_dict()
142
+ assert set(result.keys()) == {"closure", "memory"}
143
+ assert result["closure"] == [0.5, 0.6]
144
+ assert result["memory"] == [0.4, None]
145
+
146
+
147
+ def test_init_rejects_unknown_axis() -> None:
148
+ with pytest.raises(ValueError):
149
+ ProfileTrajectory(axes=("closure", "nonsense"))
150
+
151
+
152
+ def test_init_rejects_duplicate_axes() -> None:
153
+ with pytest.raises(ValueError):
154
+ ProfileTrajectory(axes=("closure", "closure"))
155
+
156
+
157
+ def test_init_rejects_empty_axes_when_provided() -> None:
158
+ with pytest.raises(ValueError):
159
+ ProfileTrajectory(axes=[])
160
+
161
+
162
+ def test_default_axes_cover_all_five_canonical() -> None:
163
+ traj = ProfileTrajectory()
164
+ assert traj.axes == ("closure", "memory", "constraint", "persistence", "coherence")