use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class EstParams_TwoDiffComponentPanel method loadBatchRunParameters.
public void loadBatchRunParameters(File inFile) {
String xmlString;
try {
xmlString = XmlUtil.getXMLString(inFile.getAbsolutePath());
BatchRunXmlReader batchRunXmlReader = new BatchRunXmlReader();
FRAPBatchRunWorkspace tempBatchRunWorkspace = batchRunXmlReader.getBatchRunWorkspace(XmlUtil.stringToXML(xmlString, null).getRootElement());
Parameter[] parameters = tempBatchRunWorkspace.getAverageParameters();
if (parameters != null && parameters.length > 0 && parameters.length == FRAPModel.NUM_MODEL_PARAMETERS_TWO_DIFF) {
String paramMsg = "Replace the current parameters with the following parameter values, \n";
for (int i = 0; i < parameters.length; i++) {
paramMsg = paramMsg + parameters[i].getName() + ": " + parameters[i].getInitialGuess() + "\n";
}
String choice = DialogUtils.showWarningDialog(this, paramMsg, new String[] { UserMessage.OPTION_OK, UserMessage.OPTION_CANCEL }, UserMessage.OPTION_OK);
if (choice == UserMessage.OPTION_OK) {
frapWorkspace.getWorkingFrapStudy();
getPureDiffusionPanel().setParameterValues(parameters[FRAPModel.INDEX_PRIMARY_DIFF_RATE].getInitialGuess(), parameters[FRAPModel.INDEX_PRIMARY_FRACTION].getInitialGuess(), parameters[FRAPModel.INDEX_BLEACH_MONITOR_RATE].getInitialGuess(), parameters[FRAPModel.INDEX_SECONDARY_DIFF_RATE].getInitialGuess(), parameters[FRAPModel.INDEX_SECONDARY_FRACTION].getInitialGuess());
}
} else {
throw new Exception("Parameters are null or number of applied parameters don't match the number (5) of parameters for diffusion with two diffusing components.");
}
} catch (Exception e) {
e.printStackTrace(System.out);
DialogUtils.showErrorDialog(this, e.getMessage());
}
}
use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class FRAPDiffOneParamPanel method runAndSetBestParameters.
public void runAndSetBestParameters() {
AsynchClientTask optTask = new AsynchClientTask("Running optimization ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
String errorStr = checkParameters();
if (errorStr.equals("")) {
frapOptData.setNumEstimatedParams(getCurrentParameters().length);
final Parameter[] bestParameters = frapOptData.getBestParamters(getCurrentParameters(), frapWorkspace.getWorkingFrapStudy().getSelectedROIsForErrorCalculation());
hashTable.put("bestParameters", bestParameters);
} else {
throw new IllegalArgumentException(errorStr);
}
}
};
AsynchClientTask showResultTask = new AsynchClientTask("Running optimization ...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
final Parameter[] bestParameters = (Parameter[]) hashTable.get("bestParameters");
if (bestParameters.length == FRAPModel.NUM_MODEL_PARAMETERS_ONE_DIFF) {
setParameterValues(new Double(bestParameters[FRAPModel.INDEX_PRIMARY_DIFF_RATE].getInitialGuess()), new Double(bestParameters[FRAPModel.INDEX_PRIMARY_FRACTION].getInitialGuess()), new Double(bestParameters[FRAPModel.INDEX_BLEACH_MONITOR_RATE].getInitialGuess()));
firePropertyChange(FRAPSingleWorkspace.PROPERTY_CHANGE_OPTIMIZER_VALUE, null, null);
}
}
};
// dispatch
ClientTaskDispatcher.dispatch(FRAPDiffOneParamPanel.this, new Hashtable<String, Object>(), new AsynchClientTask[] { optTask, showResultTask }, false, false, null, true);
}
use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class FRAPDiffTwoParamPanel method runAndSetBestParameters.
public void runAndSetBestParameters() {
AsynchClientTask optTask = new AsynchClientTask("Running optimization ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
String errorStr = checkParameters();
if (errorStr.equals("")) {
frapOptData.setNumEstimatedParams(getCurrentParameters().length);
final Parameter[] bestParameters = frapOptData.getBestParamters(getCurrentParameters(), frapWorkspace.getWorkingFrapStudy().getSelectedROIsForErrorCalculation());
hashTable.put("bestParameters", bestParameters);
} else {
throw new IllegalArgumentException(errorStr);
}
}
};
AsynchClientTask showResultTask = new AsynchClientTask("Running optimization ...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
final Parameter[] bestParameters = (Parameter[]) hashTable.get("bestParameters");
if (bestParameters.length == FRAPModel.NUM_MODEL_PARAMETERS_TWO_DIFF) {
setParameterValues(new Double(bestParameters[FRAPModel.INDEX_PRIMARY_DIFF_RATE].getInitialGuess()), new Double(bestParameters[FRAPModel.INDEX_PRIMARY_FRACTION].getInitialGuess()), new Double(bestParameters[FRAPModel.INDEX_BLEACH_MONITOR_RATE].getInitialGuess()), new Double(bestParameters[FRAPModel.INDEX_SECONDARY_DIFF_RATE].getInitialGuess()), new Double(bestParameters[FRAPModel.INDEX_SECONDARY_FRACTION].getInitialGuess()));
firePropertyChange(FRAPSingleWorkspace.PROPERTY_CHANGE_OPTIMIZER_VALUE, null, null);
}
}
};
// dispatch
ClientTaskDispatcher.dispatch(FRAPDiffTwoParamPanel.this, new Hashtable<String, Object>(), new AsynchClientTask[] { optTask, showResultTask }, false, false, null, true);
}
use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class FRAPDiffTwoParamPanel method createParameterArray.
private static Parameter[] createParameterArray(double diffusionRate, double mobileFraction, double monitorBleachRate, double secondDiffRate, double secondMobileFrac) {
Parameter[] params = null;
Parameter diff = 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(), diffusionRate);
Parameter mobileFrac = 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(), mobileFraction);
Parameter monitorRate = 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(), monitorBleachRate);
Parameter secDiffRate = 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(), secondDiffRate);
Parameter secMobileFrac = 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(), secondMobileFrac);
params = new Parameter[FRAPModel.NUM_MODEL_PARAMETERS_TWO_DIFF];
params[FRAPModel.INDEX_PRIMARY_DIFF_RATE] = diff;
params[FRAPModel.INDEX_PRIMARY_FRACTION] = mobileFrac;
params[FRAPModel.INDEX_BLEACH_MONITOR_RATE] = monitorRate;
params[FRAPModel.INDEX_SECONDARY_DIFF_RATE] = secDiffRate;
params[FRAPModel.INDEX_SECONDARY_FRACTION] = secMobileFrac;
return params;
}
use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class FRAPReactionDiffusionParamPanel method createParameterArray.
private static Parameter[] createParameterArray(double freeDiffRate, double freeFraction, double monitorBleachRate, double complexDifffRate, double complexFraction, double bsConc, double onRate, double offRate) {
Parameter[] params = null;
Parameter primaryDiff = 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(), freeDiffRate);
Parameter primaryFrac = 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(), freeFraction);
Parameter bleachWhileMonitoringRate = 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(), monitorBleachRate);
Parameter secondaryDiff = 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(), complexDifffRate);
Parameter secondaryFrac = 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(), complexFraction);
Parameter bsConcentration = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_BINDING_SITE_CONCENTRATION], 0, 1, 1, bsConc);
Parameter onReacRate = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_ON_RATE], 0, 1e6, 1, onRate);
Parameter offReacRate = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_OFF_RATE], 0, 1e6, 1, offRate);
params = new Parameter[FRAPModel.NUM_MODEL_PARAMETERS_BINDING];
params[FRAPModel.INDEX_PRIMARY_DIFF_RATE] = primaryDiff;
params[FRAPModel.INDEX_PRIMARY_FRACTION] = primaryFrac;
params[FRAPModel.INDEX_BLEACH_MONITOR_RATE] = bleachWhileMonitoringRate;
params[FRAPModel.INDEX_SECONDARY_DIFF_RATE] = secondaryDiff;
params[FRAPModel.INDEX_SECONDARY_FRACTION] = secondaryFrac;
params[FRAPModel.INDEX_BINDING_SITE_CONCENTRATION] = bsConcentration;
params[FRAPModel.INDEX_ON_RATE] = onReacRate;
params[FRAPModel.INDEX_OFF_RATE] = offReacRate;
return params;
}
Aggregations