use of cbit.vcell.util.ColumnDescription in project vcell by virtualcell.
the class ODESolverPlotSpecificationPanel method initConnections.
/**
* Initializes connections
* @exception java.lang.Exception The exception description.
*/
@SuppressWarnings({ "serial", "unchecked" })
private void initConnections() throws java.lang.Exception {
// user code begin {1}
// user code end
getFilterPanel().addPropertyChangeListener(ivjEventHandler);
getYAxisChoice().addListSelectionListener(ivjEventHandler);
this.addPropertyChangeListener(ivjEventHandler);
getXAxisComboBox_frm().addItemListener(ivjEventHandler);
getLogSensCheckbox().addActionListener(ivjEventHandler);
getSensitivityParameterSlider().addChangeListener(ivjEventHandler);
connPtoP1SetTarget();
connPtoP3SetTarget();
getYAxisChoice().setCellRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
ODEDataInterface mdi = getMyDataInterface();
if (mdi == null) {
return this;
}
String varName = (String) value;
ColumnDescription cd = null;
try {
cd = mdi.getColumnDescription(varName);
} catch (ObjectNotFoundException e) {
e.printStackTrace();
}
if (cd instanceof FunctionColumnDescription && ((FunctionColumnDescription) cd).getIsUserDefined()) {
if (function_icon == null) {
function_icon = new ImageIcon(getClass().getResource("/icons/function_icon.png"));
}
setIcon(function_icon);
}
if (mdi.getDataSymbolMetadataResolver() != null && mdi.getDataSymbolMetadataResolver().getDataSymbolMetadata(varName) != null) {
DataSymbolMetadata dsm = mdi.getDataSymbolMetadataResolver().getDataSymbolMetadata(varName);
String tooltipString = dsm.tooltipString;
if (tooltipString == null) {
tooltipString = varName;
}
setToolTipText(tooltipString);
}
return this;
}
});
}
use of cbit.vcell.util.ColumnDescription in project vcell by virtualcell.
the class MathTestingUtilities method compareUnEqualResultSets.
/**
* Insert the method's description here.
* Creation date: (1/17/2003 3:48:36 PM)
* @param testResultSet cbit.vcell.solver.ode.ODESolverResultSet
* @param referenceResultSet cbit.vcell.solver.ode.ODESolverResultSet
*/
public static SimulationComparisonSummary compareUnEqualResultSets(ODESolverResultSet testResultSet, ODESolverResultSet referenceResultSet, String[] varsToTest, double absErrorThreshold, double relErrorThreshold, int interpolationOrder) throws Exception {
if (varsToTest == null) {
throw new IllegalArgumentException("varsToTest must not be null");
}
SimulationComparisonSummary simComparisonSummary = new SimulationComparisonSummary();
int testTimeOrHistogramIndex = testResultSet.findColumn(ReservedVariable.TIME.getName());
int refTimeOrHistogramIndex = referenceResultSet.findColumn(ReservedVariable.TIME.getName());
if (testTimeOrHistogramIndex < 0 && refTimeOrHistogramIndex < 0) {
testTimeOrHistogramIndex = testResultSet.findColumn(SimDataConstants.HISTOGRAM_INDEX_NAME);
refTimeOrHistogramIndex = referenceResultSet.findColumn(SimDataConstants.HISTOGRAM_INDEX_NAME);
}
double[] testRSTimes = testResultSet.extractColumn(testTimeOrHistogramIndex);
double[] refRSTimes = referenceResultSet.extractColumn(refTimeOrHistogramIndex);
for (int i = 0; i < varsToTest.length; i++) {
int refRSIndex = referenceResultSet.findColumn(varsToTest[i]);
if (refRSIndex == -1) {
if (varsToTest[i].endsWith(AbstractMathMapping.MATH_VAR_SUFFIX_SPECIES_COUNT)) {
String varNameWithoutCount = varsToTest[i].replace(AbstractMathMapping.MATH_VAR_SUFFIX_SPECIES_COUNT, "");
refRSIndex = referenceResultSet.findColumn(varNameWithoutCount);
if (refRSIndex == -1) {
throw new RuntimeException("neither variable '" + varsToTest[i] + "' nor '" + varNameWithoutCount + "' found in reference dataset");
}
} else {
throw new RuntimeException("variable '" + varsToTest[i] + "' not found in reference dataset");
}
}
ColumnDescription refColDesc = referenceResultSet.getColumnDescriptions(refRSIndex);
double[] refData = referenceResultSet.extractColumn(refRSIndex);
int testRSIndex = testResultSet.findColumn(varsToTest[i]);
if (testRSIndex == -1) {
throw new RuntimeException("variable '" + varsToTest[i] + "' not found in test dataset");
}
double[] testData = testResultSet.extractColumn(testRSIndex);
// Resampling test data
double[] resampledTestData = interpolateArray(refRSTimes, testRSTimes, testData, interpolationOrder);
DataErrorSummary tempVar = new DataErrorSummary();
for (int j = 0; j < refData.length; j++) {
tempVar.addDataValues(refData[j], resampledTestData[j], refRSTimes[j], 0, absErrorThreshold, relErrorThreshold);
}
simComparisonSummary.addVariableComparisonSummary(new VariableComparisonSummary(refColDesc.getName(), tempVar.getMinRef(), tempVar.getMaxRef(), tempVar.getMaxAbsoluteError(), tempVar.getMaxRelativeError(), tempVar.getL2Norm(), tempVar.getTimeAtMaxAbsoluteError(), tempVar.getIndexAtMaxAbsoluteError(), tempVar.getTimeAtMaxRelativeError(), tempVar.getIndexAtMaxRelativeError()));
}
return simComparisonSummary;
}
use of cbit.vcell.util.ColumnDescription in project vcell by virtualcell.
the class MathTestingUtilities method compareResultSets.
/**
* Insert the method's description here.
* Creation date: (1/17/2003 3:48:36 PM)
* @param testResultSet cbit.vcell.solver.ode.ODESolverResultSet
* @param referenceResultSet cbit.vcell.solver.ode.ODESolverResultSet
*/
public static SimulationComparisonSummary compareResultSets(ODESolverResultSet testResultSet, ODESolverResultSet referenceResultSet, String[] varsToTest, String type, double absErrorThreshold, double relErrorThreshold) throws Exception {
if (varsToTest == null) {
throw new IllegalArgumentException("varsToTest must not be null");
}
SimulationComparisonSummary simComparisonSummary = new SimulationComparisonSummary();
double[] timeData = referenceResultSet.extractColumn(referenceResultSet.findColumn(ODESolverResultSet.TIME_COLUMN));
for (int i = 0; i < varsToTest.length; i++) {
int refRSIndex = referenceResultSet.findColumn(varsToTest[i]);
if (refRSIndex == -1) {
throw new RuntimeException("variable '" + varsToTest[i] + "' not found in reference dataset");
}
ColumnDescription refColDesc = referenceResultSet.getColumnDescriptions(refRSIndex);
double[] refData = referenceResultSet.extractColumn(refRSIndex);
int testRSIndex = testResultSet.findColumn(varsToTest[i]);
if (testRSIndex == -1) {
throw new RuntimeException("variable '" + varsToTest[i] + "' not found in test dataset");
}
double[] testData = testResultSet.extractColumn(testRSIndex);
DataErrorSummary tempVar = new DataErrorSummary();
for (int j = 0; j < refData.length; j++) {
if (type.equals(TestCaseNew.EXACT_STEADY)) {
if (j != (refData.length - 1)) {
continue;
}
}
tempVar.addDataValues(refData[j], testData[j], timeData[j], 0, absErrorThreshold, relErrorThreshold);
}
simComparisonSummary.addVariableComparisonSummary(new VariableComparisonSummary(refColDesc.getName(), tempVar.getMinRef(), tempVar.getMaxRef(), tempVar.getMaxAbsoluteError(), tempVar.getMaxRelativeError(), tempVar.getL2Norm(), tempVar.getTimeAtMaxAbsoluteError(), tempVar.getIndexAtMaxAbsoluteError(), tempVar.getTimeAtMaxRelativeError(), tempVar.getIndexAtMaxRelativeError()));
}
return simComparisonSummary;
}
use of cbit.vcell.util.ColumnDescription in project vcell by virtualcell.
the class ODESolverPlotSpecificationPanel method getSensitivityParameter.
/**
* // Method to obtain the sensitivity parameter (if applicable). The method checks the column description names in the
* // result set to find any column description that begins with the substring "sens" and contains the substring "wrt_".
* // If there is, then the last portion of that column description name is the parameter name. The sensitivity parameter
* // is also stored as a function column description in the result set (as a constant function). The value is extracted
* // from the result set, and a new Constant is created (with the name and value of the parameter) and returned. If no
* // column description starts with the substring "sens" or if the column for the parameter does not exist in the result
* // set, the method returns null.
*/
private Constant getSensitivityParameter() throws ExpressionException {
String sensParamName = "";
ColumnDescription[] fcds = getMyDataInterface().getAllColumnDescriptions();
// Check for any column description name that starts with the substring "sens" and contains "wrt_".
for (int i = 0; i < fcds.length; i++) {
if (fcds[i].getName().startsWith("sens_")) {
int c = fcds[i].getName().indexOf("wrt_");
sensParamName = fcds[i].getName().substring(c + 4);
if (!sensParamName.equals(null) || !sensParamName.equals("")) {
break;
}
}
}
double sensParamValue = 0.0;
if (sensParamName.equals("")) {
return null;
}
// If the sens param column exists in the result set, create a Constant and return it, else return null.
try {
sensParamValue = getMyDataInterface().extractColumn(sensParamName)[1];
} catch (ObjectNotFoundException e) {
// System.out.println("REUSULT SET DOES NOT HAVE SENSITIVITY ANALYSIS");
return null;
}
Constant sensParam = new Constant(sensParamName, new Expression(sensParamValue));
return sensParam;
}
use of cbit.vcell.util.ColumnDescription in project vcell by virtualcell.
the class ODEDataInterfaceImpl method getFilteredColumnDescriptions.
@Override
public ColumnDescription[] getFilteredColumnDescriptions() {
if (selectedFilters == null || simulationModelInfo == null) {
return getOdeSolverResultSet().getColumnDescriptions();
} else {
ArrayList<ColumnDescription> selectedColumnDescriptions = new ArrayList<ColumnDescription>();
for (int i = 0; i < getOdeSolverResultSet().getColumnDescriptions().length; i++) {
DataSymbolMetadata dataSymbolMetadata = simulationModelInfo.getDataSymbolMetadataResolver().getDataSymbolMetadata(getOdeSolverResultSet().getColumnDescriptions()[i].getName());
ModelCategoryType selectedFilterCategory = null;
if (dataSymbolMetadata != null) {
selectedFilterCategory = dataSymbolMetadata.filterCategory;
}
for (int j = 0; j < selectedFilters.length; j++) {
if (selectedFilters[j].equals(selectedFilterCategory)) {
selectedColumnDescriptions.add(getOdeSolverResultSet().getColumnDescriptions()[i]);
break;
}
}
}
return selectedColumnDescriptions.toArray(new ColumnDescription[0]);
}
}
Aggregations