Search in sources :

Example 11 with ParameterEstimationTask

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

the class ReferenceDataPanel method setParameterEstimationTask.

public void setParameterEstimationTask(ParameterEstimationTask newValue) {
    ParameterEstimationTask oldValue = fieldParameterEstimationTask;
    fieldParameterEstimationTask = newValue;
    if (oldValue != null) {
        oldValue.getModelOptimizationSpec().removePropertyChangeListener(ivjEventHandler);
        ReferenceDataMappingSpec[] refDataMappingSpecs = oldValue.getModelOptimizationSpec().getReferenceDataMappingSpecs();
        if (refDataMappingSpecs != null) {
            for (ReferenceDataMappingSpec refDataMappingSpec : refDataMappingSpecs) {
                refDataMappingSpec.removePropertyChangeListener(ivjEventHandler);
            }
        }
    }
    if (fieldParameterEstimationTask != null) {
        newValue.getModelOptimizationSpec().addPropertyChangeListener(ivjEventHandler);
        ReferenceDataMappingSpec[] refDataMappingSpecs = fieldParameterEstimationTask.getModelOptimizationSpec().getReferenceDataMappingSpecs();
        if (refDataMappingSpecs != null) {
            for (ReferenceDataMappingSpec refDataMappingSpec : refDataMappingSpecs) {
                refDataMappingSpec.addPropertyChangeListener(ivjEventHandler);
            }
        }
        timeIndex = fieldParameterEstimationTask.getModelOptimizationSpec().getReferenceDataTimeColumnIndex();
    } else {
        // fieldParameterEstimationTask is null, so referenceData cannot have any data, should be null too?
        timeIndex = 0;
    }
    updatePlot();
}
Also used : ParameterEstimationTask(cbit.vcell.modelopt.ParameterEstimationTask) ReferenceDataMappingSpec(cbit.vcell.modelopt.ReferenceDataMappingSpec)

Example 12 with ParameterEstimationTask

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

the class Xmlproducer method getXML.

/**
 * Insert the method's description here.
 * Creation date: (5/5/2006 9:25:06 AM)
 * @return Element
 * @param analysisTasks cbit.vcell.modelopt.AnalysisTask[]
 */
private Element getXML(AnalysisTask[] analysisTasks) {
    Element analysisTaskListElement = new Element(XMLTags.AnalysisTaskListTag);
    for (int i = 0; i < analysisTasks.length; i++) {
        Element analysisTaskElement = null;
        if (analysisTasks[i] instanceof ParameterEstimationTask) {
            analysisTaskElement = ParameterEstimationTaskXMLPersistence.getXML((ParameterEstimationTask) analysisTasks[i]);
        } else {
            throw new RuntimeException("XML persistence not supported for analysis type " + analysisTasks[i].getClass().getName());
        }
        analysisTaskListElement.addContent(analysisTaskElement);
    }
    return analysisTaskListElement;
}
Also used : ParameterEstimationTask(cbit.vcell.modelopt.ParameterEstimationTask) Element(org.jdom.Element)

Example 13 with ParameterEstimationTask

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

the class ParameterEstimationPanel method setParameterEstimationTask.

/**
 * Sets the parameterEstimationTask property (cbit.vcell.modelopt.ParameterEstimationTask) value.
 * @param newValue The new value for the property.
 * @see #getParameterEstimationTask
 */
private void setParameterEstimationTask(ParameterEstimationTask newValue) {
    ParameterEstimationTask oldValue = fieldParameterEstimationTask;
    /* Stop listening for events from the current object */
    if (oldValue != null) {
        oldValue.removePropertyChangeListener(eventHandler);
        if (oldValue.getModelOptimizationSpec() != null) {
            oldValue.getModelOptimizationSpec().removePropertyChangeListener(eventHandler);
        }
    }
    fieldParameterEstimationTask = newValue;
    /* Listen for events from the new object */
    if (newValue != null) {
        newValue.addPropertyChangeListener(eventHandler);
        if (newValue.getModelOptimizationSpec() != null) {
            newValue.getModelOptimizationSpec().addPropertyChangeListener(eventHandler);
        }
    }
    getreferenceDataMappingSpecTableModel().setModelOptimizationSpec(fieldParameterEstimationTask == null ? null : fieldParameterEstimationTask.getModelOptimizationSpec());
    referenceDataPanel.setParameterEstimationTask(fieldParameterEstimationTask);
    getparameterMappingPanel().setParameterEstimationTask(fieldParameterEstimationTask);
    getAnalysisTaskComboBox().setSelectedItem(fieldParameterEstimationTask);
    runTaskPanel.setParameterEstimationTask(fieldParameterEstimationTask);
}
Also used : ParameterEstimationTask(cbit.vcell.modelopt.ParameterEstimationTask)

Example 14 with ParameterEstimationTask

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

the class ParameterEstimationPanel method newParameterEstimationTaskButton_ActionPerformed.

private void newParameterEstimationTaskButton_ActionPerformed() {
    try {
        String parameterEstimationName = "task0";
        if (simulationContext == null) {
            return;
        }
        AnalysisTask[] analysisTasks = simulationContext.getAnalysisTasks();
        boolean found = true;
        while (found) {
            found = false;
            parameterEstimationName = TokenMangler.getNextEnumeratedToken(parameterEstimationName);
            for (int i = 0; analysisTasks != null && i < analysisTasks.length; i++) {
                if (analysisTasks[i].getName().equals(parameterEstimationName)) {
                    found = true;
                    continue;
                }
            }
        }
        String newParameterEstimationName = null;
        try {
            newParameterEstimationName = DialogUtils.showInputDialog0(this, "name for new parameter estimation set", parameterEstimationName);
        } catch (UtilCancelException ex) {
        // user canceled; it's ok
        }
        if (newParameterEstimationName != null) {
            if (newParameterEstimationName.length() == 0) {
                PopupGenerator.showErrorDialog(this, "Error:\n name for new parameter estimation can't be empty");
            } else {
                final String finalname = newParameterEstimationName;
                AsynchClientTask task1 = new AsynchClientTask("init task", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

                    @Override
                    public void run(Hashtable<String, Object> hashTable) throws Exception {
                        ParameterEstimationTask newParameterEstimationTask = new ParameterEstimationTask(simulationContext);
                        newParameterEstimationTask.setName(finalname);
                        hashTable.put("newParameterEstimationTask", newParameterEstimationTask);
                    }
                };
                AsynchClientTask task2 = new AsynchClientTask("add task", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

                    @Override
                    public void run(Hashtable<String, Object> hashTable) throws Exception {
                        ParameterEstimationTask newParameterEstimationTask = (ParameterEstimationTask) hashTable.get("newParameterEstimationTask");
                        simulationContext.addAnalysisTask(newParameterEstimationTask);
                        getAnalysisTaskComboBox().setSelectedItem(newParameterEstimationTask);
                        refreshAnalysisTaskEnables();
                    }
                };
                ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 });
            }
        }
    } catch (Exception e) {
        e.printStackTrace(System.out);
        DialogUtils.showErrorDialog(this, e.getMessage(), e);
    }
}
Also used : ParameterEstimationTask(cbit.vcell.modelopt.ParameterEstimationTask) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) UtilCancelException(org.vcell.util.UtilCancelException) Hashtable(java.util.Hashtable) AnalysisTask(cbit.vcell.modelopt.AnalysisTask) PropertyVetoException(java.beans.PropertyVetoException) UtilCancelException(org.vcell.util.UtilCancelException)

Example 15 with ParameterEstimationTask

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

the class ParameterEstimationTaskPropertiesPanel method onSelectedObjectsChange.

@Override
protected void onSelectedObjectsChange(Object[] selectedObjects) {
    ParameterEstimationTask pet = null;
    if (selectedObjects != null && selectedObjects.length == 1 && selectedObjects[0] instanceof ParameterEstimationTask) {
        pet = (ParameterEstimationTask) selectedObjects[0];
    }
    setParameterEstimationTask(pet);
}
Also used : ParameterEstimationTask(cbit.vcell.modelopt.ParameterEstimationTask)

Aggregations

ParameterEstimationTask (cbit.vcell.modelopt.ParameterEstimationTask)16 AnalysisTask (cbit.vcell.modelopt.AnalysisTask)4 BioEvent (cbit.vcell.mapping.BioEvent)3 SimulationContext (cbit.vcell.mapping.SimulationContext)3 SpatialObject (cbit.vcell.mapping.spatial.SpatialObject)3 SpatialProcess (cbit.vcell.mapping.spatial.processes.SpatialProcess)3 PropertyVetoException (java.beans.PropertyVetoException)3 Element (org.jdom.Element)3 ImageException (cbit.image.ImageException)2 DataSymbol (cbit.vcell.data.DataSymbol)2 GeometryException (cbit.vcell.geometry.GeometryException)2 RateRule (cbit.vcell.mapping.RateRule)2 ReactionRuleSpec (cbit.vcell.mapping.ReactionRuleSpec)2 ReactionSpec (cbit.vcell.mapping.ReactionSpec)2 SimulationContextParameter (cbit.vcell.mapping.SimulationContext.SimulationContextParameter)2 MathException (cbit.vcell.math.MathException)2 ModelException (cbit.vcell.model.ModelException)2 ExpressionBindingException (cbit.vcell.parser.ExpressionBindingException)2 ExpressionException (cbit.vcell.parser.ExpressionException)2 AnnotatedFunction (cbit.vcell.solver.AnnotatedFunction)2