Exemple #1
0
def show_posmarks(dec, setname, ylim=None, win=None, singles=False, baseFN=None):
    MTHR = 0.001   #  how much smaller is mixture compared to maximum

    for nt in xrange(dec.nTets):
        if not singles:
            fig = _plt.figure(figsize=(7, 5))
        for k in xrange(1, dec.mdim+1):
            if singles:
                fig = _plt.figure(figsize=(4, 3))
                ax  = fig.add_subplot(1, 1, 1)
            else:
                ax  = fig.add_subplot(2, 2, k)

            """
            for l in xrange(dec.tt0, dec.tt1):
                if (dec.marks[l, nt] is not None):
                    x.append(dec.pos[l])
                    y.append(dec.marks[l, nt][0][k-1])
            """

            if dec.marksObserved[nt] > 0:
                _plt.scatter(dec.tr_pos[nt], dec.tr_marks[nt][:, k-1], color="black", s=2)
            #_plt.scatter(dec.mvNrm[nt].us[:, 0], dec.mvNrm[nt].us[:, k], color="red", s=30)
            mThr = MTHR * _N.max(dec.mvNrm[nt].ms)

            for m in xrange(dec.M):
                if dec.mvNrm[nt].ms[m, 0] >= mThr:
                    ux   = dec.mvNrm[nt].us[m, 0]  #  position
                    uy   = dec.mvNrm[nt].us[m, k]
                    ex_x = _N.sqrt(dec.mvNrm[nt].covs[m, 0, 0])
                    ex_y = _N.sqrt(dec.mvNrm[nt].covs[m, k, k])
                    _plt.plot([ux-ex_x, ux+ex_x], [uy, uy], color="red", lw=2)
                    _plt.plot([ux, ux], [uy-ex_y, uy+ex_y], color="red", lw=2)

                    _plt.scatter(dec.mvNrm[nt].us[m, 0], dec.mvNrm[nt].us[m, k], color="red", s=30)

            _plt.xlim(-6, 6)
            if ylim is not None:
                _plt.ylim(ylim[0], ylim[1])

            if singles:
                _plt.suptitle("k=%(k)d  t0=%(2).2fs : t1=%(3).2fs" % {"2" : (dec.tt0/1000.), "3" : (dec.tt1/1000.), "k" : k})
                fn= baseFN if (dec.usetets is None) else "%(bf)s_tet%(t)s" % {"bf" : baseFN, "t" : dec.usetets[nt]}

                mF.arbitraryAxes(ax)
                mF.setLabelTicks(_plt, xlabel="position", ylabel="mark", xtickFntSz=14, ytickFntSz=14, xlabFntSz=16, ylabFntSz=16)
                fig.subplots_adjust(left=0.2, bottom=0.2, top=0.85)
                _plt.savefig(resFN("%(1)s_win=%(w)d.png" % {"1" : fn, "w" : win}, dir=setname), transparent=True)
                _plt.close()


        if not singles:
            _plt.suptitle("t0=%(2)d,t1=%(3)d" % {"2" : dec.tt0, "3" : dec.tt1})
            fn= baseFN if (dec.usetets is None) else "%(bf)s_tet%(t)s" % {"bf" : baseFN, "t" : dec.usetets[nt]}
            _plt.savefig(resFN("%(1)s_win=%(w)d.png" % {"1" : fn, "w" : win}, dir=setname, create=True), transparent=True)
            _plt.close()
Exemple #2
0
def show_posmarksCNTR(dec, setname, mvNrm, ylim=None, win=None, singles=False, showScatter=True, baseFN="look", scatskip=1):
    for nt in xrange(dec.nTets):
        if not singles:
            fig = _plt.figure(figsize=(7, 5))
        for k in xrange(1, dec.mdim+1):
            if singles:
                fig = _plt.figure(figsize=(4, 3))
                ax  = fig.add_subplot(1, 1, 1)
            else:
                ax  = fig.add_subplot(2, 2, k)

            """
            for l in xrange(dec.tt0, dec.tt1):
                if (dec.marks[l, nt] is not None):
                    x.append(dec.pos[l])
                    y.append(dec.marks[l, nt][0][k-1])
            """


            _plt.xlim(-6, 6)
            if ylim is not None:
                _plt.ylim(ylim[0], ylim[1])
            else:
                ylim = _N.empty(2)
                ylim[0] = _N.min(dec.tr_marks[nt][:, k-1])
                ylim[1] = _N.max(dec.tr_marks[nt][:, k-1])
                yAMP    = ylim[1] - ylim[0]
                ylim[0] -= 0.1*yAMP
                ylim[1] += 0.1*yAMP


            if showScatter and dec.marksObserved[nt] > 0:
                _plt.scatter(dec.tr_pos[nt][::scatskip], dec.tr_marks[nt][::scatskip, k-1], color="grey", s=1)
            img = mvNrm.evalAll(1000, k-1, ylim=ylim)
            _plt.imshow(img, origin="lower", extent=(-6, 6, ylim[0], ylim[1]), cmap=_plt.get_cmap("Reds"))
            if singles:
                _plt.suptitle("k=%(k)d  t0=%(2).2fs : t1=%(3).2fs" % {"2" : (dec.tt0/1000.), "3" : (dec.tt1/1000.), "k" : k})
                fn= baseFN if (dec.usetets is None) else "%(fn)s_tet%(tets)s" % {"fn" : baseFN, "tets" : dec.usetets[nt]}

                mF.arbitraryAxes(ax)
                mF.setLabelTicks(_plt, xlabel="position", ylabel="mark", xtickFntSz=14, ytickFntSz=14, xlabFntSz=16, ylabFntSz=16)
                fig.subplots_adjust(left=0.2, bottom=0.2, top=0.85)
                _plt.savefig(resFN("%(1)s_win=%(w)d.png" % {"1" : fn, "w" : win}, dir=setname), transparent=True)
                _plt.close()

        if not singles:
            _plt.suptitle("t0=%(2)d,t1=%(3)d" % {"2" : dec.tt0, "3" : dec.tt1})
            fn= baseFN if (dec.usetets is None) else "%(fn)s_tet%(tets)s" % {"fn" : baseFN, "tets" : dec.usetets[nt]}
            _plt.savefig(resFN("%(1)s_win=%(w)d.png" % {"1" : fn, "w" : win}, dir=setname, create=True), transparent=True)
            _plt.close()
Exemple #3
0
def showTrajectory(dec, t0, t1, ep, setname, dir):
    fig = _plt.figure(figsize=(14, 7))
    ax  = fig.add_subplot(1, 1, 1)
    _plt.imshow(dec.pX_Nm[t0:t1].T, aspect=(0.5*(t1-t0)/50.), cmap=_plt.get_cmap("Reds"))
    _plt.plot(_N.linspace(t0-t0, t1-t0, t1-t0), (dec.xA+dec.pos[t0:t1])/dec.dxp, color="grey", lw=3, ls="--")
    #_plt.plot(_N.linspace(float(t0)/1000., float(t1)/1000., t1-t0), (dec.xA+dec.pos[t0:t1])/dec.dxp, color="red", lw=2)
    #print (float(t0)/1000)
    #print (float(t1)/1000)
    _plt.xlim(0, t1-t0)
    _plt.ylim(-(dec.nTets*4), 50)
    #_plt.xticks(_N.arange(0, t1-t0, 2000), _N.arange(t0, t1, 2000, dtype=_N.float)/1000)
    dt = int((((int(t1/1000.)*1000) - (int(t0/1000.)*1000))/4.)/1000.)*1000

    stT0 = t0 - int(t0/1000.)*1000
    enT1 = t1 - int(t1/1000.)*1000
    #_plt.xticks(_N.arange(0, t1-t0, dt), _N.arange(t0, t1, dt, dtype=_N.float)/1000)
    _plt.xticks(_N.arange(stT0, t1-t0, dt), _N.arange(int(t0/1000.)*1000, int(t1/1000.)*1000, dt, dtype=_N.int)/1000)
    #_plt.locator_params(nbins=6, axis="x")
    _plt.yticks(_N.linspace(0, 50, 5), [-6, -3, 0, 3, 6])
    mF.arbitaryAxes(ax, axesVis=[False, False, False, False], x_tick_positions="bottom", y_tick_positions="left")
    mF.setLabelTicks(_plt, xlabel="Time (sec.)", ylabel="Position", xtickFntSz=30, ytickFntSz=30, xlabFntSz=32, ylabFntSz=32)

    x = []
    y = []
    for nt in xrange(dec.nTets):
        x.append([])
        y.append([])

    for t in xrange(t0, t1):
        for nt in xrange(dec.nTets):
            if dec.marks[t, nt] is not None:
                x[nt].append(t-t0)
                y[nt].append(-1.5 - 3*nt)

    for nt in xrange(dec.nTets):
        _plt.plot(x[nt], y[nt], ls="", marker="|", ms=15, color="black")

    fig.subplots_adjust(bottom=0.15, left=0.15)
    _plt.savefig(resFN("decode_%(uts)s_%(mth)s_win=%(e)d.eps" % {"e" : (ep/2), "mth" : dec.decmth, "uts" : dec.utets_str, "dir" : dir}, dir=setname, create=True))
    _plt.close()
Exemple #4
0
def showTrajectory(dec, t0, t1, ep, setname, dir):
    fig = _plt.figure(figsize=(14, 7))
    ax = fig.add_subplot(1, 1, 1)
    _plt.imshow(dec.pX_Nm[t0:t1].T,
                aspect=(0.5 * (t1 - t0) / 50.),
                cmap=_plt.get_cmap("Reds"))
    _plt.plot(_N.linspace(t0 - t0, t1 - t0, t1 - t0),
              (dec.xA + dec.pos[t0:t1]) / dec.dxp,
              color="grey",
              lw=3,
              ls="--")
    #_plt.plot(_N.linspace(float(t0)/1000., float(t1)/1000., t1-t0), (dec.xA+dec.pos[t0:t1])/dec.dxp, color="red", lw=2)
    #print (float(t0)/1000)
    #print (float(t1)/1000)
    _plt.xlim(0, t1 - t0)
    _plt.ylim(-(dec.nTets * 4), 50)
    #_plt.xticks(_N.arange(0, t1-t0, 2000), _N.arange(t0, t1, 2000, dtype=_N.float)/1000)
    dt = int((((int(t1 / 1000.) * 1000) -
               (int(t0 / 1000.) * 1000)) / 4.) / 1000.) * 1000

    stT0 = t0 - int(t0 / 1000.) * 1000
    enT1 = t1 - int(t1 / 1000.) * 1000
    #_plt.xticks(_N.arange(0, t1-t0, dt), _N.arange(t0, t1, dt, dtype=_N.float)/1000)
    _plt.xticks(
        _N.arange(stT0, t1 - t0, dt),
        _N.arange(
            int(t0 / 1000.) * 1000, int(t1 / 1000.) * 1000, dt, dtype=_N.int) /
        1000)
    #_plt.locator_params(nbins=6, axis="x")
    _plt.yticks(_N.linspace(0, 50, 5), [-6, -3, 0, 3, 6])
    mF.arbitaryAxes(ax,
                    axesVis=[False, False, False, False],
                    x_tick_positions="bottom",
                    y_tick_positions="left")
    mF.setLabelTicks(_plt,
                     xlabel="Time (sec.)",
                     ylabel="Position",
                     xtickFntSz=30,
                     ytickFntSz=30,
                     xlabFntSz=32,
                     ylabFntSz=32)

    x = []
    y = []
    for nt in range(dec.nTets):
        x.append([])
        y.append([])

    for t in range(t0, t1):
        for nt in range(dec.nTets):
            if dec.marks[t, nt] is not None:
                x[nt].append(t - t0)
                y[nt].append(-1.5 - 3 * nt)

    for nt in range(dec.nTets):
        _plt.plot(x[nt], y[nt], ls="", marker="|", ms=15, color="black")

    fig.subplots_adjust(bottom=0.15, left=0.15)
    _plt.savefig(
        resFN("decode_%(uts)s_%(mth)s_win=%(e)d.eps" % {
            "e": (ep / 2),
            "mth": dec.decmth,
            "uts": dec.utets_str,
            "dir": dir
        },
              dir=setname,
              create=True))
    _plt.close()
Exemple #5
0
def show_posmarksCNTR(dec,
                      setname,
                      mvNrm,
                      ylim=None,
                      win=None,
                      singles=False,
                      showScatter=True,
                      baseFN="look",
                      scatskip=1):
    for nt in range(dec.nTets):
        if not singles:
            fig = _plt.figure(figsize=(7, 5))
        for k in range(1, dec.mdim + 1):
            if singles:
                fig = _plt.figure(figsize=(4, 3))
                ax = fig.add_subplot(1, 1, 1)
            else:
                ax = fig.add_subplot(2, 2, k)
            """
            for l in range(dec.tt0, dec.tt1):
                if (dec.marks[l, nt] is not None):
                    x.append(dec.pos[l])
                    y.append(dec.marks[l, nt][0][k-1])
            """

            _plt.xlim(-6, 6)
            if ylim is not None:
                _plt.ylim(ylim[0], ylim[1])
            else:
                ylim = _N.empty(2)
                ylim[0] = _N.min(dec.tr_marks[nt][:, k - 1])
                ylim[1] = _N.max(dec.tr_marks[nt][:, k - 1])
                yAMP = ylim[1] - ylim[0]
                ylim[0] -= 0.1 * yAMP
                ylim[1] += 0.1 * yAMP

            if showScatter and dec.marksObserved[nt] > 0:
                _plt.scatter(dec.tr_pos[nt][::scatskip],
                             dec.tr_marks[nt][::scatskip, k - 1],
                             color="grey",
                             s=1)
            img = mvNrm.evalAll(1000, k - 1, ylim=ylim)
            _plt.imshow(img,
                        origin="lower",
                        extent=(-6, 6, ylim[0], ylim[1]),
                        cmap=_plt.get_cmap("Reds"))
            if singles:
                _plt.suptitle("k=%(k)d  t0=%(2).2fs : t1=%(3).2fs" % {
                    "2": (dec.tt0 / 1000.),
                    "3": (dec.tt1 / 1000.),
                    "k": k
                })
                fn = baseFN if (
                    dec.usetets is None) else "%(fn)s_tet%(tets)s" % {
                        "fn": baseFN,
                        "tets": dec.usetets[nt]
                    }

                mF.arbitraryAxes(ax)
                mF.setLabelTicks(_plt,
                                 xlabel="position",
                                 ylabel="mark",
                                 xtickFntSz=14,
                                 ytickFntSz=14,
                                 xlabFntSz=16,
                                 ylabFntSz=16)
                fig.subplots_adjust(left=0.2, bottom=0.2, top=0.85)
                _plt.savefig(resFN("%(1)s_win=%(w)d.png" % {
                    "1": fn,
                    "w": win
                },
                                   dir=setname),
                             transparent=True)
                _plt.close()

        if not singles:
            _plt.suptitle("t0=%(2)d,t1=%(3)d" % {"2": dec.tt0, "3": dec.tt1})
            fn = baseFN if (dec.usetets is None) else "%(fn)s_tet%(tets)s" % {
                "fn": baseFN,
                "tets": dec.usetets[nt]
            }
            _plt.savefig(resFN("%(1)s_win=%(w)d.png" % {
                "1": fn,
                "w": win
            },
                               dir=setname,
                               create=True),
                         transparent=True)
            _plt.close()
Exemple #6
0
def show_posmarks(dec,
                  setname,
                  ylim=None,
                  win=None,
                  singles=False,
                  baseFN=None):
    MTHR = 0.001  #  how much smaller is mixture compared to maximum

    for nt in range(dec.nTets):
        if not singles:
            fig = _plt.figure(figsize=(7, 5))
        for k in range(1, dec.mdim + 1):
            if singles:
                fig = _plt.figure(figsize=(4, 3))
                ax = fig.add_subplot(1, 1, 1)
            else:
                ax = fig.add_subplot(2, 2, k)
            """
            for l in range(dec.tt0, dec.tt1):
                if (dec.marks[l, nt] is not None):
                    x.append(dec.pos[l])
                    y.append(dec.marks[l, nt][0][k-1])
            """

            if dec.marksObserved[nt] > 0:
                _plt.scatter(dec.tr_pos[nt],
                             dec.tr_marks[nt][:, k - 1],
                             color="black",
                             s=2)
            #_plt.scatter(dec.mvNrm[nt].us[:, 0], dec.mvNrm[nt].us[:, k], color="red", s=30)
            mThr = MTHR * _N.max(dec.mvNrm[nt].ms)

            for m in range(dec.M):
                if dec.mvNrm[nt].ms[m, 0] >= mThr:
                    ux = dec.mvNrm[nt].us[m, 0]  #  position
                    uy = dec.mvNrm[nt].us[m, k]
                    ex_x = _N.sqrt(dec.mvNrm[nt].covs[m, 0, 0])
                    ex_y = _N.sqrt(dec.mvNrm[nt].covs[m, k, k])
                    _plt.plot([ux - ex_x, ux + ex_x], [uy, uy],
                              color="red",
                              lw=2)
                    _plt.plot([ux, ux], [uy - ex_y, uy + ex_y],
                              color="red",
                              lw=2)

                    _plt.scatter(dec.mvNrm[nt].us[m, 0],
                                 dec.mvNrm[nt].us[m, k],
                                 color="red",
                                 s=30)

            _plt.xlim(-6, 6)
            if ylim is not None:
                _plt.ylim(ylim[0], ylim[1])

            if singles:
                _plt.suptitle("k=%(k)d  t0=%(2).2fs : t1=%(3).2fs" % {
                    "2": (dec.tt0 / 1000.),
                    "3": (dec.tt1 / 1000.),
                    "k": k
                })
                fn = baseFN if (dec.usetets is None) else "%(bf)s_tet%(t)s" % {
                    "bf": baseFN,
                    "t": dec.usetets[nt]
                }

                mF.arbitraryAxes(ax)
                mF.setLabelTicks(_plt,
                                 xlabel="position",
                                 ylabel="mark",
                                 xtickFntSz=14,
                                 ytickFntSz=14,
                                 xlabFntSz=16,
                                 ylabFntSz=16)
                fig.subplots_adjust(left=0.2, bottom=0.2, top=0.85)
                _plt.savefig(resFN("%(1)s_win=%(w)d.png" % {
                    "1": fn,
                    "w": win
                },
                                   dir=setname),
                             transparent=True)
                _plt.close()

        if not singles:
            _plt.suptitle("t0=%(2)d,t1=%(3)d" % {"2": dec.tt0, "3": dec.tt1})
            fn = baseFN if (dec.usetets is None) else "%(bf)s_tet%(t)s" % {
                "bf": baseFN,
                "t": dec.usetets[nt]
            }
            _plt.savefig(resFN("%(1)s_win=%(w)d.png" % {
                "1": fn,
                "w": win
            },
                               dir=setname,
                               create=True),
                         transparent=True)
            _plt.close()
Exemple #7
0
def compareWF(mARp,
              ests,
              Xs,
              spkHists,
              oscMn,
              dat,
              gkW=20,
              useRefr=True,
              dspW=None):
    """
    instead of subplots, plot 3 different things with 3 largely separated y-values
    """

    glmsets = len(ests)  #  horrible hack
    TR = oscMn.shape[0]
    infrdAll = _N.zeros((TR, mARp.N + 1))
    dt = 0.001
    gk = _flt.gauKer(gkW)
    gk /= _N.sum(gk)

    paramss = []
    ocifss = []
    stTs = []

    for gs in xrange(glmsets):  #  for the 2 glm conditions
        params = _N.array(ests[gs].params)
        X = Xs[gs]
        spkHist = spkHists[gs]

        stTs.append(spkHist.LHbin *
                    (spkHist.nLHBins +
                     1))  #  first stT spikes used for initial history
        ocifss.append(
            _N.empty((spkHist.endTR - spkHist.startTR,
                      spkHist.t1 - spkHist.t0 - stTs[gs])))

        for tr in xrange(spkHist.endTR - spkHist.startTR):
            ocifss[gs][tr] = _N.exp(_N.dot(X[tr], params)) / dt

    stT = min(stTs)

    #cglmAll = _N.zeros((TR, mARp.N+1))

    xt = _N.arange(stT, mARp.N + 1)
    xts = [_N.arange(stTs[0], mARp.N + 1), _N.arange(stTs[1], mARp.N + 1)]
    lss = [":", "-"]
    lws = [3.8, 2]
    cls = [myC.infrdM]
    for tr in xrange(spkHist.startTR, TR):
        _gt = dat[stT:, tr * 3]
        gt = _N.convolve(_gt, gk, mode="same")
        gt /= _N.std(gt)

        infrd = oscMn[tr, stT:] / _N.std(oscMn[tr, stT:])
        infrd /= _N.std(infrd)
        infrdAll[tr, stT:] = infrd

        fig = _plt.figure(figsize=(12, 8))
        ax = fig.add_subplot(1, 1, 1)
        _plt.plot(xt, gt, color=myC.grndTruth, lw=4)
        #_plt.plot(xt, infrd, color="brown", lw=4)

        up1 = _N.max(gt) - _N.min(gt)
        ##  mirror
        _plt.plot(xt, gt + up1 * 1.25, color=myC.grndTruth, lw=4)
        _plt.plot(xt, infrd + up1 * 1.25, color=myC.infrdM, lw=2)

        for gs in xrange(glmsets):
            ocifs = ocifss[gs]
            glm = (ocifs[tr] - _N.mean(ocifs[tr])) / _N.std(ocifs[tr])
            cglm = _N.convolve(glm, gk, mode="same")
            cglm /= _N.std(cglm)

            _plt.plot(xts[gs], cglm, color=myC.infrdM, lw=lws[gs], ls=lss[gs])

        MINx = _N.min(infrd)
        #MAXx = _N.max(infrd)
        MAXx = _N.max(gt) + up1 * 1.35

        AMP = MAXx - MINx
        ht = 0.08 * AMP
        ys1 = MINx - 0.5 * ht
        ys2 = MINx - 3 * ht

        for n in xrange(stT, mARp.N + 1):
            if mARp.y[tr, n] == 1:
                _plt.plot([n, n], [ys1, ys2], lw=2.5, color="black")
        _plt.ylim(ys2 - 0.05 * AMP, MAXx + 0.05 * AMP)

        if dspW is None:
            _plt.xlim(stT, mARp.N + 1)
        else:
            _plt.xlim(dspW[0], dspW[1])
        mF.arbitraryAxes(ax,
                         axesVis=[False, False, False, False],
                         xtpos="bottom",
                         ytpos="none")
        mF.setLabelTicks(_plt,
                         yticks=[],
                         yticksDsp=None,
                         xlabel="time (ms)",
                         ylabel=None,
                         xtickFntSz=24,
                         xlabFntSz=26)
        fig.subplots_adjust(left=0.05, right=0.95, bottom=0.2, top=0.85)
        _plt.savefig("cmpGLMAR_%(tr)d.eps" % {"tr": tr}, transparent=True)
        _plt.close()
Exemple #8
0
def compare(mARp, est, X, spkHist, oscMn, dat, gkW=20, useRefr=True):
    dt = 0.001

    gk = _flt.gauKer(gkW)
    gk /= _N.sum(gk)

    TR = oscMn.shape[0]

    #  params, stT
    params = _N.array(est.params)

    stT = spkHist.LHbin * (spkHist.nLHBins + 1
                           )  #  first stT spikes used for initial history
    ocifs = _N.empty(
        (spkHist.endTR - spkHist.startTR, spkHist.t1 - spkHist.t0 - stT))
    ##

    sur = "refr"
    if not useRefr:
        params[spkHist.endTR:spkHist.endTR +
               spkHist.LHbin] = params[spkHist.endTR + spkHist.LHbin]
        sur = "NOrefr"

    for tr in xrange(spkHist.endTR - spkHist.startTR):
        ocifs[tr] = _N.exp(_N.dot(X[tr], params)) / dt

    cglmAll = _N.zeros((TR, mARp.N + 1))
    infrdAll = _N.zeros((TR, mARp.N + 1))
    xt = _N.arange(stT, mARp.N + 1)

    for tr in xrange(spkHist.startTR, TR):
        _gt = dat[stT:, tr * 3]
        gt = _N.convolve(_gt, gk, mode="same")
        gt /= _N.std(gt)

        glm = (ocifs[tr] - _N.mean(ocifs[tr])) / _N.std(ocifs[tr])
        cglm = _N.convolve(glm, gk, mode="same")
        cglm /= _N.std(cglm)

        infrd = oscMn[tr, stT:] / _N.std(oscMn[tr, stT:])
        infrd /= _N.std(infrd)

        pc1, pv1 = _ss.pearsonr(glm, gt)
        pc1c, pv1c = _ss.pearsonr(cglm, gt)
        pc2, pv2 = _ss.pearsonr(infrd, gt)

        cglmAll[tr, stT:] = cglm
        infrdAll[tr, stT:] = infrd

        fig = _plt.figure(figsize=(12, 4))
        ax = fig.add_subplot(1, 1, 1)
        _plt.plot(xt, infrd, color=myC.infrdM, lw=2)
        _plt.plot(xt, cglm, color=myC.infrdM, lw=2., ls="--")
        #_plt.plot(xt, glm, color=myC.infrdM, lw=2., ls="-.")
        _plt.plot(xt, gt, color=myC.grndTruth, lw=4)

        MINx = _N.min(infrd)
        MAXx = _N.max(infrd)

        AMP = MAXx - MINx
        ht = 0.08 * AMP
        ys1 = MINx - 0.5 * ht
        ys2 = MINx - 3 * ht

        for n in xrange(stT, mARp.N + 1):
            if mARp.y[tr, n] == 1:
                _plt.plot([n, n], [ys1, ys2], lw=2.5, color="black")
        _plt.ylim(ys2 - 0.05 * AMP, MAXx + 0.05 * AMP)

        _plt.xlim(stT, mARp.N + 1)
        mF.arbitraryAxes(ax,
                         axesVis=[False, False, False, False],
                         xtpos="bottom",
                         ytpos="none")
        mF.setLabelTicks(_plt,
                         yticks=[],
                         yticksDsp=None,
                         xlabel="time (ms)",
                         ylabel=None,
                         xtickFntSz=24,
                         xlabFntSz=26)
        fig.subplots_adjust(left=0.05, right=0.95, bottom=0.2, top=0.85)
        _plt.savefig("cmpGLMAR_%(ur)s_%(tr)d.eps" % {"tr": tr, "ur": sur})
        _plt.close()

        corrs[tr] = pc1, pc1c, pc2
    mF.histPhase0_phaseInfrd(mARp,
                             cglmAll,
                             t0=stT,
                             t1=(mARp.N + 1),
                             bRealDat=False,
                             normed=True,
                             maxY=1.8,
                             fn="smthdGLMPhaseGLM%s" % sur)
    mF.histPhase0_phaseInfrd(mARp,
                             infrdAll,
                             t0=stT,
                             t1=(mARp.N + 1),
                             bRealDat=False,
                             normed=True,
                             maxY=1.8,
                             fn="smthdGLMPhaseInfrd")

    print _N.mean(corrs[:, 0])
    print _N.mean(corrs[:, 1])
    print _N.mean(corrs[:, 2])

    fig = _plt.figure(figsize=(8, 3.5))
    ax = fig.add_subplot(1, 2, 1)
    _plt.hist(corrs[:, 1],
              bins=_N.linspace(-0.5,
                               max(corrs[:, 2]) * 1.05, 30),
              color=myC.hist1)
    mF.bottomLeftAxes(ax)
    ax = fig.add_subplot(1, 2, 2)
    _plt.hist(corrs[:, 2],
              bins=_N.linspace(-0.5,
                               max(corrs[:, 2]) * 1.05, 30),
              color=myC.hist1)
    mF.bottomLeftAxes(ax)
    fig.subplots_adjust(left=0.05,
                        bottom=0.1,
                        right=0.95,
                        top=0.88,
                        wspace=0.2,
                        hspace=0.2)

    _plt.savefig("cmpGLMAR_hist")
    _plt.close()