-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from briandrawert/prerelease_1.0
Release 1.0
- Loading branch information
Showing
123 changed files
with
92,802 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,78 @@ | ||
pyurdme | ||
PyURDME | ||
======= | ||
|
||
Python API for URDME solvers | ||
PyURDME is a modeling and simulation toolkit for spatial stochastic simulations. It makes use of a modified version of the core solver of URDME (www.urdme.org) for mesocopic simulations via the Reaction-Diffusion Master Equation (RDME), and builds on Dolfin/FeniCS (http://fenicsproject.org) for geometric modeling, meshing and Finite Element Assembly. | ||
|
||
Currently supported (tested) platforms are MacOSX >= 10.8 and Ubuntu >= 12.04. | ||
|
||
## Dependencies | ||
|
||
To install and use pyurdme, you need to satisfy the following dependencies. Below we point at suggested ways to satisfy them for OSX and Ubuntu. | ||
|
||
- GCC: http://gcc.gnu.org/ | ||
* Ubuntu: | ||
+ apt-get install fenics | ||
* OSX: | ||
+ We recommend installing Xcode: https://developer.apple.com/xcode/. | ||
- FEniCS: http://fenicsproject.org/ | ||
* Ubuntu: | ||
+ apt-get install fenics | ||
* OSX: | ||
+ We recommend using the binary installer provided here: http://fenicsproject.org/download/osx_details.html | ||
- numpy, scipy, matplotlib: http://www.scipy.org/ | ||
* Ubuntu: | ||
+ apt-get install python-numpy python-scipy python-matplotlib | ||
* OSX: | ||
+ We recommend using the installer provided by http://fonnesbeck.github.io/ScipySuperpack/ | ||
|
||
- h5py: http://www.h5py.org/ | ||
* Ubuntu: | ||
+ apt-get intall python-h5py | ||
* OSX: | ||
+ brew install h5py | ||
|
||
Note: We strongly recommend using the appropriate package manager or binary installer for your platform to satisfy the above dependencies. However, we understand that some users prefer a non-system-wide installation of python packages, such as if using virtualenv. If one of the above listed dependencies is not satisfied, setuptools will try to install it from the PyPI index. For numpy, scipy, matplotlib, h5py this involves building from source. Due to the many non-python dependencies, you will likely need to install development versions of certain libraries (such as freetype and libpng). An easy way to satisfy the dependencies for Ubuntu is | ||
|
||
```bash | ||
sudo apt-get build-dep python-numpy python-scipy python-matplotlib | ||
``` | ||
|
||
If you do not mind system-wide installations, we provide a script to install all dependecies for Ubuntu, see detailed instructions below. | ||
|
||
## Installation | ||
|
||
### Ubuntu | ||
For Ubuntu, we provide a script that will install pyurdme and all dependecies. The install script must be run as root | ||
```bash | ||
git clone https://github.com/pyurdme/pyurdme | ||
cd pyurdme | ||
sudo ./install_ubuntu.sh | ||
``` | ||
|
||
If you want to manage the dependencies yourself, after installing them do: | ||
|
||
```bash | ||
git clone https://github.com/pyurdme/pyurdme.git | ||
cd pyurdme | ||
sudo python setup.py install | ||
|
||
``` | ||
or simply | ||
|
||
```bash | ||
sudo pip install https://github.com/pyurdme/pyurdme/tarball/master | ||
``` | ||
|
||
### OSX | ||
|
||
```bash | ||
git clone https://github.com/pyurdme/pyurdme.git | ||
cd pyurdme | ||
sudo python setup.py install | ||
``` | ||
|
||
or simply | ||
```bash | ||
sudo pip install https://github.com/pyurdme/pyurdme/tarball/master | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
0.1.0 | ||
------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: da6edf5adb65f4dbe6b77f6af3397ff8 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
|
||
|
||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
|
||
<title>Overview: module code — PyURDME 1.0 documentation</title> | ||
|
||
<link rel="stylesheet" href="../_static/default.css" type="text/css" /> | ||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> | ||
|
||
<script type="text/javascript"> | ||
var DOCUMENTATION_OPTIONS = { | ||
URL_ROOT: '../', | ||
VERSION: '1.0', | ||
COLLAPSE_INDEX: false, | ||
FILE_SUFFIX: '.html', | ||
HAS_SOURCE: true | ||
}; | ||
</script> | ||
<script type="text/javascript" src="../_static/jquery.js"></script> | ||
<script type="text/javascript" src="../_static/underscore.js"></script> | ||
<script type="text/javascript" src="../_static/doctools.js"></script> | ||
<link rel="top" title="PyURDME 1.0 documentation" href="../index.html" /> | ||
</head> | ||
<body> | ||
<div class="related"> | ||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="right" style="margin-right: 10px"> | ||
<a href="../genindex.html" title="General Index" | ||
accesskey="I">index</a></li> | ||
<li class="right" > | ||
<a href="../py-modindex.html" title="Python Module Index" | ||
>modules</a> |</li> | ||
<li><a href="../index.html">PyURDME 1.0 documentation</a> »</li> | ||
</ul> | ||
</div> | ||
|
||
<div class="document"> | ||
<div class="documentwrapper"> | ||
<div class="bodywrapper"> | ||
<div class="body"> | ||
|
||
<h1>All modules for which code is available</h1> | ||
<ul><li><a href="pyurdme/model.html">pyurdme.model</a></li> | ||
<li><a href="pyurdme/nsmsolver.html">pyurdme.nsmsolver</a></li> | ||
<li><a href="pyurdme/pyurdme.html">pyurdme.pyurdme</a></li> | ||
</ul> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
<div class="sphinxsidebar"> | ||
<div class="sphinxsidebarwrapper"> | ||
<div id="searchbox" style="display: none"> | ||
<h3>Quick search</h3> | ||
<form class="search" action="../search.html" method="get"> | ||
<input type="text" name="q" /> | ||
<input type="submit" value="Go" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
<p class="searchtip" style="font-size: 90%"> | ||
Enter search terms or a module, class or function name. | ||
</p> | ||
</div> | ||
<script type="text/javascript">$('#searchbox').show(0);</script> | ||
</div> | ||
</div> | ||
<div class="clearer"></div> | ||
</div> | ||
<div class="related"> | ||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="right" style="margin-right: 10px"> | ||
<a href="../genindex.html" title="General Index" | ||
>index</a></li> | ||
<li class="right" > | ||
<a href="../py-modindex.html" title="Python Module Index" | ||
>modules</a> |</li> | ||
<li><a href="../index.html">PyURDME 1.0 documentation</a> »</li> | ||
</ul> | ||
</div> | ||
<div class="footer"> | ||
© Copyright 2014, Brian Drawert, Andreas Hellander. | ||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b3. | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
|
||
|
||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
|
||
<title>pyurdme.gmsh — PyURDME 1.0 documentation</title> | ||
|
||
<link rel="stylesheet" href="../../_static/default.css" type="text/css" /> | ||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> | ||
|
||
<script type="text/javascript"> | ||
var DOCUMENTATION_OPTIONS = { | ||
URL_ROOT: '../../', | ||
VERSION: '1.0', | ||
COLLAPSE_INDEX: false, | ||
FILE_SUFFIX: '.html', | ||
HAS_SOURCE: true | ||
}; | ||
</script> | ||
<script type="text/javascript" src="../../_static/jquery.js"></script> | ||
<script type="text/javascript" src="../../_static/underscore.js"></script> | ||
<script type="text/javascript" src="../../_static/doctools.js"></script> | ||
<link rel="top" title="PyURDME 1.0 documentation" href="../../index.html" /> | ||
<link rel="up" title="Module code" href="../index.html" /> | ||
</head> | ||
<body> | ||
<div class="related"> | ||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="right" style="margin-right: 10px"> | ||
<a href="../../genindex.html" title="General Index" | ||
accesskey="I">index</a></li> | ||
<li class="right" > | ||
<a href="../../py-modindex.html" title="Python Module Index" | ||
>modules</a> |</li> | ||
<li><a href="../../index.html">PyURDME 1.0 documentation</a> »</li> | ||
<li><a href="../index.html" accesskey="U">Module code</a> »</li> | ||
</ul> | ||
</div> | ||
|
||
<div class="document"> | ||
<div class="documentwrapper"> | ||
<div class="bodywrapper"> | ||
<div class="body"> | ||
|
||
<h1>Source code for pyurdme.gmsh</h1><div class="highlight"><pre> | ||
<span class="sd">""" Wrappers for selected Gmsh functionality. """</span> | ||
<span class="kn">import</span> <span class="nn">subprocess</span> | ||
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span> | ||
|
||
<div class="viewcode-block" id="gmshGeometry"><a class="viewcode-back" href="../../pyurdme.html#pyurdme.gmsh.gmshGeometry">[docs]</a><span class="k">class</span> <span class="nc">gmshGeometry</span><span class="p">():</span> | ||
<span class="sd">""" Represent a Gmsh geometry. Wrapper around a Gmesh .geo file. """</span> | ||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="nb">file</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span> | ||
<span class="n">geomfile</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="nb">file</span><span class="p">)</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">geometry_file</span> <span class="o">=</span> <span class="n">geomfile</span><span class="o">.</span><span class="n">read</span><span class="p">()</span> | ||
<span class="n">geomfile</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> | ||
</div> | ||
<div class="viewcode-block" id="GmshMesh"><a class="viewcode-back" href="../../pyurdme.html#pyurdme.gmsh.GmshMesh">[docs]</a><span class="k">class</span> <span class="nc">GmshMesh</span><span class="p">():</span> | ||
|
||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">meshfile</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span> | ||
<span class="n">importmesh</span><span class="p">(</span><span class="n">meshfile</span><span class="p">)</span> | ||
|
||
<div class="viewcode-block" id="GmshMesh.refine"><a class="viewcode-back" href="../../pyurdme.html#pyurdme.gmsh.GmshMesh.refine">[docs]</a> <span class="k">def</span> <span class="nf">refine</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | ||
<span class="sd">""" Refine the mesh """</span> | ||
</div></div> | ||
<div class="viewcode-block" id="importMesh"><a class="viewcode-back" href="../../pyurdme.html#pyurdme.gmsh.importMesh">[docs]</a><span class="k">def</span> <span class="nf">importMesh</span><span class="p">(</span><span class="n">meshfile</span><span class="p">):</span> | ||
<span class="sd">""" Import a Gmsh .msh file. """</span> | ||
<span class="n">meshf</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">meshfile</span><span class="p">,</span><span class="s">'r'</span><span class="p">)</span> | ||
<span class="n">lines</span> <span class="o">=</span> <span class="n">meshf</span><span class="o">.</span><span class="n">readlines</span><span class="p">()</span> | ||
|
||
<span class="c"># Read number of nodes</span> | ||
<span class="k">for</span> <span class="n">lineno</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">lines</span><span class="p">)):</span> | ||
<span class="k">if</span> <span class="n">lines</span><span class="p">[</span><span class="n">lineno</span><span class="p">]</span><span class="o">==</span><span class="s">"$Nodes</span><span class="se">\n</span><span class="s">"</span><span class="p">:</span> | ||
<span class="k">break</span> | ||
<span class="n">lineno</span><span class="o">=</span><span class="n">lineno</span><span class="o">+</span><span class="mi">1</span> | ||
<span class="n">number_of_nodes</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">lines</span><span class="p">[</span><span class="n">lineno</span><span class="p">])</span> | ||
|
||
<span class="c"># Read the node values</span> | ||
<span class="n">p</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="mi">3</span><span class="p">,</span><span class="n">number_of_nodes</span><span class="p">))</span> | ||
<span class="c"># !!!! IT IS READING ONE NODE TOO LITTLE.</span> | ||
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">number_of_nodes</span><span class="p">):</span> | ||
<span class="n">line</span> <span class="o">=</span> <span class="n">lines</span><span class="p">[</span><span class="n">lineno</span><span class="o">+</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span> | ||
<span class="n">vtx</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">asmatrix</span><span class="p">(</span><span class="n">line</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span> | ||
<span class="n">p</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="n">i</span><span class="p">]</span><span class="o">=</span><span class="n">vtx</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span> | ||
<span class="n">p</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="n">i</span><span class="p">]</span><span class="o">=</span><span class="n">vtx</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">]</span> | ||
<span class="n">p</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="n">i</span><span class="p">]</span><span class="o">=</span><span class="n">vtx</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">]</span> | ||
|
||
<span class="n">lineno</span> <span class="o">=</span> <span class="n">lineno</span><span class="o">+</span><span class="n">number_of_nodes</span> | ||
<span class="k">if</span> <span class="n">lines</span><span class="p">[</span><span class="n">lineno</span><span class="p">]</span><span class="o">!=</span><span class="s">"$EndNodes"</span><span class="p">:</span> | ||
<span class="k">print</span> <span class="n">lines</span><span class="p">[</span><span class="n">lineno</span><span class="p">]</span> | ||
|
||
|
||
|
||
</div> | ||
<div class="viewcode-block" id="meshinit"><a class="viewcode-back" href="../../pyurdme.html#pyurdme.gmsh.meshinit">[docs]</a><span class="k">def</span> <span class="nf">meshinit</span><span class="p">(</span><span class="n">geometry</span><span class="p">):</span> | ||
<span class="c"># Write temporary geometry file</span> | ||
<span class="n">geometry_file_name</span><span class="o">=</span><span class="s">'.gmsh_temporary_geometry_file.geo'</span> | ||
<span class="n">geometry_file</span><span class="o">=</span><span class="nb">open</span><span class="p">(</span><span class="n">geometry_file_name</span><span class="p">,</span><span class="s">'w'</span><span class="p">)</span> | ||
<span class="n">geometry_file</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">geometry</span><span class="o">.</span><span class="n">geometry_file</span><span class="p">)</span> | ||
<span class="n">geometry_file</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> | ||
|
||
<span class="n">mesh_outfile_name</span> <span class="o">=</span> <span class="s">'.gmsh_temporary_mesh_file.msh'</span> | ||
<span class="n">mesh_outfile</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">mesh_outfile_name</span><span class="p">,</span><span class="s">'w'</span><span class="p">)</span> | ||
<span class="n">mesh_outfile</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> | ||
|
||
<span class="n">subprocess</span><span class="o">.</span><span class="n">call</span><span class="p">([</span><span class="s">'gmsh'</span><span class="p">,</span><span class="s">'-3'</span><span class="p">,</span><span class="s">'-optimize'</span><span class="p">,</span><span class="n">geometry_file_name</span><span class="p">,</span><span class="s">'-o'</span><span class="p">,</span><span class="n">mesh_outfile_name</span><span class="p">])</span> | ||
|
||
<span class="n">importMesh</span><span class="p">(</span><span class="n">mesh_outfile_name</span><span class="p">)</span> | ||
|
||
<span class="c"># Clean up</span> | ||
<span class="c">#subprocess.call(['rm','-rf',geometry_file_name])</span> | ||
<span class="c">#subprocess.call(['rm','-rf',mesh_outfile_name])</span> | ||
|
||
</div> | ||
<div class="viewcode-block" id="toDolfin"><a class="viewcode-back" href="../../pyurdme.html#pyurdme.gmsh.toDolfin">[docs]</a><span class="k">def</span> <span class="nf">toDolfin</span><span class="p">(</span><span class="n">mesh</span><span class="p">):</span> | ||
<span class="sd">""" Serialize a Gmsh mesh to Dolfin format. """</span> | ||
<span class="c"># TBD. </span></div> | ||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
<div class="sphinxsidebar"> | ||
<div class="sphinxsidebarwrapper"> | ||
<div id="searchbox" style="display: none"> | ||
<h3>Quick search</h3> | ||
<form class="search" action="../../search.html" method="get"> | ||
<input type="text" name="q" /> | ||
<input type="submit" value="Go" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
<p class="searchtip" style="font-size: 90%"> | ||
Enter search terms or a module, class or function name. | ||
</p> | ||
</div> | ||
<script type="text/javascript">$('#searchbox').show(0);</script> | ||
</div> | ||
</div> | ||
<div class="clearer"></div> | ||
</div> | ||
<div class="related"> | ||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="right" style="margin-right: 10px"> | ||
<a href="../../genindex.html" title="General Index" | ||
>index</a></li> | ||
<li class="right" > | ||
<a href="../../py-modindex.html" title="Python Module Index" | ||
>modules</a> |</li> | ||
<li><a href="../../index.html">PyURDME 1.0 documentation</a> »</li> | ||
<li><a href="../index.html" >Module code</a> »</li> | ||
</ul> | ||
</div> | ||
<div class="footer"> | ||
© Copyright 2014, Brian Drawert, Andreas Hellander. | ||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b3. | ||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.