Skip to content

Commit b43594b

Browse files
authored
Merge pull request #120 from NeuroML/development
Changes for NeuroML v2.3.1 release
2 parents 394dce4 + c527321 commit b43594b

File tree

19 files changed

+362
-162
lines changed

19 files changed

+362
-162
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,19 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
java: [ '8', '11', '16', '17', '19']
20-
runs-on: [ubuntu-latest, macos-latest, windows-2019 ]
19+
java: [ '8', '11', '16', '17', '19', '21' ]
20+
runs-on: [ubuntu-latest, macos-12, windows-2019] # Note macos-12, not latest/14, due to hdf5 install issue
21+
exclude:
22+
- runs-on: macos-latest
23+
java: "8"
24+
- runs-on: macos-latest
25+
java: "16"
2126

2227
name: Test on Java ${{ matrix.Java }} on ${{ matrix.runs-on }}
2328
steps:
24-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
2530
- name: Set up JDK ${{ matrix.Java }}
26-
uses: actions/setup-java@v3
31+
uses: actions/setup-java@v4
2732
with:
2833
java-version: ${{ matrix.Java }}
2934
distribution: 'temurin'

.github/workflows/docs.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717
- uses: nelonoel/[email protected]
1818

1919
- name: Set up JDK 11
20-
uses: actions/setup-java@v3
20+
uses: actions/setup-java@v4
2121
with:
2222
java-version: 11
2323
distribution: 'temurin'
2424
java-package: jdk
2525

2626
- name: Set up Python 3.9
27-
uses: actions/setup-python@v4
27+
uses: actions/setup-python@v5
2828
with:
2929
python-version: 3.9
3030

@@ -34,29 +34,29 @@ jobs:
3434
pip install ghp-import
3535
3636
- name: Checkout NeuroML2
37-
uses: actions/checkout@v3
37+
uses: actions/checkout@v4
3838
with:
3939
repository: NeuroML/NeuroML2
4040
ref: development
4141
path: NeuroML2
4242

4343
- name: Checkout org.lemsml
44-
uses: actions/checkout@v3
44+
uses: actions/checkout@v4
4545
with:
4646
repository: LEMS/jLEMS
4747
ref: development
4848
path: jLEMS
4949

5050

5151
- name: Checkout org.neuroml.model.injectingplugin
52-
uses: actions/checkout@v3
52+
uses: actions/checkout@v4
5353
with:
5454
repository: NeuroML/org.neuroml.model.injectingplugin
5555
ref: development
5656
path: org.neuroml.model.injectingplugin
5757

5858
- name: Checkout org.neuroml.model
59-
uses: actions/checkout@v3
59+
uses: actions/checkout@v4
6060
with:
6161
repository: NeuroML/org.neuroml.model
6262
ref: development

pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>org.neuroml.export</groupId>
55
<artifactId>org.neuroml.export</artifactId>
66
<packaging>bundle</packaging>
7-
<version>1.9.1</version>
7+
<version>1.10.1</version>
88
<name>org.neuroml.export</name>
99
<url>http://maven.apache.org</url>
1010

@@ -18,12 +18,12 @@
1818
<dependency>
1919
<groupId>org.neuroml.model</groupId>
2020
<artifactId>org.neuroml.model</artifactId>
21-
<version>1.9.1</version>
21+
<version>1.10.1</version>
2222
</dependency>
2323
<dependency>
2424
<groupId>org.lemsml</groupId>
2525
<artifactId>jlems</artifactId>
26-
<version>0.10.8</version>
26+
<version>0.11.1</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>org.apache.velocity</groupId>
@@ -49,7 +49,7 @@
4949
&lt;br /&gt;
5050
&lt;br /&gt;
5151
</top>
52-
<bottom>Copyright NeuroML Contributors 2023</bottom>
52+
<bottom>Copyright NeuroML Contributors 2024</bottom>
5353
</configuration>
5454
</plugin>
5555
<plugin>
@@ -91,8 +91,8 @@
9191
<artifactId>maven-compiler-plugin</artifactId>
9292
<version>3.0</version>
9393
<configuration>
94-
<source>1.7</source>
95-
<target>1.7</target>
94+
<source>1.8</source>
95+
<target>1.8</target>
9696
</configuration>
9797
</plugin>
9898
<plugin>

src/main/java/org/lemsml/export/dlems/DLemsKeywords.java

Lines changed: 64 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,79 +2,83 @@
22

33
/**
44
* @author matteocantarelli
5-
*
5+
*
66
*/
77
public enum DLemsKeywords
88
{
9-
DT,
10-
SEED,
11-
REPORT_FILE,
12-
DYNAMICS,
13-
EVENTS,
14-
CONDITION,
15-
DIRECTION,
16-
EFFECT,
17-
NAME,
18-
TYPE,
19-
TITLE,
20-
PARAMETERS,
21-
STATE,
22-
STATE_FUNCTIONS,
23-
T_END,
24-
T_START,
25-
COMMENT,
26-
DUMP_TO_FILE,
27-
OUTPUT_FILE,
28-
SPIKE_FILE,
29-
SPIKE_FILE_FORMAT,
30-
EVENT_SELECTIONS,
31-
EVENT_SELECTION_ID,
32-
SELECT,
33-
EVENT_PORT,
34-
FILE_NAME,
35-
OUTPUT_COLUMNS,
36-
VARIABLE,
37-
QUANTITY,
38-
DISPLAY,
39-
ABSCISSA_AXIS,
40-
MIN, MAX,
41-
ORDINATE_AXIS,
42-
CURVES,
43-
ABSCISSA,
44-
ORDINATE,
45-
POPULATION,
46-
POPULATION_INDEX,
47-
SEGMENT_ID,
48-
SEGMENT_NAME,
49-
FRACTION_ALONG,
50-
COLOUR,
51-
POPULATIONS,
52-
SIZE,
9+
DT,
10+
SEED,
11+
REPORT_FILE,
12+
DYNAMICS,
13+
EVENTS,
14+
CONDITION,
15+
DIRECTION,
16+
EFFECT,
17+
NAME,
18+
TYPE,
19+
TITLE,
20+
PARAMETERS,
21+
STATE,
22+
STATE_FUNCTIONS,
23+
T_END,
24+
T_START,
25+
COMMENT,
26+
DUMP_TO_FILE,
27+
OUTPUT_FILE,
28+
SPIKE_FILE,
29+
SPIKE_FILE_FORMAT,
30+
EVENT_SELECTIONS,
31+
EVENT_SELECTION_ID,
32+
SELECT,
33+
EVENT_PORT,
34+
FILE_NAME,
35+
OUTPUT_COLUMNS,
36+
VARIABLE,
37+
QUANTITY,
38+
DISPLAY,
39+
ABSCISSA_AXIS,
40+
MIN, MAX,
41+
ORDINATE_AXIS,
42+
CURVES,
43+
ABSCISSA,
44+
ORDINATE,
45+
POPULATION,
46+
POPULATION_INDEX,
47+
SEGMENT_ID,
48+
SEGMENT_NAME,
49+
FRACTION_ALONG,
50+
COLOUR,
51+
POPULATIONS,
52+
SIZE,
5353
SYNAPSES,
5454
SYNAPSE,
5555
COMPONENT,
56-
PROJECTIONS,
57-
PRE_POPULATION,
58-
POST_POPULATION,
56+
PROJECTIONS,
57+
PRE_POPULATION,
58+
POST_POPULATION,
5959
CONNECTIONS,
60-
PRE_CELL_ID,
61-
POST_CELL_ID,
62-
WEIGHT,
63-
DELAY,
60+
PRE_CELL_ID,
61+
POST_CELL_ID,
62+
WEIGHT,
63+
DELAY,
6464
INPUTS,
65-
66-
65+
66+
6767
TEMPERATURE,
6868
NEURON_VARIABLE_NAME,
6969
NEURON_MECHANISM_NAME,
7070
NEURON_SECTION_NAME,
7171
NEURON_FRACT_ALONG,
7272
NEURON_VARIABLE_SCALE,
73-
74-
EXPORT_LIBRARY_VERSION;
7573

76-
public String get()
77-
{
78-
return this.toString().toLowerCase();
79-
}
74+
EXPORT_LIBRARY_VERSION,
75+
76+
CVODE,
77+
ABS_TOL,
78+
REL_TOL;
79+
80+
public String get()
81+
{
82+
return this.toString().toLowerCase();
83+
}
8084
}

src/main/java/org/lemsml/export/dlems/DLemsWriter.java

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
import org.lemsml.jlems.core.type.Dimension;
3232
import org.lemsml.jlems.core.type.FinalParam;
3333
import org.lemsml.jlems.core.type.Lems;
34+
import org.lemsml.jlems.core.type.LemsCollection;
3435
import org.lemsml.jlems.core.type.ParamValue;
36+
import org.lemsml.jlems.core.type.Meta;
3537
import org.lemsml.jlems.core.type.Target;
3638
import org.lemsml.jlems.core.type.dynamics.DerivedVariable;
3739
import org.lemsml.jlems.core.type.dynamics.IVisitable;
@@ -203,6 +205,38 @@ public String getMainScript() throws LEMSException, IOException
203205

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

208+
boolean nrn_cvode = false;
209+
/* defaults from NEURON */
210+
String abs_tol = "None";
211+
String rel_tol = "None";
212+
LemsCollection<Meta> metas = simCpt.metas;
213+
for(Meta m : metas)
214+
{
215+
HashMap<String, String> attributes = m.getAttributes();
216+
if (attributes.getOrDefault("for", "").equals("neuron"))
217+
{
218+
if (attributes.getOrDefault("method", "").equals("cvode"))
219+
{
220+
nrn_cvode = true;
221+
abs_tol = attributes.getOrDefault("abs_tolerance", abs_tol);
222+
rel_tol = attributes.getOrDefault("rel_tolerance", rel_tol);
223+
E.info("CVode with abs_tol="+abs_tol+" , rel_tol="+rel_tol+" selected for NEURON simulation");
224+
}
225+
}
226+
227+
}
228+
if (nrn_cvode == true)
229+
{
230+
g.writeStringField(DLemsKeywords.CVODE.get(), "true");
231+
}
232+
else
233+
{
234+
g.writeStringField(DLemsKeywords.CVODE.get(), "false");
235+
}
236+
/* set them to something even if not provided by user */
237+
g.writeStringField(DLemsKeywords.ABS_TOL.get(), abs_tol);
238+
g.writeStringField(DLemsKeywords.REL_TOL.get(), rel_tol);
239+
206240
int seed = DEFAULT_SEED;
207241
if (simCpt.hasStringValue("seed"))
208242
seed = Integer.parseInt(simCpt.getStringValue("seed"));
@@ -639,16 +673,29 @@ private void writeDLemsForComponent(JsonGenerator g, Component comp, HashMap<Str
639673
g.writeObjectFieldStart(DLemsKeywords.PARAMETERS.get());
640674
writeParameters(g, comp);
641675
g.writeEndObject();
676+
677+
Component bpComp = comp.quietGetChild("biophysicalProperties");
678+
if (bpComp==null)
679+
{
680+
try{
681+
Cell cell = (Cell)Utils.convertLemsComponentToNeuroML(comp, true, lems).get(comp.getID());
682+
bpComp = lems.getComponent(cell.getBiophysicalProperties().getId());
683+
}
684+
catch (NeuroMLException ne)
685+
{
686+
throw new ContentError("Unable to parse cell's biophysicalProperties", ne);
687+
}
688+
}
642689

643-
for (Component specie: comp.getChild("biophysicalProperties").getChild("intracellularProperties").getChildrenAL("speciesList")) {
690+
for (Component specie: bpComp.getChild("intracellularProperties").getChildrenAL("speciesList")) {
644691

645692
try{
646693
g.writeStringField(specie.getID()+"_initial_internal_conc", ""+Utils.getMagnitudeInSI(specie.getAttributeValue("initialConcentration")));
647694
g.writeStringField(specie.getID()+"_initial_external_conc", ""+Utils.getMagnitudeInSI(specie.getAttributeValue("initialExtConcentration")));
648695
}
649696
catch (NeuroMLException ne)
650697
{
651-
throw new ContentError("Unabel to parse NeuroML", ne);
698+
throw new ContentError("Unable to parse NeuroML", ne);
652699
}
653700
}
654701

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

861908
if(!cachedNrnSecNames.get(comp.getID()).containsKey(segId))
862909
{
863-
Cell cell = (Cell)Utils.convertLemsComponentToNeuroML(comp).get(comp.getID());
910+
Cell cell = (Cell)Utils.convertLemsComponentToNeuroML(comp, true, lems).get(comp.getID());
864911

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

901948
if (comp.getComponentType().isOrExtends("cell")) {
902-
for (Component seg: comp.getChild("morphology").getChildrenAL("segments")) {
949+
Component morphComp = comp.quietGetChild("morphology");
950+
951+
if (morphComp==null) {
952+
morphComp=lems.getComponent(comp.getTextParam("morphology"));
953+
}
954+
955+
956+
for (Component seg: morphComp.getChildrenAL("segments")) {
903957
if (seg.id.equals(lqp.getSegmentId()+"")) {
904958
g.writeStringField(DLemsKeywords.SEGMENT_ID.get(), lqp.getSegmentId()+"");
905959
g.writeStringField(DLemsKeywords.SEGMENT_NAME.get(), seg.getName());

0 commit comments

Comments
 (0)