lunagen 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.
- lunagen-0.1.0/LICENSE +21 -0
- lunagen-0.1.0/MANIFEST.in +4 -0
- lunagen-0.1.0/PKG-INFO +101 -0
- lunagen-0.1.0/README.md +75 -0
- lunagen-0.1.0/docs/DOCUMENTACION.md +616 -0
- lunagen-0.1.0/examples/01_xylinus_optimize.py +98 -0
- lunagen-0.1.0/examples/02_lifespan_and_reproduction.py +20 -0
- lunagen-0.1.0/examples/03_new_organism.py +62 -0
- lunagen-0.1.0/examples/04_config.json +11 -0
- lunagen-0.1.0/examples/05_microalgae_lipids.py +105 -0
- lunagen-0.1.0/lunagen/__init__.py +28 -0
- lunagen-0.1.0/lunagen/__main__.py +31 -0
- lunagen-0.1.0/lunagen/engine.py +557 -0
- lunagen-0.1.0/lunagen/metrics.py +305 -0
- lunagen-0.1.0/lunagen/organism.py +248 -0
- lunagen-0.1.0/lunagen/presets.py +114 -0
- lunagen-0.1.0/lunagen/py.typed +0 -0
- lunagen-0.1.0/lunagen/responses.py +263 -0
- lunagen-0.1.0/lunagen/study.py +699 -0
- lunagen-0.1.0/lunagen/viz.py +1165 -0
- lunagen-0.1.0/lunagen.egg-info/PKG-INFO +101 -0
- lunagen-0.1.0/lunagen.egg-info/SOURCES.txt +29 -0
- lunagen-0.1.0/lunagen.egg-info/dependency_links.txt +1 -0
- lunagen-0.1.0/lunagen.egg-info/entry_points.txt +2 -0
- lunagen-0.1.0/lunagen.egg-info/requires.txt +9 -0
- lunagen-0.1.0/lunagen.egg-info/top_level.txt +1 -0
- lunagen-0.1.0/pyproject.toml +50 -0
- lunagen-0.1.0/setup.cfg +4 -0
- lunagen-0.1.0/tests/legacy_bacillus_model.py +1042 -0
- lunagen-0.1.0/tests/test_library.py +98 -0
- lunagen-0.1.0/tests/test_regression.py +63 -0
lunagen-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Metzli-Aislinn Alvarez-Molotla
|
|
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.
|
lunagen-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: lunagen
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Simulación de cultivos basada en agentes: configurable, optimizable y con visualización en vivo.
|
|
5
|
+
Author-email: Metzli-Aislinn Alvarez-Molotla <metzli.alvarez23ibi@nube.unadmexico.mx>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://satsh.org/lunagen/
|
|
8
|
+
Project-URL: Documentation, https://satsh.org/lunagen/
|
|
9
|
+
Keywords: simulación,simulation,agent-based,basada en agentes,bioprocess,bioprocesos,optimización,optimization,celulosa bacteriana,bacterial cellulose,Komagataeibacter xylinus,cultivo,fermentación
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Natural Language :: Spanish
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
Provides-Extra: all
|
|
24
|
+
Provides-Extra: viz
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
|
|
27
|
+
# lunagen
|
|
28
|
+
|
|
29
|
+
**Simulación de cultivos basada en agentes: configurable, optimizable y con visualización en vivo.**
|
|
30
|
+
|
|
31
|
+
`lunagen` simula poblaciones de células una por una (metabolismo, crecimiento, división, muerte y
|
|
32
|
+
producción de uno o varios compuestos) y busca las condiciones de cultivo que maximizan lo que te
|
|
33
|
+
interese: celulosa bacteriana, etanol, otra biomasa, tiempo de vida, velocidad de reproducción…
|
|
34
|
+
|
|
35
|
+
El motor no sabe nada de ningún organismo concreto: **todo lo específico se declara** (variables,
|
|
36
|
+
respuestas al entorno, productos, qué medir). Incluye un preset de *Komagataeibacter xylinus*
|
|
37
|
+
(celulosa bacteriana) y se pueden describir organismos nuevos en unas decenas de líneas.
|
|
38
|
+
|
|
39
|
+
## Instalación
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install lunagen # núcleo (solo requiere numpy)
|
|
43
|
+
pip install "lunagen[viz]" # + ventana en vivo (pygame y scipy)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
También se puede instalar desde el archivo `.whl`:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install lunagen-0.1.0-py3-none-any.whl
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Inicio rápido
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import lunagen as lg
|
|
56
|
+
|
|
57
|
+
if __name__ == "__main__": # necesario si usas varios procesos (workers > 1)
|
|
58
|
+
organismo = lg.presets.komagataeibacter_xylinus()
|
|
59
|
+
estudio = lg.Study(organismo, objective="yield[cellulose]", workers=4)
|
|
60
|
+
resultado = estudio.optimize(samples=60, generations=8, population=16, viz=True)
|
|
61
|
+
print(resultado.best_conditions, resultado.best_value)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Imprime en consola todo lo que hace, anima cada simulación en una ventana (`viz=True`) y escribe
|
|
65
|
+
`evaluations.csv`, `results.json` y `best_unity.xml` en la carpeta `output/`.
|
|
66
|
+
|
|
67
|
+
## Qué puedes hacer con pocas líneas
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
# Otra pregunta con el mismo organismo
|
|
71
|
+
lg.Study(org, objective="mean_lifespan_h", space=["temperature_c", "ph"]) # tiempo de vida
|
|
72
|
+
lg.Study(org, objective="doubling_time_h", direction="min") # reproducción
|
|
73
|
+
lg.Study(org, objective={"yield[cellulose]": 1.0, "survival_fraction": 2.0}, # varios objetivos
|
|
74
|
+
constraints=[("final_population", ">=", 100)]) # y restricciones
|
|
75
|
+
|
|
76
|
+
# Operar solo con algunas variables
|
|
77
|
+
lg.Study(org, space=["temperature_c", "ph"], fixed={"glucose_gl": 30})
|
|
78
|
+
|
|
79
|
+
# Una métrica propia
|
|
80
|
+
@lg.metric("viabilidad", unit="%")
|
|
81
|
+
def viabilidad(result, cond, ctx):
|
|
82
|
+
return 100 * result.final_alive / max(1, result.peak_alive)
|
|
83
|
+
|
|
84
|
+
# Sin escribir código: un archivo JSON
|
|
85
|
+
lg.run("config.json") # o en la terminal: lunagen config.json
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Documentación
|
|
89
|
+
|
|
90
|
+
La documentación completa en español (conceptos, referencia de la API, cómo describir un organismo
|
|
91
|
+
nuevo, calibración, ventana en vivo, exportación y publicación) está en
|
|
92
|
+
<https://satsh.org/lunagen/>.
|
|
93
|
+
|
|
94
|
+
## Fiabilidad
|
|
95
|
+
|
|
96
|
+
Las pruebas incluidas comparan la librería con el modelo original del que nació: con las mismas
|
|
97
|
+
condiciones y semilla, los resultados son **idénticos bit a bit**. Ejecuta `python tests/test_regression.py`.
|
|
98
|
+
|
|
99
|
+
## Licencia
|
|
100
|
+
|
|
101
|
+
MIT (ver `LICENSE`).
|
lunagen-0.1.0/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# lunagen
|
|
2
|
+
|
|
3
|
+
**Simulación de cultivos basada en agentes: configurable, optimizable y con visualización en vivo.**
|
|
4
|
+
|
|
5
|
+
`lunagen` simula poblaciones de células una por una (metabolismo, crecimiento, división, muerte y
|
|
6
|
+
producción de uno o varios compuestos) y busca las condiciones de cultivo que maximizan lo que te
|
|
7
|
+
interese: celulosa bacteriana, etanol, otra biomasa, tiempo de vida, velocidad de reproducción…
|
|
8
|
+
|
|
9
|
+
El motor no sabe nada de ningún organismo concreto: **todo lo específico se declara** (variables,
|
|
10
|
+
respuestas al entorno, productos, qué medir). Incluye un preset de *Komagataeibacter xylinus*
|
|
11
|
+
(celulosa bacteriana) y se pueden describir organismos nuevos en unas decenas de líneas.
|
|
12
|
+
|
|
13
|
+
## Instalación
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install lunagen # núcleo (solo requiere numpy)
|
|
17
|
+
pip install "lunagen[viz]" # + ventana en vivo (pygame y scipy)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
También se puede instalar desde el archivo `.whl`:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install lunagen-0.1.0-py3-none-any.whl
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Inicio rápido
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
import lunagen as lg
|
|
30
|
+
|
|
31
|
+
if __name__ == "__main__": # necesario si usas varios procesos (workers > 1)
|
|
32
|
+
organismo = lg.presets.komagataeibacter_xylinus()
|
|
33
|
+
estudio = lg.Study(organismo, objective="yield[cellulose]", workers=4)
|
|
34
|
+
resultado = estudio.optimize(samples=60, generations=8, population=16, viz=True)
|
|
35
|
+
print(resultado.best_conditions, resultado.best_value)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Imprime en consola todo lo que hace, anima cada simulación en una ventana (`viz=True`) y escribe
|
|
39
|
+
`evaluations.csv`, `results.json` y `best_unity.xml` en la carpeta `output/`.
|
|
40
|
+
|
|
41
|
+
## Qué puedes hacer con pocas líneas
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
# Otra pregunta con el mismo organismo
|
|
45
|
+
lg.Study(org, objective="mean_lifespan_h", space=["temperature_c", "ph"]) # tiempo de vida
|
|
46
|
+
lg.Study(org, objective="doubling_time_h", direction="min") # reproducción
|
|
47
|
+
lg.Study(org, objective={"yield[cellulose]": 1.0, "survival_fraction": 2.0}, # varios objetivos
|
|
48
|
+
constraints=[("final_population", ">=", 100)]) # y restricciones
|
|
49
|
+
|
|
50
|
+
# Operar solo con algunas variables
|
|
51
|
+
lg.Study(org, space=["temperature_c", "ph"], fixed={"glucose_gl": 30})
|
|
52
|
+
|
|
53
|
+
# Una métrica propia
|
|
54
|
+
@lg.metric("viabilidad", unit="%")
|
|
55
|
+
def viabilidad(result, cond, ctx):
|
|
56
|
+
return 100 * result.final_alive / max(1, result.peak_alive)
|
|
57
|
+
|
|
58
|
+
# Sin escribir código: un archivo JSON
|
|
59
|
+
lg.run("config.json") # o en la terminal: lunagen config.json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Documentación
|
|
63
|
+
|
|
64
|
+
La documentación completa en español (conceptos, referencia de la API, cómo describir un organismo
|
|
65
|
+
nuevo, calibración, ventana en vivo, exportación y publicación) está en
|
|
66
|
+
<https://satsh.org/lunagen/>.
|
|
67
|
+
|
|
68
|
+
## Fiabilidad
|
|
69
|
+
|
|
70
|
+
Las pruebas incluidas comparan la librería con el modelo original del que nació: con las mismas
|
|
71
|
+
condiciones y semilla, los resultados son **idénticos bit a bit**. Ejecuta `python tests/test_regression.py`.
|
|
72
|
+
|
|
73
|
+
## Licencia
|
|
74
|
+
|
|
75
|
+
MIT (ver `LICENSE`).
|