예제 #1
0
    def __init__(self, data, supp, neighbors_graph, weights_neighbors, spectrums, \
                P, flux, sig, ker, ker_rot, D, basis, data_type=float):

        self._grad_data_type = data_type
        self.obs_data = data
        self.op = self.MX
        self.trans_op = self.MtX
        shap = data.shape
        self.shape = (shap[0] * D, shap[1] * D)
        self.D = D
        self.supp = supp
        self.neighbors_graph = neighbors_graph
        self.weights_neighbors = weights_neighbors
        self.spectrums = spectrums
        self.P = np.copy(P)
        self.flux = flux
        self.sig = sig
        self.ker = ker
        self.ker_rot = ker_rot
        self.basis = basis

        PowerMethod.__init__(self, self.trans_op_op,
                             (P.shape[-1], self.basis.shape[0]))

        self._current_rec = None  # stores latest application of self.MX
예제 #2
0
    def __init__(self, data, weights, A, H_loc, flux, sig,
                 ker, ker_rot, SNR_weights, D, filters, save_iter_cost=False,
                 data_type='float'):
        r"""Initialize class attributes."""
        self._grad_data_type = data_type
        self.obs_data = data
        self.obs_weights = weights
        self.op = self.MX
        self.trans_op = self.MtX
        self.A = np.copy(A)
        self.H_loc = np.copy(H_loc)
        self.flux = flux
        self.sig = sig
        self.normfacs = self.flux / (np.median(self.flux) * self.sig)
        self.ker = ker
        self.ker_rot = ker_rot
        self.D = D
        self.filters = filters
        self.SNR_weights = SNR_weights
        self.iter_cost = []
        self.save_iter_cost = save_iter_cost
        self.FdH_loc = None

        hr_shape = np.array(data.shape[:2]) * D
        PowerMethod.__init__(self, self.trans_op_op,
                             (A.shape[0], filters.shape[0]) + tuple(hr_shape),
                             auto_run=False)

        self._current_rec = None
예제 #3
0
    def __init__(self, data, weights, S, VT, H_glob, flux, sig, ker,
                 ker_rot, SNR_weights, D, save_iter_cost=False,
                 data_type='float'):
        r"""Initialize class attributes."""
        self._grad_data_type = data_type
        self.obs_data = data
        self.obs_weights = weights
        self.op = self.MX
        self.trans_op = self.MtX
        self.VT = VT
        self.H_glob = H_glob
        self.flux = flux
        self.sig = sig
        self.normfacs = self.flux / (np.median(self.flux) * self.sig)
        self.ker = ker
        self.ker_rot = ker_rot
        self.D = D
        self.SNR_weights = SNR_weights
        self.iter_cost = []
        self.save_iter_cost = save_iter_cost

        self.S = None
        self.FdS = None
        self.FdH_glob = None

        PowerMethod.__init__(self, self.trans_op_op,
                             (S.shape[-1], VT.shape[0]), auto_run=False)
        self.update_S(np.copy(S), update_spectral_radius=False)

        self._current_rec = None
예제 #4
0
파일: grads.py 프로젝트: tobias-liaudat/rca
    def __init__(self,
                 data,
                 weights,
                 S,
                 VT,
                 flux,
                 sig,
                 ker,
                 ker_rot,
                 D,
                 data_type='float'):
        self._grad_data_type = data_type
        self.obs_data = data
        self.obs_weights = weights
        self.op = self.MX
        self.trans_op = self.MtX
        self.VT = VT
        self.flux = flux
        self.sig = sig
        self.ker = ker
        self.ker_rot = ker_rot
        self.D = D
        # initialize Power Method to compute spectral radius
        PowerMethod.__init__(self,
                             self.trans_op_op, (S.shape[-1], VT.shape[0]),
                             auto_run=False)
        self.update_S(np.copy(S), update_spectral_radius=False)

        self._current_rec = None  # stores latest application of self.MX
예제 #5
0
파일: grads.py 프로젝트: tobias-liaudat/rca
    def __init__(self,
                 data,
                 weights,
                 A,
                 flux,
                 sig,
                 ker,
                 ker_rot,
                 D,
                 filters,
                 data_type='float'):
        self._grad_data_type = data_type
        self.obs_data = data
        self.obs_weights = weights
        self.op = self.MX
        self.trans_op = self.MtX
        self.A = np.copy(A)
        self.flux = flux
        self.sig = sig
        self.ker = ker
        self.ker_rot = ker_rot
        self.D = D
        self.filters = filters
        # initialize Power Method to compute spectral radius
        hr_shape = np.array(data.shape[:2]) * D
        PowerMethod.__init__(self,
                             self.trans_op_op,
                             (A.shape[0], filters.shape[0]) + tuple(hr_shape),
                             auto_run=False)

        self._current_rec = None  # stores latest application of self.MX
예제 #6
0
    def __init__(self, data, fourier_op):

        GradBasic.__init__(self, data, fourier_op.op, fourier_op.adj_op)
        self.fourier_op = fourier_op
        PowerMethod.__init__(self, self.trans_op_op, self.fourier_op.shape,
                             data_type=np.complex, auto_run=False)
        self.get_spec_rad(extra_factor=1.1)
예제 #7
0
 def __init__(self, data, linear_op, fourier_op):
     GradBasic.__init__(self, data, self._op_method, self._trans_op_method)
     self.fourier_op = fourier_op
     self.linear_op = linear_op
     coef = linear_op.op(np.zeros(fourier_op.shape).astype(np.complex))
     PowerMethod.__init__(self, self.trans_op_op, coef.shape,
                          data_type=np.complex, auto_run=False)
     self.get_spec_rad(extra_factor=1.1)
예제 #8
0
    def __init__(self, data, psf, psf_type='fixed', convolve_method='astropy'):

        self.obs_data = data
        self.op = self._H_op_method
        self.trans_op = self._Ht_op_method
        check_float(psf)
        check_npndarray(psf, writeable=False)
        self._psf = psf
        self._psf_type = psf_type
        self._convolve_method = convolve_method

        PowerMethod.__init__(self, self.trans_op_op, self.obs_data.shape)
예제 #9
0
    def __init__(self, data, fourier_op, S):
        """ Initilize the 'GradSynthesis2' class.
        """

        self.fourier_op = fourier_op
        self.S = S
        GradBasic.__init__(self, data, self._analy_op_method,
                           self._analy_rsns_op_method)
        PowerMethod.__init__(self,
                             self.trans_op_op,
                             self.fourier_op.shape,
                             data_type="complex128",
                             auto_run=False)
        self.get_spec_rad(extra_factor=1.1)
예제 #10
0
    def __init__(self, data, fourier_op, linear_op, S):
        """ Initilize the 'GradSynthesis2' class.
        """

        self.fourier_op = fourier_op
        self.linear_op = linear_op
        self.S = S
        GradBasic.__init__(self, data, self._synth_op_method,
                           self._synth_trans_op_method)
        coef = linear_op.op(np.zeros(fourier_op.shape).astype(np.complex))
        self.linear_op_coeffs_shape = coef.shape
        PowerMethod.__init__(self,
                             self.trans_op_op,
                             coef.shape,
                             data_type="complex128",
                             auto_run=False)
        self.get_spec_rad(extra_factor=1.1)
예제 #11
0
    def __init__(self, data, supp, neighbors_graph, weights_neighbors, spectrums, \
                A, flux, sig, ker, ker_rot, D, data_type=float):
        self._grad_data_type = data_type
        self.obs_data = data
        self.op = self.MX
        self.trans_op = self.MtX
        shap = data.shape
        self.shape = (shap[0] * D, shap[1] * D)
        self.D = D
        self.supp = supp
        self.neighbors_graph = neighbors_graph
        self.weights_neighbors = weights_neighbors
        self.spectrums = spectrums
        self.A = np.copy(A)
        self.flux = flux
        self.sig = sig
        self.ker = ker
        self.ker_rot = ker_rot
        PowerMethod.__init__(
            self, self.trans_op_op,
            (np.prod(self.shape), np.prod(self.shape), A.shape[0]))
        print " > SPECTRAL RADIUS:\t{}".format(self.spec_rad)

        self._current_rec = None  # stores latest application of self.MX
예제 #12
0
 def set_flux(self, flux_new, pwr_en=False):
     self.flux = np.copy(flux_new)
     if pwr_en:
         PowerMethod.__init__(
             self, self.trans_op_op,
             (np.prod(self.shape), np.prod(self.shape), self.A.shape[0]))
예제 #13
0
 def set_A(self, A_new, pwr_en=True):
     self.A = np.copy(A_new)
     if pwr_en:
         PowerMethod.__init__(
             self, self.trans_op_op,
             (np.prod(self.shape), np.prod(self.shape), self.A.shape[0]))
예제 #14
0
 def set_flux(self, flux_new, pwr_en=False):
     self.flux = np.copy(flux_new)
     if pwr_en:
         PowerMethod.__init__(self, self.trans_op_op,
                              (self.P.shape[-1], self.basis.shape[0]))
예제 #15
0
 def set_P(self, P_new, pwr_en=True):
     self.P = np.copy(P_new)
     if pwr_en:
         PowerMethod.__init__(self, self.trans_op_op,
                              (self.P.shape[-1], self.basis.shape[0]))