libNeuroML is a Python package for working with models specified in NeuroML version 2. It provides a native Python object model corresponding to the NeuroML schema. This allows users to build their NeuroML models natively in Python without having to work directly with the underlying XML representation. Additionally, libNeuroML includes functions for the conversion of the Python representation of the NeuroML model to and from the XML representation.
pyNeuroML builds on libNeuroML and includes additional utility functions.
Please cite Vella et al. ([VCC+14]) if you use libNeuroML.
Python is generally pre-installed on all computers nowadays. However, if you do not have Python installed on your system, please follow the official installation instructions to install Python on your computer. A number of Free/Open source Integrated Development Environments (IDEs) are also available that make working with Python (even) easier. An example list is here.
Install libNeuroML with pip#
Tip: Use a virtual environment
While using Python packages, it is suggested to use a virtual environment to isolate the software you install from each other. Learn more about using virtual environments in Python here.
The easiest way to install the latest version of libNeuroML is using the default Python package manager,
pip install libNeuroML
Installation on Fedora Linux#
sudo dnf install python3-libNeuroML
The core classes in NeuroML are Python representations of the Component Types defined in the NeuroML standard. These can be used to build NeuroML models in Python, and these models can then be exported to the standard XML NeuroML representation. These core classes also contain some utility functions to make it easier for users to carry out common tasks.
Each NeuroML Component Type is represented here as a Python class.
Due to implementation limitations, whereas NeuroML Component Types use lower camel case naming, the Python classes here use upper camel case naming.
So, for example, the
adExIaFCell Component Type in the NeuroML schema becomes the
AdExIaFCell class here, and
expTwoSynapse becomes the
children elements that NeuroML Component Types can have are represented in the Python classes as variables.
The variable names, to distinguish them from class names, use snake case.
So for example, the
cell NeuroML Component Type has a corresponding
Cell Python class here.
biophysicalProperties child Component Type in
cell is represented as the
biophysical_properties list variable in the
Cell Python class.
The class signatures list all the child/children elements and text fields that the corresponding Component Type possesses.
To again use the
Cell class as an example, the construction signature is this:
class neuroml.nml.nml.Cell(neuro_lex_id=None, id=None, metaid=None, notes=None, properties=None, annotation=None, morphology_attr=None, biophysical_properties_attr=None, morphology=None, biophysical_properties=None, extensiontype_=None, **kwargs_)
As can be seen here, it includes both the
morphology child elements as variables.
Please see the examples in the NeuroML documentation to see usage examples of libNeuroML.
Please also note that this module is also included in the top level of the
neuroml package, so you can use these classes by importing neuroml:
from neuroml import AdExIaFCell
For any questions regarding libNeuroML, please open an issue on the GitHub issue tracker here. Any bugs and feature requests can also be filed there.
You can also use any of the communication channels of the NeuroML community.
libNeuroML is developed on GitHub at NeuralEnsemble/libNeuroML under the BSD 3 clause license. The repository contains the complete source code along with instructions on building/installing libNeuroML. Please follow the instructions there to build libNeuroML from source.