-
Notifications
You must be signed in to change notification settings - Fork 6
Backend LEMS
The LEMS backend provides the following services:
- Import/Export LEMS and NeuroML models
- Execute models via jNeuroML
Import/export is available by clicking on icons in the Models tab. The backend automatically chooses between LEMS and NeuroML based on features used in the model. Import/export does not require any external software.
On the other hand, jNeuroML is needed to execute the model with a LEMS interpreter or to translate the model to another simulator such as NEURON. To use it:
- Download the latest version of jnml and set it up following the instructions on the project page.
- Configure N2A by going to the Settings:Backend NeuroML tab and entering the path to jnml.
Because import/export is where all the power of the LEMS/NeuroML backend resides, the rest of this page discusses some of the details from a user perspective. While an exported model will never match its original import exactly, the backend attempts to preserve function and naming of elements. It should be possible to round-trip a model through N2A without losing any information. Some of this information gets stored in $meta tags because it is not directly relevant to N2A. The names and semantics of tags are listed below. You can use them to edit or compose new LEMS models via N2A.
LEMS and N2A are roughly equivalent in expressive power. One major difference is that LEMS resolves names at run time (late binding) while N2A resolves names at compile time (early binding). The backend has difficulty importing models which rely on runtime context to resolve names. It makes a best guess based on known compatible components, but in some cases you may have to correct the import by hand. In those cases, an extra metadata tag is added with a warning message.
N2A does not have a concept of regimes. The backend will create a state variable called "regime", along with constants named after each regime that appears in the LEMS model. The transition conditions are held as equations under "regime". Variables that appear in the various regimes also have conditional equations, where part of each condition is a test whether "regime" equals a particular constant. It is necessary to follow this pattern strictly in order to get an export back to regimes in LEMS. Note that the motivation for regimes in both LEMS and NineML is to reduce computation to only the relevant dynamics, and to create hybrid discrete/dynamical systems. In practice (as evidenced by the LEMS code for the base NeuroML models), regimes play very little role, and in most cases an equally elegant model can be created without them.
N2A does not have a concept of defined interfaces or private variables, so "export" and "requirement" have no meaning. In general, LEMS makes many fine distinctions between roles that models and variables play that simply are not necessary within N2A. Instead, much of that work is accomplished by the compiler with middle-end analysis. During export to LEMS, the backend compiles the model and uses intermediate results to determine which elements/keywords to use.
Metadata entries have the form name=value. In a few cases, tags function as a boolean. Their very presence indicates that a certain condition is true, so no value is necessary. These are pointed out in the associated explanation. The following appear as top-level tags:
- description -- Captures the text of the "description" XML attribute. In some cases, "note" or "notes" will also get exported to "description".
- neuroLexID -- Captures XML attribute of same name in NeuroML files.
- param -- Indicates that this variable is intended to be set by the user.
- species -- Name of ion type, in standard short form (ca, na, k, mg, ...).
The remaining tags appear under "backend.lems".
- annotation -- Captures the NeuroML annotation element.
- attachments -- Captures the LEMS Attachments element. Entries under this node take the form
- name=partName,componentType -- "name" is the XML attribute identifying the attachment collection. "partName" is the N2A part id. "componentType" is the LEMS ComponentType id, only used if the export type is ambiguous.
- min -- Captures the XML "min" attribute.
- max -- Captures the XML "max" attribute.
- name=partName,componentType -- "name" is the XML attribute identifying the attachment collection. "partName" is the N2A part id. "componentType" is the LEMS ComponentType id, only used if the export type is ambiguous.
- children -- Captures the LEMS Children element. Entries under this node take a form similar to attachments.
- dimension -- The dimension of a variable when it is the target of a reduction (ie: has a "select" attribute).
- expose=name -- Flags that this variable should have an associated exposure element. "name" is only specified if different than than variable name.
- extends -- The name of the ComponentType from which this one inherits. Used to resolve ambiguity during export, for reasons similar to the "name" tag below.
- id -- In some cases, the backend folds two LEMS parts together. When this happens, the name of the resulting part can only capture one of the original IDs, so the other one gets stored in metadata.
- id# -- Each segment in a NeuroML morphology section can have its own human-readable name. This captures those values so they can be played back during export. The integer # is the segment id.
- name -- Some N2A parts map to multiple ComponentTypes. When the default export mapping is not suitable, this can be used to override the choice.
- param -- A comma-separate list of LEMS variable names which map to this N2A variable. The first one is the default used for export.
- part -- A comma-separated list of LEMS ComponentTypes which map to this N2A part. The first one is the default used for export.
- port=direction -- Indicates that a variable functions as an event port. Direction can either be "in" or "out".
- regime -- Flags a variable as the regime indicator. Only used when the variable itself can't be called "regime" (because some other variable already used that name).
- reportFile -- Captures attribute of the LEMS Target element.
- required -- Captures the "required" attribute on reductions. N2A notes the reduction in the child part (source of reduced values), while LEMS notes the reduction on the target variable itself.
- requirement -- Captures the content of LEMS Requirement elements. Entries under this node have the form
- N2A_name=LEMS_name (dimension) description
- timesFile -- Captures attribute of the LEMS Target element.