コード例 #1
0
    def calc_conditional_prior(self, x_free, geom):
        """Calculate prior distribution of radiance. This depends on the
        location in the state space. Return the inverse covariance and
        its square root (for non-quadratic error residual calculation)."""

        x = self.full_statevector(x_free)
        xa = self.fm.xa(x, geom)
        Sa = self.fm.Sa(x, geom)

        # If there aren't any fixed parameters, we just directly
        if self.x_fixed is None or self.grid_as_starting_points:
            Sa_inv, Sa_inv_sqrt = svd_inv_sqrt(
                Sa,
                hashtable=self.hashtable,
                max_hash_size=self.max_table_size)
            return xa, Sa, Sa_inv, Sa_inv_sqrt

        else:
            # otherwise condition on fixed variables
            #TODO: could make the below calculation without the svd_inv (using full initial inversion),
            # which would be way cheaper
            xa_free, Sa_free = conditional_gaussian(xa, Sa, self.inds_free,
                                                    self.inds_fixed,
                                                    self.x_fixed)
            Sa_free_inv, Sa_free_inv_sqrt = svd_inv_sqrt(
                Sa_free,
                hashtable=self.hashtable,
                max_hash_size=self.max_table_size)
            return xa_free, Sa_free, Sa_free_inv, Sa_free_inv_sqrt
コード例 #2
0
ファイル: inverse.py プロジェクト: pgbrodrick/isofit
    def calc_prior(self, x, geom):
        """Calculate prior distribution of radiance. This depends on the 
        location in the state space. Return the inverse covariance and 
        its square root (for non-quadratic error residual calculation)."""

        xa = self.fm.xa(x, geom)
        Sa = self.fm.Sa(x, geom)
        Sa_inv, Sa_inv_sqrt = svd_inv_sqrt(Sa, hashtable=self.hashtable)
        return xa, Sa, Sa_inv, Sa_inv_sqrt
コード例 #3
0
ファイル: inverse.py プロジェクト: pgbrodrick/isofit
    def calc_Seps(self, x, meas, geom):
        """Calculate (zero-mean) measurement distribution in radiance terms.
        This depends on the location in the state space. This distribution is 
        calculated over one or more subwindows of the spectrum. Return the 
        inverse covariance and its square root."""

        Seps = self.fm.Seps(x, meas, geom)
        wn = len(self.winidx)
        Seps_win = np.zeros((wn, wn))
        for i in range(wn):
            Seps_win[i, :] = Seps[self.winidx[i], self.winidx]
        return svd_inv_sqrt(Seps_win, hashtable=self.hashtable)
コード例 #4
0
    def calc_conditional_prior(self, x_free, geom):
        """Calculate prior distribution of radiance. This depends on the
        location in the state space. Return the inverse covariance and
        its square root (for non-quadratic error residual calculation)."""

        x = self.full_statevector(x_free)
        xa = self.fm.xa(x, geom)
        Sa = self.fm.Sa(x, geom)

        # If there aren't any fixed parameters, we just directly
        if self.x_fixed is None:
            x[self.inds_fixed] = self.x_fixed
            Sa_inv, Sa_inv_sqrt = svd_inv_sqrt(Sa, hashtable=self.hashtable)
            return xa, Sa, Sa_inv, Sa_inv_sqrt

        else:
            # otherwise condition on fixed variables
            xa_free, Sa_free = conditional_gaussian(xa, Sa, self.inds_free,
                                                    self.inds_fixed,
                                                    self.x_fixed)
            Sa_free_inv, Sa_free_inv_sqrt = svd_inv_sqrt(
                Sa_free, hashtable=self.hashtable)
            return xa_free, Sa_free, Sa_free_inv, Sa_free_inv_sqrt