Skip to content

Commit

Permalink
v0.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
mundya committed Jun 8, 2015
1 parent 46dcda4 commit b26efed
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 22 deletions.
53 changes: 34 additions & 19 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,29 @@ SpiNNaker based Nengo simulator
:alt: Coverage Status
:target: https://coveralls.io/r/project-rig/nengo_spinnaker?branch=master

`nengo_spinnaker` is a SpiNNaker-based simulator for models built using
``nengo_spinnaker`` is a SpiNNaker-based simulator for models built using
`Nengo <https://github.com/nengo/nengo>`_. It allows real-time simulation of
large-scale models.

Quick Start
===========

.. warning::
`nengo_spinnaker` is not currently available from Pip.
Install using ``pip``::

pip install nengo_spinnaker

Settings File
-------------

To use SpiNNaker with Nengo you must create a `nengo_spinnaker.conf` file in
To use SpiNNaker with Nengo you must create a ``nengo_spinnaker.conf`` file in
either the directory you will be running your code from or, more usefully, a
centralised location. The centralised location varies based on your operating
system:

- Windows: `%userprofile%\nengo\nengo_spinnaker.conf`
- Other: `~/.config/nengo/nengo_spinnaker.conf`
- Windows: ``%userprofile%\nengo\nengo_spinnaker.conf``
- Other: ``~/.config/nengo/nengo_spinnaker.conf``

This file exists to inform `nengo_spinnaker` of the nature of the SpiNNaker
This file exists to inform ``nengo_spinnaker`` of the nature of the SpiNNaker
machine you wish to simulate with and how to communicate with it. This file may
look like::

Expand Down Expand Up @@ -71,21 +72,21 @@ look like::
# hardware_version: 3
# led_config: 0x00000502
#
# For a Spin5 board connected to 192.168.240.1 this section would look
# For a Spin5 board connected to 192.168.1.1 this section would look
# like:
#
# hostname: 192.168.240.253
# hostname: 192.168.1.1
# width: 8
# height: 8
# hardware_version: 5
# led_config: 0x00000001


Using `nengo_spinnaker`
-----------------------
Using ``nengo_spinnaker``
-------------------------

To use SpiNNaker to simulate your Nengo model first construct the model as
normal. Then use `nengo_spinnaker.Simulator` to simulate your model.::
normal. Then use ``nengo_spinnaker.Simulator`` to simulate your model.::

import nengo_spinnaker

Expand All @@ -94,8 +95,11 @@ normal. Then use `nengo_spinnaker.Simulator` to simulate your model.::
sim = nengo_spinnaker.Simulator(network)
sim.run(10.0)

After running your model you must call `close` to leave the SpiNNaker machine
in a clean state. Alternatively a `with` block may be used to ensure the
# When done
sim.close()

After running your model you must call ``close`` to leave the SpiNNaker machine
in a clean state. Alternatively a ``with`` block may be used to ensure the
simulator is closed after use::

with sim:
Expand All @@ -108,12 +112,23 @@ Some specific configuration options are available for SpiNNaker. To use these::

Current settings are:

* `function_of_time` - Mark a Node as being a function of time only.
* `function_of_time_period` - Provide the period of the Node.
* ``function_of_time`` - Mark a Node as being a function of time only.
* ``function_of_time_period`` - Provide the period of the Node.

For example::

with model:
signal = nengo.Node(lambda t: np.sin(t))

nengo_spinnaker.add_params(model.config)
model.config[signal].function_of_time = True


Developers
==========

See `DEVELOP.md <./DEVELOP.md>`_ for information on how to get involved in
`nengo_spinnaker` development and how to install and build the latest copy of
`nengo_spinnaker`.
See `DEVELOP.md`__ for information on how to get involved in
``nengo_spinnaker`` development and how to install and build the latest copy of
``nengo_spinnaker``.

__ ./DEVELOP.md
83 changes: 80 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,93 @@
import io
import re
from setuptools import setup, find_packages
import sys


def read_file(filename, **kwargs):
encoding = kwargs.get("encoding", "utf-8")

with io.open(filename, encoding=encoding) as f:
return f.read()


def replace_local_hyperlinks(
text,
base_url="https://github.com/project-rig/nengo_spinnaker/blob/master/"
):
"""Replace local hyperlinks in RST with absolute addresses using the given
base URL.
This is used to make links in the long description function correctly
outside of the repository (e.g. when published on PyPi).
NOTE: This may need adjusting if further syntax is used.
"""
def get_new_url(url):
return base_url + url[2:]

# Deal with anonymous URLS
for match in re.finditer(r"^__ (?P<url>\./.*)", text, re.MULTILINE):
orig_url = match.groupdict()["url"]
url = get_new_url(orig_url)

text = re.sub("^__ {}".format(orig_url),
"__ {}".format(url), text, flags=re.MULTILINE)

# Deal with named URLS
for match in re.finditer(r"^\.\. _(?P<identifier>[^:]*): (?P<url>\./.*)",
text, re.MULTILINE):
identifier = match.groupdict()["identifier"]
orig_url = match.groupdict()["url"]
url = get_new_url(orig_url)

text = re.sub(
"^\.\. _{}: {}".format(identifier, orig_url),
".. _{}: {}".format(identifier, url),
text, flags=re.MULTILINE)

# Deal with image URLS
for match in re.finditer(r"^\.\. image:: (?P<url>\./.*)",
text, re.MULTILINE):
orig_url = match.groupdict()["url"]
url = get_new_url(orig_url)

text = text.replace(".. image:: {}".format(orig_url),
".. image:: {}".format(url))

return text

setup(
name="nengo_spinnaker",
version="0.1.0",
version="0.2.0",
packages=find_packages(),
package_data={'nengo_spinnaker': ['binaries/*.aplx']},

# Metadata for PyPi
author="Andrew Mundy",
url="https://github.com/project-rig/nengo_spinnaker",
author="University of Manchester and University of Waterloo",
description="Tools for simulating neural models generated using Nengo on "
"the SpiNNaker platform",
long_description=replace_local_hyperlinks(read_file("README.rst")),
license="GPLv2",
classifiers=[
"Development Status :: 3 - Alpha",

"Intended Audience :: Science/Research",

"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",

"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS",

"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",

"Topic :: Scientific/Engineering",
],
keywords="spinnaker nengo neural cognitive simulation",

# Requirements
install_requires=["nengo>=2.0.0, <3.0.0", "rig>=0.4.0, <1.0.0",
Expand Down

0 comments on commit b26efed

Please sign in to comment.