Search in sources :

Example 6 with ReferenceDataMappingSpec

use of cbit.vcell.modelopt.ReferenceDataMappingSpec in project vcell by virtualcell.

the class ParameterEstimationPanel method mapButton_ActionPerformed.

/**
 * Comment
 */
private void mapButton_ActionPerformed() {
    if (getParameterEstimationTask() == null) {
        return;
    }
    SymbolTableEntry[] symbolTableEntries = getParameterEstimationTask().getModelOptimizationSpec().calculateTimeDependentModelObjects(getParameterEstimationTask().getModelOptimizationSpec().getSimulationContext());
    java.util.Comparator<SymbolTableEntry> steComparator = new java.util.Comparator<SymbolTableEntry>() {

        private Class<?>[] classOrder = new Class<?>[] { Model.ReservedSymbol.class, SpeciesContext.class, Model.ModelParameter.class, Kinetics.KineticsParameter.class };

        public int compare(SymbolTableEntry ste1, SymbolTableEntry ste2) {
            int ste1Category = 100;
            int ste2Category = 100;
            for (int i = 0; i < classOrder.length; i++) {
                if (ste1.getClass().equals(classOrder[i])) {
                    ste1Category = i;
                }
                if (ste2.getClass().equals(classOrder[i])) {
                    ste2Category = i;
                }
            }
            if (ste1Category < ste2Category) {
                return 1;
            } else if (ste1Category > ste2Category) {
                return -1;
            } else {
                return ste1.getName().compareTo(ste2.getName());
            }
        }
    };
    java.util.Arrays.sort(symbolTableEntries, steComparator);
    SymbolTableEntry ste = (SymbolTableEntry) DialogUtils.showListDialog(this, symbolTableEntries, "Map Experimental Data", new SymbolTableEntryListCellRenderer());
    if (ste != null && getDataModelMappingTable().getSelectionModel().getMaxSelectionIndex() >= 0) {
        ReferenceDataMappingSpec refDataMappingSpec = getParameterEstimationTask().getModelOptimizationSpec().getReferenceDataMappingSpecs()[getDataModelMappingTable().getSelectionModel().getMaxSelectionIndex()];
        try {
            refDataMappingSpec.setModelObject(ste);
        } catch (java.beans.PropertyVetoException e) {
            e.printStackTrace(System.out);
            DialogUtils.showErrorDialog(this, e.getMessage());
        }
    }
    return;
}
Also used : ReferenceDataMappingSpec(cbit.vcell.modelopt.ReferenceDataMappingSpec) SymbolTableEntryListCellRenderer(cbit.vcell.modelopt.gui.SymbolTableEntryListCellRenderer) PropertyVetoException(java.beans.PropertyVetoException) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) ReferenceDataMappingSpecTableModel(org.vcell.optimization.gui.ReferenceDataMappingSpecTableModel) AnalysisTaskComboBoxModel(org.vcell.optimization.gui.AnalysisTaskComboBoxModel) Model(cbit.vcell.model.Model) Kinetics(cbit.vcell.model.Kinetics)

Aggregations

ReferenceDataMappingSpec (cbit.vcell.modelopt.ReferenceDataMappingSpec)6 ModelOptimizationSpec (cbit.vcell.modelopt.ModelOptimizationSpec)2 ReferenceData (cbit.vcell.opt.ReferenceData)2 SimpleReferenceData (cbit.vcell.opt.SimpleReferenceData)2 SimulationContext (cbit.vcell.mapping.SimulationContext)1 MathMappingCallback (cbit.vcell.mapping.SimulationContext.MathMappingCallback)1 Variable (cbit.vcell.math.Variable)1 MathModel (cbit.vcell.mathmodel.MathModel)1 Kinetics (cbit.vcell.model.Kinetics)1 Model (cbit.vcell.model.Model)1 ReservedSymbol (cbit.vcell.model.Model.ReservedSymbol)1 DataSource (cbit.vcell.modelopt.DataSource)1 ParameterEstimationTask (cbit.vcell.modelopt.ParameterEstimationTask)1 SortDataReferenceHelper (cbit.vcell.modelopt.gui.MultisourcePlotListModel.SortDataReferenceHelper)1 MultisourcePlotPane (cbit.vcell.modelopt.gui.MultisourcePlotPane)1 SymbolTableEntryListCellRenderer (cbit.vcell.modelopt.gui.SymbolTableEntryListCellRenderer)1 Constraint (cbit.vcell.opt.Constraint)1 OptimizationException (cbit.vcell.opt.OptimizationException)1 OptimizationSpec (cbit.vcell.opt.OptimizationSpec)1 Parameter (cbit.vcell.opt.Parameter)1