Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
836d06e
adding movie
briandrawert Feb 21, 2021
94a1fe1
Merge pull request #70 from StochSS/timeout-and-str
BryanRumsey Feb 25, 2021
fa99a72
Added timestep_size to the timespan function. Closes #74
BryanRumsey Mar 2, 2021
7583ce7
Added 'add_mesh' function that will set a models mesh and the list of…
BryanRumsey Mar 2, 2021
8542d4d
Fixed interation bug in the initial conditions section of the models …
BryanRumsey Mar 2, 2021
fa5b87c
Added function that read in a shochss domain and convert it to a Spat…
BryanRumsey Mar 2, 2021
81d52f6
adding spatial birth death model, shows error for #78
briandrawert Mar 3, 2021
cae4990
Merge pull request #81 from StochSS/spatial_birth_death_model
makdl Mar 3, 2021
ccf2496
Fixed error reporting typo.
BryanRumsey Mar 5, 2021
004f0a3
Fixed bug the was assigning the wrong name for ploting species to the…
BryanRumsey Mar 5, 2021
4fbc402
Implemented Result eq and ne
makdl Mar 6, 2021
3802ed4
Re-implemented solver seed tests
makdl Mar 6, 2021
b214853
Replace diffusion model with simplier model
makdl Mar 6, 2021
d6357e3
Renamed GitHub Actions unit test job
makdl Mar 6, 2021
182cfc1
Removed unused imports & whitespace
makdl Mar 6, 2021
d1cc553
Removed unneeded print statement
makdl Mar 6, 2021
3b626bd
Clarify license information
makdl Mar 6, 2021
6b7ba2e
Updated URLS & license clarification
makdl Mar 6, 2021
54079af
Added AUTHORS file, sorted alphabetically
makdl Mar 6, 2021
1db06d0
Updated RELEASE_NOTES & more URLS
makdl Mar 6, 2021
3d5943f
Replace Python2 PATH with Python3
makdl Mar 6, 2021
7bc2673
Remove mistakenly commited debug script
makdl Mar 6, 2021
b6b4c91
Implemented regex filter for propensity filenames
makdl Mar 6, 2021
c3d2a93
Merge pull request #86 from StochSS/sanitize_model_names
briandrawert Mar 6, 2021
a7ba1e1
Re-implemented pickle tests & pickling
makdl Mar 6, 2021
175ebc6
Merge pull request #85 from StochSS/clarify_license
briandrawert Mar 6, 2021
87f27b9
Removed typo
makdl Mar 6, 2021
8daf04d
Merge pull request #83 from StochSS/ploting-bugs
briandrawert Mar 6, 2021
311fda0
Merge pull request #80 from StochSS/stochss_domain
briandrawert Mar 6, 2021
dfda87b
Merge pull request #84 from StochSS/test_updates1
briandrawert Mar 6, 2021
f6641b7
Merge pull request #79 from StochSS/timespan-update
briandrawert Mar 6, 2021
2533190
Fixed typo in the model class str function.
BryanRumsey Mar 8, 2021
a16b03f
Merge pull request #91 from StochSS/str-typo
makdl Mar 8, 2021
091dedd
Removed Result Dict inheritance
makdl Mar 8, 2021
cd9609b
Added Result timeout flag
makdl Mar 8, 2021
7274994
Implemented results output pickling
makdl Mar 9, 2021
0aa5173
Merge pull request #92 from StochSS/remove_dict_inherit
BryanRumsey Mar 9, 2021
d5382b9
Merge pull request #93 from StochSS/pickle_results_dir
BryanRumsey Mar 9, 2021
56bdbb2
Update RELEASE_NOTES
makdl Mar 9, 2021
d2b27e4
Update __version__.py
makdl Mar 9, 2021
6a6131e
Merge pull request #94 from StochSS/beta-0.6.1
BryanRumsey Mar 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adding spatial birth death model, shows error for #78
  • Loading branch information
briandrawert committed Mar 3, 2021
commit 81d52f6e5d4ffad24fb61eb3211499d8d8b62bbe
255 changes: 255 additions & 0 deletions examples/tests/Spatial_Birth_Death.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import numpy\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'../../spatialpy/__init__.py'"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import sys\n",
"sys.path.insert(0,'../..')\n",
"import spatialpy\n",
"spatialpy.__file__"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"model = spatialpy.Model('Spatial Birth-Death')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"model.mesh = spatialpy.Mesh.create_3D_domain([0,1],[0,1],[0,0.1], 10,10,1, fixed=True)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"rabbits = model.add_species(spatialpy.Species('rabbits', D=0.1))"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"model.add_initial_condition(spatialpy.ScatterInitialCondition(rabbits, 100, types=None))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<spatialpy.Model.Parameter at 0x7f6ade4d9280>,\n",
" <spatialpy.Model.Parameter at 0x7f6ade4d98e0>]"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"kb=spatialpy.Parameter('k_birth',10)\n",
"kd=spatialpy.Parameter('k_death',0.1)\n",
"model.add_parameter([kb,kd])"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"model.add_reaction(spatialpy.Reaction(\n",
" 'birth',\n",
" reactants={},\n",
" products={rabbits:1},\n",
" rate=kb))\n",
"#model.add_reaction(spatialpy.Reaction(\n",
"# 'death',\n",
"# reactants={rabbits:1},\n",
"# products={},\n",
"# rate=kd))\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.staticDomain"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"model.timespan(numpy.arange(0,10,1))"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"model.timestep_size = 1"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Reading stdout/stderr from process:\n",
"\n",
"make: *** No rule to make target 'Birth-Death_generated_model.c'. Stop.\n",
"\n"
]
},
{
"ename": "SimulationError",
"evalue": "Compilation of solver failed, return_code=2",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mSimulationError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<timed exec>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n",
"\u001b[0;32m~/Desktop/research/SpatialPy/spatialpy/Model.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, number_of_trajectories, seed, timeout, number_of_threads, debug_level, debug, profile)\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0msol\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mSolver\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdebug_level\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdebug_level\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 104\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 105\u001b[0;31m return sol.run(number_of_trajectories=number_of_trajectories, seed=seed, timeout=timeout,\n\u001b[0m\u001b[1;32m 106\u001b[0m number_of_threads=number_of_threads, debug=debug, profile=profile)\n\u001b[1;32m 107\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Desktop/research/SpatialPy/spatialpy/Solver.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, number_of_trajectories, seed, timeout, number_of_threads, debug, profile)\u001b[0m\n\u001b[1;32m 131\u001b[0m \u001b[0;31m# Check if compiled, call compile() if not.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 132\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_compiled\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 133\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcompile\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdebug\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdebug\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mprofile\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mprofile\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 134\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 135\u001b[0m \u001b[0;31m# Execute the solver\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Desktop/research/SpatialPy/spatialpy/Solver.py\u001b[0m in \u001b[0;36mcompile\u001b[0;34m(self, debug, profile)\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mException\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 104\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 105\u001b[0;31m raise SimulationError(\n\u001b[0m\u001b[1;32m 106\u001b[0m \"Compilation of solver failed, return_code={0}\".format(return_code))\n\u001b[1;32m 107\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mSimulationError\u001b[0m: Compilation of solver failed, return_code=2"
]
}
],
"source": [
"%time result = model.run()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'result' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-14-baaa9e3c3437>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mplot_property\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'type'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mNameError\u001b[0m: name 'result' is not defined"
]
}
],
"source": [
"result.plot_property('type')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"result.plot_species('rabbits', animated=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}