Search in sources :

Example 1 with SimulationModelInfo

use of cbit.vcell.solver.SimulationModelInfo in project vcell by virtualcell.

the class DataViewer method setSimulationModelInfo.

/**
 * Sets the simulationModelInfo property (cbit.vcell.client.data.SimulationModelInfo) value.
 * @param simulationModelInfo The new value for the property.
 * @see #getSimulationModelInfo
 */
public void setSimulationModelInfo(SimulationModelInfo simulationModelInfo) {
    SimulationModelInfo oldValue = fieldSimulationModelInfo;
    fieldSimulationModelInfo = simulationModelInfo;
    firePropertyChange(PROP_SIM_MODEL_INFO, oldValue, simulationModelInfo);
}
Also used : SimulationModelInfo(cbit.vcell.solver.SimulationModelInfo)

Example 2 with SimulationModelInfo

use of cbit.vcell.solver.SimulationModelInfo in project vcell by virtualcell.

the class ODEDataViewer method updateMetadata.

private void updateMetadata() {
    /* Set the target from the source */
    if (getOdeSolverResultSet() == null) {
        return;
    }
    final HashMap<String, DataSymbolMetadata> auxDataSymbolMap = new HashMap();
    for (ColumnDescription columnDescription : getOdeSolverResultSet().getColumnDescriptions()) {
        if (columnDescription.getName().startsWith("sens_") && columnDescription.getName().contains("_wrt_")) {
            DataSymbolMetadata dataSymbolMetadata = sensitivityMetaDataParser(columnDescription.getName());
            auxDataSymbolMap.put(columnDescription.getName(), dataSymbolMetadata);
        }
    }
    try {
        AsynchClientTask filterCategoriesTask = new AsynchClientTask("Calculating Filter...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                if (ODEDataViewer.this.getSimulationModelInfo() != null) {
                    SimulationModelInfo simulationModelInfo = ODEDataViewer.this.getSimulationModelInfo();
                    simulationModelInfo.getDataSymbolMetadataResolver().populateDataSymbolMetadata(auxDataSymbolMap);
                }
            }
        };
        AsynchClientTask firePropertyChangeTask = new AsynchClientTask("Fire Property Change...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                SimulationModelInfo simulationModelInfo = ODEDataViewer.this.getSimulationModelInfo();
                ODEDataInterfaceImpl oDEDataInterfaceImpl = new ODEDataInterfaceImpl(getVcDataIdentifier(), getOdeSolverResultSet(), simulationModelInfo);
                getODESolverPlotSpecificationPanel1().setMyDataInterface(oDEDataInterfaceImpl);
            // new Thread(new Runnable() {
            // @Override
            // public void run() {
            // while(ClientTaskDispatcher.isBusy()){
            // try{Thread.sleep(200);}catch(Exception e){e.printStackTrace();}
            // }
            // SwingUtilities.invokeLater(new Runnable() {
            // @Override
            // public void run() {
            // ((Window)BeanUtils.findTypeParentOfComponent(ODEDataViewer.this, Window.class)).toFront();
            // }
            // });
            // }
            // }).start();
            }
        };
        ClientTaskDispatcher.dispatch(ODEDataViewer.this, new Hashtable<String, Object>(), new AsynchClientTask[] { filterCategoriesTask, firePropertyChangeTask }, false, false, false, null, true);
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) SimulationModelInfo(cbit.vcell.solver.SimulationModelInfo) HashMap(java.util.HashMap) ColumnDescription(cbit.vcell.util.ColumnDescription) Hashtable(java.util.Hashtable) DataSymbolMetadata(cbit.vcell.solver.DataSymbolMetadata)

Example 3 with SimulationModelInfo

use of cbit.vcell.solver.SimulationModelInfo in project vcell by virtualcell.

the class PDEDataViewer method updateMetadata.

public void updateMetadata() {
    if (getPdeDataContext() == null) {
        return;
    }
    // check if clienttaskdispatcher is busy, if so schedule this method to run later (workaround spurious threading problem)
    if ((pdeDataViewersetupTimer = ClientTaskDispatcher.getBlockingTimer(PDEDataViewer.this, null, null, pdeDataViewersetupTimer, new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e2) {
            updateMetadata();
        }
    }, "PDEDataViewer Setup...")) != null) {
        return;
    }
    try {
        updatingMetaData = true;
        AsynchClientTask filterCategoriesTask = new AsynchClientTask("Calculating Filter...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                // try {
                if (getSimulationModelInfo() != null) {
                    SimulationModelInfo simulationWorkspaceModelInfo = PDEDataViewer.this.getSimulationModelInfo();
                    simulationWorkspaceModelInfo.getDataSymbolMetadataResolver().populateDataSymbolMetadata(null);
                }
            // }catch (Exception e){
            // e.printStackTrace();
            // }
            }
        };
        AsynchClientTask firePropertyChangeTask = new AsynchClientTask("Fire Property Change...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                SimulationModelInfo simulationModelInfo = PDEDataViewer.this.getSimulationModelInfo();
                DataInfoProvider dataInfoProvider = new DataInfoProvider(getPdeDataContext(), simulationModelInfo);
                getPDEPlotControlPanel1().setDataInfoProvider(dataInfoProvider);
                getPDEDataContextPanel1().setDataInfoProvider(dataInfoProvider);
                getPDEExportPanel1().setDataInfoProvider(getPDEDataContextPanel1().getDataInfoProvider());
                if (getSimulationModelInfo() != null && getSimulationModelInfo().getDataSymbolMetadataResolver().getUniqueFilterCategories() != null) {
                    getPDEPlotControlPanel1().setDataIdentifierFilter(new DefaultDataIdentifierFilter(getSimulationModelInfo().getDataSymbolMetadataResolver()));
                }
            }
        };
        ClientTaskDispatcher.dispatch(PDEDataViewer.this, new Hashtable<String, Object>(), new AsynchClientTask[] { filterCategoriesTask, firePropertyChangeTask }, false, false, false, null, true);
    } finally {
        updatingMetaData = false;
    }
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) ActionListener(java.awt.event.ActionListener) SimulationModelInfo(cbit.vcell.solver.SimulationModelInfo) ActionEvent(java.awt.event.ActionEvent) Hashtable(java.util.Hashtable) DataInfoProvider(cbit.vcell.simdata.DataInfoProvider)

Example 4 with SimulationModelInfo

use of cbit.vcell.solver.SimulationModelInfo in project vcell by virtualcell.

the class FRAPStudyPanel method refreshPDEDisplay.

protected void refreshPDEDisplay(DisplayChoice choice) throws Exception {
    Simulation sim = null;
    FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
    if (fStudy == null || fStudy.getBioModel() == null || fStudy.getBioModel().getSimulations() == null || fStudy.getBioModel().getSimulations().length < 1) {
        return;
    }
    sim = fStudy.getBioModel().getSimulations()[0];
    FieldFunctionArguments[] fieldFunctionArgs = FieldUtilities.getFieldFunctionArguments(sim.getMathDescription());
    FieldDataIdentifierSpec[] fieldDataIdentifierSpecs = new FieldDataIdentifierSpec[fieldFunctionArgs.length];
    for (int i = 0; i < fieldDataIdentifierSpecs.length; i++) {
        fieldDataIdentifierSpecs[i] = new FieldDataIdentifierSpec(fieldFunctionArgs[i], fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier());
    }
    PDEDataViewer flourViewer = getFlourDataViewer();
    PDEDataManager dataManager = null;
    if (choice == DisplayChoice.EXTTIMEDATA) {
        flourViewer.setSimulation(null);
        flourViewer.setPdeDataContext(null);
        flourViewer.setDataIdentifierFilter(new DataIdentifierFilter() {

            private String ALL_DATAIDENTIFIERS = "All";

            private String EXP_NORM_FLUOR = "Exp. Norm. Fluor";

            private String SIM_NORM_FLUOR = "Sim. Norm. Fluor";

            private String DEFAULT_VIEW = "Default View (more...)";

            private String[] filterSetNames = new String[] { ALL_DATAIDENTIFIERS, EXP_NORM_FLUOR, SIM_NORM_FLUOR, DEFAULT_VIEW };

            public boolean accept(String filterSetName, List<AnnotatedFunction> myFunctionList, DataIdentifier dataidentifier) {
                if (filterSetName.equals(ALL_DATAIDENTIFIERS)) {
                    return true;
                } else if (filterSetName.equals(EXP_NORM_FLUOR)) {
                    return dataidentifier.getName().indexOf(NORM_FLUOR_VAR) != -1;
                } else if (filterSetName.equals(SIM_NORM_FLUOR)) {
                    boolean a = (dataidentifier.getName().indexOf(REACTION_RATE_PREFIX) == -1) && ((dataidentifier.getName().indexOf(FRAPStudy.SPECIES_NAME_PREFIX_COMBINED) != -1) || (dataidentifier.getName().indexOf(FRAPStudy.SPECIES_NAME_PREFIX_IMMOBILE) != -1) || (dataidentifier.getName().indexOf(FRAPStudy.SPECIES_NAME_PREFIX_MOBILE) != -1) || (dataidentifier.getName().indexOf(FRAPStudy.SPECIES_NAME_PREFIX_SLOW_MOBILE) != -1));
                    return a;
                } else if (filterSetName.equals(DEFAULT_VIEW)) {
                    boolean a = (dataidentifier.getName().indexOf(REACTION_RATE_PREFIX) == -1) && ((dataidentifier.getName().indexOf(NORM_FLUOR_VAR) != -1) || (dataidentifier.getName().indexOf(NORM_SIM_VAR) != -1));
                    return a;
                }
                throw new IllegalArgumentException("DataIdentifierFilter: Unknown filterSetName " + filterSetName);
            }

            public String getDefaultFilterName() {
                return DEFAULT_VIEW;
            }

            public String[] getFilterSetNames() {
                return filterSetNames;
            }

            public boolean isAcceptAll(String filterSetName) {
                return filterSetName.equals(ALL_DATAIDENTIFIERS);
            }

            @Override
            public void setPostProcessingMode(boolean bPostProcessingMode) {
            // TODO Auto-generated method stub
            }

            @Override
            public boolean isPostProcessingMode() {
                // TODO Auto-generated method stub
                return false;
            }

            @Override
            public ArrayList<DataIdentifier> accept(String filterSetName, List<AnnotatedFunction> myFunctionList, DataIdentifier[] dataidentifiers) {
                if (filterSetName.equals(DEFAULT_VIEW)) {
                    ArrayList<DataIdentifier> dataIds = new ArrayList<>();
                    if (dataidentifiers != null) {
                        for (int i = 0; i < dataidentifiers.length; i++) {
                            dataIds.add(dataidentifiers[i]);
                        }
                    }
                    return dataIds;
                }
                throw new RuntimeException("Not Implemented for FRAP");
            }
        });
        ExternalDataIdentifier timeSeriesExtDataID = fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier();
        ExternalDataIdentifier maskExtDataID = fStudy.getRoiExternalDataInfo().getExternalDataIdentifier();
        // add sim
        int jobIndex = 0;
        SimulationJob simJob = new SimulationJob(sim, jobIndex, fieldDataIdentifierSpecs);
        // add function to display normalized fluorence data
        Norm_Exp_Fluor = new Expression(Norm_Exp_Fluor_Str);
        SimulationSymbolTable simSymbolTable = simJob.getSimulationSymbolTable();
        if (// one diffusing component
        simSymbolTable.getVariable(FRAPStudy.SPECIES_NAME_PREFIX_SLOW_MOBILE) == null) {
            Norm_Sim = new Expression(Norm_Sim_One_Diff_Str);
        } else // two diffusing components
        {
            Norm_Sim = new Expression(Norm_Sim_Two_Diff_Str);
        }
        AnnotatedFunction[] func = { new AnnotatedFunction(NORM_FLUOR_VAR, Norm_Exp_Fluor, null, null, VariableType.VOLUME, FunctionCategory.OLDUSERDEFINED), new AnnotatedFunction(NORM_SIM_VAR, Norm_Sim, null, null, VariableType.VOLUME, FunctionCategory.OLDUSERDEFINED) };
        VCDataIdentifier[] dataIDs = new VCDataIdentifier[] { timeSeriesExtDataID, maskExtDataID, simJob.getVCDataIdentifier() };
        VCDataIdentifier vcDataId = new MergedDataInfo(LocalWorkspace.getDefaultOwner(), dataIDs, FRAPStudy.VFRAP_DS_PREFIX);
        outputContext = new OutputContext(func);
        dataManager = new PDEDataManager(outputContext, getLocalWorkspace().getVCDataManager(), vcDataId);
        ClientPDEDataContext pdeDataContext = new ClientPDEDataContext(dataManager);
        pdeDataContext.refreshIdentifiers();
        flourViewer.setSimulation(sim);
        flourViewer.setPdeDataContext(pdeDataContext);
        SimulationModelInfo simModelInfo = new SimulationWorkspaceModelInfo(fStudy.getBioModel().getSimulationContext(sim), sim.getName());
        flourViewer.setSimulationModelInfo(simModelInfo);
        getLocalWorkspace().getDataSetControllerImpl().addDataJobListener(flourViewer);
        ((VirtualFrapWindowManager) flourViewer.getDataViewerManager()).setLocalWorkSpace(getLocalWorkspace());
        // do now show post data processing for VFRAP
        flourViewer.setPostProcessingPanelVisible(false);
        flourViewer.repaint();
    }
}
Also used : ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) DataIdentifier(cbit.vcell.simdata.DataIdentifier) ArrayList(java.util.ArrayList) MergedDataInfo(cbit.vcell.simdata.MergedDataInfo) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) FRAPStudy(cbit.vcell.microscopy.FRAPStudy) SimulationWorkspaceModelInfo(cbit.vcell.client.data.SimulationWorkspaceModelInfo) SimulationJob(cbit.vcell.solver.SimulationJob) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction) DataIdentifierFilter(cbit.vcell.client.data.DataIdentifierFilter) SimulationModelInfo(cbit.vcell.solver.SimulationModelInfo) FieldFunctionArguments(cbit.vcell.field.FieldFunctionArguments) SimulationSymbolTable(cbit.vcell.solver.SimulationSymbolTable) Point(java.awt.Point) OutputContext(cbit.vcell.simdata.OutputContext) Simulation(cbit.vcell.solver.Simulation) PDEDataManager(cbit.vcell.simdata.PDEDataManager) Expression(cbit.vcell.parser.Expression) FieldDataIdentifierSpec(cbit.vcell.field.FieldDataIdentifierSpec) ClientPDEDataContext(cbit.vcell.simdata.ClientPDEDataContext) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) PDEDataViewer(cbit.vcell.client.data.PDEDataViewer)

Aggregations

SimulationModelInfo (cbit.vcell.solver.SimulationModelInfo)4 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)2 Hashtable (java.util.Hashtable)2 DataIdentifierFilter (cbit.vcell.client.data.DataIdentifierFilter)1 PDEDataViewer (cbit.vcell.client.data.PDEDataViewer)1 SimulationWorkspaceModelInfo (cbit.vcell.client.data.SimulationWorkspaceModelInfo)1 FieldDataIdentifierSpec (cbit.vcell.field.FieldDataIdentifierSpec)1 FieldFunctionArguments (cbit.vcell.field.FieldFunctionArguments)1 FRAPStudy (cbit.vcell.microscopy.FRAPStudy)1 Expression (cbit.vcell.parser.Expression)1 ClientPDEDataContext (cbit.vcell.simdata.ClientPDEDataContext)1 DataIdentifier (cbit.vcell.simdata.DataIdentifier)1 DataInfoProvider (cbit.vcell.simdata.DataInfoProvider)1 MergedDataInfo (cbit.vcell.simdata.MergedDataInfo)1 OutputContext (cbit.vcell.simdata.OutputContext)1 PDEDataManager (cbit.vcell.simdata.PDEDataManager)1 AnnotatedFunction (cbit.vcell.solver.AnnotatedFunction)1 DataSymbolMetadata (cbit.vcell.solver.DataSymbolMetadata)1 Simulation (cbit.vcell.solver.Simulation)1 SimulationJob (cbit.vcell.solver.SimulationJob)1