Skip to content

Commit

Permalink
WIP: N5Exporter - first look
Browse files Browse the repository at this point in the history
  • Loading branch information
jcschaff committed Aug 23, 2023
1 parent ab104f3 commit 997a96f
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions vcell-core/src/main/java/cbit/vcell/simdata/n5/N5Exporter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package cbit.vcell.simdata.n5;

import cbit.vcell.export.server.ExportConstants;
import cbit.vcell.resource.PropertyLoader;
import cbit.vcell.simdata.*;
import cbit.vcell.solver.VCSimulationDataIdentifier;
import cbit.vcell.solver.VCSimulationIdentifier;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.vcell.util.document.KeyValue;
import org.vcell.util.document.User;

import java.io.File;
import java.util.Arrays;

public class N5Exporter implements ExportConstants {
private final static Logger lg = LogManager.getLogger(N5Exporter.class);

public N5Exporter() {

}

public static void main(String[] args) throws Exception {
String primaryDirStr = "~/.vcell/simdata/temp";
PropertyLoader.loadProperties();
//System.setProperty(PropertyLoader.installationRoot,"/Users/schaff/workspace/vcell");
User user = new User("schaff", new KeyValue("17"));
KeyValue simKey = new KeyValue("1128909032");
VCSimulationIdentifier vcSimID = new VCSimulationIdentifier(simKey, user);
VCSimulationDataIdentifier vcdID = new VCSimulationDataIdentifier(vcSimID, 0);

Cachetable cachetable = new Cachetable(10 * Cachetable.minute, 1000000L);
File primaryDir = new File(primaryDirStr);
DataSetControllerImpl dataSetControllerImpl = new DataSetControllerImpl(cachetable, primaryDir, null);
double[] allTimes = dataSetControllerImpl.getDataSetTimes(vcdID);

// get dataset identifier for vcSimID
VCData vcData = dataSetControllerImpl.getVCData(vcdID);
OutputContext outputContext = new OutputContext(null);
DataIdentifier[] dataIdentifiers = vcData.getVarAndFunctionDataIdentifiers(outputContext);
DataIdentifier DexDataIdentifier = Arrays.stream(dataIdentifiers).filter(di -> di.getName().equals("Dex")).findFirst().get();
SimDataBlock simDataBlock = vcData.getSimDataBlock(outputContext, DexDataIdentifier.getName(), allTimes[0]);
double[] Dex_dataBlockValues = simDataBlock.getData(); // X,Y,Z raster for time 0 for variable cAMP
System.out.println("Dex_dataBlockValues.length = " + Dex_dataBlockValues.length);
System.out.println("Dex_dataBlockValues[0] = " + Dex_dataBlockValues[0]);

}
}

0 comments on commit 997a96f

Please sign in to comment.