Skip to content

Commit

Permalink
Fix for broken ant file when using no IDE like Netbeans, minor adjust…
Browse files Browse the repository at this point in the history
…ment for cell type stuff in Backend and some help text for SimpleCLI added.
  • Loading branch information
stephanmg committed Nov 5, 2015
1 parent b90c989 commit 92a5812
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
12 changes: 10 additions & 2 deletions NeuGen/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

<!-- variables -->
<property name="lib.dir" value="libs/" />
<property name="build.dir" value="build/" />
<property name="dist.lib.dir" value="dist/"/>
<property name="mainclass" value="org.neugen.gui.NeuGenApp"/>
<property name="release.version" value="2.0"/>
Expand Down Expand Up @@ -64,7 +65,14 @@
test-report: JUnit report generation
-->

<!-- copy all dependencies in one jar (TODO add release target=win, mac or linux) -->
<!-- ensure that the dist/lib, dist and build dirs are available when not using an IDE -->
<target name="-pre-compile">
<mkdir dir="${dist.lib.dir}" />
<mkdir dir="${dist.lib.dir}/lib" />
<mkdir dir="${build.dir}" />
</target>

<!-- copy all dependencies in one jar (@todo: add release target=win, mac or linux) -->
<target name="copy-dependencies">
<mkdir dir="${dist.lib.dir}" />
<jar jarfile="${dist.lib.dir}/dependencies-all.jar">
Expand Down Expand Up @@ -105,7 +113,7 @@
classname="com.oracle.appbundler.AppBundlerTask"
classpath="libs/appbundler-1.0.jar" />

<!-- TODO: probably we should use $JAVA_HOME below, not hardcoded path! -->
<!-- @todo: probably we should use $JAVA_HOME below, not hardcoded path! -->
<property environment="env" />

<target name="bundle-NeuGen">
Expand Down
7 changes: 4 additions & 3 deletions NeuGen/src/org/neugen/backend/NGBackend.java
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,9 @@ public void save_and_close_project(Map<String, XMLObject> paramTrees, String pro
*
* @param type
* @param file
* @param withCellType
*/
public void export_network(String type, String file) {
public void export_network(String type, String file, boolean withCellType) {
Net net = ngLib.getNet();
if ("NGX".equalsIgnoreCase(type)) {
logger.info("Exporting NGX data to... " + file);
Expand All @@ -466,7 +467,7 @@ public void export_network(String type, String file) {
TXTWriter txtWriter = new TXTWriter(net, new File(file));
txtWriter.setCompressed(false);
txtWriter.setUncompressed(true);
txtWriter.setWithCellType(true);
txtWriter.setWithCellType(withCellType);
txtWriter.exportNetToTXT();
} else {
logger.info("Unsupported exporter chosen.");
Expand Down Expand Up @@ -778,7 +779,7 @@ public static void main(String... args) {
Map<String, XMLObject> params = back.create_and_open_project("foo24", NeuGenConstants.NEOCORTEX_PROJECT, true, false);
back.modifyNPartsDensity(params, "foo24/Neocortex", 0.1);
back.generate_network(NeuGenConstants.NEOCORTEX_PROJECT);
back.export_network("NGX", "foo24.ngx");
back.export_network("NGX", "foo24.ngx", false);
back.save_and_close_project(params, "foo26");
} catch (Exception e) {
logger.fatal("Make sure you selected a valid project directory: " + e);
Expand Down
23 changes: 18 additions & 5 deletions NeuGen/src/org/neugen/backend/main/SimpleCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public static void main(String... args) {
/// flags
boolean open_only = false;
boolean force = false;
boolean with_cell_type = false;
if (args.length == 5) {
if ("OPEN".equalsIgnoreCase(args[4])) { open_only = true; }
}
Expand All @@ -83,6 +84,12 @@ public static void main(String... args) {
if ("FORCE".equalsIgnoreCase(args[5]) || ! args[5].isEmpty()) { force = true; }
}

if (args.length == 7) {
if ("TRUE".equalsIgnoreCase(args[6])) {
with_cell_type = true;
}
}

try {
final NGBackend backend = new NGBackend();
backend.create_and_open_project(project_base_dir, NeuGenConstants.NEOCORTEX_PROJECT, force, open_only);
Expand All @@ -93,7 +100,7 @@ public static void main(String... args) {
}

backend.generate_network(project_type);
backend.export_network(export_format, output_name);
backend.export_network(export_format, output_name, with_cell_type);
} catch (Exception e) {
logger.fatal(e);
e.printStackTrace();
Expand All @@ -105,9 +112,15 @@ public static void main(String... args) {
* @brief prints usage for the simple CLI
*/
private static void usage() {
System.out.println("Usage: SimpleCLI PROJECT_BASE_DIR PROJECT_TYPE EXPORT_FORMAT OUTPUT_NAME [OPEN_OR_CREATE] [FORCE]");
System.out.println("Project type either Neocortex or Hippocampus");
System.out.println("Export format: TXT, HOC or NGX");
System.out.println("Note: Only the first four parameters are mandatory.");
System.out.println("Usage: SimpleCLI PROJECT_BASE_DIR PROJECT_TYPE EXPORT_FORMAT OUTPUT_NAME [OPEN_OR_CREATE] [FORCE] [WITH_CELL_TYPE]");
System.out.println("\tProject base dir on your FS where the project is located");
System.out.println("\tProject type either Neocortex or Hippocampus");
System.out.println("\tExport format: TXT, HOC or NGX");
System.out.println("\tOutput name on your FS for the exported network given your format");
System.out.println("\tOpen or create: Depending on your choise you can start with a new project or a existing project (specifeid by project base dir). Default OPEN.");
System.out.println("\tForce: If CREATE was chosen previously, specify also FORCE to override if you specify an existing project location. Default. FALSE");
System.out.println("\tWith cell type: True or False, depending if we want the cell type to be encoded");
System.out.println("\tNote: Only the first four parameters are mandatory.");
System.out.println("In case of any questions contact: [email protected]");
}
}

0 comments on commit 92a5812

Please sign in to comment.