process-bigraph 0.0.33__tar.gz → 0.0.35__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.
Files changed (22) hide show
  1. {process-bigraph-0.0.33/process_bigraph.egg-info → process-bigraph-0.0.35}/PKG-INFO +1 -1
  2. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph/composite.py +6 -6
  3. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph/emitter.py +9 -3
  4. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph/tests.py +13 -0
  5. {process-bigraph-0.0.33 → process-bigraph-0.0.35/process_bigraph.egg-info}/PKG-INFO +1 -1
  6. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/setup.py +1 -1
  7. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/AUTHORS.md +0 -0
  8. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/LICENSE +0 -0
  9. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/README.md +0 -0
  10. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph/__init__.py +0 -0
  11. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph/experiments/__init__.py +0 -0
  12. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph/experiments/minimal_gillespie.py +0 -0
  13. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph/process_types.py +0 -0
  14. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph/processes/__init__.py +0 -0
  15. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph/processes/growth_division.py +0 -0
  16. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph/processes/parameter_scan.py +0 -0
  17. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph/protocols.py +0 -0
  18. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph.egg-info/SOURCES.txt +0 -0
  19. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph.egg-info/dependency_links.txt +0 -0
  20. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph.egg-info/requires.txt +0 -0
  21. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/process_bigraph.egg-info/top_level.txt +0 -0
  22. {process-bigraph-0.0.33 → process-bigraph-0.0.35}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: process-bigraph
3
- Version: 0.0.33
3
+ Version: 0.0.35
4
4
  Home-page: https://github.com/vivarium-collective/process-bigraph
5
5
  Author: Ryan Spangler, Eran Agmon
6
6
  Author-email: ryan.spangler@gmail.com, agmon.eran@gmail.com
@@ -401,6 +401,8 @@ class Composite(Process):
401
401
  def load(cls, path, core=None):
402
402
  with open(path) as data:
403
403
  document = json.load(data)
404
+ composition = document['composition']
405
+ document['composition'] = core.deserialize('schema', composition)
404
406
 
405
407
  composite = cls(
406
408
  document,
@@ -456,10 +458,6 @@ class Composite(Process):
456
458
  self.composition,
457
459
  edge_state)
458
460
 
459
- # self.state = deep_merge(
460
- # self.state,
461
- # edge_state)
462
-
463
461
  # TODO: call validate on this composite, not just check
464
462
  # assert self.core.validate(
465
463
  # self.composition,
@@ -511,6 +509,9 @@ class Composite(Process):
511
509
  self.composition,
512
510
  self.state)
513
511
 
512
+ def serialize_schema(self):
513
+ return self.core.serialize('schema', self.composition)
514
+
514
515
  def save(self,
515
516
  filename='composite.json',
516
517
  outdir='out',
@@ -531,8 +532,7 @@ class Composite(Process):
531
532
  document['state'] = serialized_state
532
533
 
533
534
  if schema:
534
- serialized_schema = self.core.representation(
535
- self.composition)
535
+ serialized_schema = self.serialize_schema()
536
536
  document['composition'] = serialized_schema
537
537
 
538
538
  # save the dictionary to a JSON file
@@ -234,19 +234,25 @@ class RAMEmitter(Emitter):
234
234
 
235
235
  return {}
236
236
 
237
- def query(self, query=None):
237
+ def query(self, query=None, schema=None):
238
238
  """
239
239
  Query the history of the emitter.
240
240
  :param query: a list of paths to query from the history. If None, the entire history is returned.
241
241
  :return: results of the query in a list
242
242
  """
243
+ schema = schema or self.inputs()
243
244
  if isinstance(query, list):
244
245
  results = []
245
246
  for t in self.history:
246
247
  result = {}
247
248
  for path in query:
248
- element = get_path(t, path)
249
- result = set_path(result, path, element)
249
+ _, state = self.core.slice(
250
+ schema=schema,
251
+ state=t,
252
+ path=path)
253
+
254
+ # element = get_path(t, path)
255
+ result = set_path(result, path, state)
250
256
  results.append(result)
251
257
  # element = get_path(self.history, path)
252
258
  # result = set_path(result, path, element)
@@ -610,6 +610,19 @@ def test_grow_divide(core):
610
610
  assert '0_0_0_0_1' in composite.state['environment']
611
611
  assert composite.state['environment']['0_0_0_0_1']['mass'] == composite.state['environment']['0_0_0_0_1']['grow_divide']['instance'].state['mass']
612
612
 
613
+ # check recursive schema reference
614
+ assert (id(composite.composition['environment']['_value']['grow_divide']) ==
615
+ id(composite.composition['environment']['_value']['grow_divide']['_outputs']['environment']['_value']['grow_divide']))
616
+
617
+ composite.save('test_grow_divide_saved.json')
618
+
619
+ c2 = Composite.load(
620
+ 'out/test_grow_divide_saved.json',
621
+ core=core)
622
+
623
+ assert (id(composite.composition['environment']['_value']['grow_divide']) ==
624
+ id(composite.composition['environment']['_value']['grow_divide']['_outputs']['environment']['_value']['grow_divide']))
625
+
613
626
 
614
627
  def test_gillespie_composite(core):
615
628
  composite_schema = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: process-bigraph
3
- Version: 0.0.33
3
+ Version: 0.0.35
4
4
  Home-page: https://github.com/vivarium-collective/process-bigraph
5
5
  Author: Ryan Spangler, Eran Agmon
6
6
  Author-email: ryan.spangler@gmail.com, agmon.eran@gmail.com
@@ -2,7 +2,7 @@ import re
2
2
  from setuptools import setup, find_packages
3
3
 
4
4
 
5
- VERSION = '0.0.33'
5
+ VERSION = '0.0.35'
6
6
 
7
7
 
8
8
  with open("README.md", "r") as readme: