Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
filter_norm = np.array([[norm(b) * c * np.ones(psf.shape[1:])
for b, c in zip(a,
kwargs['psf_wave_thresh_factor'])]
for a in filter_conv])
noise_est = sigma_mad(psf)
print(' - PSF noise est:', noise_est)
kwargs['psf_reweight'] = cwbReweight(noise_est * filter_norm)
if list(kwargs['psf_reweight'].weights.shape) != kwargs['dual_shape']:
raise ValueError('The shape of the input weights must match the dual '
'shape.')
from proximity import ProxPSF
psf_prox_primal = ProxPSF(kwargs['grad_psf_op']._psf0)
kwargs['psf_prox_dual'] = SparseThreshold(kwargs['linear_op'],
kwargs['psf_reweight'].weights)
psf_cost = (costObj([kwargs['grad_psf_op'], psf_prox_primal,
kwargs['psf_prox_dual']],
tolerance=kwargs['convergence'],
cost_interval=kwargs['cost_window'],
plot_output=kwargs['output'],
verbose=not kwargs['quiet']))
psf_cost._check_cost = lambda: False
kwargs['cost_op']._check_cost = lambda: False
kwargs['optimisation_psf'] = (Condat(kwargs['grad_psf_op'].delta_psf,
np.zeros(kwargs['dual_shape']),
kwargs['grad_psf_op'],
psf_prox_primal,