Skip to content

Commit

Permalink
add processes module
Browse files Browse the repository at this point in the history
  • Loading branch information
eagmon committed Sep 7, 2024
1 parent 955756c commit ee28d60
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 18 deletions.
3 changes: 1 addition & 2 deletions process_bigraph/experiments/comets.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import numpy as np
from pathlib import Path
import matplotlib.pyplot as plt
from scipy.ndimage import convolve
import cobra
from cobra.io import load_model

from process_bigraph import Process, ProcessTypes, Composite
from process_bigraph.experiments.parameter_scan import RunProcess
from process_bigraph.processes.parameter_scan import RunProcess


# create new types
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,14 @@ class ToySystem(Process):
'kdeg': 'float',
'ksynth': 'float'}}}


def inputs(self):
return {
'species': 'map[float]'}


def outputs(self):
return {
'species': 'map[float]'}


def update(self, inputs, interval):
species = {
key: input * (self.config['rates'][key]['ksynth'] - self.config['rates'][key]['kdeg'])
Expand All @@ -59,7 +56,6 @@ def update(self, inputs, interval):
class ODE(Process):
config_schema = 'ode_config'


def __init__(self, config, core):
super().__init__(config, core)

Expand All @@ -72,17 +68,14 @@ def __init__(self, config, core):
self.species_count,
self.species_count)


def inputs(self):
return {
'species': f'array[({self.species_count}), float]'}


def outputs(self):
return {
'species': f'array[({self.species_count}), float]'}


def update(self, state, interval):
total = np.dot(
self.config['rates'],
Expand All @@ -100,7 +93,6 @@ class RunProcess(Step):
'timestep': 'float',
'runtime': 'float'}


def __init__(self, config, core):
super().__init__(config, core)

Expand Down Expand Up @@ -187,18 +179,15 @@ def __init__(self, config, core):

self.composite = Composite(composite_config, core=core)


def inputs(self):
return self.process.inputs()


def outputs(self):
return {
'results': dict(
{'time': 'list[float]'},
**self.results_schema)}


def update(self, inputs):
# TODO: instead of the composite being a reference it is instead read through
# some port and lives in the state of the simulation (??)
Expand Down Expand Up @@ -265,7 +254,6 @@ class ParameterScan(Step):
'timestep': 'float',
'runtime': 'float'}


def __init__(self, config, core):
super().__init__(config, core)

Expand Down Expand Up @@ -338,18 +326,15 @@ def __init__(self, config, core):

self.results_schema = results_schema


def first_process(self):
for key, value in self.scan.state.items():
if key.startswith('process_'):
return value['instance'].composite.state['process']['instance']


def outputs(self):
return {
'results': self.results_schema}


def update(self, inputs):
results = self.scan.update({}, 0.0)

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup, find_packages


VERSION = '0.0.20'
VERSION = '0.0.21'


with open("README.md", "r") as readme:
Expand All @@ -29,6 +29,7 @@
# packages=find_packages(),
packages=[
'process_bigraph',
'process_bigraph.processes',
],
classifiers=[
"Development Status :: 3 - Alpha",
Expand Down

0 comments on commit ee28d60

Please sign in to comment.