Search in sources :

Example 11 with PlotData

use of cbit.plot.PlotData in project vcell by virtualcell.

the class KymographPanel method configurePlotData.

/**
 * Insert the method's description here.
 * Creation date: (12/16/2004 10:46:05 AM)
 * @param imgX int
 * @param imgY int
 */
private void configurePlotData(int imgX, int imgY) {
    // 
    // TimeScan Data
    // 
    double[][] timeData = new double[2][currentTimes.length];
    timeData[0] = currentTimes;
    timeData[1] = new double[currentTimes.length];
    for (int i = 0; i < currentTimes.length; i += 1) {
        // timeData[1][i] = timeSeriesDataOrig[1+imgX][i];
        timeData[1][i] = rawValues[imgX + (i * RESAMP_SIZE)];
    }
    ;
    localTimeDataMMMH = calcMMM(timeData[1]);
    final int MAX_TITLE_VAL_LENGTH = 9;
    DecimalFormat nf = new DecimalFormat();
    String valS = null;
    valS = currentDistances[imgX] + "";
    if (valS.length() > MAX_TITLE_VAL_LENGTH) {
        nf.applyPattern("#.###E0");
        valS = nf.format(currentDistances[imgX]);
    }
    currentTimeSeriesPlot2D = new SingleXPlot2D(new SymbolTableEntry[] { currentSymbolTablEntry }, multiTimePlotHelper.getDataSymbolMetadataResolver(), "Time", new String[] { (currentDataIdentifier == null ? "Error" : currentDataIdentifier.getName()) }, timeData, new String[] { "Time Series (d=" + valS + ") Vert", "Time", /*"Time (s)"*/
    "Value" });
    getPlotPaneTimeSeries().setPlot2D(currentTimeSeriesPlot2D);
    // 
    // LineScan Data
    // 
    double[] lineData = new double[timeSeriesDataOrig.length - 1];
    for (int i = 1; i < timeSeriesDataOrig.length; i += 1) {
        lineData[i - 1] = timeSeriesDataOrig[i][imgY];
    }
    double[] lineScanDistances = accumDistancesDataOrig;
    localDistDataMMMH = calcMMM(lineData);
    PlotData plotData = new PlotData(lineScanDistances, lineData);
    valS = currentTimes[imgY] + "";
    if (valS.length() > MAX_TITLE_VAL_LENGTH) {
        valS = nf.format(currentTimes[imgY]);
    }
    currentLineScanPlot2D = new Plot2D(new SymbolTableEntry[] { currentSymbolTablEntry }, multiTimePlotHelper.getDataSymbolMetadataResolver(), new String[] { (currentDataIdentifier == null ? "Error" : currentDataIdentifier.getName()) }, new PlotData[] { plotData }, new String[] { "Line Scan (t=" + valS + ") Horz", "Distance", /*"Distance (\u00b5m)"*/
    "Value" });
    getPlotPaneLineScan().setPlot2D(currentLineScanPlot2D);
    Range xRangeTime = new Range(currentTimes[0], currentTimes[currentTimes.length - 1]);
    Range xRangeDist = new Range(lineScanDistances[0], lineScanDistances[lineScanDistances.length - 1]);
    Range yRangeTime = (allDataMMMH != null ? allDataMMMH.getRange() : null);
    Range yRangeDist = yRangeTime;
    if (bLocalScaling) {
        yRangeTime = (localTimeDataMMMH != null ? localTimeDataMMMH.getRange() : null);
        yRangeDist = (localDistDataMMMH != null ? localDistDataMMMH.getRange() : null);
    }
    getPlotPaneTimeSeries().forceXYRange(xRangeTime, yRangeTime);
    getPlotPaneLineScan().forceXYRange(xRangeDist, yRangeDist);
    configureMinMax();
    getimagePaneView1().repaint();
}
Also used : PlotData(cbit.plot.PlotData) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) DecimalFormat(java.text.DecimalFormat) SingleXPlot2D(cbit.plot.SingleXPlot2D) Plot2D(cbit.plot.Plot2D) Range(org.vcell.util.Range) Point(java.awt.Point) SingleXPlot2D(cbit.plot.SingleXPlot2D)

Example 12 with PlotData

use of cbit.plot.PlotData in project vcell by virtualcell.

the class MultisourcePlotPane method selectionModel1_ValueChanged.

/**
 * Comment
 */
private void selectionModel1_ValueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) throws Exception {
    if (listSelectionEvent.getValueIsAdjusting() == true) {
        return;
    }
    int firstIndex = listSelectionEvent.getFirstIndex();
    int lastIndex = listSelectionEvent.getLastIndex();
    if (firstIndex < 0 || lastIndex < 0) {
        getplotPane().setPlot2D(new Plot2D(null, null, new String[0], new PlotData[0]));
    }
    // 
    // make plotDatas for the reference data
    // 
    Vector<PlotData> plotDataList = new Vector<PlotData>();
    Vector<String> nameList = new Vector<String>();
    Vector<Integer> renderHintList = new Vector<Integer>();
    Vector<Color> colorV = new Vector<Color>();
    int[] selectedIndices = getJList1().getSelectedIndices();
    for (int ii = 0; ii < selectedIndices.length; ii++) {
        int selectedIndex = selectedIndices[ii];
        DataReference dataReference = (DataReference) getmultisourcePlotListModel().getElementAt(selectedIndex);
        DataSource dataSource = dataReference.getDataSource();
        // instanceof DataSource.DataSourceReferenceData ? refDataLabelPrefix : modelDataLabelPrefix;
        String prefix = dataSource.getName() + ": ";
        String[] columnNames = dataSource.getColumnNames();
        int timeIndex = dataSource.getTimeColumnIndex();
        if (timeIndex == -1) {
            throw new RuntimeException("no time variable specified");
        }
        for (int i = 0; i < columnNames.length; i++) {
            if (i == timeIndex) {
                continue;
            }
            if (columnNames[i].equals(dataReference.getIdentifier())) {
                double[] independentValues = dataSource.getColumnData(timeIndex);
                double[] dependentValues = dataSource.getColumnData(i);
                PlotData plotData = new PlotData(independentValues, dependentValues);
                plotDataList.add(plotData);
                int unsortedSelecteIndex = (getmultisourcePlotListModel().getSortedDataReferences() == null ? selectedIndex : getmultisourcePlotListModel().getSortedDataReferences().get(selectedIndex).unsortedIndex);
                colorV.add(autoContrastColors[unsortedSelecteIndex]);
                nameList.add(prefix + columnNames[i]);
                renderHintList.add(dataSource.getRenderHints());
                break;
            }
        }
    }
    String[] labels = { "", "t", "" };
    String[] names = (String[]) BeanUtils.getArray(nameList, String.class);
    PlotData[] plotDatas = (PlotData[]) BeanUtils.getArray(plotDataList, PlotData.class);
    boolean[] visibleFlags = new boolean[plotDatas.length];
    for (int i = 0; i < visibleFlags.length; i++) {
        visibleFlags[i] = true;
    }
    int[] renderHints = new int[plotDatas.length];
    for (int i = 0; i < renderHints.length; i++) {
        renderHints[i] = ((Integer) renderHintList.elementAt(i)).intValue();
    }
    Plot2D plot2D = new Plot2D(null, null, names, plotDatas, labels, visibleFlags, renderHints);
    Color[] colorArr = colorV.toArray(new Color[0]);
    // if(colorV.size() == plot2D.getNumberOfPlots()){
    // colorArr = colorV.toArray(new Color[0]);
    // }
    getplotPane().setPlot2D(plot2D, colorArr);
    return;
}
Also used : PlotData(cbit.plot.PlotData) Color(java.awt.Color) DataSource(cbit.vcell.modelopt.DataSource) Plot2D(cbit.plot.Plot2D) Vector(java.util.Vector) DataReference(cbit.vcell.modelopt.DataReference)

Example 13 with PlotData

use of cbit.plot.PlotData in project vcell by virtualcell.

the class FRAPDataPanel method showCurve.

private void showCurve(String[] varNames, double[] independent, double[][] dependents) {
    PlotPane plotter = new PlotPane();
    PlotData[] plotDatas = new PlotData[dependents.length];
    for (int i = 0; i < plotDatas.length; i++) {
        plotDatas[i] = new PlotData(independent, dependents[i]);
    }
    Plot2D plot2D = new Plot2D(null, null, varNames, plotDatas);
    plotter.setPlot2D(plot2D);
    ChildWindow plotChildWindow = ChildWindowManager.findChildWindowManager(this).addChildWindow(plotter, plotter, "ROI time course", true);
    plotChildWindow.setTitle("ROI time course");
    plotChildWindow.setIsCenteredOnParent();
    plotChildWindow.setSize(new Dimension(400, 400));
    plotChildWindow.showModal();
}
Also used : PlotData(cbit.plot.PlotData) PlotPane(cbit.plot.gui.PlotPane) Plot2D(cbit.plot.Plot2D) Dimension(java.awt.Dimension) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow)

Example 14 with PlotData

use of cbit.plot.PlotData in project vcell by virtualcell.

the class FRAPOptimizationUtils method getSummaryFromProfileData.

// getting a profileSummary for each parameter that has acquired a profile likelihood distribution
public static ProfileSummaryData getSummaryFromProfileData(ProfileData profileData) {
    ArrayList<ProfileDataElement> profileElements = profileData.getProfileDataElements();
    int dataSize = profileElements.size();
    double[] paramValArray = new double[dataSize];
    double[] errorArray = new double[dataSize];
    if (dataSize > 0) {
        // profile likelihood curve
        String paramName = profileElements.get(0).getParamName();
        // find the parameter to locate the upper and lower bounds
        Parameter parameter = null;
        Parameter[] bestParameters = profileElements.get(0).getBestParameters();
        for (int i = 0; i < bestParameters.length; i++) {
            if (bestParameters[i] != null && bestParameters[i].getName().equals(paramName)) {
                parameter = bestParameters[i];
            }
        }
        // double logLowerBound = (lowerBound == 0)? 0: Math.log10(lowerBound);
        for (int i = 0; i < dataSize; i++) {
            paramValArray[i] = profileElements.get(i).getParameterValue();
            errorArray[i] = profileElements.get(i).getLikelihood();
        }
        PlotData dataPlot = new PlotData(paramValArray, errorArray);
        // get confidence interval line
        // make array copy in order to not change the data orders afte the sorting
        double[] paramValArrayCopy = new double[paramValArray.length];
        System.arraycopy(paramValArray, 0, paramValArrayCopy, 0, paramValArray.length);
        double[] errorArrayCopy = new double[errorArray.length];
        System.arraycopy(errorArray, 0, errorArrayCopy, 0, errorArray.length);
        DescriptiveStatistics paramValStat = DescriptiveStatistics.CreateBasicStatistics(paramValArrayCopy);
        DescriptiveStatistics errorStat = DescriptiveStatistics.CreateBasicStatistics(errorArrayCopy);
        double[] xArray = new double[2];
        double[][] yArray = new double[ConfidenceInterval.NUM_CONFIDENCE_LEVELS][2];
        // get confidence level plot lines
        xArray[0] = paramValStat.getMin() - (Math.abs(paramValStat.getMin()) * 0.2);
        xArray[1] = paramValStat.getMax() + (Math.abs(paramValStat.getMax()) * 0.2);
        for (int i = 0; i < ConfidenceInterval.NUM_CONFIDENCE_LEVELS; i++) {
            yArray[i][0] = errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i];
            yArray[i][1] = yArray[i][0];
        }
        PlotData confidence80Plot = new PlotData(xArray, yArray[ConfidenceInterval.IDX_DELTA_ALPHA_80]);
        PlotData confidence90Plot = new PlotData(xArray, yArray[ConfidenceInterval.IDX_DELTA_ALPHA_90]);
        PlotData confidence95Plot = new PlotData(xArray, yArray[ConfidenceInterval.IDX_DELTA_ALPHA_95]);
        PlotData confidence99Plot = new PlotData(xArray, yArray[ConfidenceInterval.IDX_DELTA_ALPHA_99]);
        // generate plot2D data
        Plot2D plots = new Plot2D(null, null, new String[] { "profile Likelihood Data", "80% confidence", "90% confidence", "95% confidence", "99% confidence" }, new PlotData[] { dataPlot, confidence80Plot, confidence90Plot, confidence95Plot, confidence99Plot }, new String[] { "Profile likelihood of " + paramName, "Log base 10 of " + paramName, "Profile Likelihood" }, new boolean[] { true, true, true, true, true });
        // get the best parameter for the minimal error
        int minErrIndex = -1;
        for (int i = 0; i < errorArray.length; i++) {
            if (errorArray[i] == errorStat.getMin()) {
                minErrIndex = i;
                break;
            }
        }
        double bestParamVal = Math.pow(10, paramValArray[minErrIndex]);
        // find confidence interval points
        ConfidenceInterval[] intervals = new ConfidenceInterval[ConfidenceInterval.NUM_CONFIDENCE_LEVELS];
        // half loop through the errors(left side curve)
        int[] smallLeftIdx = new int[ConfidenceInterval.NUM_CONFIDENCE_LEVELS];
        int[] bigLeftIdx = new int[ConfidenceInterval.NUM_CONFIDENCE_LEVELS];
        for (int i = 0; i < ConfidenceInterval.NUM_CONFIDENCE_LEVELS; i++) {
            smallLeftIdx[i] = -1;
            bigLeftIdx[i] = -1;
            for (// loop from bigger error to smaller error
            int j = 1; // loop from bigger error to smaller error
            j < minErrIndex + 1; // loop from bigger error to smaller error
            j++) {
                if ((errorArray[j] < (errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i])) && (errorArray[j - 1] > (errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i]))) {
                    smallLeftIdx[i] = j - 1;
                    bigLeftIdx[i] = j;
                    break;
                }
            }
        }
        // another half loop through the errors(right side curve)
        int[] smallRightIdx = new int[ConfidenceInterval.NUM_CONFIDENCE_LEVELS];
        int[] bigRightIdx = new int[ConfidenceInterval.NUM_CONFIDENCE_LEVELS];
        for (int i = 0; i < ConfidenceInterval.NUM_CONFIDENCE_LEVELS; i++) {
            smallRightIdx[i] = -1;
            bigRightIdx[i] = -1;
            for (// loop from bigger error to smaller error
            int j = (minErrIndex + 1); // loop from bigger error to smaller error
            j < errorArray.length; // loop from bigger error to smaller error
            j++) {
                if ((errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i]) < errorArray[j] && (errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i]) > errorArray[j - 1]) {
                    smallRightIdx[i] = j - 1;
                    bigRightIdx[i] = j;
                    break;
                }
            }
        }
        // calculate intervals
        for (int i = 0; i < ConfidenceInterval.NUM_CONFIDENCE_LEVELS; i++) {
            double lowerBound = Double.NEGATIVE_INFINITY;
            boolean bLowerBoundOpen = true;
            double upperBound = Double.POSITIVE_INFINITY;
            boolean bUpperBoundOpen = true;
            if (// no lower bound
            smallLeftIdx[i] == -1 && bigLeftIdx[i] == -1) {
                lowerBound = parameter.getLowerBound();
                bLowerBoundOpen = false;
            } else if (// there is a lower bound
            smallLeftIdx[i] != -1 && bigLeftIdx[i] != -1) {
                // x=x1+(x2-x1)*(y-y1)/(y2-y1);
                double x1 = paramValArray[smallLeftIdx[i]];
                double x2 = paramValArray[bigLeftIdx[i]];
                double y = errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i];
                double y1 = errorArray[smallLeftIdx[i]];
                double y2 = errorArray[bigLeftIdx[i]];
                lowerBound = x1 + (x2 - x1) * (y - y1) / (y2 - y1);
                lowerBound = Math.pow(10, lowerBound);
                bLowerBoundOpen = false;
            }
            if (// no upper bound
            smallRightIdx[i] == -1 && bigRightIdx[i] == -1) {
                upperBound = parameter.getUpperBound();
                bUpperBoundOpen = false;
            } else if (// there is a upper bound
            smallRightIdx[i] != -1 && bigRightIdx[i] != -1) {
                // x=x1+(x2-x1)*(y-y1)/(y2-y1);
                double x1 = paramValArray[smallRightIdx[i]];
                double x2 = paramValArray[bigRightIdx[i]];
                double y = errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i];
                double y1 = errorArray[smallRightIdx[i]];
                double y2 = errorArray[bigRightIdx[i]];
                upperBound = x1 + (x2 - x1) * (y - y1) / (y2 - y1);
                upperBound = Math.pow(10, upperBound);
                bUpperBoundOpen = false;
            }
            intervals[i] = new ConfidenceInterval(lowerBound, bLowerBoundOpen, upperBound, bUpperBoundOpen);
        }
        return new ProfileSummaryData(plots, bestParamVal, intervals, paramName);
    }
    return null;
}
Also used : PlotData(cbit.plot.PlotData) DescriptiveStatistics(org.vcell.util.DescriptiveStatistics) ProfileSummaryData(org.vcell.optimization.ProfileSummaryData) ProfileDataElement(org.vcell.optimization.ProfileDataElement) Parameter(cbit.vcell.opt.Parameter) Plot2D(cbit.plot.Plot2D) ConfidenceInterval(org.vcell.optimization.ConfidenceInterval)

Example 15 with PlotData

use of cbit.plot.PlotData in project vcell by virtualcell.

the class DisplayProfileLikelihoodPlotsOp method getSummaryFromProfileData.

// getting a profileSummary for each parameter that has acquired a profile likelihood distribution
ProfileSummaryData getSummaryFromProfileData(ProfileData profileData) {
    ArrayList<ProfileDataElement> profileElements = profileData.getProfileDataElements();
    int dataSize = profileElements.size();
    double[] paramValArray = new double[dataSize];
    double[] errorArray = new double[dataSize];
    if (dataSize > 0) {
        // profile likelihood curve
        String paramName = profileElements.get(0).getParamName();
        // find the parameter to locate the upper and lower bounds
        Parameter parameter = null;
        Parameter[] bestParameters = profileElements.get(0).getBestParameters();
        for (int i = 0; i < bestParameters.length; i++) {
            if (bestParameters[i] != null && bestParameters[i].getName().equals(paramName)) {
                parameter = bestParameters[i];
            }
        }
        // double logLowerBound = (lowerBound == 0)? 0: Math.log10(lowerBound);
        for (int i = 0; i < dataSize; i++) {
            paramValArray[i] = profileElements.get(i).getParameterValue();
            errorArray[i] = profileElements.get(i).getLikelihood();
        }
        PlotData dataPlot = new PlotData(paramValArray, errorArray);
        // get confidence interval line
        // make array copy in order to not change the data orders afte the sorting
        double[] paramValArrayCopy = new double[paramValArray.length];
        System.arraycopy(paramValArray, 0, paramValArrayCopy, 0, paramValArray.length);
        double[] errorArrayCopy = new double[errorArray.length];
        System.arraycopy(errorArray, 0, errorArrayCopy, 0, errorArray.length);
        DescriptiveStatistics paramValStat = DescriptiveStatistics.CreateBasicStatistics(paramValArrayCopy);
        DescriptiveStatistics errorStat = DescriptiveStatistics.CreateBasicStatistics(errorArrayCopy);
        double[] xArray = new double[2];
        double[][] yArray = new double[ConfidenceInterval.NUM_CONFIDENCE_LEVELS][2];
        // get confidence level plot lines
        xArray[0] = paramValStat.getMin() - (Math.abs(paramValStat.getMin()) * 0.2);
        xArray[1] = paramValStat.getMax() + (Math.abs(paramValStat.getMax()) * 0.2);
        for (int i = 0; i < ConfidenceInterval.NUM_CONFIDENCE_LEVELS; i++) {
            yArray[i][0] = errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i];
            yArray[i][1] = yArray[i][0];
        }
        PlotData confidence80Plot = new PlotData(xArray, yArray[ConfidenceInterval.IDX_DELTA_ALPHA_80]);
        PlotData confidence90Plot = new PlotData(xArray, yArray[ConfidenceInterval.IDX_DELTA_ALPHA_90]);
        PlotData confidence95Plot = new PlotData(xArray, yArray[ConfidenceInterval.IDX_DELTA_ALPHA_95]);
        PlotData confidence99Plot = new PlotData(xArray, yArray[ConfidenceInterval.IDX_DELTA_ALPHA_99]);
        // generate plot2D data
        Plot2D plots = new Plot2D(null, null, new String[] { "profile Likelihood Data", "80% confidence", "90% confidence", "95% confidence", "99% confidence" }, new PlotData[] { dataPlot, confidence80Plot, confidence90Plot, confidence95Plot, confidence99Plot }, new String[] { "Profile likelihood of " + paramName, "Log base 10 of " + paramName, "Profile Likelihood" }, new boolean[] { true, true, true, true, true });
        // get the best parameter for the minimal error
        int minErrIndex = -1;
        for (int i = 0; i < errorArray.length; i++) {
            if (errorArray[i] == errorStat.getMin()) {
                minErrIndex = i;
                break;
            }
        }
        double bestParamVal = Math.pow(10, paramValArray[minErrIndex]);
        // find confidence interval points
        ConfidenceInterval[] intervals = new ConfidenceInterval[ConfidenceInterval.NUM_CONFIDENCE_LEVELS];
        // half loop through the errors(left side curve)
        int[] smallLeftIdx = new int[ConfidenceInterval.NUM_CONFIDENCE_LEVELS];
        int[] bigLeftIdx = new int[ConfidenceInterval.NUM_CONFIDENCE_LEVELS];
        for (int i = 0; i < ConfidenceInterval.NUM_CONFIDENCE_LEVELS; i++) {
            smallLeftIdx[i] = -1;
            bigLeftIdx[i] = -1;
            for (// loop from bigger error to smaller error
            int j = 1; // loop from bigger error to smaller error
            j < minErrIndex + 1; // loop from bigger error to smaller error
            j++) {
                if ((errorArray[j] < (errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i])) && (errorArray[j - 1] > (errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i]))) {
                    smallLeftIdx[i] = j - 1;
                    bigLeftIdx[i] = j;
                    break;
                }
            }
        }
        // another half loop through the errors(right side curve)
        int[] smallRightIdx = new int[ConfidenceInterval.NUM_CONFIDENCE_LEVELS];
        int[] bigRightIdx = new int[ConfidenceInterval.NUM_CONFIDENCE_LEVELS];
        for (int i = 0; i < ConfidenceInterval.NUM_CONFIDENCE_LEVELS; i++) {
            smallRightIdx[i] = -1;
            bigRightIdx[i] = -1;
            for (// loop from bigger error to smaller error
            int j = (minErrIndex + 1); // loop from bigger error to smaller error
            j < errorArray.length; // loop from bigger error to smaller error
            j++) {
                if ((errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i]) < errorArray[j] && (errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i]) > errorArray[j - 1]) {
                    smallRightIdx[i] = j - 1;
                    bigRightIdx[i] = j;
                    break;
                }
            }
        }
        // calculate intervals
        for (int i = 0; i < ConfidenceInterval.NUM_CONFIDENCE_LEVELS; i++) {
            double lowerBound = Double.NEGATIVE_INFINITY;
            boolean bLowerBoundOpen = true;
            double upperBound = Double.POSITIVE_INFINITY;
            boolean bUpperBoundOpen = true;
            if (// no lower bound
            smallLeftIdx[i] == -1 && bigLeftIdx[i] == -1) {
                lowerBound = parameter.getLowerBound();
                bLowerBoundOpen = false;
            } else if (// there is a lower bound
            smallLeftIdx[i] != -1 && bigLeftIdx[i] != -1) {
                // x=x1+(x2-x1)*(y-y1)/(y2-y1);
                double x1 = paramValArray[smallLeftIdx[i]];
                double x2 = paramValArray[bigLeftIdx[i]];
                double y = errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i];
                double y1 = errorArray[smallLeftIdx[i]];
                double y2 = errorArray[bigLeftIdx[i]];
                lowerBound = x1 + (x2 - x1) * (y - y1) / (y2 - y1);
                lowerBound = Math.pow(10, lowerBound);
                bLowerBoundOpen = false;
            }
            if (// no upper bound
            smallRightIdx[i] == -1 && bigRightIdx[i] == -1) {
                upperBound = parameter.getUpperBound();
                bUpperBoundOpen = false;
            } else if (// there is a upper bound
            smallRightIdx[i] != -1 && bigRightIdx[i] != -1) {
                // x=x1+(x2-x1)*(y-y1)/(y2-y1);
                double x1 = paramValArray[smallRightIdx[i]];
                double x2 = paramValArray[bigRightIdx[i]];
                double y = errorStat.getMin() + ConfidenceInterval.DELTA_ALPHA_VALUE[i];
                double y1 = errorArray[smallRightIdx[i]];
                double y2 = errorArray[bigRightIdx[i]];
                upperBound = x1 + (x2 - x1) * (y - y1) / (y2 - y1);
                upperBound = Math.pow(10, upperBound);
                bUpperBoundOpen = false;
            }
            intervals[i] = new ConfidenceInterval(lowerBound, bLowerBoundOpen, upperBound, bUpperBoundOpen);
        }
        return new ProfileSummaryData(plots, bestParamVal, intervals, paramName);
    }
    return null;
}
Also used : PlotData(cbit.plot.PlotData) DescriptiveStatistics(org.vcell.util.DescriptiveStatistics) ProfileSummaryData(org.vcell.optimization.ProfileSummaryData) ProfileDataElement(org.vcell.optimization.ProfileDataElement) Parameter(cbit.vcell.opt.Parameter) Plot2D(cbit.plot.Plot2D) ConfidenceInterval(org.vcell.optimization.ConfidenceInterval)

Aggregations

PlotData (cbit.plot.PlotData)15 Plot2D (cbit.plot.Plot2D)12 SingleXPlot2D (cbit.plot.SingleXPlot2D)4 PlotPane (cbit.plot.gui.PlotPane)4 SymbolTableEntry (cbit.vcell.parser.SymbolTableEntry)4 Point (java.awt.Point)4 Paint (java.awt.Paint)3 ChildWindow (cbit.vcell.client.ChildWindowManager.ChildWindow)2 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)2 VolVariable (cbit.vcell.math.VolVariable)2 Parameter (cbit.vcell.opt.Parameter)2 SpatialSelectionVolume (cbit.vcell.simdata.SpatialSelectionVolume)2 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)2 CartesianMesh (cbit.vcell.solvers.CartesianMesh)2 Point2D (java.awt.geom.Point2D)2 JFrame (javax.swing.JFrame)2 ConfidenceInterval (org.vcell.optimization.ConfidenceInterval)2 ProfileDataElement (org.vcell.optimization.ProfileDataElement)2 ProfileSummaryData (org.vcell.optimization.ProfileSummaryData)2 DescriptiveStatistics (org.vcell.util.DescriptiveStatistics)2