def as_matrix(self): """ Returns the l array as an lm-indexed diagonal matrix, with repeated elements for each m in [-l, l]. EXAMPLES:: >>> ClArray([1,2], 1, 2).as_matrix() 8 by 8 diagonal matrix of float64: [ 1. 0. 0. 0. 0. 0. 0. 0.] [ 0. 1. 0. 0. 0. 0. 0. 0.] [ 0. 0. 1. 0. 0. 0. 0. 0.] [ 0. 0. 0. 2. 0. 0. 0. 0.] [ 0. 0. 0. 0. 2. 0. 0. 0.] [ 0. 0. 0. 0. 0. 2. 0. 0.] [ 0. 0. 0. 0. 0. 0. 2. 0.] [ 0. 0. 0. 0. 0. 0. 0. 2.] """ return isotropic_real_covar(self.astype(np.double))
def load_covariance(self, lmin, lmax, dtype=np.double): Cl = self._power_spectrum.by_l[lmin:lmax + 1].astype(dtype) return isotropic_real_covar(Cl)