conv_abs_lapl *= 2 / np.max(conv_abs_lapl) conv_abs_lapl[:] = np.minimum(conv_abs_lapl, 1) exponent = 2.0 - conv_abs_lapl exponent.show(force_show=True) # Disturb the exponent function # var_exponent_arr[:, 100:150] = 2.0 # --- Set up the inverse problem --- # # Assemble operators and functionals for the solver gradient = odl.Gradient(reco_space, pad_mode='order1') lin_ops = [odl.IdentityOperator(reco_space), gradient] data_matching = odl.solvers.L2NormSquared(reco_space).translated(data) varlp_func = variable_lp.VariableLpModular(gradient.range, exponent, impl='cython') # Left-multiplication version reg_param = 2e0 regularizer = reg_param * varlp_func # Right-multiplication version # reg_param = 8e-2 # regularizer = varlp_func * reg_param g = [data_matching, regularizer] f = odl.solvers.IndicatorBox(reco_space, 0, 255) # Uncomment the combined callback to also display iterates callback = (odl.solvers.CallbackShow('iterate', step=20, clim=[0, 255]) & odl.solvers.CallbackPrintIteration()) # callback = odl.solvers.CallbackPrintIteration()
post_conv = fourier.inverse * post_kernel_ft * fourier conv_abs_lapl = np.maximum(post_conv(abs_lapl), 0) conv_abs_lapl -= np.min(conv_abs_lapl) conv_abs_lapl *= 2 / np.max(conv_abs_lapl) conv_abs_lapl[:] = np.minimum(conv_abs_lapl, 1) exponent = 2.0 - conv_abs_lapl exponent.show(force_show=True) # --- Set up the inverse problem --- # # Assemble operators and functionals for the solver gradient = odl.Gradient(reco_space, pad_mode='order1') lin_ops = [odl.IdentityOperator(reco_space), gradient] data_matching = odl.solvers.L2NormSquared(reco_space).translated(data) varlp_func = variable_lp.VariableLpModular(gradient.range, exponent, impl='numba_parallel') reg_param = 4.5e-3 regularizer = reg_param * varlp_func g = [data_matching, regularizer] f = odl.solvers.IndicatorBox(reco_space, 0, 1.0) # Uncomment the combined callback to also display iterates callback = (odl.solvers.CallbackShow('iterate', step=10, clim=[0, 1.0]) & odl.solvers.CallbackPrintIteration()) # callback = odl.solvers.CallbackPrintIteration() # Solve with initial guess x = data. # Step size parameters are selected to ensure convergence. # See douglas_rachford_pd doc for more information.