Skip to content

Commit

Permalink
Merge pull request #124 from LEMS/development
Browse files Browse the repository at this point in the history
Changes for NeuroML v2.3.1 release
  • Loading branch information
pgleeson authored Aug 20, 2024
2 parents f6c98c2 + 069a8d1 commit 09b25eb
Show file tree
Hide file tree
Showing 31 changed files with 274 additions and 595 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,23 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [ '8', '11', '16', '17', '19' ]
java: [ '8', '11', '16', '17', '19', '21' ]
runs-on: [ubuntu-latest, macos-latest, windows-latest]
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@v2
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.Java }}
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.Java }}
distribution: 'adopt'
distribution: 'temurin'
- name: Test with Maven
run: mvn install
- name: Further tests, non Win
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: nelonoel/[email protected]

# https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions
Expand All @@ -20,7 +20,7 @@ jobs:
id: extract_branch

- name: Checkout lems
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: LEMS/LEMS
ref: ${{ steps.extract_branch.outputs.branch }}
Expand Down
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
<javac srcdir="src"
destdir="build"
debug="true"
source="1.6"
target="1.6"
source="1.8"
target="1.8"
includeantruntime="false"
classpathref="junit.classpath">
<include name="**/*.java"/>
Expand Down
2 changes: 1 addition & 1 deletion lems
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

export LEMS_VERSION=0.10.8
export LEMS_VERSION=0.11.1

export CLASSPATH=.:./target/jlems-$LEMS_VERSION.jar:$LEMS_HOME/target/jlems-$LEMS_VERSION.jar

Expand Down
2 changes: 1 addition & 1 deletion lems.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off

set LEMS_VERSION=0.10.8
set LEMS_VERSION=0.11.1

set CLASSPATH=target\jlems-%LEMS_VERSION%.jar;%LEMS_HOME%\target\jlems-%LEMS_VERSION%.jar

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.lemsml</groupId>
<artifactId>jlems</artifactId>
<version>0.10.8</version>
<version>0.11.1</version>
<packaging>bundle</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -29,8 +29,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
6 changes: 6 additions & 0 deletions src/main/java/org/lemsml/jlems/core/run/StateInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ public void advance(StateRunnable parent, double t, double dt) throws RuntimeErr


public void transitionTo(String rnm) throws RuntimeError {
if (regimeHM == null) {
throw new IllegalStateException("No Regimes.");
}
activeRegime = regimeHM.get(rnm);
activeRegime.enter();
}
Expand All @@ -314,6 +317,9 @@ public void doneInit() {

public void initRegime() throws RuntimeError {
if (activeRegime == null) {
if (regimeHM == null || regimeHM.isEmpty()) {
throw new IllegalStateException("No Regimes.");
}
activeRegime = regimeHM.get(regimeHM.keySet().iterator().next());
// TODO just picks random regime
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ public void checkDimensions(HashMap<String, Dimensional> dimHM) throws ContentEr
if (dres.isDimensionless()) {
// OK
} else {
E.oneLineError("Dimension mismatch in equation: " + variable + " = " + value + ". Residual dimension: " + dres);
E.info("Dimension of " + variable + ": " + dsv + ", multiplier=" + dlf + ", left=" + dl + ", rhs=" + drhs);
E.info("All:" + dimHM);

String errmsg = ("Dimension mismatch in the equation: " + variable + " = " + value + ". Residual dimension: " + dres +
"\nDimension of " + variable + ": " + dsv + ", multiplier=" + dlf + ", left=" + dl + ", rhs=" + drhs +
"\nAll:" + dimHM);
E.info(errmsg);
throw new ContentError(errmsg);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ public Valued getValued(String select) throws ContentError {



public void checkEquations(HashMap<String, Dimensional> cdimHM) throws ContentError {
public void checkEquations(HashMap<String, Dimensional> cdimHM) throws ContentError{

HashMap<String, Dimensional> dimHM = new HashMap<String, Dimensional>();

Expand Down Expand Up @@ -559,15 +559,18 @@ public void checkEquations(HashMap<String, Dimensional> cdimHM) throws ContentEr
try {
dimHM.put(dv.getName(), dv.getDimensionality(dimHM));
} catch (ContentError ce) {
E.error("Checking " + dv + " in " + r_type + " " + ce.getMessage());
String errmsg = ("Checking derived variable: " + dv + " in " + r_type + "\nError here: " + ce.getMessage());
E.error(errmsg+"\n**************\n* Note: this may not be a serious error, in the case that the derived variables are all present, just have been specified out of order, e.g. b = f(a) is defined in the xML file before a is defined. ");

}
}

for (ConditionalDerivedVariable cdv : conditionalDerivedVariables) {
try {
dimHM.put(cdv.getName(), cdv.getDimensionality(dimHM));
} catch (ContentError ce) {
E.error("Checking " + cdv + " in " + r_type + " " + ce.getMessage());
String errmsg = "Checking " + cdv + " in " + r_type + " " + ce.getMessage();
throw new ContentError(errmsg);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/lemsml/jlems/io/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

public final class Main {

public static final String VERSION = "0.10.8";
public static final String VERSION = "0.11.1";

static String usage = "USAGE: java -jar target/jlems-"+VERSION+".jar [-cp folderpaths] model-file [-nogui]\n";

Expand Down
1 change: 1 addition & 0 deletions src/test/java/org/lemsml/jlems/test/ExamplesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public void testExample10() throws ContentError, ConnectionError, RuntimeError,

public boolean executeExample(String filename) throws ContentError, ConnectionError, RuntimeError, ParseError, IOException, ParseException, BuildException, XMLException {
URL url = this.getClass().getResource("/"+filename);
System.out.println(" - Testing: "+url);
File f = new File(url.getFile());

FileInclusionReader fir = new FileInclusionReader(f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void testReadFromString() throws ParseException, BuildException,
File fdir = new File(url.getFile());

for (File fx : fdir.listFiles()) {
E.info("Testing: " + fx);
E.info(" >>> Testing: " + fx);
if (fx.isFile() && fx.getName().endsWith(".xml")) {
String stxt = FileUtil.readStringFromFile(fx);
XMLElementReader xmlReader = new XMLElementReader(stxt);
Expand All @@ -53,7 +53,7 @@ public void testReadFromString() throws ParseException, BuildException,
+ "'<Element a=\"val\"/>' and not '<Element a=\"val\"></Element>'");
}

assertEquals("Rewrite matches", sns.length(), tns.length());
assertEquals("Rewrite matches ("+fx+")", sns.length(), tns.length());
}
}
}
Expand Down
9 changes: 1 addition & 8 deletions src/test/resources/SimpleNetwork.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<Children name="connectivities" type="EventConnectivity"/>
</ComponentType>


<ComponentType name="Population">
<ComponentReference name="component" type="Component"/>
<Parameter name="size" dimension="none"/>
Expand All @@ -13,8 +12,6 @@
</Structure>
</ComponentType>



<ComponentType name="EventConnectivity">
<Link name="source" type="Population"/>
<Link name="target" type="Population"/>
Expand All @@ -23,17 +20,13 @@

<ComponentType name="ConnectionPattern"/>



<ComponentType name="AllAll" extends="ConnectionPattern">
<Structure>
<ForEach instances="../source" as="a">
<ForEach instances="../target" as="b">
<EventConnection from="a" to="b"/>
</ForEach>
</ForEach>
</ForEach>
</Structure>

</ComponentType>

</Lems>
25 changes: 2 additions & 23 deletions src/test/resources/SingleSimulation.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<Lems>


<ComponentType name="Display">
<Text name="title"/>
<Text name="title"/>
<Parameter name="xmin" dimension="none"/>
<Parameter name="xmax" dimension="none"/>
<Parameter name="ymin" dimension="none"/>
<Parameter name="ymax" dimension="none"/>

<Parameter name="timeScale" dimension="time"/>
<Children name="lines" type="Line"/>

<Simulation>
<DataDisplay title="title" dataRegion="xmin,xmax,ymin,ymax"/>
</Simulation>
</ComponentType>


<ComponentType name="Line">
<Parameter name="scale" dimension="*"/>
<Parameter name="timeScale" dimension="*"/>
Expand All @@ -27,49 +22,33 @@
</Simulation>
</ComponentType>


<ComponentType name="OutputFile">
<Text name="path"/>
<Text name="fileName"/>

<Children name="outputColumn" type="OutputColumn"/>

<Simulation>
<DataWriter path="path" fileName="fileName"/>
</Simulation>

</ComponentType>


<ComponentType name="OutputColumn">
<Path name="quantity"/>
<Simulation>
<Record quantity="quantity"/>
</Simulation>
</ComponentType>



<ComponentType name="Simulation">
<Parameter name="length" dimension="time"/>
<Parameter name="step" dimension="time"/>

<ComponentReference name="target" type="Component"/>


<Children name="displays" type="Display"/>

<Children name="outputs" type="OutputFile"/>

<Dynamics>
<StateVariable name="t" dimension="time"/>
</Dynamics>

<Simulation>
<Run component="target" variable="t" increment="step" total="length"/>
</Simulation>
</ComponentType>



</Lems>
</Lems>
3 changes: 1 addition & 2 deletions src/test/resources/elecdims.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
<Dimension name="conductance" m="-1" l="-2" t="3" i="2"/>
<Dimension name="capacitance" m="-1" l="-2" t="4" i="2"/>
<Dimension name="current" i="1"/>

</Lems>
</Lems>
10 changes: 4 additions & 6 deletions src/test/resources/ex2dims.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Lems>

<Lems>
<Dimension name="voltage" m="1" l="2" t="-3" i="-1"/>
<Dimension name="time" t="1"/>
<Dimension name="per_time" t="-1"/>
Expand All @@ -8,8 +7,8 @@
<Dimension name="current" i="1"/>
<Dimension name="temperature" k="1"/>

<Unit symbol="mV" dimension="voltage" power="-3"/>
<Unit symbol="ms" dimension="time" power="-3"/>
<Unit symbol="mV" dimension="voltage" power="-3"/>
<Unit symbol="ms" dimension="time" power="-3"/>
<Unit symbol="pS" dimension="conductance" power="-12"/>
<Unit symbol="nS" dimension="conductance" power="-9"/>
<Unit symbol="uF" dimension="capacitance" power="-6"/>
Expand All @@ -19,5 +18,4 @@
<Unit symbol="pA" dimension="current" power="-12"/>
<Unit symbol="nA" dimension="current" power="-9"/>
<Unit symbol="degC" dimension="temperature" offset="273.15"/>

</Lems>
</Lems>
Loading

0 comments on commit 09b25eb

Please sign in to comment.