Search in sources :

Example 1 with NotImplementedException

use of gdsc.core.utils.NotImplementedException in project GDSC-SMLM by aherbert.

the class BaseSteppingFunctionSolverTest method getSolver.

SteppingFunctionSolver getSolver(SteppingFunctionSolverClamp clamp, SteppingFunctionSolverType type) {
    ErfGaussian2DFunction f = (ErfGaussian2DFunction) GaussianFunctionFactory.create2D(1, size, size, flags, null);
    ToleranceChecker tc = new ToleranceChecker(1e-5, 1e-5, 0, 0, 100);
    ParameterBounds bounds = new ParameterBounds(f);
    switch(clamp) {
        case DYNAMIC_CLAMP:
            bounds.setDynamicClamp(true);
        case CLAMP:
            bounds.setClampValues(defaultClampValues);
        case NO_CLAMP:
        default:
            break;
    }
    SteppingFunctionSolver solver;
    switch(type) {
        case LSELVM:
            solver = new LSELVMSteppingFunctionSolver(f, tc, bounds);
            break;
        case MLELVM:
            solver = new MLELVMSteppingFunctionSolver(f, tc, bounds);
            // MLE requires a positive function value so use a lower bound
            solver.setBounds(new double[7], null);
            break;
        case WLSELVM:
            solver = new WLSELVMSteppingFunctionSolver(f, tc, bounds);
            break;
        case FastMLE:
            solver = new FastMLESteppingFunctionSolver(f, tc, bounds);
            // MLE requires a positive function value so use a lower bound
            solver.setBounds(new double[7], null);
            break;
        case BTFastMLE:
            solver = new BacktrackingFastMLESteppingFunctionSolver(f, tc, bounds);
            // MLE requires a positive function value so use a lower bound
            solver.setBounds(new double[7], null);
            break;
        case JFastMLE:
            FastMLESteppingFunctionSolver s = new FastMLESteppingFunctionSolver(f, tc, bounds);
            s.enableJacobianSolution(true);
            // MLE requires a positive function value so use a lower bound
            solver = s;
            solver.setBounds(new double[7], null);
            break;
        default:
            throw new NotImplementedException();
    }
    if (solver instanceof LVMSteppingFunctionSolver)
        ((LVMSteppingFunctionSolver) solver).setInitialLambda(1);
    return solver;
}
Also used : ErfGaussian2DFunction(gdsc.smlm.function.gaussian.erf.ErfGaussian2DFunction) NotImplementedException(gdsc.core.utils.NotImplementedException)

Aggregations

NotImplementedException (gdsc.core.utils.NotImplementedException)1 ErfGaussian2DFunction (gdsc.smlm.function.gaussian.erf.ErfGaussian2DFunction)1