Skip to content

Commit

Permalink
Revert "Changes to fix nonspatial data set in biosim mode"
Browse files Browse the repository at this point in the history
This reverts commit 429aee0.
  • Loading branch information
CodeByDrescher committed Apr 12, 2024
1 parent 429aee0 commit 7d76fff
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 27 deletions.
2 changes: 1 addition & 1 deletion vcell-cli/src/main/java/org/vcell/cli/run/SedmlJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ private void generateHDF5(SolverHandler solverHandler, HDF5ExecutionResults mast

Hdf5DataExtractor hdf5Extractor = new Hdf5DataExtractor(this.sedml, solverHandler.taskToTempSimulationMap, this.RESULTS_DIRECTORY_PATH);

Hdf5DataContainer partialHdf5File = hdf5Extractor.extractHdf5RelevantData(solverHandler.nonSpatialResults, solverHandler.spatialResults, masterHdf5File.isBioSimHdf5);
Hdf5DataContainer partialHdf5File = hdf5Extractor.extractHdf5RelevantData(solverHandler.nonSpatialResults, solverHandler.spatialResults);
masterHdf5File.addResults(this.sedml, partialHdf5File);

for (File tempH5File : solverHandler.spatialResults.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static Hdf5PreparedData prepareNonspatialData(Hdf5SedmlResults datasetWra
List<Long> dataDimensionList = new LinkedList<>();

Hdf5SedmlResultsNonspatial dataSourceNonspatial = (Hdf5SedmlResultsNonspatial) datasetWrapper.dataSource;
Map<DataSet, List<double[]>> dataSetMap = dataSourceNonspatial.dataItems.getDataSetMappings(report);
Map<DataSet, List<double[]>> dataSetMap = dataSourceNonspatial.allJobResults;
numDataSets = dataSetMap.keySet().size();

for (DataSet dataSet : dataSetMap.keySet()){
Expand All @@ -150,7 +150,7 @@ public static Hdf5PreparedData prepareNonspatialData(Hdf5SedmlResults datasetWra
int bufferOffset = 0;

for (DataSet dataSet : dataSetMap.keySet()) {
List<double[]> dataArrays = dataSourceNonspatial.dataItems.get(report, dataSet);
List<double[]> dataArrays = dataSourceNonspatial.allJobResults.get(dataSet);
for (double[] dataArray : dataArrays){
if (dataArray.length < numTimePoints){
double[] paddedArray = new double[Math.toIntExact(numTimePoints)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public Hdf5SedmlResultsNonspatial() {}
/**
* Map of all data contained within a job relevant to HDF5 formatted files
*/
public NonspatialDataMapping dataItems = new NonspatialDataMapping();
public Map<DataSet, List<double[]>> allJobResults = new LinkedHashMap<>();

}
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ public static Map<Report, List<Hdf5SedmlResults>> convertNonspatialResultsToSedm
for (DataSet dataSet : dataSetValues.keySet()){
NonspatialValueHolder dataSetValuesSource = dataSetValues.get(dataSet);

dataSourceNonspatial.dataItems.put(report, dataSet, new LinkedList<>());
dataSourceNonspatial.allJobResults.put(dataSet, new LinkedList<>());
dataSourceNonspatial.scanBounds = dataSetValuesSource.vcSimulation.getMathOverrides().getScanBounds();
dataSourceNonspatial.scanParameterNames = dataSetValuesSource.vcSimulation.getMathOverrides().getScannedConstantNames();
for (double[] data : dataSetValuesSource.listOfResultSets) {
dataSourceNonspatial.dataItems.get(report, dataSet).add(data);
dataSourceNonspatial.allJobResults.get(dataSet).add(data);
shapes.add(Integer.toString(data.length));
}

Expand Down
39 changes: 18 additions & 21 deletions vcell-cli/src/test/java/org/vcell/cli/run/hdf5/Hdf5WriterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,9 @@ public class Hdf5WriterTest {

public static HDF5ExecutionResults createExampleData() {

Report plotReport = new Report("report0", "Plot Report");
Report reportReport = new Report("report1", "Report Report");

DataSet t = new DataSet("t","t","t","#null");
DataSet s0 = new DataSet("s0","s0","s0","#null");
DataSet s1 = new DataSet("s1", "s1", "s1","#null");
plotReport.addDataSet(t); plotReport.addDataSet(s0); plotReport.addDataSet(s1);
reportReport.addDataSet(t); reportReport.addDataSet(s0); reportReport.addDataSet(s1);

Hdf5SedmlMetadata plotMetadata = new Hdf5SedmlMetadata();
plotMetadata._type = "SedPlot2D";
Expand Down Expand Up @@ -63,31 +58,33 @@ public static HDF5ExecutionResults createExampleData() {
plotDataSourceNonspatial.scanBounds = new int[0];
plotDataSourceNonspatial.scanParameterNames = new String[0];
plotDatasetWrapper.dataSource = plotDataSourceNonspatial;
plotDataSourceNonspatial.dataItems.put(plotReport, t, Arrays.asList(row_t));
plotDataSourceNonspatial.dataItems.put(plotReport, s0, Arrays.asList(row_S0_0));
plotDataSourceNonspatial.dataItems.put(plotReport, s1, Arrays.asList(row_S1));
Map<DataSet, List<double[]>> plotJob = new LinkedHashMap<>();
plotJob.put(t, Arrays.asList(row_t));
plotJob.put(s0, Arrays.asList(row_S0_0));
plotJob.put(s1, Arrays.asList(row_S1));
plotDataSourceNonspatial.allJobResults = plotJob;


Hdf5SedmlResults reportDatasetWrapper = new Hdf5SedmlResults();
reportDatasetWrapper.datasetMetadata = reportMetadata;
Hdf5SedmlResultsNonspatial reportDataSourceNonspatial = new Hdf5SedmlResultsNonspatial();
reportDataSourceNonspatial.scanBounds = new int[] { 2 }; // zero indexed?
reportDataSourceNonspatial.scanParameterNames = new String[] { "k1" };
reportDatasetWrapper.dataSource = reportDataSourceNonspatial;
reportDataSourceNonspatial.dataItems.put(reportReport, t, Arrays.asList(row_t, row_t, row_t));
reportDataSourceNonspatial.dataItems.put(reportReport, s0, Arrays.asList(row_S0_0, row_S0_1, row_S0_2));
reportDataSourceNonspatial.dataItems.put(reportReport, s1, Arrays.asList(row_S1, row_S1, row_S1));
Map<DataSet, List<double[]>> reportJob = new LinkedHashMap<>();
reportJob.put(t, Arrays.asList(row_t, row_t, row_t));
reportJob.put(s0, Arrays.asList(row_S0_0, row_S0_1, row_S0_2));
reportJob.put(s1, Arrays.asList(row_S1, row_S1, row_S1));
reportDataSourceNonspatial.allJobResults = reportJob;

Hdf5DataContainer hdf5FileWrapper = new Hdf5DataContainer();
String uri1 = "___0_export_NO_scan_test_1.sedml";
String uri2 = "___0_export_NO_scan_test_2.sedml";
List<Hdf5SedmlResults> wrappers1 = new ArrayList<>();
List<Hdf5SedmlResults> wrappers2 = new ArrayList<>();
wrappers1.add(plotDatasetWrapper);
wrappers2.add(reportDatasetWrapper);
hdf5FileWrapper.reportToUriMap.put(plotReport, uri1);
hdf5FileWrapper.reportToUriMap.put(reportReport, uri2);
hdf5FileWrapper.reportToResultsMap.put(plotReport, wrappers1);
hdf5FileWrapper.reportToResultsMap.put(reportReport, wrappers2);
Report report = new Report("simId","simName");
String uri = "___0_export_NO_scan_test.sedml";
List<Hdf5SedmlResults> wrappers = new ArrayList<>();
wrappers.add(plotDatasetWrapper);
wrappers.add(reportDatasetWrapper);
hdf5FileWrapper.reportToUriMap.put(report, uri);
hdf5FileWrapper.reportToResultsMap.put(report, wrappers);

HDF5ExecutionResults results = new HDF5ExecutionResults(true);
results.addResults(null, hdf5FileWrapper);
Expand Down

0 comments on commit 7d76fff

Please sign in to comment.