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 VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
0.1.0
6 changes: 3 additions & 3 deletions build_docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
# built documents.
#
# The short X.Y version.
version = '1.0'
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '1.0.0'
release = '0.1.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -270,7 +270,7 @@
epub_copyright = u'2019, Brian Drawert, Evie Hilton'

# The basename for the epub file. It defaults to the project name.
#epub_basename = u'PyURDME'
#epub_basename = u'SpatialPy'

# The HTML theme for the epub output. Since the default themes are not optimized
# for small screen space, using the same theme for HTML and epub output is
Expand Down
2 changes: 1 addition & 1 deletion build_docs/examples_coral_reef.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PyURDME Example: Coral Reef
SpatialPy Example: Coral Reef
=============================

Introduction
Expand Down
8 changes: 4 additions & 4 deletions build_docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
.. PyURDME documentation master file, created by
.. SpatialPy documentation master file, created by
sphinx-quickstart on Mon Apr 21 11:09:45 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to PyURDME's documentation!
Welcome to SpatialPy's documentation!
===================================

PyURDME is a general software framework for modeling and simulation of stochastic reaction-diffusion processes on unstructured, tetrahedral (3D) and triangular (2D) meshes. Unstructured meshes allow for a more flexible handling of complex geometries compared to structured, Cartesian meshes. The current core simulation algorithm is based on the mesoscopic reaction-diffusion master equation (RDME) model.
SpatialPy is a general software framework for modeling and simulation of stochastic reaction-diffusion processes on unstructured, tetrahedral (3D) and triangular (2D) meshes. Unstructured meshes allow for a more flexible handling of complex geometries compared to structured, Cartesian meshes. The current core simulation algorithm is based on the mesoscopic reaction-diffusion master equation (RDME) model.

PyURDME was originally based on the URDME software package, but has been completely rewritten in python and updated. It depends on the FEniCS libraries for mesh generation and assembly, see http://fenicsproject.org/. The core simulation routines are implemented in C, and requires GCC for compilation. The default solver is an efficient implementation of the Next Subvolume Method (NSM).
SpatialPy was originally based on the PyURDME software package, and before that the URDME software. It has been rewritted to use the Smoothed Disapative Particles Dynamics formunlation for the discretization of the diffusion equation. The core simulation routines are implemented in C, and requires GCC for compilation. The default solver is an efficient implementation of the Next Subvolume Method (NSM).

Contents:

Expand Down
29 changes: 0 additions & 29 deletions build_docs/pyurdme.rst

This file was deleted.

21 changes: 21 additions & 0 deletions build_docs/spatialpy.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
SpatialPy API
===============

spatialpy module
----------------------

.. automodule:: spatialpy.spatialpy
:members:
:undoc-members:
:show-inheritance:


spatialpy.nsmsolver module
------------------------

.. automodule:: spatialpy.nsmsolver
:members:
:undoc-members:
:show-inheritance:


430 changes: 430 additions & 0 deletions examples/cylinderDemo/SpatialPy_cylinderDemo3D.ipynb

Large diffs are not rendered by default.

5,619 changes: 5,619 additions & 0 deletions examples/cylinderDemo/cylinder.xml

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions install_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
#!/usr/bin/env bash
apt-get -y update
apt-get -y install git
apt-get -y install build-essential python-dev
apt-get -y install python-setuptools
apt-get -y install python-matplotlib python-numpy python-scipy
apt-get -y install make
apt-get -y install python-software-properties
add-apt-repository ppa:fenics-packages/fenics
apt-get update
apt-get -y install fenics
apt-get -y install cython python-h5py
python setup.py install
92 changes: 79 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,89 @@
from setuptools import setup
from setuptools import setup, find_packages
from setuptools.command.develop import develop
from setuptools.command.install import install
from setuptools.command.bdist_egg import bdist_egg
from setuptools.command.easy_install import easy_install
import os

SETUP_DIR = os.path.dirname(os.path.abspath(__file__))


def stoch_path(command_subclass):
"""
A decorator for classes subclassing one of the setuptools commands.
It modifies the run() method.
"""
orig_run = command_subclass.run

def modified_run(self):
success = False
orig_run(self)

command_subclass.run = modified_run
return command_subclass


# update all install classes with our new class
@stoch_path
class develop_new(develop):
pass


@stoch_path
class install_new(install):
pass


@stoch_path
class bdist_egg_new(bdist_egg):
pass


@stoch_path
class easy_install_new(easy_install):
pass


with open('README.md', 'r') as fh:
full_description = fh.read()



setup(name="spatialpy",
version="1.1.1",
version="0.1.0",
packages=['spatialpy'],

include_package_data = True,
#package_data={'spatialpy':['data/*.c','data/three.js_templates/js/*','data/three.js_templates/*.html','spatialpy/AUTHORS','spatialpy/LICENCE','spatialpy/bin/*','spatialpy/build/*','spatialpy/include/*','spatialpy/src/*.c','spatialpy/src/nsm/*']},

#include_package_data = True,
package_data={'spatialpy':['data/*.c','data/three.js_templates/js/*','data/three.js_templates/*.html','spatialpy/AUTHORS','spatialpy/LICENCE','spatialpy/bin/*','spatialpy/build/*','spatialpy/include/*','spatialpy/src/*.c','spatialpy/src/nsm/*']},

description='Python Interface for Spatial Stochastic Biochemical Simulations',

install_requires = ["numpy",
"scipy",
"h5py"],
"scipy"],

author="Brian Drawert",
author="Evie Hilton",
author_email=["[email protected]"],
author_email=["[email protected]"],
author="Brian Drawert, Evie Hilton",
author_email="[email protected]",
license = "GPL",
keywords = "spatialpy, spatial stochastic simulation, RDME",


url="https://spatialpy.github.io/SpatialPy/",
download_url="https://github.com/SpatialPy/SpatialPy/tarball/master/",


cmdclass={'bdist_egg': bdist_egg_new,
'install': install_new,
'develop': develop_new,
'easy_install': easy_install_new},
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Chemistry',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Medical Science Apps.',
'Intended Audience :: Science/Research'
],

)

22 changes: 22 additions & 0 deletions spatialpy/DataFunction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import spatialpy


class DataFunction():
""" Abstract class used to constuct the data vector. """
name = None
def __init__(self, name=None):
if name is not None:
self.name = name
if self.name is None:
raise Exception("DataFunction must have a 'name'")

def map(self, x):
""" map() takes the coordinate 'x' and returns a double.
Args:
x: a list of 3 ints.
Returns:
A float
"""
raise Exception("DataFunction.map() not implemented.")


45 changes: 45 additions & 0 deletions spatialpy/InitialCondition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import numpy


class InitialCondition():
""" Class used to defined initial conditions in SpatialPy.
SubClasses must implement the 'apply(model)' method, which
direction modifies the model.u0[species,voxel] matrix.
"""

def apply(self, model):
raise ModelError("spatialpy.InitialCondition subclasses must implement apply()")


class ScatterInitialCondition(InitialCondition):

def __init__(self, species, count, subdomains=None):
""" Scatter 'count' of 'species' randomly over the list of subdomains
(all subdomains if None)."""
self.species = species
self.count = count
self.subdomains = subdomains

def apply(self, model):

spec_name = self.species.name
for spec_ndx in range(len(model.listOfSpecies)):
if model.listOfSpecies[spec_ndx] = self.species: break

if self.subdomains is None:
nvox = model.mesh.get_num_voxels()
for mol in range(self.count):
vtx = numpy.random.randint(0, nvox)
self.u0[spec_ndx, vtx] += 1
else:
allowed_voxels = []
for i in range(model.mesh.get_num_voxels()):
if model.sd[i] in self.subdomains:
allowed_voxels.append(i)
nvox = len(alowed_voxels)
if nvox==0: raise ModelError("ScatterInitialCondition has zero voxels to scatter in")
for mol in range(self.count):
v_ndx = numpy.random.randint(0, nvox)
vtx = allowed_voxels[v_ndx]
self.u0[spec_ndx, vtx] += 1

Loading