GithubHelp home page GithubHelp logo

lems / pylems Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 17.0 1.43 MB

LEMS interpreter implemented in Python

Home Page: https://pylems.readthedocs.io/en/development/

License: GNU Lesser General Public License v3.0

Makefile 0.44% Python 98.69% Shell 0.87%
lems neuroml

pylems's Introduction

LEMS

Java CI with Maven pages-build-deployment

The Low Entropy Model Specification language. This repository contains the Schema for the language, some examples and code for generating the documentation.

LEMS Documentation

See http://lems.github.io/LEMS

For more details on LEMS see:

Robert C. Cannon, Padraig Gleeson, Sharon Crook, Gautham Ganapathy, Boris Marin, Eugenio Piasini and R. Angus Silver, LEMS: A language for expressing complex biological models in concise and hierarchical form and its use in underpinning NeuroML 2, Frontiers in Neuroinformatics 2014, doi: 10.3389/fninf.2014.00079

Java based LEMS interpreter/simulator

jLEMS (see also here).

jLEMS can be used to parse and execute any LEMS model. For an application which adds NeuroML 2 ComponentType definitions and various options for importing & exporting LEMS to other formats, see jNeuroML.

Python based LEMS interpreter/simulator

PyLEMS (see also here).

This code is distributed under the terms of the GNU General Public License v3.

pylems's People

Contributors

borismarin avatar dokato avatar lisphacker avatar pgleeson avatar rgerkin avatar sanjayankur31 avatar wvangeit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pylems's Issues

Add -cp command line option

Add an option to specify a folder with xml files which can be included in the main model file, e.g.

python runlems.py -cp ../NeuroML2/NeuroML2CoreTypes examples/LEMS_NML2_Ex0_IaF.xml

Conversion to NEURON

Is it possible to use pylems to convert NeuroML + LEMS to NEURON for simulation, analogous to a command like jnml some_model.xml -neuron -run in jNeuroML? Will this ever be possible?

Regime transition should call OnEntry of new Regime in the same time step

See:
./pylems ../NeuroML2/NeuroML2CoreTypes/LEMS_NML2_Ex8_AdEx.xml

screenshot from 2013-12-13 18 44 52

The membrane potential should be reset (as defined by OnEntry in the refactory regime) in the same time step as the regime transition is triggered, not in the following time step. V here becomes very large since the memb pot is increasing exponentially

PyPI version 0.4.9.1

@pgleeson Are you able to push the current master branch to PyPI? It would help cleanup some dependencies issues on my side.

Membrane potential not being initialized correctly

I am trying to get to grips with NeuroML2/LEMS, and have run into what seems to be a bug in PyLEMS when running a very simple model of a single compartment neuron with just a passive leak channel.

MyCell.xml: http://pastebin.com/RVNb3m2s
MySim.xml: http://pastebin.com/L2N8A3Ht

No matter what value I specify for initMembPotential, in the results the membrane potential always appears to start at 0mV. I know it's using initMembPotential somehow, because I get an error if I remove it! It's entirely possible I've messed something up in my model files, but I don't think this is the case because it seems to work properly in jLEMS... but maybe jLEMS is just more forgiving.

I'm using the latest version of PyLEMS that I just cloned from GitHub today, Python 2.7.6 on Ubuntu 14.04.

Initial condition output

pylems output data does not show the initial point (0,...) for models where no <OnStart> is defined. Integration works fine, but state output is "advanced" by 1*delta_t.

lems assign

Hi, following an example https://github.com/LEMS/jLEMS/blob/development/src/test/resources/ex-properties.xml I tried to reproduce something similar using pylems, especially that part:

<Structure>
    <MultiInstantiate componentType="spikeGenerator" number="n">
          <Assign property="period" 
                  value="minPeriod + (maxPeriod - minPeriod) * index/n"/>
    </MultiInstantiate>
</Structure>

but I don't see lems.Assign class. Is there any other way to add assignments to MultiInstantiate ?

Running from different directories

It's currently difficult to use runlems.py from a different directory, and also to find included files when you're not in the pylems directory, e.g. should be able to run:

python ~/pylems/runlems.py ~/pylems/examples/example1.xml

from anywhere

This could be solved by looking in sys.path[0] for the xsl folder etc.

Also, for includes, search in the parent folder of the xml file

typing package should not be installed in python 3.5+

According to https://pypi.org/project/typing/#description:

For package maintainers, it is preferred to use typing;python_version<"3.5" if your package requires it to support earlier Python versions. This will avoid shadowing the stdlib typing module when your package is installed via pip install -t . on Python 3.5 or later.

Introduced in 64bf0a7, the typing package shadows the python native typing package present in 3.5+ and can result in AttributeError: type object 'Callable' has no attribute '_abc_registry' errors when installing certain dependency combinations. See python/typing#573

Check error when plotting blocking traces in NMDA example

See: https://github.com/NeuroML/NML2_LEMS_Examples/blob/master/Figure5_NMDA.xml#L111

When this commented out code is added back (and population rampPop is readded), model works in jLEMS:

selection_565

but throws error in pylems:

Traceback (most recent call last):
  File "/home/padraig/pylems/pylems", line 13, in <module>
    main()
  File "/home/padraig/pylems/lems/run.py", line 96, in main
    sim = SimulationBuilder(resolved_model).build()
  File "/home/padraig/pylems/lems/sim/build.py", line 63, in build
    runnable = self.build_runnable(component)
  File "/home/padraig/pylems/lems/sim/build.py", line 179, in build_runnable
    self.process_simulation_specs(component, runnable, component.simulation)
  File "/home/padraig/pylems/lems/sim/build.py", line 627, in process_simulation_specs
    target = self.build_runnable(run.component, runnable, cid)
  File "/home/padraig/pylems/lems/sim/build.py", line 182, in build_runnable
    child_runnable = self.build_runnable(child, runnable)
  File "/home/padraig/pylems/lems/sim/build.py", line 199, in build_runnable
    self.build_structure(component, runnable, component.structure)
  File "/home/padraig/pylems/lems/sim/build.py", line 312, in build_structure
    runnable)
  File "/home/padraig/pylems/lems/sim/build.py", line 191, in build_runnable
    runnable.add_child_to_group(children.name, child_runnable)
  File "/home/padraig/pylems/lems/sim/runnable.py", line 186, in add_child_to_group
    self.__dict__[group_name].append(child)
AttributeError: 'Runnable' object has no attribute 'append'

networks

I noticed that there is no support for adding Networks and Populations. I know that those are not in default LEMS elements, but are commonly used, so it would be convenient to have that possibility.

Incorrect Parsing of 'symbol' and 'description' Attributes in LEMS XML `<Constant>` Elements

Issue Description:

While working with the LEMS XML parsing functionality, I noticed an issue in the parse_constant method of the LEMS file parser in lems/parser/LEMS.py.
Specifically, the symbol attribute within <Constant> elements is not being correctly parsed. Instead, the description attribute from the XML is mistakenly assigned to the symbol attribute in the corresponding Python object. This misassignment leads to incorrect representation of the <Constant> elements and potential loss of model information.

Example of Issue:

In the LEMS XML, a <Constant> element, like

<Constant name="A" symbol="A" value="3.25" dimension="lo=2.6, hi=9.75, step=0.05" description="Maximum amplitude of EPSP mV Also called average synaptic gain "/>

is parsed as follows:

{'name': 'A', 'symbol': 'Maximum amplitude of EPSP mV Also called average synaptic gain ', 'value': '3.25', 'dimension': 'lo=2.6, hi=9.75, step=0.05', 'description': '', 'numeric_value': None}

Proposed Solution:

I have prepared a fix for this issue, which involves correctly parsing the symbol attribute and ensuring it is accurately passed to the Constant constructor. I'll submit a pull request with this fix for further review and integration.

I am looking forward to any feedback or suggestions regarding this issue.
L

Update and move examples to LEMS

What do we need to do with the examples here? Copy them over to LEMS?

I wonder if there is a better way of keeping examples in one place and then referring to this from wherever required, otherwise we're duplicating the same files in multiple repositories and will have to ensure we keep them in sync manually.

Include file using lems.api

Hello,

I would like to ask if there is any possibility to include an external file to my own XML using lems.api model? I mean a line like this:

<Include file="NeuroMLCoreDimensions.xml" />

I tried to use model.include_file but it adds all tags from specified file instead of just its name.

[feature] exporting dom

I have another suggestion, which could be really helpful when working with pylems. I noticed that in some cases I need to join LEMS and NeuroML functionality or sometimes add some external XML tags. So I would be great to have an opportunity to export final model not only to XML file but also as a DOM structure.

It shouldn't be a big deal as in Model.export_to_file parsing to DOM is already done.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.