medium-modulation 0.1.0__py3-none-any.whl

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,7 @@
1
+ """medium-modulation: Resonant medium between S∝A and S∝V."""
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ from .core import coupling_factor, modulated_entropy, resonance_spectrum
6
+
7
+ __all__ = ["coupling_factor", "modulated_entropy", "resonance_spectrum"]
@@ -0,0 +1,80 @@
1
+ """CLI mm – medium-modulation command-line interface."""
2
+
3
+ import numpy as np
4
+ import typer
5
+ from rich.console import Console
6
+ from rich.table import Table
7
+
8
+ from .core import coupling_factor, modulated_entropy, resonance_spectrum
9
+
10
+ app = typer.Typer(
11
+ help="medium-modulation CLI – fractal entropy coupling between S∝A and S∝V"
12
+ )
13
+ console = Console()
14
+
15
+
16
+ @app.command()
17
+ def modulate(
18
+ depth: float = typer.Option(0.5, help="Modulation depth in [0, 1]"),
19
+ freq: float = typer.Option(1.0, help="Modulation frequency (rad/s)"),
20
+ steps: int = typer.Option(100, help="Number of time steps over [0, 10]"),
21
+ s_a: float = typer.Option(1.0, help="Action-governed entropy S_A"),
22
+ s_v: float = typer.Option(1.618, help="Volume-governed entropy S_V"),
23
+ ) -> None:
24
+ """Apply fractal modulation to the S_A/S_V entropy duality."""
25
+ t_range = np.linspace(0, 10, steps)
26
+ s_mod = [modulated_entropy(s_a, s_v, depth, freq, ti) for ti in t_range]
27
+ arr = np.array(s_mod)
28
+
29
+ table = Table(title="Modulation Results")
30
+ table.add_column("Metric", style="cyan")
31
+ table.add_column("Value", style="green")
32
+ table.add_row("Mean S_mod", f"{arr.mean():.6f}")
33
+ table.add_row("Min S_mod", f"{arr.min():.6f}")
34
+ table.add_row("Max S_mod", f"{arr.max():.6f}")
35
+ table.add_row("Std S_mod", f"{arr.std():.6f}")
36
+ table.add_row("depth", str(depth))
37
+ table.add_row("freq", str(freq))
38
+ table.add_row("steps", str(steps))
39
+
40
+ console.print(table)
41
+
42
+
43
+ @app.command()
44
+ def spectrum(
45
+ f_min: float = typer.Option(0.1, help="Minimum frequency"),
46
+ f_max: float = typer.Option(10.0, help="Maximum frequency"),
47
+ n: int = typer.Option(50, help="Number of frequency points"),
48
+ depth: float = typer.Option(0.5, help="Modulation depth in [0, 1]"),
49
+ ) -> None:
50
+ """Show the resonance spectrum over a frequency range."""
51
+ freqs = np.linspace(f_min, f_max, n)
52
+ spec = resonance_spectrum(freqs, depth)
53
+
54
+ table = Table(title="Resonance Spectrum")
55
+ table.add_column("Metric", style="cyan")
56
+ table.add_column("Value", style="green")
57
+ table.add_row("Peak amplitude", f"{spec.max():.6f}")
58
+ table.add_row("Min amplitude", f"{spec.min():.6f}")
59
+ table.add_row("Mean amplitude", f"{spec.mean():.6f}")
60
+ table.add_row("Peak frequency", f"{freqs[spec.argmax()]:.4f} rad/s")
61
+
62
+ console.print(table)
63
+
64
+
65
+ @app.command()
66
+ def couple(
67
+ a: float = typer.Option(1.0, help="Action amplitude A"),
68
+ v: float = typer.Option(1.618, help="Volume amplitude V"),
69
+ depth: float = typer.Option(0.5, help="Modulation depth in [0, 1]"),
70
+ ) -> None:
71
+ """Compute dynamic coupling strength between action and volume."""
72
+ kappa = coupling_factor(a, v, modulation_depth=depth)
73
+ console.print(
74
+ f"[bold cyan]Coupling factor k(A={a}, V={v}, depth={depth}):[/] "
75
+ f"[green]{kappa:.6f}[/]"
76
+ )
77
+
78
+
79
+ if __name__ == "__main__":
80
+ app()
@@ -0,0 +1,75 @@
1
+ """Fractal modulation operators and resonance coupling for medium-modulation."""
2
+
3
+ import numpy as np
4
+ import sympy as sp
5
+
6
+ # Golden ratio – the natural coupling constant
7
+ _PHI = 0.618033988749895
8
+
9
+ t_sym, omega, phi_sym = sp.symbols("t omega phi", real=True, positive=True)
10
+ depth_sym = sp.symbols("depth", positive=True)
11
+
12
+ # Symbolic modulation operator M(t) = 1 + depth · sin(ωt + φ)
13
+ M = 1 + depth_sym * sp.sin(omega * t_sym + phi_sym)
14
+
15
+
16
+ def _duality_factor(S_A: float, S_V: float, alpha: float = _PHI) -> float:
17
+ """Weighted duality: α·S_A + (1-α)·S_V."""
18
+ return alpha * S_A + (1.0 - alpha) * S_V
19
+
20
+
21
+ def modulated_entropy(
22
+ S_A: float,
23
+ S_V: float,
24
+ depth: float = 0.5,
25
+ freq: float = 1.0,
26
+ t: float = 0.0,
27
+ ) -> float:
28
+ """Fractal medium modulation: S_mod = α·(S_A·M) + (1-α)·S_V.
29
+
30
+ Parameters
31
+ ----------
32
+ S_A: action-governed entropy
33
+ S_V: volume-governed entropy
34
+ depth: modulation depth ∈ [0, 1]
35
+ freq: modulation frequency (rad/s)
36
+ t: time point
37
+
38
+ Returns
39
+ -------
40
+ Modulated composite entropy value.
41
+ """
42
+ modulation = 1.0 + depth * np.sin(freq * t)
43
+ return _duality_factor(S_A * modulation, S_V, alpha=_PHI)
44
+
45
+
46
+ def resonance_spectrum(freqs: np.ndarray, depth: float = 0.5) -> np.ndarray:
47
+ """Resonance spectrum evaluated over a frequency array.
48
+
49
+ Parameters
50
+ ----------
51
+ freqs: 1-D array of frequencies
52
+ depth: modulation depth ∈ [0, 1]
53
+
54
+ Returns
55
+ -------
56
+ Array of resonance amplitudes.
57
+ """
58
+ freqs = np.asarray(freqs, dtype=float)
59
+ return 1.0 + depth * np.sin(2.0 * np.pi * freqs)
60
+
61
+
62
+ def coupling_factor(A: float, V: float, modulation_depth: float = 0.5) -> float:
63
+ """Dynamic coupling strength between action and volume at t=0.
64
+
65
+ Parameters
66
+ ----------
67
+ A: action amplitude
68
+ V: volume amplitude
69
+ modulation_depth: depth of the modulation operator
70
+
71
+ Returns
72
+ -------
73
+ Scalar coupling strength.
74
+ """
75
+ return modulated_entropy(A, V, depth=modulation_depth, freq=1.0, t=0.0)
@@ -0,0 +1,42 @@
1
+ """Bridge between medium-modulation and entropy-table domain registry."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+ import yaml
8
+
9
+
10
+ class MediumModulationBridge:
11
+ """Stores modulation relations and exports them to domains.yaml format."""
12
+
13
+ DOMAIN = "medium-modulation"
14
+
15
+ def __init__(self) -> None:
16
+ self._relations: dict[str, float] = {}
17
+
18
+ def add_modulation(self, key: str, value: float) -> None:
19
+ """Register a named modulation value."""
20
+ self._relations[key] = float(value)
21
+
22
+ def export(self, filepath: Path | str = "domains.yaml") -> Path:
23
+ """Serialise relations to a YAML file and return the path."""
24
+ filepath = Path(filepath)
25
+ data: dict = {}
26
+
27
+ if filepath.exists():
28
+ with filepath.open() as fh:
29
+ data = yaml.safe_load(fh) or {}
30
+
31
+ data.setdefault("domains", {}).setdefault(self.DOMAIN, {}).update(
32
+ self._relations
33
+ )
34
+
35
+ with filepath.open("w") as fh:
36
+ yaml.safe_dump(data, fh, default_flow_style=False, allow_unicode=True)
37
+
38
+ return filepath
39
+
40
+ def relations(self) -> dict[str, float]:
41
+ """Return a copy of the currently registered relations."""
42
+ return dict(self._relations)
@@ -0,0 +1,98 @@
1
+ Metadata-Version: 2.4
2
+ Name: medium-modulation
3
+ Version: 0.1.0
4
+ Summary: Resonant medium between S∝A and S∝V – fractal modulation operators, resonance spectra and tunable interference for controlled information propagation.
5
+ Project-URL: Repository, https://github.com/GenesisAeon/medium-modulation
6
+ Project-URL: Issues, https://github.com/GenesisAeon/medium-modulation/issues
7
+ Author-email: GenesisAeon Team <team@genesisaeon.org>
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Requires-Python: >=3.11
11
+ Requires-Dist: entropy-governance>=0.1.0
12
+ Requires-Dist: entropy-table>=1.0.1
13
+ Requires-Dist: implosive-genesis>=0.4.0
14
+ Requires-Dist: numpy>=2.0.0
15
+ Requires-Dist: rich>=13.0.0
16
+ Requires-Dist: sympy>=1.13.0
17
+ Requires-Dist: typer>=0.15.0
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
20
+ Requires-Dist: pytest>=8.0; extra == 'dev'
21
+ Requires-Dist: ruff>=0.9; extra == 'dev'
22
+ Provides-Extra: docs
23
+ Requires-Dist: mkdocs-material>=9.5.0; extra == 'docs'
24
+ Requires-Dist: mkdocs>=1.6.0; extra == 'docs'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # medium-modulation
28
+
29
+ **The resonant medium between action and expanse.**
30
+
31
+ [![CI](https://github.com/GenesisAeon/medium-modulation/actions/workflows/ci.yml/badge.svg)](https://github.com/GenesisAeon/medium-modulation/actions/workflows/ci.yml)
32
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org)
33
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
34
+
35
+ medium-modulation serves as the dynamic coupling layer that modulates the fundamental duality of the GenesisAeon framework: action-governed entropy production (S ∝ A) versus volume-governed informational expansion (S ∝ V).
36
+
37
+ Through fractal modulation operators, resonance spectra, and tunable interference fields, it turns raw tension into coherent emergence.
38
+
39
+ ---
40
+
41
+ ## Install
42
+
43
+ ```bash
44
+ pip install medium-modulation
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ ```bash
50
+ mm modulate --depth 0.7 --freq 2.3
51
+ mm spectrum
52
+ ```
53
+
54
+ ## API
55
+
56
+ ```python
57
+ from medium_modulation.core import modulated_entropy, resonance_spectrum, coupling_factor
58
+ import numpy as np
59
+
60
+ # Fractal medium modulation
61
+ S_mod = modulated_entropy(S_A=1.0, S_V=1.618, depth=0.5, freq=1.0, t=0.0)
62
+
63
+ # Resonance spectrum over frequency range
64
+ freqs = np.linspace(0.1, 10, 50)
65
+ spec = resonance_spectrum(freqs, depth=0.5)
66
+
67
+ # Dynamic coupling strength
68
+ kappa = coupling_factor(A=1.0, V=1.618, modulation_depth=0.5)
69
+ ```
70
+
71
+ ## Architecture
72
+
73
+ ```
74
+ medium-modulation/
75
+ ├── src/medium_modulation/
76
+ │ ├── core.py # Modulation operator + fractal coupling
77
+ │ ├── cli.py # CLI mm
78
+ │ └── entropy_table_bridge.py # entropy-table integration
79
+ ├── tests/
80
+ │ ├── test_core.py
81
+ │ └── test_cli.py
82
+ └── domains.yaml # Domain configuration
83
+ ```
84
+
85
+ ## Integrations
86
+
87
+ | Package | Role |
88
+ |---------|------|
89
+ | `entropy-governance` | Duality factor α·S_A + (1-α)·S_V |
90
+ | `entropy-table` | Domain relation registry |
91
+ | `implosive-genesis` | Fractal emergence substrate |
92
+
93
+ **DOI** (after Zenodo release): 10.5281/zenodo.XXXXXXX
94
+ **PyPI**: https://pypi.org/project/medium-modulation/
95
+
96
+ ---
97
+
98
+ Built with [SymPy](https://www.sympy.org/) · [NumPy](https://numpy.org/) · [Typer](https://typer.tiangolo.com/) · [Rich](https://rich.readthedocs.io/)
@@ -0,0 +1,9 @@
1
+ medium_modulation/__init__.py,sha256=p7yFwOlArb1OxR2HT70F_x_hIlfKzuDbtWGXcs7ChZY,244
2
+ medium_modulation/cli.py,sha256=5QH7zP7G-R6im_ZhhK64QI4A0CmRcioDUINMbUKiDB8,2944
3
+ medium_modulation/core.py,sha256=2jhaRe6ha4XCHwChzFJjm-4FLhL9Kz91zTpOP6llAeI,2137
4
+ medium_modulation/entropy_table_bridge.py,sha256=ew6yXsQUQnL4EVcgRNZwgSAB44y8IA7HAuXQKSbM0AQ,1301
5
+ medium_modulation-0.1.0.dist-info/METADATA,sha256=m2pjtlDN9uXIxJ7VsakegWziSKEpSj5om5E9J4fQ1Uo,3296
6
+ medium_modulation-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
7
+ medium_modulation-0.1.0.dist-info/entry_points.txt,sha256=qu6E4pMJdLgXkgtEY9h_gZLEsW8qpxgFT2OwtT9XO_8,49
8
+ medium_modulation-0.1.0.dist-info/licenses/LICENSE,sha256=wSqMUOfr3YalZyMoR93_W327v9D9Z0BeOg5-DFn4g1g,1090
9
+ medium_modulation-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mm = medium_modulation.cli:app
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 JohannRömer
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.