def genSerBasisMatrix(beta,nmax,ns,r,th): """Generate the n x k matrix of basis functions(k) for each pixel(n) beta: characteristic size of the shaeplets nmax: maximum decomposition order r: radius matrix of n pixels th: theta matrix of n pixels """ bvals=[] for nn in range(nmax): for mm in n.arange(-1*nn,nn+1): if (nn%2==0 and mm%2==0) or (nn%2==1 and mm%2==1): bf=shapelet.serDimBasis(nn,ns,mm,beta=beta) bvals.append(shapelet.computeBasisPolar(bf,r,th).flatten()) bm=n.array(bvals) return bm.transpose()
def genPolarBasisMatrix(beta,nmax,phi,r,th,fourier=False): """Generate the n x k matrix of basis functions(k) for each pixel(n) beta: characteristic size of the shapelets (b_major, b_minor) nmax: maximum decomposition order phi: rotation angle r: radius matrix of n pixels th: theta matrix of n pixels fourier: return a FOurer transformed version of the basis functions """ bvals=[] if type(nmax) is int: nmax=[nmax,nmax] for nn in range(nmax[0]): for mm in np.arange(-1*nn,nn+1): if (nn%2==0 and mm%2==0) or (nn%2==1 and mm%2==1): bf=shapelet.polarDimBasis(nn,mm,beta=beta,phi=phi,fourier=fourier) bvals.append(shapelet.computeBasisPolar(bf,r,th).flatten()) bm=np.array(bvals) return bm.transpose()
def genPolarBasisMatrix(beta, nmax, phi, r, th, fourier=False): """Generate the n x k matrix of basis functions(k) for each pixel(n) beta: characteristic size of the shapelets (b_major, b_minor) nmax: maximum decomposition order phi: rotation angle r: radius matrix of n pixels th: theta matrix of n pixels fourier: return a FOurer transformed version of the basis functions """ bvals = [] if type(nmax) is int: nmax = [nmax, nmax] for nn in range(nmax[0]): for mm in np.arange(-1 * nn, nn + 1): if (nn % 2 == 0 and mm % 2 == 0) or (nn % 2 == 1 and mm % 2 == 1): bf = shapelet.polarDimBasis(nn, mm, beta=beta, phi=phi, fourier=fourier) bvals.append(shapelet.computeBasisPolar(bf, r, th).flatten()) bm = np.array(bvals) return bm.transpose()