Skip to content

Commit

Permalink
tests are passing
Browse files Browse the repository at this point in the history
  • Loading branch information
prismofeverything committed Nov 14, 2024
1 parent b8995dc commit 377d951
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
28 changes: 14 additions & 14 deletions process_bigraph/composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ def deserialize_process(schema, encoded, core):


def deserialize_step(schema, encoded, core):
deserialized = encoded.copy()
if not encoded['address']:
return encoded
if not encoded:
deserialized = core.default(schema)
else:
deserialized = encoded.copy()

protocol = encoded['address'].split(':', 1)
if len(protocol) == 1:
return encoded
if not deserialized['address']:
return deserialized

protocol, address = encoded['address'].split(':', 1)
protocol, address = deserialized['address'].split(':', 1)

if 'instance' in deserialized:
instantiate = type(deserialized['instance'])
Expand All @@ -184,7 +184,7 @@ def deserialize_step(schema, encoded, core):

config = core.deserialize(
instantiate.config_schema,
encoded.get('config', {}))
deserialized.get('config', {}))

if not 'instance' in deserialized:
process = instantiate(config, core=core)
Expand Down Expand Up @@ -222,7 +222,7 @@ def deserialize_step(schema, encoded, core):
'_description': '',
# TODO: support reference to type parameters from other states
'address': 'protocol',
'config': 'tree[any]'},
'config': 'quote'},

# TODO: slice process to allow for navigating through a port
'process': {
Expand All @@ -238,7 +238,7 @@ def deserialize_step(schema, encoded, core):
# TODO: support reference to type parameters from other states
'interval': 'interval',
'address': 'protocol',
'config': 'tree[any]'}}
'config': 'quote'}}


BASE_PROTOCOLS = {
Expand Down Expand Up @@ -397,10 +397,10 @@ def __init__(self, config=None, core=None):
if config is None:
config = {}

# check that all keywords in config are in config_schema
for key in config.keys():
if key not in self.config_schema:
raise Exception(f'config key {key} not in config_schema for {self.__class__.__name__}')
# # check that all keywords in config are in config_schema
# for key in config.keys():
# if key not in self.config_schema:
# raise Exception(f'config key {key} not in config_schema for {self.__class__.__name__}')

# fill in defaults for config
self.config = self.core.fill(
Expand Down
1 change: 1 addition & 0 deletions process_bigraph/experiments/growth_division.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def generate_bridge(schema, state, interval=1.0):
for port in ['inputs', 'outputs']}

config = {
'_type': 'quote',
'state': state,
'bridge': bridge}

Expand Down
3 changes: 2 additions & 1 deletion process_bigraph/processes/parameter_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ 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 (??)
self.composite.merge(
self.inputs(),
inputs)

self.composite.run(
Expand Down Expand Up @@ -325,7 +326,7 @@ def update(self, inputs):

for observable in self.config['observables']:
subschema = self.results_schema[key]
value_schema, value = core.slice(
value_schema, value = self.core.slice(
subschema,
values,
observable)
Expand Down
10 changes: 4 additions & 6 deletions process_bigraph/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def test_emitter(core):
# TODO: support omit as well as emit


def test_run_process():
def test_run_process(core):
timestep = 0.1
runtime = 10.0
initial_A = 11.11
Expand Down Expand Up @@ -470,7 +470,7 @@ def test_run_process():
assert results[0]['results']['species'][0]['A'] == initial_A


def test_nested_wires():
def test_nested_wires(core):
timestep = 0.1
runtime = 10.0
initial_A = 11.11
Expand Down Expand Up @@ -507,7 +507,7 @@ def test_nested_wires():
assert results[0]['results']['species']['A'][0] == initial_A


def test_parameter_scan():
def test_parameter_scan(core):
# TODO: make a parameter scan with a biosimulator process,
# ie - Copasi

Expand Down Expand Up @@ -547,7 +547,7 @@ def test_parameter_scan():
result = scan.update({}, 0.0)


def test_composite_workflow():
def test_composite_workflow(core):
# TODO: Make a workflow with a composite inside
pass

Expand All @@ -566,8 +566,6 @@ def test_grow_divide(core):
'mass': initial_mass,
'grow_divide': grow_divide}}}

import ipdb; ipdb.set_trace()

composite = Composite({
'state': environment},
core=core)
Expand Down

0 comments on commit 377d951

Please sign in to comment.