diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12e75b2..9d134e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,8 @@ jobs: strategy: fail-fast: false matrix: - java: [ '8', '11', '16', '17' ] - runs-on: [ubuntu-latest, macos-11, windows-2019 ] + java: [ '8', '11', '16', '17', '19'] + runs-on: [ubuntu-latest, macos-latest, windows-2019 ] name: Test on Java ${{ matrix.Java }} on ${{ matrix.runs-on }} steps: @@ -68,10 +68,12 @@ jobs: ./jnml ../NeuroML2/LEMSexamples/LEMS_NML2_Ex9_FN.xml -cvode ./jnml ../NeuroML2/LEMSexamples/LEMS_NML2_Ex9_FN.xml -matlab ./jnml ../NeuroML2/LEMSexamples/LEMS_NML2_Ex9_FN.xml -dlems + ./jnml ../NeuroML2/LEMSexamples/LEMS_NML2_Ex9_FN.xml -eden ./jnml ../NeuroML2/LEMSexamples/regression-tests/LEMS_NML2_Ex5_DetCell_unformatted.xml -nogui ./jnml ../NeuroML2/examples/NML2_SimpleMorphology.nml -svg ls -alt ../NeuroML2/examples ls -alt ../NeuroML2/LEMSexamples + env - name: Further tests (Win) if: ${{ matrix.runs-on == 'windows-2019' }} @@ -87,5 +89,6 @@ jobs: .\jnml.bat ..\NeuroML2\LEMSexamples\LEMS_NML2_Ex9_FN.xml -cvode .\jnml.bat ..\NeuroML2\LEMSexamples\LEMS_NML2_Ex9_FN.xml -matlab .\jnml.bat ..\NeuroML2\LEMSexamples\LEMS_NML2_Ex9_FN.xml -dlems + .\jnml.bat ..\NeuroML2\LEMSexamples\LEMS_NML2_Ex9_FN.xml -eden .\jnml.bat ..\NeuroML2\LEMSexamples\regression-tests\LEMS_NML2_Ex5_DetCell_unformatted.xml -nogui .\jnml.bat ..\NeuroML2\examples\NML2_SimpleMorphology.nml -svg diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7cbd054..0000000 --- a/.travis.yml +++ /dev/null @@ -1,58 +0,0 @@ -dist: xenial - -language: java - -jdk: - - oraclejdk11 - - - openjdk8 - #- openjdk10 # Some non deterministic recurring error with jdk10... - - openjdk11 - -install: - - export main_repo_branch=$TRAVIS_BRANCH - - echo $main_repo_branch - - if [[ ${main_repo_branch} != "master" && ${main_repo_branch} != "development" && ${main_repo_branch} != "experimental" ]]; then main_repo_branch=development ; fi - - - pwd - - ls -alt - - git branch - - python getNeuroML.py $main_repo_branch # will call mvn install on this & other repos - - mvn dependency:tree - - pwd - -script: - - mkdir results - - # Test validate - - ./jnml -validate ../NeuroML2/examples/NML2_FullNeuroML.nml - - # Test running with jLEMS - - ./jnml ../NeuroML2/LEMSexamples/LEMS_NML2_Ex9_FN.xml -nogui - - ./jnml ../NeuroML2/LEMSexamples/LEMS_NML2_Ex5_DetCell.xml -nogui - - # Test generating NEURON - - ./jnml ../NeuroML2/LEMSexamples/LEMS_NML2_Ex9_FN.xml -neuron - - # Test generating Brian - - ./jnml ../NeuroML2/LEMSexamples/LEMS_NML2_Ex9_FN.xml -brian - - # Test generating SED-ML - - ./jnml ../NeuroML2/LEMSexamples/LEMS_NML2_Ex9_FN.xml -sedml - - # Test generating CVODE - - ./jnml ../NeuroML2/LEMSexamples/LEMS_NML2_Ex9_FN.xml -cvode - - # Test generating MATLAB - - ./jnml ../NeuroML2/LEMSexamples/LEMS_NML2_Ex9_FN.xml -matlab - - # Test generating dLEMS - - ./jnml ../NeuroML2/LEMSexamples/LEMS_NML2_Ex9_FN.xml -dlems - - # Test generating SVG - - ./jnml ../NeuroML2/examples/NML2_SimpleMorphology.nml -svg - - - # Print version info - - ./jnml -v - diff --git a/getNeuroML.py b/getNeuroML.py index fd8b439..eb7b1b8 100644 --- a/getNeuroML.py +++ b/getNeuroML.py @@ -125,7 +125,8 @@ def main(): or ("jNeuroML" in repo) ) - if (repo in java_repos or repo in neuroml2_spec_repo) and runMvnInstall: + if (repo in java_repos or repo in neuroml2_spec_repo) \ + and runMvnInstall: command = "mvn install" print("It's a Java repository, so installing using Maven...") info = execute_command_in_dir(command, local_dir) @@ -162,7 +163,8 @@ def execute_command_in_dir(command, directory, exit_on_fail=True): % (command, directory, os.path.abspath(directory)) ) - p = subprocess.Popen(command, cwd=directory, shell=True, stdout=subprocess.PIPE) + p = subprocess.Popen(command, cwd=directory, shell=True, + stdout=subprocess.PIPE) return_str = p.communicate() if p.returncode != 0: diff --git a/jnml b/jnml index 1e754b9..5a5ae99 100755 --- a/jnml +++ b/jnml @@ -5,7 +5,7 @@ # Type java -X for more info export JNML_MAX_MEMORY=400M -export JNML_VERSION=0.11.1 +export JNML_VERSION=0.12.4 export CLASSPATH=.:./target/jNeuroML-$JNML_VERSION-jar-with-dependencies.jar:$JNML_HOME/target/jNeuroML-$JNML_VERSION-jar-with-dependencies.jar diff --git a/jnml.bat b/jnml.bat index de00f93..2702580 100644 --- a/jnml.bat +++ b/jnml.bat @@ -1,6 +1,6 @@ @echo off -set JNML_VERSION=0.11.1 +set JNML_VERSION=0.12.4 set CLASSPATH=target\jNeuroML-%JNML_VERSION%-jar-with-dependencies.jar;%JNML_HOME%\jNeuroML-%JNML_VERSION%-jar-with-dependencies.jar diff --git a/pom.xml b/pom.xml index b647565..889ee05 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.neuroml jNeuroML - 0.11.1 + 0.12.4 jar jNeuroML @@ -24,12 +24,12 @@ org.neuroml1.model org.neuroml1.model - 1.8.1 + 1.9.1 org.neuroml.import org.neuroml.import - 1.8.1 + 1.9.1 @@ -37,13 +37,11 @@ org.apache.logging.log4j log4j-1.2-api 2.17.1 - test org.apache.logging.log4j log4j-slf4j-impl 2.17.1 - test @@ -61,7 +59,7 @@ <br /> <br /> - Copyright NeuroML Contributors 2021 + Copyright NeuroML Contributors 2023 diff --git a/src/main/java/org/neuroml/JNeuroML.java b/src/main/java/org/neuroml/JNeuroML.java index 7cf726e..d08e543 100644 --- a/src/main/java/org/neuroml/JNeuroML.java +++ b/src/main/java/org/neuroml/JNeuroML.java @@ -32,6 +32,7 @@ import org.neuroml.export.info.InfoWriter; import org.neuroml.export.nest.NestWriter; import org.neuroml.export.moose.MooseWriter; +import org.neuroml.export.eden.EDENWriter; import org.neuroml.export.netpyne.NetPyNEWriter; import org.neuroml.export.neuron.NeuronWriter; import org.neuroml.export.pynn.PyNNWriter; @@ -59,7 +60,7 @@ public class JNeuroML public static final String JNML_SCRIPT = "jnml"; - public static final String JNML_VERSION = "0.11.1"; + public static final String JNML_VERSION = "0.12.4"; public static final String HELP_FLAG = "-help"; public static final String HELP_FLAG_SHORT = "-h"; @@ -113,6 +114,7 @@ public class JNeuroML public static final String RUN_PYNN_NEURON_FLAG = "-run-neuron"; public static final String NETPYNE_EXPORT_FLAG = "-netpyne"; + public static final String NETPYNE_JSON_FLAG = "-json"; public static final String NUMBER_PROCESSORS_FLAG = "-np"; @@ -125,6 +127,8 @@ public class JNeuroML public static final String MOOSE_EXPORT_FLAG = "-moose"; + public static final String EDEN_EXPORT_FLAG = "-eden"; + //public static final String GEPPETTO_EXPORT_FLAG = "-geppetto"; public static final String SBML_IMPORT_FLAG = "-sbml-import"; @@ -139,6 +143,8 @@ public class JNeuroML public static final String PNG_FLAG = "-png"; + public static final String GENERATED_FILE = ">>> JNML generated file: "; + static String usage = "Usage: \n\n" + " " + JNML_SCRIPT + " LEMSFile.xml\n" + " Load LEMSFile.xml using jLEMS, parse it and validate it as LEMS, and execute the model it contains\n\n" @@ -164,6 +170,7 @@ public class JNeuroML + " " + JNML_SCRIPT + " LEMSFile.xml " + NETPYNE_EXPORT_FLAG + "\n" + " Load LEMSFile.xml using jLEMS, and convert it to NetPyNE format\n" + " " + RUN_FLAG + " Compile NMODL files and run the main NEURON Python file\n\n" + + " " + NETPYNE_JSON_FLAG + " Generate network in NetPyNE JSON format\n\n" + " " + JNML_SCRIPT + " LEMSFile.xml " + BRIAN_EXPORT_FLAG + "\n" + " Load LEMSFile.xml using jLEMS, and convert it to Brian v1 format (*EXPERIMENTAL - single components only*)\n\n" @@ -174,6 +181,9 @@ public class JNeuroML + " " + JNML_SCRIPT + " LEMSFile.xml " + MOOSE_EXPORT_FLAG + "\n" + " Load LEMSFile.xml using jLEMS, and convert it to MOOSE format (**EXPERIMENTAL**)\n\n" + + " " + JNML_SCRIPT + " LEMSFile.xml " + EDEN_EXPORT_FLAG + "\n" + + " Generate a Python script for loading LEMSFile.xml in the EDEN simulator\n\n" + + " " + JNML_SCRIPT + " NMLFile.nml " + SVG_FLAG + "\n" + " Load NMLFile.nml and convert cells & networks to SVG image format \n\n" @@ -514,7 +524,11 @@ else if (args[i].equals(OUTPUT_DIR_FLAG)) } else { - nw.generateAndRun(nogui, compile, run, false); + List files = nw.generateAndRun(nogui, compile, run, false); + for(File genFile : files) + { + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); + } } } @@ -527,7 +541,12 @@ else if(args[1].equals(PYNN_EXPORT_FLAG)) boolean runNrn = (args.length==3 && args[2].equals(RUN_PYNN_NEURON_FLAG)); PyNNWriter pw = new PyNNWriter(lems, lemsFile.getParentFile(), nFile); - pw.generateAndRun(false, runNrn); + + List files = pw.generateAndRun(false, runNrn); + for(File genFile : files) + { + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); + } } else if(args[1].equals(NETPYNE_EXPORT_FLAG)) { @@ -535,6 +554,7 @@ else if(args[1].equals(NETPYNE_EXPORT_FLAG)) Lems lems = loadLemsFile(lemsFile, false); boolean nogui = false; boolean run = false; + boolean json = false; File outputDir = lemsFile.getParentFile(); int np = 1; @@ -545,6 +565,8 @@ else if(args[1].equals(NETPYNE_EXPORT_FLAG)) nogui = true; else if (args[i].equals(RUN_FLAG)) run = true; + else if (args[i].equals(NETPYNE_JSON_FLAG)) + json = true; else if (args[i].equals(OUTPUT_DIR_FLAG)) { i = i+1; @@ -570,7 +592,12 @@ else if (args[i].equals(NUMBER_PROCESSORS_FLAG)) String mainFilename = generateFormatFilename(lemsFile, Format.NETPYNE, "_netpyne"); NetPyNEWriter npw = new NetPyNEWriter(lems, outputDir, mainFilename); - npw.generateAndRun(nogui, run, np); + List files = npw.generateAndRun(nogui, run, np, json); + + for(File genFile : files) + { + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); + } } // Two arguments else if(args.length == 2) @@ -636,7 +663,7 @@ else if(args[1].equals(VERTEX_EXPORT_FLAG)) generateFormatFilename(lemsFile, Format.VERTEX, "_run")); for(File genFile : vw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } @@ -649,7 +676,7 @@ else if(args[1].equals(SBML_EXPORT_FLAG)) SBMLWriter sbmlw = new SBMLWriter(lems, lemsFile.getParentFile(), generateFormatFilename(lemsFile, Format.SBML, null)); for(File genFile : sbmlw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } @@ -662,13 +689,13 @@ else if(args[1].equals(SBML_SEDML_EXPORT_FLAG)) SBMLWriter sbmlw = new SBMLWriter(lems, lemsFile.getParentFile(), generateFormatFilename(lemsFile, Format.SBML, null)); for(File genFile : sbmlw.convert()) { - System.out.println("Writing SBML to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } SEDMLWriter sedw = new SEDMLWriter(lems, lemsFile.getParentFile(), generateFormatFilename(lemsFile, Format.SEDML, null), lemsFile.getName(), Format.SBML); for(File genFile : sedw.convert()) { - System.out.println("Writing SED-ML to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } else if(args[1].equals(XPP_EXPORT_FLAG)) @@ -680,7 +707,7 @@ else if(args[1].equals(XPP_EXPORT_FLAG)) XppWriter xppw = new XppWriter(lems, lemsFile.getParentFile(), generateFormatFilename(lemsFile, Format.XPP, null)); for(File genFile : xppw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } @@ -693,7 +720,7 @@ else if(args[1].equals(DNSIM_EXPORT_FLAG)) DNSimWriter dnsimw = new DNSimWriter(lems, lemsFile.getParentFile(), generateFormatFilename(lemsFile, Format.DN_SIM, null)); for(File genFile : dnsimw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } @@ -709,7 +736,7 @@ else if(args[1].equals(NEST_EXPORT_FLAG)) NestWriter nw = new NestWriter(lems, lemsFile.getParentFile(), nFile); for(File genFile : nw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } else if(args[1].equals(MOOSE_EXPORT_FLAG)) @@ -724,7 +751,22 @@ else if(args[1].equals(MOOSE_EXPORT_FLAG)) MooseWriter nw = new MooseWriter(lems, lemsFile.getParentFile(), nFile); for(File genFile : nw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); + } + } + else if(args[1].equals(EDEN_EXPORT_FLAG)) + { + + File lemsFile = (new File(args[0])).getAbsoluteFile(); + Lems lems = loadLemsFile(lemsFile); + + String suffix = "_eden"; + String nFile = generateFormatFilename(lemsFile, Format.EDEN, suffix); + + EDENWriter nw = new EDENWriter(lems, lemsFile, lemsFile.getParentFile(), nFile); + for(File genFile : nw.convert()) + { + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } @@ -759,7 +801,7 @@ else if(args[1].equals(SEDML_EXPORT_FLAG) || args[1].equals(SEDML_EXPORT_FLAG2)) SEDMLWriter sedw = new SEDMLWriter(lems, lemsFile.getParentFile(), generateFormatFilename(lemsFile, Format.SEDML, null), lemsFile.getName(), Format.NEUROML2); for(File genFile : sedw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } @@ -774,7 +816,7 @@ else if(args[1].equals(CELLML_EXPORT_FLAG)) generateFormatFilename(lemsFile, Format.CELLML, null)); for(File genFile : cellmlw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } @@ -789,7 +831,7 @@ else if(args[1].equals(NINEML_EXPORT_FLAG) || args[1].equals(SPINEML_EXPORT_FLAG XineMLWriter xw = new XineMLWriter(lems, v, lemsFile.getParentFile(), lemsFile.getName().replaceAll("." + Format.LEMS.getExtension(), suffix)); for(File genFile : xw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } @@ -807,7 +849,7 @@ else if(args[1].equals(MATLAB_EXPORT_FLAG)/* || args[1].equals(MATLAB_EULER_EXPO MatlabWriter matlabw = new MatlabWriter(lems, lemsFile.getParentFile(), filename); for(File genFile : matlabw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } @@ -822,7 +864,7 @@ else if(args[1].equals(CVODE_EXPORT_FLAG)) cw.setSolver(CWriter.Solver.CVODE); for(File genFile : cw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } @@ -837,7 +879,7 @@ else if(args[1].equals(MODELICA_EXPORT_FLAG)) ModelicaWriter modw = new ModelicaWriter(lems, lemsFile.getParentFile(), mFile); for(File genFile : modw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } @@ -850,7 +892,7 @@ else if(args[1].equals(DLEMS_EXPORT_FLAG)) DLemsWriter dlemsw = new DLemsWriter(lems, lemsFile.getParentFile(), generateFormatFilename(lemsFile, Format.DLEMS, null), null); for(File genFile : dlemsw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } @@ -874,7 +916,7 @@ else if(args[1].equals(BRIAN_EXPORT_FLAG) || args[1].equals(BRIAN2_EXPORT_FLAG)) for(File genFile : bw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } else if(args[1].equals(OLD_GRAPH_FLAG) || args[1].equals(LEMS_GRAPH_FLAG)) @@ -885,7 +927,7 @@ else if(args[1].equals(OLD_GRAPH_FLAG) || args[1].equals(LEMS_GRAPH_FLAG)) GraphWriter gw = new GraphWriter(lems, lemsFile.getParentFile(), generateFormatFilename(lemsFile, Format.GRAPH_VIZ, null)); List outputFiles = gw.convert(); File gvFile = outputFiles.get(0); - System.out.println("Writing to: " + gvFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + gvFile.getAbsolutePath()); String imgFile = gvFile.getAbsolutePath().replace("." + Format.GRAPH_VIZ.getExtension(), "." + Format.PNG.getExtension()); String cmd = "dot -Tpng " + gvFile.getAbsolutePath() + " -o " + imgFile; @@ -939,7 +981,7 @@ else if(args[1].equals(SVG_FLAG)) SVGWriter svgw = new SVGWriter(nmlDocument, nmlFile.getParentFile(), nmlFile.getName().replaceAll("." + Format.NEUROML2.getExtension(), "." + Format.SVG.getExtension())); for(File genFile : svgw.convert()) { - System.out.println("Writing to: " + genFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + genFile.getAbsolutePath()); } } else if(args[1].equals(PNG_FLAG)) @@ -953,7 +995,7 @@ else if(args[1].equals(PNG_FLAG)) SVGWriter svgw = new SVGWriter(nmlDocument, nmlFile.getParentFile(), pngFileName); svgw.convertToPng(pngFile); - System.out.println("Writing to: " + pngFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + pngFile.getAbsolutePath()); } else @@ -982,7 +1024,7 @@ else if(args.length == 3) String val = entry.getValue(); File vwFile = new File(lemsFile.getParentFile(), "/" + key + ".vhdl"); FileUtil.writeStringToFile(val, vwFile); - System.out.println("Writing to: "+vwFile.getAbsolutePath()); + System.out.println(GENERATED_FILE+vwFile.getAbsolutePath()); } /*File vwFile = new File(lemsFile.getParentFile(), "/testbench.vhdl"); @@ -990,7 +1032,7 @@ else if(args.length == 3) System.out.println("Writing to: "+vwFile.getAbsolutePath());*/ File vwFile = new File(lemsFile.getParentFile(), "/testbench.prj"); FileUtil.writeStringToFile(prjScript, vwFile); - System.out.println("Writing to: "+vwFile.getAbsolutePath()); + System.out.println(GENERATED_FILE+vwFile.getAbsolutePath()); } } @@ -1022,7 +1064,7 @@ else if(args.length == 4) File lemsFile = SBMLImporter.convertSBMLToLEMSFile(sbmlFile, duration, dt, true); - System.out.println("Written to: " + lemsFile.getAbsolutePath()); + System.out.println(GENERATED_FILE + lemsFile.getAbsolutePath()); } else