예제 #1
0
파일: spear.py 프로젝트: askielboe/JAVELIN
def spear(x,y,idx,idy,sigma,tau,lags,wids,scales,symm=None,set_pmap=False) :
    """
    Clean version without multithreading. Used when multiprocessing is on (e.g., 
    in emcee MCMC sampling).

    set_pmap needs to be turned on for the Pmap_Model.
    """
    if (sigma<0. or tau<0.) :
        raise ValueError, 'The amp and scale parameters must be positive.'
    if (symm is None) :
        symm = (x is y) and (idx is idy)
    x = regularize_array(x)
    y = regularize_array(y)
    nx = x.shape[0]
    ny = y.shape[0]
    if np.isscalar(idx) :
        idx = np.ones(nx, dtype="int", order="F")*idx
    if np.isscalar(idy) :
        idy = np.ones(nx, dtype="int", order="F")*idy
    # Allocate the matrix
    C = np.asmatrix(np.empty((nx,ny),dtype=float,order='F'))
    if set_pmap :
        SCF.covmatpmap_bit(C,x,y,idx,idy,sigma,tau,lags,wids,scales,0,-1,symm)
    else :
        SCF.covmat_bit(C,x,y,idx,idy,sigma,tau,lags,wids,scales,0,-1,symm)
    if symm:
        isotropic_cov_funs.symmetrize(C)
    return(C)
예제 #2
0
def spear(x,
          y,
          idx,
          idy,
          sigma,
          tau,
          lags,
          wids,
          scales,
          symm=None,
          set_pmap=False,
          set_dpmap=False):
    """ Clean version without multithreading. Used when multiprocessing is on
    (e.g., in emcee MCMC sampling).

    set_pmap needs to be turned on for the Pmap_Model.
    """
    if (sigma < 0. or tau < 0.):
        raise ValueError, 'The amp and scale parameters must be positive.'
    if (symm is None):
        symm = (x is y) and (idx is idy)
    x = regularize_array(x)
    y = regularize_array(y)
    nx = x.shape[0]
    ny = y.shape[0]
    if np.isscalar(idx):
        idx = np.ones(nx, dtype="int", order="F") * idx
    if np.isscalar(idy):
        idy = np.ones(nx, dtype="int", order="F") * idy
    # Allocate the matrix
    C = np.asmatrix(np.empty((nx, ny), dtype=float, order='F'))
    if set_pmap:
        SCF.covmatpmap_bit(C, x, y, idx, idy, sigma, tau, lags, wids, scales,
                           0, -1, symm)
    elif set_dpmap:
        SCF.covmatdpmap_bit(C, x, y, idx, idy, sigma, tau, lags, wids, scales,
                            0, -1, symm)
    else:
        SCF.covmat_bit(C, x, y, idx, idy, sigma, tau, lags, wids, scales, 0,
                       -1, symm)
    if symm:
        isotropic_cov_funs.symmetrize(C)
    return (C)
예제 #3
0
파일: spear.py 프로젝트: askielboe/JAVELIN
 def targ(C,x,y,idx,idy,cmin,cmax,symm) :
     SCF.covmat_bit(C,x,y,idx,idy,sigma,tau,lags,wids,scales,cmin,cmax,symm)
예제 #4
0
 def targ(C, x, y, idx, idy, cmin, cmax, symm):
     SCF.covmat_bit(C, x, y, idx, idy, sigma, tau, lags, wids, scales,
                    cmin, cmax, symm)
예제 #5
0
 def targ(C, x, y, idx, idy, cmin, cmax, symm):
     SCF.covmat_bit(C, x, y, idx, idy, A, gamma, lags, wids, scales,
                    cmin, cmax, symm)