Name | nrn-subprocess JSON |
Version |
1.3.4
JSON |
| download |
home_page | |
Summary | Run isolated NEURON simulations in a single Python session. |
upload_time | 2021-09-20 16:16:05 |
maintainer | |
docs_url | None |
author | Robin De Schepper |
requires_python | |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# NEURON subprocessing
Run multiple NEURON setups isolated from each other from a single Python script.
This package uses Python's `subprocess` to run multiple NEURON instances that
are completely seperated from eachother, making it easier to executed repeated
and parametrized simulations without having to worry about cleaning up the state
of the previous run.
## Installation
```
pip install nrn-subprocess
```
## Usage
Write your entire NEURON setup that you'd like to isolate inside of a function,
then use the `subprocess` or `isolate` approach to execute it in isolation:
### `subprocess`
```
import nrnsub
def my_sim(param1, opt1=None):
from neuron import h
s = h.Section(name="main")
# ...
return s.v
for i in range(10):
nrnsub.subprocess(my_sim, 15, opt1=i)
```
This will run the subprocesses in series, parallel coming Soon (tm).
### `isolate`
There's also the `isolate` decorator that will make sure every call to that function is
ran as an isolated subprocess:
```
import nrnsub
@nrnsub.isolate
def my_sim(param1, opt1=None):
from neuron import h
s = h.Section(name="main")
# ...
return s.v
for i in range(10):
my_sim(15, opt1=i)
```
## Worker `PATH`
The worker might have trouble unpacking the serialized objects because it can't
find the module they came from on the main process. This might result in `dill`
raising "module not found" errors. To fix them you can pass the `_worker_path` to
`subprocess` or `worker_path` to the `isolate` decorator:
```
import nrnsub
sys.path.insert(0, "/home/me/my_modules_folder")
@nrnsub.isolate(worker_path=["/home/me/my_modules_folder"])
def f():
import something_in_my_modules_folder
```
Raw data
{
"_id": null,
"home_page": "",
"name": "nrn-subprocess",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Robin De Schepper",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/a7/31/bd2a6f552130e41a39318670e9d336d9a87ec9e9cd4a3a7032314bca1588/nrn-subprocess-1.3.4.tar.gz",
"platform": "",
"description": "# NEURON subprocessing\n\nRun multiple NEURON setups isolated from each other from a single Python script.\nThis package uses Python's `subprocess` to run multiple NEURON instances that\nare completely seperated from eachother, making it easier to executed repeated\nand parametrized simulations without having to worry about cleaning up the state\nof the previous run.\n\n## Installation\n\n```\npip install nrn-subprocess\n```\n\n## Usage\n\nWrite your entire NEURON setup that you'd like to isolate inside of a function,\nthen use the `subprocess` or `isolate` approach to execute it in isolation:\n\n### `subprocess`\n\n```\nimport nrnsub\n\ndef my_sim(param1, opt1=None):\n from neuron import h\n s = h.Section(name=\"main\")\n # ...\n return s.v\n\nfor i in range(10):\n nrnsub.subprocess(my_sim, 15, opt1=i)\n```\n\nThis will run the subprocesses in series, parallel coming Soon (tm).\n\n### `isolate`\n\nThere's also the `isolate` decorator that will make sure every call to that function is\nran as an isolated subprocess:\n\n```\nimport nrnsub\n\n@nrnsub.isolate\ndef my_sim(param1, opt1=None):\n from neuron import h\n s = h.Section(name=\"main\")\n # ...\n return s.v\n\nfor i in range(10):\n my_sim(15, opt1=i)\n```\n\n## Worker `PATH`\n\nThe worker might have trouble unpacking the serialized objects because it can't\nfind the module they came from on the main process. This might result in `dill`\nraising \"module not found\" errors. To fix them you can pass the `_worker_path` to\n`subprocess` or `worker_path` to the `isolate` decorator:\n\n```\nimport nrnsub\n\nsys.path.insert(0, \"/home/me/my_modules_folder\")\n\n@nrnsub.isolate(worker_path=[\"/home/me/my_modules_folder\"])\ndef f():\n import something_in_my_modules_folder\n```\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Run isolated NEURON simulations in a single Python session.",
"version": "1.3.4",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "f456e625f7d4169fb826931f0195029e",
"sha256": "26f020d9fc999722534cad62fff6662c38dd6ab7c03e5e5ff17711d25df0742e"
},
"downloads": -1,
"filename": "nrn_subprocess-1.3.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f456e625f7d4169fb826931f0195029e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3933,
"upload_time": "2021-09-20T16:16:04",
"upload_time_iso_8601": "2021-09-20T16:16:04.001445Z",
"url": "https://files.pythonhosted.org/packages/ae/74/905d0d6dc2caf5063c5631cce3c86f39629a3e3bff86b45675ab5ba4d706/nrn_subprocess-1.3.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "62c920cd226ad49358586080a7e363c3",
"sha256": "12c8778b3a8ba672875f723604c73708dad86a5cc9f6539f41be0212c254f046"
},
"downloads": -1,
"filename": "nrn-subprocess-1.3.4.tar.gz",
"has_sig": false,
"md5_digest": "62c920cd226ad49358586080a7e363c3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3669,
"upload_time": "2021-09-20T16:16:05",
"upload_time_iso_8601": "2021-09-20T16:16:05.350781Z",
"url": "https://files.pythonhosted.org/packages/a7/31/bd2a6f552130e41a39318670e9d336d9a87ec9e9cd4a3a7032314bca1588/nrn-subprocess-1.3.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-09-20 16:16:05",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "nrn-subprocess"
}