Esempio n. 1
0
    def solve(self, x, tqu):
        self.watch = util.stopwatch()

        self.iter_tot = 0
        self.prev_eps = None

        logger = (lambda iter, eps, stage=0, **kwargs: self.log(
            stage, iter, eps, **kwargs))

        monitor = cd_monitors.monitor_basic(self.opfilt.dot_op(),
                                            logger=logger,
                                            iter_max=self.iter_max,
                                            eps_min=self.eps_min)

        cd_solve.cd_solve(x=x,
                          b=self.opfilt.calc_prep(tqu, self.s_inv_filt,
                                                  self.n_inv_filt),
                          fwd_op=self.opfilt.fwd_op(self.s_inv_filt,
                                                    self.n_inv_filt),
                          pre_ops=[self.pre_op],
                          dot_op=self.opfilt.dot_op(),
                          criterion=monitor,
                          tr=cd_solve.tr_cg,
                          cache=cd_solve.cache_mem())

        return self.opfilt.calc_fini(x, self.s_inv_filt, self.n_inv_filt)
Esempio n. 2
0
    def solve(self, soltn, alms, finiop=None, d0=None, no_calc_prep=False, logger=None):
        self.watch = stopwatch()

        self.iter_tot = 0
        self.prev_eps = None

        if logger is None:
            logger = (lambda it, eps, stage=self.bstage, **kwargs: self.log(stage, it, eps, **kwargs))

        if hasattr(self.opfilt, 'crit_op'):
            print("**** multigrid : setting up criterium operation")
            crit_op = self.opfilt.crit_op(self.cov)
        else:
            crit_op = self.opfilt.dot_op(self.cov.lib_skyalm)
        fwd_op = self.opfilt.fwd_op(self.cov, False)
        if not no_calc_prep:
            _b = self.opfilt.calc_prep(alms, self.cov)
        else:
            _b = alms.copy()
        if d0 is None: d0 = crit_op(_b, _b)
        monitor = cd_monitors.monitor_basic(crit_op, logger=logger, iter_max=self.bstage.iter_max,
                                            eps_min=self.bstage.eps_min, d0=d0)
        cd_solve.cd_solve(soltn, _b, fwd_op, self.bstage.pre_ops, self.opfilt.dot_op(self.cov.lib_skyalm), monitor,
                          tr=self.bstage.tr, cache=self.bstage.cache)
        if finiop is None:
            return
        else:
            assert hasattr(self.opfilt, 'apply_fini_' + finiop)
            return getattr(self.opfilt, 'apply_fini_' + finiop)(soltn, self.cov, alms)
    def solve(self, soltn, tpn_map):
        self.watch = util.stopwatch()

        self.iter_tot = 0
        self.prev_eps = None

        logger = (lambda iter, eps, stage=self.bstage, **kwargs: self.log(
            stage, iter, eps, **kwargs))

        monitor = cd_monitors.monitor_basic(self.opfilt.dot_op(),
                                            logger=logger,
                                            iter_max=self.bstage.iter_max,
                                            eps_min=self.bstage.eps_min)

        tpn_alm = self.opfilt.calc_prep(tpn_map, self.s_cls, self.n_inv_filt)

        fwd_op = self.opfilt.fwd_op(self.s_cls, self.n_inv_filt)

        cd_solve.cd_solve(soltn,
                          tpn_alm,
                          fwd_op,
                          self.bstage.pre_ops,
                          self.opfilt.dot_op(),
                          monitor,
                          tr=self.bstage.tr,
                          cache=self.bstage.cache)

        self.opfilt.apply_fini(soltn, self.s_cls, self.n_inv_filt)
Esempio n. 4
0
    def calc(self, alms):
        monitor = cd_monitors.monitor_basic(self.opfilt.dot_op(self.cov.lib_skyalm), iter_max=self.iter_max, eps_min=self.eps_min,
                                            logger=self.logger)
        soltn = alms * 0.0
        cd_solve.cd_solve(soltn, alms.copy(),
                          self.fwd_op, self.pre_ops, self.opfilt.dot_op(self.cov.lib_skyalm), monitor, tr=self.tr, cache=self.cache)

        return soltn
Esempio n. 5
0
    def calc(self, talm):
        monitor = cd_monitors.monitor_basic(self.opfilt.dot_op(), iter_max=self.iter_max, eps_min=self.eps_min, logger=self.logger)

        soltn = talm * 0.0

        cd_solve.cd_solve( soltn, util_alm.alm_copy(talm, lmax=self.lmax),
                           self.fwd_op, self.pre_ops, self.opfilt.dot_op(),
                           monitor, tr=self.tr, cache=self.cache )

        return util_alm.alm_splice(soltn, talm, self.lmax)
Esempio n. 6
0
    def calc(self, teb):
        monitor = cd_monitors.monitor_basic(self.opfilt.dot_op(), iter_max=self.iter_max, eps_min=self.eps_min, logger=self.logger)

        x = maps.tebfft( teb.nx, teb.dx, ny=teb.ny, dy=teb.dy )

        cd_solve.cd_solve( x, teb,
                           self.fwd_op, self.pre_ops, self.opfilt.dot_op(),
                           monitor, tr=self.tr, cache=self.cache )

        return x
Esempio n. 7
0
    def solve( self, x, tqu ):
        self.watch = util.stopwatch()

        self.iter_tot   = 0
        self.prev_eps   = None

        logger = (lambda iter, eps, stage=0, **kwargs :
                  self.log(stage, iter, eps, **kwargs))

        monitor = cd_monitors.monitor_basic(self.opfilt.dot_op(), logger=logger, iter_max=self.iter_max, eps_min=self.eps_min)

        cd_solve.cd_solve( x = x,
                           b = self.opfilt.calc_prep(tqu, self.s_inv_filt, self.n_inv_filt),
                           fwd_op = self.opfilt.fwd_op(self.s_inv_filt, self.n_inv_filt),
                           pre_ops = [self.pre_op], dot_op = self.opfilt.dot_op(),
                           criterion = monitor, tr=cd_solve.tr_cg, cache=cd_solve.cache_mem() )

        return self.opfilt.calc_fini( x, self.s_inv_filt, self.n_inv_filt)
Esempio n. 8
0
    def calc(self, teb):
        monitor = cd_monitors.monitor_basic(self.opfilt.dot_op(),
                                            iter_max=self.iter_max,
                                            eps_min=self.eps_min,
                                            logger=self.logger)

        x = maps.tebfft(teb.nx, teb.dx, ny=teb.ny, dy=teb.dy)

        cd_solve.cd_solve(x,
                          teb,
                          self.fwd_op,
                          self.pre_ops,
                          self.opfilt.dot_op(),
                          monitor,
                          tr=self.tr,
                          cache=self.cache)

        return x
    def calc(self, talm):
        monitor = cd_monitors.monitor_basic(self.opfilt.dot_op(),
                                            iter_max=self.iter_max,
                                            eps_min=self.eps_min,
                                            logger=self.logger)

        soltn = talm * 0.0

        cd_solve.cd_solve(soltn,
                          util_alm.alm_copy(talm, lmax=self.lmax),
                          self.fwd_op,
                          self.pre_ops,
                          self.opfilt.dot_op(),
                          monitor,
                          tr=self.tr,
                          cache=self.cache)

        return util_alm.alm_splice(soltn, talm, self.lmax)
Esempio n. 10
0
    def solve( self, soltn, tpn_map ):
        self.watch = util.stopwatch()

        self.iter_tot   = 0        
        self.prev_eps   = None

        logger = (lambda iter, eps, stage=self.bstage, **kwargs :
                  self.log(stage, iter, eps, **kwargs))

        monitor = cd_monitors.monitor_basic(self.opfilt.dot_op(), logger=logger, iter_max=self.bstage.iter_max, eps_min=self.bstage.eps_min)

        tpn_alm = self.opfilt.calc_prep(tpn_map, self.s_cls, self.n_inv_filt)

        fwd_op  = self.opfilt.fwd_op(self.s_cls, self.n_inv_filt)

        cd_solve.cd_solve( soltn, tpn_alm,
                           fwd_op, self.bstage.pre_ops, self.opfilt.dot_op(), monitor,
                           tr=self.bstage.tr, cache=self.bstage.cache )

        self.opfilt.apply_fini( soltn, self.s_cls, self.n_inv_filt )