예제 #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()
예제 #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()
예제 #3
0
def pos_timeline(bfn,
                 datfn,
                 itvfn,
                 outfn="timeline",
                 ch1=0,
                 ch2=1,
                 xL=0,
                 xH=3,
                 yticks=[0, 1, 2, 3],
                 yticksD=[0, 1, 2, 3],
                 thin=1,
                 t0=None,
                 t1=None,
                 skp=1,
                 maze=_mkd.mz_CRCL):
    d = _N.loadtxt(datFN("%s.dat" % datfn))  #  marks
    t0 = 0 if (t0 is None) else t0
    t1 = d.shape[0] if (t1 is None) else t1
    itv = _N.loadtxt(datFN("%s.dat" % itvfn))
    N = d.shape[0]
    epochs = itv.shape[0] - 1
    ch1 += 2  #  because this is data col
    ch2 += 2

    _sts = _N.where(d[t0:t1, 1] == 1)[0] + t0
    if thin == 1:
        sts = _sts
    else:
        sts = _sts[::thin]

    wvfmMin = _N.min(d[t0:t1, 2:], axis=0)
    wvfmMax = _N.max(d[t0:t1, 2:], axis=0)

    #fig = _plt.figure(figsize=(4, 2.2))
    fig = _plt.figure(figsize=(10, 2.2))
    #######################
    ax = _plt.subplot2grid((1, 3), (0, 0), colspan=3)
    _plt.scatter(_N.arange(d[t0:t1:100].shape[0], dtype=_N.float) / 10.,
                 d[t0:t1:100, 0],
                 s=9,
                 color="black")
    _plt.scatter(sts[::skp] / 1000., d[sts[::skp], 0], s=1, color="orange")

    if maze == _mkd.mz_W:
        _plt.axhline(y=-6, ls="--", lw=1, color="black")
        _plt.axhline(y=-3, ls=":", lw=1, color="black")
        _plt.axhline(y=0, ls="--", lw=1, color="black")
        _plt.axhline(y=3, ls=":", lw=1, color="black")
        _plt.axhline(y=6, ls="--", lw=1, color="black")
    mF.arbitraryAxes(ax,
                     axesVis=[True, True, False, False],
                     xtpos="bottom",
                     ytpos="left")
    #itv[-1] = 0.97
    for ep in range(epochs):
        _plt.axvline(x=(itv[ep + 1] * N / 1000.), color="red", ls="-.")
    mF.setTicksAndLims(xlabel="time (s)",
                       ylabel="position",
                       xticks=None,
                       yticks=yticks,
                       xticksD=None,
                       yticksD=yticksD,
                       xlim=[t0 / 1000., t1 / 1000.],
                       ylim=[xL - 0.3, xH + 0.3],
                       tickFS=15,
                       labelFS=18)

    choutfn = "%(of)s_%(1)d,%(2)d" % {
        "of": outfn,
        "1": (ch1 - 1),
        "2": (ch2 - 1)
    }
    fig.subplots_adjust(bottom=0.28, left=0.1, top=0.96, right=0.99)
    _plt.savefig(resFN("%s.pdf" % choutfn, dir=bfn), transparent=True)
    _plt.close()
예제 #4
0
def timeline_v2(bfn,
                datfn,
                itvfn,
                outfn="timeline",
                ch1=0,
                ch2=1,
                xL=0,
                xH=3,
                yticks=[0, 1, 2, 3],
                thin=1,
                allFR=None,
                tcksz=19,
                lblsz=21,
                t0=None,
                t1=None,
                figw=10,
                figh=10,
                ytpos="left"):  #  25Hz
    d = _N.loadtxt(datFN("%s.dat" % datfn))  #  marks
    N = d.shape[0]  #  ALL spikes
    itv = _N.loadtxt(datFN("%s.dat" % itvfn))

    epochs = itv.shape[0] - 1
    ch1 += 2  #  because this is data col
    ch2 += 2

    wvfmMin = _N.min(d[:, 2:], axis=0)
    print(wvfmMin)
    wvfmMax = _N.max(d[:, 2:], axis=0)
    print(wvfmMax)

    Aint = _N.array(itv * N, dtype=_N.int)
    Asts = _N.where(d[Aint[0]:Aint[1], 1] == 1)[0]
    N1 = len(Asts)  # num spikes in 1st epoch

    _x = _N.empty((N1, 5))
    _x[:, 0] = d[Asts, 0]
    _x[:, 1:] = d[Asts, 2:]
    T1 = Aint[1] - Aint[0]
    hz = _x.shape[0] / float(T1 * 0.001)

    if allFR is not None:
        unonhash, hashsp, hashthresh = sepHash(_x,
                                               BINS=20,
                                               blksz=5,
                                               xlo=xL,
                                               xhi=xH)

        rh = len(hashsp) / float(N1)
        rnh = len(unonhash) / float(N1)

        #(m x rh + rnh)*hz = allFR
        #allFR  - rnh x hz = m x rh x hz
        #  m = (rnh x hz - allFR) / (rh x hz)

        m = (allFR - rnh * hz) / (rh * hz)

        #  ((m*len(hashsp) + len(unonhash)) / (T1*0.001))  == allFR  (target FR)
        #  how much of hashsp should we remove?
        #  Find lowest (1 - m)

        _x[:, 1:].sort(axis=0)

        chmins = channelMins(_x, 100, 4, int((1 - m) * len(hashsp)))

        #spk_n, chs = _N.where(_x[:, 1:] > chmins)
        #unique, counts = _N.unique(spk_n, return_counts=True)

        #print len(_N.where(counts > 0)[0])  # at least 1 channel above
        #print (len(_N.where(counts > 0)[0]) / float(T1*0.001))

        _sts = _N.where(d[:, 1] == 1)[0]  #  ALL spikes in ALL epochs
        spk_n, chs = _N.where(d[_sts, 2:] > chmins)

        unique_spk_IDs, counts = _N.unique(spk_n, return_counts=True)
        sts = _sts[unique_spk_IDs[_N.where(counts > 0)[0]]]

    if allFR is None:
        _sts = _N.where(d[:, 1] == 1)[0]
        if thin == 1:
            sts = _sts
        else:
            sts = _sts[::thin]

    fig = _plt.figure(figsize=(figw, figh))
    #######################
    #ax =_plt.subplot2grid((5, 3), (0, 0), colspan=3)
    ax = _plt.subplot2grid((33, 3), (0, 0), colspan=3, rowspan=5)
    _plt.scatter(sts / 1000., d[sts, 0], s=2, color="black")
    if ytpos == "left":
        mF.arbitraryAxes(ax,
                         axesVis=[True, True, False, False],
                         xtpos="bottom",
                         ytpos="left")
        mF.setTicksAndLims(xlabel="time (s)",
                           ylabel="position",
                           yticks=[-6, -5, -3, -1, 0, 1, 3, 5, 6],
                           xticks=None,
                           yticksD=[
                               "H     ", "C", "L     ", "C", "H     ", "C",
                               "R     ", "C", "H     "
                           ],
                           xticksD=None,
                           xlim=[0, N / 1000.],
                           ylim=[xL - 0.3, xH + 0.3],
                           tickFS=tcksz,
                           labelFS=lblsz)
    else:
        mF.arbitraryAxes(ax,
                         axesVis=[False, True, True, False],
                         xtpos="bottom",
                         ytpos="right")
        mF.setTicksAndLims(
            xlabel="time (s)",
            ylabel="position",
            yticks=[-6, -5, -3, -1, 0, 1, 3, 5, 6],
            xticks=None,
            yticksD=["H", "   C", "L", "   C", "H", "   C", "R", "   C", "H"],
            xticksD=None,
            xlim=[0, N / 1000.],
            ylim=[xL - 0.3, xH + 0.3],
            tickFS=tcksz,
            labelFS=lblsz)

    for ep in range(epochs):
        _plt.axvline(x=(itv[ep + 1] * N / 1000.), color="red", ls="--")
    #######################
    #ax = _plt.subplot2grid((5, 3), (1, 0), colspan=3)
    ax = _plt.subplot2grid((33, 3), (10, 0), colspan=3, rowspan=5)
    print(len(sts))
    _plt.scatter(sts / 1000., d[sts, 2], s=2, color="black")
    if ytpos == "left":
        mF.arbitraryAxes(ax,
                         axesVis=[True, True, False, False],
                         xtpos="bottom",
                         ytpos="left")
        mF.setTicksAndLims(xlabel=None,
                           ylabel="channel 1\nmark (mV)",
                           xticks=None,
                           yticks=[],
                           xticksD=None,
                           yticksD=None,
                           xlim=[0, N / 1000.],
                           ylim=[wvfmMin[0], wvfmMax[0]],
                           tickFS=tcksz,
                           labelFS=lblsz)
    else:
        mF.arbitraryAxes(ax,
                         axesVis=[False, True, True, False],
                         xtpos="bottom",
                         ytpos="right")
        mF.setTicksAndLims(xlabel=None,
                           ylabel="channel 1\nmark (mV)",
                           xticks=None,
                           yticks=[],
                           xticksD=None,
                           yticksD=None,
                           xlim=[0, N / 1000.],
                           ylim=[wvfmMin[0], wvfmMax[0]],
                           tickFS=tcksz,
                           labelFS=lblsz)

    for ep in range(epochs):
        _plt.axvline(x=(itv[ep + 1] * N / 1000.), color="red", ls="--")
    #######################
    ax = _plt.subplot2grid((33, 3), (16, 0), colspan=3, rowspan=5)
    #ax = _plt.subplot2grid((5, 3), (2, 0), colspan=3)
    _plt.scatter(sts / 1000., d[sts, 3], s=2, color="black")
    if ytpos == "left":
        mF.arbitraryAxes(ax,
                         axesVis=[True, True, False, False],
                         xtpos="bottom",
                         ytpos="left")
        mF.setTicksAndLims(xlabel=None,
                           ylabel="channel 2\nmark (mV)",
                           xticks=None,
                           yticks=[],
                           xticksD=None,
                           yticksD=None,
                           xlim=[0, N / 1000.],
                           ylim=[wvfmMin[1], wvfmMax[1]],
                           tickFS=tcksz,
                           labelFS=lblsz)
    else:
        mF.arbitraryAxes(ax,
                         axesVis=[False, True, True, False],
                         xtpos="bottom",
                         ytpos="right")
        mF.setTicksAndLims(xlabel=None,
                           ylabel="channel 2\nmark (mV)",
                           xticks=None,
                           yticks=[],
                           xticksD=None,
                           yticksD=None,
                           xlim=[0, N / 1000.],
                           ylim=[wvfmMin[1], wvfmMax[1]],
                           tickFS=tcksz,
                           labelFS=lblsz)
    for ep in range(epochs):
        _plt.axvline(x=(itv[ep + 1] * N / 1000.), color="red", ls="--")
    #######################
    #ax = _plt.subplot2grid((5, 3), (3, 0), colspan=3)
    ax = _plt.subplot2grid((33, 3), (22, 0), colspan=3, rowspan=5)
    print(len(sts))
    _plt.scatter(sts / 1000., d[sts, 4], s=2, color="black")
    if ytpos == "left":
        mF.arbitraryAxes(ax,
                         axesVis=[True, True, False, False],
                         xtpos="bottom",
                         ytpos="left")
        mF.setTicksAndLims(xlabel=None,
                           ylabel="channel 3\nmark (mV)",
                           xticks=None,
                           yticks=[],
                           xticksD=None,
                           yticksD=None,
                           xlim=[0, N / 1000.],
                           ylim=[wvfmMin[2], wvfmMax[2]],
                           tickFS=tcksz,
                           labelFS=lblsz)
    else:
        mF.arbitraryAxes(ax,
                         axesVis=[False, True, True, False],
                         xtpos="bottom",
                         ytpos="right")
        mF.setTicksAndLims(xlabel=None,
                           ylabel="channel 3\nmark (mV)",
                           xticks=None,
                           yticks=[],
                           xticksD=None,
                           yticksD=None,
                           xlim=[0, N / 1000.],
                           ylim=[wvfmMin[2], wvfmMax[2]],
                           tickFS=tcksz,
                           labelFS=lblsz)
    for ep in range(epochs):
        _plt.axvline(x=(itv[ep + 1] * N / 1000.), color="red", ls="--")
    #######################
    ax = _plt.subplot2grid((33, 3), (28, 0), colspan=3, rowspan=5)
    #ax = _plt.subplot2grid((5, 3), (4, 0), colspan=3)
    _plt.scatter(sts / 1000., d[sts, 5], s=2, color="black")
    if ytpos == "left":
        mF.arbitraryAxes(ax,
                         axesVis=[True, True, False, False],
                         xtpos="bottom",
                         ytpos="left")
        mF.setTicksAndLims(xlabel="time (s)",
                           ylabel="channel 4\nmark (mV)",
                           xticks=None,
                           yticks=[],
                           xticksD=None,
                           yticksD=None,
                           xlim=[0, N / 1000.],
                           ylim=[wvfmMin[3], wvfmMax[3]],
                           tickFS=tcksz,
                           labelFS=lblsz)
    else:
        mF.arbitraryAxes(ax,
                         axesVis=[False, True, True, False],
                         xtpos="bottom",
                         ytpos="right")
        mF.setTicksAndLims(xlabel="time (s)",
                           ylabel="channel 4\nmark (mV)",
                           xticks=None,
                           yticks=[],
                           xticksD=None,
                           yticksD=None,
                           xlim=[0, N / 1000.],
                           ylim=[wvfmMin[3], wvfmMax[3]],
                           tickFS=tcksz,
                           labelFS=lblsz)
    for ep in range(epochs):
        _plt.axvline(x=(itv[ep + 1] * N / 1000.), color="red", ls="--")

    #fig.subplots_adjust(left=0.08, bottom=0.08, right=0.95, top=0.95, wspace=0.9, hspace=0.9)
    if ytpos == "left":
        fig.subplots_adjust(left=0.16,
                            bottom=0.08,
                            right=0.98,
                            top=0.95,
                            wspace=0.4,
                            hspace=0.4)
    if ytpos == "right":
        fig.subplots_adjust(left=0.05,
                            bottom=0.08,
                            right=0.84,
                            top=0.95,
                            wspace=0.4,
                            hspace=0.4)
    epochs = len(itv) - 1
    for fmt in ["eps"]:
        choutfn = "%(of)s.%(fmt)s" % {"of": outfn, "fmt": fmt}
        _plt.savefig(resFN(choutfn, dir=bfn), transparent=True)
    _plt.close()
예제 #5
0
def timeline(bfn,
             datfn,
             itvfn,
             outfn="timeline",
             ch1=0,
             ch2=1,
             xL=0,
             xH=3,
             yticks=[0, 1, 2, 3],
             thin=1,
             allFR=None):  #  25Hz
    d = _N.loadtxt(datFN("%s.dat" % datfn))  #  marks
    itv = _N.loadtxt(datFN("%s.dat" % itvfn))
    N = d.shape[0]  #  ALL spikes
    epochs = itv.shape[0] - 1
    ch1 += 2  #  because this is data col
    ch2 += 2

    wvfmMin = _N.min(d[:, 2:], axis=0)
    wvfmMax = _N.max(d[:, 2:], axis=0)

    Aint = _N.array(itv * N, dtype=_N.int)
    Asts = _N.where(d[Aint[0]:Aint[1], 1] == 1)[0]
    N1 = len(Asts)  # num spikes in 1st epoch

    _x = _N.empty((N1, 5))
    _x[:, 0] = d[Asts, 0]
    _x[:, 1:] = d[Asts, 2:]
    T1 = Aint[1] - Aint[0]
    hz = _x.shape[0] / float(T1 * 0.001)

    if allFR is not None:
        unonhash, hashsp, hashthresh = sepHash(_x,
                                               BINS=20,
                                               blksz=5,
                                               xlo=xL,
                                               xhi=xH)

        rh = len(hashsp) / float(N1)
        rnh = len(unonhash) / float(N1)

        #(m x rh + rnh)*hz = allFR
        #allFR  - rnh x hz = m x rh x hz
        #  m = (rnh x hz - allFR) / (rh x hz)

        m = (allFR - rnh * hz) / (rh * hz)

        #  ((m*len(hashsp) + len(unonhash)) / (T1*0.001))  == allFR  (target FR)
        #  how much of hashsp should we remove?
        #  Find lowest (1 - m)

        _x[:, 1:].sort(axis=0)

        chmins = channelMins(_x, 100, 4, int((1 - m) * len(hashsp)))

        #spk_n, chs = _N.where(_x[:, 1:] > chmins)
        #unique, counts = _N.unique(spk_n, return_counts=True)

        #print len(_N.where(counts > 0)[0])  # at least 1 channel above
        #print (len(_N.where(counts > 0)[0]) / float(T1*0.001))

        _sts = _N.where(d[:, 1] == 1)[0]  #  ALL spikes in ALL epochs
        spk_n, chs = _N.where(d[_sts, 2:] > chmins)

        unique_spk_IDs, counts = _N.unique(spk_n, return_counts=True)
        sts = _sts[unique_spk_IDs[_N.where(counts > 0)[0]]]

    if allFR is None:
        _sts = _N.where(d[:, 1] == 1)[0]
        if thin == 1:
            sts = _sts
        else:
            sts = _sts[::thin]

    fig = _plt.figure(figsize=(10, 12))
    #######################
    ax = _plt.subplot2grid((4, 3), (0, 0), colspan=3)
    _plt.scatter(sts / 1000., d[sts, 0], s=2, color="black")
    mF.arbitraryAxes(ax,
                     axesVis=[True, True, False, False],
                     xtpos="bottom",
                     ytpos="left")
    mF.setTicksAndLims(xlabel="time (s)",
                       ylabel="position",
                       xticks=None,
                       yticks=yticks,
                       xticksD=None,
                       yticksD=None,
                       xlim=[0, N / 1000.],
                       ylim=[xL - 0.3, xH + 0.3],
                       tickFS=15,
                       labelFS=18)
    for ep in range(epochs):
        _plt.axvline(x=(itv[ep + 1] * N / 1000.), color="red", ls="--")
    #######################
    ax = _plt.subplot2grid((4, 3), (1, 0), colspan=3)
    print(len(sts))
    _plt.scatter(sts / 1000., d[sts, ch1], s=2, color="black")
    mF.arbitraryAxes(ax,
                     axesVis=[True, True, False, False],
                     xtpos="bottom",
                     ytpos="left")
    mF.setTicksAndLims(xlabel="time (s)",
                       ylabel=("mk elctrd %d" % (ch1 - 1)),
                       xticks=None,
                       yticks=[0, 3, 6],
                       xticksD=None,
                       yticksD=None,
                       xlim=[0, N / 1000.],
                       ylim=[wvfmMin[0], wvfmMax[0]],
                       tickFS=15,
                       labelFS=18)
    for ep in range(epochs):
        _plt.axvline(x=(itv[ep + 1] * N / 1000.), color="red", ls="--")
    #######################
    ax = _plt.subplot2grid((4, 3), (2, 0), colspan=3)
    _plt.scatter(sts / 1000., d[sts, ch2], s=2, color="black")
    mF.arbitraryAxes(ax,
                     axesVis=[True, True, False, False],
                     xtpos="bottom",
                     ytpos="left")
    mF.setTicksAndLims(xlabel="time (s)",
                       ylabel=("mk elctrd %d" % (ch2 - 1)),
                       xticks=None,
                       yticks=[0, 3, 6],
                       xticksD=None,
                       yticksD=None,
                       xlim=[0, N / 1000.],
                       ylim=[wvfmMin[1], wvfmMax[1]],
                       tickFS=15,
                       labelFS=18)
    for ep in range(epochs):
        _plt.axvline(x=(itv[ep + 1] * N / 1000.), color="red", ls="--")
    ##############
    ax = _plt.subplot2grid((4, 3), (3, 0), colspan=1)
    _plt.scatter(d[sts, ch1], d[sts, ch2], s=2, color="black")
    mF.arbitraryAxes(ax,
                     axesVis=[True, True, False, False],
                     xtpos="bottom",
                     ytpos="left")
    mF.setTicksAndLims(xlabel=("mk elctrd %d" % (ch1 - 1)),
                       ylabel=("mk elctrd %d" % (ch2 - 1)),
                       xticks=[0, 3, 6],
                       yticks=[0, 3, 6],
                       xticksD=None,
                       yticksD=None,
                       xlim=[wvfmMin[0], wvfmMax[0]],
                       ylim=[wvfmMin[1], wvfmMax[1]],
                       tickFS=15,
                       labelFS=18)
    ##############
    ax = _plt.subplot2grid((4, 3), (3, 1), colspan=1)
    _plt.scatter(d[sts, 0], d[sts, ch1], s=2, color="black")
    mF.arbitraryAxes(ax,
                     axesVis=[True, True, False, False],
                     xtpos="bottom",
                     ytpos="left")
    mF.setTicksAndLims(xlabel="pos",
                       ylabel=("mk elctrd %d" % (ch1 - 1)),
                       xticks=_N.linspace(xL, xH, 3),
                       yticks=[0, 3, 6],
                       xticksD=None,
                       yticksD=None,
                       xlim=[xL, xH],
                       ylim=None,
                       tickFS=15,
                       labelFS=18)
    ##############
    ax = _plt.subplot2grid((4, 3), (3, 2), colspan=1)
    _plt.scatter(d[sts, 0], d[sts, ch2], s=2, color="black")
    mF.arbitraryAxes(ax,
                     axesVis=[True, True, False, False],
                     xtpos="bottom",
                     ytpos="left")
    mF.setTicksAndLims(xlabel="pos",
                       ylabel=("mk elctrd %d" % (ch2 - 1)),
                       xticks=_N.linspace(xL, xH, 3),
                       yticks=[0, 3, 6],
                       xticksD=None,
                       yticksD=None,
                       xlim=[xL, xH],
                       ylim=None,
                       tickFS=15,
                       labelFS=18)
    ##############

    fig.subplots_adjust(left=0.15, bottom=0.15, wspace=0.38, hspace=0.38)
    epochs = len(itv) - 1
    choutfn = "%(of)s_%(1)d,%(2)d" % {
        "of": outfn,
        "1": (ch1 - 1),
        "2": (ch2 - 1)
    }
    _plt.savefig(resFN(choutfn, dir=bfn), transparent=True)
    _plt.close()
예제 #6
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()
예제 #7
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()
예제 #8
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()
예제 #9
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()
예제 #10
0
#  the parts of the model in which making a proposal distribution is
#  difficult.

#us = -1
us = 0
std= 1.3#.5

tcksz=15
labsz=17

us = us + std*_N.random.randn(20000)
ps = 1/(1 + _N.exp(-us))

fig = _plt.figure(figsize=(5, 10))
ax = fig.add_subplot(3, 1, 1)
_plt.hist(ps, bins=_N.linspace(0, 1, 1001))
mF.arbitraryAxes(ax, axesVis=[True, True, False, False], xtpos="bottom", ytpos="left")
mF.setTicksAndLims(xlabel="ps", ylabel="prob", xticks=None, yticks=None, xticksD=None, yticksD=None, xlim=None, ylim=None, tickFS=tcksz, labelFS=labsz)

ax = fig.add_subplot(3, 1, 2)
_plt.hist(1-ps, bins=_N.linspace(0, 1, 1001))
mF.arbitraryAxes(ax, axesVis=[True, True, False, False], xtpos="bottom", ytpos="left")
mF.setTicksAndLims(xlabel="ps", ylabel="prob", xticks=None, yticks=None, xticksD=None, yticksD=None, xlim=None, ylim=None, tickFS=tcksz, labelFS=labsz)

ax = fig.add_subplot(3, 1, 3)
_plt.hist(1/(1-ps), bins=_N.linspace(1, 5, 1001))
mF.arbitraryAxes(ax, axesVis=[True, True, False, False], xtpos="bottom", ytpos="left")
mF.setTicksAndLims(xlabel="ps", ylabel="prob", xticks=None, yticks=None, xticksD=None, yticksD=None, xlim=None, ylim=None, tickFS=tcksz, labelFS=labsz)

fig.subplots_adjust(left=0.15, bottom=0.15, wspace=0.3, hspace=0.3)
예제 #11
0
def timeline(bfn, datfn, itvfn, outfn="timeline", ch1=0, ch2=1, xL=0, xH=3, yticks=[0, 1, 2, 3], thin=1):
    d = _N.loadtxt(datFN("%s.dat" % datfn))   #  marks
    itv = _N.loadtxt(datFN("%s.dat" % itvfn))
    N = d.shape[0]
    epochs = itv.shape[0]-1
    ch1 += 2   #  because this is data col
    ch2 += 2

    _sts = _N.where(d[:, 1] == 1)[0]
    if thin == 1:
        sts = _sts
    else:
        sts = _sts[::thin]

    wvfmMin = _N.min(d[:, 2:], axis=0)
    wvfmMax = _N.max(d[:, 2:], axis=0)

    fig = _plt.figure(figsize=(10, 12))
    #######################
    ax =_plt.subplot2grid((4, 3), (0, 0), colspan=3)
    _plt.scatter(sts/1000., d[sts, 0], s=2, color="black")
    mF.arbitraryAxes(ax, axesVis=[True, True, False, False], xtpos="bottom", ytpos="left")
    mF.setTicksAndLims(xlabel="time (s)", ylabel="position", xticks=None, yticks=yticks, xticksD=None, yticksD=None, xlim=[0, N/1000.], ylim=[xL-0.3, xH+0.3], tickFS=15, labelFS=18)
    for ep in xrange(epochs):
        _plt.axvline(x=(itv[ep+1]*N/1000.), color="red", ls="--")
    #######################
    ax = _plt.subplot2grid((4, 3), (1, 0), colspan=3)
    _plt.scatter(sts/1000., d[sts, ch1], s=2, color="black")
    mF.arbitraryAxes(ax, axesVis=[True, True, False, False], xtpos="bottom", ytpos="left")
    mF.setTicksAndLims(xlabel="time (s)", ylabel=("mk tet%d" % (ch1-1)), xticks=None, yticks=[0, 3, 6], xticksD=None, yticksD=None, xlim=[0, N/1000.], ylim=[wvfmMin[0], wvfmMax[0]], tickFS=15, labelFS=18)
    for ep in xrange(epochs):
        _plt.axvline(x=(itv[ep+1]*N/1000.), color="red", ls="--")
    #######################
    ax = _plt.subplot2grid((4, 3), (2, 0), colspan=3)
    _plt.scatter(sts/1000., d[sts, ch2], s=2, color="black")
    mF.arbitraryAxes(ax, axesVis=[True, True, False, False], xtpos="bottom", ytpos="left")
    mF.setTicksAndLims(xlabel="time (s)", ylabel=("mk tet%d" % (ch2-1)), xticks=None, yticks=[0, 3, 6], xticksD=None, yticksD=None, xlim=[0, N/1000.], ylim=[wvfmMin[1], wvfmMax[1]], tickFS=15, labelFS=18)
    for ep in xrange(epochs):
        _plt.axvline(x=(itv[ep+1]*N/1000.), color="red", ls="--")
    ##############
    ax = _plt.subplot2grid((4, 3), (3, 0), colspan=1)
    _plt.scatter(d[sts, ch1], d[sts, ch2], s=2, color="black")
    mF.arbitraryAxes(ax, axesVis=[True, True, False, False], xtpos="bottom", ytpos="left")
    mF.setTicksAndLims(xlabel=("mk tet%d" % (ch1-1)), ylabel=("mk tet%d" % (ch2-1)), xticks=[0, 3, 6], yticks=[0, 3, 6], xticksD=None, yticksD=None, xlim=[wvfmMin[0], wvfmMax[0]], ylim=[wvfmMin[1], wvfmMax[1]], tickFS=15, labelFS=18)
    ##############
    ax = _plt.subplot2grid((4, 3), (3, 1), colspan=1)
    _plt.scatter(d[sts, 0], d[sts, ch1], s=2, color="black")
    mF.arbitraryAxes(ax, axesVis=[True, True, False, False], xtpos="bottom", ytpos="left")
    mF.setTicksAndLims(xlabel="pos", ylabel=("mk tet%d" % (ch1-1)), xticks=_N.linspace(xL, xH, 3), yticks=[0, 3, 6], xticksD=None, yticksD=None, xlim=[xL, xH], ylim=None, tickFS=15, labelFS=18)
    ##############
    ax = _plt.subplot2grid((4, 3), (3, 2), colspan=1)
    _plt.scatter(d[sts, 0], d[sts, ch2], s=2, color="black")
    mF.arbitraryAxes(ax, axesVis=[True, True, False, False], xtpos="bottom", ytpos="left")
    mF.setTicksAndLims(xlabel="pos", ylabel=("mk tet%d" % (ch2-1)), xticks=_N.linspace(xL, xH, 3), yticks=[0, 3, 6], xticksD=None, yticksD=None, xlim=[xL, xH], ylim=None, tickFS=15, labelFS=18)
    ##############

    fig.subplots_adjust(left=0.15, bottom=0.15, wspace=0.38, hspace=0.38)
    epochs = len(itv)-1
    choutfn = "%(of)s_%(1)d,%(2)d" % {"of" : outfn, "1" : (ch1-1), "2" : (ch2-1)}
    _plt.savefig(resFN(choutfn, dir=bfn), transparent=True)
    _plt.close()