pyLEMS

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.

Quick start

Install Python

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

The easiest way to install the latest version of pyLEMS is using the default Python package manager, pip:

pip install pyLEMS

Installation on Fedora Linux

On Fedora Linux systems, the NeuroFedora community provides pyLEMS in the standard Fedora repos and can be installed using the following commands:

sudo dnf install python3-pyLEMS

Documentation

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 -h flag:

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:

pylems lemsexample.xml

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 -I option. We suggest that you use pyNeuroML where this is not required:

pylems -I <dir of NeuroML2 install>/NeuroML2CoreTypes/  LEMS_NeuroML2_Model.xml

For more information on pyLEMS, please see Vella et al. ([VCC+14]) and Cannon et al. ([CGC+14]).

API documentation

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: gautham@lisphacker.org

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.

Getting help

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.

Development

pyLEMS is developed on GitHub at https://github.com/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.