use of cbit.vcell.opt.Parameter 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;
}
use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class FRAPParamTest method runProfileLikelihood.
public void runProfileLikelihood() {
String errorMsg = checkFrapStudyValidity();
if (!errorMsg.equals("")) {
System.out.println("Application terminated due to " + errorMsg);
System.exit(1);
} else {
try {
ClientTaskStatusSupport ctss = new ClientTaskStatusSupport() {
public void setProgress(int progress) {
System.out.println(progress);
}
public void setMessage(String message) {
System.out.println(message);
}
public boolean isInterrupted() {
// TODO Auto-generated method stub
return false;
}
public int getProgress() {
// TODO Auto-generated method stub
return 0;
}
public void addProgressDialogListener(ProgressDialogListener progressDialogListener) {
throw new RuntimeException("not yet implemented");
}
};
// get startign index
if (frapStudy.getStartingIndexForRecovery() == null) {
int index = FRAPDataAnalysis.calculateRecoveryIndex(frapStudy.getFrapData());
frapStudy.setStartingIndexForRecovery(index);
}
// get dependent rois
if (frapStudy.getFrapData().getRois().length < 4) {
frapStudy.refreshDependentROIs();
}
// get selected ROIs
if (frapStudy.getSelectedROIsForErrorCalculation() == null) {
boolean[] selectedROIs = new boolean[FRAPData.VFRAP_ROI_ENUM.values().length];
int counter = 0;
for (FRAPData.VFRAP_ROI_ENUM roiEnum : FRAPData.VFRAP_ROI_ENUM.values()) {
if (roiEnum.name().equals(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name()) || roiEnum.name().equals(FRAPData.VFRAP_ROI_ENUM.ROI_BACKGROUND.name())) {
counter++;
continue;
}
if (frapStudy.getFrapData().getRoi(roiEnum.name()).getNonzeroPixelsCount() > 0) {
selectedROIs[counter] = true;
counter++;
}
}
frapStudy.setSelectedROIsForErrorCalculation(selectedROIs);
}
// get frap opt data
if (frapStudy.getFrapOptData() == null) {
if (!FRAPWorkspace.areExternalDataOK(getLocalWorkspace(), frapStudy.getFrapDataExternalDataInfo(), frapStudy.getRoiExternalDataInfo())) {
// if external files are missing/currupt or ROIs are changed, create keys and save them
frapStudy.setFrapDataExternalDataInfo(FRAPStudy.createNewExternalDataInfo(localWorkspace, FRAPStudy.IMAGE_EXTDATA_NAME));
frapStudy.setRoiExternalDataInfo(FRAPStudy.createNewExternalDataInfo(localWorkspace, FRAPStudy.ROI_EXTDATA_NAME));
frapStudy.saveROIsAsExternalData(localWorkspace, frapStudy.getRoiExternalDataInfo().getExternalDataIdentifier(), frapStudy.getStartingIndexForRecovery());
frapStudy.saveImageDatasetAsExternalData(localWorkspace, frapStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier(), frapStudy.getStartingIndexForRecovery());
}
// run ref sim
frapStudy.setFrapOptData(new FRAPOptData(frapStudy, FRAPModel.NUM_MODEL_PARAMETERS_ONE_DIFF, localWorkspace, ctss));
}
FRAPOptData optData = frapStudy.getFrapOptData();
// create frapModels
if (frapStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT] == null) {
frapStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT] = new FRAPModel(FRAPModel.MODEL_TYPE_ARRAY[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT], null, null, null);
if (frapStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT].getModelParameters() == null) {
frapStudy.getFrapOptData().setNumEstimatedParams(FRAPModel.NUM_MODEL_PARAMETERS_ONE_DIFF);
Parameter[] initialParams = FRAPModel.getInitialParameters(frapStudy.getFrapData(), FRAPModel.MODEL_TYPE_ARRAY[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT], frapStudy.getStartingIndexForRecovery());
Parameter[] bestParameters = frapStudy.getFrapOptData().getBestParamters(initialParams, frapStudy.getSelectedROIsForErrorCalculation());
frapStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT].setModelParameters(bestParameters);
}
}
if (frapStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS] == null) {
frapStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS] = new FRAPModel(FRAPModel.MODEL_TYPE_ARRAY[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS], null, null, null);
if (frapStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS].getModelParameters() == null) {
frapStudy.getFrapOptData().setNumEstimatedParams(FRAPModel.NUM_MODEL_PARAMETERS_TWO_DIFF);
Parameter[] initialParams = FRAPModel.getInitialParameters(frapStudy.getFrapData(), FRAPModel.MODEL_TYPE_ARRAY[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS], frapStudy.getStartingIndexForRecovery());
Parameter[] bestParameters = frapStudy.getFrapOptData().getBestParamters(initialParams, frapStudy.getSelectedROIsForErrorCalculation());
frapStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS].setModelParameters(bestParameters);
}
}
// try diffusion with one diffusing component model
System.out.println("Evaluating parameters in diffusion with one diffusing compoent model...");
Parameter[] bestParameters = frapStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT].getModelParameters();
ProfileData[] profileData = optData.evaluateParameters(bestParameters, ctss);
// output profile likelihood
File outputDir_oneComponent = new File(getLocalWorkspace().getDefaultWorkspaceDirectory() + SUB_DIRECTORY + "OneComponent_SAVED_AT_" + BeanUtils.generateDateTimeString() + System.getProperty("file.separator"));
if (!outputDir_oneComponent.exists()) {
outputDir_oneComponent.mkdirs();
}
for (int i = 0; i < profileData.length; i++) {
ProfileDataElement profileDataElement = profileData[i].getProfileDataElements().get(0);
outputProfileLikelihood(profileData[i].getProfileDataElements(), profileDataElement.getParamName(), outputDir_oneComponent);
}
// try diffusion with two diffusing components model
System.out.println("Evaluating parameters in diffusion with two diffusing compoents model...");
bestParameters = frapStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS].getModelParameters();
profileData = optData.evaluateParameters(bestParameters, ctss);
// output profile likelihood
File outputDir_twoComponents = new File(getLocalWorkspace().getDefaultWorkspaceDirectory() + SUB_DIRECTORY + "TwoComponents_SAVED_AT_" + BeanUtils.generateDateTimeString() + System.getProperty("file.separator"));
if (!outputDir_twoComponents.exists()) {
outputDir_twoComponents.mkdirs();
}
for (int i = 0; i < profileData.length; i++) {
ProfileDataElement profileDataElement = profileData[i].getProfileDataElements().get(0);
outputProfileLikelihood(profileData[i].getProfileDataElements(), profileDataElement.getParamName(), outputDir_twoComponents);
}
} catch (Exception e) {
e.printStackTrace(System.out);
System.exit(1);
}
}
}
use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class FRAPParamTest method outputProfileLikelihood.
private void outputProfileLikelihood(ArrayList<ProfileDataElement> arg_profileData, String fixedParamName, File outputDir) {
try {
System.out.println("Writing profile likelihood...");
// output results
String outFileName = outputDir.getAbsolutePath() + "\\" + fixedParamName + "_profileLikelihood" + ".txt";
File outFile = new File(outFileName);
FileWriter fstream = new FileWriter(outFile);
BufferedWriter out = new BufferedWriter(fstream);
// output profile
for (int i = 0; i < arg_profileData.size(); i++) {
out.newLine();
String rowStr = arg_profileData.get(i).getParameterValue() + "\t" + arg_profileData.get(i).getLikelihood();
Parameter[] params = arg_profileData.get(i).getBestParameters();
rowStr = rowStr + "\t";
for (int j = 0; j < params.length; j++) {
rowStr = rowStr + "\t" + params[j].getInitialGuess();
}
out.write(rowStr);
}
out.close();
System.out.println("Output is done. Restults saved to " + outFileName);
} catch (IOException e) {
e.printStackTrace(System.out);
}
}
use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class MicroscopyXmlReader method getProfileDataElement.
private ProfileDataElement getProfileDataElement(Element profileDataElementElement) {
ProfileDataElement profileDataElement = null;
if (profileDataElementElement != null) {
String paramName = unMangle(profileDataElementElement.getAttributeValue(MicroscopyXMLTags.profileDataElementParameterNameAttrTag));
double paramVal = new Double(unMangle(profileDataElementElement.getAttributeValue(MicroscopyXMLTags.profileDataElementParameterValueAttrTag)));
double likelihood = new Double(unMangle(profileDataElementElement.getAttributeValue(MicroscopyXMLTags.profileDataElementLikelihoodAttrTag)));
@SuppressWarnings("unchecked") List<Element> parameterElementList = profileDataElementElement.getChildren(OptXmlTags.Parameter_Tag);
Parameter[] parameters = new Parameter[parameterElementList.size()];
int paramCounter = 0;
for (Element paramElement : parameterElementList) {
parameters[paramCounter] = getParameter(paramElement);
paramCounter++;
}
profileDataElement = new ProfileDataElement(paramName, paramVal, likelihood, parameters);
}
return profileDataElement;
}
use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class MicroscopyXmlReader method getModelParameters.
private Parameter[] getModelParameters(Element paramElement, int modelType) {
if (modelType == FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT) {
Parameter[] params = new Parameter[FRAPModel.NUM_MODEL_PARAMETERS_ONE_DIFF];
double primaryDiffRate = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.PrimaryRateAttrTag));
params[FRAPModel.INDEX_PRIMARY_DIFF_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_PRIMARY_DIFF_RATE], FRAPModel.REF_DIFFUSION_RATE_PARAM.getLowerBound(), FRAPModel.REF_DIFFUSION_RATE_PARAM.getUpperBound(), FRAPModel.REF_DIFFUSION_RATE_PARAM.getScale(), primaryDiffRate);
double primaryFraction = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.PrimaryFractionAttTag));
params[FRAPModel.INDEX_PRIMARY_FRACTION] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_PRIMARY_FRACTION], FRAPModel.REF_MOBILE_FRACTION_PARAM.getLowerBound(), FRAPModel.REF_MOBILE_FRACTION_PARAM.getUpperBound(), FRAPModel.REF_MOBILE_FRACTION_PARAM.getScale(), primaryFraction);
double bwmRate = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.BleachWhileMonitoringTauAttrTag));
params[FRAPModel.INDEX_BLEACH_MONITOR_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_BLEACH_MONITOR_RATE], FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getLowerBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getUpperBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getScale(), bwmRate);
return params;
} else if (modelType == FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS) {
Parameter[] params = new Parameter[FRAPModel.NUM_MODEL_PARAMETERS_TWO_DIFF];
double primaryDiffRate = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.PrimaryRateAttrTag));
params[FRAPModel.INDEX_PRIMARY_DIFF_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_PRIMARY_DIFF_RATE], FRAPModel.REF_DIFFUSION_RATE_PARAM.getLowerBound(), FRAPModel.REF_DIFFUSION_RATE_PARAM.getUpperBound(), FRAPModel.REF_DIFFUSION_RATE_PARAM.getScale(), primaryDiffRate);
double primaryFraction = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.PrimaryFractionAttTag));
params[FRAPModel.INDEX_PRIMARY_FRACTION] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_PRIMARY_FRACTION], FRAPModel.REF_MOBILE_FRACTION_PARAM.getLowerBound(), FRAPModel.REF_MOBILE_FRACTION_PARAM.getUpperBound(), FRAPModel.REF_MOBILE_FRACTION_PARAM.getScale(), primaryFraction);
double bwmRate = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.BleachWhileMonitoringTauAttrTag));
params[FRAPModel.INDEX_BLEACH_MONITOR_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_BLEACH_MONITOR_RATE], FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getLowerBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getUpperBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getScale(), bwmRate);
double secDiffRate = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.SecondRateAttrTag));
params[FRAPModel.INDEX_SECONDARY_DIFF_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_SECONDARY_DIFF_RATE], FRAPModel.REF_SECOND_DIFFUSION_RATE_PARAM.getLowerBound(), FRAPModel.REF_SECOND_DIFFUSION_RATE_PARAM.getUpperBound(), FRAPModel.REF_SECOND_DIFFUSION_RATE_PARAM.getScale(), secDiffRate);
double secFraction = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.SecondFractionAttTag));
params[FRAPModel.INDEX_SECONDARY_FRACTION] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_SECONDARY_FRACTION], FRAPModel.REF_SECOND_MOBILE_FRACTION_PARAM.getLowerBound(), FRAPModel.REF_SECOND_MOBILE_FRACTION_PARAM.getUpperBound(), FRAPModel.REF_SECOND_MOBILE_FRACTION_PARAM.getScale(), secFraction);
return params;
} else if (modelType == FRAPModel.IDX_MODEL_REACTION_OFF_RATE) {
Parameter[] params = new Parameter[FRAPModel.NUM_MODEL_PARAMETERS_REACTION_OFF_RATE];
double bwmRate = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.BleachWhileMonitoringTauAttrTag));
params[FRAPModel.INDEX_BLEACH_MONITOR_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_BLEACH_MONITOR_RATE], FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getLowerBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getUpperBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getScale(), bwmRate);
double fittingParam = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.BindingSiteConcentrationAttTag));
params[FRAPModel.INDEX_BINDING_SITE_CONCENTRATION] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_BINDING_SITE_CONCENTRATION], FRAPModel.REF_BS_CONCENTRATION_OR_A.getLowerBound(), FRAPModel.REF_BS_CONCENTRATION_OR_A.getUpperBound(), FRAPModel.REF_BS_CONCENTRATION_OR_A.getScale(), fittingParam);
double offRate = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.ReactionOffRateAttTag));
params[FRAPModel.INDEX_OFF_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_OFF_RATE], FRAPModel.REF_REACTION_OFF_RATE.getLowerBound(), FRAPModel.REF_REACTION_OFF_RATE.getUpperBound(), FRAPModel.REF_REACTION_OFF_RATE.getScale(), offRate);
params[FRAPModel.INDEX_PRIMARY_DIFF_RATE] = null;
params[FRAPModel.INDEX_PRIMARY_FRACTION] = null;
params[FRAPModel.INDEX_SECONDARY_DIFF_RATE] = null;
params[FRAPModel.INDEX_SECONDARY_FRACTION] = null;
params[FRAPModel.INDEX_ON_RATE] = null;
return params;
} else if (modelType == FRAPModel.IDX_MODEL_DIFF_BINDING) {
Parameter[] params = new Parameter[FRAPModel.NUM_MODEL_PARAMETERS_BINDING];
double primaryDiffRate = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.PrimaryRateAttrTag));
params[FRAPModel.INDEX_PRIMARY_DIFF_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_PRIMARY_DIFF_RATE], FRAPModel.REF_DIFFUSION_RATE_PARAM.getLowerBound(), FRAPModel.REF_DIFFUSION_RATE_PARAM.getUpperBound(), FRAPModel.REF_DIFFUSION_RATE_PARAM.getScale(), primaryDiffRate);
double primaryFraction = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.PrimaryFractionAttTag));
params[FRAPModel.INDEX_PRIMARY_FRACTION] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_PRIMARY_FRACTION], FRAPModel.REF_MOBILE_FRACTION_PARAM.getLowerBound(), FRAPModel.REF_MOBILE_FRACTION_PARAM.getUpperBound(), FRAPModel.REF_MOBILE_FRACTION_PARAM.getScale(), primaryFraction);
double bwmRate = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.BleachWhileMonitoringTauAttrTag));
params[FRAPModel.INDEX_BLEACH_MONITOR_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_BLEACH_MONITOR_RATE], FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getLowerBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getUpperBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getScale(), bwmRate);
double secDiffRate = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.SecondRateAttrTag));
params[FRAPModel.INDEX_SECONDARY_DIFF_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_SECONDARY_DIFF_RATE], FRAPModel.REF_SECOND_DIFFUSION_RATE_PARAM.getLowerBound(), FRAPModel.REF_SECOND_DIFFUSION_RATE_PARAM.getUpperBound(), FRAPModel.REF_SECOND_DIFFUSION_RATE_PARAM.getScale(), secDiffRate);
double secFraction = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.SecondFractionAttTag));
params[FRAPModel.INDEX_SECONDARY_FRACTION] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_SECONDARY_FRACTION], FRAPModel.REF_SECOND_MOBILE_FRACTION_PARAM.getLowerBound(), FRAPModel.REF_SECOND_MOBILE_FRACTION_PARAM.getUpperBound(), FRAPModel.REF_SECOND_MOBILE_FRACTION_PARAM.getScale(), secFraction);
double bsConcentration = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.BindingSiteConcentrationAttTag));
params[FRAPModel.INDEX_BINDING_SITE_CONCENTRATION] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_BINDING_SITE_CONCENTRATION], 0, 1, 1, bsConcentration);
double onRate = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.ReactionOnRateAttTag));
params[FRAPModel.INDEX_ON_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_ON_RATE], 0, 1e6, 1, onRate);
double offRate = Double.parseDouble(paramElement.getAttributeValue(MicroscopyXMLTags.ReactionOffRateAttTag));
params[FRAPModel.INDEX_OFF_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_OFF_RATE], 0, 1e6, 1, offRate);
return params;
}
return null;
}
Aggregations