Skip to content

Commit

Permalink
removed path hardcode from example file
Browse files Browse the repository at this point in the history
  • Loading branch information
shalinshah1993 committed Jun 1, 2018
1 parent 2d0d253 commit 503531b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
25 changes: 13 additions & 12 deletions examples/org/simulator/sedml/SEDMLv2Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import static org.junit.Assert.fail;

import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import org.jfree.ui.RefineryUtilities;
import org.jlibsedml.AbstractTask;
Expand All @@ -16,6 +16,8 @@
import org.simulator.math.odes.MultiTable;
import org.simulator.plot.PlotMultiTable;

import de.binfalse.bflog.LOGGER;

/**
* This test class shows how a SED-ML file can be interpreted and executed using
* SBML Simulator Core solvers. <br/> It makes extensive use of jlibsedml's
Expand All @@ -27,32 +29,31 @@
* @since 1.5
*/
public class SEDMLv2Test {
private static File l1v1Test = new File("files/sedmlTest/ClockSedML.xml");
private static File l1v2Test = new File("files/sedmlTest/l1v2/v3-example1-repeated-steady-scan-oscli.xml");
//private static File l1v2Test = new File("files/sedmlTest/l1v2/v3-example2-oscli-nested-pulse.xml");
//private static File l1v2Test = new File("files/sedmlTest/l1v2/v3-example3-repeated-stochastic-runs.xml");
//private static File l1v2Test = new File("files/sedmlTest/l1v2/v3-example4-repeated-scan-oscli.xml");
//private static File l1v2Test = new File("files/sedmlTest/l1v2/v3-example5-boris-2d-scan.xml");
private static SedML sedml = null;

public static void main(String[] args) throws XMLException {
System.out.println("Reading SEDML document...");
sedml=Libsedml.readDocument(l1v2Test).getSedMLModel();
if(args[0] == null) {
LOGGER.warn("Please give file file name as argument.");
return;
}
File file = new File(args[0]);

sedml=Libsedml.readDocument(file).getSedMLModel();

// in this SED-ML file there's just one output. If there were several,
// we could either iterate or get user to decide what they want to run.
Output wanted = sedml.getOutputs().get(0);
SedMLSBMLSimulatorExecutor exe = new SedMLSBMLSimulatorExecutor(sedml, wanted);
// This gets the raw simulation results - one for each Task that was run.
System.out.println("Collecting tasks...");
Map<AbstractTask, IRawSedmlSimulationResults> res = exe.run();
LOGGER.warn("Collecting tasks...");
Map<AbstractTask, List<IRawSedmlSimulationResults>> res = exe.run();
if (res==null ||res.isEmpty() || !exe.isExecuted()) {
fail ("Simulatation failed: " + exe.getFailureMessages().get(0));
return;
}
// now process.In this case, there's no processing performed - we're displaying the
// raw results.
System.out.println("Outputs wanted: " + wanted);
LOGGER.warn("Outputs wanted: " + wanted);
MultiTable mt = exe.processSimulationResults(wanted, res);

// plot all the reactions species
Expand Down
32 changes: 17 additions & 15 deletions src/org/simulator/sedml/SedMLSBMLSimulatorExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ private double[][] mergeDataCols(double[][] a, double[][] b) {
}

/**
* Merge time coloumns from 2 multiTables
* Merge time columns from 2 multiTables
* @param MultTableSEDMLWrapper
* @param MultTableSEDMLWrapper
* @return double[]
Expand Down Expand Up @@ -565,20 +565,22 @@ AbstractDESSolver getSolverForKisaoID(String id) {
*/
public MultiTable processSimulationResults(Output wanted,
Map<AbstractTask, List<IRawSedmlSimulationResults>> res) {
// here we post-process the results
SedMLResultsProcesser2 pcsr2 = new SedMLResultsProcesser2(sedml, wanted);
pcsr2.process(res);

// this does not necessarily have time as x-axis - another variable could be the
// independent variable.
IProcessedSedMLSimulationResults prRes = pcsr2.getProcessedResult();


// now we restore a MultiTable from the processed results. This basic example assumes a typical
// simulation where time = xaxis - otherwise, if output is a Plot, we would need to analyse the x-axis
// datagenerators
MultiTable mt = createMultiTableFromProcessedResults(wanted, prRes);
return mt;
// // here we post-process the results
// SedMLResultsProcesser2 pcsr2 = new SedMLResultsProcesser2(sedml, wanted);
// pcsr2.process(res);
//
// // this does not necessarily have time as x-axis - another variable could be the
// // independent variable.
// IProcessedSedMLSimulationResults prRes = pcsr2.getProcessedResult();
//
//
// // now we restore a MultiTable from the processed results. This basic example assumes a typical
// // simulation where time = xaxis - otherwise, if output is a Plot, we would need to analyse the x-axis
// // datagenerators
// MultiTable mt = createMultiTableFromProcessedResults(wanted, prRes);
// return mt;
//TODO: Update this method to work with Map containing list of results
return null;
}

// Here we need to check which of the results are the independent axis to create a MultiTable
Expand Down

0 comments on commit 503531b

Please sign in to comment.