"""This module contains classes for defining gradients operators. Taken frompysap-mri with minor changes (name of parameters (data_op), change of datatype to float)."""importnumpyasnpfrommodopt.math.matriximportPowerMethodfrommodopt.opt.gradientimportGradBasic
[docs]classGradAnalysis(GradBasic,PowerMethod):""" Gradient operator for the data attachment term in the reconstruction process in analysis formulation """def__init__(self,data_op):GradBasic.__init__(self,np.array(0),data_op.op,data_op.adj_op)self.data_op=data_opPowerMethod.__init__(self,self.trans_op_op,self.data_op.shape,data_type=data_op.dtype,auto_run=False)self.get_spec_rad(extra_factor=1.1)
[docs]classGradSynthesis(GradBasic,PowerMethod):""" Gradient operator for the data attachment term in the reconstruction process in synthesis formulation """def__init__(self,linear_op,data_op):GradBasic.__init__(self,np.array(0),self._op_method,self._trans_op_method)self.data_op=data_opself.linear_op=linear_opcoef=linear_op.op(np.zeros(data_op.shape).astype(data_op.dtype))PowerMethod.__init__(self,self.trans_op_op,coef.shape,data_type=data_op.dtype,auto_run=False)self.get_spec_rad(extra_factor=1.1)