Skip to content

A Python library for reading, parsing, validating and writing the 9ML (http://nineml.net) object model

License

Notifications You must be signed in to change notification settings

tclose/nineml-python

 
 

Repository files navigation

NineML Python Library

Unit Test Status Unit Test Coverage Documentation Status

NineML (9ML) is a language for describing the dynamics and connectivity of neuronal network simulations (http://nineml.net). The language is defined as an object model, described in the NineML specification (http://nineml.net/specification).

The NineML Python Library (9ML-Python) is a software library written in Python, which maps the NineML object model onto Python classes for convenient creation, manipulation and validation of NineML models, as well as handling their serialization to and from XML, JSON, YAML, and HDF5.

Installation

HDF5

To add support to read/write HDF5 serializations you must first install the HDF5 library.

On macOS it can be installed using Homebrew

$ brew install hdf5

On Ubuntu/Debian it can be installed via the libhdf5-serial-dev (serial) libhdf5-openmpi-dev/ (parallel with Open MPI), or libhdf5-mpich-dev (parallel with MPICH) packages.

Pip

9ML-Python can be installed using pip from the cloned/downloaded repo directory

$ pip install -r requirements.txt .

which, will also install the prerequisites packages sympy, lxml, and h5py if they are not already installed.

If you have not installed the HDF5 library in the previous step (and you don't plan to use HDF5 serialization), you can avoid having to install h5py by installing sympy, pyyaml and lxml separately (pyaml_ and lxml are also optional if you don't require XML or YAML support).

NB: As of 12/10/2016 Sympy v1.0 has a bug in its ccode printer, which is used by 9ML-python to write expressions within MathInline elements. This bug has been fixed in the development branch so please either use sympy >= 1.0dev or the earlier version e.g. 0.7.6.1. If you need to use the latest version of Sympy for a different project see virtualenv.

Relation to the NineML Specification

The layout of the Python modules and classes in 9ML-Python relates closely to the structure of the `NineML specification v1.0`_. However, there are notable exceptions where 9ML-Python uses names and relationships that are planned to be changed in v2.0 of the specification (9ML-Python will be backwards compatible), such as the renaming of ComponentClass elements to separate Dynamics, ConnectionRule and RandomDistribution elements (see INCF/nineml-spec#94). A full list of changes planned for NineML v2.0 can be found at https://github.com/INCF/nineml/milestone/3. When serializing 9ML models the v1.0 syntax is used unless the version=2.0 keyword argument is used.

In addition to classes that directly correspond to the 9ML object model, a range of shorthand notations ("syntactic sugar") exist to make writing 9ML models by hand more convenient (see the nineml.sugar module). These notations are frequently demonstrated in the examples directory of the repository.

NineML Catalog

The NineML Catalog (http://github.com/INCF/NineMLCatalog) contains a collection of validated NineML models that can be loaded and maninpulated with nineml-python. If you create a model that you believe will be of wider use to the computational neuroscience community please consider contributing to the catalog via a pull request.

Links

copyright:Copyright 20011-2017 by the nineml-python team, see AUTHORS.
license:BSD 3, see LICENSE for details.

About

A Python library for reading, parsing, validating and writing the 9ML (http://nineml.net) object model

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%