Exemplo n.º 1
0
    def objgrad(logim):
	Frames = np.exp(logim.reshape((-1, N_pixel, N_pixel)))
        if entropy == "simple":
            s = np.concatenate([-mx.ssimplegrad(Frames[i].ravel(), nprior_List[i])*Frames[i].ravel() for i in range(N_frame)])
        elif entropy == "l1":
            s = np.concatenate([-mx.sl1grad(Frames[i].ravel(), nprior_List[i])*Frames[i].ravel() for i in range(N_frame)])
        elif entropy == "gs":
            s = np.concatenate([-mx.sgsgrad(Frames[i].ravel(), nprior_List[i])*Frames[i].ravel() for i in range(N_frame)])
        elif entropy == "tv":
            s = np.concatenate([-mx.stvgrad(Frames[i].ravel(), Prior_List[0].xdim, Prior_List[0].ydim)*Frames[i].ravel() for i in range(N_frame)])
            
	chisq_total_grad = np.concatenate([mx.chisqgrad_bi(Frames[i].ravel(), A_List[i], bi_List[i], sigma_List[i])*Frames[i].ravel()/N_frame for i in range(N_frame)])  

	s_dynamic_grad = dynamic_regularizer_gradient(Frames, gauss)

	t = np.concatenate( [ 2.0 * gamma * (np.sum(Frames[i].ravel()) - Flux_List[i]) * Frames[i].ravel()/N_frame   for i in range(N_frame)] )

        return (s + beta * s_dynamic_grad + alpha * chisq_total_grad + t) 
Exemplo n.º 2
0
    def objgrad(logim):
	Frames = np.exp(logim.reshape((-1, N_pixel, N_pixel)))
        if entropy == "simple":
            s = np.concatenate([-mx.ssimplegrad(Frames[i].ravel(), nprior_List[i])*Frames[i].ravel() for i in range(N_frame)])
        elif entropy == "l1":
            s = np.concatenate([-mx.sl1grad(Frames[i].ravel(), nprior_List[i])*Frames[i].ravel() for i in range(N_frame)])
        elif entropy == "gs":
            s = np.concatenate([-mx.sgsgrad(Frames[i].ravel(), nprior_List[i])*Frames[i].ravel() for i in range(N_frame)])
        elif entropy == "tv":
            s = np.concatenate([-mx.stvgrad(Frames[i].ravel(), Prior_List[0].xdim, Prior_List[0].ydim)*Frames[i].ravel() for i in range(N_frame)])
            
	#s = [grad for i in range(N_frame) for grad in -stvgrad(Frames[i].ravel(), Prior_List[0].xdim, Prior_List[0].ydim)*Frames[i].ravel()]
	#s = np.concatenate(s)

	chisq_total_grad = np.concatenate([mx.chisqgrad(Frames[i].ravel(), A_List[i], vis_List[i], sigma_List[i])*Frames[i].ravel()/N_frame for i in range(N_frame)])  

	s_dynamic_grad = dynamic_regularizer_gradient(Frames, gauss)
	#return s_dynamic_grad
        return (s + beta * s_dynamic_grad + alpha * chisq_total_grad)