예제 #1
0
    def plot(self, fig=None, ax=None):

        try:
            self.min
        except AttributeError:
            self.getLimits()

        if not fig:
            fig = pl.figure(figsize=(12, 7))
        if not ax:
            ax = fig.add_subplot(111)

        ylabels = []
        last_id = self.id_list()[-1] + 1
        for id, csc in enumerate(self):
            s = csc.signal.copy()
            s -= s.mean()
            s /= self.max * .8
            pl.plot(csc.times,
                    s + id,
                    '-',
                    linewidth=1,
                    color=custom_plot.pretty_colors_set2[
                        id % custom_plot.pretty_colors_set2.__len__()])
            ylabels.append(str(csc.tags['channel']).split('.')[0])
        custom_plot.huebschMachen(ax)
        ax.set_xlabel('Time (' + self.timeUnit + ')')
        yticks = numpy.arange(last_id)
        ax.set_yticks(yticks)
        ax.set_yticklabels(ylabels, rotation=0)
        ax.set_xlim(csc.times[0], csc.times[-1])
        ax.set_ylim(-1, id + 1)

        return fig, ax
 def plotPhase(self, fig, ax, pooled=False):
     self.placeCell.phasePlot(fig=fig,labelx=False, labely=False, ax=ax, lfp=self.csc, labelsize=8)
     ax.axvline(x=traj.places[self.index_start,0],linewidth=1, color='g')
     ax.axvline(x=traj.places[self.index_stop-2,0],linewidth=1, color='k')
     ax.axvline(x=traj.places[self.index_gain,0],linewidth=1, color='r')        
     fig.canvas.draw()
     custom_plot.huebschMachen(ax)
예제 #3
0
def plotData(csc):
    csc.fft()

    fig = pl.figure(figsize=(12, 7))
    pos1 = [.1, .7, .8, .22]
    ax1 = fig.add_axes(pos1)
    pos2 = pos1
    pos2[1] = .39
    ax2 = fig.add_axes(pos2)
    pos3 = pos1
    pos3[1] = .1
    ax3 = fig.add_axes(pos3)

    ax1.set_title(csc.tags['file'])
    csc.plot(fig, ax1)
    custom_plot.huebschMachen(ax1)

    csc.fft_plot(fig, ax2)
    custom_plot.huebschMachen(ax2)
    ax2.set_xlabel('')
    ax2.set_xticklabels([])

    csc.fft_plot(fig, ax3)
    ax3.set_xlim(0, 15.)
    custom_plot.huebschMachen(ax3)
예제 #4
0
    def fft_plot(self, freq_min=0., freq_max=60., fig=None, ax=None):

        try:
            self.min
        except AttributeError:
            self.getLimits()

        if not fig:
            fig = pl.figure(figsize=(12, 7))

        if not ax:
            ax = fig.add_subplot(111)

        ylabels = []
        last_id = self.id_list()[-1] + 1
        for id, csc in enumerate(self):
            if not hasattr(csc, 'spPower'):
                csc.fft()
            index_freq_min = numpy.searchsorted(csc.freq, freq_min)
            index_freq_max = numpy.searchsorted(csc.freq, freq_max)
            s = csc.spPower
            s -= s[index_freq_min:index_freq_max].mean()
            s /= s[index_freq_min:index_freq_max].max() * 1.1
            pl.plot(csc.freq,
                    s + id,
                    '-',
                    linewidth=1,
                    color=custom_plot.pretty_colors_set2[
                        id % custom_plot.pretty_colors_set2.__len__()])
            ylabels.append(str(csc.tags['channel']).split('.')[0])
        custom_plot.huebschMachen(ax)
        ax.set_xlabel('Frequency (Hz)')
        yticks = numpy.arange(last_id)
        ax.set_yticks(yticks)
        ax.set_yticklabels(ylabels, rotation=0)
        ax.set_xlim(freq_min, freq_max)
        ax.set_ylim(0, id + 1)

        return fig, ax
예제 #5
0
                       alpha=0.6,
                       zorder=.1)

    # plot csc trace
    ax.plot(csc.time_axis(), csc.signal, 'k', linewidth=1)
    ax.plot(csc.time_axis(),
            csc.signal_filtered,
            color=[0, .75, 1],
            linewidth=2)

    ax.set_xlim(time_closeUp[0], time_closeUp[1])
    custom_plot.turnOffAxes(ax, spines=['left'])
    ax.set_ylim(numpy.percentile(csc.signal, .5),
                numpy.percentile(csc.signal, 99.5))
    ax.set_xticklabels([])
    custom_plot.huebschMachen(ax)
    #    custom_plot.turnOffAxes(ax, spines=['top'])

    ax2 = ax.twinx()
    for tl in ax2.get_yticklabels():
        tl.set_color('k')
    ax2.plot(t * 1000, s / (s.mean() + 4 * s.std()), color='k', alpha=0.5)
    ax2.plot((traj.times - traj.times[0]) * 1000,
             traj.getXComponents() / traj.getXComponents().max(),
             color='g',
             alpha=0.5)
    ax2.set_xlim(time_closeUp[0], time_closeUp[1])
    custom_plot.turnOffAxes(ax2, spines=['right'])

    #    ax2.plot(csc.time_axis(), csc.hilbertPhase,'g', alpha=.3, zorder=.1)
    #    ax2.set_ylim(0, 360)
 def plotPlace(self, row, fig):
     pos = [(row+1)*.08, (row+1)*.21, .05, .13] #  [left, bottom, width, height]
     ax = fig.add_axes(pos)
     self.placeCell.plotSpikesvsPlace(fig=fig, ax=ax)
     custom_plot.huebschMachen(ax)