Search in sources :

Example 6 with DataSource

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

the class EstParams_OneDiffComponentPanel method plotDerivedSimulationResults.

private void plotDerivedSimulationResults(AnalysisParameters[] anaParams) {
    try {
        String description = null;
        int totalROIlen = FRAPData.VFRAP_ROI_ENUM.values().length;
        boolean[] wantsROITypes = new boolean[totalROIlen];
        System.arraycopy(frapWorkspace.getWorkingFrapStudy().getSelectedROIsForErrorCalculation(), 0, wantsROITypes, 0, totalROIlen);
        ODESolverResultSet fitOdeSolverResultSet = new ODESolverResultSet();
        fitOdeSolverResultSet.addDataColumn(new ODESolverResultSetColumnDescription("t"));
        for (int j = 0; j < totalROIlen; j++) {
            if (!wantsROITypes[j]) {
                continue;
            }
            String currentROIName = FRAPData.VFRAP_ROI_ENUM.values()[j].name();
            String name = (description == null ? /*"sim D="+diffusionRates[diffusionRateIndex]+"::"*/
            "" : description) + currentROIName;
            fitOdeSolverResultSet.addDataColumn(new ODESolverResultSetColumnDescription(name));
        }
        int totalWantedROIlen = 0;
        for (int i = 0; i < wantsROITypes.length; i++) {
            if (wantsROITypes[i]) {
                totalWantedROIlen++;
            }
        }
        // 
        // populate time
        // 
        double[] shiftedSimTimes = frapOptData.getReducedExpTimePoints();
        int startIndexRecovery = frapOptData.getExpFrapStudy().getStartingIndexForRecovery();
        for (int j = 0; j < shiftedSimTimes.length; j++) {
            double[] row = new double[totalWantedROIlen + 1];
            row[0] = shiftedSimTimes[j] + frapOptData.getExpFrapStudy().getFrapData().getImageDataset().getImageTimeStamps()[startIndexRecovery];
            fitOdeSolverResultSet.addRow(row);
        }
        // populate values
        double[][] currentOptFitData = getPureDiffusionPanel().getCurrentFitData();
        // store results
        setCurrentEstimationResults(currentOptFitData);
        if (allDataHash != null && currentOptFitData != null) {
            // populate optimization data
            int columncounter = 0;
            for (int j = 0; j < totalROIlen; j++) {
                if (!wantsROITypes[j]) {
                    continue;
                }
                // if(!isSimData) //opt data
                // {
                double[] values = currentOptFitData[j];
                for (int k = 0; k < values.length; k++) {
                    fitOdeSolverResultSet.setValue(k, columncounter + 1, values[k]);
                }
                // }
                columncounter++;
            }
            // boolean hasSimData = false;
            // anaParams[0] is the key in allDataHash to get the dataSource[]:exp & sim
            DataSource[] selectedRowDataSourceArr = allDataHash.get(anaParams[0]);
            if (selectedRowDataSourceArr != null) {
                // referenceData is the exp data
                // ReferenceData referenceData = (ReferenceData)selectedRowDataSourceArr[SpatialAnalysisResults.ARRAY_INDEX_EXPDATASOURCE];
                // new DataSource.DataSourceReferenceData("exp", referenceData);
                final DataSource expDataSource = selectedRowDataSourceArr[SpatialAnalysisResults.ARRAY_INDEX_EXPDATASOURCE];
                DataSource optDataSource = new DataSource.DataSourceRowColumnResultSet("opt", fitOdeSolverResultSet);
                DataSource[] newDataSourceArr = new DataSource[2];
                newDataSourceArr[SpatialAnalysisResults.ARRAY_INDEX_EXPDATASOURCE] = expDataSource;
                newDataSourceArr[SpatialAnalysisResults.ARRAY_INDEX_SIMDATASOURCE] = optDataSource;
                if (currentOptFitData == null) {
                    multisourcePlotPane.setDataSources(null);
                } else {
                    // the following paragraph of code is just to get selected color for selected ROIs
                    // and make them the same as we show on ChooseModel_RoiForErrorPanel/RoiForErrorPanel
                    // double valid ROI colors (not include cell and background)
                    int validROISize = FRAPData.VFRAP_ROI_ENUM.values().length - 2;
                    Color[] fullColors = ColorUtil.generateAutoColor(validROISize * 2, getBackground(), new Integer(0));
                    boolean[] selectedROIs = frapWorkspace.getWorkingFrapStudy().getSelectedROIsForErrorCalculation();
                    int selectedROICounter = 0;
                    for (int i = 0; i < selectedROIs.length; i++) {
                        if (selectedROIs[i]) {
                            selectedROICounter++;
                        }
                    }
                    // double the size, each ROI is a comparison of exp and sim
                    Color[] selectedColors = new Color[selectedROICounter * 2];
                    int selectedColorIdx = 0;
                    for (int i = 0; i < selectedROIs.length; i++) {
                        if (selectedROIs[i] && i == 0) {
                            selectedColors[selectedColorIdx] = fullColors[i];
                            selectedColors[selectedColorIdx + selectedROICounter] = fullColors[i + validROISize];
                            selectedColorIdx++;
                        }
                        if (// skip cell and background ROIs
                        selectedROIs[i] && i > 2) {
                            selectedColors[selectedColorIdx] = fullColors[i - 2];
                            selectedColors[selectedColorIdx + selectedROICounter] = fullColors[i - 2 + validROISize];
                            selectedColorIdx++;
                        }
                    }
                    int[] selectedIndices = multisourcePlotPane.getUnsortedSelectedIndices();
                    multisourcePlotPane.setDataSources(newDataSourceArr, selectedColors);
                    if (selectedIndices.length == 0) {
                        multisourcePlotPane.selectAll();
                    } else {
                        multisourcePlotPane.setUnsortedSelectedIndices(selectedIndices);
                    }
                }
            }
        }
    } catch (Exception e2) {
        e2.printStackTrace();
        DialogUtils.showErrorDialog(this, "Error graphing Optimizer data " + e2.getMessage());
    }
}
Also used : Color(java.awt.Color) DataSource(cbit.vcell.modelopt.DataSource) ODESolverResultSet(cbit.vcell.solver.ode.ODESolverResultSet) ODESolverResultSetColumnDescription(cbit.vcell.math.ODESolverResultSetColumnDescription)

Example 7 with DataSource

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

the class EstParams_ReacBindingPanel method plotDerivedSimulationResults.

private void plotDerivedSimulationResults(AnalysisParameters[] anaParams) {
    try {
        if (getCurrentSimResults() == null || getCurrentRawSimTimePoints() == null || allDataHash == null || allDataHash.get(anaParams[0]) == null || (allDataHash.get(anaParams[0])[SpatialAnalysisResults.ARRAY_INDEX_EXPDATASOURCE]) == null) {
            multisourcePlotPane.setDataSources(null);
            return;
        }
        String description = null;
        int totalROIlen = FRAPData.VFRAP_ROI_ENUM.values().length;
        boolean[] wantsROITypes = new boolean[totalROIlen];
        System.arraycopy(frapWorkspace.getWorkingFrapStudy().getSelectedROIsForErrorCalculation(), 0, wantsROITypes, 0, totalROIlen);
        ODESolverResultSet simSolverResultSet = new ODESolverResultSet();
        simSolverResultSet.addDataColumn(new ODESolverResultSetColumnDescription("t"));
        for (int j = 0; j < totalROIlen; j++) {
            if (!wantsROITypes[j]) {
                continue;
            }
            String currentROIName = FRAPData.VFRAP_ROI_ENUM.values()[j].name();
            String name = (description == null ? /*"sim D="+diffusionRates[diffusionRateIndex]+"::"*/
            "" : description) + currentROIName;
            simSolverResultSet.addDataColumn(new ODESolverResultSetColumnDescription(name));
        }
        int totalWantedROIlen = 0;
        for (int i = 0; i < wantsROITypes.length; i++) {
            if (wantsROITypes[i]) {
                totalWantedROIlen++;
            }
        }
        FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
        // 
        // populate time
        // 
        double[] shiftedSimTimes = getCurrentRawSimTimePoints();
        int startIndexRecovery = fStudy.getStartingIndexForRecovery();
        for (int j = 0; j < shiftedSimTimes.length; j++) {
            double[] row = new double[totalWantedROIlen + 1];
            row[0] = shiftedSimTimes[j] + fStudy.getFrapData().getImageDataset().getImageTimeStamps()[startIndexRecovery];
            simSolverResultSet.addRow(row);
        }
        // 
        // populate values
        // 
        double[][] currentSimData = getCurrentSimResults();
        // populate sim data
        int columncounter = 0;
        for (int j = 0; j < totalROIlen; j++) {
            if (!wantsROITypes[j]) {
                continue;
            }
            double[] values = currentSimData[j];
            for (int k = 0; k < values.length; k++) {
                simSolverResultSet.setValue(k, columncounter + 1, values[k]);
            }
            columncounter++;
        }
        // get exp data and generate datasource to display
        // anaParams[0] is the key in allDataHash to get the dataSource[]:exp & sim
        DataSource[] selectedRowDataSourceArr = allDataHash.get(anaParams[0]);
        if (selectedRowDataSourceArr != null) {
            // referenceData is the exp data
            // ReferenceData referenceData = (ReferenceData)selectedRowDataSourceArr[SpatialAnalysisResults.ARRAY_INDEX_EXPDATASOURCE].getSource();
            final DataSource expDataSource = /*new DataSource(referenceData,"exp")*/
            selectedRowDataSourceArr[SpatialAnalysisResults.ARRAY_INDEX_EXPDATASOURCE];
            // from simulation
            final DataSource simDataSource = new DataSource.DataSourceRowColumnResultSet("sim", simSolverResultSet);
            DataSource[] newDataSourceArr = new DataSource[2];
            newDataSourceArr[SpatialAnalysisResults.ARRAY_INDEX_EXPDATASOURCE] = expDataSource;
            newDataSourceArr[SpatialAnalysisResults.ARRAY_INDEX_SIMDATASOURCE] = simDataSource;
            // the following paragraph of code is just to get selected color for selected ROIs
            // and make them the same as we show on ChooseModel_RoiForErrorPanel/RoiForErrorPanel
            // double valid ROI colors (not include cell and background)
            int validROISize = FRAPData.VFRAP_ROI_ENUM.values().length - 2;
            Color[] fullColors = ColorUtil.generateAutoColor(validROISize * 2, getBackground(), new Integer(0));
            boolean[] selectedROIs = frapWorkspace.getWorkingFrapStudy().getSelectedROIsForErrorCalculation();
            int selectedROICounter = 0;
            for (int i = 0; i < selectedROIs.length; i++) {
                if (selectedROIs[i]) {
                    selectedROICounter++;
                }
            }
            // double the size, each ROI is a comparison of exp and sim
            Color[] selectedColors = new Color[selectedROICounter * 2];
            int selectedColorIdx = 0;
            for (int i = 0; i < selectedROIs.length; i++) {
                if (selectedROIs[i] && i == 0) {
                    selectedColors[selectedColorIdx] = fullColors[i];
                    selectedColors[selectedColorIdx + selectedROICounter] = fullColors[i + validROISize];
                    selectedColorIdx++;
                }
                if (// skip cell and background ROIs
                selectedROIs[i] && i > 2) {
                    selectedColors[selectedColorIdx] = fullColors[i - 2];
                    selectedColors[selectedColorIdx + selectedROICounter] = fullColors[i - 2 + validROISize];
                    selectedColorIdx++;
                }
            }
            multisourcePlotPane.setDataSources(newDataSourceArr, selectedColors);
            multisourcePlotPane.selectAll();
        }
    } catch (Exception e2) {
        e2.printStackTrace();
        DialogUtils.showErrorDialog(this, "Error graphing Optimizer data " + e2.getMessage());
    }
}
Also used : Color(java.awt.Color) DataSource(cbit.vcell.modelopt.DataSource) FRAPStudy(cbit.vcell.microscopy.FRAPStudy) ODESolverResultSet(cbit.vcell.solver.ode.ODESolverResultSet) ODESolverResultSetColumnDescription(cbit.vcell.math.ODESolverResultSetColumnDescription)

Example 8 with DataSource

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

the class OptModelParamPanel method plotDerivedSimulationResults.

private void plotDerivedSimulationResults() {
    try {
        RowColumnResultSet simulatedData = optContext.computeSolution(getCurrentParameterValues(), fittedROIs, optContext.getExperimentalTimePoints());
        RowColumnResultSet experimentalData = optContext.getExperimentalData(fittedROIs);
        DataSource simDataSource = new DataSource.DataSourceRowColumnResultSet("opt", simulatedData, false);
        DataSource expDataSource = new DataSource.DataSourceRowColumnResultSet("exp", experimentalData, true);
        DataSource[] newDataSourceArr = new DataSource[2];
        newDataSourceArr[ARRAY_INDEX_EXPDATASOURCE] = expDataSource;
        newDataSourceArr[ARRAY_INDEX_SIMDATASOURCE] = simDataSource;
        // double valid ROI colors (not include cell and background)
        int roiSize = fittedROIs.length;
        Color[] uniqueColors = ColorUtil.generateAutoColor(roiSize, getBackground(), new Integer(0));
        Color[] colors = new Color[roiSize * 2];
        for (int i = 0; i < roiSize; i++) {
            colors[i] = uniqueColors[i];
            colors[i + roiSize] = uniqueColors[i];
        }
        int[] selectedIndices = multisourcePlotPane.getUnsortedSelectedIndices();
        multisourcePlotPane.setDataSources(newDataSourceArr, colors);
        if (selectedIndices.length == 0) {
            multisourcePlotPane.selectAll();
        } else {
            multisourcePlotPane.setUnsortedSelectedIndices(selectedIndices);
        }
    } catch (Exception e2) {
        e2.printStackTrace();
        DialogUtils.showErrorDialog(this, "Error graphing Optimizer data " + e2.getMessage());
    }
}
Also used : Color(java.awt.Color) RowColumnResultSet(cbit.vcell.math.RowColumnResultSet) DataSource(cbit.vcell.modelopt.DataSource)

Example 9 with DataSource

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

the class FRAPEstimationPanel_NotUsed method displayFit.

private void displayFit(FrapDataAnalysisResults.DiffusionOnlyAnalysisRestults diffAnalysisResults, double[] frapDataTimeStamps, int startIndexForRecovery) {
    if (diffAnalysisResults == null) {
        FRAPParameterEstimateEnum.DIFFUSION_RATE.value = null;
        FRAPParameterEstimateEnum.MOBILE_FRACTION.value = null;
        FRAPParameterEstimateEnum.IMMOBILE_FRATION.value = null;
        FRAPParameterEstimateEnum.START_TIME_RECOVERY.value = null;
        FRAPParameterEstimateEnum.BLEACH_RATE_MONITOR.value = null;
        multisourcePlotPane.setDataSources(null);
    } else {
        FRAPParameterEstimateEnum.DIFFUSION_RATE.value = (diffAnalysisResults.getRecoveryDiffusionRate() == null ? null : diffAnalysisResults.getRecoveryDiffusionRate());
        FRAPParameterEstimateEnum.MOBILE_FRACTION.value = (diffAnalysisResults.getMobilefraction() == null ? null : diffAnalysisResults.getMobilefraction());
        FRAPParameterEstimateEnum.IMMOBILE_FRATION.value = (FRAPParameterEstimateEnum.MOBILE_FRACTION.value == null ? null : 1.0 - FRAPParameterEstimateEnum.MOBILE_FRACTION.value);
        FRAPParameterEstimateEnum.BLEACH_RATE_MONITOR.value = (diffAnalysisResults.getBleachWhileMonitoringTau() == null ? null : diffAnalysisResults.getBleachWhileMonitoringTau());
        // int startIndexForRecovery = FRAPDataAnalysis.getRecoveryIndex(initFRAPData);
        // 
        // Experiment - Cell ROI Average
        // 
        double[] temp_background = initFRAPData.getAvgBackGroundIntensity();
        double[] preBleachAvgXYZ = FrapDataUtils.calculatePreBleachAverageXYZ(initFRAPData, startIndexForRecovery);
        double[] cellRegionData = FRAPDataAnalysis.getAverageROIIntensity(initFRAPData, initFRAPData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name()), preBleachAvgXYZ, temp_background);
        ReferenceData expCellAvgData = new SimpleReferenceData(new String[] { "t", "CellROIAvg" }, new double[] { 1.0, 1.0 }, new double[][] { frapDataTimeStamps, cellRegionData });
        DataSource expCellAvgDataSource = new DataSource.DataSourceReferenceData("expCellAvg", expCellAvgData);
        // 
        // Analytic - Cell ROI Average with Bleach while monitor
        // 
        ODESolverResultSet bleachWhileMonitorOdeSolverResultSet = new ODESolverResultSet();
        bleachWhileMonitorOdeSolverResultSet.addDataColumn(new ODESolverResultSetColumnDescription("t"));
        try {
            bleachWhileMonitorOdeSolverResultSet.addFunctionColumn(new FunctionColumnDescription(diffAnalysisResults.getFitBleachWhileMonitorExpression(), "CellROI_BleachWhileMonitor", null, "bleachWhileMonitorFit", true));
        } catch (ExpressionException e) {
            e.printStackTrace();
        }
        for (int i = startIndexForRecovery; i < frapDataTimeStamps.length; i++) {
            bleachWhileMonitorOdeSolverResultSet.addRow(new double[] { frapDataTimeStamps[i] });
        }
        // 
        // extend if necessary to plot theoretical curve to 4*tau
        // 
        {
            double T = frapDataTimeStamps[frapDataTimeStamps.length - 1];
            double deltaT = frapDataTimeStamps[frapDataTimeStamps.length - 1] - frapDataTimeStamps[frapDataTimeStamps.length - 2];
            while (T + deltaT < 6 * diffAnalysisResults.getRecoveryTau()) {
                bleachWhileMonitorOdeSolverResultSet.addRow(new double[] { T });
                T += deltaT;
            }
        }
        DataSource bleachWhileMonitorDataSource = new DataSource.DataSourceRowColumnResultSet("bleachwm", bleachWhileMonitorOdeSolverResultSet);
        // Recovery curve
        double[] bleachRegionData = FRAPDataAnalysis.getAverageROIIntensity(initFRAPData, initFRAPData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.name()), preBleachAvgXYZ, temp_background);
        ;
        ReferenceData expRefData = new SimpleReferenceData(new String[] { "t", "BleachROIAvg" }, new double[] { 1.0, 1.0 }, new double[][] { frapDataTimeStamps, bleachRegionData });
        DataSource expDataSource = new DataSource.DataSourceReferenceData("experiment", expRefData);
        ODESolverResultSet fitOdeSolverResultSet = new ODESolverResultSet();
        fitOdeSolverResultSet.addDataColumn(new ODESolverResultSetColumnDescription("t"));
        try {
            fitOdeSolverResultSet.addFunctionColumn(new FunctionColumnDescription(diffAnalysisResults.getDiffFitExpression(), // "('"+FrapDataAnalysisResults.BLEACH_TYPE_NAMES[bleachEstimationComboBox.getSelectedIndex()]+"')",
            "BleachROI_Recovery", null, "recoveryFit", true));
        } catch (ExpressionException e) {
            e.printStackTrace();
        }
        for (int i = startIndexForRecovery; i < frapDataTimeStamps.length; i++) {
            fitOdeSolverResultSet.addRow(new double[] { frapDataTimeStamps[i] });
        }
        // 
        // extend if necessary to plot theoretical curve to 4*tau
        // 
        double T = frapDataTimeStamps[frapDataTimeStamps.length - 1];
        double deltaT = frapDataTimeStamps[frapDataTimeStamps.length - 1] - frapDataTimeStamps[frapDataTimeStamps.length - 2];
        while (T + deltaT < 6 * diffAnalysisResults.getRecoveryTau()) {
            fitOdeSolverResultSet.addRow(new double[] { T });
            T += deltaT;
        }
        DataSource fitDataSource = new DataSource.DataSourceRowColumnResultSet("fit", fitOdeSolverResultSet);
        multisourcePlotPane.setDataSources(new DataSource[] { expDataSource, fitDataSource, expCellAvgDataSource, bleachWhileMonitorDataSource });
        multisourcePlotPane.selectAll();
    }
    table.repaint();
}
Also used : SimpleReferenceData(cbit.vcell.opt.SimpleReferenceData) ReferenceData(cbit.vcell.opt.ReferenceData) ODESolverResultSet(cbit.vcell.solver.ode.ODESolverResultSet) ODESolverResultSetColumnDescription(cbit.vcell.math.ODESolverResultSetColumnDescription) FunctionColumnDescription(cbit.vcell.math.FunctionColumnDescription) SimpleReferenceData(cbit.vcell.opt.SimpleReferenceData) ExpressionException(cbit.vcell.parser.ExpressionException) DataSource(cbit.vcell.modelopt.DataSource)

Example 10 with DataSource

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

the class EstParams_ReactionOffRatePanel method displayResults.

private void displayResults(FRAPData frapData, int startIndexRecovery) throws ExpressionException, DivideByZeroException {
    Parameter[] currentParams = offRateParamPanel.getCurrentParameters();
    if (frapData == null || currentParams == null) {
        multisourcePlotPane.setDataSources(null);
    } else {
        double[] frapDataTimeStamps = frapData.getImageDataset().getImageTimeStamps();
        // Experiment - Cell ROI Average
        double[] temp_background = frapData.getAvgBackGroundIntensity();
        double[] preBleachAvgXYZ = FrapDataUtils.calculatePreBleachAverageXYZ(frapData, startIndexRecovery);
        /*double[] cellRegionData = FRAPDataAnalysis.getAverageROIIntensity(frapData, frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name()),preBleachAvgXYZ,temp_background);
			ReferenceData expCellAvgData = new SimpleReferenceData(new String[] { ReservedSymbol.TIME.getName(), "CellROIAvg" }, new double[] { 1.0, 1.0 }, new double[][] {frapDataTimeStamps, cellRegionData });
			DataSource expCellAvgDataSource = new DataSource.DataSourceReferenceData("exp", expCellAvgData);
			//Analytic - Cell ROI Average with Bleach while monitor
			ODESolverResultSet bleachWhileMonitorOdeSolverResultSet = new ODESolverResultSet();
			bleachWhileMonitorOdeSolverResultSet.addDataColumn(new ODESolverResultSetColumnDescription(ReservedSymbol.TIME.getName()));
			Expression cellAvgExp = new Expression(FRAPOptFunctions.FUNC_CELL_INTENSITY);
			// substitute parameter values 
			cellAvgExp.substituteInPlace(new Expression(FRAPOptFunctions.SYMBOL_I_inicell), new Expression(cellRegionData[startIndexRecovery]));
			cellAvgExp.substituteInPlace(new Expression(FRAPOptFunctions.SYMBOL_BWM_RATE), new Expression(currentParams[FRAPModel.INDEX_BLEACH_MONITOR_RATE].getInitialGuess()));
			// time shift
			cellAvgExp.substituteInPlace(new Expression(ReservedSymbol.TIME.getName()), new Expression(ReservedSymbol.TIME.getName()+"-"+frapDataTimeStamps[startIndexRecovery]));
			try {
				bleachWhileMonitorOdeSolverResultSet.addFunctionColumn(
					new FunctionColumnDescription(
						cellAvgExp,
						"CellROIAvg",
						null,"bleachWhileMonitorFit",true));
			} catch (ExpressionException e) {
				e.printStackTrace();
			}
			for (int i = startIndexRecovery; i < frapDataTimeStamps.length; i++) 
			{
				bleachWhileMonitorOdeSolverResultSet.addRow(new double[] { frapDataTimeStamps[i] });
			}
			DataSource bleachWhileMonitorDataSource = new DataSource.DataSourceOdeSolverResultSet("fit", bleachWhileMonitorOdeSolverResultSet);*/
        // experimental bleach region average intensity curve
        double[] bleachRegionData = FRAPDataAnalysis.getAverageROIIntensity(frapData, frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.name()), preBleachAvgXYZ, temp_background);
        ;
        ReferenceData expRefData = new SimpleReferenceData(new String[] { ReservedVariable.TIME.getName(), "BleachROIAvg" }, new double[] { 1.0, 1.0 }, new double[][] { frapDataTimeStamps, bleachRegionData });
        DataSource expBleachDataSource = new DataSource.DataSourceReferenceData("exp", expRefData);
        // Analytic - bleach region average intensity with bleach while monitoring rate
        ODESolverResultSet koffFitOdeSolverResultSet = new ODESolverResultSet();
        koffFitOdeSolverResultSet.addDataColumn(new ODESolverResultSetColumnDescription(ReservedVariable.TIME.getName()));
        Expression bleachedAvgExp = frapWorkspace.getWorkingFrapStudy().getFrapOptFunc().getRecoveryExpressionWithCurrentParameters(currentParams);
        try {
            koffFitOdeSolverResultSet.addFunctionColumn(new FunctionColumnDescription(bleachedAvgExp, "BleachROIAvg", null, "recoveryFit", true));
        } catch (ExpressionException e) {
            e.printStackTrace();
        }
        double[] truncatedTimes = new double[frapDataTimeStamps.length - startIndexRecovery];
        for (int i = startIndexRecovery; i < frapDataTimeStamps.length; i++) {
            koffFitOdeSolverResultSet.addRow(new double[] { frapDataTimeStamps[i] });
            truncatedTimes[i - startIndexRecovery] = frapDataTimeStamps[i];
        }
        setCurrentEstimationResults(frapWorkspace.getWorkingFrapStudy().getFrapOptFunc().createData(bleachedAvgExp.flatten(), truncatedTimes));
        DataSource koffFitDataSource = new DataSource.DataSourceRowColumnResultSet("fit", koffFitOdeSolverResultSet);
        multisourcePlotPane.setDataSources(new DataSource[] { expBleachDataSource, koffFitDataSource /*, expCellAvgDataSource , bleachWhileMonitorDataSource*/
        });
        multisourcePlotPane.selectAll();
    }
}
Also used : SimpleReferenceData(cbit.vcell.opt.SimpleReferenceData) ExpressionException(cbit.vcell.parser.ExpressionException) DataSource(cbit.vcell.modelopt.DataSource) SimpleReferenceData(cbit.vcell.opt.SimpleReferenceData) ReferenceData(cbit.vcell.opt.ReferenceData) Expression(cbit.vcell.parser.Expression) Parameter(cbit.vcell.opt.Parameter) ODESolverResultSet(cbit.vcell.solver.ode.ODESolverResultSet) ODESolverResultSetColumnDescription(cbit.vcell.math.ODESolverResultSetColumnDescription) FunctionColumnDescription(cbit.vcell.math.FunctionColumnDescription)

Aggregations

DataSource (cbit.vcell.modelopt.DataSource)13 ODESolverResultSet (cbit.vcell.solver.ode.ODESolverResultSet)9 ReferenceData (cbit.vcell.opt.ReferenceData)6 ODESolverResultSetColumnDescription (cbit.vcell.math.ODESolverResultSetColumnDescription)5 Color (java.awt.Color)5 DataReference (cbit.vcell.modelopt.DataReference)3 SimpleReferenceData (cbit.vcell.opt.SimpleReferenceData)3 ExpressionException (cbit.vcell.parser.ExpressionException)3 FunctionColumnDescription (cbit.vcell.math.FunctionColumnDescription)2 FRAPStudy (cbit.vcell.microscopy.FRAPStudy)2 SortDataReferenceHelper (cbit.vcell.modelopt.gui.MultisourcePlotListModel.SortDataReferenceHelper)2 Plot2D (cbit.plot.Plot2D)1 PlotData (cbit.plot.PlotData)1 RowColumnResultSet (cbit.vcell.math.RowColumnResultSet)1 Variable (cbit.vcell.math.Variable)1 FRAPModel (cbit.vcell.microscopy.FRAPModel)1 ReservedSymbol (cbit.vcell.model.Model.ReservedSymbol)1 ModelOptimizationSpec (cbit.vcell.modelopt.ModelOptimizationSpec)1 ReferenceDataMappingSpec (cbit.vcell.modelopt.ReferenceDataMappingSpec)1 MultisourcePlotPane (cbit.vcell.modelopt.gui.MultisourcePlotPane)1