pyLEMS is a Python package which provides an API, as well as a simulator for the LEMS language. It can also be used to run NeuroML2 models.
pyNeuroML builds on pyLEMS and includes additional functions.
Please cite Vella et al. ([VCC+14]) if you use pyLEMS.
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 pyLEMS 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 pyLEMS is using the default Python package manager,
pip install pyLEMS
Installation on Fedora Linux#
sudo dnf install python3-pyLEMS
Detailed API documentation for PyLEMS can be found here.
pyLEMS provides the
pylems command line utility that can be used to simulate LEMS files.
pylems is self documented, and you can learn about its usage using the
pylems -h usage: pylems [-h] [-I <Include directory>] [-nogui] [-dlems] <LEMS file> positional arguments: <LEMS file> LEMS file to be simulated optional arguments: -h, --help show this help message and exit -I <Include directory> Directory to be searched for included files -nogui If this is specified, just parse & simulate the model, but don't show any plots -dlems If this is specified, export the LEMS file as dLEMS (distilled LEMS in JSON format, see https://github.com/borismarin/som-codegen)
To simulate a LEMS file:
Please note that if you are simulating a NeuroML file you will have to also specify the location of the NeuroML 2 LEMS definitions with the
We suggest that you use pyNeuroML where this is not required:
pylems -I <dir of NeuroML2 install>/NeuroML2CoreTypes/ LEMS_NeuroML2_Model.xml
Detailed API documentation for pyNeuroML can be found here.
The pyLEMS API is also self documented.
You can use Python’s in-built documentation viewer
pydoc to view the documentation for any of the package’s modules and their functions:
Help on package lems: NAME lems DESCRIPTION @author: Gautham Ganapathy @organization: LEMS (http://neuroml.org/lems/, https://github.com/organizations/LEMS) @contact: email@example.com PACKAGE CONTENTS api base (package) dlems (package) model (package) parser (package) run sim (package) DATA logger = <Logger LEMS (WARNING)> VERSION 0.5.2 FILE /usr/lib/python3.9/site-packages/lems/__init__.py
Most IDEs are able to show you this information as you use them in your Python scripts.
For any questions regarding pyLEMS, 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.
pyLEMS is developed on GitHub at LEMS/pylems under the LGPL-3.0 license. The repository contains the complete source code along with instructions on building/installing pyLEMS. Please follow the instructions there to build pyLEMS from source.