Skip to content
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 .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:

jobs:
build:
unit-tests:
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion examples/coral_reef/coral.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import os
import numpy
import sys
Expand Down
2 changes: 1 addition & 1 deletion examples/coral_reef/old/coral.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import math
import matplotlib.pyplot as plt
import numpy
Expand Down
17 changes: 0 additions & 17 deletions examples/cylinderDemo/SpatialPy_cylinderDemo3D.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -223,23 +223,6 @@
"%time result = sol.run()\n"
]
},
{
"cell_type": "code",
"execution_count": 60,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"{'Status': 'Success'}\n"
]
}
],
"source": [
"print(result)"
]
},
{
"cell_type": "code",
"execution_count": 12,
Expand Down
2 changes: 1 addition & 1 deletion examples/cylinderDemo/old/cylinder_demo3D.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
""" pyURDME model file for the annihilation cylinder 3D example. """

import os
Expand Down
2 changes: 1 addition & 1 deletion examples/cylinderDemo/old/ensemble_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from cylinder_demo3D import cylinderDemo3D
from pyurdme.nsmsolver import NSMSolver
import matplotlib.pyplot as plt
Expand Down
2 changes: 1 addition & 1 deletion examples/cylinderDemo/old/pickle_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from cylinder_demo3D import cylinderDemo3D
from pyurdme.nsmsolver import NSMSolver
import matplotlib.pyplot as plt
Expand Down
2 changes: 1 addition & 1 deletion examples/mincde/old/mincde.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import numpy
import os.path
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_diffusion/simple_diffusion2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
""" PyURDME model with one species diffusing in the unit circle and one
species diffusing on the boundary of the circle. Subdomains are
here handled by Dolfin's native subdomain model. """
Expand Down
2 changes: 1 addition & 1 deletion examples/yeast_polarization/G_protein_cycle.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
""" pyURDME model file for the polarization 1D example. """

import os
Expand Down
2 changes: 1 addition & 1 deletion examples/yeast_polarization/polarisome_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
""" pyURDME model file for the model found in Lawson et al. PloS Comp Bio (2013). """

import os
Expand Down
67 changes: 37 additions & 30 deletions spatialpy/Result.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
import filecmp
import math
import os
import re
import pickle
import shutil
import subprocess
import sys
import tempfile
import types
import warnings
import uuid


import numpy
import scipy.io
import scipy.sparse

from spatialpy.VTKReader import VTKReader
from spatialpy.Model import *

import inspect

import pickle
import json
import math


from spatialpy.VTKReader import VTKReader

common_rgb_values=['#1f77b4','#ff7f0e','#2ca02c','#d62728','#9467bd','#8c564b','#e377c2','#7f7f7f',
'#bcbd22','#17becf','#ff0000','#00ff00','#0000ff','#ffff00','#00ffff','#ff00ff',
Expand Down Expand Up @@ -94,16 +80,37 @@ def __init__(self, model=None, result_dir=None, loaddata=False):
# return model2


def __getstate__(self):
""" Used by pickle to get state when pickling. We need to read the contents of the
output file since we can't pickle file objects. """
#TODO
raise Exception('TODO: spatialpy.Result.__getstate__()');
def __eq__(self, other):
""" Compare Result object's output for equality. This does _NOT_ compare objects themselves

def __setstate__(self, state):
""" Used by pickle to set state when unpickling. """
#TODO
raise Exception('TODO: spatialpy.Result.__setstate__()');
Params:
self: Results object
other: Results object to compare against
Return:
bool """

if isinstance(other, Result) and self.result_dir != None and other.result_dir != None:
# Compare contents, not shallow compare
filecmp.cmpfiles.__defaults__ = (False,)
dircmp = filecmp.dircmp(self.result_dir, other.result_dir)
# Raise exception if funny_files
assert not dircmp.funny_files
if not (dircmp.left_only or dircmp.right_only or dircmp.funny_files or dircmp.diff_files):
return True
return False
return NotImplemented

def __ne__(self, other):
""" Compare Result object's output for inequality. This does _NOT_ compare objects themselves.
This inverts the logic in __eq__().

Params:
self: Results object
other: Results object to compare against
Return:
bool """

return not self.__eq__(other)


def read_step(self, step_num, debug=False):
Expand Down Expand Up @@ -155,7 +162,7 @@ def get_species(self, species, timepoints=None, concentration=False, determinist

#t_index_arr = numpy.linspace(0,self.model.num_timesteps,
# num=self.model.num_timesteps+1, dtype=int)
t_index_arr = self.get_timespan();
t_index_arr = self.get_timespan()

if timepoints is not None:
if isinstance(timepoints,float):
Expand Down Expand Up @@ -257,7 +264,7 @@ def plot_species(self, species, t_ndx=0, concentration=False, deterministic=Fals

if use_matplotlib:
import matplotlib.pyplot as plt

if (deterministic or not concentration):
d = data[spec_name]
else:
Expand Down Expand Up @@ -496,7 +503,7 @@ def plot_property(self, property_name, t_ndx=0, p_ndx=0, width=500, height=500,

if use_matplotlib:
import matplotlib.pyplot as plt

if (property_name == 'v'):
d = data[property_name]
d = [d[i][p_ndx] for i in range(0,len(d))]
Expand Down
2 changes: 1 addition & 1 deletion test/ioperformance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
""" PyURDME model with one species diffusing in the unit circle and one
species diffusing on the boundary of the circle. Subdomains are
here handled by Dolfin's native subdomain model. """
Expand Down
2 changes: 1 addition & 1 deletion test/models/mincde.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

from spatialpy.Model import SpeciesError
import numpy
Expand Down
2 changes: 1 addition & 1 deletion test/models/mincde_5r.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
""" spatialpy model file for the MinCDE example. """

import os.path
Expand Down
2 changes: 1 addition & 1 deletion test/test_mincde.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

from models.mincde import mincde
from models.mincde_5r import MinCDE5R
Expand Down
Loading