Skip to content

Commit

Permalink
Merge branch 'main' into nondefault-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
eagmon committed Dec 5, 2024
2 parents 934e4d9 + 61c0650 commit bdf45bc
Show file tree
Hide file tree
Showing 12 changed files with 1,007 additions and 888 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.python-version
.ipynb_checkpoints/
spatio_flux.egg-info/
__pycache__/
out/
652 changes: 278 additions & 374 deletions demo/particle_comets.ipynb

Large diffs are not rendered by default.

27 changes: 19 additions & 8 deletions spatio_flux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"""

from process_bigraph import ProcessTypes

# make type system
core = ProcessTypes()
from spatio_flux.processes import register_processes


def apply_non_negative(schema, current, update, core):
Expand All @@ -17,13 +15,26 @@ def apply_non_negative(schema, current, update, core):
positive_float = {
'_type': 'positive_float',
'_inherit': 'float',
'_apply': apply_non_negative
}
core.register('positive_float', positive_float)
'_apply': apply_non_negative}


bounds_type = {
'lower': 'maybe[float]',
'upper': 'maybe[float]'
'upper': 'maybe[float]'}


particle_type = {
'id': 'string',
'position': 'tuple[float,float]',
'size': 'float',
'local': 'map[float]',
'exchange': 'map[float]', # {mol_id: delta_value}
}
core.register_process('bounds', bounds_type)


def register_types(core):
core.register('positive_float', positive_float)
core.register('bounds', bounds_type)
core.register('particle', particle_type)

return register_processes(core)
13 changes: 13 additions & 0 deletions spatio_flux/processes/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from spatio_flux.processes.dfba import DynamicFBA
from spatio_flux.processes.diffusion_advection import DiffusionAdvection
from spatio_flux.processes.particles import Particles, MinimalParticle


def register_processes(core):
core.register_process('DynamicFBA', DynamicFBA)
core.register_process('DiffusionAdvection', DiffusionAdvection)
core.register_process('Particles', Particles)
core.register_process('MinimalParticle', MinimalParticle)

return core

30 changes: 30 additions & 0 deletions spatio_flux/processes/comets.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,36 @@
'initial_min_max': {'glucose': (0, 10), 'acetate': (0, 0), 'biomass': (0, 0.1)},
}

## TODO -- maybe we need to make specific composites
class COMETS(Composite):
"""
This needs to declare what types of processes are in the composite.
"""
config_schema = {
'n_bins': 'tuple',
}

def __init__(self, config, core=None):
# set up the document here
state = {
'dFBA': {
'config': {
'n_bins': config['n_bins'],
}
},
'diffusion': {
'config': {
'something_else': config['n_bins'],
}
}
}

super().__init__(config, core=core)

# TODO -- this could be in Process.
def get_default(self):
return self.core.default(self.config_schema)


def run_comets(
total_time=10.0,
Expand Down
Loading

0 comments on commit bdf45bc

Please sign in to comment.