Skip to main content

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

Metadata

Release files for nrn-subprocess 1.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nrn-subprocess 1.3.4
File Size Uploaded Provenance
nrn-subprocess-1.3.4.tar.gz 3.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nrn-subprocess 1.3.4
File Interpreter ABI Platform
nrn_subprocess-1.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 kB

Release files / nrn-subprocess-1.3.4.tar.gz

Download URL nrn-subprocess-1.3.4.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
12c8778b3a8ba672875f723604c73708dad86a5cc9f6539f41be0212c254f046
BLAKE2b-256 checksum
How to use checksums
a731bd2a6f552130e41a39318670e9d336d9a87ec9e9cd4a3a7032314bca1588
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

Release files / nrn_subprocess-1.3.4-py3-none-any.whl

Download URL nrn_subprocess-1.3.4-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26f020d9fc999722534cad62fff6662c38dd6ab7c03e5e5ff17711d25df0742e
BLAKE2b-256 checksum
How to use checksums
ae74905d0d6dc2caf5063c5631cce3c86f39629a3e3bff86b45675ab5ba4d706
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

Security for nrn-subprocess 1.3.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page