Commit 0ba0fe7
authored
♻️ refactor: chart(manifold) (#517)
♻️ refactor: consolidate charts, internal, manifolds
✨ feat(manifolds): introduce AbstractTopologicalManifold and NoManifold
✨ feat(charts): add manifold field to AbstractChart
♻️ refactor(manifolds): move eligible charts to module-level WeakSet
🐛 fix: resolve dataclass field ordering and chart strategy bugs from manifold field
♻️ refactor(manifolds): consolidate custom_types into _src/custom_types
♻️ refactor(manifolds): use internal imports instead of public coordinax.charts
♻️ refactor: promote exceptions.py from _src/charts/ to _src/
♻️ refactor: consolidate product subpackage under _src/product/
♻️ refactor: merge AbstractDiagonalMetric into base_metric and promote euclidean/ to _src/
♻️ refactor: consolidate spherical charts and promote spherical/ to _src/
♻️ refactor: promote embedded/ subpackage from manifolds/ to _src/
♻️ refactor: promote minkowski/ subpackage from manifolds/ to _src/
♻️ refactor: promote custom/ subpackage from manifolds/ to _src/
♻️ refactor(internal): drop leading underscore from internal module filenames
✨ feat(euclidean): add Rn alias and __pdoc__ to EuclideanManifold
♻️ refactor(charts): rename AbstractChart.manifold field to M
🧱 infra(_src): add empty __init__.py
✨ feat(manifolds): add `Sn` alias and `__pdoc__` to `HyperSphericalManifold`
✨ feat(charts/manifolds): charts now carry sensible default manifolds
♻️ refactor: rename `manifold` attribute/param to `M` throughout
✨ feat(charts): register 1D chart with EuclideanAtlas
♻️ refactor(manifolds): simplify scale_factors to chart-only signature
♻️ refactor(manifolds): simplify angle_between to chart-only signature
🩹 fix-simple(charts): rename fixed_kwargs to fixed_kw and reformat long lines
♻️ refactor(vectors): derive M from chart instead of storing it as a field
♻️ refactor(manifolds): consolidate no_manifold into separate module
♻️ refactor(base): move chart imports to TYPE_CHECKING blocks
🏷️ types(ty): ignores
♻️ refactor(manifolds): consolidate AbstractTopologicalManifold into AbstractManifold
✨ feat(manifolds): consolidate null manifold objects into dedicated module
♻️ refactor: consolidate base classes into dedicated base/ module
✨ feat(embedded): add M property to EmbeddedChart
🐛 fix(hypothesis): exclude EmbeddedChart from vector strategy
♻️ refactor(charts): clean up decorators and type annotations
♻️ refactor(hypothesis): simplify vectors dispatch
## Summary of Changes
### **Architecture & Module Organization**
- Consolidated charts, internal, and manifolds into cohesive structure
- Promoted subpackages from `manifolds/` to top-level `_src/`: euclidean, spherical, embedded, minkowski, custom, product
- Consolidated product files (charts, manifolds, spacetime) into unified `_src/product/`
- Moved base classes (atlas, charts, manifold, metric) into dedicated `_src/base/` subdirectory
- Elevated `exceptions.py` from `_src/charts/` to `_src/` for shared access
- Eliminated `manifolds/custom_types.py` by redirecting imports to canonical `coordinax._src.custom_types`
### **Core API Changes**
- **Manifold field on charts**: Added optional `manifold` field (later renamed to `M`) to `AbstractChart`, linking each chart to its topological manifold
- **Manifold hierarchy simplification**: Merged separate `AbstractTopologicalManifold` into main `AbstractManifold` class
- **Null objects consolidation**: Created dedicated `coordinax._src.null` module for `NoManifold`, `NoAtlas`, and new `NoMetric` sentinel
- **Vector refactoring**: Removed redundant `M` field from `Point` and `AbstractVector`; now derived as computed property from chart
### **Defaults & Aliases**
- Charts now carry sensible default manifolds (Cartesian charts → `Rn(n)`, spherical → `Sn(n)`)
- Added `Rn` alias for `EuclideanManifold` with `__pdoc__` pretty-printing
- Added `Sn` alias for `HyperSphericalManifold` with `__pdoc__` pretty-printing
- Introduced `guess_manifold` dispatch system for automatic manifold inference
### **Signature Simplifications**
- `scale_factors`: Removed manifold/metric positional argument; chart carries its manifold via `chart.M`
- `angle_between`: Removed manifold/metric positional argument; mirrors `scale_factors` refactor
- Renamed `manifold` attribute/parameter to `M` throughout (charts, vectors, point objects)
### **Import & Dependency Management**
- Replaced public `coordinax.charts` imports with direct `coordinax._src` or `coordinax.api` imports in internal modules
- Moved `coordinax.charts` imports to `TYPE_CHECKING` blocks in base modules to resolve circular dependencies
- Updated all imports across hypothesis strategies, interop packages, and documentation
### **Internal Cleanup**
- Dropped leading underscores from internal module filenames (`_dtype_utils.py` → `dtype_utils.py`, etc.)
- Renamed `fixed_kwargs` → `fixed_kw` and reformatted long lines in register_ptmap
- Added `@jax.tree_util.register_static` decorators and `@override` markers
- Added empty `__init__.py` to `_src/` for package structure
- Removed redundant `chart_dataclass_decorator` applications
### **Bug Fixes & Validation**
- Fixed dataclass field ordering: `AbstractChart.manifold` now KW_ONLY to avoid interfering with positional fields
- Fixed `NoManifold` dataclass implementation so `dataclassish.field_items` works
- Fixed `CartesianProductChart.manifold` ClassVar override to remove spurious init parameter
- Fixed hypothesis chart strategy `_param_filter` to skip KW_ONLY params with defaults
- Excluded `EmbeddedChart` from vector strategy (not yet supported)
- Added `M` property to `EmbeddedChart` returning combined intrinsic/ambient manifold
### **Documentation & Spec Updates**
- Updated spec.md with topological-vs-smooth manifold distinction
- Updated all docs, guides, tutorials, and hypothesis strategies to use new `M` naming
- Propagated changes to `coordinax.api`, `coordinax.astro`, `coordinax.interop.astropy`
- Added manifold `M` to chart `__pdoc__` (always shown, never hidden)1 parent 104bfe0 commit 0ba0fe7
167 files changed
Lines changed: 2998 additions & 2613 deletions
File tree
- docs
- api
- guides
- tutorials
- packages
- coordinax.api/src/coordinax/api
- coordinax.astro/src/coordinax/astro/_src
- coordinax.curveframes/src/coordinax/curveframes/_src
- coordinax.hypothesis
- docs
- src/coordinax/hypothesis
- charts/_src
- representations/_src
- utils
- _src
- annotations
- vectors/_src
- tests/unit
- charts
- manifolds
- vectors
- coordinax.interop.astropy/src/coordinax/interop/astropy/_src
- src/coordinax
- _src
- base
- charts
- custom
- embedded
- euclidean
- internal
- manifolds
- minkowski
- null
- product
- spherical
- charts
- _src
- frames
- _src
- main
- manifolds
- _src
- euclidean
- spherical
- representations/_src
- transforms/_src/actions
- vectors/_src
- tests/unit
- charts
- internal
- manifolds
- vectors
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
360 | | - | |
| 360 | + | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
| 395 | + | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
| 51 | + | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
| 247 | + | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| |||
0 commit comments