brainpy-largescale


Namebrainpy-largescale JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/NH-NCL/brainpy-largescale
Summarybrainpy-largescale depends on brainpy
upload_time2022-12-16 02:20:02
maintainer
docs_urlNone
authorNanHu Neuromorphic Computing Laboratory Team
requires_python>=3.7
licenseApache-2.0 license
keywords brainpy largescale computational neuroscience brain-inspired computation dynamical systems differential equations brain modeling brain dynamics modeling brain dynamics programming
VCS
bugtrack_url
requirements brainpy numpy tqdm numba mpi4py mpi4jax jax jaxlib matplotlib
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # brainpy-largescale
Run [BrainPy](https://github.com/PKU-NIP-Lab/BrainPy) in multiple processes.

brainpy-largescale depends on [BrainPy](https://github.com/PKU-NIP-Lab/BrainPy) and [brainpy-lib](https://github.com/PKU-NIP-Lab/brainpylib), use the following instructions to [install brainpy package](https://brainpy.readthedocs.io/en/latest/quickstart/installation.html).

## Install
Only support `Linux`
```
pip install brainpy-largescale
```

## Import
```python
import brainpy as bp
import bpl
```

## Set platform
```
bpl.set_platform('cpu')
```
only support cpu.

## Create population

Use Leaky Integrate-and-Fire (LIF)

```python
a = bpl.neurons.LIF(300, V_rest=-60., V_th=-50., V_reset=-60., tau=20., tau_ref=5.)
b = bpl.neurons.LIF(100, V_rest=-60., V_th=-50., V_reset=-60., tau=20., tau_ref=5.)
```

## Create synapse
```python
d = bpl.synapses.Exponential(a, b, bp.conn.FixedProb(0.4, seed=123), g_max=10, tau=5., delay_step=1)
```

## Construct network

```python
net = bpl.Network(a, b, d)
net.build()
```

## Add input

add current input
```python
inputs = [bpl.device.Input(a, 20), bpl.device.Input(b, 10)]
```

## Add spike monitor
```python
monitor_spike = bpl.device.Monitor([a, b], bpl.device.MonitorKey.spike)
```

## Add volt monitor
```python
monitor_volt = bpl.device.Monitor([b], bpl.device.MonitorKey.volt)
```

```python
monitors = [monitor_spike, monitor_volt]
```

## Add spike and volt callback

```python
def spike(a: List[Tuple[int, float]]):
  if a:
    print(a)


def volt(a: List[Tuple[int, float, float]]):
  # print(a)
  pass
```

## Run

```python
runner = bpl.runner.DSRunner(
  net,
  monitors=monitors,
  inputs=inputs,
  jit=False,
  spike_callback=spike,
  volt_callback=volt,
)
runner.run(10.)
```
 
## Visualization
```python
import matplotlib.pyplot as plt

if 'spike' in runner.mon:
  bp.visualize.raster_plot(runner.mon.ts, runner.mon['spike'], show=True)
```

## License<a id="quickstart"></a>
[Apache License, Version 2.0](https://github.com/NH-NCL/brainpy-largescale/blob/main/LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/NH-NCL/brainpy-largescale",
    "name": "brainpy-largescale",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "brainpy largescale,computational neuroscience,brain-inspired computation,dynamical systems,differential equations,brain modeling,brain dynamics modeling,brain dynamics programming",
    "author": "NanHu Neuromorphic Computing Laboratory Team",
    "author_email": "nhnao@cnaeit.com",
    "download_url": "https://files.pythonhosted.org/packages/45/31/9a76166801ffd3e0dfbc9aadf7f28771d549b867d3fc28433ac3f15dc34b/brainpy-largescale-0.1.2.tar.gz",
    "platform": null,
    "description": "# brainpy-largescale\nRun [BrainPy](https://github.com/PKU-NIP-Lab/BrainPy) in multiple processes.\n\nbrainpy-largescale depends on [BrainPy](https://github.com/PKU-NIP-Lab/BrainPy) and [brainpy-lib](https://github.com/PKU-NIP-Lab/brainpylib), use the following instructions to [install brainpy package](https://brainpy.readthedocs.io/en/latest/quickstart/installation.html).\n\n## Install\nOnly support `Linux`\n```\npip install brainpy-largescale\n```\n\n## Import\n```python\nimport brainpy as bp\nimport bpl\n```\n\n## Set platform\n```\nbpl.set_platform('cpu')\n```\nonly support cpu.\n\n## Create population\n\nUse Leaky Integrate-and-Fire (LIF)\n\n```python\na = bpl.neurons.LIF(300, V_rest=-60., V_th=-50., V_reset=-60., tau=20., tau_ref=5.)\nb = bpl.neurons.LIF(100, V_rest=-60., V_th=-50., V_reset=-60., tau=20., tau_ref=5.)\n```\n\n## Create synapse\n```python\nd = bpl.synapses.Exponential(a, b, bp.conn.FixedProb(0.4, seed=123), g_max=10, tau=5., delay_step=1)\n```\n\n## Construct network\n\n```python\nnet = bpl.Network(a, b, d)\nnet.build()\n```\n\n## Add input\n\nadd current input\n```python\ninputs = [bpl.device.Input(a, 20), bpl.device.Input(b, 10)]\n```\n\n## Add spike monitor\n```python\nmonitor_spike = bpl.device.Monitor([a, b], bpl.device.MonitorKey.spike)\n```\n\n## Add volt monitor\n```python\nmonitor_volt = bpl.device.Monitor([b], bpl.device.MonitorKey.volt)\n```\n\n```python\nmonitors = [monitor_spike, monitor_volt]\n```\n\n## Add spike and volt callback\n\n```python\ndef spike(a: List[Tuple[int, float]]):\n  if a:\n    print(a)\n\n\ndef volt(a: List[Tuple[int, float, float]]):\n  # print(a)\n  pass\n```\n\n## Run\n\n```python\nrunner = bpl.runner.DSRunner(\n  net,\n  monitors=monitors,\n  inputs=inputs,\n  jit=False,\n  spike_callback=spike,\n  volt_callback=volt,\n)\nrunner.run(10.)\n```\n \n## Visualization\n```python\nimport matplotlib.pyplot as plt\n\nif 'spike' in runner.mon:\n  bp.visualize.raster_plot(runner.mon.ts, runner.mon['spike'], show=True)\n```\n\n## License<a id=\"quickstart\"></a>\n[Apache License, Version 2.0](https://github.com/NH-NCL/brainpy-largescale/blob/main/LICENSE)\n",
    "bugtrack_url": null,
    "license": "Apache-2.0 license",
    "summary": "brainpy-largescale depends on brainpy",
    "version": "0.1.2",
    "split_keywords": [
        "brainpy largescale",
        "computational neuroscience",
        "brain-inspired computation",
        "dynamical systems",
        "differential equations",
        "brain modeling",
        "brain dynamics modeling",
        "brain dynamics programming"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "e3298a12ed5b9ad98b8c2cb70065b7c5",
                "sha256": "6a20f6e46f2df87ea99251f412f9de08be130706497f23ef8ceee345463b130b"
            },
            "downloads": -1,
            "filename": "brainpy_largescale-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e3298a12ed5b9ad98b8c2cb70065b7c5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 23108,
            "upload_time": "2022-12-16T02:20:00",
            "upload_time_iso_8601": "2022-12-16T02:20:00.588558Z",
            "url": "https://files.pythonhosted.org/packages/3e/d5/e8eff7a78b594ecae64786777ec12982ee2ce38ba03c6dbfa99a8d898259/brainpy_largescale-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "98f02204fae1df605d1e01d1f295e9b3",
                "sha256": "79cdf66a7c58a076f0264c8959c22fe717f728839e3f54e6e6d6672e47349d85"
            },
            "downloads": -1,
            "filename": "brainpy-largescale-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "98f02204fae1df605d1e01d1f295e9b3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 19973,
            "upload_time": "2022-12-16T02:20:02",
            "upload_time_iso_8601": "2022-12-16T02:20:02.804175Z",
            "url": "https://files.pythonhosted.org/packages/45/31/9a76166801ffd3e0dfbc9aadf7f28771d549b867d3fc28433ac3f15dc34b/brainpy-largescale-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-16 02:20:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "NH-NCL",
    "github_project": "brainpy-largescale",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "brainpy",
            "specs": [
                [
                    "==",
                    "2.2.4.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.15"
                ]
            ]
        },
        {
            "name": "tqdm",
            "specs": []
        },
        {
            "name": "numba",
            "specs": []
        },
        {
            "name": "mpi4py",
            "specs": [
                [
                    "==",
                    "3.1.4"
                ]
            ]
        },
        {
            "name": "mpi4jax",
            "specs": [
                [
                    "==",
                    "0.3.11"
                ]
            ]
        },
        {
            "name": "jax",
            "specs": [
                [
                    "==",
                    "0.3.25"
                ]
            ]
        },
        {
            "name": "jaxlib",
            "specs": [
                [
                    "==",
                    "0.3.25"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": []
        }
    ],
    "lcname": "brainpy-largescale"
}
        
Elapsed time: 0.01971s