Esempio n. 1
0
    def plot_occupancy(self):
        import pylab as pl
        from plotlib import custom_axes

        p_hist, x, y = np.histogram2d(self.pos[self.pidx_vect, 0],
                                      self.pos[self.pidx_vect, 1],
                                      range=[[-self.L / 2, self.L / 2],
                                             [-self.L / 2, self.L / 2]],
                                      bins=50)

        pl.figure()
        # plot the results
        pl.subplot(111, aspect='equal')
        custom_axes()
        pl.xlim(-self.L / 2, self.L / 2)
        pl.ylim(-self.L / 2, self.L / 2)

        pl.pcolormesh(x, y, p_hist)
        pl.colorbar()
        pl.xlabel('X bin')
        pl.ylabel('Y bin')
        pl.title('Visits')

        pl.figure()
        pl.hist(self.pidx_vect, color='k', bins=100)

        pl.figure()
        pl.plot(self.pidx_vect, '-k')
Esempio n. 2
0
    def plot_weights(self, snap_idx=-1):
        import pylab as pl
        from plotlib import noframe, colorbar, plot_weight_dist, custom_axes
        from numpy import arange
        snap_times = arange(self.num_snaps) * self.delta_snap * self.dt

        final_J_mat = self.J_vect[:, snap_idx].reshape(self.n, self.n)
        pl.figure()
        pl.subplot(211, aspect='equal')
        pl.pcolormesh(final_J_mat)
        noframe()
        colorbar()

        pl.subplot(212)
        custom_axes()
        plot_weight_dist(snap_times, self.J_vect, alpha=0.2)
Esempio n. 3
0
 def plot_scores(self):
   import pylab as pl
   from plotlib import custom_axes
   from numpy import median 
   from plotlib import MaxNLocator
   
   pl.figure(figsize=(2.8,1.8))
   pl.subplots_adjust(bottom=0.3,left=0.3)
   pl.hist(self.in_scores,bins=50,color='k')
   pl.axvline(median(self.in_scores),color='r')
   custom_axes()
   pl.xlabel('Input gridness score',fontsize=11)
   pl.ylabel('Number of neurons',fontsize=11)
   pl.xlim([-0.5,2])
   #pl.ylim([0,60])
   pl.gca().yaxis.set_major_locator(MaxNLocator(3))
   pl.gca().xaxis.set_major_locator(MaxNLocator(3))
Esempio n. 4
0
    def plot_eigs(self):
        import pylab as pl
        from plotlib import custom_axes
        import matplotlib.ticker as mtick
        pl.figure(figsize=(15, 10))
        pl.subplots_adjust(left=0.05,
                           right=0.95,
                           top=0.9,
                           bottom=0.2,
                           hspace=0.4,
                           wspace=0.4)

        pl.subplot(221)
        custom_axes()
        pl.xlabel('Frequency [1/m]')
        pl.ylabel('Eigenvalue')

        pl.plot(self.freqs[1:], self.raw_eigs[1:], '.-k', markersize=10)
        pl.axhline(self.a, color='g', linestyle='-')
        pl.xlim(-0.1, 6)
        pl.title('Raw Eigs, LF=%.2f, HF=%.2f ' %
                 (self.eigs_lf_diff, self.eigs_hf_diff))

        pl.subplot(222)
        custom_axes()
        pl.xlabel('Frequency [1/m]')
        pl.ylabel('Eigenvalue')
        pl.gca().yaxis.set_major_formatter(mtick.FormatStrFormatter('%.2e'))
        pl.plot(self.freqs[1:], self.eigs[1:] * self.eta, '.-k', markersize=10)
        pl.axhline(0, color='g', linestyle='-')
        pl.xlim(-0.1, 6)
        pl.title('Eigs')

        pl.subplot(223)
        t_vect, step_vect, resp_vect, K_vect = get_step_response(self.paramMap)
        pl.plot(t_vect, resp_vect, '-k')
        custom_axes()
        pl.xlabel('Time [s]')
        pl.ylabel('Response [a.u.]')
        pl.xlim(0, 3)
        pl.title('Step response, step_amp=10')
        max_resp = resp_vect.max()
        pl.text(2, max_resp * 0.8, 'tau1=%.2f' % self.tau1)
        pl.text(2, max_resp * 0.7, 'tau2=%.2f' % self.tau2)
        pl.text(2, max_resp * 0.6, 'tau3=%.2f' % self.tau3)
        pl.text(2, max_resp * 0.4, 'mu1=%.2f' % self.mu1)
        pl.text(2, max_resp * 0.3, 'mu2=%.2f' % self.mu2)
        pl.text(2, max_resp * 0.2, 'mu3=%.2f' % self.mu3)

        pl.subplot(224)
        pl.plot(t_vect, K_vect, '-k')
        custom_axes()
        pl.xlabel('Time [s]')
        pl.ylabel('Response [a.u.]')
        pl.xlim(0, 1)
Esempio n. 5
0
    def plot(self, num_steps=1000):
        import pylab as pl
        from plotlib import custom_axes

        pl.figure()
        pl.subplot(111, aspect='equal')
        custom_axes()
        pl.xlim(-self.L / 2, self.L / 2)
        pl.ylim(-self.L / 2, self.L / 2)

        if num_steps is not None:
            pl.plot(self.pos[self.pidx_vect[0:num_steps], 0],
                    self.pos[self.pidx_vect[0:num_steps], 1],
                    '.k',
                    ms=2)
        else:
            pl.plot(self.pos[self.pidx_vect, 0],
                    self.pos[self.pidx_vect, 1],
                    '.k',
                    ms=2)

        pl.figure(figsize=(10, 4))
        pl.subplot(121)
        time = np.linspace(0, self.walk_time, len(self.speed_vect))
        pl.plot(time, self.speed_vect, '-k')
        pl.xlabel('Time [s]')
        pl.ylabel('Speed [m/s]')
        custom_axes()
        pl.xlim(0, 5)

        pl.subplot(122)
        pl.hist(self.speed_vect, color='k', bins=100)
        pl.xlabel('Speed [m/s]')
        pl.ylabel('Count')
        custom_axes()
        pl.title('Mean = %.2f  Var = %.3e' %
                 (self.speed_vect.mean(), self.speed_vect.var()))
Esempio n. 6
0
pl.savefig(figures_path + '/fig9b_dfts.eps', bbox_inches='tight', dpi=300)

#%%

# scores
pl.figure(figsize=(8, 1.7))
pl.subplots_adjust(left=0.1, right=1, top=0.85, bottom=0.3, wspace=0.2)

pl.subplot(1, 3, 1)
bins, edges = np.histogram(scores, range=[-1., 2], bins=30)
pl.bar(edges[:-1],
       bins.astype(np.float) / sum(idxs),
       color='k',
       width=edges[1] - edges[0],
       align='center')
pp.custom_axes()
pl.axvline(np.mean(scores), color=pp.red, lw=2)
pl.xlim(-1, 2)
pl.xticks([-1, 0, 1, 2])
pl.yticks([0, 0.1, 0.2])
pl.xlabel('Gridness score')
pl.ylabel('Fraction of cells')
pl.savefig(figures_path + '/fig9c.eps', dpi=300, transparent=True)

pl.figure(figsize=(1.7, 1.7))
pl.subplots_adjust(left=0.4,
                   right=0.9,
                   top=0.85,
                   bottom=0.3,
                   wspace=0.2,
                   hspace=0.6)
Esempio n. 7
0
                                                      t_min=-1.,
                                                      t_max=6.)
f_vect = arange(0, 5, 0.01)
K_vect = K_t_sign(b1, b2, b3, p.mu1, p.mu2, p.mu3, t_vect)

pl.rc('font', size=18)
pl.figure(figsize=(10, 3.2))
pl.subplots_adjust(left=0.15,
                   right=0.95,
                   bottom=0.2,
                   top=0.9,
                   hspace=0.2,
                   wspace=0.6)
pl.subplot(1, 2, 1)
pl.plot(t_vect, K_vect, '-k', lw=2)
custom_axes()
pl.xlabel('Time [s]')
pl.ylabel('Impulse Response [a.u.]')
pl.xlim(-.5, 1.5)
pl.yticks([-1, 0, 1, 2, 3])

amp_vect = abs(K_ft_k(b1, b2, b3, p.mu1, p.mu2, p.mu3, 2 * pi * f_vect))
pl.subplot(1, 2, 2)
pl.plot(f_vect, amp_vect, '-k', lw=2)
custom_axes()
pl.xlabel('Frequency [Hz]')
pl.ylabel('Amplitude [a.u.]')
max_freq = f_vect[argmax(amp_vect)]
print max_freq
pl.axvline(max_freq, color='k', lw=1.5)
pl.yticks([0, 0.1, 0.2])