Search in sources :

Example 1 with ReservedVariable

use of cbit.vcell.math.ReservedVariable in project vcell by virtualcell.

the class ParameterEstimationPanel method initialize.

@Override
protected void initialize() {
    super.initialize();
    setName("Parameter Estimation");
    setLayout(new java.awt.BorderLayout());
    referenceDataPanel = new ReferenceDataPanel();
    runTaskPanel = new ParameterEstimationRunTaskPanel();
    getparameterMappingPanel().setBorder(GuiConstants.TAB_PANEL_BORDER);
    referenceDataPanel.setBorder(GuiConstants.TAB_PANEL_BORDER);
    getDataMappingPanel().setBorder(GuiConstants.TAB_PANEL_BORDER);
    runTaskPanel.setBorder(GuiConstants.TAB_PANEL_BORDER);
    tabbedPane.addTab(ParameterEstimationPanelTabID.parameters.title, getparameterMappingPanel());
    tabbedPane.addTab(ParameterEstimationPanelTabID.experimental_data_import.title, referenceDataPanel);
    tabbedPane.addTab(ParameterEstimationPanelTabID.experimental_data_mapping.title, getDataMappingPanel());
    tabbedPane.addTab(ParameterEstimationPanelTabID.run_task.title, runTaskPanel);
    add(tabbedPane, BorderLayout.CENTER);
    add(getButtonPanel(), BorderLayout.NORTH);
    getNewAnalysisTaskButton().addActionListener(eventHandler);
    getDeleteAnalysisTaskButton().addActionListener(eventHandler);
    getCopyButton().addActionListener(eventHandler);
    getAnalysisTaskComboBox().addActionListener(eventHandler);
    getMapButton().addActionListener(eventHandler);
    getEvaluateConfidenceIntervalButton().addActionListener(eventHandler);
    getDataModelMappingTable().getSelectionModel().addListSelectionListener(eventHandler);
    dataModelMappingTable.addMouseListener(eventHandler);
    getDataModelMappingTable().setDefaultRenderer(SymbolTableEntry.class, new DefaultScrollTableCellRenderer() {

        public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            if (value == null) {
                setText("unmapped");
                return this;
            }
            SymbolTableEntry ste = (SymbolTableEntry) value;
            if (ste instanceof Model.ReservedSymbol) {
                setText(ste.getName());
            } else if (ste instanceof SpeciesContext) {
                setText("[" + ste.getName() + "]");
            } else if (ste instanceof KineticsParameter) {
                setText(ste.getNameScope().getName() + ":" + ste.getName());
            } else if (ste instanceof ModelParameter) {
                setText(ste.getName());
            } else if (ste instanceof ReservedVariable) {
                setText(ste.getName());
            } else {
                setText(ste.getNameScope().getAbsoluteScopePrefix() + ste.getName());
            }
            return this;
        }
    });
    getDataModelMappingTable().setModel(getreferenceDataMappingSpecTableModel());
    getDataModelMappingTable().createDefaultColumnsFromModel();
}
Also used : SpeciesContext(cbit.vcell.model.SpeciesContext) ParameterEstimationRunTaskPanel(org.vcell.optimization.gui.ParameterEstimationRunTaskPanel) ModelParameter(cbit.vcell.model.Model.ModelParameter) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) ReservedVariable(cbit.vcell.math.ReservedVariable) KineticsParameter(cbit.vcell.model.Kinetics.KineticsParameter) ReferenceDataMappingSpecTableModel(org.vcell.optimization.gui.ReferenceDataMappingSpecTableModel) AnalysisTaskComboBoxModel(org.vcell.optimization.gui.AnalysisTaskComboBoxModel) Model(cbit.vcell.model.Model) DefaultScrollTableCellRenderer(org.vcell.util.gui.DefaultScrollTableCellRenderer) BorderLayout(java.awt.BorderLayout) ReferenceDataPanel(org.vcell.optimization.gui.ReferenceDataPanel)

Example 2 with ReservedVariable

use of cbit.vcell.math.ReservedVariable in project vcell by virtualcell.

the class SimulationSymbolTable method hasTimeVaryingDiffusionOrAdvection.

public boolean hasTimeVaryingDiffusionOrAdvection(Variable variable) throws MathException, ExpressionException {
    Enumeration<SubDomain> enum1 = simulation.getMathDescription().getSubDomains();
    while (enum1.hasMoreElements()) {
        SubDomain subDomain = enum1.nextElement();
        Equation equation = subDomain.getEquation(variable);
        // 
        if (equation instanceof PdeEquation) {
            Vector<Expression> spatialExpressionList = new Vector<Expression>();
            spatialExpressionList.add(((PdeEquation) equation).getDiffusionExpression());
            if (((PdeEquation) equation).getVelocityX() != null) {
                spatialExpressionList.add(((PdeEquation) equation).getVelocityX());
            }
            if (((PdeEquation) equation).getVelocityY() != null) {
                spatialExpressionList.add(((PdeEquation) equation).getVelocityY());
            }
            if (((PdeEquation) equation).getVelocityZ() != null) {
                spatialExpressionList.add(((PdeEquation) equation).getVelocityZ());
            }
            for (int i = 0; i < spatialExpressionList.size(); i++) {
                Expression spatialExp = spatialExpressionList.elementAt(i);
                spatialExp = substituteFunctions(spatialExp);
                String[] symbols = spatialExp.getSymbols();
                if (symbols != null) {
                    for (int j = 0; j < symbols.length; j++) {
                        SymbolTableEntry entry = spatialExp.getSymbolBinding(symbols[j]);
                        if (entry instanceof ReservedVariable) {
                            if (((ReservedVariable) entry).isTIME()) {
                                return true;
                            }
                        }
                        if (entry instanceof VolVariable) {
                            return true;
                        }
                        if (entry instanceof VolumeRegionVariable) {
                            return true;
                        }
                        if (entry instanceof MemVariable || entry instanceof MembraneRegionVariable) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
Also used : MembraneRegionVariable(cbit.vcell.math.MembraneRegionVariable) VolVariable(cbit.vcell.math.VolVariable) PdeEquation(cbit.vcell.math.PdeEquation) Equation(cbit.vcell.math.Equation) SubDomain(cbit.vcell.math.SubDomain) MembraneSubDomain(cbit.vcell.math.MembraneSubDomain) PdeEquation(cbit.vcell.math.PdeEquation) VolumeRegionVariable(cbit.vcell.math.VolumeRegionVariable) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) ReservedVariable(cbit.vcell.math.ReservedVariable) MemVariable(cbit.vcell.math.MemVariable) Expression(cbit.vcell.parser.Expression) Vector(java.util.Vector)

Example 3 with ReservedVariable

use of cbit.vcell.math.ReservedVariable in project vcell by virtualcell.

the class OutputFunctionContext method getAutoCompleteSymbolFilter.

public AutoCompleteSymbolFilter getAutoCompleteSymbolFilter(final Domain functionDomain) {
    AutoCompleteSymbolFilter stef = new AutoCompleteSymbolFilter() {

        public boolean accept(SymbolTableEntry ste) {
            if (simulationOwner.getGeometry().getDimension() > 0) {
                if (functionDomain == null) {
                    return true;
                }
                if (ste.getName().endsWith(InsideVariable.INSIDE_VARIABLE_SUFFIX) || ste.getName().endsWith(OutsideVariable.OUTSIDE_VARIABLE_SUFFIX)) {
                    return false;
                }
                if (ste instanceof ReservedVariable) {
                    return true;
                }
                if (ste instanceof AnnotatedFunction) {
                    return functionDomain.compareEqual(((AnnotatedFunction) ste).getDomain());
                }
                if (ste instanceof Variable) {
                    Variable var = (Variable) ste;
                    if (var.getDomain() == null) {
                        return true;
                    }
                    GeometryClass gc = simulationOwner.getGeometry().getGeometryClass(functionDomain.getName());
                    GeometryClass vargc = simulationOwner.getGeometry().getGeometryClass(var.getDomain().getName());
                    if (gc instanceof SurfaceClass && vargc instanceof SubVolume) {
                        if (((SurfaceClass) gc).isAdjacentTo((SubVolume) vargc)) {
                            return true;
                        } else {
                            return false;
                        }
                    } else {
                        return var.getDomain().compareEqual(functionDomain);
                    }
                }
            }
            return true;
        }

        public boolean acceptFunction(String funcName) {
            return true;
        }
    };
    return stef;
}
Also used : GeometryClass(cbit.vcell.geometry.GeometryClass) AutoCompleteSymbolFilter(cbit.vcell.parser.AutoCompleteSymbolFilter) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) ReservedVariable(cbit.vcell.math.ReservedVariable) ReservedVariable(cbit.vcell.math.ReservedVariable) InsideVariable(cbit.vcell.math.InsideVariable) OutsideVariable(cbit.vcell.math.OutsideVariable) Variable(cbit.vcell.math.Variable) SurfaceClass(cbit.vcell.geometry.SurfaceClass) SubVolume(cbit.vcell.geometry.SubVolume)

Example 4 with ReservedVariable

use of cbit.vcell.math.ReservedVariable in project vcell by virtualcell.

the class SymbolTableEntryTableCellRenderer method getTableCellRendererComponent.

public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    if (value == null) {
        setText("unmapped");
        return this;
    }
    SymbolTableEntry ste = (SymbolTableEntry) value;
    if (ste instanceof Model.ReservedSymbol) {
        setText(ste.getName());
    } else if (ste instanceof SpeciesContext) {
        setText("[" + ste.getName() + "]");
    } else if (ste instanceof KineticsParameter) {
        setText(ste.getNameScope().getName() + ":" + ste.getName());
    } else if (ste instanceof ModelParameter) {
        setText(ste.getName());
    } else if (ste instanceof ReservedVariable) {
        setText(ste.getName());
    } else {
        setText(ste.getNameScope().getAbsoluteScopePrefix() + ste.getName());
    }
    // setToolTipText("Kinetic parameter \""+ste.getName()+"\" in reaction "+);
    return this;
}
Also used : ModelParameter(cbit.vcell.model.Model.ModelParameter) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) ReservedVariable(cbit.vcell.math.ReservedVariable) KineticsParameter(cbit.vcell.model.Kinetics.KineticsParameter) SpeciesContext(cbit.vcell.model.SpeciesContext)

Example 5 with ReservedVariable

use of cbit.vcell.math.ReservedVariable in project vcell by virtualcell.

the class DataSetControllerImpl method identifyDataDependencies.

private Vector<DataSetIdentifier> identifyDataDependencies(AnnotatedFunction function) {
    // 
    // identify data dependencies
    // 
    Expression exp = function.getExpression();
    String[] dependentIDs = exp.getSymbols();
    Vector<DataSetIdentifier> dependencyList = new Vector<DataSetIdentifier>();
    // 
    // get Dependents
    // variables are indexed by a number, t=0, x=1, y=2, z=3, a(i) = 4+i where a's are other variables
    // 
    int varIndex = TXYZ_OFFSET;
    for (int i = 0; dependentIDs != null && i < dependentIDs.length; i++) {
        SymbolTableEntry ste = exp.getSymbolBinding(dependentIDs[i]);
        if (ste instanceof DataSetIdentifier) {
            DataSetIdentifier dsi = (DataSetIdentifier) ste;
            dependencyList.addElement(dsi);
            dsi.setIndex(varIndex++);
        } else if (ste instanceof ReservedVariable) {
            ReservedVariable rv = (ReservedVariable) ste;
            if (rv.isTIME()) {
                rv.setIndex(0);
            } else if (rv.isX()) {
                rv.setIndex(1);
            } else if (rv.isY()) {
                rv.setIndex(2);
            } else if (rv.isZ()) {
                rv.setIndex(3);
            }
        }
    }
    return dependencyList;
}
Also used : SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) ReservedVariable(cbit.vcell.math.ReservedVariable) Expression(cbit.vcell.parser.Expression) Vector(java.util.Vector)

Aggregations

ReservedVariable (cbit.vcell.math.ReservedVariable)6 SymbolTableEntry (cbit.vcell.parser.SymbolTableEntry)6 Expression (cbit.vcell.parser.Expression)3 Vector (java.util.Vector)3 KineticsParameter (cbit.vcell.model.Kinetics.KineticsParameter)2 ModelParameter (cbit.vcell.model.Model.ModelParameter)2 SpeciesContext (cbit.vcell.model.SpeciesContext)2 FieldDataParameterVariable (cbit.vcell.field.FieldDataParameterVariable)1 GeometryClass (cbit.vcell.geometry.GeometryClass)1 SubVolume (cbit.vcell.geometry.SubVolume)1 SurfaceClass (cbit.vcell.geometry.SurfaceClass)1 Equation (cbit.vcell.math.Equation)1 InsideVariable (cbit.vcell.math.InsideVariable)1 MemVariable (cbit.vcell.math.MemVariable)1 MembraneRegionVariable (cbit.vcell.math.MembraneRegionVariable)1 MembraneSubDomain (cbit.vcell.math.MembraneSubDomain)1 OutsideVariable (cbit.vcell.math.OutsideVariable)1 PdeEquation (cbit.vcell.math.PdeEquation)1 SubDomain (cbit.vcell.math.SubDomain)1 Variable (cbit.vcell.math.Variable)1