diff --git a/modules/spatiotemporal/README.md b/modules/spatiotemporal/README.md index 0bf47e1b87..4e8db2878f 100644 --- a/modules/spatiotemporal/README.md +++ b/modules/spatiotemporal/README.md @@ -32,7 +32,7 @@ Here, we describe the spatiotemporal modeling package. The goal of this package ## create_DAG.py -### create_DAG(state_dict) +### create_DAG(state_dict,input_dir='', scorestr='_scores.log', output_dir='',spatio_temporal_rule=False, subcomplexstr='.config',expected_subcomplexes=[],score_comp=False, exp_comp_map={},out_cdf=True, out_labeled_pdf=True, out_pdf=False, npaths=0,draw_dag=True) This functions streamlines the process of creating a graph by performing all the necessary steps and saving relevant input to files. Features of this function are walked through in example/toy/Simple_spatiotemporal_example.ipynb #### Possible inputs: diff --git a/modules/spatiotemporal/pyext/src/analysis.py b/modules/spatiotemporal/pyext/src/analysis.py index f16eecaea8..4ed5bd2b86 100644 --- a/modules/spatiotemporal/pyext/src/analysis.py +++ b/modules/spatiotemporal/pyext/src/analysis.py @@ -1,3 +1,6 @@ +"""@namespace IMP.spatiotemporal.analysis + Functions to analyze spatiotemporal models. +""" import numpy as np diff --git a/modules/spatiotemporal/pyext/src/composition_scoring.py b/modules/spatiotemporal/pyext/src/composition_scoring.py index 56582da35a..c7340828d6 100644 --- a/modules/spatiotemporal/pyext/src/composition_scoring.py +++ b/modules/spatiotemporal/pyext/src/composition_scoring.py @@ -1,3 +1,6 @@ +"""@namespace IMP.spatiotemporal.composition_scoring + Functions for weighting graphNode objects based on stoichiometry data. +""" import numpy as np import warnings import os diff --git a/modules/spatiotemporal/pyext/src/create_DAG.py b/modules/spatiotemporal/pyext/src/create_DAG.py index 569e96a826..ce9be9e5c5 100644 --- a/modules/spatiotemporal/pyext/src/create_DAG.py +++ b/modules/spatiotemporal/pyext/src/create_DAG.py @@ -1,3 +1,6 @@ +"""@namespace IMP.spatiotemporal.create_DAG + Simplified function for creating a spatiotemporal model. +""" import os import itertools import warnings diff --git a/modules/spatiotemporal/pyext/src/graphNode.py b/modules/spatiotemporal/pyext/src/graphNode.py index 6873c3f263..6adfd6fe0c 100644 --- a/modules/spatiotemporal/pyext/src/graphNode.py +++ b/modules/spatiotemporal/pyext/src/graphNode.py @@ -1,3 +1,7 @@ +"""@namespace IMP.spatiotemporal.graphNode + Defines the graphNode class. Each node corresponds to a snapshot model. + Nodes can be connected to create spatiotemporal models. +""" import numpy as np import os diff --git a/modules/spatiotemporal/pyext/src/score_graph.py b/modules/spatiotemporal/pyext/src/score_graph.py index b448662f6b..57060aa0f0 100644 --- a/modules/spatiotemporal/pyext/src/score_graph.py +++ b/modules/spatiotemporal/pyext/src/score_graph.py @@ -1,5 +1,5 @@ """@namespace IMP.spatiotemporal.score_graph - Function to traverse and score the graph. + Functions to traverse and score the spatiotemporal graphs. """ import numpy as np diff --git a/modules/spatiotemporal/pyext/src/write_output.py b/modules/spatiotemporal/pyext/src/write_output.py index e64edc2932..14ef27d031 100644 --- a/modules/spatiotemporal/pyext/src/write_output.py +++ b/modules/spatiotemporal/pyext/src/write_output.py @@ -1,3 +1,7 @@ +"""@namespace IMP.spatiotemporal.write_output + Functions to write spatiotemporal graph information to files. +""" + import numpy as np try: from graphviz import Digraph diff --git a/modules/spatiotemporal/test/test_make_graph.py b/modules/spatiotemporal/test/test_make_graph.py index 3f6b16032f..af8987affb 100644 --- a/modules/spatiotemporal/test/test_make_graph.py +++ b/modules/spatiotemporal/test/test_make_graph.py @@ -43,8 +43,6 @@ def test_graph_setup(self): nodes = [] # keys correspond to all timepoints keys = list(state_dict.keys()) - # Go to input_dir, if it exists - orig_dir = os.getcwd() if len(input_dir) > 0: if os.path.exists(input_dir): os.chdir(input_dir) @@ -74,8 +72,6 @@ def test_graph_setup(self): # check that all nodes are graphNode objects for node in nodes: self.assertIsInstance(node,graphNode.graphNode) - # Restore original working directory - os.chdir(orig_dir) def test_graph_scoring(self): """ @@ -152,7 +148,10 @@ def test_writing_output(self): line=check_label_pdf.readline() line_split=line.split() check_label_pdf.close() - self.assertEqual(line_split[0], '1_0min|2_5min|2_10min|') + # 2 possibilities are acceptable: '1_0min|2_5min|2_10min|','1_0min|2_5min|1_10min|'. Check this output in 3 parts: + self.assertEqual(line_split[0][0:14], '1_0min|2_5min|') + self.assertAlmostEqual(int(line_split[0][14]), 1.5,delta=0.5000001) + self.assertEqual(line_split[0][15:], '_10min|') def test_writing_dag(self): """