nested-recd 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 Johel Padilla-Villanueva
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,156 @@
1
+ Metadata-Version: 2.4
2
+ Name: nested-recd
3
+ Version: 0.1.0
4
+ Summary: Nested ordinal RECD: Φ1–Φ3 conjunction levels and λ-weighted Discrete Extramental Clock
5
+ Author-email: Johel Padilla-Villanueva <joel.padilla2@upr.edu>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/johelpadilla/nested-recd
8
+ Project-URL: Repository, https://github.com/johelpadilla/nested-recd
9
+ Project-URL: Issues, https://github.com/johelpadilla/nested-recd/issues
10
+ Project-URL: Documentation, https://github.com/johelpadilla/nested-recd#readme
11
+ Project-URL: DOI, https://doi.org/10.5281/zenodo.21270699
12
+ Keywords: RECD,ordinal patterns,nested time,Systemic Tau,complexity,early-warning,network physiology,Bandt-Pompe
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering
23
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
24
+ Classifier: Topic :: Scientific/Engineering :: Physics
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: numpy>=1.22
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=7.0; extra == "dev"
31
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
32
+ Requires-Dist: build; extra == "dev"
33
+ Requires-Dist: twine; extra == "dev"
34
+ Dynamic: license-file
35
+
36
+ # nested-recd
37
+
38
+ [![PyPI version](https://img.shields.io/pypi/v/nested-recd.svg)](https://pypi.org/project/nested-recd/)
39
+ [![Python](https://img.shields.io/pypi/pyversions/nested-recd.svg)](https://pypi.org/project/nested-recd/)
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
41
+
42
+ **Nested ordinal RECD** — pure-NumPy implementation of nested ordinal conjunction levels (Φ₁, Φ₂, Φ₃) and λ-weighted Discrete Extramental Clock (RECD) accumulation.
43
+
44
+ This is the standalone library behind the nested-time structure used in the CCTP/SDDB cardiac pilot and the experimental design in *Conversación de la naturaleza del tiempo*.
45
+
46
+ ## Install
47
+
48
+ ```bash
49
+ pip install nested-recd
50
+ ```
51
+
52
+ From source:
53
+
54
+ ```bash
55
+ pip install git+https://github.com/johelpadilla/nested-recd.git
56
+ ```
57
+
58
+ ## Quick start
59
+
60
+ ```python
61
+ import numpy as np
62
+ from nested_recd import compute_recd_from_conjunctions, compute_weighted_contributions
63
+
64
+ # Multivariate series: shape (T, N)
65
+ rng = np.random.default_rng(0)
66
+ X = rng.normal(size=(800, 3)).cumsum(axis=0)
67
+
68
+ out = compute_recd_from_conjunctions(X, m=3, d=4, theta3=0.10)
69
+
70
+ print("mean Φ1:", float(np.nanmean(out["phi1"])))
71
+ print("mean Φ2:", float(np.nanmean(out["phi2"])))
72
+ print("Φ3 active fraction:", float(np.nanmean(out["phi3"] > 0)))
73
+ print("final T_recd:", float(out["T_recd"][-1]))
74
+
75
+ w = compute_weighted_contributions(out)
76
+ print("frac level-3 contribution:", w["frac_contrib3"])
77
+ ```
78
+
79
+ Optional: supply a Systemic Tau series `tau_s` (aligned in time) so that λ is derived empirically:
80
+
81
+ ```python
82
+ out = compute_recd_from_conjunctions(X, tau_s=tau_s)
83
+ ```
84
+
85
+ Or fix the regime weight with a scalar / array override:
86
+
87
+ ```python
88
+ out = compute_recd_from_conjunctions(X, lam_override=0.5)
89
+ ```
90
+
91
+ ## What it computes
92
+
93
+ | Symbol | Meaning |
94
+ |--------|---------|
95
+ | **Φ₁** | Co-occurrence of identical ordinal symbols across variable pairs |
96
+ | **Φ₂** | Persistence of pairwise ordinal relations over lag `d` |
97
+ | **Φ₃** | Higher-order synergy proxy (total-correlation excess + joint surprise) |
98
+ | **λ** | Chaos / reorganization intensity (from `τ_s` or `lam_override`) |
99
+ | **α(λ)** | Level weights: α₁ decays with λ; α₂, α₃ grow with λ |
100
+ | **ΔRECD** | `α₁Φ₁ + α₂Φ₂ + α₃Φ₃` |
101
+ | **T_recd** | Cumulative sum of ΔRECD (nested-time clock) |
102
+
103
+ Ordinal symbols use Bandt–Pompe patterns (`m=3` by default).
104
+
105
+ ## Surrogates
106
+
107
+ ```python
108
+ from nested_recd import phase_shuffle_independent, random_permutation_independent
109
+
110
+ X_null = phase_shuffle_independent(X, seed=42) # IAAFT per column
111
+ X_perm = random_permutation_independent(X, seed=42)
112
+ ```
113
+
114
+ ## API surface
115
+
116
+ ```python
117
+ from nested_recd import (
118
+ compute_recd_from_conjunctions,
119
+ compute_phi1, compute_phi2, compute_phi3,
120
+ compute_lambda, alpha_weights, regime_lambda_proxy,
121
+ compute_weighted_contributions, high_level3_rate,
122
+ generate_multivariate_symbols,
123
+ phase_shuffle_independent, generate_surrogate_ensemble,
124
+ )
125
+ ```
126
+
127
+ ## Relation to other projects
128
+
129
+ | Project | Role |
130
+ |---------|------|
131
+ | [`systemictau`](https://pypi.org/project/systemictau/) | Full Systemic Tau library (τ_s, platform, studio) |
132
+ | [`cctp-sddb-systemic-tau`](https://github.com/johelpadilla/cctp-sddb-systemic-tau) | Cardiac VF pilot using this nested RECD pipeline |
133
+ | This package | Lightweight, installable nested-time / ordinal RECD core |
134
+
135
+ ## Citation
136
+
137
+ If you use this software, please cite the CCTP/SDDB pilot archive:
138
+
139
+ > Padilla-Villanueva, J. (2026). *CCTP/SDDB: Systemic Tau and ordinal RECD before spontaneous ventricular fibrillation* (v1.0.1). Zenodo. https://doi.org/10.5281/zenodo.21270699
140
+
141
+ And the theoretical nested-time / RECD framework as appropriate for your venue.
142
+
143
+ ```bibtex
144
+ @software{padilla_nested_recd_2026,
145
+ author = {Padilla-Villanueva, Johel},
146
+ title = {nested-recd: Nested ordinal RECD levels},
147
+ year = {2026},
148
+ url = {https://github.com/johelpadilla/nested-recd},
149
+ version = {0.1.0}
150
+ }
151
+ ```
152
+
153
+ ## License
154
+
155
+ MIT © 2026 Johel Padilla-Villanueva
156
+ ORCID: [0000-0002-5797-6931](https://orcid.org/0000-0002-5797-6931)
@@ -0,0 +1,121 @@
1
+ # nested-recd
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/nested-recd.svg)](https://pypi.org/project/nested-recd/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/nested-recd.svg)](https://pypi.org/project/nested-recd/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+
7
+ **Nested ordinal RECD** — pure-NumPy implementation of nested ordinal conjunction levels (Φ₁, Φ₂, Φ₃) and λ-weighted Discrete Extramental Clock (RECD) accumulation.
8
+
9
+ This is the standalone library behind the nested-time structure used in the CCTP/SDDB cardiac pilot and the experimental design in *Conversación de la naturaleza del tiempo*.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pip install nested-recd
15
+ ```
16
+
17
+ From source:
18
+
19
+ ```bash
20
+ pip install git+https://github.com/johelpadilla/nested-recd.git
21
+ ```
22
+
23
+ ## Quick start
24
+
25
+ ```python
26
+ import numpy as np
27
+ from nested_recd import compute_recd_from_conjunctions, compute_weighted_contributions
28
+
29
+ # Multivariate series: shape (T, N)
30
+ rng = np.random.default_rng(0)
31
+ X = rng.normal(size=(800, 3)).cumsum(axis=0)
32
+
33
+ out = compute_recd_from_conjunctions(X, m=3, d=4, theta3=0.10)
34
+
35
+ print("mean Φ1:", float(np.nanmean(out["phi1"])))
36
+ print("mean Φ2:", float(np.nanmean(out["phi2"])))
37
+ print("Φ3 active fraction:", float(np.nanmean(out["phi3"] > 0)))
38
+ print("final T_recd:", float(out["T_recd"][-1]))
39
+
40
+ w = compute_weighted_contributions(out)
41
+ print("frac level-3 contribution:", w["frac_contrib3"])
42
+ ```
43
+
44
+ Optional: supply a Systemic Tau series `tau_s` (aligned in time) so that λ is derived empirically:
45
+
46
+ ```python
47
+ out = compute_recd_from_conjunctions(X, tau_s=tau_s)
48
+ ```
49
+
50
+ Or fix the regime weight with a scalar / array override:
51
+
52
+ ```python
53
+ out = compute_recd_from_conjunctions(X, lam_override=0.5)
54
+ ```
55
+
56
+ ## What it computes
57
+
58
+ | Symbol | Meaning |
59
+ |--------|---------|
60
+ | **Φ₁** | Co-occurrence of identical ordinal symbols across variable pairs |
61
+ | **Φ₂** | Persistence of pairwise ordinal relations over lag `d` |
62
+ | **Φ₃** | Higher-order synergy proxy (total-correlation excess + joint surprise) |
63
+ | **λ** | Chaos / reorganization intensity (from `τ_s` or `lam_override`) |
64
+ | **α(λ)** | Level weights: α₁ decays with λ; α₂, α₃ grow with λ |
65
+ | **ΔRECD** | `α₁Φ₁ + α₂Φ₂ + α₃Φ₃` |
66
+ | **T_recd** | Cumulative sum of ΔRECD (nested-time clock) |
67
+
68
+ Ordinal symbols use Bandt–Pompe patterns (`m=3` by default).
69
+
70
+ ## Surrogates
71
+
72
+ ```python
73
+ from nested_recd import phase_shuffle_independent, random_permutation_independent
74
+
75
+ X_null = phase_shuffle_independent(X, seed=42) # IAAFT per column
76
+ X_perm = random_permutation_independent(X, seed=42)
77
+ ```
78
+
79
+ ## API surface
80
+
81
+ ```python
82
+ from nested_recd import (
83
+ compute_recd_from_conjunctions,
84
+ compute_phi1, compute_phi2, compute_phi3,
85
+ compute_lambda, alpha_weights, regime_lambda_proxy,
86
+ compute_weighted_contributions, high_level3_rate,
87
+ generate_multivariate_symbols,
88
+ phase_shuffle_independent, generate_surrogate_ensemble,
89
+ )
90
+ ```
91
+
92
+ ## Relation to other projects
93
+
94
+ | Project | Role |
95
+ |---------|------|
96
+ | [`systemictau`](https://pypi.org/project/systemictau/) | Full Systemic Tau library (τ_s, platform, studio) |
97
+ | [`cctp-sddb-systemic-tau`](https://github.com/johelpadilla/cctp-sddb-systemic-tau) | Cardiac VF pilot using this nested RECD pipeline |
98
+ | This package | Lightweight, installable nested-time / ordinal RECD core |
99
+
100
+ ## Citation
101
+
102
+ If you use this software, please cite the CCTP/SDDB pilot archive:
103
+
104
+ > Padilla-Villanueva, J. (2026). *CCTP/SDDB: Systemic Tau and ordinal RECD before spontaneous ventricular fibrillation* (v1.0.1). Zenodo. https://doi.org/10.5281/zenodo.21270699
105
+
106
+ And the theoretical nested-time / RECD framework as appropriate for your venue.
107
+
108
+ ```bibtex
109
+ @software{padilla_nested_recd_2026,
110
+ author = {Padilla-Villanueva, Johel},
111
+ title = {nested-recd: Nested ordinal RECD levels},
112
+ year = {2026},
113
+ url = {https://github.com/johelpadilla/nested-recd},
114
+ version = {0.1.0}
115
+ }
116
+ ```
117
+
118
+ ## License
119
+
120
+ MIT © 2026 Johel Padilla-Villanueva
121
+ ORCID: [0000-0002-5797-6931](https://orcid.org/0000-0002-5797-6931)
@@ -0,0 +1,62 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "nested-recd"
7
+ version = "0.1.0"
8
+ description = "Nested ordinal RECD: Φ1–Φ3 conjunction levels and λ-weighted Discrete Extramental Clock"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ { name = "Johel Padilla-Villanueva", email = "joel.padilla2@upr.edu" },
15
+ ]
16
+ keywords = [
17
+ "RECD",
18
+ "ordinal patterns",
19
+ "nested time",
20
+ "Systemic Tau",
21
+ "complexity",
22
+ "early-warning",
23
+ "network physiology",
24
+ "Bandt-Pompe",
25
+ ]
26
+ classifiers = [
27
+ "Development Status :: 4 - Beta",
28
+ "Intended Audience :: Science/Research",
29
+ "Operating System :: OS Independent",
30
+ "Programming Language :: Python :: 3",
31
+ "Programming Language :: Python :: 3.9",
32
+ "Programming Language :: Python :: 3.10",
33
+ "Programming Language :: Python :: 3.11",
34
+ "Programming Language :: Python :: 3.12",
35
+ "Programming Language :: Python :: 3.13",
36
+ "Topic :: Scientific/Engineering",
37
+ "Topic :: Scientific/Engineering :: Information Analysis",
38
+ "Topic :: Scientific/Engineering :: Physics",
39
+ ]
40
+ dependencies = [
41
+ "numpy>=1.22",
42
+ ]
43
+
44
+ [project.optional-dependencies]
45
+ dev = ["pytest>=7.0", "pytest-cov>=4.0", "build", "twine"]
46
+
47
+ [project.urls]
48
+ Homepage = "https://github.com/johelpadilla/nested-recd"
49
+ Repository = "https://github.com/johelpadilla/nested-recd"
50
+ Issues = "https://github.com/johelpadilla/nested-recd/issues"
51
+ Documentation = "https://github.com/johelpadilla/nested-recd#readme"
52
+ DOI = "https://doi.org/10.5281/zenodo.21270699"
53
+
54
+ [tool.setuptools.packages.find]
55
+ where = ["src"]
56
+
57
+ [tool.setuptools.package-data]
58
+ nested_recd = ["py.typed"]
59
+
60
+ [tool.pytest.ini_options]
61
+ testpaths = ["tests"]
62
+ pythonpath = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,74 @@
1
+ """
2
+ nested-recd
3
+ ===========
4
+
5
+ Nested ordinal RECD: Φ₁ / Φ₂ / Φ₃ conjunction levels and λ-weighted
6
+ Discrete Extramental Clock accumulation.
7
+
8
+ Quick start
9
+ -----------
10
+ >>> import numpy as np
11
+ >>> from nested_recd import compute_recd_from_conjunctions
12
+ >>> X = np.random.randn(500, 3).cumsum(axis=0)
13
+ >>> out = compute_recd_from_conjunctions(X)
14
+ >>> out["T_recd"][-1]
15
+ """
16
+
17
+ from nested_recd.ordinal_levels import (
18
+ DEFAULT_M,
19
+ DEFAULT_DELAY,
20
+ DEFAULT_D_PERSIST,
21
+ DEFAULT_WINDOW_TAU,
22
+ DEFAULT_THETA_CHAOS,
23
+ DEFAULT_THETA3,
24
+ DELTA_FEIGENBAUM,
25
+ generate_multivariate_symbols,
26
+ compute_phi1,
27
+ compute_phi2,
28
+ compute_phi3,
29
+ compute_lambda,
30
+ alpha_weights,
31
+ regime_lambda_proxy,
32
+ compute_recd_from_conjunctions,
33
+ simple_level_classification,
34
+ compute_weighted_contributions,
35
+ high_level3_rate,
36
+ run_logical_demonstrations,
37
+ )
38
+ from nested_recd.surrogates import (
39
+ iaaft_surrogate_1d,
40
+ phase_shuffle_independent,
41
+ random_permutation_independent,
42
+ generate_surrogate_ensemble,
43
+ compute_null_distribution,
44
+ )
45
+
46
+ __version__ = "0.1.0"
47
+
48
+ __all__ = [
49
+ "__version__",
50
+ "DEFAULT_M",
51
+ "DEFAULT_DELAY",
52
+ "DEFAULT_D_PERSIST",
53
+ "DEFAULT_WINDOW_TAU",
54
+ "DEFAULT_THETA_CHAOS",
55
+ "DEFAULT_THETA3",
56
+ "DELTA_FEIGENBAUM",
57
+ "generate_multivariate_symbols",
58
+ "compute_phi1",
59
+ "compute_phi2",
60
+ "compute_phi3",
61
+ "compute_lambda",
62
+ "alpha_weights",
63
+ "regime_lambda_proxy",
64
+ "compute_recd_from_conjunctions",
65
+ "simple_level_classification",
66
+ "compute_weighted_contributions",
67
+ "high_level3_rate",
68
+ "run_logical_demonstrations",
69
+ "iaaft_surrogate_1d",
70
+ "phase_shuffle_independent",
71
+ "random_permutation_independent",
72
+ "generate_surrogate_ensemble",
73
+ "compute_null_distribution",
74
+ ]