From cf574907b1dfd7d8290b3573a184403d77e0c6e3 Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Thu, 23 Jan 2025 12:12:17 -0500 Subject: [PATCH 01/14] WIP - possible way to add numTrials --- .../java/cbit/vcell/solver/MathOverrides.java | 37 +++++++++++++++++++ .../solver/VCSimulationDataIdentifier.java | 4 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/vcell-core/src/main/java/cbit/vcell/solver/MathOverrides.java b/vcell-core/src/main/java/cbit/vcell/solver/MathOverrides.java index 1b0c5f8a1d..6c26e5f9e8 100644 --- a/vcell-core/src/main/java/cbit/vcell/solver/MathOverrides.java +++ b/vcell-core/src/main/java/cbit/vcell/solver/MathOverrides.java @@ -74,6 +74,43 @@ public static ScanIndex parameterScanCoordinateToScanIndex(int[] parameterScanCo return new ScanIndex(index); } + public enum DataReduction { + NONE, + OVER_ALL_TRIALS + } + + // TODO: possible way to add generalized numTrials +// public static class DataQuery { +// public final Optional scanIndex; +// public final DataReduction dataReduction; +// public final Optional scanCount; // only needed when multiple trials are present. +// public final Optional trialCount; +// public final Optional jobIndex; // only used without data reduction, referring to a single job index +// +// private DataQuery(ScanIndex scanIndex, DataReduction dataReduction, Optional scanCount, Optional scanCount, Optional jobIndex){ +// this.scanIndex = scanIndex; +// this.dataReduction = dataReduction; +// this.scanCount = scanCount; +// this.jobIndex = jobIndex; +// } +// +// public static DataQuery fromSingleTrial(ScanIndex scanIndex) { +// return new DataQuery(scanIndex, DataReduction.NONE, Optional.empty(), Optional.of(scanIndex.index)); +// } +// public static DataQuery summarizeTrials(ScanIndex scanIndex, int scanCount, int trialCount) { +// return new DataQuery(scanIndex, DataReduction.OVER_ALL_TRIALS, Optional.of(scanCount), Optional.empty()); +// } +// public static DataQuery fromJobIndex(int jobIndex) { +// return new DataQuery(scanIndex, DataReduction.NONE, Optional.empty(), Optional.of(jobIndex)); +// } +// public int getJobIndex() { +// if (jobIndex.isEmpty()) { +// throw new RuntimeException("not a single job index, involves data reduction"); +// } +// return jobIndex.get().intValue(); +// } +// } + public static class ScanIndex implements Serializable { public final static ScanIndex ZERO = new ScanIndex(0); public final int index; diff --git a/vcell-core/src/main/java/cbit/vcell/solver/VCSimulationDataIdentifier.java b/vcell-core/src/main/java/cbit/vcell/solver/VCSimulationDataIdentifier.java index 038c0aa403..b257eb761e 100644 --- a/vcell-core/src/main/java/cbit/vcell/solver/VCSimulationDataIdentifier.java +++ b/vcell-core/src/main/java/cbit/vcell/solver/VCSimulationDataIdentifier.java @@ -25,7 +25,9 @@ public class VCSimulationDataIdentifier private VCSimulationIdentifier vcSimID = null; - private int jobIndex = -1; + private int jobIndex; + // TODO: replace jobIndex with next line (maybe) +// private MathOverrides.DataQuery dataQuery = null; /** * VCSimulationIdentifier constructor comment. From b5a2946ec96a9fd3bda4d29039fdf2134f2b69f2 Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Fri, 24 Jan 2025 15:19:45 -0500 Subject: [PATCH 02/14] WIP - entry point to postprocessing --- .../simulation/SimulationListPanel.java | 1 + .../simulation/SimulationListTableModel.java | 28 +++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationListPanel.java b/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationListPanel.java index 0f6a28c2cf..5615b95e6f 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationListPanel.java +++ b/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationListPanel.java @@ -170,6 +170,7 @@ public void actionPerformed(java.awt.event.ActionEvent e) { }; public void propertyChange(java.beans.PropertyChangeEvent evt) { if (evt.getSource() == fieldSimulationWorkspace && evt.getPropertyName().equals(SimulationWorkspace.PROPERTY_NAME_SIMULATION_STATUS)) { +// System.out.println("SimulationListPanel: status changed: simIndex: " + evt.getNewValue()); refreshButtonsLax(); } if (evt.getSource() instanceof SimulationContext && evt.getPropertyName().equals(GeometryOwner.PROPERTY_NAME_GEOMETRY)) { diff --git a/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationListTableModel.java b/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationListTableModel.java index ced325702b..f11a67c805 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationListTableModel.java +++ b/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationListTableModel.java @@ -14,6 +14,8 @@ import java.util.Comparator; import java.util.List; +import cbit.vcell.mapping.SimulationContext; +import cbit.vcell.solver.*; import org.vcell.util.BeanUtils; import org.vcell.util.document.PropertyConstants; import org.vcell.util.gui.DialogUtils; @@ -25,13 +27,7 @@ import cbit.vcell.client.UserMessage; import cbit.vcell.client.desktop.biomodel.VCellSortTableModel; import cbit.vcell.server.SimulationStatus; -import cbit.vcell.solver.DefaultOutputTimeSpec; -import cbit.vcell.solver.ExplicitOutputTimeSpec; -import cbit.vcell.solver.OutputTimeSpec; -import cbit.vcell.solver.Simulation; -import cbit.vcell.solver.SolverDescription; -import cbit.vcell.solver.SolverTaskDescription; -import cbit.vcell.solver.UniformOutputTimeSpec; + /** * Insert the type's description here. * Creation date: (5/7/2004 4:07:40 PM) @@ -196,8 +192,22 @@ public void propertyChange(java.beans.PropertyChangeEvent evt) { refreshData(); } else if (evt.getPropertyName().equals(SimulationWorkspace.PROPERTY_NAME_SIMULATION_STATUS)) { int simIndex = (Integer)evt.getNewValue(); - simIndex = simIndex % getMaxRowsPerPage(); - fireTableRowsUpdated(simIndex, simIndex); + int row = simIndex % getMaxRowsPerPage(); + Simulation simulation = getValueAt(row); + if (simulation.getSolverTaskDescription().getSolverDescription().isLangevinSolver()) { + SolverTaskDescription std = simulation.getSolverTaskDescription(); + SolverDescription sd = std.getSolverDescription(); + SimulationStatus simulationStatus = getSimulationWorkspace().getSimulationStatus(simulation); + System.out.println("SimulationListTableModel: simIndex: " + simIndex + ", row: " + row); + System.out.println("SimulationListTableModel: status changed: " + simulationStatus.getStatusString()); + SimulationOwner so = getSimulationWorkspace().getSimulationOwner(); + if(so instanceof SimulationContext) { + SimulationContext sc = (SimulationContext)so; + // TODO: get more sim info, trial, scan, etc + // TODO: launch postprocessing thread + } + } + fireTableRowsUpdated(row, row); } } else { if (evt.getSource() instanceof Simulation && evt.getPropertyName().equals(Simulation.PROPERTY_NAME_SOLVER_TASK_DESCRIPTION)) { From 7a40684d982dd5f334ee56f69deb6403fb71a454 Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Mon, 27 Jan 2025 17:04:19 -0500 Subject: [PATCH 03/14] WIP - recovering trials data --- .../cbit/vcell/client/ClientSimManager.java | 50 +++++++++++++++++++ .../simulation/SimulationListTableModel.java | 16 +++--- .../simulation/SimulationWorkspace.java | 9 ++++ 3 files changed, 67 insertions(+), 8 deletions(-) diff --git a/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java b/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java index 9829e14e5c..796b3f1567 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java +++ b/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java @@ -197,6 +197,56 @@ public void showSimulationResults(OutputContext outputContext, Simulation[] simu AsynchClientTask[] taskArray = showSimulationResults0(false, viewerType); ClientTaskDispatcher.dispatch(getDocumentWindowManager().getComponent(), hashTable, taskArray, false, true, null); } +/* + * ------------------------------------------------------------------------------------------------- + TODO: postProcessLangevinResults + */ +public void postProcessLangevinResults(Simulation sim) { + + final String FAILURE_KEY = "FAILURE_KEY"; + final String SIMULATION_KEY = "SIMULATION_KEY"; + Hashtable hashTable = new Hashtable(); + hashTable.put(FAILURE_KEY, false); + hashTable.put(SIMULATION_KEY, sim); + + ArrayList taskList = new ArrayList(); + AsynchClientTask retrieveLangevinResultsTask = new AsynchClientTask("Retrieving results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { + public void run(Hashtable hashTable) throws Exception { + boolean failure = (boolean) hashTable.get(FAILURE_KEY); + SolverTaskDescription std = sim.getSolverTaskDescription(); + int numTrials = std.getNumTrials(); + System.out.println(sim.getName() + ", NumTrials = " + numTrials); +// LangevinSimulationOptions lso = std.getLangevinSimulationOptions(); + final VCSimulationIdentifier vcSimulationIdentifier = sim.getSimulationInfo().getAuthoritativeVCSimulationIdentifier(); + SimulationOwner simOwner = getSimWorkspace().getSimulationOwner(); + Simulation allSims[] = simOwner.getSimulations(); + for (Simulation simCandidate : allSims) { + if (simCandidate.getName().startsWith(sim.getName())) { + System.out.println(" --- " + simCandidate.getName() + ", " + simCandidate.getJobCount()); + } + } + } + }; + AsynchClientTask calculateLangevinAveragesTask = new AsynchClientTask("Retrieving results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { + public void run(Hashtable hashTable) throws Exception { + boolean failure = (boolean)hashTable.get(FAILURE_KEY); + + } + }; + AsynchClientTask calculateLangevinAdvancedStatisticsTask = new AsynchClientTask("Retrieving results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { + public void run(Hashtable hashTable) throws Exception { + boolean failure = (boolean)hashTable.get(FAILURE_KEY); + + } + }; + taskList.add(retrieveLangevinResultsTask); + taskList.add(calculateLangevinAveragesTask); + taskList.add(calculateLangevinAdvancedStatisticsTask); + AsynchClientTask[] taskArray = new AsynchClientTask[taskList.size()]; + taskList.toArray(taskArray); + ClientTaskDispatcher.dispatch(getDocumentWindowManager().getComponent(), hashTable, taskArray, false, true, null); + +} public enum ViewerType { NativeViewer_only diff --git a/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationListTableModel.java b/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationListTableModel.java index f11a67c805..0295169122 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationListTableModel.java +++ b/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationListTableModel.java @@ -13,8 +13,10 @@ import java.util.Arrays; import java.util.Comparator; import java.util.List; +import java.util.Vector; import cbit.vcell.mapping.SimulationContext; +import cbit.vcell.math.MathDescription; import cbit.vcell.solver.*; import org.vcell.util.BeanUtils; import org.vcell.util.document.PropertyConstants; @@ -190,21 +192,19 @@ public void propertyChange(java.beans.PropertyChangeEvent evt) { } } refreshData(); + } else if (evt.getPropertyName().equals(SimulationWorkspace.PROPERTY_NAME_SIMULATION_STATUS)) { int simIndex = (Integer)evt.getNewValue(); int row = simIndex % getMaxRowsPerPage(); Simulation simulation = getValueAt(row); - if (simulation.getSolverTaskDescription().getSolverDescription().isLangevinSolver()) { + if(simulation != null) { SolverTaskDescription std = simulation.getSolverTaskDescription(); SolverDescription sd = std.getSolverDescription(); SimulationStatus simulationStatus = getSimulationWorkspace().getSimulationStatus(simulation); - System.out.println("SimulationListTableModel: simIndex: " + simIndex + ", row: " + row); - System.out.println("SimulationListTableModel: status changed: " + simulationStatus.getStatusString()); - SimulationOwner so = getSimulationWorkspace().getSimulationOwner(); - if(so instanceof SimulationContext) { - SimulationContext sc = (SimulationContext)so; - // TODO: get more sim info, trial, scan, etc - // TODO: launch postprocessing thread + if (sd.isLangevinSolver() && simulationStatus.isCompleted()) { + System.out.println("SimulationListTableModel: simIndex: " + simIndex + ", row: " + row); + System.out.println("SimulationListTableModel: status changed: " + simulationStatus.getStatusString()); + getSimulationWorkspace().postProcessLangevinResults(simulation); } } fireTableRowsUpdated(row, row); diff --git a/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationWorkspace.java b/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationWorkspace.java index 2999191474..a76fd78aea 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationWorkspace.java +++ b/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationWorkspace.java @@ -892,6 +892,15 @@ void showSimulationResults(Simulation[] sims, ViewerType viewerType) { getClientSimManager().showSimulationResults(outputContext,sims,viewerType); } +void postProcessLangevinResults(Simulation simulation) { + if(!getSimulationOwner().getMathDescription().isLangevin()) { + return; + } + if (simulation.getSimulationInfo() != null && getSimulationStatus(simulation).getHasData()) { + getClientSimManager().postProcessLangevinResults(simulation); + } +} + /** * Comment From 947a731b425d4df0033bee83ab34c9b1825c0c6f Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Wed, 29 Jan 2025 12:43:26 -0500 Subject: [PATCH 04/14] WIP - properly initialize the Concentration / Count button based on actual value --- vcell-core/src/main/java/cbit/vcell/xml/XmlReader.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vcell-core/src/main/java/cbit/vcell/xml/XmlReader.java b/vcell-core/src/main/java/cbit/vcell/xml/XmlReader.java index fdc9d4067a..e55861ff9b 100644 --- a/vcell-core/src/main/java/cbit/vcell/xml/XmlReader.java +++ b/vcell-core/src/main/java/cbit/vcell/xml/XmlReader.java @@ -6035,6 +6035,9 @@ private SimulationContext getSimulationContext(Element param, BioModel biomodel) } } else if((param.getAttributeValue(XMLTags.SpringSaLaDAttrTag) != null) && (param.getAttributeValue(XMLTags.SpringSaLaDAttrTag).equals("true"))){ bSpringSaLaD = true; + if((param.getAttributeValue(XMLTags.ConcentrationAttrTag) != null) && (param.getAttributeValue(XMLTags.ConcentrationAttrTag).equals("false"))){ + bUseConcentration = false; + } } //Retrieve Geometry From 08935a460fd78a404685f0132b58d3babe193909 Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Thu, 30 Jan 2025 14:00:40 -0500 Subject: [PATCH 05/14] WIP - new LangevinPostProcessor located in core, here all post processing happens --- .../cbit/vcell/client/ClientSimManager.java | 42 ++---- .../vcell/simdata/LangevinPostProcessor.java | 142 ++++++++++++++++++ 2 files changed, 152 insertions(+), 32 deletions(-) create mode 100644 vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java diff --git a/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java b/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java index 796b3f1567..b704688999 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java +++ b/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java @@ -25,6 +25,7 @@ import cbit.vcell.client.task.AsynchClientTaskFunction; import cbit.vcell.client.task.ClientTaskDispatcher; import cbit.vcell.export.server.ExportServiceImpl; +import cbit.vcell.export.server.ExportSpecs; import cbit.vcell.field.FieldDataIdentifierSpec; import cbit.vcell.mapping.SimulationContext; import cbit.vcell.mapping.SimulationContext.NetworkGenerationRequirements; @@ -203,45 +204,22 @@ public void showSimulationResults(OutputContext outputContext, Simulation[] simu */ public void postProcessLangevinResults(Simulation sim) { - final String FAILURE_KEY = "FAILURE_KEY"; - final String SIMULATION_KEY = "SIMULATION_KEY"; + SimulationOwner simOwner = getSimWorkspace().getSimulationOwner(); + Hashtable hashTable = new Hashtable(); - hashTable.put(FAILURE_KEY, false); - hashTable.put(SIMULATION_KEY, sim); + hashTable.put(LangevinPostProcessor.FAILURE_KEY, false); + hashTable.put(LangevinPostProcessor.SIMULATION_KEY, sim); + hashTable.put(LangevinPostProcessor.SIMULATION_OWNER, simOwner); ArrayList taskList = new ArrayList(); - AsynchClientTask retrieveLangevinResultsTask = new AsynchClientTask("Retrieving results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { + AsynchClientTask postProcessLangevinResultsTask = new AsynchClientTask("PostProcessLangevinResultsTask", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { public void run(Hashtable hashTable) throws Exception { - boolean failure = (boolean) hashTable.get(FAILURE_KEY); - SolverTaskDescription std = sim.getSolverTaskDescription(); - int numTrials = std.getNumTrials(); - System.out.println(sim.getName() + ", NumTrials = " + numTrials); -// LangevinSimulationOptions lso = std.getLangevinSimulationOptions(); - final VCSimulationIdentifier vcSimulationIdentifier = sim.getSimulationInfo().getAuthoritativeVCSimulationIdentifier(); - SimulationOwner simOwner = getSimWorkspace().getSimulationOwner(); - Simulation allSims[] = simOwner.getSimulations(); - for (Simulation simCandidate : allSims) { - if (simCandidate.getName().startsWith(sim.getName())) { - System.out.println(" --- " + simCandidate.getName() + ", " + simCandidate.getJobCount()); - } - } + LangevinPostProcessor lpp = new LangevinPostProcessor(); + lpp.postProcessLangevinResults(hashTable); } }; - AsynchClientTask calculateLangevinAveragesTask = new AsynchClientTask("Retrieving results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { - public void run(Hashtable hashTable) throws Exception { - boolean failure = (boolean)hashTable.get(FAILURE_KEY); - } - }; - AsynchClientTask calculateLangevinAdvancedStatisticsTask = new AsynchClientTask("Retrieving results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { - public void run(Hashtable hashTable) throws Exception { - boolean failure = (boolean)hashTable.get(FAILURE_KEY); - - } - }; - taskList.add(retrieveLangevinResultsTask); - taskList.add(calculateLangevinAveragesTask); - taskList.add(calculateLangevinAdvancedStatisticsTask); + taskList.add(postProcessLangevinResultsTask); AsynchClientTask[] taskArray = new AsynchClientTask[taskList.size()]; taskList.toArray(taskArray); ClientTaskDispatcher.dispatch(getDocumentWindowManager().getComponent(), hashTable, taskArray, false, true, null); diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java new file mode 100644 index 0000000000..404f859fcc --- /dev/null +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java @@ -0,0 +1,142 @@ +package cbit.vcell.simdata; + +import cbit.vcell.export.server.ExportSpecs; +import cbit.vcell.solver.*; +import cbit.vcell.solver.ode.ODESimData; + +import java.util.ArrayList; +import java.util.Hashtable; + +public class LangevinPostProcessor { + + public static final String FAILURE_KEY = "FAILURE_KEY"; + public static final String SIMULATION_KEY = "SIMULATION_KEY"; + public static final String SIMULATION_OWNER = "SIMULATION_OWNER"; + + boolean failure; + Simulation sim; + SimulationOwner simOwner; + + public void postProcessLangevinResults(Hashtable hashTable) { + + failure = (boolean) hashTable.get(FAILURE_KEY); + sim = (Simulation)hashTable.get(SIMULATION_KEY); + simOwner = (SimulationOwner)hashTable.get(SIMULATION_OWNER);; + + if(sim.getVersion() == null) { + throw new RuntimeException("Missing Version."); + } + if(sim.getSimulationInfo() == null) { + throw new RuntimeException("Missing Simulation Info."); + } + + retrieveLangevinResultsTask(); + calculateLangevinAveragesTask(); + calculateLangevinAdvancedStatisticsTask(); + } + + private void retrieveLangevinResultsTask() { + SolverTaskDescription std = sim.getSolverTaskDescription(); + int numTrials = std.getNumTrials(); + VCSimulationIdentifier vcSimulationIdentifier = sim.getSimulationInfo().getAuthoritativeVCSimulationIdentifier(); + MathOverrides mathOverrides = sim.getMathOverrides(); + int sizeOverrides = mathOverrides.getSize(); + int scanCount = mathOverrides.getScanCount(); + + System.out.println(" --- " + sim.getName() + ", numTrials = " + numTrials); + System.out.println(" --- " + sim.getName() + ", jobCount" + sim.getJobCount()); + System.out.println(" --- " + sim.getName() + ", sizeOverrides = " + sizeOverrides); + System.out.println(" --- " + sim.getName() + ", scanCount = " + scanCount); + + SimulationInfo simInfo = sim.getSimulationInfo(); + VCSimulationIdentifier asi = simInfo.getAuthoritativeVCSimulationIdentifier(); + VCSimulationDataIdentifier vcSimulationDataIdentifier = new VCSimulationDataIdentifier(asi, 0); + +// ODEDataManager dm = (ODEDataManager)getDocumentWindowManager().getRequestManager().getDataManager(null, vcSimulationDataIdentifier, false); +// ODESimData osd = (ODESimData)dm.getODESolverResultSet(); + + + System.out.println(" ------------------------------------"); + + } + private void calculateLangevinAveragesTask() { + + } + private void calculateLangevinAdvancedStatisticsTask() { + + } + +// public void postProcessLangevinResults(Simulation sim) { +// +// final String FAILURE_KEY = "FAILURE_KEY"; +// final String SIMULATION_KEY = "SIMULATION_KEY"; +// Hashtable hashTable = new Hashtable(); +// hashTable.put(FAILURE_KEY, false); +// hashTable.put(SIMULATION_KEY, sim); +// +// ArrayList taskList = new ArrayList(); +// AsynchClientTask retrieveLangevinResultsTask = new AsynchClientTask("Retrieving results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { +// public void run(Hashtable hashTable) throws Exception { +// boolean failure = (boolean) hashTable.get(FAILURE_KEY); +// SolverTaskDescription std = sim.getSolverTaskDescription(); +// int numTrials = std.getNumTrials(); +// System.out.println(sim.getName() + ", numTrials = " + numTrials); +//// LangevinSimulationOptions lso = std.getLangevinSimulationOptions(); +// final VCSimulationIdentifier vcSimulationIdentifier = sim.getSimulationInfo().getAuthoritativeVCSimulationIdentifier(); +// SimulationOwner simOwner = getSimWorkspace().getSimulationOwner(); +// Simulation allSims[] = simOwner.getSimulations(); +// for (Simulation simCandidate : allSims) { +// if (simCandidate.getName().startsWith(sim.getName())) { +// System.out.println(" --- " + simCandidate.getName() + ", jobCount" + simCandidate.getJobCount()); +// MathOverrides mathOverrides = simCandidate.getMathOverrides(); +// int sizeOverrides = mathOverrides.getSize(); +// int scanCount = mathOverrides.getScanCount(); +// System.out.println(" --- " + sim.getName() + ", sizeOverrides = " + sizeOverrides); +// System.out.println(" --- " + sim.getName() + ", scanCount = " + scanCount); +// +// ExportSpecs.ExportParamScanInfo es = ExportSpecs.getParamScanInfo(simCandidate,0); +// ExportSpecs.ExportParamScanInfo es1 = ExportSpecs.getParamScanInfo(simCandidate,1); +// ExportSpecs.ExportParamScanInfo es2 = ExportSpecs.getParamScanInfo(simCandidate,2); +// +// if(sim.getVersion() == null) { +// throw new RuntimeException("Missing Version."); +// } +// SimulationInfo simInfo = sim.getSimulationInfo(); +// if(simInfo == null) { +// throw new RuntimeException("Missing Simulation Info."); +// } +// +// VCSimulationIdentifier asi = simInfo.getAuthoritativeVCSimulationIdentifier(); +// VCSimulationDataIdentifier vcSimulationDataIdentifier = new VCSimulationDataIdentifier(asi, 0); +// +// ODEDataManager dm = (ODEDataManager)getDocumentWindowManager().getRequestManager().getDataManager(outputContext, vcSimulationDataIdentifier, false); +// ODESimData osd = (ODESimData)dm.getODESolverResultSet(); +// +// +// System.out.println(" ------------------------------------"); +// } +// } +// } +// }; +// AsynchClientTask calculateLangevinAveragesTask = new AsynchClientTask("Retrieving results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { +// public void run(Hashtable hashTable) throws Exception { +// boolean failure = (boolean)hashTable.get(FAILURE_KEY); +// +// } +// }; +// AsynchClientTask calculateLangevinAdvancedStatisticsTask = new AsynchClientTask("Retrieving results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { +// public void run(Hashtable hashTable) throws Exception { +// boolean failure = (boolean)hashTable.get(FAILURE_KEY); +// +// } +// }; +// taskList.add(retrieveLangevinResultsTask); +// taskList.add(calculateLangevinAveragesTask); +// taskList.add(calculateLangevinAdvancedStatisticsTask); +// AsynchClientTask[] taskArray = new AsynchClientTask[taskList.size()]; +// taskList.toArray(taskArray); +// ClientTaskDispatcher.dispatch(getDocumentWindowManager().getComponent(), hashTable, taskArray, false, true, null); +// +// } + +} From 14bec87488966349f7dc65d77d4ea08cc4bc776b Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Fri, 31 Jan 2025 15:58:34 -0500 Subject: [PATCH 06/14] WIP - refactoring LangevinPostProcessor, simulations results recovery --- .../cbit/vcell/client/ClientSimManager.java | 49 ++++++- .../simulation/SimulationWorkspace.java | 9 +- .../vcell/simdata/LangevinPostProcessor.java | 132 +++++------------- 3 files changed, 85 insertions(+), 105 deletions(-) diff --git a/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java b/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java index b704688999..33784c9d78 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java +++ b/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java @@ -25,7 +25,6 @@ import cbit.vcell.client.task.AsynchClientTaskFunction; import cbit.vcell.client.task.ClientTaskDispatcher; import cbit.vcell.export.server.ExportServiceImpl; -import cbit.vcell.export.server.ExportSpecs; import cbit.vcell.field.FieldDataIdentifierSpec; import cbit.vcell.mapping.SimulationContext; import cbit.vcell.mapping.SimulationContext.NetworkGenerationRequirements; @@ -199,21 +198,61 @@ public void showSimulationResults(OutputContext outputContext, Simulation[] simu ClientTaskDispatcher.dispatch(getDocumentWindowManager().getComponent(), hashTable, taskArray, false, true, null); } /* - * ------------------------------------------------------------------------------------------------- TODO: postProcessLangevinResults */ public void postProcessLangevinResults(Simulation sim) { - SimulationOwner simOwner = getSimWorkspace().getSimulationOwner(); + Hashtable hashTable = new Hashtable<> (); - Hashtable hashTable = new Hashtable(); hashTable.put(LangevinPostProcessor.FAILURE_KEY, false); hashTable.put(LangevinPostProcessor.SIMULATION_KEY, sim); - hashTable.put(LangevinPostProcessor.SIMULATION_OWNER, simOwner); + hashTable.put(LangevinPostProcessor.SIMULATION_OWNER_KEY, simOwner); + + SolverTaskDescription std = sim.getSolverTaskDescription(); + int numTrials = std.getNumTrials(); + VCSimulationIdentifier vcSimulationIdentifier = sim.getSimulationInfo().getAuthoritativeVCSimulationIdentifier(); + MathOverrides mathOverrides = sim.getMathOverrides(); + int sizeOverrides = mathOverrides.getSize(); + int scanCount = mathOverrides.getScanCount(); + System.out.println(" --- " + sim.getName() + ", numTrials = " + numTrials); + System.out.println(" --- " + sim.getName() + ", jobCount" + sim.getJobCount()); + System.out.println(" --- " + sim.getName() + ", sizeOverrides = " + sizeOverrides); + System.out.println(" --- " + sim.getName() + ", scanCount = " + scanCount); + + if(sizeOverrides > 0) { + System.out.println("ClientSimManager: parameter overrides not supported yet for SpringSaLaD applications"); + hashTable.put(LangevinPostProcessor.FAILURE_KEY, true); + } + if(scanCount != 1) { + System.out.println("ClientSimManager: parameter scans not supported yet for SpringSaLaD applications"); + hashTable.put(LangevinPostProcessor.FAILURE_KEY, true); + } + if(numTrials != sim.getJobCount()) { + System.out.println("ClientSimManager: numTrials must be the same as numTrials: " + numTrials + ", " + sim.getJobCount()); + hashTable.put(LangevinPostProcessor.FAILURE_KEY, true); + } ArrayList taskList = new ArrayList(); AsynchClientTask postProcessLangevinResultsTask = new AsynchClientTask("PostProcessLangevinResultsTask", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { public void run(Hashtable hashTable) throws Exception { + + Map odeDataManagerMap = new LinkedHashMap<>(); + try { + for (int trialIndex = 0; trialIndex < numTrials; trialIndex++) { + VCSimulationDataIdentifier vcSimulationDataIdentifier = new VCSimulationDataIdentifier(vcSimulationIdentifier, trialIndex); + ODEDataManager dm = (ODEDataManager) getDocumentWindowManager().getRequestManager().getDataManager(null, vcSimulationDataIdentifier, false); + odeDataManagerMap.put(trialIndex, dm); + } + } catch(DataAccessException dae) { + System.out.println("ClientSimManager.postProcessLangevinResults() DataAccessException: " + dae.getMessage()); + hashTable.put(LangevinPostProcessor.FAILURE_KEY, true); + } + if(odeDataManagerMap.isEmpty()) { + System.out.println("ClientSimManager: no data"); + hashTable.put(LangevinPostProcessor.FAILURE_KEY, true); + } + hashTable.put(LangevinPostProcessor.ODE_SIM_DATA_MAP_KEY, odeDataManagerMap); + LangevinPostProcessor lpp = new LangevinPostProcessor(); lpp.postProcessLangevinResults(hashTable); } diff --git a/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationWorkspace.java b/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationWorkspace.java index a76fd78aea..e7bdd6be9b 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationWorkspace.java +++ b/vcell-client/src/main/java/cbit/vcell/client/desktop/simulation/SimulationWorkspace.java @@ -894,8 +894,15 @@ void showSimulationResults(Simulation[] sims, ViewerType viewerType) { void postProcessLangevinResults(Simulation simulation) { if(!getSimulationOwner().getMathDescription().isLangevin()) { - return; + throw new RuntimeException("Expecting Langevin math description."); + } + if(simulation.getVersion() == null) { + throw new RuntimeException("Missing Version."); } + if(simulation.getSimulationInfo() == null) { + throw new RuntimeException("Missing Simulation Info."); + } + if (simulation.getSimulationInfo() != null && getSimulationStatus(simulation).getHasData()) { getClientSimManager().postProcessLangevinResults(simulation); } diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java index 404f859fcc..e901ba91b0 100644 --- a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java @@ -1,142 +1,76 @@ package cbit.vcell.simdata; -import cbit.vcell.export.server.ExportSpecs; +import cbit.vcell.mapping.SimulationContext; import cbit.vcell.solver.*; import cbit.vcell.solver.ode.ODESimData; +import org.vcell.util.TokenMangler; +import org.vcell.util.document.SimulationVersion; -import java.util.ArrayList; +import java.io.File; +import java.text.SimpleDateFormat; import java.util.Hashtable; +import java.util.LinkedHashMap; +import java.util.Map; public class LangevinPostProcessor { public static final String FAILURE_KEY = "FAILURE_KEY"; public static final String SIMULATION_KEY = "SIMULATION_KEY"; - public static final String SIMULATION_OWNER = "SIMULATION_OWNER"; + public static final String SIMULATION_OWNER_KEY = "SIMULATION_OWNER_KEY"; + public static final String ODE_SIM_DATA_MAP_KEY = "ODE_SIM_DATA_MAP_KEY"; boolean failure; Simulation sim; SimulationOwner simOwner; + Map odeSimDataMap; public void postProcessLangevinResults(Hashtable hashTable) { failure = (boolean) hashTable.get(FAILURE_KEY); sim = (Simulation)hashTable.get(SIMULATION_KEY); - simOwner = (SimulationOwner)hashTable.get(SIMULATION_OWNER);; + simOwner = (SimulationOwner)hashTable.get(SIMULATION_OWNER_KEY); + odeSimDataMap = (Map)hashTable.get(ODE_SIM_DATA_MAP_KEY); - if(sim.getVersion() == null) { - throw new RuntimeException("Missing Version."); - } - if(sim.getSimulationInfo() == null) { - throw new RuntimeException("Missing Simulation Info."); + if(failure) { + return; } - retrieveLangevinResultsTask(); calculateLangevinAveragesTask(); calculateLangevinAdvancedStatisticsTask(); } - private void retrieveLangevinResultsTask() { + private void calculateLangevinAveragesTask() { SolverTaskDescription std = sim.getSolverTaskDescription(); int numTrials = std.getNumTrials(); - VCSimulationIdentifier vcSimulationIdentifier = sim.getSimulationInfo().getAuthoritativeVCSimulationIdentifier(); - MathOverrides mathOverrides = sim.getMathOverrides(); - int sizeOverrides = mathOverrides.getSize(); - int scanCount = mathOverrides.getScanCount(); - - System.out.println(" --- " + sim.getName() + ", numTrials = " + numTrials); - System.out.println(" --- " + sim.getName() + ", jobCount" + sim.getJobCount()); - System.out.println(" --- " + sim.getName() + ", sizeOverrides = " + sizeOverrides); - System.out.println(" --- " + sim.getName() + ", scanCount = " + scanCount); - SimulationInfo simInfo = sim.getSimulationInfo(); - VCSimulationIdentifier asi = simInfo.getAuthoritativeVCSimulationIdentifier(); - VCSimulationDataIdentifier vcSimulationDataIdentifier = new VCSimulationDataIdentifier(asi, 0); - -// ODEDataManager dm = (ODEDataManager)getDocumentWindowManager().getRequestManager().getDataManager(null, vcSimulationDataIdentifier, false); -// ODESimData osd = (ODESimData)dm.getODESolverResultSet(); + VCSimulationIdentifier vcSimulationIdentifier = simInfo.getAuthoritativeVCSimulationIdentifier(); + MathOverrides mathOverrides = sim.getMathOverrides(); + SimulationVersion simVersion = simInfo.getSimulationVersion(); + // TODO: go through time series and compute averages, erc System.out.println(" ------------------------------------"); } - private void calculateLangevinAveragesTask() { - } private void calculateLangevinAdvancedStatisticsTask() { } -// public void postProcessLangevinResults(Simulation sim) { -// -// final String FAILURE_KEY = "FAILURE_KEY"; -// final String SIMULATION_KEY = "SIMULATION_KEY"; -// Hashtable hashTable = new Hashtable(); -// hashTable.put(FAILURE_KEY, false); -// hashTable.put(SIMULATION_KEY, sim); -// -// ArrayList taskList = new ArrayList(); -// AsynchClientTask retrieveLangevinResultsTask = new AsynchClientTask("Retrieving results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { -// public void run(Hashtable hashTable) throws Exception { -// boolean failure = (boolean) hashTable.get(FAILURE_KEY); -// SolverTaskDescription std = sim.getSolverTaskDescription(); -// int numTrials = std.getNumTrials(); -// System.out.println(sim.getName() + ", numTrials = " + numTrials); -//// LangevinSimulationOptions lso = std.getLangevinSimulationOptions(); -// final VCSimulationIdentifier vcSimulationIdentifier = sim.getSimulationInfo().getAuthoritativeVCSimulationIdentifier(); -// SimulationOwner simOwner = getSimWorkspace().getSimulationOwner(); -// Simulation allSims[] = simOwner.getSimulations(); -// for (Simulation simCandidate : allSims) { -// if (simCandidate.getName().startsWith(sim.getName())) { -// System.out.println(" --- " + simCandidate.getName() + ", jobCount" + simCandidate.getJobCount()); -// MathOverrides mathOverrides = simCandidate.getMathOverrides(); -// int sizeOverrides = mathOverrides.getSize(); -// int scanCount = mathOverrides.getScanCount(); -// System.out.println(" --- " + sim.getName() + ", sizeOverrides = " + sizeOverrides); -// System.out.println(" --- " + sim.getName() + ", scanCount = " + scanCount); -// -// ExportSpecs.ExportParamScanInfo es = ExportSpecs.getParamScanInfo(simCandidate,0); -// ExportSpecs.ExportParamScanInfo es1 = ExportSpecs.getParamScanInfo(simCandidate,1); -// ExportSpecs.ExportParamScanInfo es2 = ExportSpecs.getParamScanInfo(simCandidate,2); -// -// if(sim.getVersion() == null) { -// throw new RuntimeException("Missing Version."); -// } -// SimulationInfo simInfo = sim.getSimulationInfo(); -// if(simInfo == null) { -// throw new RuntimeException("Missing Simulation Info."); -// } -// -// VCSimulationIdentifier asi = simInfo.getAuthoritativeVCSimulationIdentifier(); -// VCSimulationDataIdentifier vcSimulationDataIdentifier = new VCSimulationDataIdentifier(asi, 0); -// -// ODEDataManager dm = (ODEDataManager)getDocumentWindowManager().getRequestManager().getDataManager(outputContext, vcSimulationDataIdentifier, false); -// ODESimData osd = (ODESimData)dm.getODESolverResultSet(); -// -// -// System.out.println(" ------------------------------------"); -// } -// } -// } -// }; -// AsynchClientTask calculateLangevinAveragesTask = new AsynchClientTask("Retrieving results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { -// public void run(Hashtable hashTable) throws Exception { -// boolean failure = (boolean)hashTable.get(FAILURE_KEY); -// -// } -// }; -// AsynchClientTask calculateLangevinAdvancedStatisticsTask = new AsynchClientTask("Retrieving results", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { -// public void run(Hashtable hashTable) throws Exception { -// boolean failure = (boolean)hashTable.get(FAILURE_KEY); -// -// } -// }; -// taskList.add(retrieveLangevinResultsTask); -// taskList.add(calculateLangevinAveragesTask); -// taskList.add(calculateLangevinAdvancedStatisticsTask); -// AsynchClientTask[] taskArray = new AsynchClientTask[taskList.size()]; -// taskList.toArray(taskArray); -// ClientTaskDispatcher.dispatch(getDocumentWindowManager().getComponent(), hashTable, taskArray, false, true, null); -// +// private static final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy_MM_dd_HHmmss"); +// private static File createDirFile(SimulationContext simulationContext){ +// String userid = simulationContext.getBioModel().getVersion().getOwner().getName(); +// String simContextDirName = +// TokenMangler.fixTokenStrict(userid)+"-"+ +// TokenMangler.fixTokenStrict(simulationContext.getBioModel().getName())+"-"+ +// TokenMangler.fixTokenStrict(simulationContext.getName())+"-"+ +// TokenMangler.fixTokenStrict(simpleDateFormat.format(simulationContext.getBioModel().getVersion().getDate())); +//// simContextDirName = TokenMangler.fixTokenStrict(simContextDirName); +// File dirFile = new File("C:\\temp\\ruleBasedTestDir\\"+simContextDirName); +// if(!dirFile.exists()){ +// dirFile.mkdirs(); +// } +// return dirFile; // } } From a3f3be674baf24c059be06898bf94ea8559b3d25 Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Mon, 3 Feb 2025 17:05:48 -0500 Subject: [PATCH 07/14] WIP - computing simple statistics: averages, standard deviation, etc --- .../cbit/vcell/client/ClientSimManager.java | 11 ++++ .../vcell/simdata/LangevinPostProcessor.java | 52 ++++++++++++++++--- 2 files changed, 57 insertions(+), 6 deletions(-) diff --git a/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java b/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java index 33784c9d78..b0d0c3d2d4 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java +++ b/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java @@ -257,8 +257,19 @@ public void run(Hashtable hashTable) throws Exception { lpp.postProcessLangevinResults(hashTable); } }; + AsynchClientTask finishProcessLangevinResultsTask = new AsynchClientTask("FinishProcessLangevinResultsTask", AsynchClientTask.TASKTYPE_SWING_BLOCKING) { + public void run(Hashtable hashTable) throws Exception { + boolean failure = (boolean) hashTable.get(LangevinPostProcessor.FAILURE_KEY); + if(failure) { // just open some dialog for now; eventually we'll have some unobtrusive visual notification + PopupGenerator.showErrorDialog(ClientSimManager.this.getDocumentWindowManager(), "PostProcessing failed"); + } else { + PopupGenerator.showInfoDialog(ClientSimManager.this.getDocumentWindowManager(), "PostProcessing successful"); + } + } + }; taskList.add(postProcessLangevinResultsTask); + taskList.add(finishProcessLangevinResultsTask); AsynchClientTask[] taskArray = new AsynchClientTask[taskList.size()]; taskList.toArray(taskArray); ClientTaskDispatcher.dispatch(getDocumentWindowManager().getComponent(), hashTable, taskArray, false, true, null); diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java index e901ba91b0..5ffe152d11 100644 --- a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java @@ -3,14 +3,14 @@ import cbit.vcell.mapping.SimulationContext; import cbit.vcell.solver.*; import cbit.vcell.solver.ode.ODESimData; +import cbit.vcell.solver.ode.ODESolverResultSet; +import org.vcell.util.DataAccessException; import org.vcell.util.TokenMangler; import org.vcell.util.document.SimulationVersion; import java.io.File; import java.text.SimpleDateFormat; -import java.util.Hashtable; -import java.util.LinkedHashMap; -import java.util.Map; +import java.util.*; public class LangevinPostProcessor { @@ -18,18 +18,47 @@ public class LangevinPostProcessor { public static final String SIMULATION_KEY = "SIMULATION_KEY"; public static final String SIMULATION_OWNER_KEY = "SIMULATION_OWNER_KEY"; public static final String ODE_SIM_DATA_MAP_KEY = "ODE_SIM_DATA_MAP_KEY"; + public static final String LANGEVIN_MULTI_TRIAL_KEY = "LANGEVIN_MULTI_TRIAL_KEY"; + Hashtable hashTable; + boolean isMultiTrial = false; // springsalad / langevin definition of multi-trial: numTasks > 1 boolean failure; Simulation sim; SimulationOwner simOwner; - Map odeSimDataMap; + Map odeDataManagerMap; - public void postProcessLangevinResults(Hashtable hashTable) { + // the results + ODESolverResultSet averagesResultSet; + ODESolverResultSet atdResultSet; + ODESolverResultSet minResultSet; + ODESolverResultSet maxResultSet; + public void postProcessLangevinResults(Hashtable aHashTable) throws DataAccessException { + + this.hashTable = aHashTable; failure = (boolean) hashTable.get(FAILURE_KEY); sim = (Simulation)hashTable.get(SIMULATION_KEY); simOwner = (SimulationOwner)hashTable.get(SIMULATION_OWNER_KEY); - odeSimDataMap = (Map)hashTable.get(ODE_SIM_DATA_MAP_KEY); + + // key = trial index, value = simulation results (ODESimData object) for that trial + odeDataManagerMap = (Map)hashTable.get(ODE_SIM_DATA_MAP_KEY); + + ODEDataManager tempODEDataManager0 = odeDataManagerMap.get(0); + ODEDataManager tempODEDataManager1 = odeDataManagerMap.get(1); + ODESimData tempODESimData = (ODESimData)tempODEDataManager0.getODESolverResultSet(); + String format = tempODESimData.getFormatID(); + String mathName = tempODESimData.getMathName(); // should be different instances? + + // sanity check: shouldn't be, that only works for non-spatial stochastic where things are done differently + System.out.println("isGibsonMultiTrial: " + tempODEDataManager0.getODESolverResultSet().isMultiTrialData()); + + // the + averagesResultSet = new ODESolverResultSet(tempODEDataManager0.getODESolverResultSet()); + atdResultSet = new ODESolverResultSet(tempODEDataManager0.getODESolverResultSet()); + minResultSet = new ODESolverResultSet(tempODEDataManager0.getODESolverResultSet()); + maxResultSet = new ODESolverResultSet(tempODEDataManager0.getODESolverResultSet()); + + initializeResultSetValues(averagesResultSet); if(failure) { return; @@ -39,9 +68,20 @@ public void postProcessLangevinResults(Hashtable hashTable) { calculateLangevinAdvancedStatisticsTask(); } + private void initializeResultSetValues(ODESolverResultSet osrs) { + int columnDescriptionCount = osrs.getColumnDescriptionsCount(); + int rowCount = osrs.getRowCount(); + List rows = osrs.getRows(); + + System.out.println("post process langevin"); + } + private void calculateLangevinAveragesTask() { SolverTaskDescription std = sim.getSolverTaskDescription(); int numTrials = std.getNumTrials(); + isMultiTrial = true; + hashTable.put(LANGEVIN_MULTI_TRIAL_KEY, isMultiTrial); + SimulationInfo simInfo = sim.getSimulationInfo(); VCSimulationIdentifier vcSimulationIdentifier = simInfo.getAuthoritativeVCSimulationIdentifier(); MathOverrides mathOverrides = sim.getMathOverrides(); From a7aaaf8b185dd9aaf86422ff9bf39f35a8bb41b2 Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Tue, 4 Feb 2025 15:33:08 -0500 Subject: [PATCH 08/14] WIP --- .../main/java/cbit/vcell/simdata/LangevinPostProcessor.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java index 5ffe152d11..0d5bf6c6bd 100644 --- a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java @@ -72,6 +72,12 @@ private void initializeResultSetValues(ODESolverResultSet osrs) { int columnDescriptionCount = osrs.getColumnDescriptionsCount(); int rowCount = osrs.getRowCount(); List rows = osrs.getRows(); + for(int column = 0; column < columnDescriptionCount; column++) { + double[] rowData = osrs.getRow(column); + for(int i = 0; i < rowData.length; i++) { + rowData[i] = 0; + } + } System.out.println("post process langevin"); } From 5bed49240b4994b77f63ffd7d7a3537f36fd1b3f Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Wed, 5 Feb 2025 16:49:37 -0500 Subject: [PATCH 09/14] WIP --- .../vcell/simdata/LangevinPostProcessor.java | 132 +++++++++++++----- 1 file changed, 100 insertions(+), 32 deletions(-) diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java index 0d5bf6c6bd..2880155ef5 100644 --- a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java @@ -4,6 +4,7 @@ import cbit.vcell.solver.*; import cbit.vcell.solver.ode.ODESimData; import cbit.vcell.solver.ode.ODESolverResultSet; +import cbit.vcell.util.ColumnDescription; import org.vcell.util.DataAccessException; import org.vcell.util.TokenMangler; import org.vcell.util.document.SimulationVersion; @@ -29,7 +30,7 @@ public class LangevinPostProcessor { // the results ODESolverResultSet averagesResultSet; - ODESolverResultSet atdResultSet; + ODESolverResultSet stdResultSet; ODESolverResultSet minResultSet; ODESolverResultSet maxResultSet; @@ -43,38 +44,121 @@ public void postProcessLangevinResults(Hashtable aHashTable) thr // key = trial index, value = simulation results (ODESimData object) for that trial odeDataManagerMap = (Map)hashTable.get(ODE_SIM_DATA_MAP_KEY); - ODEDataManager tempODEDataManager0 = odeDataManagerMap.get(0); - ODEDataManager tempODEDataManager1 = odeDataManagerMap.get(1); - ODESimData tempODESimData = (ODESimData)tempODEDataManager0.getODESolverResultSet(); + SolverTaskDescription std = sim.getSolverTaskDescription(); + int numTrials = std.getNumTrials(); + isMultiTrial = numTrials > 1 ? true : false; + hashTable.put(LANGEVIN_MULTI_TRIAL_KEY, isMultiTrial); + + // probably useless at this point + SimulationInfo simInfo = sim.getSimulationInfo(); + VCSimulationIdentifier vcSimulationIdentifier = simInfo.getAuthoritativeVCSimulationIdentifier(); + MathOverrides mathOverrides = sim.getMathOverrides(); + SimulationVersion simVersion = simInfo.getSimulationVersion(); + + ODEDataManager tempODEDataManager = odeDataManagerMap.get(0); + ODESimData tempODESimData = (ODESimData)tempODEDataManager.getODESolverResultSet(); String format = tempODESimData.getFormatID(); String mathName = tempODESimData.getMathName(); // should be different instances? // sanity check: shouldn't be, that only works for non-spatial stochastic where things are done differently - System.out.println("isGibsonMultiTrial: " + tempODEDataManager0.getODESolverResultSet().isMultiTrialData()); + System.out.println("isGibsonMultiTrial: " + tempODEDataManager.getODESolverResultSet().isMultiTrialData()); - // the - averagesResultSet = new ODESolverResultSet(tempODEDataManager0.getODESolverResultSet()); - atdResultSet = new ODESolverResultSet(tempODEDataManager0.getODESolverResultSet()); - minResultSet = new ODESolverResultSet(tempODEDataManager0.getODESolverResultSet()); - maxResultSet = new ODESolverResultSet(tempODEDataManager0.getODESolverResultSet()); + averagesResultSet = new ODESolverResultSet(tempODEDataManager.getODESolverResultSet()); + stdResultSet = new ODESolverResultSet(tempODEDataManager.getODESolverResultSet()); + minResultSet = new ODESolverResultSet(tempODEDataManager.getODESolverResultSet()); + maxResultSet = new ODESolverResultSet(tempODEDataManager.getODESolverResultSet()); initializeResultSetValues(averagesResultSet); - + initializeResultSetValues(stdResultSet); + // we leave the min and max initialized with whatever the first trial has and adjust as we go through the other trials if(failure) { return; } - calculateLangevinAveragesTask(); - calculateLangevinAdvancedStatisticsTask(); + calculateLangevinPrimaryStatistics(); // averages, standard deviation, min, max + calculateLangevinAdvancedStatistics(); + } + + private void calculateLangevinPrimaryStatistics() throws DataAccessException { + + int numTrials = odeDataManagerMap.size(); + for(int trialIndex = 0; trialIndex < numTrials; trialIndex++) { + ODEDataManager sourceOdm = odeDataManagerMap.get(trialIndex); + ODESolverResultSet sourceOsrs = sourceOdm.getODESolverResultSet(); + int rowCount = sourceOsrs.getRowCount(); + for (int row = 0; row < rowCount; row++) { + double[] sourceRowData = sourceOsrs.getRow(row); + double[] averageRowData = averagesResultSet.getRow(row); // destination average + double[] minRowData = minResultSet.getRow(row); // destination min + double[] maxRowData = maxResultSet.getRow(row); // destination max + + for (int i = 0; i < averageRowData.length; i++) { + ColumnDescription cd = averagesResultSet.getColumnDescriptions(i); + String name = cd.getName(); + if (name.equals("t")) { + continue; + } + averageRowData[i] = sourceRowData[i] / numTrials; + if (minRowData[i] > sourceRowData[i]) { + minRowData[i] = sourceRowData[i]; + } + if (maxRowData[i] < sourceRowData[i]) { + maxRowData[i] = sourceRowData[i]; + } + } + } + } + + for(int trialIndex = 0; trialIndex < numTrials; trialIndex++) { + ODEDataManager sourceOdm = odeDataManagerMap.get(trialIndex); + ODESolverResultSet sourceOsrs = sourceOdm.getODESolverResultSet(); + int rowCount = sourceOsrs.getRowCount(); + for (int row = 0; row < rowCount; row++) { + double[] sourceRowData = sourceOsrs.getRow(row); + double[] averageRowData = averagesResultSet.getRow(row); + double[] stdRowData = stdResultSet.getRow(row); // destination std + + for (int i = 0; i < averageRowData.length; i++) { + ColumnDescription cd = averagesResultSet.getColumnDescriptions(i); + String name = cd.getName(); + if (name.equals("t")) { + continue; + } + + double variance = Math.pow(sourceRowData[i] - averageRowData[i], 2); + stdRowData[i] += variance / numTrials; + } + } + } + + int rowCount = stdResultSet.getRowCount(); + for (int row = 0; row < rowCount; row++) { + double[] stdRowData = stdResultSet.getRow(row); + for (int i = 0; i < stdRowData.length; i++) { + ColumnDescription cd = stdResultSet.getColumnDescriptions(i); + String name = cd.getName(); + if (name.equals("t")) { + continue; + } + double variance = stdRowData[i]; + stdRowData[i] = Math.sqrt(variance); + } + } + System.out.println(" ------------------------------------"); } private void initializeResultSetValues(ODESolverResultSet osrs) { int columnDescriptionCount = osrs.getColumnDescriptionsCount(); int rowCount = osrs.getRowCount(); List rows = osrs.getRows(); - for(int column = 0; column < columnDescriptionCount; column++) { - double[] rowData = osrs.getRow(column); + for(int row = 0; row < rowCount; row++) { + double[] rowData = osrs.getRow(row); for(int i = 0; i < rowData.length; i++) { + ColumnDescription cd = osrs.getColumnDescriptions(i); + String name = cd.getName(); + if(name.equals("t")) { + continue; + } rowData[i] = 0; } } @@ -82,24 +166,8 @@ private void initializeResultSetValues(ODESolverResultSet osrs) { System.out.println("post process langevin"); } - private void calculateLangevinAveragesTask() { - SolverTaskDescription std = sim.getSolverTaskDescription(); - int numTrials = std.getNumTrials(); - isMultiTrial = true; - hashTable.put(LANGEVIN_MULTI_TRIAL_KEY, isMultiTrial); - - SimulationInfo simInfo = sim.getSimulationInfo(); - VCSimulationIdentifier vcSimulationIdentifier = simInfo.getAuthoritativeVCSimulationIdentifier(); - MathOverrides mathOverrides = sim.getMathOverrides(); - SimulationVersion simVersion = simInfo.getSimulationVersion(); - - // TODO: go through time series and compute averages, erc - - System.out.println(" ------------------------------------"); - - } - private void calculateLangevinAdvancedStatisticsTask() { + private void calculateLangevinAdvancedStatistics() { } From 5169924e2b964d70e9e779d093647a30eff3704b Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Fri, 7 Feb 2025 16:04:17 -0500 Subject: [PATCH 10/14] WIP - deep initialize / copy a RowColumnResultSet --- .../cbit/vcell/math/RowColumnResultSet.java | 22 ++++++++++ .../vcell/simdata/LangevinPostProcessor.java | 43 ++++++------------- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/vcell-core/src/main/java/cbit/vcell/math/RowColumnResultSet.java b/vcell-core/src/main/java/cbit/vcell/math/RowColumnResultSet.java index 52f6547c42..c1cd74fd82 100644 --- a/vcell-core/src/main/java/cbit/vcell/math/RowColumnResultSet.java +++ b/vcell-core/src/main/java/cbit/vcell/math/RowColumnResultSet.java @@ -62,6 +62,28 @@ public RowColumnResultSet(RowColumnResultSet copyThisRowColumnResultSet){ this.fieldValues = new ArrayList<>(copyThisRowColumnResultSet.fieldValues); } + public enum DuplicateMode { + CopyValues, + ZeroInitialize + } + public static RowColumnResultSet deepCopy(RowColumnResultSet original, DuplicateMode mode) { + RowColumnResultSet copy = new RowColumnResultSet(); + copy.fieldDataColumnDescriptions = new Vector<>(original.fieldDataColumnDescriptions); + copy.fieldFunctionColumnDescriptions = new Vector<>(original.fieldFunctionColumnDescriptions); + copy.fieldValues = new ArrayList<>(); + for (double[] originalRow : original.fieldValues) { + double[] copyRow = new double[originalRow.length]; + if(mode == DuplicateMode.CopyValues) { + System.arraycopy(originalRow, 0, copyRow, 0, originalRow.length); + } + copy.fieldValues.add(copyRow); + } + + + + return copy; + } + /** * SimpleODEData constructor comment. * JMW : THIS NEEDS TO BE FIXED...THIS CONSTRUCTOR SHOULD NOT diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java index 2880155ef5..5be70481e0 100644 --- a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java @@ -1,6 +1,7 @@ package cbit.vcell.simdata; import cbit.vcell.mapping.SimulationContext; +import cbit.vcell.math.RowColumnResultSet; import cbit.vcell.solver.*; import cbit.vcell.solver.ode.ODESimData; import cbit.vcell.solver.ode.ODESolverResultSet; @@ -9,6 +10,8 @@ import org.vcell.util.TokenMangler; import org.vcell.util.document.SimulationVersion; +import javax.swing.*; +import java.awt.*; import java.io.File; import java.text.SimpleDateFormat; import java.util.*; @@ -29,10 +32,10 @@ public class LangevinPostProcessor { Map odeDataManagerMap; // the results - ODESolverResultSet averagesResultSet; - ODESolverResultSet stdResultSet; - ODESolverResultSet minResultSet; - ODESolverResultSet maxResultSet; + RowColumnResultSet averagesResultSet; + RowColumnResultSet stdResultSet; + RowColumnResultSet minResultSet; + RowColumnResultSet maxResultSet; public void postProcessLangevinResults(Hashtable aHashTable) throws DataAccessException { @@ -56,6 +59,7 @@ public void postProcessLangevinResults(Hashtable aHashTable) thr SimulationVersion simVersion = simInfo.getSimulationVersion(); ODEDataManager tempODEDataManager = odeDataManagerMap.get(0); +// ODEDataManager tempODEDataManager1 = odeDataManagerMap.get(1); ODESimData tempODESimData = (ODESimData)tempODEDataManager.getODESolverResultSet(); String format = tempODESimData.getFormatID(); String mathName = tempODESimData.getMathName(); // should be different instances? @@ -63,13 +67,11 @@ public void postProcessLangevinResults(Hashtable aHashTable) thr // sanity check: shouldn't be, that only works for non-spatial stochastic where things are done differently System.out.println("isGibsonMultiTrial: " + tempODEDataManager.getODESolverResultSet().isMultiTrialData()); - averagesResultSet = new ODESolverResultSet(tempODEDataManager.getODESolverResultSet()); - stdResultSet = new ODESolverResultSet(tempODEDataManager.getODESolverResultSet()); - minResultSet = new ODESolverResultSet(tempODEDataManager.getODESolverResultSet()); - maxResultSet = new ODESolverResultSet(tempODEDataManager.getODESolverResultSet()); + averagesResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.ZeroInitialize); + stdResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.ZeroInitialize); + minResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.CopyValues); + maxResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.CopyValues); - initializeResultSetValues(averagesResultSet); - initializeResultSetValues(stdResultSet); // we leave the min and max initialized with whatever the first trial has and adjust as we go through the other trials if(failure) { return; @@ -98,7 +100,7 @@ private void calculateLangevinPrimaryStatistics() throws DataAccessException { if (name.equals("t")) { continue; } - averageRowData[i] = sourceRowData[i] / numTrials; + averageRowData[i] += sourceRowData[i] / numTrials; if (minRowData[i] > sourceRowData[i]) { minRowData[i] = sourceRowData[i]; } @@ -147,29 +149,12 @@ private void calculateLangevinPrimaryStatistics() throws DataAccessException { System.out.println(" ------------------------------------"); } - private void initializeResultSetValues(ODESolverResultSet osrs) { - int columnDescriptionCount = osrs.getColumnDescriptionsCount(); - int rowCount = osrs.getRowCount(); - List rows = osrs.getRows(); - for(int row = 0; row < rowCount; row++) { - double[] rowData = osrs.getRow(row); - for(int i = 0; i < rowData.length; i++) { - ColumnDescription cd = osrs.getColumnDescriptions(i); - String name = cd.getName(); - if(name.equals("t")) { - continue; - } - rowData[i] = 0; - } - } + private void calculateLangevinAdvancedStatistics() { - System.out.println("post process langevin"); } - private void calculateLangevinAdvancedStatistics() { - } // private static final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy_MM_dd_HHmmss"); // private static File createDirFile(SimulationContext simulationContext){ From 4e33985832ccb4b49f2be1650b0df2d447fbc46d Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Mon, 10 Feb 2025 14:12:33 -0500 Subject: [PATCH 11/14] WIP - paint min, max, avg, std --- .../vcell/simdata/LangevinPostProcessor.java | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java index 5be70481e0..6d79eec63f 100644 --- a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java @@ -154,6 +154,94 @@ private void calculateLangevinAdvancedStatistics() { } + public static void main(String[] args) { + + class MyClass extends JPanel { + private double[] means; + private double[] stds; + private double[] mins; + private double[] maxs; + + public MyClass(double[] means, double[] stds, double[] mins, double[] maxs) { + this.means = means; + this.stds = stds; + this.mins = mins; + this.maxs = maxs; + } + + protected void paintComponent(Graphics g) { + super.paintComponent(g); + int xOffset = 50; + int yOffset = 50; + int width = getWidth(); + int height = getHeight(); + int xStep = (width - xOffset*2) / (means.length+1); + + Graphics2D g2 = (Graphics2D) g; + Stroke oldStroke = g2.getStroke(); + Font oldFont = g2.getFont(); + Color oldColor = g2.getColor(); + + Font boldFont = oldFont.deriveFont(Font.BOLD); + g2.setFont(boldFont); + + float newWidth = 2.0f; + g2.setStroke(new BasicStroke(newWidth)); + + g2.drawLine(xOffset, height - yOffset, width - yOffset, height - yOffset); // x-axis + g2.drawLine(xOffset, height - yOffset, xOffset, yOffset); + + int[] xPoints = new int[mins.length + maxs.length]; + int[] yPoints = new int[mins.length + maxs.length]; + + for (int i = 0; i < mins.length; i++) { + xPoints[i] = 10 + xOffset + xStep*i; + yPoints[i] = height - 50 - (int) mins[i] * 10; + } + for (int i = maxs.length - 1; i >= 0; i--) { + xPoints[mins.length + (maxs.length - 1 - i)] = 10 + xOffset + xStep*i; + yPoints[mins.length + (maxs.length - 1 - i)] = height - 50 - (int) maxs[i] * 10; + } + g2.setColor(Color.darkGray); + Polygon polygon = new Polygon(xPoints, yPoints, xPoints.length); + g2.setColor(Color.yellow.darker().darker()); + g2.draw(polygon); + + for(int i=0; i Date: Mon, 10 Feb 2025 15:49:34 -0500 Subject: [PATCH 12/14] paint min, max, avg, std - proof of concept --- .../vcell/simdata/LangevinPostProcessor.java | 93 ++++++++++++------- 1 file changed, 59 insertions(+), 34 deletions(-) diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java index 6d79eec63f..1261f4639e 100644 --- a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java @@ -171,69 +171,94 @@ public MyClass(double[] means, double[] stds, double[] mins, double[] maxs) { protected void paintComponent(Graphics g) { super.paintComponent(g); - int xOffset = 50; + int xOffset = 50; // margins int yOffset = 50; int width = getWidth(); int height = getHeight(); - int xStep = (width - xOffset*2) / (means.length+1); Graphics2D g2 = (Graphics2D) g; Stroke oldStroke = g2.getStroke(); Font oldFont = g2.getFont(); Color oldColor = g2.getColor(); - Font boldFont = oldFont.deriveFont(Font.BOLD); g2.setFont(boldFont); - float newWidth = 2.0f; - g2.setStroke(new BasicStroke(newWidth)); + g2.setStroke(new BasicStroke(2.0f)); + g2.setColor(Color.darkGray); + g2.drawLine(xOffset, height - yOffset, width - xOffset +15, height - yOffset); // x-axis + g2.drawLine(xOffset, yOffset - 20, xOffset, height - yOffset); // y-axis + g2.setStroke(oldStroke); - g2.drawLine(xOffset, height - yOffset, width - yOffset, height - yOffset); // x-axis - g2.drawLine(xOffset, height - yOffset, xOffset, yOffset); + // calculate scale factors + double scaleX = (width - 2 * xOffset) / (double) (means.length - 1); + double scaleY = (height - 2 * yOffset) / getMaxValue(); + // arrays to hold the polygon points int[] xPoints = new int[mins.length + maxs.length]; int[] yPoints = new int[mins.length + maxs.length]; - - for (int i = 0; i < mins.length; i++) { - xPoints[i] = 10 + xOffset + xStep*i; - yPoints[i] = height - 50 - (int) mins[i] * 10; + for (int i = 0; i < mins.length; i++) { // mins array + xPoints[i] = xOffset + (int) (i * scaleX); + yPoints[i] = height - yOffset - (int) (mins[i] * scaleY); } - for (int i = maxs.length - 1; i >= 0; i--) { - xPoints[mins.length + (maxs.length - 1 - i)] = 10 + xOffset + xStep*i; - yPoints[mins.length + (maxs.length - 1 - i)] = height - 50 - (int) maxs[i] * 10; + for (int i = maxs.length - 1; i >= 0; i--) { // maxs array + xPoints[mins.length + (maxs.length - 1 - i)] = xOffset + (int) (i * scaleX); + yPoints[mins.length + (maxs.length - 1 - i)] = height - yOffset - (int) (maxs[i] * scaleY); } - g2.setColor(Color.darkGray); - Polygon polygon = new Polygon(xPoints, yPoints, xPoints.length); - g2.setColor(Color.yellow.darker().darker()); - g2.draw(polygon); - - for(int i=0; i0) { // unite points (draw line to previous point) + g2.drawLine(x, y, xOffset + (int) ((i-1) * scaleX), height - yOffset - (int) (means[i-1] * scaleY)); + } + g2.setStroke(oldStroke); + g2.setColor(Color.red.darker()); - g2.drawString("Std Dev", xMean + 10, yMean-15); + g2.setStroke(new BasicStroke(3.0f)); + int stdDevHeight = (int) (stds[i] * scaleY); + g2.drawLine(x, y - stdDevHeight, x, y + stdDevHeight); // draw standard deviation bar + g2.setStroke(oldStroke); + +// g2.setColor(Color.green.darker()); // labels for each +// g2.drawString("Mean", x + 10, y-3); +// g2.setColor(Color.red.darker()); +// g2.drawString("Std Dev", x + 10, y-15); } + g2.setColor(Color.green.darker()); // labels just once + g2.drawString("Mean", xOffset + 10, yOffset - 3); + g2.setColor(Color.red.darker()); + g2.drawString("Std Dev", xOffset + 10, yOffset-15); g2.setStroke(oldStroke); g2.setFont(oldFont); g2.setColor(oldColor); } + + private double getMaxValue() { // needed for scaling properly - based on the largest number + double maxVal = Double.MIN_VALUE; + for (double val : maxs) { // we only need to look into maxs, no mins or means may be higher + if (val > maxVal) { + maxVal = val; + } + } + return maxVal; + } } double[] meansA = { 30.0, 22.5, 15.8, 12.1, 9.4, 7.1, 4.9, 3.2, 2.3 }; double[] meansB = { 0.0, 7.5, 14.2, 17.9, 20.6, 22.9, 25.1, 26.8, 27.7 }; double[] stds = { 0.0, 2.2, 2.1, 1.5, 1.6, 1.9, 1.4, 1.1, 0.9 }; - double[] minA = { 30.0, 20.0, 17.0, 12.0, 8.0, 4.0, 4.0, 2.0, 1.0 }; - double[] maxA = { 30.0, 24.0, 20.0, 14.0, 11.0, 9.0, 9.0, 9.0, 5.0 }; + double[] minA = { 30.0, 18.0, 14.0, 11.0, 8.0, 4.0, 4.0, 2.0, 1.0 }; + double[] maxA = { 30.0, 24.0, 20.0, 15.0, 12.0, 10.0, 9.0, 8.0, 5.0 }; JFrame frame = new JFrame("Mean and Standard Deviation Chart"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); From bfb3aa97721cf3e5fda0fbb73c9c12b02dd85825 Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Thu, 13 Feb 2025 16:30:55 -0500 Subject: [PATCH 13/14] insulating post processing by using input / output classes --- pom.xml | 2 +- .../cbit/vcell/client/ClientSimManager.java | 19 ++++- .../vcell/simdata/LangevinPostProcessor.java | 69 +++++++++------- .../simdata/LangevinPostProcessorInput.java | 42 ++++++++++ .../simdata/LangevinPostProcessorOutput.java | 82 +++++++++++++++++++ 5 files changed, 179 insertions(+), 35 deletions(-) create mode 100644 vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessorInput.java create mode 100644 vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessorOutput.java diff --git a/pom.xml b/pom.xml index 7ed69a4d12..ae3a868d43 100644 --- a/pom.xml +++ b/pom.xml @@ -188,7 +188,7 @@ v0.0.40 v0.0.44-dev4 1.2.7 - 1.2.7 + 1.3.3 1.2.7 diff --git a/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java b/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java index b0d0c3d2d4..706903e264 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java +++ b/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java @@ -251,15 +251,28 @@ public void run(Hashtable hashTable) throws Exception { System.out.println("ClientSimManager: no data"); hashTable.put(LangevinPostProcessor.FAILURE_KEY, true); } - hashTable.put(LangevinPostProcessor.ODE_SIM_DATA_MAP_KEY, odeDataManagerMap); + + Simulation sim = (Simulation)hashTable.get(LangevinPostProcessor.SIMULATION_KEY); + SimulationOwner simOwner = (SimulationOwner)hashTable.get(LangevinPostProcessor.SIMULATION_OWNER_KEY); + LangevinPostProcessorInput lppInput = new LangevinPostProcessorInput(sim, simOwner); + lppInput.setFailed((boolean)hashTable.get(LangevinPostProcessor.FAILURE_KEY)); + lppInput.setOdeDataManagerMap(odeDataManagerMap); LangevinPostProcessor lpp = new LangevinPostProcessor(); - lpp.postProcessLangevinResults(hashTable); + LangevinPostProcessorOutput lppOutput = lpp.postProcessLangevinResults(lppInput); + hashTable.put(LangevinPostProcessor.LPP_OUTPUT_KEY, lppOutput); + + // the LangevinPostProcessorOutput contains all we need, remove the rest + hashTable.remove(LangevinPostProcessor.FAILURE_KEY); + hashTable.remove(LangevinPostProcessor.LANGEVIN_MULTI_TRIAL_KEY); + hashTable.remove(LangevinPostProcessor.SIMULATION_KEY); + hashTable.remove(LangevinPostProcessor.SIMULATION_OWNER_KEY); } }; AsynchClientTask finishProcessLangevinResultsTask = new AsynchClientTask("FinishProcessLangevinResultsTask", AsynchClientTask.TASKTYPE_SWING_BLOCKING) { public void run(Hashtable hashTable) throws Exception { - boolean failure = (boolean) hashTable.get(LangevinPostProcessor.FAILURE_KEY); + LangevinPostProcessorOutput lppOutput = (LangevinPostProcessorOutput) hashTable.get(LangevinPostProcessor.LPP_OUTPUT_KEY); + boolean failure = lppOutput.isFailed(); if(failure) { // just open some dialog for now; eventually we'll have some unobtrusive visual notification PopupGenerator.showErrorDialog(ClientSimManager.this.getDocumentWindowManager(), "PostProcessing failed"); } else { diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java index 1261f4639e..a5e4764955 100644 --- a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java @@ -1,19 +1,15 @@ package cbit.vcell.simdata; -import cbit.vcell.mapping.SimulationContext; import cbit.vcell.math.RowColumnResultSet; import cbit.vcell.solver.*; import cbit.vcell.solver.ode.ODESimData; import cbit.vcell.solver.ode.ODESolverResultSet; import cbit.vcell.util.ColumnDescription; import org.vcell.util.DataAccessException; -import org.vcell.util.TokenMangler; import org.vcell.util.document.SimulationVersion; import javax.swing.*; import java.awt.*; -import java.io.File; -import java.text.SimpleDateFormat; import java.util.*; public class LangevinPostProcessor { @@ -21,9 +17,8 @@ public class LangevinPostProcessor { public static final String FAILURE_KEY = "FAILURE_KEY"; public static final String SIMULATION_KEY = "SIMULATION_KEY"; public static final String SIMULATION_OWNER_KEY = "SIMULATION_OWNER_KEY"; - public static final String ODE_SIM_DATA_MAP_KEY = "ODE_SIM_DATA_MAP_KEY"; public static final String LANGEVIN_MULTI_TRIAL_KEY = "LANGEVIN_MULTI_TRIAL_KEY"; - Hashtable hashTable; + public static final String LPP_OUTPUT_KEY = "LANGEVIN_POST_PROCESSOR_OUTPUT_KEY"; boolean isMultiTrial = false; // springsalad / langevin definition of multi-trial: numTasks > 1 boolean failure; @@ -37,20 +32,24 @@ public class LangevinPostProcessor { RowColumnResultSet minResultSet; RowColumnResultSet maxResultSet; - public void postProcessLangevinResults(Hashtable aHashTable) throws DataAccessException { - this.hashTable = aHashTable; - failure = (boolean) hashTable.get(FAILURE_KEY); - sim = (Simulation)hashTable.get(SIMULATION_KEY); - simOwner = (SimulationOwner)hashTable.get(SIMULATION_OWNER_KEY); + public LangevinPostProcessorOutput postProcessLangevinResults(LangevinPostProcessorInput lppInput) { - // key = trial index, value = simulation results (ODESimData object) for that trial - odeDataManagerMap = (Map)hashTable.get(ODE_SIM_DATA_MAP_KEY); + sim = lppInput.getSimulation(); + simOwner = lppInput.getSimulationOwner(); + LangevinPostProcessorOutput pllOut = new LangevinPostProcessorOutput(sim, simOwner); + failure = lppInput.isFailed(); SolverTaskDescription std = sim.getSolverTaskDescription(); int numTrials = std.getNumTrials(); isMultiTrial = numTrials > 1 ? true : false; - hashTable.put(LANGEVIN_MULTI_TRIAL_KEY, isMultiTrial); + if(failure) { + pllOut.setFailed(failure); + pllOut.setMultiTrial(isMultiTrial); + return pllOut; + } + + odeDataManagerMap = lppInput.getOdeDataManagerMap(); // key = trial index, value = simulation results (ODESimData object) for that trial // probably useless at this point SimulationInfo simInfo = sim.getSimulationInfo(); @@ -58,27 +57,35 @@ public void postProcessLangevinResults(Hashtable aHashTable) thr MathOverrides mathOverrides = sim.getMathOverrides(); SimulationVersion simVersion = simInfo.getSimulationVersion(); - ODEDataManager tempODEDataManager = odeDataManagerMap.get(0); -// ODEDataManager tempODEDataManager1 = odeDataManagerMap.get(1); - ODESimData tempODESimData = (ODESimData)tempODEDataManager.getODESolverResultSet(); - String format = tempODESimData.getFormatID(); - String mathName = tempODESimData.getMathName(); // should be different instances? + try { + ODEDataManager tempODEDataManager = odeDataManagerMap.get(0); + ODESimData tempODESimData = (ODESimData) tempODEDataManager.getODESolverResultSet(); + String format = tempODESimData.getFormatID(); + String mathName = tempODESimData.getMathName(); // should be different instances? - // sanity check: shouldn't be, that only works for non-spatial stochastic where things are done differently - System.out.println("isGibsonMultiTrial: " + tempODEDataManager.getODESolverResultSet().isMultiTrialData()); + // sanity check: shouldn't be, that only works for non-spatial stochastic where things are done differently + System.out.println("isGibsonMultiTrial: " + tempODEDataManager.getODESolverResultSet().isMultiTrialData()); - averagesResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.ZeroInitialize); - stdResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.ZeroInitialize); - minResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.CopyValues); - maxResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.CopyValues); + averagesResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.ZeroInitialize); + stdResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.ZeroInitialize); + minResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.CopyValues); + maxResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.CopyValues); - // we leave the min and max initialized with whatever the first trial has and adjust as we go through the other trials - if(failure) { - return; - } + calculateLangevinPrimaryStatistics(); // averages, standard deviation, min, max + calculateLangevinAdvancedStatistics(); - calculateLangevinPrimaryStatistics(); // averages, standard deviation, min, max - calculateLangevinAdvancedStatistics(); + } catch(DataAccessException dae) { + pllOut.setFailed(true); + pllOut.setMultiTrial(isMultiTrial); + return pllOut; + } + pllOut.setFailed(failure); + pllOut.setMultiTrial(isMultiTrial); + pllOut.setAveragesResultSet(averagesResultSet); + pllOut.setStdResultSet(stdResultSet); + pllOut.setMinResultSet(minResultSet); + pllOut.setMaxResultSet((maxResultSet)); + return pllOut; } private void calculateLangevinPrimaryStatistics() throws DataAccessException { diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessorInput.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessorInput.java new file mode 100644 index 0000000000..8b5b58e1ae --- /dev/null +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessorInput.java @@ -0,0 +1,42 @@ +package cbit.vcell.simdata; + +import cbit.vcell.solver.*; + +import java.util.*; + + +public class LangevinPostProcessorInput { + + private final Simulation sim; + private final SimulationOwner simOwner; + + Map odeDataManagerMap = new LinkedHashMap<>(); // key = trialIndex + + private boolean failed = false; + + + public LangevinPostProcessorInput(Simulation sim, SimulationOwner simOwner) { + this.sim = sim; + this.simOwner = simOwner; + } + + public Simulation getSimulation() { + return sim; + } + public SimulationOwner getSimulationOwner() { + return simOwner; + } + public Map getOdeDataManagerMap() { + return odeDataManagerMap; + } + public boolean isFailed() { + return failed; + } + + public void setOdeDataManagerMap(Map odeDataManagerMap) { + this.odeDataManagerMap = odeDataManagerMap; + } + public void setFailed(boolean failed) { + this.failed = failed; + } +} diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessorOutput.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessorOutput.java new file mode 100644 index 0000000000..ff9768d987 --- /dev/null +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessorOutput.java @@ -0,0 +1,82 @@ +package cbit.vcell.simdata; + +import cbit.vcell.mapping.SimulationContext; +import cbit.vcell.math.RowColumnResultSet; +import cbit.vcell.solver.*; +import cbit.vcell.solver.ode.ODESimData; +import cbit.vcell.solver.ode.ODESolverResultSet; +import cbit.vcell.util.ColumnDescription; +import org.vcell.util.DataAccessException; +import org.vcell.util.TokenMangler; +import org.vcell.util.document.SimulationVersion; + +import javax.swing.*; +import java.awt.*; +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.*; + +public class LangevinPostProcessorOutput { + + private final Simulation sim; + private final SimulationOwner simOwner; + + private boolean failed = false; + private boolean isMultiTrial = false; // springsalad / langevin definition of multi-trial: numTasks > 1 + + // the results + RowColumnResultSet averagesResultSet = null; + RowColumnResultSet stdResultSet = null; + RowColumnResultSet minResultSet = null; + RowColumnResultSet maxResultSet = null; + + + public LangevinPostProcessorOutput(Simulation sim, SimulationOwner simOwner) { + this.sim = sim; + this.simOwner = simOwner; + } + + public Simulation getSimulation() { + return sim; + } + public SimulationOwner getSimulationOwner() { + return simOwner; + } + public boolean isFailed() { + return failed; + } + public boolean isMultiTrial() { + return isMultiTrial; + } + public RowColumnResultSet getAveragesResultSet() { + return averagesResultSet; + } + public RowColumnResultSet getStdResultSet() { + return stdResultSet; + } + public RowColumnResultSet getMinResultSet() { + return minResultSet; + } + public RowColumnResultSet getMaxResultSet() { + return maxResultSet; + } + + public void setFailed(boolean failed) { + this.failed = failed; + } + public void setMultiTrial(boolean multiTrial) { + isMultiTrial = multiTrial; + } + public void setAveragesResultSet(RowColumnResultSet averagesResultSet) { + this.averagesResultSet = averagesResultSet; + } + public void setStdResultSet(RowColumnResultSet stdResultSet) { + this.stdResultSet = stdResultSet; + } + public void setMinResultSet(RowColumnResultSet minResultSet) { + this.minResultSet = minResultSet; + } + public void setMaxResultSet(RowColumnResultSet maxResultSet) { + this.maxResultSet = maxResultSet; + } +} From 4085451a93073cc81ca7c855fcbb06a5db42c3dd Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Tue, 18 Feb 2025 16:31:41 -0500 Subject: [PATCH 14/14] refactoring post processing input, unit test for primary statistics --- .../cbit/vcell/client/ClientSimManager.java | 9 +- .../vcell/simdata/LangevinPostProcessor.java | 46 +++--- .../simdata/LangevinPostProcessorInput.java | 11 +- .../SpringSaLaDGoodReactionsTest.java | 2 +- .../simdata/LangevinPostProcessorTest.java | 137 ++++++++++++++++++ .../cbit/vcell/simdata/SimID_284673710_0_.ida | 91 ++++++++++++ .../cbit/vcell/simdata/SimID_284673710_1_.ida | 91 ++++++++++++ .../cbit/vcell/simdata/SimID_284673710_2_.ida | 91 ++++++++++++ 8 files changed, 442 insertions(+), 36 deletions(-) create mode 100644 vcell-core/src/test/java/cbit/vcell/simdata/LangevinPostProcessorTest.java create mode 100644 vcell-core/src/test/resources/cbit/vcell/simdata/SimID_284673710_0_.ida create mode 100644 vcell-core/src/test/resources/cbit/vcell/simdata/SimID_284673710_1_.ida create mode 100644 vcell-core/src/test/resources/cbit/vcell/simdata/SimID_284673710_2_.ida diff --git a/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java b/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java index 706903e264..d703fc85df 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java +++ b/vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java @@ -36,6 +36,7 @@ import cbit.vcell.simdata.*; import cbit.vcell.solver.*; import cbit.vcell.solver.ode.ODESimData; +import cbit.vcell.solver.ode.ODESolverResultSet; import cbit.vcell.solver.server.*; import cbit.vcell.util.ColumnDescription; import org.apache.logging.log4j.LogManager; @@ -236,18 +237,18 @@ public void postProcessLangevinResults(Simulation sim) { AsynchClientTask postProcessLangevinResultsTask = new AsynchClientTask("PostProcessLangevinResultsTask", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { public void run(Hashtable hashTable) throws Exception { - Map odeDataManagerMap = new LinkedHashMap<>(); + Map odeSolverResultSetMap = new LinkedHashMap<>(); try { for (int trialIndex = 0; trialIndex < numTrials; trialIndex++) { VCSimulationDataIdentifier vcSimulationDataIdentifier = new VCSimulationDataIdentifier(vcSimulationIdentifier, trialIndex); ODEDataManager dm = (ODEDataManager) getDocumentWindowManager().getRequestManager().getDataManager(null, vcSimulationDataIdentifier, false); - odeDataManagerMap.put(trialIndex, dm); + odeSolverResultSetMap.put(trialIndex, dm.getODESolverResultSet()); } } catch(DataAccessException dae) { System.out.println("ClientSimManager.postProcessLangevinResults() DataAccessException: " + dae.getMessage()); hashTable.put(LangevinPostProcessor.FAILURE_KEY, true); } - if(odeDataManagerMap.isEmpty()) { + if(odeSolverResultSetMap.isEmpty()) { System.out.println("ClientSimManager: no data"); hashTable.put(LangevinPostProcessor.FAILURE_KEY, true); } @@ -256,7 +257,7 @@ public void run(Hashtable hashTable) throws Exception { SimulationOwner simOwner = (SimulationOwner)hashTable.get(LangevinPostProcessor.SIMULATION_OWNER_KEY); LangevinPostProcessorInput lppInput = new LangevinPostProcessorInput(sim, simOwner); lppInput.setFailed((boolean)hashTable.get(LangevinPostProcessor.FAILURE_KEY)); - lppInput.setOdeDataManagerMap(odeDataManagerMap); + lppInput.setOdeSolverResultSetMap(odeSolverResultSetMap); LangevinPostProcessor lpp = new LangevinPostProcessor(); LangevinPostProcessorOutput lppOutput = lpp.postProcessLangevinResults(lppInput); diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java index a5e4764955..5fbbc940d3 100644 --- a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessor.java @@ -24,7 +24,7 @@ public class LangevinPostProcessor { boolean failure; Simulation sim; SimulationOwner simOwner; - Map odeDataManagerMap; + Map odeSolverResultSetMap; // the results RowColumnResultSet averagesResultSet; @@ -37,39 +37,35 @@ public LangevinPostProcessorOutput postProcessLangevinResults(LangevinPostProces sim = lppInput.getSimulation(); simOwner = lppInput.getSimulationOwner(); - LangevinPostProcessorOutput pllOut = new LangevinPostProcessorOutput(sim, simOwner); - + odeSolverResultSetMap = lppInput.getOdeSolverResultSetMap(); // key = trial index, value = simulation results (ODESolverResultSet object) for that trial failure = lppInput.isFailed(); - SolverTaskDescription std = sim.getSolverTaskDescription(); - int numTrials = std.getNumTrials(); - isMultiTrial = numTrials > 1 ? true : false; + isMultiTrial = odeSolverResultSetMap.size() > 1 ? true : false; + + LangevinPostProcessorOutput pllOut = new LangevinPostProcessorOutput(sim, simOwner); if(failure) { pllOut.setFailed(failure); pllOut.setMultiTrial(isMultiTrial); return pllOut; } - odeDataManagerMap = lppInput.getOdeDataManagerMap(); // key = trial index, value = simulation results (ODESimData object) for that trial - // probably useless at this point - SimulationInfo simInfo = sim.getSimulationInfo(); - VCSimulationIdentifier vcSimulationIdentifier = simInfo.getAuthoritativeVCSimulationIdentifier(); - MathOverrides mathOverrides = sim.getMathOverrides(); - SimulationVersion simVersion = simInfo.getSimulationVersion(); + if(sim != null) { + SimulationInfo simInfo = sim.getSimulationInfo(); + VCSimulationIdentifier vcSimulationIdentifier = simInfo.getAuthoritativeVCSimulationIdentifier(); + MathOverrides mathOverrides = sim.getMathOverrides(); + SimulationVersion simVersion = simInfo.getSimulationVersion(); + } try { - ODEDataManager tempODEDataManager = odeDataManagerMap.get(0); - ODESimData tempODESimData = (ODESimData) tempODEDataManager.getODESolverResultSet(); - String format = tempODESimData.getFormatID(); - String mathName = tempODESimData.getMathName(); // should be different instances? + ODESolverResultSet tempODESolverResultSet = odeSolverResultSetMap.get(0); // sanity check: shouldn't be, that only works for non-spatial stochastic where things are done differently - System.out.println("isGibsonMultiTrial: " + tempODEDataManager.getODESolverResultSet().isMultiTrialData()); + System.out.println("isGibsonMultiTrial: " + tempODESolverResultSet.isMultiTrialData()); - averagesResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.ZeroInitialize); - stdResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.ZeroInitialize); - minResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.CopyValues); - maxResultSet = RowColumnResultSet.deepCopy(tempODEDataManager.getODESolverResultSet(), RowColumnResultSet.DuplicateMode.CopyValues); + averagesResultSet = RowColumnResultSet.deepCopy(tempODESolverResultSet, RowColumnResultSet.DuplicateMode.ZeroInitialize); + stdResultSet = RowColumnResultSet.deepCopy(tempODESolverResultSet, RowColumnResultSet.DuplicateMode.ZeroInitialize); + minResultSet = RowColumnResultSet.deepCopy(tempODESolverResultSet, RowColumnResultSet.DuplicateMode.CopyValues); + maxResultSet = RowColumnResultSet.deepCopy(tempODESolverResultSet, RowColumnResultSet.DuplicateMode.CopyValues); calculateLangevinPrimaryStatistics(); // averages, standard deviation, min, max calculateLangevinAdvancedStatistics(); @@ -90,10 +86,9 @@ public LangevinPostProcessorOutput postProcessLangevinResults(LangevinPostProces private void calculateLangevinPrimaryStatistics() throws DataAccessException { - int numTrials = odeDataManagerMap.size(); + int numTrials = odeSolverResultSetMap.size(); for(int trialIndex = 0; trialIndex < numTrials; trialIndex++) { - ODEDataManager sourceOdm = odeDataManagerMap.get(trialIndex); - ODESolverResultSet sourceOsrs = sourceOdm.getODESolverResultSet(); + ODESolverResultSet sourceOsrs = odeSolverResultSetMap.get(trialIndex); int rowCount = sourceOsrs.getRowCount(); for (int row = 0; row < rowCount; row++) { double[] sourceRowData = sourceOsrs.getRow(row); @@ -119,8 +114,7 @@ private void calculateLangevinPrimaryStatistics() throws DataAccessException { } for(int trialIndex = 0; trialIndex < numTrials; trialIndex++) { - ODEDataManager sourceOdm = odeDataManagerMap.get(trialIndex); - ODESolverResultSet sourceOsrs = sourceOdm.getODESolverResultSet(); + ODESolverResultSet sourceOsrs = odeSolverResultSetMap.get(trialIndex); int rowCount = sourceOsrs.getRowCount(); for (int row = 0; row < rowCount; row++) { double[] sourceRowData = sourceOsrs.getRow(row); diff --git a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessorInput.java b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessorInput.java index 8b5b58e1ae..3aa38374ef 100644 --- a/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessorInput.java +++ b/vcell-core/src/main/java/cbit/vcell/simdata/LangevinPostProcessorInput.java @@ -1,6 +1,7 @@ package cbit.vcell.simdata; import cbit.vcell.solver.*; +import cbit.vcell.solver.ode.ODESolverResultSet; import java.util.*; @@ -10,7 +11,7 @@ public class LangevinPostProcessorInput { private final Simulation sim; private final SimulationOwner simOwner; - Map odeDataManagerMap = new LinkedHashMap<>(); // key = trialIndex + Map odeSolverResultSetMap = new LinkedHashMap<>(); // key = trialIndex private boolean failed = false; @@ -26,15 +27,15 @@ public Simulation getSimulation() { public SimulationOwner getSimulationOwner() { return simOwner; } - public Map getOdeDataManagerMap() { - return odeDataManagerMap; + public Map getOdeSolverResultSetMap() { + return odeSolverResultSetMap; } public boolean isFailed() { return failed; } - public void setOdeDataManagerMap(Map odeDataManagerMap) { - this.odeDataManagerMap = odeDataManagerMap; + public void setOdeSolverResultSetMap(Map odeSolverResultSetMap) { + this.odeSolverResultSetMap = odeSolverResultSetMap; } public void setFailed(boolean failed) { this.failed = failed; diff --git a/vcell-core/src/test/java/cbit/vcell/biomodel/SpringSaLaDGoodReactionsTest.java b/vcell-core/src/test/java/cbit/vcell/biomodel/SpringSaLaDGoodReactionsTest.java index 50a85271e8..4f4d1fd090 100644 --- a/vcell-core/src/test/java/cbit/vcell/biomodel/SpringSaLaDGoodReactionsTest.java +++ b/vcell-core/src/test/java/cbit/vcell/biomodel/SpringSaLaDGoodReactionsTest.java @@ -146,7 +146,7 @@ public void test_springsalad_bad_reactions() throws IOException, XmlParseExcepti simContext.gatherIssues(issueContext, issueList, true); // bIgnoreMathDescription == true int numErrors = checkIssuesBySeverity(issueList, Issue.Severity.ERROR); int numWarnings = checkIssuesBySeverity(issueList, Issue.Severity.WARNING); - assertTrue((numErrors == 2 && numWarnings == 14) ? true : false, "expecting 1 errors and 14 warning issues"); + assertTrue((numErrors == 2 && numWarnings == 14) ? true : false, "expecting 2 errors and 14 warning issues"); } /* ------------------------------------------------------------------------------------------------------------------------- diff --git a/vcell-core/src/test/java/cbit/vcell/simdata/LangevinPostProcessorTest.java b/vcell-core/src/test/java/cbit/vcell/simdata/LangevinPostProcessorTest.java new file mode 100644 index 0000000000..f51613fee6 --- /dev/null +++ b/vcell-core/src/test/java/cbit/vcell/simdata/LangevinPostProcessorTest.java @@ -0,0 +1,137 @@ +package cbit.vcell.simdata; + +import cbit.vcell.math.ODESolverResultSetColumnDescription; +import cbit.vcell.solver.ode.ODESolverResultSet; +import com.google.common.io.Files; +import com.google.common.io.Resources; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; + +import java.io.*; +import java.util.LinkedHashMap; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@Tag("Fast") +public class LangevinPostProcessorTest { + + // the .IDA files are in vcell-core/src/test/java /cbit/vcell/simdata + static File ida_0_File; + static File ida_1_File; + static File ida_2_File; + + @BeforeAll + public static void setUp() throws IOException { + ida_0_File = File.createTempFile("SimID_284673710_0_", ".ida"); + Resources.asByteSource(Resources.getResource("cbit/vcell/simdata/SimID_284673710_0_.ida")) + .copyTo(Files.asByteSink(ida_0_File)); + ida_1_File = File.createTempFile("SimID_284673710_1_", ".ida"); + Resources.asByteSource(Resources.getResource("cbit/vcell/simdata/SimID_284673710_1_.ida")) + .copyTo(Files.asByteSink(ida_1_File)); + ida_2_File = File.createTempFile("SimID_284673710_2_", ".ida"); + Resources.asByteSource(Resources.getResource("cbit/vcell/simdata/SimID_284673710_2_.ida")) + .copyTo(Files.asByteSink(ida_2_File)); + } + + @AfterAll + public static void tearDown() { + + ida_0_File.delete(); + ida_1_File.delete(); + ida_2_File.delete(); +// if (inputStream != null) { +// inputStream.close(); + } + + @Test + public void testRead() throws IOException { + + // read the input data (3 .IDA files) + ODESolverResultSet osrs_0 = getOdeSolverResultSet(ida_0_File); + ODESolverResultSet osrs_1 = getOdeSolverResultSet(ida_1_File); + ODESolverResultSet osrs_2 = getOdeSolverResultSet(ida_2_File); + + Map odeSolverResultSetMap = new LinkedHashMap<>(); + odeSolverResultSetMap.put(0, osrs_0); + odeSolverResultSetMap.put(1, osrs_1); + odeSolverResultSetMap.put(2, osrs_2); + + LangevinPostProcessorInput lppInput = new LangevinPostProcessorInput(null, null); + lppInput.setFailed(false); + lppInput.setOdeSolverResultSetMap(odeSolverResultSetMap); + + // compute primary statistics + LangevinPostProcessor lpp = new LangevinPostProcessor(); + LangevinPostProcessorOutput lppOutput = lpp.postProcessLangevinResults(lppInput); + + assertFalse(lppOutput.isFailed(), "expected to not fail"); + assertTrue(lppOutput.isMultiTrial(), "expected to be multi-trial"); + + // get some timepoint for some variable + String name = osrs_0.getColumnDescriptions()[7].getName(); + double anAverage = lppOutput.getAveragesResultSet().getRow(10)[7]; // TOTAL_MT0__Site1__state0 + double aStd = lppOutput.getStdResultSet().getRow(10)[7]; + double aMin = lppOutput.getMinResultSet().getRow(10)[7]; + double aMax = lppOutput.getMaxResultSet().getRow(10)[7]; + + // compare to what's expected + assertTrue("TOTAL_MT0__Site1__state0".contentEquals(name), "expecting column name 'TOTAL_MT0__Site1__state0', found: '" + name + "'"); + assertTrue(anAverage == 21.0 ? true : false, "expecting 21.0, found " + anAverage); + assertTrue(aStd == 0.816496580927726 ? true : false, "expecting 0.816496580927726, found " + aStd); + assertTrue(aMin == 20.0 ? true : false, "expecting 20.0, found " + aMin); + assertTrue(aMax == 22.0 ? true : false, "expecting 22.0, found " + aMax); + } + + // + // ------- IDA file parsing / initializing ODESolverResultSet ----------------------------------------------------- + // + private static ODESolverResultSet getOdeSolverResultSet(File idaFile) throws IOException { + ODESolverResultSet odeSolverResultSet = new ODESolverResultSet(); + FileInputStream inputStream = null; + inputStream = new FileInputStream(idaFile); + if(readIDA(odeSolverResultSet, inputStream) == null) { + return null; + } + return (odeSolverResultSet); + } + private static ODESolverResultSet readIDA(ODESolverResultSet odeSolverResultSet, FileInputStream inputStream) throws IOException { + InputStreamReader inputStreamReader = new InputStreamReader(inputStream); + BufferedReader bufferedReader = new BufferedReader(inputStreamReader); + // read header + String line = bufferedReader.readLine(); + if (line == null) { + return null; + } + while (line.indexOf(':') > 0) { + String name = line.substring(0, line.indexOf(':')); + odeSolverResultSet.addDataColumn(new ODESolverResultSetColumnDescription(name)); + line = line.substring(line.indexOf(':') + 1); + } + // read data + while ((line = bufferedReader.readLine()) != null) { + line = line + " "; + double[] values = new double[odeSolverResultSet.getDataColumnCount()]; + boolean bCompleteRow = true; + for (int i = 0; i < odeSolverResultSet.getDataColumnCount(); i++) { + if (line.indexOf(' ')==-1) { // here and below we assume separator is ' ', in other cases might also be '\t' + bCompleteRow = false; + break; + }else{ + String value = line.substring(0, line.indexOf(' ')).trim(); + values[i] = Double.valueOf(value).doubleValue(); + line = line.substring(line.indexOf(' ') + 1); + } + } + if (bCompleteRow){ + odeSolverResultSet.addRow(values); + }else{ + break; + } + } + return odeSolverResultSet; + } +} diff --git a/vcell-core/src/test/resources/cbit/vcell/simdata/SimID_284673710_0_.ida b/vcell-core/src/test/resources/cbit/vcell/simdata/SimID_284673710_0_.ida new file mode 100644 index 0000000000..4d8d36c46d --- /dev/null +++ b/vcell-core/src/test/resources/cbit/vcell/simdata/SimID_284673710_0_.ida @@ -0,0 +1,91 @@ +t:TOTAL_MT0:FREE_MT0:BOUND_MT0:TOTAL_MT0__Site0__state0:FREE_MT0__Site0__state0:BOUND_MT0__Site0__state0:TOTAL_MT0__Site1__state0:FREE_MT0__Site1__state0:BOUND_MT0__Site1__state0:TOTAL_MT0__Site1__state1:FREE_MT0__Site1__state1:BOUND_MT0__Site1__state1 +0.0 30 30 0 30 30 0 30 30 0 0 0 0 +1.00009999999987E-4 30 30 0 30 30 0 30 30 0 0 0 0 +2.0000999999993522E-4 30 30 0 30 30 0 30 30 0 0 0 0 +3.0000999999988347E-4 30 30 0 30 30 0 28 28 0 2 2 0 +4.000099999998317E-4 30 30 0 30 30 0 28 28 0 2 2 0 +5.000099999998435E-4 30 30 0 30 30 0 27 27 0 3 3 0 +6.000000000003338E-4 30 30 0 30 30 0 27 27 0 3 3 0 +7.000000000008241E-4 30 30 0 30 30 0 25 25 0 5 5 0 +8.000000000013144E-4 30 30 0 30 30 0 22 22 0 8 8 0 +9.000000000018047E-4 30 30 0 30 30 0 22 22 0 8 8 0 +0.001000000000002041 30 30 0 30 30 0 20 20 0 10 10 0 +0.001100000000001447 30 30 0 30 30 0 19 19 0 11 11 0 +0.0012000000000008532 30 30 0 30 30 0 19 19 0 11 11 0 +0.0013000000000002593 30 30 0 30 30 0 18 18 0 12 12 0 +0.0014000099999996653 30 30 0 30 30 0 18 18 0 12 12 0 +0.0015000099999990715 30 30 0 30 30 0 17 17 0 13 13 0 +0.0016000099999984776 30 30 0 30 30 0 17 17 0 13 13 0 +0.0017000099999978837 30 30 0 30 30 0 17 17 0 13 13 0 +0.0018000099999972898 30 30 0 30 30 0 17 17 0 13 13 0 +0.001900009999996696 30 30 0 30 30 0 17 17 0 13 13 0 +0.002000009999996102 30 30 0 30 30 0 17 17 0 13 13 0 +0.002100009999995508 30 30 0 30 30 0 16 16 0 14 14 0 +0.0022000099999949143 30 30 0 30 30 0 16 16 0 14 14 0 +0.0023000099999943204 30 30 0 30 30 0 15 15 0 15 15 0 +0.0024000099999937265 30 30 0 30 30 0 14 14 0 16 16 0 +0.0025000099999931327 30 30 0 30 30 0 14 14 0 16 16 0 +0.0026000099999925388 30 30 0 30 30 0 14 14 0 16 16 0 +0.002700009999991945 30 30 0 30 30 0 13 13 0 17 17 0 +0.002800009999991351 30 30 0 30 30 0 13 13 0 17 17 0 +0.002900009999990757 30 30 0 30 30 0 13 13 0 17 17 0 +0.0030000099999901633 30 30 0 30 30 0 13 13 0 17 17 0 +0.0031000099999895694 30 30 0 30 30 0 13 13 0 17 17 0 +0.0032000099999889755 30 30 0 30 30 0 12 12 0 18 18 0 +0.0033000099999883816 30 30 0 30 30 0 12 12 0 18 18 0 +0.0034000099999877877 30 30 0 30 30 0 11 11 0 19 19 0 +0.003500009999987194 30 30 0 30 30 0 11 11 0 19 19 0 +0.0036000099999866 30 30 0 30 30 0 11 11 0 19 19 0 +0.003700009999986006 30 30 0 30 30 0 11 11 0 19 19 0 +0.003800009999985412 30 30 0 30 30 0 11 11 0 19 19 0 +0.0039000099999848183 30 30 0 30 30 0 11 11 0 19 19 0 +0.0040000099999842244 30 30 0 30 30 0 10 10 0 20 20 0 +0.004100009999983631 30 30 0 30 30 0 10 10 0 20 20 0 +0.004200009999983037 30 30 0 30 30 0 10 10 0 20 20 0 +0.004300009999982443 30 30 0 30 30 0 9 9 0 21 21 0 +0.004400009999981849 30 30 0 30 30 0 9 9 0 21 21 0 +0.004500009999981255 30 30 0 30 30 0 9 9 0 21 21 0 +0.004600009999980661 30 30 0 30 30 0 8 8 0 22 22 0 +0.004700009999980067 30 30 0 30 30 0 8 8 0 22 22 0 +0.004800009999979473 30 30 0 30 30 0 8 8 0 22 22 0 +0.0049000099999788795 30 30 0 30 30 0 8 8 0 22 22 0 +0.005000009999978286 30 30 0 30 30 0 7 7 0 23 23 0 +0.005100009999977692 30 30 0 30 30 0 7 7 0 23 23 0 +0.005200009999977098 30 30 0 30 30 0 7 7 0 23 23 0 +0.005300009999976504 30 30 0 30 30 0 7 7 0 23 23 0 +0.00540000999997591 30 30 0 30 30 0 7 7 0 23 23 0 +0.005500009999975316 30 30 0 30 30 0 7 7 0 23 23 0 +0.005600009999974722 30 30 0 30 30 0 7 7 0 23 23 0 +0.0057000099999741285 30 30 0 30 30 0 7 7 0 23 23 0 +0.005800009999973535 30 30 0 30 30 0 7 7 0 23 23 0 +0.005900009999972941 30 30 0 30 30 0 7 7 0 23 23 0 +0.006000009999972347 30 30 0 30 30 0 7 7 0 23 23 0 +0.006100009999971753 30 30 0 30 30 0 7 7 0 23 23 0 +0.006200009999971159 30 30 0 30 30 0 7 7 0 23 23 0 +0.006300009999970565 30 30 0 30 30 0 7 7 0 23 23 0 +0.006400009999969971 30 30 0 30 30 0 7 7 0 23 23 0 +0.0065000099999693774 30 30 0 30 30 0 6 6 0 24 24 0 +0.0066000099999687836 30 30 0 30 30 0 6 6 0 24 24 0 +0.00670000999996819 30 30 0 30 30 0 6 6 0 24 24 0 +0.006800009999967596 30 30 0 30 30 0 5 5 0 25 25 0 +0.006900009999967002 30 30 0 30 30 0 4 4 0 26 26 0 +0.007000009999966408 30 30 0 30 30 0 4 4 0 26 26 0 +0.007100009999965814 30 30 0 30 30 0 4 4 0 26 26 0 +0.00720000999996522 30 30 0 30 30 0 4 4 0 26 26 0 +0.007300009999964626 30 30 0 30 30 0 4 4 0 26 26 0 +0.0074000099999640325 30 30 0 30 30 0 4 4 0 26 26 0 +0.007500009999963439 30 30 0 30 30 0 4 4 0 26 26 0 +0.007600009999962845 30 30 0 30 30 0 4 4 0 26 26 0 +0.007700009999962251 30 30 0 30 30 0 4 4 0 26 26 0 +0.007800009999961657 30 30 0 30 30 0 4 4 0 26 26 0 +0.007900009999961063 30 30 0 30 30 0 3 3 0 27 27 0 +0.00800000999996047 30 30 0 30 30 0 3 3 0 27 27 0 +0.008100009999959875 30 30 0 30 30 0 3 3 0 27 27 0 +0.008200009999959281 30 30 0 30 30 0 3 3 0 27 27 0 +0.008300009999958688 30 30 0 30 30 0 3 3 0 27 27 0 +0.008400009999958094 30 30 0 30 30 0 3 3 0 27 27 0 +0.0085000099999575 30 30 0 30 30 0 3 3 0 27 27 0 +0.008600009999956906 30 30 0 30 30 0 3 3 0 27 27 0 +0.008700009999956312 30 30 0 30 30 0 3 3 0 27 27 0 +0.008800009999955718 30 30 0 30 30 0 3 3 0 27 27 0 +0.008900009999955124 30 30 0 30 30 0 3 3 0 27 27 0 diff --git a/vcell-core/src/test/resources/cbit/vcell/simdata/SimID_284673710_1_.ida b/vcell-core/src/test/resources/cbit/vcell/simdata/SimID_284673710_1_.ida new file mode 100644 index 0000000000..82984e6e0e --- /dev/null +++ b/vcell-core/src/test/resources/cbit/vcell/simdata/SimID_284673710_1_.ida @@ -0,0 +1,91 @@ +t:TOTAL_MT0:FREE_MT0:BOUND_MT0:TOTAL_MT0__Site0__state0:FREE_MT0__Site0__state0:BOUND_MT0__Site0__state0:TOTAL_MT0__Site1__state0:FREE_MT0__Site1__state0:BOUND_MT0__Site1__state0:TOTAL_MT0__Site1__state1:FREE_MT0__Site1__state1:BOUND_MT0__Site1__state1 +0.0 30 30 0 30 30 0 30 30 0 0 0 0 +1.00009999999987E-4 30 30 0 30 30 0 28 28 0 2 2 0 +2.0000999999993522E-4 30 30 0 30 30 0 27 27 0 3 3 0 +3.0000999999988347E-4 30 30 0 30 30 0 27 27 0 3 3 0 +4.000099999998317E-4 30 30 0 30 30 0 27 27 0 3 3 0 +5.000099999998435E-4 30 30 0 30 30 0 27 27 0 3 3 0 +6.000000000003338E-4 30 30 0 30 30 0 27 27 0 3 3 0 +7.000000000008241E-4 30 30 0 30 30 0 26 26 0 4 4 0 +8.000000000013144E-4 30 30 0 30 30 0 24 24 0 6 6 0 +9.000000000018047E-4 30 30 0 30 30 0 23 23 0 7 7 0 +0.001000000000002041 30 30 0 30 30 0 22 22 0 8 8 0 +0.001100000000001447 30 30 0 30 30 0 22 22 0 8 8 0 +0.0012000000000008532 30 30 0 30 30 0 22 22 0 8 8 0 +0.0013000000000002593 30 30 0 30 30 0 21 21 0 9 9 0 +0.0014000099999996653 30 30 0 30 30 0 21 21 0 9 9 0 +0.0015000099999990715 30 30 0 30 30 0 19 19 0 11 11 0 +0.0016000099999984776 30 30 0 30 30 0 19 19 0 11 11 0 +0.0017000099999978837 30 30 0 30 30 0 18 18 0 12 12 0 +0.0018000099999972898 30 30 0 30 30 0 18 18 0 12 12 0 +0.001900009999996696 30 30 0 30 30 0 16 16 0 14 14 0 +0.002000009999996102 30 30 0 30 30 0 16 16 0 14 14 0 +0.002100009999995508 30 30 0 30 30 0 16 16 0 14 14 0 +0.0022000099999949143 30 30 0 30 30 0 14 14 0 16 16 0 +0.0023000099999943204 30 30 0 30 30 0 13 13 0 17 17 0 +0.0024000099999937265 30 30 0 30 30 0 12 12 0 18 18 0 +0.0025000099999931327 30 30 0 30 30 0 12 12 0 18 18 0 +0.0026000099999925388 30 30 0 30 30 0 11 11 0 19 19 0 +0.002700009999991945 30 30 0 30 30 0 10 10 0 20 20 0 +0.002800009999991351 30 30 0 30 30 0 10 10 0 20 20 0 +0.002900009999990757 30 30 0 30 30 0 9 9 0 21 21 0 +0.0030000099999901633 30 30 0 30 30 0 7 7 0 23 23 0 +0.0031000099999895694 30 30 0 30 30 0 7 7 0 23 23 0 +0.0032000099999889755 30 30 0 30 30 0 7 7 0 23 23 0 +0.0033000099999883816 30 30 0 30 30 0 6 6 0 24 24 0 +0.0034000099999877877 30 30 0 30 30 0 6 6 0 24 24 0 +0.003500009999987194 30 30 0 30 30 0 6 6 0 24 24 0 +0.0036000099999866 30 30 0 30 30 0 5 5 0 25 25 0 +0.003700009999986006 30 30 0 30 30 0 5 5 0 25 25 0 +0.003800009999985412 30 30 0 30 30 0 5 5 0 25 25 0 +0.0039000099999848183 30 30 0 30 30 0 4 4 0 26 26 0 +0.0040000099999842244 30 30 0 30 30 0 4 4 0 26 26 0 +0.004100009999983631 30 30 0 30 30 0 4 4 0 26 26 0 +0.004200009999983037 30 30 0 30 30 0 4 4 0 26 26 0 +0.004300009999982443 30 30 0 30 30 0 4 4 0 26 26 0 +0.004400009999981849 30 30 0 30 30 0 2 2 0 28 28 0 +0.004500009999981255 30 30 0 30 30 0 1 1 0 29 29 0 +0.004600009999980661 30 30 0 30 30 0 1 1 0 29 29 0 +0.004700009999980067 30 30 0 30 30 0 1 1 0 29 29 0 +0.004800009999979473 30 30 0 30 30 0 1 1 0 29 29 0 +0.0049000099999788795 30 30 0 30 30 0 1 1 0 29 29 0 +0.005000009999978286 30 30 0 30 30 0 1 1 0 29 29 0 +0.005100009999977692 30 30 0 30 30 0 1 1 0 29 29 0 +0.005200009999977098 30 30 0 30 30 0 1 1 0 29 29 0 +0.005300009999976504 30 30 0 30 30 0 1 1 0 29 29 0 +0.00540000999997591 30 30 0 30 30 0 1 1 0 29 29 0 +0.005500009999975316 30 30 0 30 30 0 1 1 0 29 29 0 +0.005600009999974722 30 30 0 30 30 0 1 1 0 29 29 0 +0.0057000099999741285 30 30 0 30 30 0 1 1 0 29 29 0 +0.005800009999973535 30 30 0 30 30 0 1 1 0 29 29 0 +0.005900009999972941 30 30 0 30 30 0 1 1 0 29 29 0 +0.006000009999972347 30 30 0 30 30 0 1 1 0 29 29 0 +0.006100009999971753 30 30 0 30 30 0 1 1 0 29 29 0 +0.006200009999971159 30 30 0 30 30 0 1 1 0 29 29 0 +0.006300009999970565 30 30 0 30 30 0 1 1 0 29 29 0 +0.006400009999969971 30 30 0 30 30 0 1 1 0 29 29 0 +0.0065000099999693774 30 30 0 30 30 0 1 1 0 29 29 0 +0.0066000099999687836 30 30 0 30 30 0 1 1 0 29 29 0 +0.00670000999996819 30 30 0 30 30 0 1 1 0 29 29 0 +0.006800009999967596 30 30 0 30 30 0 1 1 0 29 29 0 +0.006900009999967002 30 30 0 30 30 0 1 1 0 29 29 0 +0.007000009999966408 30 30 0 30 30 0 1 1 0 29 29 0 +0.007100009999965814 30 30 0 30 30 0 1 1 0 29 29 0 +0.00720000999996522 30 30 0 30 30 0 1 1 0 29 29 0 +0.007300009999964626 30 30 0 30 30 0 1 1 0 29 29 0 +0.0074000099999640325 30 30 0 30 30 0 1 1 0 29 29 0 +0.007500009999963439 30 30 0 30 30 0 1 1 0 29 29 0 +0.007600009999962845 30 30 0 30 30 0 0 0 0 30 30 0 +0.007700009999962251 30 30 0 30 30 0 0 0 0 30 30 0 +0.007800009999961657 30 30 0 30 30 0 0 0 0 30 30 0 +0.007900009999961063 30 30 0 30 30 0 0 0 0 30 30 0 +0.00800000999996047 30 30 0 30 30 0 0 0 0 30 30 0 +0.008100009999959875 30 30 0 30 30 0 0 0 0 30 30 0 +0.008200009999959281 30 30 0 30 30 0 0 0 0 30 30 0 +0.008300009999958688 30 30 0 30 30 0 0 0 0 30 30 0 +0.008400009999958094 30 30 0 30 30 0 0 0 0 30 30 0 +0.0085000099999575 30 30 0 30 30 0 0 0 0 30 30 0 +0.008600009999956906 30 30 0 30 30 0 0 0 0 30 30 0 +0.008700009999956312 30 30 0 30 30 0 0 0 0 30 30 0 +0.008800009999955718 30 30 0 30 30 0 0 0 0 30 30 0 +0.008900009999955124 30 30 0 30 30 0 0 0 0 30 30 0 diff --git a/vcell-core/src/test/resources/cbit/vcell/simdata/SimID_284673710_2_.ida b/vcell-core/src/test/resources/cbit/vcell/simdata/SimID_284673710_2_.ida new file mode 100644 index 0000000000..a5c1c8aae2 --- /dev/null +++ b/vcell-core/src/test/resources/cbit/vcell/simdata/SimID_284673710_2_.ida @@ -0,0 +1,91 @@ +t:TOTAL_MT0:FREE_MT0:BOUND_MT0:TOTAL_MT0__Site0__state0:FREE_MT0__Site0__state0:BOUND_MT0__Site0__state0:TOTAL_MT0__Site1__state0:FREE_MT0__Site1__state0:BOUND_MT0__Site1__state0:TOTAL_MT0__Site1__state1:FREE_MT0__Site1__state1:BOUND_MT0__Site1__state1 +0.0 30 30 0 30 30 0 30 30 0 0 0 0 +1.00009999999987E-4 30 30 0 30 30 0 30 30 0 0 0 0 +2.0000999999993522E-4 30 30 0 30 30 0 28 28 0 2 2 0 +3.0000999999988347E-4 30 30 0 30 30 0 27 27 0 3 3 0 +4.000099999998317E-4 30 30 0 30 30 0 27 27 0 3 3 0 +5.000099999998435E-4 30 30 0 30 30 0 25 25 0 5 5 0 +6.000000000003338E-4 30 30 0 30 30 0 25 25 0 5 5 0 +7.000000000008241E-4 30 30 0 30 30 0 25 25 0 5 5 0 +8.000000000013144E-4 30 30 0 30 30 0 21 21 0 9 9 0 +9.000000000018047E-4 30 30 0 30 30 0 21 21 0 9 9 0 +0.001000000000002041 30 30 0 30 30 0 21 21 0 9 9 0 +0.001100000000001447 30 30 0 30 30 0 19 19 0 11 11 0 +0.0012000000000008532 30 30 0 30 30 0 18 18 0 12 12 0 +0.0013000000000002593 30 30 0 30 30 0 18 18 0 12 12 0 +0.0014000099999996653 30 30 0 30 30 0 18 18 0 12 12 0 +0.0015000099999990715 30 30 0 30 30 0 18 18 0 12 12 0 +0.0016000099999984776 30 30 0 30 30 0 16 16 0 14 14 0 +0.0017000099999978837 30 30 0 30 30 0 16 16 0 14 14 0 +0.0018000099999972898 30 30 0 30 30 0 16 16 0 14 14 0 +0.001900009999996696 30 30 0 30 30 0 16 16 0 14 14 0 +0.002000009999996102 30 30 0 30 30 0 15 15 0 15 15 0 +0.002100009999995508 30 30 0 30 30 0 15 15 0 15 15 0 +0.0022000099999949143 30 30 0 30 30 0 15 15 0 15 15 0 +0.0023000099999943204 30 30 0 30 30 0 15 15 0 15 15 0 +0.0024000099999937265 30 30 0 30 30 0 15 15 0 15 15 0 +0.0025000099999931327 30 30 0 30 30 0 13 13 0 17 17 0 +0.0026000099999925388 30 30 0 30 30 0 12 12 0 18 18 0 +0.002700009999991945 30 30 0 30 30 0 12 12 0 18 18 0 +0.002800009999991351 30 30 0 30 30 0 12 12 0 18 18 0 +0.002900009999990757 30 30 0 30 30 0 12 12 0 18 18 0 +0.0030000099999901633 30 30 0 30 30 0 11 11 0 19 19 0 +0.0031000099999895694 30 30 0 30 30 0 11 11 0 19 19 0 +0.0032000099999889755 30 30 0 30 30 0 11 11 0 19 19 0 +0.0033000099999883816 30 30 0 30 30 0 11 11 0 19 19 0 +0.0034000099999877877 30 30 0 30 30 0 10 10 0 20 20 0 +0.003500009999987194 30 30 0 30 30 0 9 9 0 21 21 0 +0.0036000099999866 30 30 0 30 30 0 9 9 0 21 21 0 +0.003700009999986006 30 30 0 30 30 0 8 8 0 22 22 0 +0.003800009999985412 30 30 0 30 30 0 8 8 0 22 22 0 +0.0039000099999848183 30 30 0 30 30 0 8 8 0 22 22 0 +0.0040000099999842244 30 30 0 30 30 0 8 8 0 22 22 0 +0.004100009999983631 30 30 0 30 30 0 8 8 0 22 22 0 +0.004200009999983037 30 30 0 30 30 0 7 7 0 23 23 0 +0.004300009999982443 30 30 0 30 30 0 7 7 0 23 23 0 +0.004400009999981849 30 30 0 30 30 0 7 7 0 23 23 0 +0.004500009999981255 30 30 0 30 30 0 7 7 0 23 23 0 +0.004600009999980661 30 30 0 30 30 0 6 6 0 24 24 0 +0.004700009999980067 30 30 0 30 30 0 5 5 0 25 25 0 +0.004800009999979473 30 30 0 30 30 0 5 5 0 25 25 0 +0.0049000099999788795 30 30 0 30 30 0 5 5 0 25 25 0 +0.005000009999978286 30 30 0 30 30 0 4 4 0 26 26 0 +0.005100009999977692 30 30 0 30 30 0 4 4 0 26 26 0 +0.005200009999977098 30 30 0 30 30 0 4 4 0 26 26 0 +0.005300009999976504 30 30 0 30 30 0 4 4 0 26 26 0 +0.00540000999997591 30 30 0 30 30 0 4 4 0 26 26 0 +0.005500009999975316 30 30 0 30 30 0 4 4 0 26 26 0 +0.005600009999974722 30 30 0 30 30 0 4 4 0 26 26 0 +0.0057000099999741285 30 30 0 30 30 0 4 4 0 26 26 0 +0.005800009999973535 30 30 0 30 30 0 4 4 0 26 26 0 +0.005900009999972941 30 30 0 30 30 0 4 4 0 26 26 0 +0.006000009999972347 30 30 0 30 30 0 4 4 0 26 26 0 +0.006100009999971753 30 30 0 30 30 0 4 4 0 26 26 0 +0.006200009999971159 30 30 0 30 30 0 4 4 0 26 26 0 +0.006300009999970565 30 30 0 30 30 0 4 4 0 26 26 0 +0.006400009999969971 30 30 0 30 30 0 4 4 0 26 26 0 +0.0065000099999693774 30 30 0 30 30 0 4 4 0 26 26 0 +0.0066000099999687836 30 30 0 30 30 0 4 4 0 26 26 0 +0.00670000999996819 30 30 0 30 30 0 4 4 0 26 26 0 +0.006800009999967596 30 30 0 30 30 0 4 4 0 26 26 0 +0.006900009999967002 30 30 0 30 30 0 4 4 0 26 26 0 +0.007000009999966408 30 30 0 30 30 0 4 4 0 26 26 0 +0.007100009999965814 30 30 0 30 30 0 4 4 0 26 26 0 +0.00720000999996522 30 30 0 30 30 0 4 4 0 26 26 0 +0.007300009999964626 30 30 0 30 30 0 3 3 0 27 27 0 +0.0074000099999640325 30 30 0 30 30 0 3 3 0 27 27 0 +0.007500009999963439 30 30 0 30 30 0 3 3 0 27 27 0 +0.007600009999962845 30 30 0 30 30 0 3 3 0 27 27 0 +0.007700009999962251 30 30 0 30 30 0 2 2 0 28 28 0 +0.007800009999961657 30 30 0 30 30 0 1 1 0 29 29 0 +0.007900009999961063 30 30 0 30 30 0 1 1 0 29 29 0 +0.00800000999996047 30 30 0 30 30 0 1 1 0 29 29 0 +0.008100009999959875 30 30 0 30 30 0 1 1 0 29 29 0 +0.008200009999959281 30 30 0 30 30 0 1 1 0 29 29 0 +0.008300009999958688 30 30 0 30 30 0 1 1 0 29 29 0 +0.008400009999958094 30 30 0 30 30 0 1 1 0 29 29 0 +0.0085000099999575 30 30 0 30 30 0 1 1 0 29 29 0 +0.008600009999956906 30 30 0 30 30 0 1 1 0 29 29 0 +0.008700009999956312 30 30 0 30 30 0 1 1 0 29 29 0 +0.008800009999955718 30 30 0 30 30 0 1 1 0 29 29 0 +0.008900009999955124 30 30 0 30 30 0 1 1 0 29 29 0