Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing spatiotemporal documentation and tests #1091

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/spatiotemporal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions modules/spatiotemporal/pyext/src/analysis.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""@namespace IMP.spatiotemporal.analysis
Functions to analyze spatiotemporal models.
"""
import numpy as np


Expand Down
3 changes: 3 additions & 0 deletions modules/spatiotemporal/pyext/src/composition_scoring.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions modules/spatiotemporal/pyext/src/create_DAG.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""@namespace IMP.spatiotemporal.create_DAG
Simplified function for creating a spatiotemporal model.
"""
import os
import itertools
import warnings
Expand Down
4 changes: 4 additions & 0 deletions modules/spatiotemporal/pyext/src/graphNode.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion modules/spatiotemporal/pyext/src/score_graph.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions modules/spatiotemporal/pyext/src/write_output.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 4 additions & 5 deletions modules/spatiotemporal/test/test_make_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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):
"""
Expand Down
Loading