示例#1
0
def _pfp(pha, amp, phabin, binsize):
    """Sub prefered phase function
    """
    nbin, nt = len(phabin), pha.shape[1]
    ampbin = np.zeros((len(phabin), nt), dtype=float)
    # Binarize amplitude accros all trials :
    for t in range(nt):
        curpha, curamp = pha[:, t], amp[:, t]
        for i, p in enumerate(phabin):
            idx = np.logical_and(curpha >= p, curpha < p + binsize)
            if idx.astype(int).sum() != 0:
                ampbin[i, t] = curamp[idx].mean()
            else:
                ampbin[i, t] = 0
        ampbin[:, t] /= ampbin[:, t].sum()
    # Find prefered phase and p-values :
    pfp = np.array([phabin[k] + binsize / 2 for k in ampbin.argmax(axis=0)])
    pvalue = circ_rtest(pfp)[0]
    prf = phabin[ampbin.mean(axis=1).argmax()] + binsize / 2

    return pfp, prf, pvalue, ampbin
示例#2
0
def _pfp(pha, amp, phabin, binsize):
    """Sub prefered phase function
    """
    nbin, nt = len(phabin), pha.shape[1]
    ampbin = np.zeros((len(phabin), nt), dtype=float)
    # Binarize amplitude accros all trials :
    for t in range(nt):
        curpha, curamp = pha[:, t], amp[:, t]
        for i, p in enumerate(phabin):
            idx = np.logical_and(curpha >= p, curpha < p+binsize)
            if idx.astype(int).sum() != 0:
                ampbin[i, t] = curamp[idx].mean()
            else:
                ampbin[i, t] = 0
        ampbin[:, t] /= ampbin[:, t].sum()
    # Find prefered phase and p-values :
    pfp = np.array([phabin[k]+binsize/2 for k in ampbin.argmax(axis=0)])
    pvalue = circ_rtest(pfp)[0]
    prf = phabin[ampbin.mean(axis=1).argmax()]+binsize/2
    
    return pfp, prf, pvalue, ampbin
示例#3
0
def _phase(x, self):
    """Sub-phase function
    """
    # Get the filter properties and apply:
    fMeth = self._fobj.get(self._sf, self._fSplit, self._npts)
    xF = self._fobj.apply(x, fMeth)

    # Mean time :
    if self._window is not None:
        xF, _ = binArray(xF, self._window, axis=1)
    nf, npts, nt = xF.shape

    # Get p-value:
    if self._getstat:
        pvalues = np.zeros((nf, npts), dtype=float)
        for f in range(nf):
            for k in range(npts):
                pvalues[f, k] = circ_rtest(xF[f, k, :])[0]
    else:
        pvalues = None

    return xF, pvalues
示例#4
0
def _phase(x, self):
    """Sub-phase function
    """
    # Get the filter properties and apply:
    fMeth = self._fobj.get(self._sf, self._fSplit, self._npts)
    xF = self._fobj.apply(x, fMeth)

    # Mean time :
    if self._window is not None:
        xF, _ = binArray(xF, self._window, axis=1)
    nf, npts, nt = xF.shape

    # Get p-value:
    if self._getstat:
        pvalues = np.zeros((nf, npts), dtype=float)
        for f in range(nf):
            for k in range(npts):
                pvalues[f, k] = circ_rtest(xF[f, k, :])[0]
    else:
        pvalues = None

    return xF, pvalues