Ejemplo n.º 1
0
  def plot_num_overlap(self,th=None):
    if th is None:
      th=self.amp/2.
    
    import pylab as pl
    import plotlib as pp

    pl.figure()
    pl.subplot(111,aspect='equal')
    pl.pcolormesh(np.sum(self.inputs_flat>th,axis=1).reshape(self.nx,self.nx))
    pp.noframe()
    pp.colorbar()    
Ejemplo 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)
Ejemplo n.º 3
0
  def plot_sample(self,random=False,num_samples=16):
    import pylab as pl
    from plotlib import noframe,colorbar
    from numpy import var,floor,ceil,arange,sqrt
    
    sparseness=self.comp_sparseness()

    if random is True:
      input_idxs=randint(0,self.n**2,num_samples)
    else:
      input_idxs=arange(num_samples)

    nsx=int(ceil(sqrt(num_samples)))
    nsy=int(floor(sqrt(num_samples)))
    pl.figure(figsize=(12,10))
    for idx,input_idx in enumerate(input_idxs):
      pl.subplot(nsx,nsy,idx+1,aspect='equal')
      noframe()
      pl.pcolormesh(self.inputs_flat[:,input_idx].reshape(self.nx,self.nx))
      colorbar()
      pl.title('m:%.3f v:%.2e s:%.2e'%(np.mean(self.inputs_flat[:,input_idx]),var(self.inputs_flat[:,input_idx]),sparseness[input_idx]),fontsize=14)
Ejemplo n.º 4
0
    def plot_estimated_initial_output(self):

        import pylab as pl
        from plotlib import noframe, colorbar, shiftedColorMap
        from grid_functions import get_estimated_output
        out_map = get_estimated_output(self.__dict__, self.inputs_flat,
                                       self.J0, self.boundary_input_flat)
        pl.figure(figsize=(10, 5))
        pl.subplot(121, aspect='equal')
        pl.pcolormesh(out_map.reshape(self.nx, self.nx))
        colorbar()
        noframe()
        pl.title('Initial output')

        pl.subplot(122, aspect='equal')
        data = self.boundary_input_flat.reshape(self.nx, self.nx)
        mesh = pl.pcolormesh(data, vmin=data.min(), vmax=data.max())
        midpoint = 1 - data.max() / (data.max() + abs(data.min()))
        cmap = shiftedColorMap(pl.cm.RdBu_r, midpoint=midpoint)
        mesh.set_cmap(cmap)
        colorbar()
        noframe()

        pl.title('Boundary input')
Ejemplo n.º 5
0
#%%

inputs = GridInputs(batch_default_map, comp_scores=True)

#### EXAMPLE INPUTS

pl.rc('font', size=11)
pp.set_tick_size(3)

pl.figure(figsize=(5.5, 2))
input_idxs = [0, 5, 2, 3, 7]
idx = 0
for idx, input_idx in enumerate(input_idxs):
    pl.subplot(1, len(input_idxs), idx + 1, aspect='equal')
    pp.noframe()
    rmap = inputs.inputs_flat[:, input_idx].reshape(inputs.nx, inputs.nx)
    pl.pcolormesh(rmap, vmin=0, rasterized=True)

    pl.title('%.1f ' % (rmap.max()))

    #pp.colorbar(num_int=3)

pl.savefig(figures_path + '/fig9a_maps.eps', bbox_inches='tight', dpi=300)

#%%
pl.figure(figsize=(5.5, 2))
idx = 0
for idx, input_idx in enumerate(input_idxs):
    pl.subplot(1, len(input_idxs), idx + 1, aspect='equal')
    pl.xticks([])