Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for NeuroML v2.3.1 release #120

Merged
merged 31 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c2f1276
To v1.10.0
pgleeson Sep 22, 2023
b8713b4
feat(nrnwriter): also handle ChannelDensityNonUniformNernst
sanjayankur31 Dec 20, 2023
6e409b5
Merge pull request #109 from NeuroML/feat/channeldensitynonuniformnernst
pgleeson Dec 21, 2023
2f2e2a7
Add functionality to save file outputs of sed-ml
pgleeson Feb 12, 2024
f6ad0c8
Generates valid sed-ml
pgleeson Feb 12, 2024
728c83f
Merge pull request #111 from NeuroML/experimental
pgleeson Feb 13, 2024
fe6009b
feat(dlems-keywords): add cvode related keywords
sanjayankur31 Feb 15, 2024
2aa6950
feat(netpyne-template): update to include cvode bits
sanjayankur31 Feb 15, 2024
d5b2eb9
feat(dlems-writer): add bits for handling cvode in NEURON
sanjayankur31 Feb 15, 2024
dacf1f3
fix(netpyne): improve logic for cvode in generated script
sanjayankur31 Feb 15, 2024
aa62f9b
Merge pull request #112 from NeuroML/feat/netpyne-cvode
pgleeson Feb 22, 2024
1e3948d
fix(sedml): sanitise report id in sedml export
sanjayankur31 Apr 18, 2024
d5aaa32
fix(sedml): make variable ids unique for data generators
sanjayankur31 Apr 18, 2024
f8a601f
fix(sedml): also make data set ids in reports unique
sanjayankur31 Apr 18, 2024
ce395cf
fix(sedml): also make time id unique
sanjayankur31 Apr 18, 2024
62cfdc8
Merge pull request #115 from NeuroML/feat/sed-ml-id-fix
pgleeson Apr 18, 2024
e6ef4de
Test on java 21
pgleeson May 1, 2024
2d0159a
Just test on macos-12 for now...
pgleeson May 1, 2024
faf1311
Back to windows-2019
pgleeson May 1, 2024
9accde5
Merge pull request #116 from NeuroML/experimental
pgleeson May 1, 2024
528e08a
Fixes to Neuron and Netpyne to handle case where cell has external mo…
pgleeson May 31, 2024
a335c3c
Added check EXT_MORPH_BIOPHYS_CELL_MODEL, just passing on Neuron & Netne
pgleeson Jun 4, 2024
c4d3ae9
Eden supports external morphology/bioPhys
pgleeson Jun 11, 2024
7f7590e
To v1.10.1
pgleeson Jun 11, 2024
11aabc9
Bump year in docs
pgleeson Jun 11, 2024
c0fe053
Merge pull request #117 from NeuroML/experimental
pgleeson Jun 11, 2024
e6981bf
Check if cell is CELL_2CA_POOLS_COMP_TYPE
pgleeson Jun 13, 2024
de789e6
Merge pull request #118 from NeuroML/experimental
pgleeson Jun 18, 2024
bf3a099
Add location of neuron when pip installed on Binder
pgleeson Jul 4, 2024
ae0ef92
Add more info on namespaces in SED-ML export
pgleeson Jul 31, 2024
c527321
Merge pull request #119 from NeuroML/experimental
pgleeson Jul 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [ '8', '11', '16', '17', '19']
runs-on: [ubuntu-latest, macos-latest, windows-2019 ]
java: [ '8', '11', '16', '17', '19', '21' ]
runs-on: [ubuntu-latest, macos-12, windows-2019] # Note macos-12, not latest/14, due to hdf5 install issue
exclude:
- runs-on: macos-latest
java: "8"
- runs-on: macos-latest
java: "16"

name: Test on Java ${{ matrix.Java }} on ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.Java }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.Java }}
distribution: 'temurin'
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: nelonoel/branch-name@v1.0.1

- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
java-package: jdk

- name: Set up Python 3.9
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9

Expand All @@ -34,29 +34,29 @@ jobs:
pip install ghp-import

- name: Checkout NeuroML2
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: NeuroML/NeuroML2
ref: development
path: NeuroML2

- name: Checkout org.lemsml
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: LEMS/jLEMS
ref: development
path: jLEMS


- name: Checkout org.neuroml.model.injectingplugin
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: NeuroML/org.neuroml.model.injectingplugin
ref: development
path: org.neuroml.model.injectingplugin

- name: Checkout org.neuroml.model
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: NeuroML/org.neuroml.model
ref: development
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>org.neuroml.export</groupId>
<artifactId>org.neuroml.export</artifactId>
<packaging>bundle</packaging>
<version>1.9.1</version>
<version>1.10.1</version>
<name>org.neuroml.export</name>
<url>http://maven.apache.org</url>

Expand All @@ -18,12 +18,12 @@
<dependency>
<groupId>org.neuroml.model</groupId>
<artifactId>org.neuroml.model</artifactId>
<version>1.9.1</version>
<version>1.10.1</version>
</dependency>
<dependency>
<groupId>org.lemsml</groupId>
<artifactId>jlems</artifactId>
<version>0.10.8</version>
<version>0.11.1</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
Expand All @@ -49,7 +49,7 @@
&lt;br /&gt;
&lt;br /&gt;
</top>
<bottom>Copyright NeuroML Contributors 2023</bottom>
<bottom>Copyright NeuroML Contributors 2024</bottom>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -91,8 +91,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand Down
124 changes: 64 additions & 60 deletions src/main/java/org/lemsml/export/dlems/DLemsKeywords.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,83 @@

/**
* @author matteocantarelli
*
*
*/
public enum DLemsKeywords
{
DT,
SEED,
REPORT_FILE,
DYNAMICS,
EVENTS,
CONDITION,
DIRECTION,
EFFECT,
NAME,
TYPE,
TITLE,
PARAMETERS,
STATE,
STATE_FUNCTIONS,
T_END,
T_START,
COMMENT,
DUMP_TO_FILE,
OUTPUT_FILE,
SPIKE_FILE,
SPIKE_FILE_FORMAT,
EVENT_SELECTIONS,
EVENT_SELECTION_ID,
SELECT,
EVENT_PORT,
FILE_NAME,
OUTPUT_COLUMNS,
VARIABLE,
QUANTITY,
DISPLAY,
ABSCISSA_AXIS,
MIN, MAX,
ORDINATE_AXIS,
CURVES,
ABSCISSA,
ORDINATE,
POPULATION,
POPULATION_INDEX,
SEGMENT_ID,
SEGMENT_NAME,
FRACTION_ALONG,
COLOUR,
POPULATIONS,
SIZE,
DT,
SEED,
REPORT_FILE,
DYNAMICS,
EVENTS,
CONDITION,
DIRECTION,
EFFECT,
NAME,
TYPE,
TITLE,
PARAMETERS,
STATE,
STATE_FUNCTIONS,
T_END,
T_START,
COMMENT,
DUMP_TO_FILE,
OUTPUT_FILE,
SPIKE_FILE,
SPIKE_FILE_FORMAT,
EVENT_SELECTIONS,
EVENT_SELECTION_ID,
SELECT,
EVENT_PORT,
FILE_NAME,
OUTPUT_COLUMNS,
VARIABLE,
QUANTITY,
DISPLAY,
ABSCISSA_AXIS,
MIN, MAX,
ORDINATE_AXIS,
CURVES,
ABSCISSA,
ORDINATE,
POPULATION,
POPULATION_INDEX,
SEGMENT_ID,
SEGMENT_NAME,
FRACTION_ALONG,
COLOUR,
POPULATIONS,
SIZE,
SYNAPSES,
SYNAPSE,
COMPONENT,
PROJECTIONS,
PRE_POPULATION,
POST_POPULATION,
PROJECTIONS,
PRE_POPULATION,
POST_POPULATION,
CONNECTIONS,
PRE_CELL_ID,
POST_CELL_ID,
WEIGHT,
DELAY,
PRE_CELL_ID,
POST_CELL_ID,
WEIGHT,
DELAY,
INPUTS,


TEMPERATURE,
NEURON_VARIABLE_NAME,
NEURON_MECHANISM_NAME,
NEURON_SECTION_NAME,
NEURON_FRACT_ALONG,
NEURON_VARIABLE_SCALE,

EXPORT_LIBRARY_VERSION;

public String get()
{
return this.toString().toLowerCase();
}
EXPORT_LIBRARY_VERSION,

CVODE,
ABS_TOL,
REL_TOL;

public String get()
{
return this.toString().toLowerCase();
}
}
62 changes: 58 additions & 4 deletions src/main/java/org/lemsml/export/dlems/DLemsWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
import org.lemsml.jlems.core.type.Dimension;
import org.lemsml.jlems.core.type.FinalParam;
import org.lemsml.jlems.core.type.Lems;
import org.lemsml.jlems.core.type.LemsCollection;
import org.lemsml.jlems.core.type.ParamValue;
import org.lemsml.jlems.core.type.Meta;
import org.lemsml.jlems.core.type.Target;
import org.lemsml.jlems.core.type.dynamics.DerivedVariable;
import org.lemsml.jlems.core.type.dynamics.IVisitable;
Expand Down Expand Up @@ -203,6 +205,38 @@ public String getMainScript() throws LEMSException, IOException

g.writeStringField(DLemsKeywords.DT.get(), convertTime(simCpt.getParamValue("step")));

boolean nrn_cvode = false;
/* defaults from NEURON */
String abs_tol = "None";
String rel_tol = "None";
LemsCollection<Meta> metas = simCpt.metas;
for(Meta m : metas)
{
HashMap<String, String> attributes = m.getAttributes();
if (attributes.getOrDefault("for", "").equals("neuron"))
{
if (attributes.getOrDefault("method", "").equals("cvode"))
{
nrn_cvode = true;
abs_tol = attributes.getOrDefault("abs_tolerance", abs_tol);
rel_tol = attributes.getOrDefault("rel_tolerance", rel_tol);
E.info("CVode with abs_tol="+abs_tol+" , rel_tol="+rel_tol+" selected for NEURON simulation");
}
}

}
if (nrn_cvode == true)
{
g.writeStringField(DLemsKeywords.CVODE.get(), "true");
}
else
{
g.writeStringField(DLemsKeywords.CVODE.get(), "false");
}
/* set them to something even if not provided by user */
g.writeStringField(DLemsKeywords.ABS_TOL.get(), abs_tol);
g.writeStringField(DLemsKeywords.REL_TOL.get(), rel_tol);

int seed = DEFAULT_SEED;
if (simCpt.hasStringValue("seed"))
seed = Integer.parseInt(simCpt.getStringValue("seed"));
Expand Down Expand Up @@ -639,16 +673,29 @@ private void writeDLemsForComponent(JsonGenerator g, Component comp, HashMap<Str
g.writeObjectFieldStart(DLemsKeywords.PARAMETERS.get());
writeParameters(g, comp);
g.writeEndObject();

Component bpComp = comp.quietGetChild("biophysicalProperties");
if (bpComp==null)
{
try{
Cell cell = (Cell)Utils.convertLemsComponentToNeuroML(comp, true, lems).get(comp.getID());
bpComp = lems.getComponent(cell.getBiophysicalProperties().getId());
}
catch (NeuroMLException ne)
{
throw new ContentError("Unable to parse cell's biophysicalProperties", ne);
}
}

for (Component specie: comp.getChild("biophysicalProperties").getChild("intracellularProperties").getChildrenAL("speciesList")) {
for (Component specie: bpComp.getChild("intracellularProperties").getChildrenAL("speciesList")) {

try{
g.writeStringField(specie.getID()+"_initial_internal_conc", ""+Utils.getMagnitudeInSI(specie.getAttributeValue("initialConcentration")));
g.writeStringField(specie.getID()+"_initial_external_conc", ""+Utils.getMagnitudeInSI(specie.getAttributeValue("initialExtConcentration")));
}
catch (NeuroMLException ne)
{
throw new ContentError("Unabel to parse NeuroML", ne);
throw new ContentError("Unable to parse NeuroML", ne);
}
}

Expand Down Expand Up @@ -860,7 +907,7 @@ private void addNrnSecNameFract(Component comp, int segId, JsonGenerator g) thro

if(!cachedNrnSecNames.get(comp.getID()).containsKey(segId))
{
Cell cell = (Cell)Utils.convertLemsComponentToNeuroML(comp).get(comp.getID());
Cell cell = (Cell)Utils.convertLemsComponentToNeuroML(comp, true, lems).get(comp.getID());

NamingHelper nh = new NamingHelper(cell);
Segment segment = CellUtils.getSegmentWithId(cell, segId);
Expand Down Expand Up @@ -899,7 +946,14 @@ private void extractQuantityInfo(String quantity, JsonGenerator g) throws IOExce
Component comp = popIdsVsComponents.get(lqp.getPopulation());

if (comp.getComponentType().isOrExtends("cell")) {
for (Component seg: comp.getChild("morphology").getChildrenAL("segments")) {
Component morphComp = comp.quietGetChild("morphology");

if (morphComp==null) {
morphComp=lems.getComponent(comp.getTextParam("morphology"));
}


for (Component seg: morphComp.getChildrenAL("segments")) {
if (seg.id.equals(lqp.getSegmentId()+"")) {
g.writeStringField(DLemsKeywords.SEGMENT_ID.get(), lqp.getSegmentId()+"");
g.writeStringField(DLemsKeywords.SEGMENT_NAME.get(), seg.getName());
Expand Down
Loading
Loading