ecliseutils 0.1.0__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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Wentinn Liao
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,105 @@
1
+ Metadata-Version: 2.4
2
+ Name: ecliseutils
3
+ Version: 0.1.0
4
+ Summary: Shared general-purpose research utilities (tensor/module batching, linear algebra, ARE/ODE solvers, labeled arrays, plotting) used across multiple projects.
5
+ Author: Wentinn Liao
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/JophiArcana/ecliseutils
8
+ Project-URL: Repository, https://github.com/JophiArcana/ecliseutils
9
+ Project-URL: Issues, https://github.com/JophiArcana/ecliseutils/issues
10
+ Keywords: pytorch,numpy,linear-algebra,research-utilities,vmap,tensordict
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
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.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: numpy
25
+ Requires-Dist: torch
26
+ Requires-Dist: tensordict
27
+ Requires-Dist: einops
28
+ Requires-Dist: scipy
29
+ Requires-Dist: matplotlib
30
+ Requires-Dist: tqdm
31
+ Requires-Dist: pandas
32
+ Provides-Extra: ode
33
+ Requires-Dist: torchdiffeq; extra == "ode"
34
+ Dynamic: license-file
35
+
36
+ # ecliseutils
37
+
38
+ Shared general-purpose research utilities used across multiple projects (e.g.
39
+ `KF_RNN`, `event_camera`). This package is the single source of truth for code
40
+ that previously lived as diverged copies inside each project's
41
+ `infrastructure/utils.py`.
42
+
43
+ ## What's here
44
+
45
+ | Module | Contents |
46
+ |--------|----------|
47
+ | `settings` | `configure(device, dtype, precision, seed, debug)`, `default_dtype`, safe-global registration. No hardcoded paths; no import-time torch mutation. |
48
+ | `types` | `ModelPair = tuple[nn.Module, TensorDict]` and shared aliases. |
49
+ | `labeled_array` | `LabeledArray` / `LabeledDataset` (in-house replacement for `dimarray`). |
50
+ | `modules` | Module/tensor/TensorDict batching: `stack_module_arr`, `run_module_arr`, `multi_vmap`, `td_items`, ... |
51
+ | `arrays` | NumPy object-array comprehensions: `multi_map`, `multi_zip`, `broadcast_dim_arrays`, ... |
52
+ | `linalg` | `pow_series`, `batch_trace`, `kl_div`, `sqrtm`, `hadamard_conjugation*`, `inverse`, `eig_some`, ... |
53
+ | `are` | `solve_discrete_are` (torch Schur) and `solve_continuous_are` (scipy `ordqz` fallback) + residual tests. |
54
+ | `ode` | `batch_odeint`, `linspace`, `geomspace` (lazy `torchdiffeq`). |
55
+ | `ensemble` | `EnsembleModule` chunked vmap wrapper. |
56
+ | `fast_conv_scan` | `conv_scan` exponential cumulative scan autograd op. |
57
+ | `recursive` | Dotted-path `rgetattr` / `rsetattr` / `rgetitem` / `rsetitem`. |
58
+ | `dicts` | `flatten_nested_dict`, `map_dict`, `nested_type`, `call_func_with_kwargs`. |
59
+ | `io` | `torch_load`, `empty_cache`, `reset_seed`, `model_size`. |
60
+ | `memory` | `get_tensors_in_memory`, `track_tensor_diff`, ... |
61
+ | `timing` | `Timer`, `print_disabled`, `print_enabled`, `track_calls`. |
62
+ | `plotting` | `color`, `confidence_ellipse`. |
63
+
64
+ ## Install
65
+
66
+ From PyPI (once published):
67
+
68
+ ```bash
69
+ pip install ecliseutils
70
+ # with ODE support:
71
+ pip install "ecliseutils[ode]"
72
+ ```
73
+
74
+ From GitHub (works on any device, no clone needed):
75
+
76
+ ```bash
77
+ pip install "git+https://github.com/JophiArcana/ecliseutils.git"
78
+ # pin to a release:
79
+ pip install "git+https://github.com/JophiArcana/ecliseutils.git@v0.1.0"
80
+ # with ODE support:
81
+ pip install "ecliseutils[ode] @ git+https://github.com/JophiArcana/ecliseutils.git"
82
+ ```
83
+
84
+ Editable (for local development):
85
+
86
+ ```bash
87
+ pip install -e /path/to/ecliseutils
88
+ # with ODE support:
89
+ pip install -e "/path/to/ecliseutils[ode]"
90
+ ```
91
+
92
+ ## Usage
93
+
94
+ ```python
95
+ import torch
96
+ import ecliseutils as eu
97
+
98
+ # Configure once at startup (typically from your project's settings module).
99
+ eu.configure(device="cpu", dtype=torch.float64, precision=8, seed=1212)
100
+
101
+ P = eu.solve_discrete_are(A, B, Q, R)
102
+ ```
103
+
104
+ `torchdiffeq` is only required if you call `ecliseutils.ode.batch_odeint`; it is
105
+ imported lazily.
@@ -0,0 +1,70 @@
1
+ # ecliseutils
2
+
3
+ Shared general-purpose research utilities used across multiple projects (e.g.
4
+ `KF_RNN`, `event_camera`). This package is the single source of truth for code
5
+ that previously lived as diverged copies inside each project's
6
+ `infrastructure/utils.py`.
7
+
8
+ ## What's here
9
+
10
+ | Module | Contents |
11
+ |--------|----------|
12
+ | `settings` | `configure(device, dtype, precision, seed, debug)`, `default_dtype`, safe-global registration. No hardcoded paths; no import-time torch mutation. |
13
+ | `types` | `ModelPair = tuple[nn.Module, TensorDict]` and shared aliases. |
14
+ | `labeled_array` | `LabeledArray` / `LabeledDataset` (in-house replacement for `dimarray`). |
15
+ | `modules` | Module/tensor/TensorDict batching: `stack_module_arr`, `run_module_arr`, `multi_vmap`, `td_items`, ... |
16
+ | `arrays` | NumPy object-array comprehensions: `multi_map`, `multi_zip`, `broadcast_dim_arrays`, ... |
17
+ | `linalg` | `pow_series`, `batch_trace`, `kl_div`, `sqrtm`, `hadamard_conjugation*`, `inverse`, `eig_some`, ... |
18
+ | `are` | `solve_discrete_are` (torch Schur) and `solve_continuous_are` (scipy `ordqz` fallback) + residual tests. |
19
+ | `ode` | `batch_odeint`, `linspace`, `geomspace` (lazy `torchdiffeq`). |
20
+ | `ensemble` | `EnsembleModule` chunked vmap wrapper. |
21
+ | `fast_conv_scan` | `conv_scan` exponential cumulative scan autograd op. |
22
+ | `recursive` | Dotted-path `rgetattr` / `rsetattr` / `rgetitem` / `rsetitem`. |
23
+ | `dicts` | `flatten_nested_dict`, `map_dict`, `nested_type`, `call_func_with_kwargs`. |
24
+ | `io` | `torch_load`, `empty_cache`, `reset_seed`, `model_size`. |
25
+ | `memory` | `get_tensors_in_memory`, `track_tensor_diff`, ... |
26
+ | `timing` | `Timer`, `print_disabled`, `print_enabled`, `track_calls`. |
27
+ | `plotting` | `color`, `confidence_ellipse`. |
28
+
29
+ ## Install
30
+
31
+ From PyPI (once published):
32
+
33
+ ```bash
34
+ pip install ecliseutils
35
+ # with ODE support:
36
+ pip install "ecliseutils[ode]"
37
+ ```
38
+
39
+ From GitHub (works on any device, no clone needed):
40
+
41
+ ```bash
42
+ pip install "git+https://github.com/JophiArcana/ecliseutils.git"
43
+ # pin to a release:
44
+ pip install "git+https://github.com/JophiArcana/ecliseutils.git@v0.1.0"
45
+ # with ODE support:
46
+ pip install "ecliseutils[ode] @ git+https://github.com/JophiArcana/ecliseutils.git"
47
+ ```
48
+
49
+ Editable (for local development):
50
+
51
+ ```bash
52
+ pip install -e /path/to/ecliseutils
53
+ # with ODE support:
54
+ pip install -e "/path/to/ecliseutils[ode]"
55
+ ```
56
+
57
+ ## Usage
58
+
59
+ ```python
60
+ import torch
61
+ import ecliseutils as eu
62
+
63
+ # Configure once at startup (typically from your project's settings module).
64
+ eu.configure(device="cpu", dtype=torch.float64, precision=8, seed=1212)
65
+
66
+ P = eu.solve_discrete_are(A, B, Q, R)
67
+ ```
68
+
69
+ `torchdiffeq` is only required if you call `ecliseutils.ode.batch_odeint`; it is
70
+ imported lazily.
@@ -0,0 +1,54 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ecliseutils"
7
+ version = "0.1.0"
8
+ description = "Shared general-purpose research utilities (tensor/module batching, linear algebra, ARE/ODE solvers, labeled arrays, plotting) used across multiple projects."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.9"
12
+ authors = [{ name = "Wentinn Liao" }]
13
+ keywords = [
14
+ "pytorch",
15
+ "numpy",
16
+ "linear-algebra",
17
+ "research-utilities",
18
+ "vmap",
19
+ "tensordict",
20
+ ]
21
+ classifiers = [
22
+ "Development Status :: 4 - Beta",
23
+ "Intended Audience :: Science/Research",
24
+ "License :: OSI Approved :: MIT License",
25
+ "Operating System :: OS Independent",
26
+ "Programming Language :: Python :: 3",
27
+ "Programming Language :: Python :: 3.9",
28
+ "Programming Language :: Python :: 3.10",
29
+ "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Topic :: Scientific/Engineering",
32
+ ]
33
+ dependencies = [
34
+ "numpy",
35
+ "torch",
36
+ "tensordict",
37
+ "einops",
38
+ "scipy",
39
+ "matplotlib",
40
+ "tqdm",
41
+ "pandas",
42
+ ]
43
+
44
+ [project.optional-dependencies]
45
+ # Required only for the ODE integration helpers in ``ecliseutils.ode``.
46
+ ode = ["torchdiffeq"]
47
+
48
+ [project.urls]
49
+ Homepage = "https://github.com/JophiArcana/ecliseutils"
50
+ Repository = "https://github.com/JophiArcana/ecliseutils"
51
+ Issues = "https://github.com/JophiArcana/ecliseutils/issues"
52
+
53
+ [tool.setuptools.packages.find]
54
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,99 @@
1
+ """ecliseutils: shared general-purpose research utilities.
2
+
3
+ Submodules group the utilities by concern (``modules``, ``arrays``, ``linalg``,
4
+ ``are``, ``ode``, ``labeled_array``, ``ensemble``, ``fast_conv_scan``,
5
+ ``recursive``, ``dicts``, ``io``, ``memory``, ``timing``, ``plotting``,
6
+ ``settings``, ``types``). The most commonly used names are re-exported here for
7
+ convenience (``import ecliseutils as eu; eu.stack_module_arr(...)``).
8
+
9
+ Projects should call :func:`ecliseutils.configure` early (typically from their
10
+ own ``settings`` module) to set device/dtype/precision/seed.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ from . import (
16
+ arrays,
17
+ are,
18
+ dicts,
19
+ ensemble,
20
+ fast_conv_scan,
21
+ io,
22
+ labeled_array,
23
+ linalg,
24
+ memory,
25
+ modules,
26
+ ode,
27
+ plotting,
28
+ recursive,
29
+ settings,
30
+ timing,
31
+ types,
32
+ )
33
+
34
+ from .settings import configure, set_debug, register_safe_globals, default_dtype
35
+ from .types import ModelPair
36
+
37
+ from .labeled_array import LabeledArray, LabeledDataset, array_of, put_object, as_ndarray
38
+ from .modules import (
39
+ stack_tensor_arr,
40
+ stack_module_arr,
41
+ stack_module_arr_preserve_reference,
42
+ run_module_arr,
43
+ multi_vmap,
44
+ buffer_dict,
45
+ td_items,
46
+ td_get,
47
+ parameter_td,
48
+ mask_dataset_with_total_sequence_length,
49
+ broadcast_shapes,
50
+ get_all_hooks,
51
+ )
52
+ from .arrays import (
53
+ multi_iter,
54
+ multi_enumerate,
55
+ multi_map,
56
+ multi_zip,
57
+ dim_array_like,
58
+ broadcast_dim_array_shapes,
59
+ broadcast_dim_arrays,
60
+ take_from_dim_array,
61
+ )
62
+ from .linalg import (
63
+ pow_series,
64
+ batch_trace,
65
+ kl_div,
66
+ sqrtm,
67
+ complex,
68
+ ceildiv,
69
+ ceil,
70
+ T,
71
+ hadamard_conjugation,
72
+ hadamard_conjugation_diff_order1,
73
+ hadamard_conjugation_diff_order2,
74
+ inverse,
75
+ eig_some,
76
+ )
77
+ from .are import (
78
+ solve_discrete_are,
79
+ solve_continuous_are,
80
+ test_discrete_are,
81
+ test_continuous_are,
82
+ )
83
+ from .ode import linspace, geomspace, batch_odeint
84
+ from .ensemble import EnsembleModule, DEFAULT_SPLIT_SIZE
85
+ from .fast_conv_scan import ConvScanFn, conv_scan
86
+ from .recursive import rgetattr, rsetattr, rhasattr, rgetitem, rsetitem
87
+ from .dicts import flatten_nested_dict, map_dict, nested_type, print_dict, call_func_with_kwargs, hash_hex
88
+ from .io import torch_load, empty_cache, reset_seed, model_size
89
+ from .memory import (
90
+ get_tensors_in_memory,
91
+ print_tensors_in_memory,
92
+ get_tensors_in_memory_shape,
93
+ track_tensor_diff,
94
+ )
95
+ from .timing import Timer, identity, PTR, print_disabled, print_enabled, track_calls
96
+ from .plotting import color, confidence_ellipse
97
+
98
+
99
+ __version__ = "0.1.0"