modus-py 0.1.0a1__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.
Files changed (33) hide show
  1. modus_py-0.1.0a1/.gitignore +218 -0
  2. modus_py-0.1.0a1/LICENSE +28 -0
  3. modus_py-0.1.0a1/PKG-INFO +110 -0
  4. modus_py-0.1.0a1/README.md +92 -0
  5. modus_py-0.1.0a1/pyproject.toml +81 -0
  6. modus_py-0.1.0a1/src/modus/__init__.py +177 -0
  7. modus_py-0.1.0a1/src/modus/_builder.py +61 -0
  8. modus_py-0.1.0a1/src/modus/errors.py +37 -0
  9. modus_py-0.1.0a1/src/modus/expr.py +149 -0
  10. modus_py-0.1.0a1/src/modus/frame.py +1095 -0
  11. modus_py-0.1.0a1/src/modus/serialisation.py +151 -0
  12. modus_py-0.1.0a1/src/modus/transform/__init__.py +157 -0
  13. modus_py-0.1.0a1/src/modus/transform/_base.py +189 -0
  14. modus_py-0.1.0a1/src/modus/transform/_formula.py +278 -0
  15. modus_py-0.1.0a1/src/modus/transform/aggregations.py +623 -0
  16. modus_py-0.1.0a1/src/modus/transform/cleaners.py +185 -0
  17. modus_py-0.1.0a1/src/modus/transform/derivations.py +588 -0
  18. modus_py-0.1.0a1/src/modus/transform/engine.py +617 -0
  19. modus_py-0.1.0a1/src/modus/transform/event_views.py +373 -0
  20. modus_py-0.1.0a1/src/modus/transform/filters.py +242 -0
  21. modus_py-0.1.0a1/src/modus/transform/group_filters.py +165 -0
  22. modus_py-0.1.0a1/src/modus/transform/groupers.py +563 -0
  23. modus_py-0.1.0a1/src/modus/units.py +89 -0
  24. modus_py-0.1.0a1/tests/__init__.py +0 -0
  25. modus_py-0.1.0a1/tests/unit/__init__.py +0 -0
  26. modus_py-0.1.0a1/tests/unit/test_event_views.py +298 -0
  27. modus_py-0.1.0a1/tests/unit/test_expr.py +230 -0
  28. modus_py-0.1.0a1/tests/unit/test_formula.py +219 -0
  29. modus_py-0.1.0a1/tests/unit/test_frame.py +885 -0
  30. modus_py-0.1.0a1/tests/unit/test_group_filters.py +392 -0
  31. modus_py-0.1.0a1/tests/unit/test_new_transform_ops.py +218 -0
  32. modus_py-0.1.0a1/tests/unit/test_transform.py +2632 -0
  33. modus_py-0.1.0a1/uv.lock +463 -0
@@ -0,0 +1,218 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
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
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2026, Chloe Elvin
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: modus-py
3
+ Version: 0.1.0a1
4
+ Summary: Schema-driven, unit-aware Polars transform engine.
5
+ License: BSD-3-Clause
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.12
8
+ Requires-Dist: astropy<8.0.0,>=7.0.0
9
+ Requires-Dist: polars<2.0.0,>=1.0.0
10
+ Requires-Dist: pydantic<3.0.0,>=2.0.0
11
+ Provides-Extra: dev
12
+ Requires-Dist: pyright>=1.1; extra == 'dev'
13
+ Requires-Dist: pytest-mock; extra == 'dev'
14
+ Requires-Dist: pytest-ruff; extra == 'dev'
15
+ Requires-Dist: pytest>=8; extra == 'dev'
16
+ Requires-Dist: ruff>=0.15.0; extra == 'dev'
17
+ Description-Content-Type: text/markdown
18
+
19
+ # modus
20
+
21
+ Schema-driven, unit-aware Polars transform engine.
22
+
23
+ modus pairs `ModusFrame` — a Polars DataFrame with per-column Astropy unit
24
+ metadata — with `FrameTransform`, a builder-pattern engine for expressing
25
+ timeseries transform pipelines (grouping, cleaning, deriving, filtering, and
26
+ aggregating) declaratively, while keeping unit metadata accurate throughout.
27
+
28
+ ## Installation
29
+
30
+ ```
31
+ pip install modus-py
32
+ ```
33
+
34
+ ## Quick start
35
+
36
+ ```python
37
+ import astropy.units as u
38
+ import polars
39
+ import modus
40
+
41
+ frame = modus.ModusFrame(
42
+ data=polars.DataFrame({"hoist_pressure1": [101.3, 98.7]}),
43
+ units={"hoist_pressure1": u.kPa},
44
+ )
45
+
46
+ velocity = frame.col("distance") / frame.col("time") # UnitExpr; unit propagates
47
+ frame = frame.with_columns(velocity=velocity)
48
+ ```
49
+
50
+ ```python
51
+ from datetime import timedelta
52
+ import modus
53
+
54
+ result = (
55
+ modus.FrameTransform()
56
+ .add_grouper(modus.DataGap("chunk", gap_seconds=60))
57
+ .add_grouper(modus.EventSequence("body_up_event", source="dump_body_up_sts", value=1, within="chunk"))
58
+ .add_cleaner(modus.Interpolate("hoist_pressure1_kpa", within="chunk"))
59
+ .add_filter(modus.SuppressLeadingEvent("body_up_event", within_column="chunk"))
60
+ .add_filter(modus.SuppressTrailingEvent("body_up_event"))
61
+ .group_by("chunk", "body_up_event")
62
+ .add_aggregation(modus.Mean("hoist_pressure1_kpa", output_name="mean_hoist_pressure1_kpa"))
63
+ .add_aggregation(modus.Duration(output_name="body_up_duration_s"))
64
+ .apply(frame)
65
+ )
66
+
67
+ labelled = result.labelled # ModusFrame -- timeseries with grouper columns added
68
+ aggregated = result.aggregated # ModusFrame -- one row per (chunk, body_up_event) group
69
+ ```
70
+
71
+ ## Custom units
72
+
73
+ modus ships an extensible unit registry, in the same spirit as Astropy's own
74
+ enabled-units model:
75
+
76
+ ```python
77
+ import astropy.units as u
78
+ import modus
79
+
80
+ modus.units.registry.register("kgcm2", u.def_unit("kgcm2", 98.0665 * u.kPa))
81
+ ```
82
+
83
+ ## Custom derivations and aggregations
84
+
85
+ Both extension points are plugin registries keyed by name, so a schema or
86
+ manifest layer built on top of modus can construct bespoke operations from
87
+ declarative configuration without importing analytic-specific Python:
88
+
89
+ ```python
90
+ import modus
91
+
92
+ @modus.DerivationRegistry.register("state_inference")
93
+ class StateInferenceDerivation(modus.Derivation):
94
+ ...
95
+
96
+ @modus.AggregationRegistry.register("weighted_percentile")
97
+ class WeightedPercentile(modus.Aggregation):
98
+ ...
99
+ ```
100
+
101
+ ## Development
102
+
103
+ ```
104
+ pip install -e .[dev]
105
+ pytest
106
+ ```
107
+
108
+ ## Licence
109
+
110
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,92 @@
1
+ # modus
2
+
3
+ Schema-driven, unit-aware Polars transform engine.
4
+
5
+ modus pairs `ModusFrame` — a Polars DataFrame with per-column Astropy unit
6
+ metadata — with `FrameTransform`, a builder-pattern engine for expressing
7
+ timeseries transform pipelines (grouping, cleaning, deriving, filtering, and
8
+ aggregating) declaratively, while keeping unit metadata accurate throughout.
9
+
10
+ ## Installation
11
+
12
+ ```
13
+ pip install modus-py
14
+ ```
15
+
16
+ ## Quick start
17
+
18
+ ```python
19
+ import astropy.units as u
20
+ import polars
21
+ import modus
22
+
23
+ frame = modus.ModusFrame(
24
+ data=polars.DataFrame({"hoist_pressure1": [101.3, 98.7]}),
25
+ units={"hoist_pressure1": u.kPa},
26
+ )
27
+
28
+ velocity = frame.col("distance") / frame.col("time") # UnitExpr; unit propagates
29
+ frame = frame.with_columns(velocity=velocity)
30
+ ```
31
+
32
+ ```python
33
+ from datetime import timedelta
34
+ import modus
35
+
36
+ result = (
37
+ modus.FrameTransform()
38
+ .add_grouper(modus.DataGap("chunk", gap_seconds=60))
39
+ .add_grouper(modus.EventSequence("body_up_event", source="dump_body_up_sts", value=1, within="chunk"))
40
+ .add_cleaner(modus.Interpolate("hoist_pressure1_kpa", within="chunk"))
41
+ .add_filter(modus.SuppressLeadingEvent("body_up_event", within_column="chunk"))
42
+ .add_filter(modus.SuppressTrailingEvent("body_up_event"))
43
+ .group_by("chunk", "body_up_event")
44
+ .add_aggregation(modus.Mean("hoist_pressure1_kpa", output_name="mean_hoist_pressure1_kpa"))
45
+ .add_aggregation(modus.Duration(output_name="body_up_duration_s"))
46
+ .apply(frame)
47
+ )
48
+
49
+ labelled = result.labelled # ModusFrame -- timeseries with grouper columns added
50
+ aggregated = result.aggregated # ModusFrame -- one row per (chunk, body_up_event) group
51
+ ```
52
+
53
+ ## Custom units
54
+
55
+ modus ships an extensible unit registry, in the same spirit as Astropy's own
56
+ enabled-units model:
57
+
58
+ ```python
59
+ import astropy.units as u
60
+ import modus
61
+
62
+ modus.units.registry.register("kgcm2", u.def_unit("kgcm2", 98.0665 * u.kPa))
63
+ ```
64
+
65
+ ## Custom derivations and aggregations
66
+
67
+ Both extension points are plugin registries keyed by name, so a schema or
68
+ manifest layer built on top of modus can construct bespoke operations from
69
+ declarative configuration without importing analytic-specific Python:
70
+
71
+ ```python
72
+ import modus
73
+
74
+ @modus.DerivationRegistry.register("state_inference")
75
+ class StateInferenceDerivation(modus.Derivation):
76
+ ...
77
+
78
+ @modus.AggregationRegistry.register("weighted_percentile")
79
+ class WeightedPercentile(modus.Aggregation):
80
+ ...
81
+ ```
82
+
83
+ ## Development
84
+
85
+ ```
86
+ pip install -e .[dev]
87
+ pytest
88
+ ```
89
+
90
+ ## Licence
91
+
92
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,81 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "modus-py"
7
+ version = "0.1.0a1"
8
+ description = "Schema-driven, unit-aware Polars transform engine."
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = { text = "BSD-3-Clause" } # Updated to match your choice!
12
+
13
+ dependencies = [
14
+ "astropy>=7.0.0,<8.0.0",
15
+ "polars>=1.0.0,<2.0.0",
16
+ "pydantic>=2.0.0,<3.0.0",
17
+ ]
18
+
19
+ [project.optional-dependencies]
20
+ dev = [
21
+ "ruff>=0.15.0",
22
+ "pytest>=8",
23
+ "pytest-ruff",
24
+ "pytest-mock",
25
+ "pyright>=1.1",
26
+ ]
27
+
28
+ [tool.hatch.build.targets.wheel]
29
+ packages = ["src/modus"]
30
+
31
+ [tool.pytest.ini_options]
32
+ testpaths = ["tests"]
33
+ addopts = "--tb=short -q -vv --ruff --ruff-format"
34
+ markers = [
35
+ "integration: integration tests",
36
+ ]
37
+
38
+ [tool.pyright]
39
+ pythonVersion = "3.12"
40
+ pythonPlatform = "Linux"
41
+ include = ["src"]
42
+ strict = []
43
+ typeCheckingMode = "basic"
44
+
45
+ [tool.ruff]
46
+ src = ["src"]
47
+ target-version = "py312"
48
+ line-length = 120
49
+
50
+ [tool.ruff.lint]
51
+ select = ["E", "F", "W", "I", "UP", "B", "C4", "PT", "RUF", "ICN", "TID"]
52
+ ignore = ["E501"]
53
+
54
+ [tool.ruff.lint.per-file-ignores]
55
+ "tests/**/*.py" = ["S101"] # assert statements are expected in tests
56
+
57
+ [tool.ruff.lint.flake8-tidy-imports]
58
+ # modus convention: local imports are always absolute
59
+ # (`from modus.foo.bar import XYZ`) not (`from .foo import XYZ`).
60
+ ban-relative-imports = "all"
61
+
62
+ [tool.ruff.lint.isort]
63
+ known-local-folder = ["modus", "tests"]
64
+ section-order = ["future", "standard-library", "third-party", "local-folder"]
65
+ lines-after-imports = 2
66
+
67
+ [tool.ruff.lint.isort.import-heading]
68
+ standard-library = "Standard Library"
69
+ third-party = "Third Party"
70
+ local-folder = "Local"
71
+
72
+ [tool.ruff.lint.flake8-import-conventions]
73
+ banned-from = ["typing", "collections.abc", "dataclasses", "abc"]
74
+
75
+ [tool.ruff.lint.flake8-import-conventions.aliases]
76
+ "astropy.units" = "u"
77
+
78
+ [tool.ruff.lint.flake8-import-conventions.banned-aliases]
79
+ pandas = ["pd"]
80
+ numpy = ["np"]
81
+ polars = ["pl"]
@@ -0,0 +1,177 @@
1
+ """modus — schema-driven, unit-aware Polars transform engine.
2
+
3
+ modus pairs a Polars `ModusFrame` (a DataFrame with per-column Astropy unit
4
+ metadata) with `FrameTransform`, a builder-pattern engine for expressing
5
+ timeseries transform pipelines — grouping, cleaning, deriving, filtering, and
6
+ aggregating — declaratively, while keeping unit metadata accurate throughout.
7
+
8
+ Quick start
9
+ -----------
10
+ >>> import astropy.units as u
11
+ >>> import polars
12
+ >>> import modus
13
+ >>>
14
+ >>> frame = modus.ModusFrame(
15
+ ... data=polars.DataFrame({"hoist_pressure1": [101.3, 98.7]}),
16
+ ... units={"hoist_pressure1": u.kPa},
17
+ ... )
18
+ >>> velocity = frame.col("distance") / frame.col("time") # UnitExpr; unit propagates
19
+ >>> frame = frame.with_columns(velocity=velocity)
20
+
21
+ Public surface
22
+ --------------
23
+ `ModusFrame`
24
+ Polars DataFrame paired with per-column Astropy unit metadata. Exposes
25
+ `~ModusFrame.col` to obtain unit-aware expressions and explicit
26
+ transformation methods (`~ModusFrame.with_columns`, `~ModusFrame.select`,
27
+ `~ModusFrame.filter`, `~ModusFrame.rename`, `~ModusFrame.drop`,
28
+ `~ModusFrame.sort`, `~ModusFrame.join`, `~ModusFrame.concat`) that
29
+ keep the unit dict accurate after each operation.
30
+
31
+ `UnitExpr`
32
+ A `polars.Expr` paired with an `u.UnitBase`. Returned by
33
+ `ModusFrame.col`; supports arithmetic operator overloads (``+``, ``-``,
34
+ ``*``, ``/``) that propagate unit algebra alongside the Polars expression
35
+ tree.
36
+
37
+ :data:`TIMESTAMP_COLUMN`
38
+ Module-level constant (``"ts"``) naming the canonical timestamp column
39
+ present in every timeseries `ModusFrame`.
40
+
41
+ `ModusFrameBuilder`
42
+ Helper used to construct an `ModusFrame` from raw Polars data and unit
43
+ strings, parsed via `modus.units.registry`.
44
+
45
+ `FrameTransform`
46
+ Schema-driven, unit-aware transform engine. Build up a pipeline with
47
+ groupers, cleaners, derivations, filters, and aggregations, then call
48
+ `~FrameTransform.apply` to execute it against an `ModusFrame`. Both a
49
+ labelled timeseries and a per-event aggregated summary are returned as a
50
+ `TransformResult`.
51
+
52
+ `ModusError`, `FrameError`, `TransformError`
53
+ modus's exception hierarchy — see `modus.errors`.
54
+
55
+ `modus.units.registry`
56
+ Shared, extensible unit registry (see `modus.units`). Register custom
57
+ unit strings against it, Astropy-style, before parsing them.
58
+
59
+ Transform operations
60
+ ---------------------
61
+ - Groupers: `DataGap`, `EventSequence`, `PatternSequence`
62
+ - Cleaners: `FillForward`, `FillBackward`, `FillNull`, `Interpolate`
63
+ - Derivations: `TimeDelta`, `Rate`, `LinearCombination`, `Formula`,
64
+ `ColumnExpression`, and the `Derivation` extension point with
65
+ `DerivationRegistry` for declarative construction by name
66
+ - Filters: `SuppressLeadingEvent`, `SuppressTrailingEvent`,
67
+ `SuppressEventCrossingGrouper`
68
+ - Aggregations: `Mean`, `Sum`, `Sem`, `Min`, `Max`, `MaxAbs`, `Std`, `First`,
69
+ `Last`, `Mode`, `NthValue`, `ValueSequence`, `Duration`, `Count`, and the
70
+ `Aggregation` extension point with `AggregationRegistry`
71
+ - Group filters: `GroupCondition`, `GroupFilter`
72
+ - Event views: `EventView`, `Budget`, `Rows`, `Seconds`
73
+ """
74
+
75
+ # Local
76
+ from modus import units
77
+ from modus._builder import ModusFrameBuilder
78
+ from modus.errors import FrameError, ModusError
79
+ from modus.expr import UnitExpr
80
+ from modus.frame import TIMESTAMP_COLUMN, ModusFrame
81
+ from modus.transform import (
82
+ Aggregation,
83
+ AggregationRegistry,
84
+ Budget,
85
+ ColumnExpression,
86
+ Count,
87
+ DataGap,
88
+ Derivation,
89
+ DerivationRegistry,
90
+ Duration,
91
+ EventSequence,
92
+ EventView,
93
+ FillBackward,
94
+ FillForward,
95
+ FillNull,
96
+ First,
97
+ Formula,
98
+ FrameTransform,
99
+ GroupCondition,
100
+ GroupFilter,
101
+ Interpolate,
102
+ Last,
103
+ LinearCombination,
104
+ Max,
105
+ MaxAbs,
106
+ Mean,
107
+ Min,
108
+ Mode,
109
+ NthValue,
110
+ PatternSequence,
111
+ Rate,
112
+ Rows,
113
+ Seconds,
114
+ Sem,
115
+ Std,
116
+ Sum,
117
+ SuppressEventCrossingGrouper,
118
+ SuppressLeadingEvent,
119
+ SuppressTrailingEvent,
120
+ TimeDelta,
121
+ TransformError,
122
+ TransformResult,
123
+ ValueSequence,
124
+ )
125
+
126
+
127
+ __all__ = [
128
+ "TIMESTAMP_COLUMN",
129
+ "Aggregation",
130
+ "AggregationRegistry",
131
+ "Budget",
132
+ "ColumnExpression",
133
+ "Count",
134
+ "DataGap",
135
+ "Derivation",
136
+ "DerivationRegistry",
137
+ "Duration",
138
+ "EventSequence",
139
+ "EventView",
140
+ "FillBackward",
141
+ "FillForward",
142
+ "FillNull",
143
+ "First",
144
+ "Formula",
145
+ "FrameError",
146
+ "FrameTransform",
147
+ "GroupCondition",
148
+ "GroupFilter",
149
+ "Interpolate",
150
+ "Last",
151
+ "LinearCombination",
152
+ "Max",
153
+ "MaxAbs",
154
+ "Mean",
155
+ "Min",
156
+ "Mode",
157
+ "ModusError",
158
+ "ModusFrame",
159
+ "ModusFrameBuilder",
160
+ "NthValue",
161
+ "PatternSequence",
162
+ "Rate",
163
+ "Rows",
164
+ "Seconds",
165
+ "Sem",
166
+ "Std",
167
+ "Sum",
168
+ "SuppressEventCrossingGrouper",
169
+ "SuppressLeadingEvent",
170
+ "SuppressTrailingEvent",
171
+ "TimeDelta",
172
+ "TransformError",
173
+ "TransformResult",
174
+ "UnitExpr",
175
+ "ValueSequence",
176
+ "units",
177
+ ]