diff --git a/README.md b/README.md index 3eac99cc..2e6a4d93 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- +

SpatialPy is a Python 3 package for simulation of spatial deterministic/stochastic reaction-diffusion-advection problems embedded in Lagrangian reference frame particle based fluid dynamics domain @@ -7,7 +7,7 @@ SpatialPy is a Python 3 package for simulation of spatial deterministic/stochast This package is intended to replace the PyURDME software https://github.com/pyurdme/pyurdme and will feature both a NSM solver for RDME simulation on static domains and a sSSA-SDPD particle based fluid dynamics solver as described in the publication "A hybrid smoothed dissipative particle dynamics (SDPD) spatial stochastic simulation algorithm (sSSA) for advection–diffusion–reaction problems" by Drawert, Jacob, Li, Yi, Petzold https://www.sciencedirect.com/science/article/pii/S0021999118307101
- + PLEASE REGISTER AS A USER, so that we can prove SpatialPy has many users when we seek funding to support development. SpatialPy is part of the StochSS project.
@@ -25,9 +25,11 @@ Table of contents - [_Using the source code repository_](#using-the-source-code-repository) - [Usage](#usage) - [_Simple example to illustrate the use of SpatialPy_](#simple-example-to-illustrate-the-use-of-spatialpy) + - [Getting help](#getting-help) - [Contributing](#contributing) - [License](#license) @@ -72,8 +74,8 @@ SpatialPy provides simple object-oriented abstractions for defining a model of a The `run()` method can be customized using keyword arguments to select different solvers, random seed, data return type and more. For more detailed examples on how to use SpatialPy, please see the Jupyter notebooks contained in the [examples](https://github.com/StochSS/SpatialPy/tree/main/examples) subdirectory. - -### Docker environment + Getting help ------------ diff --git a/RELEASE_NOTES b/RELEASE_NOTES deleted file mode 100644 index 718c22b1..00000000 --- a/RELEASE_NOTES +++ /dev/null @@ -1,17 +0,0 @@ - RELEASE NOTES - SpatialPy - -These are release notes for SpatialPy. ----------------------------------------- -Date: 2/25/2021 -Version: 0.5.0+beta ----------------------------------------- -- Initial beta release ----------------------------------------- -Date: 3/9/2021 -Version: 0.5.1+beta ----------------------------------------- -- Added pickling Results -- Added add_mesh() function -- timespan() now includes option to set timestep size -- Added ability to read StochSS domains diff --git a/docs/build/html/.buildinfo b/docs/build/html/.buildinfo index ab4bd335..1a89b373 100644 --- a/docs/build/html/.buildinfo +++ b/docs/build/html/.buildinfo @@ -1,4 +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: 9eb3e1c2ecc65d7c728e939f73f722a8 +config: dcc482ab068f3e2527755562cc1c17ff tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/build/html/.doctrees/classes/spatialpy.core.doctree b/docs/build/html/.doctrees/classes/spatialpy.core.doctree index 3c9dfe51..7fd9b754 100644 Binary files a/docs/build/html/.doctrees/classes/spatialpy.core.doctree and b/docs/build/html/.doctrees/classes/spatialpy.core.doctree differ diff --git a/docs/build/html/.doctrees/classes/spatialpy.doctree b/docs/build/html/.doctrees/classes/spatialpy.doctree index 9c5f3485..7a400cbb 100644 Binary files a/docs/build/html/.doctrees/classes/spatialpy.doctree and b/docs/build/html/.doctrees/classes/spatialpy.doctree differ diff --git a/docs/build/html/.doctrees/classes/spatialpy.solvers.doctree b/docs/build/html/.doctrees/classes/spatialpy.solvers.doctree index e0782b86..4392ea28 100644 Binary files a/docs/build/html/.doctrees/classes/spatialpy.solvers.doctree and b/docs/build/html/.doctrees/classes/spatialpy.solvers.doctree differ diff --git a/docs/build/html/.doctrees/classes/spatialpy.stochss.doctree b/docs/build/html/.doctrees/classes/spatialpy.stochss.doctree index f901dc97..a99dde57 100644 Binary files a/docs/build/html/.doctrees/classes/spatialpy.stochss.doctree and b/docs/build/html/.doctrees/classes/spatialpy.stochss.doctree differ diff --git a/docs/build/html/.doctrees/environment.pickle b/docs/build/html/.doctrees/environment.pickle index e5b1ff22..1db82246 100644 Binary files a/docs/build/html/.doctrees/environment.pickle and b/docs/build/html/.doctrees/environment.pickle differ diff --git a/docs/build/html/.doctrees/index.doctree b/docs/build/html/.doctrees/index.doctree index 4ecb305d..7fa4bd01 100644 Binary files a/docs/build/html/.doctrees/index.doctree and b/docs/build/html/.doctrees/index.doctree differ diff --git a/docs/build/html/_modules/index.html b/docs/build/html/_modules/index.html index d1f4d7cf..45612b6e 100644 --- a/docs/build/html/_modules/index.html +++ b/docs/build/html/_modules/index.html @@ -5,7 +5,7 @@ - Overview: module code — SpatialPy 1.0 documentation + Overview: module code — SpatialPy 1.0.2 documentation @@ -105,6 +105,7 @@

All modules for which code is available

  • spatialpy.core.result
  • spatialpy.core.spatialpyerror
  • spatialpy.core.species
  • +
  • spatialpy.core.visualization
  • spatialpy.core.vtkreader
  • spatialpy.solvers.build_expression
  • spatialpy.solvers.solver
  • @@ -125,10 +126,10 @@

    All modules for which code is available

    diff --git a/docs/build/html/_modules/spatialpy/core/boundarycondition.html b/docs/build/html/_modules/spatialpy/core/boundarycondition.html index 4a7889e4..71185357 100644 --- a/docs/build/html/_modules/spatialpy/core/boundarycondition.html +++ b/docs/build/html/_modules/spatialpy/core/boundarycondition.html @@ -5,7 +5,7 @@ - spatialpy.core.boundarycondition — SpatialPy 1.0 documentation + spatialpy.core.boundarycondition — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.boundarycondition

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
     
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
     
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
     
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
     from spatialpy.core.spatialpyerror import BoundaryConditionError
     
    @@ -274,10 +272,10 @@ 

    Source code for spatialpy.core.boundarycondition

    diff --git a/docs/build/html/_modules/spatialpy/core/cleanup.html b/docs/build/html/_modules/spatialpy/core/cleanup.html index 81d264d1..433d3d38 100644 --- a/docs/build/html/_modules/spatialpy/core/cleanup.html +++ b/docs/build/html/_modules/spatialpy/core/cleanup.html @@ -5,7 +5,7 @@ - spatialpy.core.cleanup — SpatialPy 1.0 documentation + spatialpy.core.cleanup — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.cleanup

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
     
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
     
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
     
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
     import os
     import shutil
    @@ -196,10 +194,10 @@ 

    Source code for spatialpy.core.cleanup

         
    diff --git a/docs/build/html/_modules/spatialpy/core/datafunction.html b/docs/build/html/_modules/spatialpy/core/datafunction.html index 3e2840cb..6d95180b 100644 --- a/docs/build/html/_modules/spatialpy/core/datafunction.html +++ b/docs/build/html/_modules/spatialpy/core/datafunction.html @@ -5,7 +5,7 @@ - spatialpy.core.datafunction — SpatialPy 1.0 documentation + spatialpy.core.datafunction — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.datafunction

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    -
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    -
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    -
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
    +
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
    +
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     from spatialpy.core.spatialpyerror import DataFunctionError
     
     
    [docs]class DataFunction(): @@ -156,10 +154,10 @@

    Source code for spatialpy.core.datafunction

         
    diff --git a/docs/build/html/_modules/spatialpy/core/domain.html b/docs/build/html/_modules/spatialpy/core/domain.html index 7b608992..0079840b 100644 --- a/docs/build/html/_modules/spatialpy/core/domain.html +++ b/docs/build/html/_modules/spatialpy/core/domain.html @@ -5,7 +5,7 @@ - spatialpy.core.domain — SpatialPy 1.0 documentation + spatialpy.core.domain — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.domain

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
     
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
     
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
     
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
     import json
     import string
    @@ -120,6 +118,7 @@ 

    Source code for spatialpy.core.domain

     from plotly.offline import init_notebook_mode, iplot
     from scipy.spatial import KDTree
     
    +from spatialpy.core.visualization import Visualization
     from spatialpy.core.spatialpyerror import DomainError
     
     
    [docs]class Domain(): @@ -297,8 +296,8 @@

    Source code for spatialpy.core.domain

             """
             Add a type definition to the domain. By default, all regions are set to type 0.
     
    -        :param geometry_ivar: an instance of a :py:class:`spatialpy.core.geometry.Geometry` subclass.  The 'inside()' method
    -                   of this object will be used to assign properties to points.
    +        :param geometry_ivar: an instance of a :py:class:`spatialpy.core.geometry.Geometry` subclass. \
    +                   The 'inside()' method of this object will be used to assign properties to points.
             :type geometry_ivar: spatialpy.core.geometry.Geometry
     
             :param type_id: The identifier for this type.
    @@ -363,8 +362,8 @@ 

    Source code for spatialpy.core.domain

             """
             Fill a geometric shape with particles.
     
    -        :param geometry_ivar: an instance of a :py:class:`spatialpy.core.geometry.Geometry` subclass.  The 'inside()' method
    -                   of this object will be used to create add the particles.
    +        :param geometry_ivar: an instance of a :py:class:`spatialpy.core.geometry.Geometry` subclass. \
    +                   The 'inside()' method of this object will be used to create add the particles.
             :type geometry_ivar: spatialpy.core.geometry.Geometry
     
             :param deltax: Distance between particles on the x-axis.
    @@ -628,7 +627,7 @@ 

    Source code for spatialpy.core.domain

                 self.vol[v3] += t_vol / 4
                 self.vol[v4] += t_vol / 4
    -
    [docs] def plot_types(self, width=None, height=None, colormap=None, size=5, title=None, +
    [docs] def plot_types(self, width=None, height=None, colormap=None, size=None, title=None, included_types_list=None, use_matplotlib=False, return_plotly_figure=False): ''' Plots the domain using plotly. Can only be viewed in a Jupyter Notebook. @@ -667,13 +666,10 @@

    Source code for spatialpy.core.domain

             '''
             from spatialpy.core.result import _plotly_iterate # pylint: disable=import-outside-toplevel
     
    -        if use_matplotlib:
    -            width = 6.4 if width in (None, "auto") else width
    -            height = 4.8 if height in (None, "auto") else height
    -        else:
    +        if not use_matplotlib:
                 if width in (None, "auto"):
                     width = None if width == "auto" else 500
    -            if height is None:
    +            if height in (None, "auto"):
                     height = None if height == "auto" else 500
     
             if not numpy.count_nonzero(self.vertices[:, 1]):
    @@ -686,32 +682,67 @@ 

    Source code for spatialpy.core.domain

             self._get_type_name_mapping()
     
             types = {}
    +        # Normalize volumes to [0, 1]
    +        vols = (self.vol - numpy.min(self.vol))/numpy.ptp(self.vol)
             for i, type_id in enumerate(self.type_id):
                 name = type_id[5:]
                 if included_types_list is None or name in included_types_list:
                     if name in types:
                         types[name]['points'].append(self.vertices[i])
                         types[name]['data'].append(self.typeNdxMapping[type_id])
    +                    types[name]['size_scale'] = numpy.append(types[name]['size_scale'], vols[i])
                     else:
    -                    types[name] = {"points":[self.vertices[i]], "data":[self.typeNdxMapping[type_id]]}
    +                    types[name] = {
    +                        "points": [self.vertices[i]],
    +                        "data": [self.typeNdxMapping[type_id]],
    +                        "size_scale": numpy.array([vols[i]])
    +                    }
     
             if use_matplotlib:
    -            import matplotlib.pyplot as plt # pylint: disable=import-outside-toplevel
    -
    -            fig, ax = plt.subplots(figsize=(width, height))
    -            for name, data in types.items():
    -                x_coords = list(map(lambda point: point[0], data["points"]))
    -                y_coords = list(map(lambda point: point[1], data["points"]))
    -
    -                ax.scatter(x_coords, y_coords, label=name)
    -                ax.grid(linestyle='--', linewidth=1)
    -                ax.legend(loc='upper right', fontsize=12)
    -                if title is not None:
    -                    ax.set_title(title)
    -
    -            plt.axis('scaled')
    +            if not isinstance(use_matplotlib, dict):
    +                use_matplotlib = {}
    +            use_matplotlib['limits'] = (
    +                (self.xlim[0] - 0.25, self.xlim[1] + 0.25), (self.ylim[0] - 0.25, self.ylim[1] + 0.25)
    +            )
    +
    +            # Support for width, height, and title args
    +            if width not in (None, "auto") and height not in (None, "auto"):
    +                # TODO: Deprecation warning for width and height
    +                plot_args = {"figsize": (width, height)}
    +
    +                if "plot_args" in use_matplotlib:
    +                    for name, val in use_matplotlib['plot_args'].items():
    +                        plot_args[name] = val
    +                use_matplotlib['plot_args'] = plot_args
    +
    +            base_group_args = {}
    +            if colormap is not None:
    +                base_group_args['cmap'] = colormap
    +                base_group_args['vmin'] = 1 # minimum number of defined types
    +                base_group_args['vmax'] = len(self.typeNdxMapping) # number of defined types
    +            if size is not None:
    +                base_group_args['s'] = size
    +
    +            if "scatter_args" not in use_matplotlib:
    +                use_matplotlib['scatter_args'] = {}
    +            for type_id in self.typeNdxMapping.keys():
    +                type_id = type_id[5:]
    +                group_args = base_group_args.copy()
    +                if type_id in use_matplotlib['scatter_args']:
    +                    for name, val in use_matplotlib['scatter_args'][type_id].items():
    +                        group_args[name] = val
    +                use_matplotlib['scatter_args'][type_id] = group_args
    +
    +            if title is not None:
    +                use_matplotlib['title'] = title
    +
    +            vis_obj = Visualization(data=types)
    +            vis_obj.plot_scatter(**use_matplotlib)
                 return
     
    +        if size is None:
    +            size = 5
    +
             is_2d = self.dimensions == 2
     
             trace_list = _plotly_iterate(types, size=size, property_name="type",
    @@ -953,7 +984,7 @@ 

    Source code for spatialpy.core.domain

             :type fixed: bool
     
             :param \**kwargs: Additional keyword arguments passed to :py:class:`Domain`.
    -        
    +
             :returns: Uniform 3D SpatialPy Domain object.
             :rtype: spatialpy.core.domain.Domain
             """
    @@ -1047,10 +1078,10 @@ 

    Source code for spatialpy.core.domain

         
    diff --git a/docs/build/html/_modules/spatialpy/core/geometry.html b/docs/build/html/_modules/spatialpy/core/geometry.html index 8ca065ff..d016004a 100644 --- a/docs/build/html/_modules/spatialpy/core/geometry.html +++ b/docs/build/html/_modules/spatialpy/core/geometry.html @@ -5,7 +5,7 @@ - spatialpy.core.geometry — SpatialPy 1.0 documentation + spatialpy.core.geometry — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.geometry

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    -
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    -
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    -
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
    +
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
    +
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     from spatialpy.core.spatialpyerror import GeometryError
     
     
    [docs]class Geometry: @@ -198,10 +196,10 @@

    Source code for spatialpy.core.geometry

         
    diff --git a/docs/build/html/_modules/spatialpy/core/initialcondition.html b/docs/build/html/_modules/spatialpy/core/initialcondition.html index 9dc0c791..2c778f33 100644 --- a/docs/build/html/_modules/spatialpy/core/initialcondition.html +++ b/docs/build/html/_modules/spatialpy/core/initialcondition.html @@ -5,7 +5,7 @@ - spatialpy.core.initialcondition — SpatialPy 1.0 documentation + spatialpy.core.initialcondition — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.initialcondition

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    -
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    -
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    -
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
    +
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
    +
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     import numpy
     
     from spatialpy.core.spatialpyerror import InitialConditionError
    @@ -156,6 +154,10 @@ 

    Source code for spatialpy.core.initialcondition

    < :param model: Model contianing the target species. :type model: spatialpy.core.model.Model """ + if isinstance(self.species, str): + if self.species not in model.listOfSpecies: + raise InitialConditionError(f"Species {self.species} does not exist in the model.") + self.species = model.listOfSpecies[self.species] spec_name = self.species.name spec_ndx = None for index, spec_name in enumerate(model.listOfSpecies.keys()): @@ -199,6 +201,10 @@

    Source code for spatialpy.core.initialcondition

    < :param model: Model contianing the target species. :type model: spatialpy.core.model.Model """ + if isinstance(self.species, str): + if self.species not in model.listOfSpecies: + raise InitialConditionError(f"Species {self.species} does not exist in the model.") + self.species = model.listOfSpecies[self.species] spec_name = self.species.name spec_ndx = None for index, spec_name in enumerate(model.listOfSpecies.keys()): @@ -251,6 +257,10 @@

    Source code for spatialpy.core.initialcondition

    < :param model: Model contianing the target species. :type model: spatialpy.core.model.Model """ + if isinstance(self.species, str): + if self.species not in model.listOfSpecies: + raise InitialConditionError(f"Species {self.species} does not exist in the model.") + self.species = model.listOfSpecies[self.species] spec_name = self.species.name spec_ndx = None for index, spec_name in enumerate(model.listOfSpecies.keys()): @@ -294,10 +304,10 @@

    Source code for spatialpy.core.initialcondition

    <
    diff --git a/docs/build/html/_modules/spatialpy/core/model.html b/docs/build/html/_modules/spatialpy/core/model.html index 6e155948..09d9db5a 100644 --- a/docs/build/html/_modules/spatialpy/core/model.html +++ b/docs/build/html/_modules/spatialpy/core/model.html @@ -5,7 +5,7 @@ - spatialpy.core.model — SpatialPy 1.0 documentation + spatialpy.core.model — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.model

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
     
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
     
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
     
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
     #This module defines a model that simulates a discrete, stoachastic, mixed biochemical reaction network in python.
     
    @@ -411,6 +409,15 @@ 

    Source code for spatialpy.core.model

             self.__update_diffusion_restrictions()
             self.__apply_initial_conditions()
             self.__resolve_parameters()
    +
    +        sanitized_params = self.sanitized_parameter_names()
    +        for species in self.listOfSpecies.values():
    +            diff_coeff = species.diffusion_coefficient
    +            if isinstance(diff_coeff, str):
    +                if diff_coeff not in sanitized_params:
    +                    raise ModelError(f"Parameterm {diff_coeff} doesn't exist.")
    +                species.diffusion_coefficient = sanitized_params[diff_coeff]
    +
             self.__get_expression_utility()
             stoich_matrix = self.__create_stoichiometric_matrix()
             dep_graph = self.__create_dependency_graph()
    @@ -853,10 +860,10 @@ 

    Source code for spatialpy.core.model

         
    diff --git a/docs/build/html/_modules/spatialpy/core/parameter.html b/docs/build/html/_modules/spatialpy/core/parameter.html index a1bd41b0..1cbb243e 100644 --- a/docs/build/html/_modules/spatialpy/core/parameter.html +++ b/docs/build/html/_modules/spatialpy/core/parameter.html @@ -5,7 +5,7 @@ - spatialpy.core.parameter — SpatialPy 1.0 documentation + spatialpy.core.parameter — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.parameter

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    -
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    -
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    -
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
    +
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
    +
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     from spatialpy.core.spatialpyerror import ParameterError
     
     
    [docs]class Parameter(): @@ -178,10 +176,10 @@

    Source code for spatialpy.core.parameter

         
    diff --git a/docs/build/html/_modules/spatialpy/core/reaction.html b/docs/build/html/_modules/spatialpy/core/reaction.html index 3c4d5a34..3c7d83bf 100644 --- a/docs/build/html/_modules/spatialpy/core/reaction.html +++ b/docs/build/html/_modules/spatialpy/core/reaction.html @@ -5,7 +5,7 @@ - spatialpy.core.reaction — SpatialPy 1.0 documentation + spatialpy.core.reaction — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.reaction

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    -
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    -
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    -
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
    +
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
    +
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     import uuid
     
     from spatialpy.core.species import Species
    @@ -383,10 +381,10 @@ 

    Source code for spatialpy.core.reaction

         
    diff --git a/docs/build/html/_modules/spatialpy/core/result.html b/docs/build/html/_modules/spatialpy/core/result.html index aa473c0b..e1d3ddeb 100644 --- a/docs/build/html/_modules/spatialpy/core/result.html +++ b/docs/build/html/_modules/spatialpy/core/result.html @@ -5,7 +5,7 @@ - spatialpy.core.result — SpatialPy 1.0 documentation + spatialpy.core.result — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.result

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
     
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
     
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
     
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
     import csv
     import filecmp
    @@ -122,6 +120,7 @@ 

    Source code for spatialpy.core.result

     from plotly.offline import init_notebook_mode, iplot
     
     # from spatialpy.core.model import *
    +from spatialpy.core.visualization import Visualization
     from spatialpy.core.vtkreader import VTKReader
     from spatialpy.core.spatialpyerror import ResultError
     
    @@ -314,6 +313,9 @@ 

    Source code for spatialpy.core.result

         def __map_property_to_type(self, property_name, data, included_types_list, points, p_ndx):
             types = {}
             if property_name == 'type':
    +            # Normalize volumes to [0, 1]
    +            vol = data['mass'] / data['rho']
    +            vols = (vol - numpy.min(vol))/numpy.ptp(vol)
                 for i, val in enumerate(data['type']):
                     name = self.model.domain.typeNameMapping[val][5:]
     
    @@ -321,9 +323,15 @@ 

    Source code for spatialpy.core.result

                         if name in types:
                             types[name]['points'].append(points[i])
                             types[name]['data'].append(data[property_name][i])
    +                        types[name]['size_scale'] = numpy.append(types[name]['size_scale'], vols[i])
                         else:
    -                        types[name] = {"points":[points[i]], "data":[data[property_name][i]]}
    -        elif property_name == 'v':
    +                        types[name] = {
    +                            "points": [points[i]],
    +                            "data": [data[property_name][i]],
    +                            "size_scale": numpy.array([vols[i]])
    +                        }
    +            return types
    +        if property_name == 'v':
                 types[property_name] = {
                     "points": points,
                     "data" : [data[property_name][i][p_ndx] for i in range(0,len(data[property_name]))]
    @@ -419,7 +427,8 @@ 

    Source code for spatialpy.core.result

                 If set to True, the concentration (=copy_number/volume) is returned.  Defaults to False
             :type concentration: bool
     
    -        :param deterministic: Whether or not the species is deterministic (True) or stochastic (False).  Defaults to False
    +        :param deterministic: Whether or not the species is deterministic (True) or stochastic (False). \
    +                Defaults to False
             :type deterministic: bool
     
             :param debug: Whether or not debug information should be printed. Defaults to False
    @@ -707,7 +716,6 @@ 

    Source code for spatialpy.core.result

                 t_index_arr = [t_index_arr]
                 num_timepoints = 1
     
    -        
             if property_name == "v":
                 ret = numpy.zeros((num_timepoints, num_voxel, 3))
             else:
    @@ -723,7 +731,7 @@ 

    Source code for spatialpy.core.result

             return ret
    [docs] def plot_property(self, property_name, t_ndx=None, t_val=None, p_ndx=0, width=None, height=None, - colormap=None, size=5, title=None, animated=False, t_ndx_list=None, speed=1, + colormap=None, size=None, title=None, animated=False, t_ndx_list=None, speed=1, f_duration=500, t_duration=300, included_types_list=None, return_plotly_figure=False, use_matplotlib=False, debug=False): """ @@ -836,17 +844,47 @@

    Source code for spatialpy.core.result

             if use_matplotlib:
                 import matplotlib.pyplot as plt # pylint: disable=import-outside-toplevel
     
    +            if not isinstance(use_matplotlib, dict):
    +                use_matplotlib = {}
    +            use_matplotlib['limits'] = (
    +                (self.model.domain.xlim[0] - 0.25, self.model.domain.xlim[1] + 0.25),
    +                (self.model.domain.ylim[0] - 0.25, self.model.domain.ylim[1] + 0.25)
    +            )
    +
    +            # Support for width, height, and title args
    +            if width not in (None, "auto") and height not in (None, "auto"):
    +                # TODO: Deprecation warning for width and height
    +                plot_args = {"figsize": (width, height)}
    +
    +                if "plot_args" in use_matplotlib:
    +                    for name, val in use_matplotlib['plot_args'].items():
    +                        plot_args[name] = val
    +                use_matplotlib['plot_args'] = plot_args
    +
    +            base_group_args = {}
    +            if colormap is not None:
    +                base_group_args['cmap'] = colormap
    +                base_group_args['vmin'] = 1 # minimum number of defined types
    +                base_group_args['vmax'] = len(self.model.domain.typeNdxMapping) # number of defined types
    +            if size is not None:
    +                base_group_args['s'] = size
    +
    +            if "scatter_args" not in use_matplotlib:
    +                use_matplotlib['scatter_args'] = {}
    +            for type_id in self.model.domain.typeNdxMapping.keys():
    +                type_id = type_id[5:]
    +                group_args = base_group_args.copy()
    +                if type_id in use_matplotlib['scatter_args']:
    +                    for name, val in use_matplotlib['scatter_args'][type_id].items():
    +                        group_args[name] = val
    +                use_matplotlib['scatter_args'][type_id] = group_args
    +
    +            if title is not None:
    +                use_matplotlib['title'] = title
    +
                 if property_name == "type":
    -                fig, ax = plt.subplots(figsize=(width, height))
    -                for name, data in types.items():
    -                    x_coords = list(map(lambda point: point[0], data["points"]))
    -                    y_coords = list(map(lambda point: point[1], data["points"]))
    -
    -                    ax.scatter(x_coords, y_coords, label=name)
    -                    ax.grid(linestyle='--', linewidth=1)
    -                    ax.legend(loc='upper right', fontsize=12)
    -                    if title is not None:
    -                        ax.set_title(title)
    +                vis_obj = Visualization(data=types)
    +                vis_obj.plot_scatter(**use_matplotlib)
                 else:
                     if property_name == 'v':
                         p_data = data[property_name]
    @@ -862,9 +900,12 @@ 

    Source code for spatialpy.core.result

                     if title is not None:
                         plt.title(title)
                     plt.grid(linestyle='--', linewidth=1)
    -            plt.axis('scaled')
    +                plt.axis('scaled')
                 return
     
    +        if size is None:
    +            size = 5
    +
             is_2d = self.model.domain.dimensions == 2
             trace_list = _plotly_iterate(types, size=size, property_name=property_name,
                                          colormap=colormap, is_2d=is_2d)
    @@ -993,10 +1034,10 @@ 

    Source code for spatialpy.core.result

         
    diff --git a/docs/build/html/_modules/spatialpy/core/spatialpyerror.html b/docs/build/html/_modules/spatialpy/core/spatialpyerror.html index 2cf15b1b..c965256e 100644 --- a/docs/build/html/_modules/spatialpy/core/spatialpyerror.html +++ b/docs/build/html/_modules/spatialpy/core/spatialpyerror.html @@ -5,7 +5,7 @@ - spatialpy.core.spatialpyerror — SpatialPy 1.0 documentation + spatialpy.core.spatialpyerror — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.spatialpyerror

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
     
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
     
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
     
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
     # Base Module Expections
     
    [docs]class ModelError(Exception): @@ -120,6 +118,11 @@

    Source code for spatialpy.core.spatialpyerror

    Class for exceptions in the results module. """
    +
    [docs]class VisualizationError(Exception): + """ + Class for exceptions in the visualization module. + """
    +
    [docs]class VTKReaderError(Exception): """ Bass class for exceptions in the vtkreader module. @@ -174,6 +177,9 @@

    Source code for spatialpy.core.spatialpyerror

    # Result Exceptions +# Visualization Exceptions + + # VTKReader Exceptions
    [docs]class VTKReaderIOError(VTKReaderError): """ @@ -204,10 +210,10 @@

    Source code for spatialpy.core.spatialpyerror

    diff --git a/docs/build/html/_modules/spatialpy/core/species.html b/docs/build/html/_modules/spatialpy/core/species.html index 8429f830..32643f60 100644 --- a/docs/build/html/_modules/spatialpy/core/species.html +++ b/docs/build/html/_modules/spatialpy/core/species.html @@ -5,7 +5,7 @@ - spatialpy.core.species — SpatialPy 1.0 documentation + spatialpy.core.species — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.species

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    -
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    -
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    -
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
    +
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
    +
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     from spatialpy.core.parameter import Parameter
     from spatialpy.core.spatialpyerror import SpeciesError
     
    @@ -133,9 +131,9 @@ 

    Source code for spatialpy.core.species

     
             if  diffusion_coefficient is None:
                 raise SpeciesError("Species must have a diffusion_coefficient.")
    -        if not (isinstance(diffusion_coefficient, (Parameter, float, int)) or \
    +        if not (isinstance(diffusion_coefficient, (Parameter, str, float, int)) or \
                         type(diffusion_coefficient).__name__ == 'Parameter'):
    -            raise SpeciesError("Diffusion coefficient must be a spatialpy.Parameter, float, or int.")
    +            raise SpeciesError("Diffusion coefficient must be a spatialpy.Parameter, str, float, or int.")
             if isinstance(diffusion_coefficient, (float, int)) and diffusion_coefficient < 0:
                 raise SpeciesError("Diffusion coefficient must be non-negative.")
     
    @@ -166,9 +164,9 @@ 

    Source code for spatialpy.core.species

     
             :raises SpeciesError: If diffusion_coefficient is negative or not a valid type.
             """
    -        if not (isinstance(diffusion_coefficient, (Parameter, float, int)) or \
    +        if not (isinstance(diffusion_coefficient, (Parameter, str, float, int)) or \
                                 type(diffusion_coefficient).__name__ == 'Parameter'):
    -            raise SpeciesError("Diffusion coefficient must be a spatialpy.Parameter, float, or int.")
    +            raise SpeciesError("Diffusion coefficient must be a spatialpy.Parameter, str, float, or int.")
             if diffusion_coefficient < 0:
                 raise SpeciesError("Diffusion coefficient must be non-negative.")
     
    @@ -189,10 +187,10 @@ 

    Source code for spatialpy.core.species

         
    diff --git a/docs/build/html/_modules/spatialpy/core/visualization.html b/docs/build/html/_modules/spatialpy/core/visualization.html new file mode 100644 index 00000000..b16466f4 --- /dev/null +++ b/docs/build/html/_modules/spatialpy/core/visualization.html @@ -0,0 +1,310 @@ + + + + + + + + spatialpy.core.visualization — SpatialPy 1.0.2 documentation + + + + + + + + + + + + + + + + + + +
    + + +
    +
    + + +
    + +

    Source code for spatialpy.core.visualization

    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
    +
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
    +
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    +
    +import math
    +import numpy
    +
    +try:
    +    import matplotlib.pyplot as plt
    +    mpl_import_err = None
    +except ImportError as err:
    +    mpl_import_err = err
    +
    +from spatialpy.core.spatialpyerror import VisualizationError
    +
    +common_rgb_values=['#1f77b4','#ff7f0e','#2ca02c','#d62728','#9467bd','#8c564b','#e377c2','#7f7f7f',
    +                   '#bcbd22','#17becf','#ff0000','#00ff00','#0000ff','#ffff00','#00ffff','#ff00ff',
    +                   '#800000','#808000','#008000','#800080','#008080','#000080','#ff9999','#ffcc99',
    +                   '#ccff99','#cc99ff','#ffccff','#62666a','#8896bb','#77a096','#9d5a6c','#9d5a6c',
    +                   '#eabc75','#ff9600','#885300','#9172ad','#a1b9c4','#18749b','#dadecf','#c5b8a8',
    +                   '#000117','#13a8fe','#cf0060','#04354b','#0297a0','#037665','#eed284','#442244',
    +                   '#ffddee','#702afb']
    +
    +def _get_coords(points):
    +    labels = ["X-Axis", "Y-Axis", "Z-Axis"]
    +    coords = []
    +    axes = []
    +    i = 0
    +    while len(coords) < 2 and i < 3:
    +        vertex = list(map(lambda point: point[i], points))
    +        if numpy.count_nonzero(numpy.diff(vertex)) > 0:
    +            coords.append(vertex)
    +            axes.append(labels[i])
    +        i += 1
    +    if len(coords) < 2:
    +        if labels[0] not in axes:
    +            coords.insert(0, list(map(lambda point: point[0], points)))
    +            axes.insert(0, labels[0])
    +        elif labels[1] not in axes:
    +            coords.append(list(map(lambda point: point[1], points)))
    +            axes.append(labels[1])
    +    return coords, axes
    +
    +def _validate_mplplot_args(args):
    +    if args is None:
    +        return {"figsize": (Visualization.MPL_WIDTH, Visualization.MPL_HEIGHT)}
    +
    +    supported_splts_args = ["sharex", "sharey", "squeeze"]
    +    supported_fig_args = ["figsize", "dpi", "facecolor", "edgecolor", "frameon"]
    +
    +    kwargs = {}
    +    for name, val in args.items():
    +        if name in supported_splts_args or name in supported_fig_args:
    +            kwargs[name] = val
    +        else:
    +            from spatialpy.core import log # pylint: disable=import-outside-toplevel
    +            logmsg = f"Un-supported key word argument: {name} is not currently supported"
    +            log.warning(logmsg)
    +    return kwargs
    +
    +
    [docs]class Visualization(): + + MPL_WIDTH = 6.4 + MPL_HEIGHT = 4.8 + MPL_SIZE = 40 + + def __init__(self, data): + self.data = data + + def __get_grid_shape(self, multiple_graphs): + if isinstance(multiple_graphs, tuple): + num_subplots = multiple_graphs[0] * multiple_graphs[1] + if num_subplots < len(self.data.keys()): + errmsg = f"The shape {multiple_graphs} of the graphs is to small for the given data" + raise VisualizationError(errmsg) + nrows = multiple_graphs[0] + ncols = multiple_graphs[1] + else: + nrows = math.ceil(len(self.data.keys()) / 2) + ncols = 2 + return nrows, ncols + + def __validate_mplscatter_args(self, args, name): + if args is None: + return {"s": Visualization.MPL_SIZE} + + supported_args = ["s", "cmap", "color", "marker", "vmin", "vmax"] + + group_args = args[name] + if "cmap" in group_args and "color" in group_args: + errmsg = f"scatter args for {name}: 'cmap' and 'color' cannot both be set." + raise VisualizationError(errmsg) + + kwargs = {} + for arg_name, val in group_args.items(): + if arg_name in supported_args: + kwargs[arg_name] = val + else: + from spatialpy.core import log # pylint: disable=import-outside-toplevel + logmsg = f"Un-supported key word argument: {arg_name} is not currently supported" + log.warning(logmsg) + if "s" not in kwargs: + if "size_scale" in self.data[name]: + mpl_smin = 18 + mpl_smax = 180 + kwargs['s'] = (mpl_smax - mpl_smin) * self.data[name]['size_scale'] + mpl_smin + else: + kwargs['s'] = Visualization.MPL_SIZE + return kwargs + +
    [docs] def plot_scatter(self, plot_args=None, scatter_args=None, multiple_graphs=False, title=None, limits=None): + """ + Visualize data using maplotlib scatter plots. + + :param plot_args: additional keyword arguments passed to :py:class:`matplotlib.pyplot.subplots` + :type plot_args: dict + + :param scatter_args: dict of additional keyword arguments passed to \ + :py:class:`matplotlib.pyplot.scatter` for each group. + :type scatter_args: dist + + :param multiple_graphs: if each data entry should be ploted separately or on the same plot. \ + If ploted separately a shape may be provided. + :type multiple_graphs: bool | tuple(nrows, ncols) + """ + if mpl_import_err is not None: + raise VisualizationError("Missing MatPlotLib dependency.") from mpl_import_err + + plot_args = _validate_mplplot_args(plot_args) + if multiple_graphs: + plot_args['nrows'], plot_args['ncols'] = self.__get_grid_shape(multiple_graphs) + + fig, axs = plt.subplots(**plot_args) + if multiple_graphs: + axs = axs.flatten() + if len(self.data.keys())%plot_args['ncols'] != 0: + fig.delaxes(axs[-1]) + axs = numpy.delete(axs, -1) + data_keys = list(self.data.keys()) + for index, ax in enumerate(axs): + name = data_keys[index] + coords, axes_labels = _get_coords(self.data[name]["points"]) + + group_args = self.__validate_mplscatter_args(scatter_args, name) + if "cmap" in group_args: + group_args['c'] = self.data[name]["data"] + + ax.scatter(*coords, label=name, **group_args) + ax.set_xlabel(axes_labels[0]) + ax.set_xlim(limits[0]) + ax.set_ylabel(axes_labels[1]) + ax.set_ylim(limits[1]) + ax.grid(linestyle='--', linewidth=1) + ax.legend(loc='upper right', fontsize=12) + if title is not None: + ax.set_title(title) + else: + for index, (name, data) in enumerate(self.data.items()): + x_coords = list(map(lambda point: point[0], data["points"])) + y_coords = list(map(lambda point: point[1], data["points"])) + + group_args = self.__validate_mplscatter_args(scatter_args, name) + if "cmap" in group_args: + group_args['c'] = data["data"] + + axs.scatter(x_coords, y_coords, label=name, **group_args) + axs.grid(linestyle='--', linewidth=1) + axs.legend(loc='upper right', fontsize=12) + if title is not None: + axs.set_title(title) + + plt.axis('scaled')
    +
    + +
    + + +
    +
    +
    +
    + + + + + Fork me on GitHub + + + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/spatialpy/core/vtkreader.html b/docs/build/html/_modules/spatialpy/core/vtkreader.html index 68768261..d725520b 100644 --- a/docs/build/html/_modules/spatialpy/core/vtkreader.html +++ b/docs/build/html/_modules/spatialpy/core/vtkreader.html @@ -5,7 +5,7 @@ - spatialpy.core.vtkreader — SpatialPy 1.0 documentation + spatialpy.core.vtkreader — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.core.vtkreader

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
     
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
     
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
     
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
     import numpy
     
    @@ -303,10 +301,10 @@ 

    Source code for spatialpy.core.vtkreader

         
    diff --git a/docs/build/html/_modules/spatialpy/solvers/build_expression.html b/docs/build/html/_modules/spatialpy/solvers/build_expression.html index 6aaf4746..69669844 100644 --- a/docs/build/html/_modules/spatialpy/solvers/build_expression.html +++ b/docs/build/html/_modules/spatialpy/solvers/build_expression.html @@ -5,7 +5,7 @@ - spatialpy.solvers.build_expression — SpatialPy 1.0 documentation + spatialpy.solvers.build_expression — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.solvers.build_expression

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
     
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
     
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
     
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
     import ast
     
    @@ -862,10 +860,10 @@ 

    Source code for spatialpy.solvers.build_expression

    diff --git a/docs/build/html/_modules/spatialpy/solvers/solver.html b/docs/build/html/_modules/spatialpy/solvers/solver.html index 5c84fcbc..4ebca464 100644 --- a/docs/build/html/_modules/spatialpy/solvers/solver.html +++ b/docs/build/html/_modules/spatialpy/solvers/solver.html @@ -5,7 +5,7 @@ - spatialpy.solvers.solver — SpatialPy 1.0 documentation + spatialpy.solvers.solver — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.solvers.solver

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
     
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
     
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
     
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
     import os
     import shutil
    @@ -567,7 +565,12 @@ 

    Source code for spatialpy.solvers.solver

     
             # Build the solver
             makefile = self.spatialpy_rootdir+'/build/Makefile'
    -        cmd_list = ['cd', self.core_dir, '&&', 'make', 'CORE', '-f',  makefile,
    +        makefile_ann = self.spatialpy_rootdir+'/external/ANN/src/Makefile.spatialpy'
    +        cmd_list = ['cd', self.core_dir, '&&',
    +            'make', '-f' , makefile_ann, 
    +            'ROOTINC="' + self.spatialpy_rootinc+'"',
    +            '&&',
    +            'make', 'CORE', '-f',  makefile,
                 'ROOT="' + self.spatialpy_rootparam+'"',
                 'ROOTINC="' + self.spatialpy_rootinc+'"',
                 'BUILD='+self.core_dir, '&&'
    @@ -721,10 +724,10 @@ 

    Source code for spatialpy.solvers.solver

         
    diff --git a/docs/build/html/_modules/spatialpy/stochss/stochss_export.html b/docs/build/html/_modules/spatialpy/stochss/stochss_export.html index cead8e00..67f2458b 100644 --- a/docs/build/html/_modules/spatialpy/stochss/stochss_export.html +++ b/docs/build/html/_modules/spatialpy/stochss/stochss_export.html @@ -5,7 +5,7 @@ - spatialpy.stochss.stochss_export — SpatialPy 1.0 documentation + spatialpy.stochss.stochss_export — SpatialPy 1.0.2 documentation @@ -91,23 +91,21 @@

    Quick search

    Source code for spatialpy.stochss.stochss_export

    -'''
    -SpatialPy is a Python 3 package for simulation of
    -spatial deterministic/stochastic reaction-diffusion-advection problems
    -Copyright (C) 2019 - 2022 SpatialPy developers.
    +# SpatialPy is a Python 3 package for simulation of
    +# spatial deterministic/stochastic reaction-diffusion-advection problems
    +# Copyright (C) 2019 - 2022 SpatialPy developers.
     
    -This program is free software: you can redistribute it and/or modify
    -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    -published by the Free Software Foundation.
    +# This program is free software: you can redistribute it and/or modify
    +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as
    +# published by the Free Software Foundation.
     
    -This program is distributed in the hope that it will be useful,
    -but WITHOUT ANY WARRANTY; without even the implied warranty of
    -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -GNU GENERAL PUBLIC LICENSE Version 3 for more details.
    +# This program is distributed in the hope that it will be useful,
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    +# GNU GENERAL PUBLIC LICENSE Version 3 for more details.
     
    -You should have received a copy of the GNU General Public License
    -along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -'''
    +# You should have received a copy of the GNU General Public License
    +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
     import ast
     import json
    @@ -364,10 +362,10 @@ 

    Source code for spatialpy.stochss.stochss_export

    diff --git a/docs/build/html/_sources/classes/spatialpy.core.rst.txt b/docs/build/html/_sources/classes/spatialpy.core.rst.txt index 9d0dc903..f259fa08 100644 --- a/docs/build/html/_sources/classes/spatialpy.core.rst.txt +++ b/docs/build/html/_sources/classes/spatialpy.core.rst.txt @@ -100,6 +100,14 @@ spatialpy.core.species module :undoc-members: :show-inheritance: +spatialpy.core.visualization module +----------------------------------- + +.. automodule:: spatialpy.core.visualization + :members: + :undoc-members: + :show-inheritance: + spatialpy.core.vtkreader module ------------------------------- diff --git a/docs/build/html/_static/basic.css b/docs/build/html/_static/basic.css index 912859b5..bf18350b 100644 --- a/docs/build/html/_static/basic.css +++ b/docs/build/html/_static/basic.css @@ -4,7 +4,7 @@ * * Sphinx stylesheet -- basic theme. * - * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -731,8 +731,9 @@ dl.glossary dt { .classifier:before { font-style: normal; - margin: 0.5em; + margin: 0 0.5em; content: ":"; + display: inline-block; } abbr, acronym { @@ -756,6 +757,7 @@ span.pre { -ms-hyphens: none; -webkit-hyphens: none; hyphens: none; + white-space: nowrap; } div[class*="highlight-"] { diff --git a/docs/build/html/_static/doctools.js b/docs/build/html/_static/doctools.js index 8cbf1b16..e509e483 100644 --- a/docs/build/html/_static/doctools.js +++ b/docs/build/html/_static/doctools.js @@ -4,7 +4,7 @@ * * Sphinx JavaScript utilities for all documentation. * - * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -264,6 +264,9 @@ var Documentation = { hideSearchWords : function() { $('#searchbox .highlight-link').fadeOut(300); $('span.highlighted').removeClass('highlighted'); + var url = new URL(window.location); + url.searchParams.delete('highlight'); + window.history.replaceState({}, '', url); }, /** diff --git a/docs/build/html/_static/documentation_options.js b/docs/build/html/_static/documentation_options.js index b24e4743..32a0c247 100644 --- a/docs/build/html/_static/documentation_options.js +++ b/docs/build/html/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '1.0', + VERSION: '1.0.2', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/build/html/_static/language_data.js b/docs/build/html/_static/language_data.js index 863704b3..ebe2f03b 100644 --- a/docs/build/html/_static/language_data.js +++ b/docs/build/html/_static/language_data.js @@ -5,7 +5,7 @@ * This script contains the language-specific data used by searchtools.js, * namely the list of stopwords, stemmer, scorer and splitter. * - * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ diff --git a/docs/build/html/_static/pygments.css b/docs/build/html/_static/pygments.css index 1b945229..87f8bd12 100644 --- a/docs/build/html/_static/pygments.css +++ b/docs/build/html/_static/pygments.css @@ -1,7 +1,7 @@ -pre { line-height: 125%; margin: 0; } -td.linenos pre { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } -span.linenos { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } -td.linenos pre.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +pre { line-height: 125%; } +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight { background: #f8f8f8; } diff --git a/docs/build/html/_static/searchtools.js b/docs/build/html/_static/searchtools.js index 8eb14218..2d778593 100644 --- a/docs/build/html/_static/searchtools.js +++ b/docs/build/html/_static/searchtools.js @@ -4,7 +4,7 @@ * * Sphinx JavaScript utilities for the full-text search. * - * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -276,19 +276,28 @@ var Search = { setTimeout(function() { displayNextItem(); }, 5); - } else { + } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) { $.ajax({url: requestUrl, dataType: "text", complete: function(jqxhr, textstatus) { var data = jqxhr.responseText; if (data !== '' && data !== undefined) { - listItem.append(Search.makeSearchSummary(data, searchterms, hlterms)); + var summary = Search.makeSearchSummary(data, searchterms, hlterms); + if (summary) { + listItem.append(summary); + } } Search.output.append(listItem); setTimeout(function() { displayNextItem(); }, 5); }}); + } else { + // no source available, just display title + Search.output.append(listItem); + setTimeout(function() { + displayNextItem(); + }, 5); } } // search finished, update title and status message @@ -319,7 +328,9 @@ var Search = { var results = []; for (var prefix in objects) { - for (var name in objects[prefix]) { + for (var iMatch = 0; iMatch != objects[prefix].length; ++iMatch) { + var match = objects[prefix][iMatch]; + var name = match[4]; var fullname = (prefix ? prefix + '.' : '') + name; var fullnameLower = fullname.toLowerCase() if (fullnameLower.indexOf(object) > -1) { @@ -333,7 +344,6 @@ var Search = { } else if (parts[parts.length - 1].indexOf(object) > -1) { score += Scorer.objPartialMatch; } - var match = objects[prefix][name]; var objname = objnames[match[1]][2]; var title = titles[match[0]]; // If more than one term searched for, we require other words to be @@ -492,6 +502,9 @@ var Search = { */ makeSearchSummary : function(htmlText, keywords, hlwords) { var text = Search.htmlToText(htmlText); + if (text == "") { + return null; + } var textLower = text.toLowerCase(); var start = 0; $.each(keywords, function() { diff --git a/docs/build/html/classes/spatialpy.core.html b/docs/build/html/classes/spatialpy.core.html index 0b5b39b2..d2b61df2 100644 --- a/docs/build/html/classes/spatialpy.core.html +++ b/docs/build/html/classes/spatialpy.core.html @@ -4,8 +4,9 @@ - - spatialpy.core package — SpatialPy 1.0 documentation + + + spatialpy.core package — SpatialPy 1.0.2 documentation @@ -13,6 +14,7 @@ + @@ -103,28 +105,16 @@

    Quick search

    -
    +

    spatialpy.core package

    -
    +

    Submodules

    -
    -
    +
    +

    spatialpy.core.boundarycondition module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -class spatialpy.core.boundarycondition.BoundaryCondition(xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, type_id=None, deterministic=True, target=None, value=None, model=None)[source]
    +class spatialpy.core.boundarycondition.BoundaryCondition(xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, type_id=None, deterministic=True, target=None, value=None, model=None)[source]

    Bases: object

    Set spatial regions of the domain where a property of particles are held constant (updated each simulation step)

    @@ -173,21 +163,9 @@

    Submodules +

    +

    spatialpy.core.cleanup module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    spatialpy.core.cleanup.cleanup_build_files(build_dir=None)[source]
    @@ -222,24 +200,12 @@

    Submodules +

    +

    spatialpy.core.datafunction module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -class spatialpy.core.datafunction.DataFunction(name=None)[source]
    +class spatialpy.core.datafunction.DataFunction(name=None)[source]

    Bases: object

    Abstract class used to constuct the data function.

    @@ -270,24 +236,12 @@

    Submodules +

    +

    spatialpy.core.domain module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -class spatialpy.core.domain.Domain(numpoints, xlim, ylim, zlim, rho0=1.0, c0=10, P0=None, gravity=None)[source]
    +class spatialpy.core.domain.Domain(numpoints, xlim, ylim, zlim, rho0=1.0, c0=10, P0=None, gravity=None)[source]

    Bases: object

    Domain class for SpatialPy. A domain defines points and attributes of a regional space for simulation.

    @@ -378,7 +332,7 @@

    Submodules
    -classmethod create_2D_domain(xlim, ylim, nx, ny, type_id=1, mass=1.0, nu=1.0, rho=None, c=0, fixed=False, **kwargs)[source]
    +classmethod create_2D_domain(xlim, ylim, nx, ny, type_id=1, mass=1.0, nu=1.0, rho=None, c=0, fixed=False, **kwargs)[source]

    Create a filled 2D domain

    Parameters
    @@ -407,7 +361,7 @@

    Submodules
    -classmethod create_3D_domain(xlim, ylim, zlim, nx, ny, nz, type_id=1, mass=1.0, nu=1.0, rho=None, c=0, fixed=False, **kwargs)[source]
    +classmethod create_3D_domain(xlim, ylim, zlim, nx, ny, nz, type_id=1, mass=1.0, nu=1.0, rho=None, c=0, fixed=False, **kwargs)[source]

    Create a filled 3D domain

    Parameters
    @@ -463,8 +417,7 @@

    Submodules
    Parameters

    +

    spatialpy.core.geometry module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -class spatialpy.core.geometry.Geometry[source]
    +class spatialpy.core.geometry.Geometry[source]

    Bases: object

    Geometry class provides a method for tagging parts of the spatial domain as separate parts.

    @@ -778,7 +718,7 @@

    Submodules
    -class spatialpy.core.geometry.GeometryAll[source]
    +class spatialpy.core.geometry.GeometryAll[source]

    Bases: spatialpy.core.geometry.Geometry

    Mark all particles.

    @@ -804,7 +744,7 @@

    Submodules
    -class spatialpy.core.geometry.GeometryExterior[source]
    +class spatialpy.core.geometry.GeometryExterior[source]

    Bases: spatialpy.core.geometry.Geometry

    Mark particles that are on the edge of the domain. only works for domains that define triangles and tetrahedrons.

    @@ -831,7 +771,7 @@

    Submodules
    -class spatialpy.core.geometry.GeometryInterior[source]
    +class spatialpy.core.geometry.GeometryInterior[source]

    Bases: spatialpy.core.geometry.Geometry

    Mark particles that are not on the edge of the domain. Only works for domains that define triangles and tetrahedrons.

    @@ -856,24 +796,12 @@

    Submodules +

    +

    spatialpy.core.initialcondition module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -class spatialpy.core.initialcondition.InitialCondition[source]
    +class spatialpy.core.initialcondition.InitialCondition[source]

    Bases: object

    Class used to defined initial conditions in SpatialPy. SubClasses must implement the ‘apply(model)’ method, which @@ -893,7 +821,7 @@

    Submodules
    -class spatialpy.core.initialcondition.PlaceInitialCondition(species, count, location)[source]
    +class spatialpy.core.initialcondition.PlaceInitialCondition(species, count, location)[source]

    Bases: spatialpy.core.initialcondition.InitialCondition

    Class used to defined the place initial condition in SpatialPy.

    @@ -920,7 +848,7 @@

    Submodules
    -class spatialpy.core.initialcondition.ScatterInitialCondition(species, count, types=None)[source]
    +class spatialpy.core.initialcondition.ScatterInitialCondition(species, count, types=None)[source]

    Bases: spatialpy.core.initialcondition.InitialCondition

    Class used to defined the scatter initial condition in SpatialPy.

    @@ -947,7 +875,7 @@

    Submodules
    -class spatialpy.core.initialcondition.UniformInitialCondition(species, count, types=None)[source]
    +class spatialpy.core.initialcondition.UniformInitialCondition(species, count, types=None)[source]

    Bases: spatialpy.core.initialcondition.InitialCondition

    Class used to defined the uniform initial condition in SpatialPy.

    @@ -972,24 +900,12 @@

    Submodules +

    +

    spatialpy.core.model module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -class spatialpy.core.model.Model(name='spatialpy')[source]
    +class spatialpy.core.model.Model(name='spatialpy')[source]

    Bases: object

    Representation of a spatial biochemical model.

    @@ -1320,7 +1236,7 @@

    Submodules
    -reserved_names = ['vol', 't']
    +reserved_names = ['vol', 't']

    @@ -1414,7 +1330,7 @@

    Submodules
    -special_characters = ['[', ']', '+', '-', '*', '/', '.', '^']
    +special_characters = ['[', ']', '+', '-', '*', '/', '.', '^']

    @@ -1464,24 +1380,12 @@

    Submodules +

    +

    spatialpy.core.parameter module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -class spatialpy.core.parameter.Parameter(name=None, expression=None)[source]
    +class spatialpy.core.parameter.Parameter(name=None, expression=None)[source]

    Bases: object

    Model of a rate paramter. A parameter can be given as a String expression (function) or directly as a scalar value. @@ -1497,24 +1401,12 @@

    Submodules +

    +

    spatialpy.core.reaction module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -class spatialpy.core.reaction.Reaction(name='', reactants=None, products=None, propensity_function=None, rate=None, annotation=None, restrict_to=None)[source]
    +class spatialpy.core.reaction.Reaction(name='', reactants=None, products=None, propensity_function=None, rate=None, annotation=None, restrict_to=None)[source]

    Bases: object

    Models a biochemical reaction. A reaction conatains dictionaries of species (reactants and products) and parameters. The reaction’s propensity function needs to be evaluable and result in a non-negative scalar value in the namespace defined by the union of its Reactant, Product and Parameter dictionaries. For mass-action, zeroth, first and second order reactions are supported, attempting to used higher orders will result in an error.

    @@ -1582,24 +1474,12 @@

    Submodules +

    +

    spatialpy.core.result module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -class spatialpy.core.result.Result(model=None, result_dir=None)[source]
    +class spatialpy.core.result.Result(model=None, result_dir=None)[source]

    Bases: object

    Result object for a URDME simulation.

    @@ -1663,7 +1543,7 @@

    Submodules
    -plot_property(property_name, t_ndx=None, t_val=None, p_ndx=0, width=None, height=None, colormap=None, size=5, title=None, animated=False, t_ndx_list=None, speed=1, f_duration=500, t_duration=300, included_types_list=None, return_plotly_figure=False, use_matplotlib=False, debug=False)[source]
    +plot_property(property_name, t_ndx=None, t_val=None, p_ndx=0, width=None, height=None, colormap=None, size=None, title=None, animated=False, t_ndx_list=None, speed=1, f_duration=500, t_duration=300, included_types_list=None, return_plotly_figure=False, use_matplotlib=False, debug=False)[source]

    Plots the Results using plotly. Can only be viewed in a Jupyter Notebook.

    Parameters
    @@ -1808,137 +1688,120 @@

    Submodules +

    +

    spatialpy.core.spatialpyerror module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -exception spatialpy.core.spatialpyerror.BoundaryConditionError[source]
    +exception spatialpy.core.spatialpyerror.BoundaryConditionError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Base class for exceptions in the boundarycondition module.

    -exception spatialpy.core.spatialpyerror.DataFunctionError[source]
    +exception spatialpy.core.spatialpyerror.DataFunctionError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Class for exceptions in the datafunction module.

    -exception spatialpy.core.spatialpyerror.DomainError[source]
    +exception spatialpy.core.spatialpyerror.DomainError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Class for exceptions in the domain module.

    -exception spatialpy.core.spatialpyerror.GeometryError[source]
    +exception spatialpy.core.spatialpyerror.GeometryError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Class for exceptions in the geometry module.

    -exception spatialpy.core.spatialpyerror.InitialConditionError[source]
    +exception spatialpy.core.spatialpyerror.InitialConditionError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Class for exceptions in initailcondition module.

    -exception spatialpy.core.spatialpyerror.ModelError[source]
    +exception spatialpy.core.spatialpyerror.ModelError[source]

    Bases: Exception

    Class for exceptions in the model module.

    -exception spatialpy.core.spatialpyerror.ParameterError[source]
    +exception spatialpy.core.spatialpyerror.ParameterError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Class for exceptions in parameter module.

    -exception spatialpy.core.spatialpyerror.ReactionError[source]
    +exception spatialpy.core.spatialpyerror.ReactionError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Class for exceptions in reaction module.

    -exception spatialpy.core.spatialpyerror.ResultError[source]
    +exception spatialpy.core.spatialpyerror.ResultError[source]

    Bases: Exception

    Class for exceptions in the results module.

    -exception spatialpy.core.spatialpyerror.SimulationError[source]
    +exception spatialpy.core.spatialpyerror.SimulationError[source]

    Bases: Exception

    Class for exceptions in the simulation module.

    -exception spatialpy.core.spatialpyerror.SimulationTimeout[source]
    +exception spatialpy.core.spatialpyerror.SimulationTimeout[source]

    Bases: spatialpy.core.spatialpyerror.SimulationError

    Exception raised for timeout errors.

    -exception spatialpy.core.spatialpyerror.SpeciesError[source]
    +exception spatialpy.core.spatialpyerror.SpeciesError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Class for exceptions in the species module.

    -exception spatialpy.core.spatialpyerror.VTKReaderError[source]
    +exception spatialpy.core.spatialpyerror.VTKReaderError[source]

    Bases: Exception

    Bass class for exceptions in the vtkreader module.

    -exception spatialpy.core.spatialpyerror.VTKReaderIOError(message)[source]
    +exception spatialpy.core.spatialpyerror.VTKReaderIOError(message)[source]

    Bases: spatialpy.core.spatialpyerror.VTKReaderError

    Exception raised for I/O errors.

    -
    -
    +
    +
    +exception spatialpy.core.spatialpyerror.VisualizationError[source]
    +

    Bases: Exception

    +

    Class for exceptions in the visualization module.

    +
    + + +

    spatialpy.core.species module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -class spatialpy.core.species.Species(name=None, diffusion_coefficient=None, restrict_to=None)[source]
    +class spatialpy.core.species.Species(name=None, diffusion_coefficient=None, restrict_to=None)[source]

    Bases: object

    Model of a biochemical species. Must be assigned a diffusion coefficent.

    @@ -1966,24 +1829,51 @@

    Submodules +

    +
    +

    spatialpy.core.visualization module

    +
    +
    +class spatialpy.core.visualization.Visualization(data)[source]
    +

    Bases: object

    +
    +
    +MPL_HEIGHT = 4.8
    +
    + +
    +
    +MPL_SIZE = 40
    +
    + +
    +
    +MPL_WIDTH = 6.4
    +
    + +
    +
    +plot_scatter(plot_args=None, scatter_args=None, multiple_graphs=False, title=None, limits=None)[source]
    +

    Visualize data using maplotlib scatter plots.

    +
    +
    Parameters
    +
      +
    • plot_args (dict) – additional keyword arguments passed to matplotlib.pyplot.subplots

    • +
    • scatter_args (dist) – dict of additional keyword arguments passed to matplotlib.pyplot.scatter for each group.

    • +
    • multiple_graphs (bool | tuple(nrows, ncols)) – if each data entry should be ploted separately or on the same plot. If ploted separately a shape may be provided.

    • +
    +
    +
    +
    + +
    + +
    +

    spatialpy.core.vtkreader module

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -class spatialpy.core.vtkreader.VTKReader(filename=None, debug=False)[source]
    +class spatialpy.core.vtkreader.VTKReader(filename=None, debug=False)[source]

    Bases: object

    VTKReader.py: SpatialPy minimal VTK legacy file reader. Reference: https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf

    @@ -2078,24 +1968,12 @@

    Submodules +

    +

    Module contents

    -

    SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers.

    -

    This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation.

    -

    This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details.

    -

    You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>.

    -class spatialpy.core.BoundaryCondition(xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, type_id=None, deterministic=True, target=None, value=None, model=None)[source]
    +class spatialpy.core.BoundaryCondition(xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, type_id=None, deterministic=True, target=None, value=None, model=None)[source]

    Bases: object

    Set spatial regions of the domain where a property of particles are held constant (updated each simulation step)

    @@ -2146,14 +2024,14 @@

    Submodules
    -exception spatialpy.core.BoundaryConditionError[source]
    +exception spatialpy.core.BoundaryConditionError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Base class for exceptions in the boundarycondition module.

    -class spatialpy.core.DataFunction(name=None)[source]
    +class spatialpy.core.DataFunction(name=None)[source]

    Bases: object

    Abstract class used to constuct the data function.

    @@ -2186,14 +2064,14 @@

    Submodules
    -exception spatialpy.core.DataFunctionError[source]
    +exception spatialpy.core.DataFunctionError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Class for exceptions in the datafunction module.

    -class spatialpy.core.Domain(numpoints, xlim, ylim, zlim, rho0=1.0, c0=10, P0=None, gravity=None)[source]
    +class spatialpy.core.Domain(numpoints, xlim, ylim, zlim, rho0=1.0, c0=10, P0=None, gravity=None)[source]

    Bases: object

    Domain class for SpatialPy. A domain defines points and attributes of a regional space for simulation.

    @@ -2284,7 +2162,7 @@

    Submodules
    -classmethod create_2D_domain(xlim, ylim, nx, ny, type_id=1, mass=1.0, nu=1.0, rho=None, c=0, fixed=False, **kwargs)[source]
    +classmethod create_2D_domain(xlim, ylim, nx, ny, type_id=1, mass=1.0, nu=1.0, rho=None, c=0, fixed=False, **kwargs)[source]

    Create a filled 2D domain

    Parameters
    @@ -2313,7 +2191,7 @@

    Submodules
    -classmethod create_3D_domain(xlim, ylim, zlim, nx, ny, nz, type_id=1, mass=1.0, nu=1.0, rho=None, c=0, fixed=False, **kwargs)[source]
    +classmethod create_3D_domain(xlim, ylim, zlim, nx, ny, nz, type_id=1, mass=1.0, nu=1.0, rho=None, c=0, fixed=False, **kwargs)[source]

    Create a filled 3D domain

    Parameters
    @@ -2369,8 +2247,7 @@

    Submodules
    Parameters
      -
    • geometry_ivar (spatialpy.core.geometry.Geometry) – an instance of a spatialpy.core.geometry.Geometry subclass. The ‘inside()’ method -of this object will be used to create add the particles.

    • +
    • geometry_ivar (spatialpy.core.geometry.Geometry) – an instance of a spatialpy.core.geometry.Geometry subclass. The ‘inside()’ method of this object will be used to create add the particles.

    • deltax (float) – Distance between particles on the x-axis.

    • deltay (float) – Distance between particles on the y-axis (defaults to deltax).

    • deltaz (float) – Distance between particles on the z-axis (defaults to deltax).

    • @@ -2500,7 +2377,7 @@

      Submodules
      -classmethod import_meshio_object(mesh_obj)[source]
      +classmethod import_meshio_object(mesh_obj)[source]

      Import a python meshio mesh object.

      Parameters
      @@ -2517,7 +2394,7 @@

      Submodules
      -plot_types(width=None, height=None, colormap=None, size=5, title=None, included_types_list=None, use_matplotlib=False, return_plotly_figure=False)[source]
      +plot_types(width=None, height=None, colormap=None, size=None, title=None, included_types_list=None, use_matplotlib=False, return_plotly_figure=False)[source]

      Plots the domain using plotly. Can only be viewed in a Jupyter Notebook.

      Parameters
      @@ -2543,7 +2420,7 @@

      Submodules
      -classmethod read_msh_file(filename)[source]
      +classmethod read_msh_file(filename)[source]

      Read a Gmsh style .msh file

      Parameters
      @@ -2560,7 +2437,7 @@

      Submodules
      -classmethod read_stochss_domain(filename)[source]
      +classmethod read_stochss_domain(filename)[source]

      Read a StochSS Domain (.domn) file or pull a StochSS Domain from a StochSS Spatial Model (.smdl) file.

      Parameters
      @@ -2594,7 +2471,7 @@

      Submodules
      -classmethod read_xml_mesh(filename)[source]
      +classmethod read_xml_mesh(filename)[source]

      Read a FEniCS/dolfin style XML mesh file

      Parameters
      @@ -2616,8 +2493,7 @@

      Submodules
      Parameters

      -class spatialpy.core.Geometry[source]
      +class spatialpy.core.Geometry[source]

      Bases: object

      Geometry class provides a method for tagging parts of the spatial domain as separate parts.

      @@ -2676,7 +2552,7 @@

      Submodules
      -class spatialpy.core.GeometryAll[source]
      +class spatialpy.core.GeometryAll[source]

      Bases: spatialpy.core.geometry.Geometry

      Mark all particles.

      @@ -2702,14 +2578,14 @@

      Submodules
      -exception spatialpy.core.GeometryError[source]
      +exception spatialpy.core.GeometryError[source]

      Bases: spatialpy.core.spatialpyerror.ModelError

      Class for exceptions in the geometry module.

      -class spatialpy.core.GeometryExterior[source]
      +class spatialpy.core.GeometryExterior[source]

      Bases: spatialpy.core.geometry.Geometry

      Mark particles that are on the edge of the domain. only works for domains that define triangles and tetrahedrons.

      @@ -2736,7 +2612,7 @@

      Submodules
      -class spatialpy.core.GeometryInterior[source]
      +class spatialpy.core.GeometryInterior[source]

      Bases: spatialpy.core.geometry.Geometry

      Mark particles that are not on the edge of the domain. Only works for domains that define triangles and tetrahedrons.

      @@ -2763,7 +2639,7 @@

      Submodules
      -class spatialpy.core.InitialCondition[source]
      +class spatialpy.core.InitialCondition[source]

      Bases: object

      Class used to defined initial conditions in SpatialPy. SubClasses must implement the ‘apply(model)’ method, which @@ -2783,43 +2659,46 @@

      Submodules
      -exception spatialpy.core.InitialConditionError[source]
      +exception spatialpy.core.InitialConditionError[source]

      Bases: spatialpy.core.spatialpyerror.ModelError

      Class for exceptions in initailcondition module.

      -class spatialpy.core.KDTree(data, leafsize=10)[source]
      -

      Bases: object

      -

      kd-tree for quick nearest-neighbor lookup

      -

      This class provides an index into a set of k-D points which -can be used to rapidly look up the nearest neighbors of any point.

      +class spatialpy.core.KDTree(data, leafsize=10, compact_nodes=True, copy_data=False, balanced_tree=True, boxsize=None)[source] +

      Bases: scipy.spatial.ckdtree.cKDTree

      +

      kd-tree for quick nearest-neighbor lookup.

      +

      This class provides an index into a set of k-dimensional points +which can be used to rapidly look up the nearest neighbors of any +point.

      Parameters
        -
      • data ((N,K) array_like) – The data points to be indexed. This array is not copied, and -so modifying this data will result in bogus results.

      • -
      • leafsize (int, optional) – The number of points at which the algorithm switches over to -brute-force. Has to be positive.

      • +
      • data (array_like, shape (n,m)) – The n data points of dimension m to be indexed. This array is +not copied unless this is necessary to produce a contiguous +array of doubles, and so modifying this data will result in +bogus results. The data are also copied if the kd-tree is built +with copy_data=True.

      • +
      • leafsize (positive int, optional) – The number of points at which the algorithm switches over to +brute-force. Default: 10.

      • +
      • compact_nodes (bool, optional) – If True, the kd-tree is built to shrink the hyperrectangles to +the actual data range. This usually gives a more compact tree that +is robust against degenerated input data and gives faster queries +at the expense of longer build time. Default: True.

      • +
      • copy_data (bool, optional) – If True the data is always copied to protect the kd-tree against +data corruption. Default: False.

      • +
      • balanced_tree (bool, optional) – If True, the median is used to split the hyperrectangles instead of +the midpoint. This usually gives a more compact tree and +faster queries at the expense of longer build time. Default: True.

      • +
      • boxsize (array_like or scalar, optional) – Apply a m-d toroidal topology to the KDTree.. The topology is generated +by \(x_i + n_i L_i\) where \(n_i\) are integers and \(L_i\) +is the boxsize along i-th dimension. The input data shall be wrapped +into \([0, L_i)\). A ValueError is raised if any of the data is +outside of this bound.

      -
      Raises
      -

      RuntimeError – The maximum recursion limit can be exceeded for large data - sets. If this happens, either increase the value for the leafsize - parameter or increase the recursion limit by:: - - >>> import sys - >>> sys.setrecursionlimit(10000)

      -
      -
      -

      See also

      -
      -
      cKDTree

      Implementation of KDTree in Cython

      -
      -
      -

      Notes

      The algorithm used is described in Maneewongvatana and Mount 1999. The general idea is that the kd-tree is a binary tree, each of whose @@ -2836,153 +2715,414 @@

      Submodules +
      +data
      +

      The n data points of dimension m to be indexed. This array is +not copied unless this is necessary to produce a contiguous +array of doubles. The data are also copied if the kd-tree is built +with copy_data=True.

      +
      +
      Type
      +

      ndarray, shape (n,m)

      +
      +
      +

      + +
      +
      +leafsize
      +

      The number of points at which the algorithm switches over to +brute-force.

      +
      +
      Type
      +

      positive int

      +
      +
      +
      + +
      +
      +m
      +

      The dimension of a single data-point.

      +
      +
      Type
      +

      int

      +
      +
      +
      + +
      +
      +n
      +

      The number of data points.

      +
      +
      Type
      +

      int

      +
      +
      +
      + +
      +
      +maxes
      +

      The maximum value in each dimension of the n data points.

      +
      +
      Type
      +

      ndarray, shape (m,)

      +
      +
      +
      + +
      +
      +mins
      +

      The minimum value in each dimension of the n data points.

      +
      +
      Type
      +

      ndarray, shape (m,)

      +
      +
      +
      + +
      +
      +size
      +

      The number of nodes in the tree.

      +
      +
      Type
      +

      int

      +
      +
      +
      +
      -count_neighbors(other, r, p=2.0)[source]
      +count_neighbors(other, r, p=2.0, weights=None, cumulative=True)[source]

      Count how many nearby pairs can be formed.

      -

      Count the number of pairs (x1,x2) can be formed, with x1 drawn -from self and x2 drawn from other, and where -distance(x1, x2, p) <= r. -This is the “two-point correlation” described in Gray and Moore 2000, -“N-body problems in statistical learning”, and the code here is based -on their algorithm.

      +

      Count the number of pairs (x1,x2) can be formed, with x1 drawn +from self and x2 drawn from other, and where +distance(x1, x2, p) <= r.

      +

      Data points on self and other are optionally weighted by the +weights argument. (See below)

      +

      This is adapted from the “two-point correlation” algorithm described by +Gray and Moore 1. See notes for further discussion.

      Parameters
        -
      • other (KDTree instance) – The other tree to draw points from.

      • +
      • other (KDTree) – The other tree to draw points from, can be the same tree as self.

      • r (float or one-dimensional array of floats) – The radius to produce a count for. Multiple radii are searched with -a single tree traversal.

      • -
      • p (float, 1<=p<=infinity, optional) – Which Minkowski p-norm to use

      • +a single tree traversal. +If the count is non-cumulative(cumulative=False), r defines +the edges of the bins, and must be non-decreasing.

        +
      • p (float, optional) – 1<=p<=infinity. +Which Minkowski p-norm to use. +Default 2.0. +A finite large p may cause a ValueError if overflow can occur.

      • +
      • weights (tuple, array_like, or None, optional) –

        If None, the pair-counting is unweighted. +If given as a tuple, weights[0] is the weights of points in +self, and weights[1] is the weights of points in other; +either can be None to indicate the points are unweighted. +If given as an array_like, weights is the weights of points in +self and other. For this to make sense, self and +other must be the same tree. If self and other are two +different trees, a ValueError is raised. +Default: None

        +
        +

        New in version 1.6.0.

        +
        +

      • +
      • cumulative (bool, optional) –

        Whether the returned counts are cumulative. When cumulative is set +to False the algorithm is optimized to work with a large number +of bins (>10) specified by r. When cumulative is set to +True, the algorithm is optimized to work with a small number of +r. Default: True

        +
        +

        New in version 1.6.0.

        +
        +

      Returns
      -

      result – The number of pairs. Note that this is internally stored in a numpy -int, and so may overflow if very large (2e9).

      +

      result – The number of pairs. For unweighted counts, the result is integer. +For weighted counts, the result is float. +If cumulative is False, result[i] contains the counts with +(-inf if i == 0 else r[i-1]) < R <= r[i]

      Return type
      -

      int or 1-D array of ints

      +

      scalar or 1-D array

      +

      Notes

      +

      Pair-counting is the basic operation used to calculate the two point +correlation functions from a data set composed of position of objects.

      +

      Two point correlation function measures the clustering of objects and +is widely used in cosmology to quantify the large scale structure +in our Universe, but it may be useful for data analysis in other fields +where self-similar assembly of objects also occur.

      +

      The Landy-Szalay estimator for the two point correlation function of +D measures the clustering signal in D. 2

      +

      For example, given the position of two sets of objects,

      +
        +
      • objects D (data) contains the clustering signal, and

      • +
      • objects R (random) that contains no signal,

      • +
      +
      +\[\xi(r) = \frac{<D, D> - 2 f <D, R> + f^2<R, R>}{f^2<R, R>},\]
      +

      where the brackets represents counting pairs between two data sets +in a finite bin around r (distance), corresponding to setting +cumulative=False, and f = float(len(D)) / float(len(R)) is the +ratio between number of objects from data and random.

      +

      The algorithm implemented here is loosely based on the dual-tree +algorithm described in 1. We switch between two different +pair-cumulation scheme depending on the setting of cumulative. +The computing time of the method we use when for +cumulative == False does not scale with the total number of bins. +The algorithm for cumulative == True scales linearly with the +number of bins, though it is slightly faster when only +1 or 2 bins are used. 5.

      +

      As an extension to the naive pair-counting, +weighted pair-counting counts the product of weights instead +of number of pairs. +Weighted pair-counting is used to estimate marked correlation functions +(3, section 2.2), +or to properly calculate the average of data per distance bin +(e.g. 4, section 2.1 on redshift).

      +
      +
      1(1,2)
      +

      Gray and Moore, +“N-body problems in statistical learning”, +Mining the sky, 2000, +https://arxiv.org/abs/astro-ph/0012333

      +
      +
      2
      +

      Landy and Szalay, +“Bias and variance of angular correlation functions”, +The Astrophysical Journal, 1993, +http://adsabs.harvard.edu/abs/1993ApJ…412…64L

      +
      +
      3
      +

      Sheth, Connolly and Skibba, +“Marked correlations in galaxy formation models”, +Arxiv e-print, 2005, +https://arxiv.org/abs/astro-ph/0511773

      +
      +
      4
      +

      Hawkins, et al., +“The 2dF Galaxy Redshift Survey: correlation functions, +peculiar velocities and the matter density of the Universe”, +Monthly Notices of the Royal Astronomical Society, 2002, +http://adsabs.harvard.edu/abs/2003MNRAS.346…78H

      +
      +
      5
      +

      https://github.com/scipy/scipy/pull/5647#issuecomment-168474926

      +
      +
      +

      Examples

      +

      You can count neighbors number between two kd-trees within a distance:

      +
      >>> import numpy as np
      +>>> from scipy.spatial import KDTree
      +>>> rng = np.random.default_rng()
      +>>> points1 = rng.random((5, 2))
      +>>> points2 = rng.random((5, 2))
      +>>> kd_tree1 = KDTree(points1)
      +>>> kd_tree2 = KDTree(points2)
      +>>> kd_tree1.count_neighbors(kd_tree2, 0.2)
      +1
      +
      +
      +

      This number is same as the total pair number calculated by +query_ball_tree:

      +
      >>> indexes = kd_tree1.query_ball_tree(kd_tree2, r=0.2)
      +>>> sum([len(i) for i in indexes])
      +1
      +
      +
      -class innernode(split_dim, split, less, greater)[source]
      +class innernode(ckdtreenode)[source]

      Bases: scipy.spatial.kdtree.KDTree.node

      +
      +
      +property children
      +
      + +
      +
      +property split
      +
      + +
      +
      +property split_dim
      +
      +
      -class leafnode(idx)[source]
      +class leafnode(ckdtree_node=None)[source]

      Bases: scipy.spatial.kdtree.KDTree.node

      +
      +
      +property children
      +
      + +
      +
      +property idx
      +
      +
      -class node[source]
      +class node(ckdtree_node=None)[source]

      Bases: object

      -query(x, k=1, eps=0, p=2, distance_upper_bound=inf)[source]
      -

      Query the kd-tree for nearest neighbors

      +query(x, k=1, eps=0, p=2, distance_upper_bound=inf, workers=1)[source] +

      Query the kd-tree for nearest neighbors.

      Parameters
      • x (array_like, last dimension self.m) – An array of points to query.

      • -
      • k (int, optional) – The number of nearest neighbors to return.

      • +
      • k (int or Sequence[int], optional) – Either the number of nearest neighbors to return, or a list of the +k-th nearest neighbors to return, starting from 1.

      • eps (nonnegative float, optional) – Return approximate nearest neighbors; the kth returned value is guaranteed to be no further than (1+eps) times the distance to the real kth nearest neighbor.

      • p (float, 1<=p<=infinity, optional) – Which Minkowski p-norm to use. -1 is the sum-of-absolute-values “Manhattan” distance -2 is the usual Euclidean distance -infinity is the maximum-coordinate-difference distance

      • +1 is the sum-of-absolute-values distance (“Manhattan” distance). +2 is the usual Euclidean distance. +infinity is the maximum-coordinate-difference distance. +A large, finite p may cause a ValueError if overflow can occur.

      • distance_upper_bound (nonnegative float, optional) – Return only neighbors within this distance. This is used to prune tree searches, so if you are doing a series of nearest-neighbor queries, it may help to supply the distance to the nearest neighbor of the most recent point.

      • +
      • workers (int, optional) –

        Number of workers to use for parallel processing. If -1 is given +all CPU threads are used. Default: 1.

        +
        +

        New in version 1.6.0.

        +
        +

      Returns
      -

        +

        • d (float or array of floats) – The distances to the nearest neighbors. -If x has shape tuple+(self.m,), then d has shape tuple if -k is one, or tuple+(k,) if k is larger than one. Missing -neighbors (e.g. when k > n or distance_upper_bound is -given) are indicated with infinite distances. If k is None, -then d is an object array of shape tuple, containing lists -of distances. In either case the hits are sorted by distance -(nearest first).

        • -
        • i (integer or array of integers) – The locations of the neighbors in self.data. i is the same -shape as d.

        • +If x has shape tuple+(self.m,), then d has shape +tuple+(k,). +When k == 1, the last dimension of the output is squeezed. +Missing neighbors are indicated with infinite distances. +Hits are sorted by distance (nearest first).

          +
          +

          Deprecated since version 1.6.0: If k=None, then d is an object array of shape tuple, +containing lists of distances. This behavior is deprecated and +will be removed in SciPy 1.8.0, use query_ball_point +instead.

          +
          + +
        • i (integer or array of integers) – The index of each neighbor in self.data. +i is the same shape as d. +Missing neighbors are indicated with self.n.

      Examples

      -
      >>> from scipy import spatial
      +
      >>> import numpy as np
      +>>> from scipy.spatial import KDTree
       >>> x, y = np.mgrid[0:5, 2:8]
      ->>> tree = spatial.KDTree(list(zip(x.ravel(), y.ravel())))
      ->>> tree.data
      -array([[0, 2],
      -       [0, 3],
      -       [0, 4],
      -       [0, 5],
      -       [0, 6],
      -       [0, 7],
      -       [1, 2],
      -       [1, 3],
      -       [1, 4],
      -       [1, 5],
      -       [1, 6],
      -       [1, 7],
      -       [2, 2],
      -       [2, 3],
      -       [2, 4],
      -       [2, 5],
      -       [2, 6],
      -       [2, 7],
      -       [3, 2],
      -       [3, 3],
      -       [3, 4],
      -       [3, 5],
      -       [3, 6],
      -       [3, 7],
      -       [4, 2],
      -       [4, 3],
      -       [4, 4],
      -       [4, 5],
      -       [4, 6],
      -       [4, 7]])
      ->>> pts = np.array([[0, 0], [2.1, 2.9]])
      ->>> tree.query(pts)
      -(array([ 2.        ,  0.14142136]), array([ 0, 13]))
      ->>> tree.query(pts[0])
      -(2.0, 0)
      +>>> tree = KDTree(np.c_[x.ravel(), y.ravel()])
      +
      +
      +

      To query the nearest neighbours and return squeezed result, use

      +
      >>> dd, ii = tree.query([[0, 0], [2.2, 2.9]], k=1)
      +>>> print(dd, ii, sep='\n')
      +[2.         0.2236068]
      +[ 0 13]
      +
      +
      +

      To query the nearest neighbours and return unsqueezed result, use

      +
      >>> dd, ii = tree.query([[0, 0], [2.2, 2.9]], k=[1])
      +>>> print(dd, ii, sep='\n')
      +[[2.        ]
      + [0.2236068]]
      +[[ 0]
      + [13]]
      +
      +
      +

      To query the second nearest neighbours and return unsqueezed result, +use

      +
      >>> dd, ii = tree.query([[0, 0], [2.2, 2.9]], k=[2])
      +>>> print(dd, ii, sep='\n')
      +[[2.23606798]
      + [0.80622577]]
      +[[ 6]
      + [19]]
      +
      +
      +

      To query the first and second nearest neighbours, use

      +
      >>> dd, ii = tree.query([[0, 0], [2.2, 2.9]], k=2)
      +>>> print(dd, ii, sep='\n')
      +[[2.         2.23606798]
      + [0.2236068  0.80622577]]
      +[[ 0  6]
      + [13 19]]
      +
      +
      +

      or, be more specific

      +
      >>> dd, ii = tree.query([[0, 0], [2.2, 2.9]], k=[1, 2])
      +>>> print(dd, ii, sep='\n')
      +[[2.         2.23606798]
      + [0.2236068  0.80622577]]
      +[[ 0  6]
      + [13 19]]
       
      -query_ball_point(x, r, p=2.0, eps=0)[source]
      +query_ball_point(x, r, p=2.0, eps=0, workers=1, return_sorted=None, return_length=False)[source]

      Find all points within distance r of point(s) x.

      Parameters
      • x (array_like, shape tuple + (self.m,)) – The point or points to search for neighbors of.

      • -
      • r (positive float) – The radius of points to return.

      • -
      • p (float, optional) – Which Minkowski p-norm to use. Should be in the range [1, inf].

      • +
      • r (array_like, float) – The radius of points to return, must broadcast to the length of x.

      • +
      • p (float, optional) – Which Minkowski p-norm to use. Should be in the range [1, inf]. +A finite large p may cause a ValueError if overflow can occur.

      • eps (nonnegative float, optional) – Approximate search. Branches of the tree are not explored if their nearest points are further than r / (1 + eps), and branches are added in bulk if their furthest points are nearer than r * (1 + eps).

      • +
      • workers (int, optional) –

        Number of jobs to schedule for parallel processing. If -1 is given +all processors are used. Default: 1.

        +
        +

        New in version 1.6.0.

        +
        +

      • +
      • return_sorted (bool, optional) –

        Sorts returned indicies if True and does not sort them if False. If +None, does not sort single point queries, but does sort +multi-point queries which was the behavior before this option +was added.

        +
        +

        New in version 1.6.0.

        +
        +

      • +
      • return_length (bool, optional) –

        Return the number of points inside the radius instead of a list +of the indices.

        +
        +

        New in version 1.6.0.

        +
        +

      Returns
      @@ -3003,7 +3143,7 @@

      Submodules>>> x, y = np.mgrid[0:5, 0:5] >>> points = np.c_[x.ravel(), y.ravel()] >>> tree = spatial.KDTree(points) ->>> tree.query_ball_point([2, 0], 1) +>>> sorted(tree.query_ball_point([2, 0], 1)) [5, 10, 11, 15]

    @@ -3023,7 +3163,8 @@

    Submodules
    query_ball_tree(other, r, p=2.0, eps=0)[source]
    -

    Find all pairs of points whose distance is at most r

    +

    Find all pairs of points between self and other whose distance is +at most r.

    Parameters
    +

    Examples

    +

    You can search all pairs of points between two kd-trees within a distance:

    +
    >>> import matplotlib.pyplot as plt
    +>>> import numpy as np
    +>>> from scipy.spatial import KDTree
    +>>> rng = np.random.default_rng()
    +>>> points1 = rng.random((15, 2))
    +>>> points2 = rng.random((15, 2))
    +>>> plt.figure(figsize=(6, 6))
    +>>> plt.plot(points1[:, 0], points1[:, 1], "xk", markersize=14)
    +>>> plt.plot(points2[:, 0], points2[:, 1], "og", markersize=14)
    +>>> kd_tree1 = KDTree(points1)
    +>>> kd_tree2 = KDTree(points2)
    +>>> indexes = kd_tree1.query_ball_tree(kd_tree2, r=0.2)
    +>>> for i in range(len(indexes)):
    +...     for j in indexes[i]:
    +...         plt.plot([points1[i, 0], points2[j, 0]],
    +...             [points1[i, 1], points2[j, 1]], "-r")
    +>>> plt.show()
    +
    +
    -query_pairs(r, p=2.0, eps=0)[source]
    -

    Find all pairs of points within a distance.

    +query_pairs(r, p=2.0, eps=0, output_type='set')[source] +

    Find all pairs of points in self whose distance is at most r.

    Parameters
    Returns

    results – Set of pairs (i,j), with i < j, for which the corresponding -positions are close.

    +positions are close. If output_type is ‘ndarray’, an ndarry is +returned instead of a set.

    Return type
    -

    set

    +

    set or ndarray

    +

    Examples

    +

    You can search all pairs of points in a kd-tree within a distance:

    +
    >>> import matplotlib.pyplot as plt
    +>>> import numpy as np
    +>>> from scipy.spatial import KDTree
    +>>> rng = np.random.default_rng()
    +>>> points = rng.random((20, 2))
    +>>> plt.figure(figsize=(6, 6))
    +>>> plt.plot(points[:, 0], points[:, 1], "xk", markersize=14)
    +>>> kd_tree = KDTree(points)
    +>>> pairs = kd_tree.query_pairs(r=0.2)
    +>>> for (i, j) in pairs:
    +...     plt.plot([points[i, 0], points[j, 0]],
    +...             [points[i, 1], points[j, 1]], "-r")
    +>>> plt.show()
    +
    +
    -sparse_distance_matrix(other, max_distance, p=2.0)[source]
    -

    Compute a sparse distance matrix

    +sparse_distance_matrix(other, max_distance, p=2.0, output_type='dok_matrix')[source] +

    Compute a sparse distance matrix.

    Computes a distance matrix between two KDTrees, leaving as zero any distance greater than max_distance.

    @@ -3084,23 +3269,66 @@

    Submodules
    • other (KDTree) –

    • max_distance (positive float) –

    • -
    • p (float, optional) –

    • +
    • p (float, 1<=p<=infinity) – Which Minkowski p-norm to use. +A finite large p may cause a ValueError if overflow can occur.

    • +
    • output_type (string, optional) –

      Which container to use for output data. Options: ‘dok_matrix’, +‘coo_matrix’, ‘dict’, or ‘ndarray’. Default: ‘dok_matrix’.

      +
      +

      New in version 1.6.0.

      +
      +

    Returns
    -

    result – Sparse matrix representing the results in “dictionary of keys” format.

    +

    result – Sparse matrix representing the results in “dictionary of keys” +format. If a dict is returned the keys are (i,j) tuples of indices. +If output_type is ‘ndarray’ a record array with fields ‘i’, ‘j’, +and ‘v’ is returned,

    Return type
    -

    dok_matrix

    +

    dok_matrix, coo_matrix, dict or ndarray

    +

    Examples

    +

    You can compute a sparse distance matrix between two kd-trees:

    +
    >>> import numpy as np
    +>>> from scipy.spatial import KDTree
    +>>> rng = np.random.default_rng()
    +>>> points1 = rng.random((5, 2))
    +>>> points2 = rng.random((5, 2))
    +>>> kd_tree1 = KDTree(points1)
    +>>> kd_tree2 = KDTree(points2)
    +>>> sdm = kd_tree1.sparse_distance_matrix(kd_tree2, 0.3)
    +>>> sdm.toarray()
    +array([[0.        , 0.        , 0.12295571, 0.        , 0.        ],
    +   [0.        , 0.        , 0.        , 0.        , 0.        ],
    +   [0.28942611, 0.        , 0.        , 0.2333084 , 0.        ],
    +   [0.        , 0.        , 0.        , 0.        , 0.        ],
    +   [0.24617575, 0.29571802, 0.26836782, 0.        , 0.        ]])
    +
    +
    +

    You can check distances above the max_distance are zeros:

    +
    >>> from scipy.spatial import distance_matrix
    +>>> distance_matrix(points1, points2)
    +array([[0.56906522, 0.39923701, 0.12295571, 0.8658745 , 0.79428925],
    +   [0.37327919, 0.7225693 , 0.87665969, 0.32580855, 0.75679479],
    +   [0.28942611, 0.30088013, 0.6395831 , 0.2333084 , 0.33630734],
    +   [0.31994999, 0.72658602, 0.71124834, 0.55396483, 0.90785663],
    +   [0.24617575, 0.29571802, 0.26836782, 0.57714465, 0.6473269 ]])
    +
    +
    +
    +
    +property tree
    +
    +
    -class spatialpy.core.Model(name='spatialpy')[source]
    +class spatialpy.core.Model(name='spatialpy')[source]

    Bases: object

    Representation of a spatial biochemical model.

    @@ -3431,7 +3659,7 @@

    Submodules
    -reserved_names = ['vol', 't']
    +reserved_names = ['vol', 't']

    @@ -3525,7 +3753,7 @@

    Submodules
    -special_characters = ['[', ']', '+', '-', '*', '/', '.', '^']
    +special_characters = ['[', ']', '+', '-', '*', '/', '.', '^']

    @@ -3556,14 +3784,14 @@

    Submodules
    -exception spatialpy.core.ModelError[source]
    +exception spatialpy.core.ModelError[source]

    Bases: Exception

    Class for exceptions in the model module.

    -class spatialpy.core.OrderedDict[source]
    +class spatialpy.core.OrderedDict[source]

    Bases: dict

    Dictionary that remembers insertion order

    @@ -3584,12 +3812,12 @@

    Submodules
    -items() a set-like object providing a view on D’s items
    +items() a set-like object providing a view on D's items

    -keys() a set-like object providing a view on D’s keys
    +keys() a set-like object providing a view on D's keys
    @@ -3601,7 +3829,7 @@

    Submodules
    -pop(k[, d]) v, remove specified key and return the corresponding
    +pop(k[, d]) v, remove specified key and return the corresponding

    value. If key is not found, d is returned if given, otherwise KeyError is raised.

    @@ -3622,7 +3850,7 @@

    Submodules
    -update([E, ]**F) None.  Update D from dict/iterable E and F.
    +update([E, ]**F) None.  Update D from dict/iterable E and F.

    If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

    @@ -3630,14 +3858,14 @@

    Submodules
    -values() an object providing a view on D’s values
    +values() an object providing a view on D's values

    -class spatialpy.core.Parameter(name=None, expression=None)[source]
    +class spatialpy.core.Parameter(name=None, expression=None)[source]

    Bases: object

    Model of a rate paramter. A parameter can be given as a String expression (function) or directly as a scalar value. @@ -3655,14 +3883,14 @@

    Submodules
    -exception spatialpy.core.ParameterError[source]
    +exception spatialpy.core.ParameterError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Class for exceptions in parameter module.

    -class spatialpy.core.PlaceInitialCondition(species, count, location)[source]
    +class spatialpy.core.PlaceInitialCondition(species, count, location)[source]

    Bases: spatialpy.core.initialcondition.InitialCondition

    Class used to defined the place initial condition in SpatialPy.

    @@ -3689,7 +3917,7 @@

    Submodules
    -class spatialpy.core.Reaction(name='', reactants=None, products=None, propensity_function=None, rate=None, annotation=None, restrict_to=None)[source]
    +class spatialpy.core.Reaction(name='', reactants=None, products=None, propensity_function=None, rate=None, annotation=None, restrict_to=None)[source]

    Bases: object

    Models a biochemical reaction. A reaction conatains dictionaries of species (reactants and products) and parameters. The reaction’s propensity function needs to be evaluable and result in a non-negative scalar value in the namespace defined by the union of its Reactant, Product and Parameter dictionaries. For mass-action, zeroth, first and second order reactions are supported, attempting to used higher orders will result in an error.

    @@ -3759,14 +3987,14 @@

    Submodules
    -exception spatialpy.core.ReactionError[source]
    +exception spatialpy.core.ReactionError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Class for exceptions in reaction module.

    -class spatialpy.core.Result(model=None, result_dir=None)[source]
    +class spatialpy.core.Result(model=None, result_dir=None)[source]

    Bases: object

    Result object for a URDME simulation.

    @@ -3830,7 +4058,7 @@

    Submodules
    -plot_property(property_name, t_ndx=None, t_val=None, p_ndx=0, width=None, height=None, colormap=None, size=5, title=None, animated=False, t_ndx_list=None, speed=1, f_duration=500, t_duration=300, included_types_list=None, return_plotly_figure=False, use_matplotlib=False, debug=False)[source]
    +plot_property(property_name, t_ndx=None, t_val=None, p_ndx=0, width=None, height=None, colormap=None, size=None, title=None, animated=False, t_ndx_list=None, speed=1, f_duration=500, t_duration=300, included_types_list=None, return_plotly_figure=False, use_matplotlib=False, debug=False)[source]

    Plots the Results using plotly. Can only be viewed in a Jupyter Notebook.

    Parameters
    @@ -3977,14 +4205,14 @@

    Submodules
    -exception spatialpy.core.ResultError[source]
    +exception spatialpy.core.ResultError[source]

    Bases: Exception

    Class for exceptions in the results module.

    -class spatialpy.core.ScatterInitialCondition(species, count, types=None)[source]
    +class spatialpy.core.ScatterInitialCondition(species, count, types=None)[source]

    Bases: spatialpy.core.initialcondition.InitialCondition

    Class used to defined the scatter initial condition in SpatialPy.

    @@ -4011,21 +4239,21 @@

    Submodules
    -exception spatialpy.core.SimulationError[source]
    +exception spatialpy.core.SimulationError[source]

    Bases: Exception

    Class for exceptions in the simulation module.

    -exception spatialpy.core.SimulationTimeout[source]
    +exception spatialpy.core.SimulationTimeout[source]

    Bases: spatialpy.core.spatialpyerror.SimulationError

    Exception raised for timeout errors.

    -class spatialpy.core.Species(name=None, diffusion_coefficient=None, restrict_to=None)[source]
    +class spatialpy.core.Species(name=None, diffusion_coefficient=None, restrict_to=None)[source]

    Bases: object

    Model of a biochemical species. Must be assigned a diffusion coefficent.

    @@ -4055,14 +4283,14 @@

    Submodules
    -exception spatialpy.core.SpeciesError[source]
    +exception spatialpy.core.SpeciesError[source]

    Bases: spatialpy.core.spatialpyerror.ModelError

    Class for exceptions in the species module.

    -class spatialpy.core.UniformInitialCondition(species, count, types=None)[source]
    +class spatialpy.core.UniformInitialCondition(species, count, types=None)[source]

    Bases: spatialpy.core.initialcondition.InitialCondition

    Class used to defined the uniform initial condition in SpatialPy.

    @@ -4089,7 +4317,7 @@

    Submodules
    -class spatialpy.core.VTKReader(filename=None, debug=False)[source]
    +class spatialpy.core.VTKReader(filename=None, debug=False)[source]

    Bases: object

    VTKReader.py: SpatialPy minimal VTK legacy file reader. Reference: https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf

    @@ -4186,18 +4414,61 @@

    Submodules
    -exception spatialpy.core.VTKReaderError[source]
    +exception spatialpy.core.VTKReaderError[source]

    Bases: Exception

    Bass class for exceptions in the vtkreader module.

    -exception spatialpy.core.VTKReaderIOError(message)[source]
    +exception spatialpy.core.VTKReaderIOError(message)[source]

    Bases: spatialpy.core.spatialpyerror.VTKReaderError

    Exception raised for I/O errors.

    +
    +
    +class spatialpy.core.Visualization(data)[source]
    +

    Bases: object

    +
    +
    +MPL_HEIGHT = 4.8
    +
    + +
    +
    +MPL_SIZE = 40
    +
    + +
    +
    +MPL_WIDTH = 6.4
    +
    + +
    +
    +plot_scatter(plot_args=None, scatter_args=None, multiple_graphs=False, title=None, limits=None)[source]
    +

    Visualize data using maplotlib scatter plots.

    +
    +
    Parameters
    +
      +
    • plot_args (dict) – additional keyword arguments passed to matplotlib.pyplot.subplots

    • +
    • scatter_args (dist) – dict of additional keyword arguments passed to matplotlib.pyplot.scatter for each group.

    • +
    • multiple_graphs (bool | tuple(nrows, ncols)) – if each data entry should be ploted separately or on the same plot. If ploted separately a shape may be provided.

    • +
    +
    +
    +
    + +
    + +
    +
    +exception spatialpy.core.VisualizationError[source]
    +

    Bases: Exception

    +

    Class for exceptions in the visualization module.

    +
    +
    spatialpy.core.cleanup_build_files(build_dir=None)[source]
    @@ -4234,7 +4505,7 @@

    Submodules
    -class spatialpy.core.combinations(iterable, r)
    +class spatialpy.core.combinations(iterable, r)

    Bases: object

    Return successive r-length combinations of elements in the iterable.

    combinations(range(4), 3) –> (0,1,2), (0,1,3), (0,2,3), (1,2,3)

    @@ -4289,7 +4560,7 @@

    Submodules -
    image (default=None |’png’ |’jpeg’ |’svg’ |’webp’) – This parameter sets

    the format of the image to be downloaded, if we choose to download an +

    image (default=None |’png’ |’jpeg’ |’svg’ |’webp’) – This parameter sets

    the format of the image to be downloaded, if we choose to download an image. This parameter has a default value of None indicating that no image should be downloaded. Please note: for higher resolution images and more export options, consider using plotly.io.write_image. See @@ -4326,7 +4597,7 @@

    Submodulesiplot([{'x': [1, 2, 3], 'y': [5, 2, 7]}], image='png') `

    animation_opts Example: -``` +``` from plotly.offline import iplot figure = {‘data’: [{‘x’: [0, 1], ‘y’: [0, 1]}],

    @@ -4343,11 +4614,11 @@

    Submodules```

    +```

    -

    -
    + +
    @@ -4372,10 +4643,10 @@

    Submodules

    @@ -987,10 +952,10 @@

    Submodules

    @@ -178,10 +155,10 @@

    Submodules

    diff --git a/docs/build/html/index.html b/docs/build/html/index.html index dfb90b68..66bc1ed0 100644 --- a/docs/build/html/index.html +++ b/docs/build/html/index.html @@ -4,8 +4,9 @@ - - Documentation for SpatialPy 1.0 — SpatialPy 1.0 documentation + + + Documentation for SpatialPy 1.0.2 — SpatialPy 1.0.2 documentation @@ -90,23 +91,23 @@

    Quick search

    -
    -

    Documentation for SpatialPy 1.0

    +
    +

    Documentation for SpatialPy 1.0.2

    SpatialPy is a Python 3 package for simulation of spatial deterministic/stochastic reaction-diffusion-advection problems embedded in Lagrangian reference frame particle based fluid dynamics domain

    This package is intended to replace the PyURDME software https://github.com/pyurdme/pyurdme and will feature both a NSM solver for RDME simulation on static domains and a sSSA-SDPD particle based fluid dynamics solver as described in the publication “A hybrid smoothed dissipative particle dynamics (SDPD) spatial stochastic simulation algorithm (sSSA) for advection–diffusion–reaction problems” by Drawert, Jacob, Li, Yi, Petzold https://www.sciencedirect.com/science/article/pii/S0021999118307101

    -
    +

    Getting a copy of SpatialPy

    The latest version of SpatialPy can be found on PyPI. The source code is available on GitHub. SpatialPy is licensed under the GNU General Public License version 3.

    -

    Please register as a user! SpatialPy's development is funded by NIH grant 2R01EB014877, and to continue support, we need to prove SpatialPy has users. Please fill out our short registration form!

    -
    +

    Please register as a user! SpatialPy's development is funded by NIH grant 2R01EB014877, and to continue support, we need to prove SpatialPy has users. Please fill out our short registration form!

    +

    Examples

    See our Example Notebook - Start Here for more information on how to build and simulate your models with SpatialPy. For an example of how to use SpatialPy to simulate a spatial stochastic reaction-diffusion system, see the 3D Cylinder Demo. We also provide examples of how to use SpatialPy to simulate physics (Gravity Demo) and fluid flow (Weir Model).

    -
    -
    + +

    Reporting Issues

    If you find any problem with SpatialPy or this documentation, please report it using the GitHub issue tracker for the project. You can also contact the main author, Dr. Brian Drawert, directly with questions and suggestions.

    -
    -
    + +

    Documentation

    API reference

    @@ -123,16 +124,16 @@

    Documentation +

    + +

    Indices and tables

    -
    +
    @@ -153,10 +154,10 @@

    Indices and tables

    diff --git a/docs/build/html/search.html b/docs/build/html/search.html index 0fca5605..41abcb61 100644 --- a/docs/build/html/search.html +++ b/docs/build/html/search.html @@ -5,7 +5,7 @@ - Search — SpatialPy 1.0 documentation + Search — SpatialPy 1.0.2 documentation @@ -86,13 +86,14 @@

    Related Topics

    Search

    -
    - +

    @@ -128,10 +129,10 @@

    Search

    diff --git a/docs/build/html/searchindex.js b/docs/build/html/searchindex.js index 70ef50ba..93ab9a19 100644 --- a/docs/build/html/searchindex.js +++ b/docs/build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["classes/spatialpy","classes/spatialpy.core","classes/spatialpy.solvers","classes/spatialpy.stochss","index"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["classes/spatialpy.rst","classes/spatialpy.core.rst","classes/spatialpy.solvers.rst","classes/spatialpy.stochss.rst","index.rst"],objects:{"":{spatialpy:[0,0,0,"-"]},"spatialpy.core":{BoundaryCondition:[1,1,1,""],BoundaryConditionError:[1,3,1,""],DataFunction:[1,1,1,""],DataFunctionError:[1,3,1,""],Domain:[1,1,1,""],DomainError:[1,3,1,""],Geometry:[1,1,1,""],GeometryAll:[1,1,1,""],GeometryError:[1,3,1,""],GeometryExterior:[1,1,1,""],GeometryInterior:[1,1,1,""],InitialCondition:[1,1,1,""],InitialConditionError:[1,3,1,""],KDTree:[1,1,1,""],Model:[1,1,1,""],ModelError:[1,3,1,""],OrderedDict:[1,1,1,""],Parameter:[1,1,1,""],ParameterError:[1,3,1,""],PlaceInitialCondition:[1,1,1,""],Reaction:[1,1,1,""],ReactionError:[1,3,1,""],Result:[1,1,1,""],ResultError:[1,3,1,""],ScatterInitialCondition:[1,1,1,""],SimulationError:[1,3,1,""],SimulationTimeout:[1,3,1,""],Species:[1,1,1,""],SpeciesError:[1,3,1,""],UniformInitialCondition:[1,1,1,""],VTKReader:[1,1,1,""],VTKReaderError:[1,3,1,""],VTKReaderIOError:[1,3,1,""],boundarycondition:[1,0,0,"-"],cleanup:[1,0,0,"-"],cleanup_build_files:[1,5,1,""],cleanup_core_files:[1,5,1,""],cleanup_result_files:[1,5,1,""],cleanup_tempfiles:[1,5,1,""],combinations:[1,1,1,""],datafunction:[1,0,0,"-"],domain:[1,0,0,"-"],geometry:[1,0,0,"-"],init_notebook_mode:[1,5,1,""],initialcondition:[1,0,0,"-"],iplot:[1,5,1,""],model:[1,0,0,"-"],parameter:[1,0,0,"-"],reaction:[1,0,0,"-"],result:[1,0,0,"-"],spatialpyerror:[1,0,0,"-"],species:[1,0,0,"-"],vtkreader:[1,0,0,"-"]},"spatialpy.core.BoundaryCondition":{expression:[1,2,1,""]},"spatialpy.core.DataFunction":{map:[1,2,1,""]},"spatialpy.core.Domain":{add_point:[1,2,1,""],calculate_vol:[1,2,1,""],closest_vertex:[1,2,1,""],compile_prep:[1,2,1,""],coordinates:[1,2,1,""],create_2D_domain:[1,2,1,""],create_3D_domain:[1,2,1,""],distance_between_2_vertices:[1,2,1,""],fill_with_particles:[1,2,1,""],find_boundary_points:[1,2,1,""],find_h:[1,2,1,""],get_bounding_box:[1,2,1,""],get_domain_size:[1,2,1,""],get_num_voxels:[1,2,1,""],get_type_def:[1,2,1,""],get_vol:[1,2,1,""],import_meshio_object:[1,2,1,""],plot_types:[1,2,1,""],read_msh_file:[1,2,1,""],read_stochss_domain:[1,2,1,""],read_stochss_subdomain_file:[1,2,1,""],read_xml_mesh:[1,2,1,""],set_properties:[1,2,1,""]},"spatialpy.core.Geometry":{inside:[1,2,1,""]},"spatialpy.core.GeometryAll":{inside:[1,2,1,""]},"spatialpy.core.GeometryExterior":{inside:[1,2,1,""]},"spatialpy.core.GeometryInterior":{inside:[1,2,1,""]},"spatialpy.core.InitialCondition":{apply:[1,2,1,""]},"spatialpy.core.KDTree":{count_neighbors:[1,2,1,""],innernode:[1,1,1,""],leafnode:[1,1,1,""],node:[1,1,1,""],query:[1,2,1,""],query_ball_point:[1,2,1,""],query_ball_tree:[1,2,1,""],query_pairs:[1,2,1,""],sparse_distance_matrix:[1,2,1,""]},"spatialpy.core.Model":{add_boundary_condition:[1,2,1,""],add_data_function:[1,2,1,""],add_domain:[1,2,1,""],add_initial_condition:[1,2,1,""],add_parameter:[1,2,1,""],add_reaction:[1,2,1,""],add_species:[1,2,1,""],compile_prep:[1,2,1,""],delete_all_parameters:[1,2,1,""],delete_all_reactions:[1,2,1,""],delete_all_species:[1,2,1,""],delete_parameter:[1,2,1,""],delete_reaction:[1,2,1,""],delete_species:[1,2,1,""],get_all_parameters:[1,2,1,""],get_all_reactions:[1,2,1,""],get_all_species:[1,2,1,""],get_num_reactions:[1,2,1,""],get_num_species:[1,2,1,""],get_parameter:[1,2,1,""],get_reaction:[1,2,1,""],get_species:[1,2,1,""],reserved_names:[1,4,1,""],run:[1,2,1,""],sanitized_data_function_names:[1,2,1,""],sanitized_parameter_names:[1,2,1,""],sanitized_species_names:[1,2,1,""],set_timesteps:[1,2,1,""],special_characters:[1,4,1,""],timespan:[1,2,1,""],update_namespace:[1,2,1,""]},"spatialpy.core.OrderedDict":{clear:[1,2,1,""],copy:[1,2,1,""],fromkeys:[1,2,1,""],items:[1,2,1,""],keys:[1,2,1,""],move_to_end:[1,2,1,""],pop:[1,2,1,""],popitem:[1,2,1,""],setdefault:[1,2,1,""],update:[1,2,1,""],values:[1,2,1,""]},"spatialpy.core.PlaceInitialCondition":{apply:[1,2,1,""]},"spatialpy.core.Reaction":{add_product:[1,2,1,""],add_reactant:[1,2,1,""],annotate:[1,2,1,""],initialize:[1,2,1,""]},"spatialpy.core.Result":{export_to_csv:[1,2,1,""],get_property:[1,2,1,""],get_species:[1,2,1,""],get_timespan:[1,2,1,""],plot_property:[1,2,1,""],plot_species:[1,2,1,""],read_step:[1,2,1,""]},"spatialpy.core.ScatterInitialCondition":{apply:[1,2,1,""]},"spatialpy.core.Species":{set_diffusion_coefficient:[1,2,1,""]},"spatialpy.core.UniformInitialCondition":{apply:[1,2,1,""]},"spatialpy.core.VTKReader":{get_array_name:[1,2,1,""],get_arrays:[1,2,1,""],get_num_points:[1,2,1,""],get_points:[1,2,1,""],read_file:[1,2,1,""],set_filename:[1,2,1,""]},"spatialpy.core.boundarycondition":{BoundaryCondition:[1,1,1,""]},"spatialpy.core.boundarycondition.BoundaryCondition":{expression:[1,2,1,""]},"spatialpy.core.cleanup":{cleanup_build_files:[1,5,1,""],cleanup_core_files:[1,5,1,""],cleanup_result_files:[1,5,1,""],cleanup_tempfiles:[1,5,1,""]},"spatialpy.core.datafunction":{DataFunction:[1,1,1,""]},"spatialpy.core.datafunction.DataFunction":{map:[1,2,1,""]},"spatialpy.core.domain":{Domain:[1,1,1,""]},"spatialpy.core.domain.Domain":{add_point:[1,2,1,""],calculate_vol:[1,2,1,""],closest_vertex:[1,2,1,""],compile_prep:[1,2,1,""],coordinates:[1,2,1,""],create_2D_domain:[1,2,1,""],create_3D_domain:[1,2,1,""],distance_between_2_vertices:[1,2,1,""],fill_with_particles:[1,2,1,""],find_boundary_points:[1,2,1,""],find_h:[1,2,1,""],get_bounding_box:[1,2,1,""],get_domain_size:[1,2,1,""],get_num_voxels:[1,2,1,""],get_type_def:[1,2,1,""],get_vol:[1,2,1,""],import_meshio_object:[1,2,1,""],plot_types:[1,2,1,""],read_msh_file:[1,2,1,""],read_stochss_domain:[1,2,1,""],read_stochss_subdomain_file:[1,2,1,""],read_xml_mesh:[1,2,1,""],set_properties:[1,2,1,""]},"spatialpy.core.geometry":{Geometry:[1,1,1,""],GeometryAll:[1,1,1,""],GeometryExterior:[1,1,1,""],GeometryInterior:[1,1,1,""]},"spatialpy.core.geometry.Geometry":{inside:[1,2,1,""]},"spatialpy.core.geometry.GeometryAll":{inside:[1,2,1,""]},"spatialpy.core.geometry.GeometryExterior":{inside:[1,2,1,""]},"spatialpy.core.geometry.GeometryInterior":{inside:[1,2,1,""]},"spatialpy.core.initialcondition":{InitialCondition:[1,1,1,""],PlaceInitialCondition:[1,1,1,""],ScatterInitialCondition:[1,1,1,""],UniformInitialCondition:[1,1,1,""]},"spatialpy.core.initialcondition.InitialCondition":{apply:[1,2,1,""]},"spatialpy.core.initialcondition.PlaceInitialCondition":{apply:[1,2,1,""]},"spatialpy.core.initialcondition.ScatterInitialCondition":{apply:[1,2,1,""]},"spatialpy.core.initialcondition.UniformInitialCondition":{apply:[1,2,1,""]},"spatialpy.core.model":{Model:[1,1,1,""],export_StochSS:[1,5,1,""]},"spatialpy.core.model.Model":{add_boundary_condition:[1,2,1,""],add_data_function:[1,2,1,""],add_domain:[1,2,1,""],add_initial_condition:[1,2,1,""],add_parameter:[1,2,1,""],add_reaction:[1,2,1,""],add_species:[1,2,1,""],compile_prep:[1,2,1,""],delete_all_parameters:[1,2,1,""],delete_all_reactions:[1,2,1,""],delete_all_species:[1,2,1,""],delete_parameter:[1,2,1,""],delete_reaction:[1,2,1,""],delete_species:[1,2,1,""],get_all_parameters:[1,2,1,""],get_all_reactions:[1,2,1,""],get_all_species:[1,2,1,""],get_num_reactions:[1,2,1,""],get_num_species:[1,2,1,""],get_parameter:[1,2,1,""],get_reaction:[1,2,1,""],get_species:[1,2,1,""],reserved_names:[1,4,1,""],run:[1,2,1,""],sanitized_data_function_names:[1,2,1,""],sanitized_parameter_names:[1,2,1,""],sanitized_species_names:[1,2,1,""],set_timesteps:[1,2,1,""],special_characters:[1,4,1,""],timespan:[1,2,1,""],update_namespace:[1,2,1,""]},"spatialpy.core.parameter":{Parameter:[1,1,1,""]},"spatialpy.core.reaction":{Reaction:[1,1,1,""]},"spatialpy.core.reaction.Reaction":{add_product:[1,2,1,""],add_reactant:[1,2,1,""],annotate:[1,2,1,""],initialize:[1,2,1,""]},"spatialpy.core.result":{Result:[1,1,1,""]},"spatialpy.core.result.Result":{export_to_csv:[1,2,1,""],get_property:[1,2,1,""],get_species:[1,2,1,""],get_timespan:[1,2,1,""],plot_property:[1,2,1,""],plot_species:[1,2,1,""],read_step:[1,2,1,""]},"spatialpy.core.spatialpyerror":{BoundaryConditionError:[1,3,1,""],DataFunctionError:[1,3,1,""],DomainError:[1,3,1,""],GeometryError:[1,3,1,""],InitialConditionError:[1,3,1,""],ModelError:[1,3,1,""],ParameterError:[1,3,1,""],ReactionError:[1,3,1,""],ResultError:[1,3,1,""],SimulationError:[1,3,1,""],SimulationTimeout:[1,3,1,""],SpeciesError:[1,3,1,""],VTKReaderError:[1,3,1,""],VTKReaderIOError:[1,3,1,""]},"spatialpy.core.species":{Species:[1,1,1,""]},"spatialpy.core.species.Species":{set_diffusion_coefficient:[1,2,1,""]},"spatialpy.core.vtkreader":{VTKReader:[1,1,1,""]},"spatialpy.core.vtkreader.VTKReader":{get_array_name:[1,2,1,""],get_arrays:[1,2,1,""],get_num_points:[1,2,1,""],get_points:[1,2,1,""],read_file:[1,2,1,""],set_filename:[1,2,1,""]},"spatialpy.solvers":{build_expression:[2,0,0,"-"],solver:[2,0,0,"-"]},"spatialpy.solvers.build_expression":{BuildExpression:[2,1,1,""],CppConverter:[2,1,1,""],ExpressionConverter:[2,1,1,""],ExpressionResults:[2,1,1,""],PythonConverter:[2,1,1,""]},"spatialpy.solvers.build_expression.BuildExpression":{ValidationVisitor:[2,1,1,""],getexpr_cpp:[2,2,1,""],getexpr_python:[2,2,1,""],map_operator:[2,2,1,""],operator_map:[2,4,1,""],validate:[2,2,1,""],with_blacklist:[2,2,1,""],with_namespace:[2,2,1,""]},"spatialpy.solvers.build_expression.BuildExpression.ValidationVisitor":{visit_Assign:[2,2,1,""],visit_BinOp:[2,2,1,""],visit_BoolOp:[2,2,1,""],visit_Call:[2,2,1,""],visit_Compare:[2,2,1,""],visit_Name:[2,2,1,""],visit_UnaryOp:[2,2,1,""]},"spatialpy.solvers.build_expression.CppConverter":{CppExpressionTransformer:[2,1,1,""],get_str:[2,2,1,""],visit_And:[2,2,1,""],visit_Or:[2,2,1,""]},"spatialpy.solvers.build_expression.CppConverter.CppExpressionTransformer":{visit_BinOp:[2,2,1,""]},"spatialpy.solvers.build_expression.ExpressionConverter":{convert_str:[2,2,1,""],get_str:[2,2,1,""],parse_comparison:[2,2,1,""],parse_logical:[2,2,1,""],parse_operator:[2,2,1,""],visit_Add:[2,2,1,""],visit_BinOp:[2,2,1,""],visit_BoolOp:[2,2,1,""],visit_Bytes:[2,2,1,""],visit_Call:[2,2,1,""],visit_Compare:[2,2,1,""],visit_Constant:[2,2,1,""],visit_Div:[2,2,1,""],visit_Ellipsis:[2,2,1,""],visit_Eq:[2,2,1,""],visit_Gt:[2,2,1,""],visit_GtE:[2,2,1,""],visit_Lt:[2,2,1,""],visit_LtE:[2,2,1,""],visit_Mult:[2,2,1,""],visit_Name:[2,2,1,""],visit_NameConstant:[2,2,1,""],visit_NotEq:[2,2,1,""],visit_Num:[2,2,1,""],visit_Pow:[2,2,1,""],visit_Str:[2,2,1,""],visit_Sub:[2,2,1,""],visit_USub:[2,2,1,""],visit_UnaryOp:[2,2,1,""]},"spatialpy.solvers.build_expression.PythonConverter":{visit_And:[2,2,1,""],visit_Or:[2,2,1,""]},"spatialpy.solvers.solver":{Solver:[2,1,1,""]},"spatialpy.solvers.solver.Solver":{compile:[2,2,1,""],run:[2,2,1,""]},"spatialpy.stochss":{stochss_export:[3,0,0,"-"]},"spatialpy.stochss.stochss_export":{"export":[3,5,1,""]},spatialpy:{core:[1,0,0,"-"],solvers:[2,0,0,"-"],stochss:[3,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","exception","Python exception"],"4":["py","attribute","Python attribute"],"5":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:exception","4":"py:attribute","5":"py:function"},terms:{"0":[1,2],"04":1,"1":[1,2],"10":1,"10000":1,"11":1,"13":1,"14142136":1,"15":1,"1999":1,"1d":1,"2":1,"20":1,"2000":1,"2015":1,"2019":[0,1,2,3],"2022":[0,1,2,3],"2d":1,"2e9":1,"2r01eb014877":4,"3":[0,1,2,3,4],"300":1,"3d":[1,4],"4":1,"5":1,"500":1,"6":1,"600":1,"7":1,"8":1,"800":1,"9":1,"abstract":[1,2],"byte":2,"case":1,"class":[1,2],"default":1,"do":1,"export":[1,3],"float":1,"function":[1,2],"import":1,"int":[1,2],"long":1,"new":[1,2],"public":[0,1,2,3,4],"return":[1,2,3],"short":4,"static":[1,4],"super":2,"switch":1,"true":[1,2,3],A:[0,1,2,3,4],And:2,By:[1,2],FOR:[0,1,2,3],For:[1,4],If:[0,1,2,3,4],In:1,It:1,No:1,Not:2,Or:2,The:[1,2,4],These:1,Will:1,_ast:2,abl:1,about:1,absolut:1,acceler:1,accept:2,across:1,action:1,ad:[1,2],add:[1,2],add_boundary_condit:1,add_data_funct:1,add_domain:1,add_initial_condit:1,add_paramet:1,add_point:1,add_product:1,add_react:1,add_speci:1,addit:[1,2],addition:[1,2],addtion:[1,2],advect:[0,1,2,3,4],against:[1,2],algorithm:[1,4],align:1,all:[1,2],allow:2,along:[0,1,2,3],alreadi:1,also:[1,2,4],alwai:2,amount:1,an:[1,2,4],ani:[0,1,2,3,4],anim:1,animation_attribut:1,animation_opt:1,annot:1,append:2,appli:1,approxim:1,ar:[1,2],argument:1,arrai:1,arraid:1,array_lik:1,articl:4,artifici:1,asarrai:1,ascii:1,assign:[1,2],associ:1,assum:2,ast:2,attempt:1,attribut:1,author:4,auto_plai:1,automat:[1,2],autorang:1,avail:[1,2,4],averag:1,axi:1,background:1,bare:2,base:[1,2,4],bass:1,becaus:1,becom:1,been:1,begin:1,behavior:2,best:1,between:[1,2],binari:1,binboolopop:2,binop:2,biochem:1,bitand:2,bitor:2,bitxor:2,blacklist:2,blob:1,blue:1,bodi:1,bogu:1,bool:[1,2,3],boolop:2,both:[1,4],bottom:1,bound:1,bound_cond:1,boundari:1,boundarycondit:0,boundaryconditionerror:1,box:1,branch:1,brian:4,browser:1,brute:1,bugn:1,build:[1,2,4],build_dir:1,build_express:0,buildexpress:2,built:2,bulk:1,bupu:1,bvf_phi:1,c0:1,c:[0,1,2,3],c_:1,calcul:1,calculate_vol:1,call:[1,2],can:[0,1,2,3,4],caus:2,cdn:1,cell:1,charact:1,chart:1,check:[1,2],chemic:1,choos:1,chosen:1,circumradiu:1,ckdtree:1,classmethod:[1,2],cleanup:0,cleanup_build_fil:1,cleanup_core_fil:1,cleanup_result_fil:1,cleanup_tempfil:1,clear:1,close:1,closest:1,closest_vertex:1,cloud:1,code:[1,4],coeffic:1,coeffici:1,collabor:1,colormap:1,column:1,com:[1,4],combin:1,compar:[1,2],comparison:2,compil:[1,2],compile_prep:1,comput:1,conain:1,conatain:1,concentr:1,condit:[1,2],config:1,connect:1,consid:1,consol:2,constant:[1,2],construct:1,constructor:2,constuct:1,contact:4,contain:[1,2],content:4,context:2,contian:1,continu:4,convers:2,convert:[1,2,3],convert_str:2,convet:2,coodin:1,coordin:1,copi:[0,1,2,3],copy_numb:1,copyright:[0,1,2,3],core:[0,2,3,4],corner:1,correl:1,correspond:[1,2],could:[1,2],count:1,count_neighbor:1,coupl:1,cppconvert:2,cppexpressiontransform:2,cradded:1,creat:[1,2],create_2d_domain:1,create_3d_domain:1,csv:1,current:[1,2],custom:1,cylind:4,cython:1,d:1,data:[1,2],data_funct:1,datafunct:0,datafunctionerror:1,debug:[1,2],debug_level:[1,2],debugg:2,defer:1,defin:[1,2],definit:1,delete_all_paramet:1,delete_all_react:1,delete_all_speci:1,delete_paramet:1,delete_react:1,delete_speci:1,deltai:1,deltax:1,deltaz:1,demo:4,densiti:1,dependency_graph:1,describ:[1,4],descript:1,detail:[0,1,2,3],determinist:[0,1,2,3,4],determinst:1,develop:[0,1,2,3,4],diamet:1,dict:[1,2,3],dictionari:[1,2],differ:[1,2],diffus:[0,1,2,3,4],diffusion_coeffici:1,dimens:1,dimension:1,direct:1,directli:[1,4],directori:1,displai:1,dissip:4,distanc:1,distance_between_2_vertic:1,distance_upper_bound:1,distribut:[0,1,2,3],div:2,doe:1,doesn:1,dok_matrix:1,dolfin:1,dom:1,domain:[0,4],domainerror:1,domn:1,download:1,dr:4,draw:1,drawert:4,drawn:1,dtype:1,duplic:2,durat:1,dure:[1,2],dynam:4,e:1,each:1,edg:1,edit:1,effect:1,effici:1,either:1,element:1,ellipsi:2,els:[1,3],embed:4,empti:2,end:1,engin:1,ensur:[1,2],enterpris:1,entir:1,entireti:1,ep:1,eq:2,equival:2,error:1,estim:1,euclidean:1,evalu:1,evaul:1,even:[0,1,2,3],evenli:1,exampl:1,exce:1,exceed:[1,2],except:1,execut:[1,2],exist:1,expect:[1,2],explor:1,export_stochss:1,export_to_csv:1,expres:2,express:[1,2],expressionconvert:2,expressionresult:2,extens:1,extra:1,f:1,f_durat:1,fail:2,fals:[1,2,3],far:2,faster:1,featur:4,fenic:1,fifo:1,figur:1,figure_or_data:1,file:[1,3],filenam:[1,3],fill:[1,4],fill_with_particl:1,find:[1,4],find_boundary_point:1,find_h:1,first:[1,2],fit:[0,1,2,3],fix:1,flag:[1,2],flatten:1,flight:2,floordiv:2,flow:4,fluid:[1,4],folder_nam:1,follow:[1,2],forc:1,form:[1,4],format:1,forward:2,found:[1,2,4],foundat:[0,1,2,3],fraction:1,frame:[1,4],free:[0,1,2,3],frequenc:1,from:[1,2],fromkei:1,fund:4,further:1,furthest:1,g:1,gain:1,gdbgui:2,gener:[0,1,2,3,4],geometr:1,geometri:0,geometry_ivar:1,geometryal:1,geometryerror:1,geometryexterior:1,geometryinterior:1,get:[1,2],get_all_paramet:1,get_all_react:1,get_all_speci:1,get_arrai:1,get_array_nam:1,get_bounding_box:1,get_domain_s:1,get_num_point:1,get_num_react:1,get_num_speci:1,get_num_voxel:1,get_paramet:1,get_point:1,get_properti:1,get_react:1,get_speci:1,get_str:2,get_timespan:1,get_type_def:1,get_vol:1,getexpr_:2,getexpr_cpp:2,getexpr_python:2,github:[1,4],given:[1,2],gmsh:1,gnbu:1,gnu:[0,1,2,3,4],gprof:2,grai:1,grant:4,granular:2,graph:1,graph_obj:1,graph_refer:1,graviti:[1,4],greater:1,greatest:1,green:1,grei:1,gt:2,gte:2,guarante:1,h:1,ha:[1,4],hand:2,handl:2,happen:[1,2],hasn:[1,2],have:[0,1,2,3],height:1,held:1,help:1,here:[1,4],high:1,higher:1,highest:1,hit:1,hope:[0,1,2,3],how:[1,2,4],http:[0,1,2,3,4],hybrid:4,hyperrectangl:1,i:1,id:1,idea:1,ideal:2,idempot:1,identifi:[1,2],idx:1,ignor:1,imag:1,image_height:1,image_width:1,immobil:1,implemenet:1,implement:[1,2],impli:[0,1,2,3],import_meshio_object:1,imposs:2,inch:1,incid:1,includ:1,included_types_list:1,incompat:1,increas:1,increment:2,indec:1,indeci:1,index:[1,4],indic:[1,2],inf:1,infer:2,infin:1,infinit:1,info:1,inform:[1,2,4],inherit:2,init_cond:1,init_notebook_mod:1,initailcondit:1,initi:1,initialcondit:0,initialconditionerror:1,inlin:1,innernod:1,input:1,insert:1,insid:1,instanc:[1,2],instead:1,integ:1,intend:4,intern:1,internet:1,interv:1,invalid:[1,2],invalid_:2,invalid_nam:2,invalid_oper:2,io:1,iplot:1,ipython:1,is_valid:2,item:[1,2],iter:1,its:1,j:1,jacob:4,jet:1,jpeg:1,js:1,json:1,jupyt:1,k:1,kd:1,kdtree:1,kei:[1,2],keyerror:1,keyword:1,kill:1,kth:1,kwarg:1,lack:1,lagrangian:4,larg:1,larger:1,last:[1,2],later:[1,2],latest:4,layout:1,leafnod:1,leafsiz:1,learn:1,leav:1,left:2,legaci:1,length:1,less:1,level:[1,2],li:4,librari:1,licens:[0,1,2,3,4],lifo:1,like:1,limit:1,link:1,link_text:1,list:[1,2],listofparamet:1,listofreact:1,listofspeci:1,listoftyp:1,load:1,local:1,locat:1,logic:2,look:1,lookup:1,lower:1,lowest:1,lshift:2,lt:2,lte:2,ly:1,m:1,mai:1,main:4,make:1,manag:2,maneewongvatana:1,manhattan:1,mani:[1,2],map:[1,2],map_oper:2,margin:1,mark:1,mass:1,master:1,mathemat:[1,2],matmult:2,matplotlib:1,matrix:1,max:1,max_dist:1,maximum:[1,2],mean:1,measur:1,meet:1,megabyt:1,merchant:[0,1,2,3],mesh:1,mesh_obj:1,meshio:1,messag:1,meta:1,method:[1,2],mgrid:1,midpoint:1,min:1,minim:1,minimum:1,minkowski:1,miss:1,mod:2,model:[0,2,3,4],modelerror:1,modelname_mesh:1,modelname_species_:1,modifi:[0,1,2,3],modul:4,moor:1,more:[0,1,2,3,4],most:[1,2],mount:1,move:1,move_to_end:1,movement:1,msh:1,much:1,mult:2,multipl:[1,2],must:1,n:1,name:[1,2],nameconst:2,namespac:[1,2],ndarrai:1,nearbi:1,nearby_point:1,nearer:1,nearest:1,necessarili:1,need:[1,4],neg:1,neighbor:1,nih:4,node:[1,2],nodetransform:2,nodevisitor:2,non:1,none:[1,2,3],nonneg:1,norm:1,notat:1,note:[1,2],notebook:[1,4],noteq:2,np:1,nsm:4,nu:1,num:2,num_step:1,number:[1,2],number_of_thread:[1,2],number_of_trajectori:[1,2],numpi:1,numpoint:1,nx:1,ny:1,nz:1,o:1,obj:1,object:[1,2],od:1,off:1,offlin:1,omit:1,on_boundari:1,one:[1,2],onli:[1,2],onlin:1,open:1,oper:2,operator_map:2,option:1,orang:1,order:1,ordereddict:1,org:[0,1,2,3],origin:2,orrd:1,other:[1,2],otherwis:[1,2],our:4,out:[1,4],outdat:1,output:[1,2],output_interv:1,over:1,overflow:1,overrid:2,overridden:1,p0:1,p:1,p_ndx:1,packag:4,page:[1,4],pair:1,param:1,param_nam:1,param_obj:1,paramet:[0,2,3],parametererror:1,paramt:1,parent:1,pars:2,parse_comparison:2,parse_log:2,parse_oper:2,part:1,partcil:1,particip:1,particl:[1,4],particular:[0,1,2,3],pass:[1,2],path:[1,3],pdf:1,perform:1,petzold:4,physic:4,pii:4,pixel:1,place:1,placeinitialcondit:1,platform:1,pleas:[1,4],plot:1,plot_imag:1,plot_properti:1,plot_speci:1,plot_typ:1,plotli:1,plotly3:1,plt:1,pname:1,png:1,point:1,pop:[1,2],popitem:1,popul:1,posit:1,positon:1,pow:2,pre:2,predict:1,preper:1,present:[1,2],pressur:1,print:[1,2],problem:[0,1,2,3,4],process:2,produc:1,product:1,profil:[1,2],program:[0,1,2,3],project:4,propens:1,propensity_funct:1,properti:[1,2],property_nam:1,proprti:1,prove:4,provid:[1,2,4],prune:1,pt:1,publish:[0,1,2,3],pubu:1,pubugn:1,pull:1,purd:1,purpl:1,purpos:[0,1,2,3],put:1,px:1,py:1,pypi:4,pyplot:1,python:[0,1,2,3,4],pythonconvert:2,pyurdm:4,queri:1,query_ball_point:1,query_ball_tre:1,query_pair:1,question:4,quick:1,r:1,radii:1,radiu:1,rais:[1,2],random:[1,2],randomli:1,rang:1,rapidli:1,rate:1,rather:1,ravel:1,raw:1,rdme:4,rdpu:1,re:1,reac:1,reach:1,react_nam:1,react_obj:1,reactant:1,reaction:[0,2,3,4],reactionerror:1,read:1,read_fil:1,read_msh_fil:1,read_step:1,read_stochss_domain:1,read_stochss_subdomain_fil:1,read_xml_mesh:1,reader:1,real:1,reason:1,receiv:[0,1,2,3],recent:[1,2],recurs:1,red:1,redistribut:[0,1,2,3],refer:1,referenc:1,regardless:1,region:1,regist:4,registr:4,reject:2,rememb:1,remov:1,replac:4,repres:1,represent:[1,2],request:1,requir:1,reserved_nam:1,resolut:1,restrict:1,restrict_to:1,result:[0,2],result_dir:1,resulterror:1,retreiv:1,retriev:1,return_plotly_figur:1,return_stochss_model:[1,3],rho0:1,rho:1,right:[1,2],rname:1,rshift:2,rtype:2,rule:1,run:[1,2],runtimeerror:1,rvalu:2,s0021999118307101:4,s:[1,4],same:1,sampl:1,sanit:2,sanitized_data_function_nam:1,sanitized_parameter_nam:1,sanitized_species_nam:1,save:1,scalar:1,scatter:1,scatterinitialcondit:1,scienc:[1,4],sciencedirect:4,scipi:1,sdpd:[1,4],search:[1,4],second:[1,2],see:[0,1,2,3,4],seed:[1,2],self:[1,2],separ:1,sequenc:1,seri:[1,2],set:[1,2],set_diffusion_coeffici:1,set_filenam:1,set_properti:1,set_timestep:1,setdefault:1,setrecursionlimit:1,setter:1,shallow:1,shape:1,should:[0,1,2,3],show:1,show_link:1,significantli:1,simlat:1,simplifi:1,simul:[0,1,2,3,4],simulationerror:[1,2],simulationtimeout:[1,2],sinc:1,singl:[1,2],size:1,slide:1,smaller:1,smdl:1,smooth:4,sname:1,so:[1,2],softwar:[0,1,2,3,4],solver:[0,1,4],some:1,sort:1,sound:1,sourc:[1,2,3,4],space:1,spactialpi:2,span:1,spars:1,sparse_distance_matrix:1,spatial:[0,1,2,3,4],spatialpy_build:1,spatialpy_model:1,spatialpy_result:1,spatialpyerror:0,spatialpysolv:1,speci:0,special_charact:1,species_nam:1,species_object:1,specieserror:1,specif:1,specifi:1,speed:1,split:1,split_dim:1,src:1,ssa:1,sssa:4,start:[1,2,4],statement:2,statist:1,step:1,step_num:1,stochast:[0,1,2,3,4],stochss:[0,1,4],stochss_export:0,stoichiometr:1,stoichiometri:1,store:1,str:[1,2,3],string:[1,2],struct:2,structur:1,style:1,sub:2,subclass:[1,2],subdomain:1,submodul:0,subpackag:4,substanti:1,substitut:2,success:1,suggest:4,sum:1,suppli:1,support:[1,4],sure:1,svg:1,sy:1,symbol:2,syntax:2,syntaxerror:2,system:[1,4],t:[1,2],t_durat:1,t_ndx:1,t_ndx_list:1,t_val:1,tag:1,take:1,target:[1,2],tempfil:1,term:[0,1,2,3],tetrahedron:1,text:1,than:1,them:1,thi:[0,1,2,3,4],thin:1,those:1,thread:[1,2],time:[1,2],time_span:1,timeout:[1,2],timepoint:1,timespan:1,timestep:1,timestep_s:1,titl:1,token:2,total:1,toth:1,trace:1,tracker:4,trajectori:[1,2],transit:1,travers:1,tree:[1,2],triangl:1,trigger:2,tspan:1,tupl:1,two:[1,2],txt:1,type:[1,2,3],type_id:1,u0:1,unabl:1,unaryop:2,under:[0,1,2,3,4],uniform:1,uniforminitialcondit:1,union:1,univers:2,unnecessari:1,up:1,updat:1,update_namespac:1,upload:1,upon:1,upper:1,urdm:1,us:[0,1,2,3,4],use_matplotlib:1,user:[1,4],usual:1,usub:2,util:1,v1:1,v:1,valid:[1,2],validationvisitor:2,valu:[1,2],vari:1,veloc:1,verbos:2,veri:1,version:[0,1,2,3,4],vertex:1,vertic:1,view:1,viewer:1,viscos:1,visit:2,visit_add:2,visit_and:2,visit_assign:2,visit_binop:2,visit_boolop:2,visit_byt:2,visit_cal:2,visit_compar:2,visit_const:2,visit_div:2,visit_ellipsi:2,visit_eq:2,visit_gt:2,visit_lt:2,visit_mult:2,visit_nam:2,visit_nameconst:2,visit_noteq:2,visit_num:2,visit_or:2,visit_pow:2,visit_str:2,visit_sub:2,visit_unaryop:2,visit_usub:2,visitor:2,vol:1,volum:1,voxel:1,vtk:1,vtkreader:0,vtkreadererror:1,vtkreaderioerror:1,wa:1,want:1,warranti:[0,1,2,3],we:[1,4],web:1,webp:1,weir:4,well:2,were:[1,2],what:2,when:[1,2],where:1,whether:[1,2,3],which:[1,2],whose:1,width:1,with_blacklist:2,with_namespac:2,within:1,without:[0,1,2,3],work:1,wp:1,write:1,write_imag:1,written:1,www:[0,1,2,3,4],x1:1,x2:1,x:1,xaxi:1,xlim:1,xmax:1,xmin:1,xml:1,y:1,yaxi:1,yet:1,yi:4,ylgn:1,ylgnbu:1,ylim:1,ylorbr:1,ylorrd:1,ymax:1,ymin:1,you:[0,1,2,3,4],your:[1,4],z:1,zero:1,zeroth:1,zip:1,zlim:1,zmax:1,zmin:1},titles:["spatialpy package","spatialpy.core package","spatialpy.solvers package","spatialpy.stochss package","Documentation for SpatialPy 1.0"],titleterms:{"0":4,"1":4,api:4,boundarycondit:1,build_express:2,cleanup:1,content:[0,1,2,3],copi:4,core:1,datafunct:1,document:4,domain:1,exampl:4,geometri:1,get:4,indic:4,initialcondit:1,issu:4,model:1,modul:[0,1,2,3],packag:[0,1,2,3],paramet:1,reaction:1,refer:4,report:4,result:1,solver:2,spatialpi:[0,1,2,3,4],spatialpyerror:1,speci:1,stochss:3,stochss_export:3,submodul:[1,2,3],subpackag:0,tabl:4,vtkreader:1}}) \ No newline at end of file +Search.setIndex({docnames:["classes/spatialpy","classes/spatialpy.core","classes/spatialpy.solvers","classes/spatialpy.stochss","index"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["classes/spatialpy.rst","classes/spatialpy.core.rst","classes/spatialpy.solvers.rst","classes/spatialpy.stochss.rst","index.rst"],objects:{"":[[0,0,0,"-","spatialpy"]],"spatialpy.core":[[1,1,1,"","BoundaryCondition"],[1,3,1,"","BoundaryConditionError"],[1,1,1,"","DataFunction"],[1,3,1,"","DataFunctionError"],[1,1,1,"","Domain"],[1,3,1,"","DomainError"],[1,1,1,"","Geometry"],[1,1,1,"","GeometryAll"],[1,3,1,"","GeometryError"],[1,1,1,"","GeometryExterior"],[1,1,1,"","GeometryInterior"],[1,1,1,"","InitialCondition"],[1,3,1,"","InitialConditionError"],[1,1,1,"","KDTree"],[1,1,1,"","Model"],[1,3,1,"","ModelError"],[1,1,1,"","OrderedDict"],[1,1,1,"","Parameter"],[1,3,1,"","ParameterError"],[1,1,1,"","PlaceInitialCondition"],[1,1,1,"","Reaction"],[1,3,1,"","ReactionError"],[1,1,1,"","Result"],[1,3,1,"","ResultError"],[1,1,1,"","ScatterInitialCondition"],[1,3,1,"","SimulationError"],[1,3,1,"","SimulationTimeout"],[1,1,1,"","Species"],[1,3,1,"","SpeciesError"],[1,1,1,"","UniformInitialCondition"],[1,1,1,"","VTKReader"],[1,3,1,"","VTKReaderError"],[1,3,1,"","VTKReaderIOError"],[1,1,1,"","Visualization"],[1,3,1,"","VisualizationError"],[1,0,0,"-","boundarycondition"],[1,0,0,"-","cleanup"],[1,6,1,"","cleanup_build_files"],[1,6,1,"","cleanup_core_files"],[1,6,1,"","cleanup_result_files"],[1,6,1,"","cleanup_tempfiles"],[1,1,1,"","combinations"],[1,0,0,"-","datafunction"],[1,0,0,"-","domain"],[1,0,0,"-","geometry"],[1,6,1,"","init_notebook_mode"],[1,0,0,"-","initialcondition"],[1,6,1,"","iplot"],[1,0,0,"-","model"],[1,0,0,"-","parameter"],[1,0,0,"-","reaction"],[1,0,0,"-","result"],[1,0,0,"-","spatialpyerror"],[1,0,0,"-","species"],[1,0,0,"-","visualization"],[1,0,0,"-","vtkreader"]],"spatialpy.core.BoundaryCondition":[[1,2,1,"","expression"]],"spatialpy.core.DataFunction":[[1,2,1,"","map"]],"spatialpy.core.Domain":[[1,2,1,"","add_point"],[1,2,1,"","calculate_vol"],[1,2,1,"","closest_vertex"],[1,2,1,"","compile_prep"],[1,2,1,"","coordinates"],[1,2,1,"","create_2D_domain"],[1,2,1,"","create_3D_domain"],[1,2,1,"","distance_between_2_vertices"],[1,2,1,"","fill_with_particles"],[1,2,1,"","find_boundary_points"],[1,2,1,"","find_h"],[1,2,1,"","get_bounding_box"],[1,2,1,"","get_domain_size"],[1,2,1,"","get_num_voxels"],[1,2,1,"","get_type_def"],[1,2,1,"","get_vol"],[1,2,1,"","import_meshio_object"],[1,2,1,"","plot_types"],[1,2,1,"","read_msh_file"],[1,2,1,"","read_stochss_domain"],[1,2,1,"","read_stochss_subdomain_file"],[1,2,1,"","read_xml_mesh"],[1,2,1,"","set_properties"]],"spatialpy.core.Geometry":[[1,2,1,"","inside"]],"spatialpy.core.GeometryAll":[[1,2,1,"","inside"]],"spatialpy.core.GeometryExterior":[[1,2,1,"","inside"]],"spatialpy.core.GeometryInterior":[[1,2,1,"","inside"]],"spatialpy.core.InitialCondition":[[1,2,1,"","apply"]],"spatialpy.core.KDTree":[[1,2,1,"","count_neighbors"],[1,4,1,"","data"],[1,1,1,"","innernode"],[1,1,1,"","leafnode"],[1,4,1,"","leafsize"],[1,4,1,"","m"],[1,4,1,"","maxes"],[1,4,1,"","mins"],[1,4,1,"","n"],[1,1,1,"","node"],[1,2,1,"","query"],[1,2,1,"","query_ball_point"],[1,2,1,"","query_ball_tree"],[1,2,1,"","query_pairs"],[1,4,1,"","size"],[1,2,1,"","sparse_distance_matrix"],[1,5,1,"","tree"]],"spatialpy.core.KDTree.innernode":[[1,5,1,"","children"],[1,5,1,"","split"],[1,5,1,"","split_dim"]],"spatialpy.core.KDTree.leafnode":[[1,5,1,"","children"],[1,5,1,"","idx"]],"spatialpy.core.Model":[[1,2,1,"","add_boundary_condition"],[1,2,1,"","add_data_function"],[1,2,1,"","add_domain"],[1,2,1,"","add_initial_condition"],[1,2,1,"","add_parameter"],[1,2,1,"","add_reaction"],[1,2,1,"","add_species"],[1,2,1,"","compile_prep"],[1,2,1,"","delete_all_parameters"],[1,2,1,"","delete_all_reactions"],[1,2,1,"","delete_all_species"],[1,2,1,"","delete_parameter"],[1,2,1,"","delete_reaction"],[1,2,1,"","delete_species"],[1,2,1,"","get_all_parameters"],[1,2,1,"","get_all_reactions"],[1,2,1,"","get_all_species"],[1,2,1,"","get_num_reactions"],[1,2,1,"","get_num_species"],[1,2,1,"","get_parameter"],[1,2,1,"","get_reaction"],[1,2,1,"","get_species"],[1,4,1,"","reserved_names"],[1,2,1,"","run"],[1,2,1,"","sanitized_data_function_names"],[1,2,1,"","sanitized_parameter_names"],[1,2,1,"","sanitized_species_names"],[1,2,1,"","set_timesteps"],[1,4,1,"","special_characters"],[1,2,1,"","timespan"],[1,2,1,"","update_namespace"]],"spatialpy.core.OrderedDict":[[1,2,1,"","clear"],[1,2,1,"","copy"],[1,2,1,"","fromkeys"],[1,2,1,"","items"],[1,2,1,"","keys"],[1,2,1,"","move_to_end"],[1,2,1,"","pop"],[1,2,1,"","popitem"],[1,2,1,"","setdefault"],[1,2,1,"","update"],[1,2,1,"","values"]],"spatialpy.core.PlaceInitialCondition":[[1,2,1,"","apply"]],"spatialpy.core.Reaction":[[1,2,1,"","add_product"],[1,2,1,"","add_reactant"],[1,2,1,"","annotate"],[1,2,1,"","initialize"]],"spatialpy.core.Result":[[1,2,1,"","export_to_csv"],[1,2,1,"","get_property"],[1,2,1,"","get_species"],[1,2,1,"","get_timespan"],[1,2,1,"","plot_property"],[1,2,1,"","plot_species"],[1,2,1,"","read_step"]],"spatialpy.core.ScatterInitialCondition":[[1,2,1,"","apply"]],"spatialpy.core.Species":[[1,2,1,"","set_diffusion_coefficient"]],"spatialpy.core.UniformInitialCondition":[[1,2,1,"","apply"]],"spatialpy.core.VTKReader":[[1,2,1,"","get_array_name"],[1,2,1,"","get_arrays"],[1,2,1,"","get_num_points"],[1,2,1,"","get_points"],[1,2,1,"","read_file"],[1,2,1,"","set_filename"]],"spatialpy.core.Visualization":[[1,4,1,"","MPL_HEIGHT"],[1,4,1,"","MPL_SIZE"],[1,4,1,"","MPL_WIDTH"],[1,2,1,"","plot_scatter"]],"spatialpy.core.boundarycondition":[[1,1,1,"","BoundaryCondition"]],"spatialpy.core.boundarycondition.BoundaryCondition":[[1,2,1,"","expression"]],"spatialpy.core.cleanup":[[1,6,1,"","cleanup_build_files"],[1,6,1,"","cleanup_core_files"],[1,6,1,"","cleanup_result_files"],[1,6,1,"","cleanup_tempfiles"]],"spatialpy.core.datafunction":[[1,1,1,"","DataFunction"]],"spatialpy.core.datafunction.DataFunction":[[1,2,1,"","map"]],"spatialpy.core.domain":[[1,1,1,"","Domain"]],"spatialpy.core.domain.Domain":[[1,2,1,"","add_point"],[1,2,1,"","calculate_vol"],[1,2,1,"","closest_vertex"],[1,2,1,"","compile_prep"],[1,2,1,"","coordinates"],[1,2,1,"","create_2D_domain"],[1,2,1,"","create_3D_domain"],[1,2,1,"","distance_between_2_vertices"],[1,2,1,"","fill_with_particles"],[1,2,1,"","find_boundary_points"],[1,2,1,"","find_h"],[1,2,1,"","get_bounding_box"],[1,2,1,"","get_domain_size"],[1,2,1,"","get_num_voxels"],[1,2,1,"","get_type_def"],[1,2,1,"","get_vol"],[1,2,1,"","import_meshio_object"],[1,2,1,"","plot_types"],[1,2,1,"","read_msh_file"],[1,2,1,"","read_stochss_domain"],[1,2,1,"","read_stochss_subdomain_file"],[1,2,1,"","read_xml_mesh"],[1,2,1,"","set_properties"]],"spatialpy.core.geometry":[[1,1,1,"","Geometry"],[1,1,1,"","GeometryAll"],[1,1,1,"","GeometryExterior"],[1,1,1,"","GeometryInterior"]],"spatialpy.core.geometry.Geometry":[[1,2,1,"","inside"]],"spatialpy.core.geometry.GeometryAll":[[1,2,1,"","inside"]],"spatialpy.core.geometry.GeometryExterior":[[1,2,1,"","inside"]],"spatialpy.core.geometry.GeometryInterior":[[1,2,1,"","inside"]],"spatialpy.core.initialcondition":[[1,1,1,"","InitialCondition"],[1,1,1,"","PlaceInitialCondition"],[1,1,1,"","ScatterInitialCondition"],[1,1,1,"","UniformInitialCondition"]],"spatialpy.core.initialcondition.InitialCondition":[[1,2,1,"","apply"]],"spatialpy.core.initialcondition.PlaceInitialCondition":[[1,2,1,"","apply"]],"spatialpy.core.initialcondition.ScatterInitialCondition":[[1,2,1,"","apply"]],"spatialpy.core.initialcondition.UniformInitialCondition":[[1,2,1,"","apply"]],"spatialpy.core.model":[[1,1,1,"","Model"],[1,6,1,"","export_StochSS"]],"spatialpy.core.model.Model":[[1,2,1,"","add_boundary_condition"],[1,2,1,"","add_data_function"],[1,2,1,"","add_domain"],[1,2,1,"","add_initial_condition"],[1,2,1,"","add_parameter"],[1,2,1,"","add_reaction"],[1,2,1,"","add_species"],[1,2,1,"","compile_prep"],[1,2,1,"","delete_all_parameters"],[1,2,1,"","delete_all_reactions"],[1,2,1,"","delete_all_species"],[1,2,1,"","delete_parameter"],[1,2,1,"","delete_reaction"],[1,2,1,"","delete_species"],[1,2,1,"","get_all_parameters"],[1,2,1,"","get_all_reactions"],[1,2,1,"","get_all_species"],[1,2,1,"","get_num_reactions"],[1,2,1,"","get_num_species"],[1,2,1,"","get_parameter"],[1,2,1,"","get_reaction"],[1,2,1,"","get_species"],[1,4,1,"","reserved_names"],[1,2,1,"","run"],[1,2,1,"","sanitized_data_function_names"],[1,2,1,"","sanitized_parameter_names"],[1,2,1,"","sanitized_species_names"],[1,2,1,"","set_timesteps"],[1,4,1,"","special_characters"],[1,2,1,"","timespan"],[1,2,1,"","update_namespace"]],"spatialpy.core.parameter":[[1,1,1,"","Parameter"]],"spatialpy.core.reaction":[[1,1,1,"","Reaction"]],"spatialpy.core.reaction.Reaction":[[1,2,1,"","add_product"],[1,2,1,"","add_reactant"],[1,2,1,"","annotate"],[1,2,1,"","initialize"]],"spatialpy.core.result":[[1,1,1,"","Result"]],"spatialpy.core.result.Result":[[1,2,1,"","export_to_csv"],[1,2,1,"","get_property"],[1,2,1,"","get_species"],[1,2,1,"","get_timespan"],[1,2,1,"","plot_property"],[1,2,1,"","plot_species"],[1,2,1,"","read_step"]],"spatialpy.core.spatialpyerror":[[1,3,1,"","BoundaryConditionError"],[1,3,1,"","DataFunctionError"],[1,3,1,"","DomainError"],[1,3,1,"","GeometryError"],[1,3,1,"","InitialConditionError"],[1,3,1,"","ModelError"],[1,3,1,"","ParameterError"],[1,3,1,"","ReactionError"],[1,3,1,"","ResultError"],[1,3,1,"","SimulationError"],[1,3,1,"","SimulationTimeout"],[1,3,1,"","SpeciesError"],[1,3,1,"","VTKReaderError"],[1,3,1,"","VTKReaderIOError"],[1,3,1,"","VisualizationError"]],"spatialpy.core.species":[[1,1,1,"","Species"]],"spatialpy.core.species.Species":[[1,2,1,"","set_diffusion_coefficient"]],"spatialpy.core.visualization":[[1,1,1,"","Visualization"]],"spatialpy.core.visualization.Visualization":[[1,4,1,"","MPL_HEIGHT"],[1,4,1,"","MPL_SIZE"],[1,4,1,"","MPL_WIDTH"],[1,2,1,"","plot_scatter"]],"spatialpy.core.vtkreader":[[1,1,1,"","VTKReader"]],"spatialpy.core.vtkreader.VTKReader":[[1,2,1,"","get_array_name"],[1,2,1,"","get_arrays"],[1,2,1,"","get_num_points"],[1,2,1,"","get_points"],[1,2,1,"","read_file"],[1,2,1,"","set_filename"]],"spatialpy.solvers":[[2,0,0,"-","build_expression"],[2,0,0,"-","solver"]],"spatialpy.solvers.build_expression":[[2,1,1,"","BuildExpression"],[2,1,1,"","CppConverter"],[2,1,1,"","ExpressionConverter"],[2,1,1,"","ExpressionResults"],[2,1,1,"","PythonConverter"]],"spatialpy.solvers.build_expression.BuildExpression":[[2,1,1,"","ValidationVisitor"],[2,2,1,"","getexpr_cpp"],[2,2,1,"","getexpr_python"],[2,2,1,"","map_operator"],[2,4,1,"","operator_map"],[2,2,1,"","validate"],[2,2,1,"","with_blacklist"],[2,2,1,"","with_namespace"]],"spatialpy.solvers.build_expression.BuildExpression.ValidationVisitor":[[2,2,1,"","visit_Assign"],[2,2,1,"","visit_BinOp"],[2,2,1,"","visit_BoolOp"],[2,2,1,"","visit_Call"],[2,2,1,"","visit_Compare"],[2,2,1,"","visit_Name"],[2,2,1,"","visit_UnaryOp"]],"spatialpy.solvers.build_expression.CppConverter":[[2,1,1,"","CppExpressionTransformer"],[2,2,1,"","get_str"],[2,2,1,"","visit_And"],[2,2,1,"","visit_Or"]],"spatialpy.solvers.build_expression.CppConverter.CppExpressionTransformer":[[2,2,1,"","visit_BinOp"]],"spatialpy.solvers.build_expression.ExpressionConverter":[[2,2,1,"","convert_str"],[2,2,1,"","get_str"],[2,2,1,"","parse_comparison"],[2,2,1,"","parse_logical"],[2,2,1,"","parse_operator"],[2,2,1,"","visit_Add"],[2,2,1,"","visit_BinOp"],[2,2,1,"","visit_BoolOp"],[2,2,1,"","visit_Bytes"],[2,2,1,"","visit_Call"],[2,2,1,"","visit_Compare"],[2,2,1,"","visit_Constant"],[2,2,1,"","visit_Div"],[2,2,1,"","visit_Ellipsis"],[2,2,1,"","visit_Eq"],[2,2,1,"","visit_Gt"],[2,2,1,"","visit_GtE"],[2,2,1,"","visit_Lt"],[2,2,1,"","visit_LtE"],[2,2,1,"","visit_Mult"],[2,2,1,"","visit_Name"],[2,2,1,"","visit_NameConstant"],[2,2,1,"","visit_NotEq"],[2,2,1,"","visit_Num"],[2,2,1,"","visit_Pow"],[2,2,1,"","visit_Str"],[2,2,1,"","visit_Sub"],[2,2,1,"","visit_USub"],[2,2,1,"","visit_UnaryOp"]],"spatialpy.solvers.build_expression.PythonConverter":[[2,2,1,"","visit_And"],[2,2,1,"","visit_Or"]],"spatialpy.solvers.solver":[[2,1,1,"","Solver"]],"spatialpy.solvers.solver.Solver":[[2,2,1,"","compile"],[2,2,1,"","run"]],"spatialpy.stochss":[[3,0,0,"-","stochss_export"]],"spatialpy.stochss.stochss_export":[[3,6,1,"","export"]],spatialpy:[[1,0,0,"-","core"],[2,0,0,"-","solvers"],[3,0,0,"-","stochss"]]},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","exception","Python exception"],"4":["py","attribute","Python attribute"],"5":["py","property","Python property"],"6":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:exception","4":"py:attribute","5":"py:property","6":"py:function"},terms:{"0":[1,2],"0012333":1,"04":1,"0511773":1,"1":[1,2],"10":1,"10000":[],"11":1,"12295571":1,"13":1,"14":1,"14142136":[],"15":1,"168474926":1,"19":1,"1993":1,"1993apj":1,"1999":1,"1d":1,"2":1,"20":1,"2000":1,"2002":1,"2003mnra":1,"2005":1,"2015":1,"2019":[],"2022":[],"2236068":1,"2333084":1,"23606798":1,"24617575":1,"26836782":1,"28942611":1,"29571802":1,"2d":1,"2df":1,"2e9":[],"2r01eb014877":4,"3":[1,4],"300":1,"30088013":1,"31994999":1,"32580855":1,"33630734":1,"346":1,"37327919":1,"39923701":1,"3d":[1,4],"4":1,"40":1,"412":1,"5":1,"500":1,"55396483":1,"5647":1,"56906522":1,"57714465":1,"6":1,"600":1,"6395831":1,"6473269":1,"64l":1,"7":1,"71124834":1,"7225693":1,"72658602":1,"75679479":1,"78h":1,"79428925":1,"8":1,"800":1,"80622577":1,"8658745":1,"87665969":1,"9":1,"90785663":1,"abstract":[1,2],"byte":2,"case":1,"class":[1,2],"default":1,"do":1,"export":[1,3],"float":1,"function":[1,2],"import":1,"int":[1,2],"long":1,"new":[1,2],"public":4,"return":[1,2,3],"short":4,"static":[1,4],"super":2,"switch":1,"true":[1,2,3],A:[1,2,4],And:2,As:1,By:[1,2],FOR:[],For:[1,4],If:[1,2,4],In:1,It:1,No:1,Not:2,Or:2,The:[1,2,4],These:[],To:1,Will:1,_ast:[],ab:1,abl:1,about:1,abov:1,absolut:1,acceler:1,accept:2,across:1,action:1,actual:1,ad:[1,2],adapt:1,add:[1,2],add_boundary_condit:1,add_data_funct:1,add_domain:1,add_initial_condit:1,add_paramet:1,add_point:1,add_product:1,add_react:1,add_speci:1,addit:[1,2],addition:[1,2],addtion:[1,2],adsab:1,advect:4,against:[1,2],al:1,algorithm:[1,4],align:1,all:[1,2],allow:2,along:1,alreadi:1,also:[1,2,4],alwai:[1,2],amount:1,an:[1,2,4],analysi:1,angular:1,ani:[1,2,4],anim:1,animation_attribut:1,animation_opt:1,annot:1,append:2,appli:1,approxim:1,ar:[1,2],argument:1,around:1,arrai:1,arraid:1,array_lik:1,articl:4,artifici:1,arxiv:1,asarrai:1,ascii:1,assembl:1,assign:[1,2],associ:1,assum:2,ast:2,astro:1,astronom:1,astrophys:1,attempt:1,attribut:1,author:4,auto_plai:1,automat:[1,2],autorang:1,avail:[1,2,4],averag:1,axi:1,background:1,balanced_tre:1,bare:2,base:[1,2,4],basic:1,bass:1,becaus:1,becom:1,been:1,befor:1,begin:1,behavior:[1,2],below:1,best:[],between:[1,2],bia:1,bin:1,binari:1,binboolopop:2,binop:2,biochem:1,bitand:2,bitor:2,bitxor:2,blacklist:2,blob:1,blue:1,bodi:1,bogu:1,bool:[1,2,3],boolop:2,both:4,bottom:1,bound:1,bound_cond:1,boundari:1,boundarycondit:0,boundaryconditionerror:1,box:1,boxsiz:1,bracket:1,branch:1,brian:4,broadcast:1,browser:1,brute:1,bugn:1,build:[1,2,4],build_dir:1,build_express:0,buildexpress:2,built:[1,2],bulk:1,bupu:1,bvf_phi:1,c0:1,c:[1,2],c_:1,calcul:1,calculate_vol:1,call:[1,2],can:[1,2,4],caus:[1,2],cdn:1,cell:1,charact:1,chart:1,check:[1,2],chemic:1,children:1,choos:1,chosen:1,circumradiu:1,ckdtree:1,ckdtree_nod:1,ckdtreenod:1,classmethod:[1,2],cleanup:0,cleanup_build_fil:1,cleanup_core_fil:1,cleanup_result_fil:1,cleanup_tempfil:1,clear:1,close:1,closest:1,closest_vertex:1,cloud:1,cluster:1,code:4,coeffic:1,coeffici:1,collabor:1,colormap:1,column:1,com:[1,4],combin:1,compact:1,compact_nod:1,compar:[1,2],comparison:2,compil:[1,2],compile_prep:1,compos:1,comput:1,conain:1,conatain:1,concentr:1,condit:[1,2],config:1,connect:1,connolli:1,consid:1,consol:2,constant:[1,2],construct:1,constructor:2,constuct:1,contact:4,contain:[1,2],content:4,context:2,contian:1,contigu:1,continu:4,convers:2,convert:[1,2,3],convert_str:2,convet:2,coo_matrix:1,coodin:1,coordin:1,copi:[1,2],copy_data:1,copy_numb:1,copyright:[],core:[0,2,3,4],corner:1,correl:1,correspond:[1,2],corrupt:1,cosmolog:1,could:[1,2],count:1,count_neighbor:1,coupl:1,cppconvert:2,cppexpressiontransform:2,cpu:1,cradded:1,creat:[1,2],create_2d_domain:1,create_3d_domain:1,csv:1,cumul:1,current:[1,2],custom:1,cylind:4,cython:[],d:1,data:[1,2],data_funct:1,datafunct:0,datafunctionerror:1,dd:1,debug:[1,2],debug_level:[1,2],debugg:2,decreas:1,default_rng:1,defer:1,defin:[1,2],definit:1,degener:1,delete_all_paramet:1,delete_all_react:1,delete_all_speci:1,delete_paramet:1,delete_react:1,delete_speci:1,deltai:1,deltax:1,deltaz:1,demo:4,densiti:1,depend:1,dependency_graph:1,deprec:1,describ:[1,4],descript:1,detail:1,determinist:[1,4],determinst:1,develop:4,diamet:1,dict:[1,2,3],dictionari:[1,2],differ:[1,2],diffus:[1,4],diffusion_coeffici:1,dimens:1,dimension:1,direct:1,directli:[1,4],directori:1,discuss:1,displai:1,dissip:4,dist:1,distanc:1,distance_between_2_vertic:1,distance_matrix:1,distance_upper_bound:1,distribut:[],div:2,doe:1,doesn:1,dok_matrix:1,dolfin:1,dom:1,domain:[0,4],domainerror:1,domn:1,doubl:1,download:1,dr:4,draw:1,drawert:4,drawn:1,dtype:1,dual:1,duplic:2,durat:1,dure:[1,2],dynam:4,e:1,each:1,edg:1,edit:1,edu:1,effect:1,effici:1,either:1,element:1,ellipsi:2,els:[1,3],embed:4,empti:2,end:1,engin:1,ensur:[1,2],enterpris:1,entir:1,entireti:1,entri:1,ep:1,eq:2,equival:2,error:1,estim:1,et:1,euclidean:1,evalu:1,evaul:1,even:[],evenli:1,exampl:1,exce:1,exceed:2,except:1,execut:[1,2],exist:1,expect:[1,2],expens:1,explor:1,export_stochss:1,export_to_csv:1,expres:2,express:[1,2],expressionconvert:2,expressionresult:2,extens:1,extra:1,f:1,f_durat:1,fail:2,fals:[1,2,3],far:2,faster:1,featur:4,fenic:1,field:1,fifo:1,figsiz:1,figur:1,figure_or_data:1,file:[1,3],filenam:[1,3],fill:[1,4],fill_with_particl:1,find:[1,4],find_boundary_point:1,find_h:1,finit:1,first:[1,2],fit:[],fix:1,flag:[1,2],flatten:1,flight:2,floordiv:2,flow:4,fluid:[1,4],folder_nam:1,follow:[1,2],forc:1,form:[1,4],format:1,forward:2,found:[1,2,4],foundat:[],frac:1,fraction:1,frame:[1,4],free:[],frequenc:1,from:[1,2],fromkei:1,fund:4,further:1,furthest:1,g:1,gain:1,galaxi:1,gdbgui:2,gener:[1,4],geometr:1,geometri:0,geometry_ivar:1,geometryal:1,geometryerror:1,geometryexterior:1,geometryinterior:1,get:[1,2],get_all_paramet:1,get_all_react:1,get_all_speci:1,get_arrai:1,get_array_nam:1,get_bounding_box:1,get_domain_s:1,get_num_point:1,get_num_react:1,get_num_speci:1,get_num_voxel:1,get_paramet:1,get_point:1,get_properti:1,get_react:1,get_speci:1,get_str:2,get_timespan:1,get_type_def:1,get_vol:1,getexpr_:2,getexpr_cpp:2,getexpr_python:2,github:[1,4],give:1,given:[1,2],gmsh:1,gnbu:1,gnu:4,gprof:2,grai:1,grant:4,granular:2,graph:1,graph_obj:1,graph_refer:1,graviti:[1,4],greater:1,greatest:1,green:1,grei:1,group:1,gt:2,gte:2,guarante:1,h:1,ha:[1,4],hand:2,handl:2,happen:2,harvard:1,hasn:[1,2],have:1,hawkin:1,height:1,held:1,help:1,here:[1,4],high:1,higher:1,highest:1,hit:1,hope:[],how:[1,2,4],http:[1,4],hybrid:4,hyperrectangl:1,i:1,id:1,idea:1,ideal:2,idempot:1,identifi:[1,2],idx:1,ignor:1,ii:1,imag:1,image_height:1,image_width:1,immobil:1,implemenet:1,implement:[1,2],impli:[],import_meshio_object:1,imposs:2,inch:1,incid:1,includ:1,included_types_list:1,incompat:1,increas:1,increment:2,indec:1,indeci:1,index:[1,4],indic:[1,2],indici:1,inf:1,infer:2,infin:1,infinit:1,info:1,inform:[1,2,4],inherit:2,init_cond:1,init_notebook_mod:1,initailcondit:1,initi:1,initialcondit:0,initialconditionerror:1,inlin:1,innernod:1,input:1,insert:1,insid:1,instanc:[1,2],instead:1,integ:1,intend:4,intern:1,internet:1,interv:1,invalid:[1,2],invalid_:2,invalid_nam:2,invalid_oper:2,io:1,iplot:1,ipython:1,is_valid:2,issuecom:1,item:[1,2],iter:1,its:1,j:1,jacob:4,jet:1,job:1,journal:1,jpeg:1,js:1,json:1,jupyt:1,k:1,kd:1,kd_tree1:1,kd_tree2:1,kd_tree:1,kdtree:1,kei:[1,2],keyerror:1,keyword:1,kill:1,kth:1,kwarg:1,l_i:1,lack:1,lagrangian:4,landi:1,larg:1,larger:1,last:[1,2],later:[1,2],latest:4,layout:1,leafnod:1,leafsiz:1,learn:1,leav:1,left:2,legaci:1,len:1,length:1,less:1,level:[1,2],li:4,librari:1,licens:4,lifo:1,like:1,limit:1,linearli:1,link:1,link_text:1,list:[1,2],listofparamet:1,listofreact:1,listofspeci:1,listoftyp:1,load:1,local:1,locat:1,logic:2,longer:1,look:1,lookup:1,loos:1,lower:1,lowest:1,lshift:2,lt:2,lte:2,ly:1,m:1,mai:1,main:4,make:1,manag:2,maneewongvatana:1,manhattan:1,mani:[1,2],map:[1,2],map_oper:2,maplotlib:1,margin:1,mark:1,markers:1,mass:1,master:1,mathemat:[1,2],matmult:2,matplotlib:1,matrix:1,matter:1,max:1,max_dist:1,maximum:[1,2],mean:1,measur:1,median:1,meet:1,megabyt:1,merchant:[],mesh:1,mesh_obj:1,meshio:1,messag:1,meta:1,method:[1,2],mgrid:1,midpoint:1,min:1,mine:1,minim:1,minimum:1,minkowski:1,miss:1,mod:2,model:[0,2,3,4],modelerror:1,modelname_mesh:1,modelname_species_:1,modifi:1,modul:4,monthli:1,moor:1,more:[1,2,4],most:[1,2],mount:1,move:1,move_to_end:1,movement:1,mpl_height:1,mpl_size:1,mpl_width:1,msh:1,much:1,mult:2,multi:1,multipl:[1,2],multiple_graph:1,must:1,n:1,n_i:1,naiv:1,name:[1,2],nameconst:2,namespac:[1,2],ncol:1,ndarrai:1,ndarri:1,nearbi:1,nearby_point:1,nearer:1,nearest:1,necessari:1,necessarili:[],need:[1,4],neg:1,neighbor:1,neighbour:1,nih:4,node:[1,2],nodetransform:2,nodevisitor:2,non:1,none:[1,2,3],nonneg:1,norm:1,notat:1,note:[1,2],notebook:[1,4],noteq:2,notic:1,np:1,nrow:1,nsm:4,nu:1,num:2,num_step:1,number:[1,2],number_of_thread:[1,2],number_of_trajectori:[1,2],numpi:1,numpoint:1,nx:1,ny:1,nz:1,o:1,obj:1,object:[1,2],occur:1,od:1,off:1,offlin:1,og:1,omit:1,on_boundari:1,one:[1,2],onli:[1,2],onlin:1,open:1,oper:[1,2],operator_map:2,optim:1,option:1,orang:1,order:1,ordereddict:1,org:1,origin:2,orrd:1,other:[1,2],otherwis:[1,2],our:[1,4],out:[1,4],outdat:1,output:[1,2],output_interv:1,output_typ:1,outsid:1,over:1,overflow:1,overrid:2,overridden:1,p0:1,p:1,p_ndx:1,packag:4,page:[1,4],pair:1,parallel:1,param:1,param_nam:1,param_obj:1,paramet:[0,2,3],parametererror:1,paramt:1,parent:1,pars:2,parse_comparison:2,parse_log:2,parse_oper:2,part:1,partcil:1,particip:1,particl:[1,4],particular:1,pass:[1,2],path:[1,3],pdf:1,peculiar:1,per:1,perform:1,petzold:4,ph:1,physic:4,pii:4,pixel:1,place:1,placeinitialcondit:1,platform:1,pleas:[1,4],plot:1,plot_arg:1,plot_imag:1,plot_properti:1,plot_scatt:1,plot_speci:1,plot_typ:1,plote:1,plotli:1,plotly3:1,plt:1,pname:1,png:1,point:1,points1:1,points2:1,pop:[1,2],popitem:1,popul:1,posit:1,positon:1,pow:2,pre:2,predict:1,preper:1,present:[1,2],pressur:1,print:[1,2],problem:[1,4],process:[1,2],processor:1,produc:1,product:1,profil:[1,2],program:[],project:4,propens:1,propensity_funct:1,properli:1,properti:[1,2],property_nam:1,proprti:1,protect:1,prove:4,provid:[1,2,4],prune:1,pt:[],publish:[],pubu:1,pubugn:1,pull:1,purd:1,purpl:1,purpos:[],put:1,px:1,py:1,pypi:4,pyplot:1,python:[1,2,4],pythonconvert:2,pyurdm:4,quantifi:1,queri:1,query_ball_point:1,query_ball_tre:1,query_pair:1,question:4,quick:1,r:1,radii:1,radiu:1,rais:[1,2],random:[1,2],randomli:1,rang:1,rapidli:1,rate:1,rather:1,ratio:1,ravel:1,raw:1,rdme:4,rdpu:1,re:1,reac:1,reach:1,react_nam:1,react_obj:1,reactant:1,reaction:[0,4],reactionerror:1,read:1,read_fil:1,read_msh_fil:1,read_step:1,read_stochss_domain:1,read_stochss_subdomain_fil:1,read_xml_mesh:1,reader:1,real:1,reason:[],receiv:[],recent:[1,2],record:1,recurs:[],red:1,redistribut:[],redshift:1,refer:1,referenc:1,regardless:1,region:1,regist:4,registr:4,reject:2,rememb:1,remov:1,replac:4,repres:1,represent:[1,2],request:1,requir:1,reserved_nam:1,resolut:1,restrict:1,restrict_to:1,result:[0,2],result_dir:1,resulterror:1,retreiv:1,retriev:1,return_length:1,return_plotly_figur:1,return_sort:1,return_stochss_model:[1,3],rho0:1,rho:1,right:[1,2],rname:1,rng:1,robust:1,royal:1,rshift:2,rtype:2,rule:1,run:[1,2],runtimeerror:[],rvalu:2,s0021999118307101:4,s:[1,4],same:1,sampl:1,sanit:2,sanitized_data_function_nam:1,sanitized_parameter_nam:1,sanitized_species_nam:1,save:1,scalar:1,scale:1,scatter:1,scatter_arg:1,scatterinitialcondit:1,schedul:1,scheme:1,scienc:[1,4],sciencedirect:4,scipi:1,sdm:1,sdpd:[1,4],search:[1,4],second:[1,2],section:1,see:[1,4],seed:[1,2],self:[1,2],sens:1,sep:1,separ:1,sequenc:1,seri:[1,2],set:[1,2],set_diffusion_coeffici:1,set_filenam:1,set_properti:1,set_timestep:1,setdefault:1,setrecursionlimit:[],setter:1,shall:1,shallow:1,shape:1,sheth:1,should:[1,2],show:1,show_link:1,shrink:1,signal:1,significantli:1,similar:1,simlat:1,simplifi:1,simul:[1,2,4],simulationerror:[1,2],simulationtimeout:[1,2],sinc:1,singl:[1,2],size:1,skibba:1,sky:1,slide:1,slightli:1,small:1,smaller:1,smdl:1,smooth:4,sname:1,so:[1,2],societi:1,softwar:4,solver:[0,1,4],some:1,sort:1,sound:1,sourc:[1,2,3,4],space:1,spactialpi:2,span:1,spars:1,sparse_distance_matrix:1,spatial:[1,2,4],spatialpy_build:1,spatialpy_model:1,spatialpy_result:1,spatialpyerror:0,spatialpysolv:1,speci:0,special_charact:1,species_nam:1,species_object:1,specieserror:1,specif:1,specifi:1,speed:1,split:1,split_dim:1,squeez:1,src:1,ssa:1,sssa:4,start:[1,2,4],statement:2,statist:1,step:1,step_num:1,stochast:[1,4],stochss:[0,1,4],stochss_export:0,stoichiometr:1,stoichiometri:1,store:[],str:[1,2,3],string:[1,2],struct:2,structur:1,style:1,sub:2,subclass:[1,2],subdomain:1,submodul:0,subpackag:4,subplot:1,substanti:1,substitut:2,success:1,suggest:4,sum:1,suppli:1,support:[1,4],sure:1,survei:1,svg:1,sy:[],symbol:2,syntax:2,syntaxerror:2,system:[1,4],szalai:1,t:[1,2],t_durat:1,t_ndx:1,t_ndx_list:1,t_val:1,tag:1,take:1,target:[1,2],tempfil:1,term:[],tetrahedron:1,text:1,th:1,than:1,them:1,thi:[1,2,4],thin:1,those:1,though:1,thread:[1,2],time:[1,2],time_span:1,timeout:[1,2],timepoint:1,timespan:1,timestep:1,timestep_s:1,titl:1,toarrai:1,token:2,topolog:1,toroid:1,total:1,toth:1,trace:1,tracker:4,trajectori:[1,2],transit:1,travers:1,tree:[1,2],triangl:1,trigger:2,tspan:1,tupl:1,two:[1,2],txt:1,type:[1,2,3],type_id:1,u0:1,unabl:1,unaryop:2,under:[1,4],uniform:1,uniforminitialcondit:1,union:1,univers:[1,2],unless:1,unnecessari:1,unsqueez:1,unweight:1,up:1,updat:1,update_namespac:1,upload:1,upon:1,upper:1,urdm:1,us:[1,2,4],use_matplotlib:1,user:[1,4],usual:1,usub:2,util:1,v1:1,v:1,valid:[1,2],validationvisitor:2,valu:[1,2],valueerror:1,vari:1,varianc:1,veloc:1,verbos:2,veri:[],version:[1,4],vertex:1,vertic:1,view:1,viewer:1,viscos:1,visit:2,visit_add:2,visit_and:2,visit_assign:2,visit_binop:2,visit_boolop:2,visit_byt:2,visit_cal:2,visit_compar:2,visit_const:2,visit_div:2,visit_ellipsi:2,visit_eq:2,visit_gt:2,visit_lt:2,visit_mult:2,visit_nam:2,visit_nameconst:2,visit_noteq:2,visit_num:2,visit_or:2,visit_pow:2,visit_str:2,visit_sub:2,visit_unaryop:2,visit_usub:2,visitor:2,visual:0,visualizationerror:1,vol:1,volum:1,voxel:1,vtk:1,vtkreader:0,vtkreadererror:1,vtkreaderioerror:1,wa:1,want:1,warranti:[],we:[1,4],web:1,webp:1,weight:1,weir:4,well:2,were:[1,2],what:2,when:[1,2],where:1,whether:[1,2,3],which:[1,2],whose:1,wide:1,width:1,with_blacklist:2,with_namespac:2,within:1,without:[],work:1,worker:1,wp:1,wrap:1,write:1,write_imag:1,written:1,www:4,x1:1,x2:1,x:1,x_i:1,xaxi:1,xi:1,xk:1,xlim:1,xmax:1,xmin:1,xml:1,y:1,yaxi:1,yet:1,yi:4,ylgn:1,ylgnbu:1,ylim:1,ylorbr:1,ylorrd:1,ymax:1,ymin:1,you:[1,4],your:[1,4],z:1,zero:1,zeroth:1,zip:[],zlim:1,zmax:1,zmin:1},titles:["spatialpy package","spatialpy.core package","spatialpy.solvers package","spatialpy.stochss package","Documentation for SpatialPy 1.0.2"],titleterms:{"0":4,"1":4,"2":4,api:4,boundarycondit:1,build_express:2,cleanup:1,content:[0,1,2,3],copi:4,core:1,datafunct:1,document:4,domain:1,exampl:4,geometri:1,get:4,indic:4,initialcondit:1,issu:4,model:1,modul:[0,1,2,3],packag:[0,1,2,3],paramet:1,reaction:1,refer:4,report:4,result:1,solver:2,spatialpi:[0,1,2,3,4],spatialpyerror:1,speci:1,stochss:3,stochss_export:3,submodul:[1,2,3],subpackag:0,tabl:4,visual:1,vtkreader:1}}) \ No newline at end of file diff --git a/docs/classes/spatialpy.core.rst b/docs/classes/spatialpy.core.rst index 9d0dc903..f259fa08 100644 --- a/docs/classes/spatialpy.core.rst +++ b/docs/classes/spatialpy.core.rst @@ -100,6 +100,14 @@ spatialpy.core.species module :undoc-members: :show-inheritance: +spatialpy.core.visualization module +----------------------------------- + +.. automodule:: spatialpy.core.visualization + :members: + :undoc-members: + :show-inheritance: + spatialpy.core.vtkreader module ------------------------------- diff --git a/setup.py b/setup.py index b802fe9f..32d8db35 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . #!/usr/bin/env python3 # ============================================================================= diff --git a/spatialpy/__init__.py b/spatialpy/__init__.py index e125594a..8e541f81 100644 --- a/spatialpy/__init__.py +++ b/spatialpy/__init__.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . #__all__=['model','spatialpy'] #from .spatialpy import * diff --git a/spatialpy/__version__.py b/spatialpy/__version__.py index 22fc6782..52fbb588 100644 --- a/spatialpy/__version__.py +++ b/spatialpy/__version__.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # ============================================================================= # @file __version__.py @@ -23,7 +21,7 @@ # @website https://github.com/StochSS/SpatialPy # ============================================================================= -__version__ = '1.0' +__version__ = '1.0.2' __title__ = 'SpatialPy' __description__ = 'Python Interface for Spatial Stochastic Biochemical Simulations' __url__ = 'https://spatialpy.github.io/SpatialPy/' @@ -31,4 +29,4 @@ __author__ = 'See AUTHORS' __email__ = 'bdrawert@unca.edu' __license__ = 'GPL-3.0-only' -__copyright__ = 'Copyright (C) 2017-2022' +__copyright__ = 'Copyright (C) 2019-2022' diff --git a/spatialpy/core/__init__.py b/spatialpy/core/__init__.py index bda84e58..1cd9ac9d 100644 --- a/spatialpy/core/__init__.py +++ b/spatialpy/core/__init__.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import logging from spatialpy.__version__ import __version__ @@ -30,6 +28,7 @@ from .result import * from .spatialpyerror import * from .species import * +from .visualization import Visualization from .vtkreader import * _formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') diff --git a/spatialpy/core/boundarycondition.py b/spatialpy/core/boundarycondition.py index c66579d2..32f25ae7 100644 --- a/spatialpy/core/boundarycondition.py +++ b/spatialpy/core/boundarycondition.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . from spatialpy.core.spatialpyerror import BoundaryConditionError diff --git a/spatialpy/core/cleanup.py b/spatialpy/core/cleanup.py index fe1fd204..6da34ccf 100644 --- a/spatialpy/core/cleanup.py +++ b/spatialpy/core/cleanup.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import os import shutil diff --git a/spatialpy/core/datafunction.py b/spatialpy/core/datafunction.py index a926fc5d..5cfaff1b 100644 --- a/spatialpy/core/datafunction.py +++ b/spatialpy/core/datafunction.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . from spatialpy.core.spatialpyerror import DataFunctionError class DataFunction(): diff --git a/spatialpy/core/domain.py b/spatialpy/core/domain.py index b6c763de..4a8c4d2a 100644 --- a/spatialpy/core/domain.py +++ b/spatialpy/core/domain.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import json import string @@ -27,6 +25,7 @@ from plotly.offline import init_notebook_mode, iplot from scipy.spatial import KDTree +from spatialpy.core.visualization import Visualization from spatialpy.core.spatialpyerror import DomainError class Domain(): @@ -204,8 +203,8 @@ def set_properties(self, geometry_ivar, type_id, vol=None, mass=None, nu=None, r """ Add a type definition to the domain. By default, all regions are set to type 0. - :param geometry_ivar: an instance of a :py:class:`spatialpy.core.geometry.Geometry` subclass. The 'inside()' method - of this object will be used to assign properties to points. + :param geometry_ivar: an instance of a :py:class:`spatialpy.core.geometry.Geometry` subclass. \ + The 'inside()' method of this object will be used to assign properties to points. :type geometry_ivar: spatialpy.core.geometry.Geometry :param type_id: The identifier for this type. @@ -270,8 +269,8 @@ def fill_with_particles(self, geometry_ivar, deltax, deltay=None, deltaz=None, x """ Fill a geometric shape with particles. - :param geometry_ivar: an instance of a :py:class:`spatialpy.core.geometry.Geometry` subclass. The 'inside()' method - of this object will be used to create add the particles. + :param geometry_ivar: an instance of a :py:class:`spatialpy.core.geometry.Geometry` subclass. \ + The 'inside()' method of this object will be used to create add the particles. :type geometry_ivar: spatialpy.core.geometry.Geometry :param deltax: Distance between particles on the x-axis. @@ -535,7 +534,7 @@ def calculate_vol(self): self.vol[v3] += t_vol / 4 self.vol[v4] += t_vol / 4 - def plot_types(self, width=None, height=None, colormap=None, size=5, title=None, + def plot_types(self, width=None, height=None, colormap=None, size=None, title=None, included_types_list=None, use_matplotlib=False, return_plotly_figure=False): ''' Plots the domain using plotly. Can only be viewed in a Jupyter Notebook. @@ -574,13 +573,10 @@ def plot_types(self, width=None, height=None, colormap=None, size=5, title=None, ''' from spatialpy.core.result import _plotly_iterate # pylint: disable=import-outside-toplevel - if use_matplotlib: - width = 6.4 if width in (None, "auto") else width - height = 4.8 if height in (None, "auto") else height - else: + if not use_matplotlib: if width in (None, "auto"): width = None if width == "auto" else 500 - if height is None: + if height in (None, "auto"): height = None if height == "auto" else 500 if not numpy.count_nonzero(self.vertices[:, 1]): @@ -593,32 +589,67 @@ def plot_types(self, width=None, height=None, colormap=None, size=5, title=None, self._get_type_name_mapping() types = {} + # Normalize volumes to [0, 1] + vols = (self.vol - numpy.min(self.vol))/numpy.ptp(self.vol) for i, type_id in enumerate(self.type_id): name = type_id[5:] if included_types_list is None or name in included_types_list: if name in types: types[name]['points'].append(self.vertices[i]) types[name]['data'].append(self.typeNdxMapping[type_id]) + types[name]['size_scale'] = numpy.append(types[name]['size_scale'], vols[i]) else: - types[name] = {"points":[self.vertices[i]], "data":[self.typeNdxMapping[type_id]]} + types[name] = { + "points": [self.vertices[i]], + "data": [self.typeNdxMapping[type_id]], + "size_scale": numpy.array([vols[i]]) + } if use_matplotlib: - import matplotlib.pyplot as plt # pylint: disable=import-outside-toplevel - - fig, ax = plt.subplots(figsize=(width, height)) - for name, data in types.items(): - x_coords = list(map(lambda point: point[0], data["points"])) - y_coords = list(map(lambda point: point[1], data["points"])) - - ax.scatter(x_coords, y_coords, label=name) - ax.grid(linestyle='--', linewidth=1) - ax.legend(loc='upper right', fontsize=12) - if title is not None: - ax.set_title(title) - - plt.axis('scaled') + if not isinstance(use_matplotlib, dict): + use_matplotlib = {} + use_matplotlib['limits'] = ( + (self.xlim[0] - 0.25, self.xlim[1] + 0.25), (self.ylim[0] - 0.25, self.ylim[1] + 0.25) + ) + + # Support for width, height, and title args + if width not in (None, "auto") and height not in (None, "auto"): + # TODO: Deprecation warning for width and height + plot_args = {"figsize": (width, height)} + + if "plot_args" in use_matplotlib: + for name, val in use_matplotlib['plot_args'].items(): + plot_args[name] = val + use_matplotlib['plot_args'] = plot_args + + base_group_args = {} + if colormap is not None: + base_group_args['cmap'] = colormap + base_group_args['vmin'] = 1 # minimum number of defined types + base_group_args['vmax'] = len(self.typeNdxMapping) # number of defined types + if size is not None: + base_group_args['s'] = size + + if "scatter_args" not in use_matplotlib: + use_matplotlib['scatter_args'] = {} + for type_id in self.typeNdxMapping.keys(): + type_id = type_id[5:] + group_args = base_group_args.copy() + if type_id in use_matplotlib['scatter_args']: + for name, val in use_matplotlib['scatter_args'][type_id].items(): + group_args[name] = val + use_matplotlib['scatter_args'][type_id] = group_args + + if title is not None: + use_matplotlib['title'] = title + + vis_obj = Visualization(data=types) + vis_obj.plot_scatter(**use_matplotlib) return + if size is None: + size = 5 + is_2d = self.dimensions == 2 trace_list = _plotly_iterate(types, size=size, property_name="type", @@ -860,7 +891,7 @@ def create_3D_domain(cls, xlim, ylim, zlim, nx, ny, nz, type_id=1, mass=1.0, :type fixed: bool :param \**kwargs: Additional keyword arguments passed to :py:class:`Domain`. - + :returns: Uniform 3D SpatialPy Domain object. :rtype: spatialpy.core.domain.Domain """ diff --git a/spatialpy/core/geometry.py b/spatialpy/core/geometry.py index ee3e7aa5..f9c4b6cc 100644 --- a/spatialpy/core/geometry.py +++ b/spatialpy/core/geometry.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . from spatialpy.core.spatialpyerror import GeometryError class Geometry: diff --git a/spatialpy/core/initialcondition.py b/spatialpy/core/initialcondition.py index f3cb505d..94e35f32 100644 --- a/spatialpy/core/initialcondition.py +++ b/spatialpy/core/initialcondition.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import numpy from spatialpy.core.spatialpyerror import InitialConditionError @@ -63,6 +61,10 @@ def apply(self, model): :param model: Model contianing the target species. :type model: spatialpy.core.model.Model """ + if isinstance(self.species, str): + if self.species not in model.listOfSpecies: + raise InitialConditionError(f"Species {self.species} does not exist in the model.") + self.species = model.listOfSpecies[self.species] spec_name = self.species.name spec_ndx = None for index, spec_name in enumerate(model.listOfSpecies.keys()): @@ -106,6 +108,10 @@ def apply(self, model): :param model: Model contianing the target species. :type model: spatialpy.core.model.Model """ + if isinstance(self.species, str): + if self.species not in model.listOfSpecies: + raise InitialConditionError(f"Species {self.species} does not exist in the model.") + self.species = model.listOfSpecies[self.species] spec_name = self.species.name spec_ndx = None for index, spec_name in enumerate(model.listOfSpecies.keys()): @@ -158,6 +164,10 @@ def apply(self, model): :param model: Model contianing the target species. :type model: spatialpy.core.model.Model """ + if isinstance(self.species, str): + if self.species not in model.listOfSpecies: + raise InitialConditionError(f"Species {self.species} does not exist in the model.") + self.species = model.listOfSpecies[self.species] spec_name = self.species.name spec_ndx = None for index, spec_name in enumerate(model.listOfSpecies.keys()): diff --git a/spatialpy/core/model.py b/spatialpy/core/model.py index 68b74b03..62b38ede 100644 --- a/spatialpy/core/model.py +++ b/spatialpy/core/model.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . #This module defines a model that simulates a discrete, stoachastic, mixed biochemical reaction network in python. @@ -318,6 +316,15 @@ def compile_prep(self): self.__update_diffusion_restrictions() self.__apply_initial_conditions() self.__resolve_parameters() + + sanitized_params = self.sanitized_parameter_names() + for species in self.listOfSpecies.values(): + diff_coeff = species.diffusion_coefficient + if isinstance(diff_coeff, str): + if diff_coeff not in sanitized_params: + raise ModelError(f"Parameterm {diff_coeff} doesn't exist.") + species.diffusion_coefficient = sanitized_params[diff_coeff] + self.__get_expression_utility() stoich_matrix = self.__create_stoichiometric_matrix() dep_graph = self.__create_dependency_graph() diff --git a/spatialpy/core/parameter.py b/spatialpy/core/parameter.py index d918663a..7dc35a4d 100644 --- a/spatialpy/core/parameter.py +++ b/spatialpy/core/parameter.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . from spatialpy.core.spatialpyerror import ParameterError class Parameter(): diff --git a/spatialpy/core/reaction.py b/spatialpy/core/reaction.py index 988f0823..1e3f8a7b 100644 --- a/spatialpy/core/reaction.py +++ b/spatialpy/core/reaction.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import uuid from spatialpy.core.species import Species diff --git a/spatialpy/core/result.py b/spatialpy/core/result.py index a8408d8f..fbba4537 100644 --- a/spatialpy/core/result.py +++ b/spatialpy/core/result.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import csv import filecmp @@ -29,6 +27,7 @@ from plotly.offline import init_notebook_mode, iplot # from spatialpy.core.model import * +from spatialpy.core.visualization import Visualization from spatialpy.core.vtkreader import VTKReader from spatialpy.core.spatialpyerror import ResultError @@ -221,6 +220,9 @@ def __del__(self): def __map_property_to_type(self, property_name, data, included_types_list, points, p_ndx): types = {} if property_name == 'type': + # Normalize volumes to [0, 1] + vol = data['mass'] / data['rho'] + vols = (vol - numpy.min(vol))/numpy.ptp(vol) for i, val in enumerate(data['type']): name = self.model.domain.typeNameMapping[val][5:] @@ -228,9 +230,15 @@ def __map_property_to_type(self, property_name, data, included_types_list, point if name in types: types[name]['points'].append(points[i]) types[name]['data'].append(data[property_name][i]) + types[name]['size_scale'] = numpy.append(types[name]['size_scale'], vols[i]) else: - types[name] = {"points":[points[i]], "data":[data[property_name][i]]} - elif property_name == 'v': + types[name] = { + "points": [points[i]], + "data": [data[property_name][i]], + "size_scale": numpy.array([vols[i]]) + } + return types + if property_name == 'v': types[property_name] = { "points": points, "data" : [data[property_name][i][p_ndx] for i in range(0,len(data[property_name]))] @@ -326,7 +334,8 @@ def get_species(self, species, timepoints=None, concentration=False, determinist If set to True, the concentration (=copy_number/volume) is returned. Defaults to False :type concentration: bool - :param deterministic: Whether or not the species is deterministic (True) or stochastic (False). Defaults to False + :param deterministic: Whether or not the species is deterministic (True) or stochastic (False). \ + Defaults to False :type deterministic: bool :param debug: Whether or not debug information should be printed. Defaults to False @@ -614,7 +623,6 @@ def get_property(self, property_name, timepoints=None): t_index_arr = [t_index_arr] num_timepoints = 1 - if property_name == "v": ret = numpy.zeros((num_timepoints, num_voxel, 3)) else: @@ -630,7 +638,7 @@ def get_property(self, property_name, timepoints=None): return ret def plot_property(self, property_name, t_ndx=None, t_val=None, p_ndx=0, width=None, height=None, - colormap=None, size=5, title=None, animated=False, t_ndx_list=None, speed=1, + colormap=None, size=None, title=None, animated=False, t_ndx_list=None, speed=1, f_duration=500, t_duration=300, included_types_list=None, return_plotly_figure=False, use_matplotlib=False, debug=False): """ @@ -743,17 +751,47 @@ def plot_property(self, property_name, t_ndx=None, t_val=None, p_ndx=0, width=No if use_matplotlib: import matplotlib.pyplot as plt # pylint: disable=import-outside-toplevel + if not isinstance(use_matplotlib, dict): + use_matplotlib = {} + use_matplotlib['limits'] = ( + (self.model.domain.xlim[0] - 0.25, self.model.domain.xlim[1] + 0.25), + (self.model.domain.ylim[0] - 0.25, self.model.domain.ylim[1] + 0.25) + ) + + # Support for width, height, and title args + if width not in (None, "auto") and height not in (None, "auto"): + # TODO: Deprecation warning for width and height + plot_args = {"figsize": (width, height)} + + if "plot_args" in use_matplotlib: + for name, val in use_matplotlib['plot_args'].items(): + plot_args[name] = val + use_matplotlib['plot_args'] = plot_args + + base_group_args = {} + if colormap is not None: + base_group_args['cmap'] = colormap + base_group_args['vmin'] = 1 # minimum number of defined types + base_group_args['vmax'] = len(self.model.domain.typeNdxMapping) # number of defined types + if size is not None: + base_group_args['s'] = size + + if "scatter_args" not in use_matplotlib: + use_matplotlib['scatter_args'] = {} + for type_id in self.model.domain.typeNdxMapping.keys(): + type_id = type_id[5:] + group_args = base_group_args.copy() + if type_id in use_matplotlib['scatter_args']: + for name, val in use_matplotlib['scatter_args'][type_id].items(): + group_args[name] = val + use_matplotlib['scatter_args'][type_id] = group_args + + if title is not None: + use_matplotlib['title'] = title + if property_name == "type": - fig, ax = plt.subplots(figsize=(width, height)) - for name, data in types.items(): - x_coords = list(map(lambda point: point[0], data["points"])) - y_coords = list(map(lambda point: point[1], data["points"])) - - ax.scatter(x_coords, y_coords, label=name) - ax.grid(linestyle='--', linewidth=1) - ax.legend(loc='upper right', fontsize=12) - if title is not None: - ax.set_title(title) + vis_obj = Visualization(data=types) + vis_obj.plot_scatter(**use_matplotlib) else: if property_name == 'v': p_data = data[property_name] @@ -769,9 +807,12 @@ def plot_property(self, property_name, t_ndx=None, t_val=None, p_ndx=0, width=No if title is not None: plt.title(title) plt.grid(linestyle='--', linewidth=1) - plt.axis('scaled') + plt.axis('scaled') return + if size is None: + size = 5 + is_2d = self.model.domain.dimensions == 2 trace_list = _plotly_iterate(types, size=size, property_name=property_name, colormap=colormap, is_2d=is_2d) diff --git a/spatialpy/core/spatialpyerror.py b/spatialpy/core/spatialpyerror.py index ca32ff95..6ad7d0f1 100644 --- a/spatialpy/core/spatialpyerror.py +++ b/spatialpy/core/spatialpyerror.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # Base Module Expections class ModelError(Exception): @@ -27,6 +25,11 @@ class ResultError(Exception): Class for exceptions in the results module. """ +class VisualizationError(Exception): + """ + Class for exceptions in the visualization module. + """ + class VTKReaderError(Exception): """ Bass class for exceptions in the vtkreader module. @@ -81,6 +84,9 @@ class SpeciesError(ModelError): # Result Exceptions +# Visualization Exceptions + + # VTKReader Exceptions class VTKReaderIOError(VTKReaderError): """ diff --git a/spatialpy/core/species.py b/spatialpy/core/species.py index c1f03142..99e85353 100644 --- a/spatialpy/core/species.py +++ b/spatialpy/core/species.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . from spatialpy.core.parameter import Parameter from spatialpy.core.spatialpyerror import SpeciesError @@ -40,9 +38,9 @@ def __init__(self, name=None, diffusion_coefficient=None, restrict_to=None): if diffusion_coefficient is None: raise SpeciesError("Species must have a diffusion_coefficient.") - if not (isinstance(diffusion_coefficient, (Parameter, float, int)) or \ + if not (isinstance(diffusion_coefficient, (Parameter, str, float, int)) or \ type(diffusion_coefficient).__name__ == 'Parameter'): - raise SpeciesError("Diffusion coefficient must be a spatialpy.Parameter, float, or int.") + raise SpeciesError("Diffusion coefficient must be a spatialpy.Parameter, str, float, or int.") if isinstance(diffusion_coefficient, (float, int)) and diffusion_coefficient < 0: raise SpeciesError("Diffusion coefficient must be non-negative.") @@ -73,9 +71,9 @@ def set_diffusion_coefficient(self, diffusion_coefficient): :raises SpeciesError: If diffusion_coefficient is negative or not a valid type. """ - if not (isinstance(diffusion_coefficient, (Parameter, float, int)) or \ + if not (isinstance(diffusion_coefficient, (Parameter, str, float, int)) or \ type(diffusion_coefficient).__name__ == 'Parameter'): - raise SpeciesError("Diffusion coefficient must be a spatialpy.Parameter, float, or int.") + raise SpeciesError("Diffusion coefficient must be a spatialpy.Parameter, str, float, or int.") if diffusion_coefficient < 0: raise SpeciesError("Diffusion coefficient must be non-negative.") diff --git a/spatialpy/core/visualization.py b/spatialpy/core/visualization.py new file mode 100644 index 00000000..b69abc9b --- /dev/null +++ b/spatialpy/core/visualization.py @@ -0,0 +1,184 @@ +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import math +import numpy + +try: + import matplotlib.pyplot as plt + mpl_import_err = None +except ImportError as err: + mpl_import_err = err + +from spatialpy.core.spatialpyerror import VisualizationError + +common_rgb_values=['#1f77b4','#ff7f0e','#2ca02c','#d62728','#9467bd','#8c564b','#e377c2','#7f7f7f', + '#bcbd22','#17becf','#ff0000','#00ff00','#0000ff','#ffff00','#00ffff','#ff00ff', + '#800000','#808000','#008000','#800080','#008080','#000080','#ff9999','#ffcc99', + '#ccff99','#cc99ff','#ffccff','#62666a','#8896bb','#77a096','#9d5a6c','#9d5a6c', + '#eabc75','#ff9600','#885300','#9172ad','#a1b9c4','#18749b','#dadecf','#c5b8a8', + '#000117','#13a8fe','#cf0060','#04354b','#0297a0','#037665','#eed284','#442244', + '#ffddee','#702afb'] + +def _get_coords(points): + labels = ["X-Axis", "Y-Axis", "Z-Axis"] + coords = [] + axes = [] + i = 0 + while len(coords) < 2 and i < 3: + vertex = list(map(lambda point: point[i], points)) + if numpy.count_nonzero(numpy.diff(vertex)) > 0: + coords.append(vertex) + axes.append(labels[i]) + i += 1 + if len(coords) < 2: + if labels[0] not in axes: + coords.insert(0, list(map(lambda point: point[0], points))) + axes.insert(0, labels[0]) + elif labels[1] not in axes: + coords.append(list(map(lambda point: point[1], points))) + axes.append(labels[1]) + return coords, axes + +def _validate_mplplot_args(args): + if args is None: + return {"figsize": (Visualization.MPL_WIDTH, Visualization.MPL_HEIGHT)} + + supported_splts_args = ["sharex", "sharey", "squeeze"] + supported_fig_args = ["figsize", "dpi", "facecolor", "edgecolor", "frameon"] + + kwargs = {} + for name, val in args.items(): + if name in supported_splts_args or name in supported_fig_args: + kwargs[name] = val + else: + from spatialpy.core import log # pylint: disable=import-outside-toplevel + logmsg = f"Un-supported key word argument: {name} is not currently supported" + log.warning(logmsg) + return kwargs + +class Visualization(): + + MPL_WIDTH = 6.4 + MPL_HEIGHT = 4.8 + MPL_SIZE = 40 + + def __init__(self, data): + self.data = data + + def __get_grid_shape(self, multiple_graphs): + if isinstance(multiple_graphs, tuple): + num_subplots = multiple_graphs[0] * multiple_graphs[1] + if num_subplots < len(self.data.keys()): + errmsg = f"The shape {multiple_graphs} of the graphs is to small for the given data" + raise VisualizationError(errmsg) + nrows = multiple_graphs[0] + ncols = multiple_graphs[1] + else: + nrows = math.ceil(len(self.data.keys()) / 2) + ncols = 2 + return nrows, ncols + + def __validate_mplscatter_args(self, args, name): + if args is None: + return {"s": Visualization.MPL_SIZE} + + supported_args = ["s", "cmap", "color", "marker", "vmin", "vmax"] + + group_args = args[name] + if "cmap" in group_args and "color" in group_args: + errmsg = f"scatter args for {name}: 'cmap' and 'color' cannot both be set." + raise VisualizationError(errmsg) + + kwargs = {} + for arg_name, val in group_args.items(): + if arg_name in supported_args: + kwargs[arg_name] = val + else: + from spatialpy.core import log # pylint: disable=import-outside-toplevel + logmsg = f"Un-supported key word argument: {arg_name} is not currently supported" + log.warning(logmsg) + if "s" not in kwargs: + if "size_scale" in self.data[name]: + mpl_smin = 18 + mpl_smax = 180 + kwargs['s'] = (mpl_smax - mpl_smin) * self.data[name]['size_scale'] + mpl_smin + else: + kwargs['s'] = Visualization.MPL_SIZE + return kwargs + + def plot_scatter(self, plot_args=None, scatter_args=None, multiple_graphs=False, title=None, limits=None): + """ + Visualize data using maplotlib scatter plots. + + :param plot_args: additional keyword arguments passed to :py:class:`matplotlib.pyplot.subplots` + :type plot_args: dict + + :param scatter_args: dict of additional keyword arguments passed to \ + :py:class:`matplotlib.pyplot.scatter` for each group. + :type scatter_args: dist + + :param multiple_graphs: if each data entry should be ploted separately or on the same plot. \ + If ploted separately a shape may be provided. + :type multiple_graphs: bool | tuple(nrows, ncols) + """ + if mpl_import_err is not None: + raise VisualizationError("Missing MatPlotLib dependency.") from mpl_import_err + + plot_args = _validate_mplplot_args(plot_args) + if multiple_graphs: + plot_args['nrows'], plot_args['ncols'] = self.__get_grid_shape(multiple_graphs) + + fig, axs = plt.subplots(**plot_args) + if multiple_graphs: + axs = axs.flatten() + if len(self.data.keys())%plot_args['ncols'] != 0: + fig.delaxes(axs[-1]) + axs = numpy.delete(axs, -1) + data_keys = list(self.data.keys()) + for index, ax in enumerate(axs): + name = data_keys[index] + coords, axes_labels = _get_coords(self.data[name]["points"]) + + group_args = self.__validate_mplscatter_args(scatter_args, name) + if "cmap" in group_args: + group_args['c'] = self.data[name]["data"] + + ax.scatter(*coords, label=name, **group_args) + ax.set_xlabel(axes_labels[0]) + ax.set_xlim(limits[0]) + ax.set_ylabel(axes_labels[1]) + ax.set_ylim(limits[1]) + ax.grid(linestyle='--', linewidth=1) + ax.legend(loc='upper right', fontsize=12) + if title is not None: + ax.set_title(title) + else: + for index, (name, data) in enumerate(self.data.items()): + x_coords = list(map(lambda point: point[0], data["points"])) + y_coords = list(map(lambda point: point[1], data["points"])) + + group_args = self.__validate_mplscatter_args(scatter_args, name) + if "cmap" in group_args: + group_args['c'] = data["data"] + + axs.scatter(x_coords, y_coords, label=name, **group_args) + axs.grid(linestyle='--', linewidth=1) + axs.legend(loc='upper right', fontsize=12) + if title is not None: + axs.set_title(title) + + plt.axis('scaled') diff --git a/spatialpy/core/vtkreader.py b/spatialpy/core/vtkreader.py index fe6e363d..99e5f1a7 100644 --- a/spatialpy/core/vtkreader.py +++ b/spatialpy/core/vtkreader.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import numpy diff --git a/spatialpy/solvers/__init__.py b/spatialpy/solvers/__init__.py index c2d9df7c..fd7a442b 100644 --- a/spatialpy/solvers/__init__.py +++ b/spatialpy/solvers/__init__.py @@ -1,19 +1,17 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . from .solver import * diff --git a/spatialpy/solvers/build_expression.py b/spatialpy/solvers/build_expression.py index 505bc79b..573a1ea8 100644 --- a/spatialpy/solvers/build_expression.py +++ b/spatialpy/solvers/build_expression.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import ast diff --git a/spatialpy/solvers/solver.py b/spatialpy/solvers/solver.py index ea622ba0..a9f50240 100644 --- a/spatialpy/solvers/solver.py +++ b/spatialpy/solvers/solver.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import os import shutil diff --git a/spatialpy/stochss/__init__.py b/spatialpy/stochss/__init__.py index 4cb912d4..5449def2 100644 --- a/spatialpy/stochss/__init__.py +++ b/spatialpy/stochss/__init__.py @@ -1,17 +1,15 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . diff --git a/spatialpy/stochss/stochss_export.py b/spatialpy/stochss/stochss_export.py index 02ecc484..45fbf571 100644 --- a/spatialpy/stochss/stochss_export.py +++ b/spatialpy/stochss/stochss_export.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import ast import json diff --git a/test/ioperformance.py b/test/ioperformance.py index 9603f788..4cda3b9f 100644 --- a/test/ioperformance.py +++ b/test/ioperformance.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . #!/usr/bin/env python3 """ PyURDME model with one species diffusing in the unit circle and one diff --git a/test/models/__init__.py b/test/models/__init__.py index f7ca2dba..5449def2 100644 --- a/test/models/__init__.py +++ b/test/models/__init__.py @@ -1,19 +1,15 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . diff --git a/test/models/cylinder_demo3D.py b/test/models/cylinder_demo3D.py index f53b65c5..b8980747 100644 --- a/test/models/cylinder_demo3D.py +++ b/test/models/cylinder_demo3D.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import os import numpy diff --git a/test/models/mincde.py b/test/models/mincde.py index 57f9f954..12c8e2dc 100644 --- a/test/models/mincde.py +++ b/test/models/mincde.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . #!/usr/bin/env python3 diff --git a/test/models/mincde_5r.py b/test/models/mincde_5r.py index 3a73e092..6f945ed3 100644 --- a/test/models/mincde_5r.py +++ b/test/models/mincde_5r.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . #!/usr/bin/env python3 """ spatialpy model file for the MinCDE example. """ diff --git a/test/run_integration_tests.py b/test/run_integration_tests.py index a2b547e3..b84d845f 100644 --- a/test/run_integration_tests.py +++ b/test/run_integration_tests.py @@ -1,21 +1,19 @@ #!/usr/bin/env python3 -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import unittest, sys, os import argparse diff --git a/test/run_unit_tests.py b/test/run_unit_tests.py index b35fb3f3..48e360cc 100755 --- a/test/run_unit_tests.py +++ b/test/run_unit_tests.py @@ -1,21 +1,19 @@ #!/usr/bin/env python3 -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import unittest, sys, os import argparse diff --git a/test/test_mincde.py b/test/test_mincde.py index f089df1a..758e364a 100644 --- a/test/test_mincde.py +++ b/test/test_mincde.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . #!/usr/bin/env python3 diff --git a/test/test_model.py b/test/test_model.py index d5a4dbc0..599c9647 100644 --- a/test/test_model.py +++ b/test/test_model.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import pickle diff --git a/test/test_parameter.py b/test/test_parameter.py index d080f8a9..4d240b48 100644 --- a/test/test_parameter.py +++ b/test/test_parameter.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import unittest import spatialpy diff --git a/test/test_reaction.py b/test/test_reaction.py index 93d213f3..116dcc3c 100644 --- a/test/test_reaction.py +++ b/test/test_reaction.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import re import unittest diff --git a/test/test_solver.py b/test/test_solver.py index feee5619..28bb96ba 100644 --- a/test/test_solver.py +++ b/test/test_solver.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . #!/usr/bin/env python3 diff --git a/test/test_species.py b/test/test_species.py index 3ef5cd62..d1569a4b 100644 --- a/test/test_species.py +++ b/test/test_species.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import unittest import spatialpy @@ -65,10 +63,10 @@ def test_constructor__parameter_diffusion_coefficient(self): self.assertIsInstance(species.diffusion_coefficient, Parameter) - def test_constructor__diffusion_coefficient_not_int_or_float(self): - """ Test the Species constructor with non-int or non-float diffusion_coefficient. """ + def test_constructor__diffusion_coefficient_not_str_int_or_float(self): + """ Test the Species constructor with non-str, non-int, or non-float diffusion_coefficient. """ with self.assertRaises(SpeciesError): - species = Species(name="test_species", diffusion_coefficient="0") + species = Species(name="test_species", diffusion_coefficient=[0]) def test_constructor__restrict_to_not_accepted_type(self): @@ -111,8 +109,8 @@ def test_set_diffusion_coefficient__negative_diffusion_coefficient(self): species.set_diffusion_coefficient(diffusion_coefficient=-1) - def test_set_diffusion_coefficient__diffusion_coefficient_not_int_or_float(self): - """ Test Species.set_diffusion_coefficient method with non-int or non-float diffusion_coefficient. """ + def test_set_diffusion_coefficient__diffusion_coefficient_not_str_int_or_float(self): + """ Test Species.set_diffusion_coefficient method with non-str, non-int, or non-float diffusion_coefficient. """ species = Species(name="test_species", diffusion_coefficient=0) with self.assertRaises(SpeciesError): - species.set_diffusion_coefficient(diffusion_coefficient="1") + species.set_diffusion_coefficient(diffusion_coefficient=[0]) diff --git a/test/test_threads.py b/test/test_threads.py index feeba6f0..b555a511 100644 --- a/test/test_threads.py +++ b/test/test_threads.py @@ -1,20 +1,18 @@ -''' -SpatialPy is a Python 3 package for simulation of -spatial deterministic/stochastic reaction-diffusion-advection problems -Copyright (C) 2019 - 2022 SpatialPy developers. +# SpatialPy is a Python 3 package for simulation of +# spatial deterministic/stochastic reaction-diffusion-advection problems +# Copyright (C) 2019 - 2022 SpatialPy developers. -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as -published by the Free Software Foundation. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 as +# published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU GENERAL PUBLIC LICENSE Version 3 for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU GENERAL PUBLIC LICENSE Version 3 for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . #!/usr/bin/env python3