def example(): ''' Create images of a situation where the size of the place cell matters. ''' PlaceN = 500 GridN = 1000 C=.3 thresh = .0075 f_I = 5.31 f_p = 15 W = 1 min_grid_size = .0004 min_plcfld_size = .005 grid_net = GridNetwork(GridN, min_grid_size, W,W, None) plc_net = PlaceNetwork(PlaceN, grid_net, wt_type='Monaco', C=C) acts = plc_net.activity() final_acts, _ = asymptotic_inhib(acts, f_I, f_p, thresh) mesh_pts = acts[0].shape[0] for i in range(PlaceN): flds = PlaceField.above_cutoff(final_acts[i], use_cutoff=False) num_flds, layout, _ = PlaceField.check_size(flds,W,W,min_plcfld_size,mesh_pts) no_min, _, _ = PlaceField.check_size(flds,W,W,0,mesh_pts) if no_min != num_flds: # TODO(joelshor): Make plots twin aka. side by side. _plot(grid_net.X[0],grid_net.Y[0],flds,'Before size check') _plot(grid_net.X[0],grid_net.Y[0],layout,'After size check') plt.show()
def example(): ''' Create images of place cell output for the paper. Called as python MakeFig.py inhib''' thresh = .1 f_I = 7 f_p = 15 W = 1 C=.33 min_grid_size = .0004 grid_net = GridNetwork(1000,min_grid_size,W,W) plc_net = PlaceNetwork(500,grid_net,wt_type='Monaco updated',C=C) act = plc_net.activity() final_acts, _ = asymptotic_inhib(act,f_I,f_p,thresh) for i in range(5): _plot(grid_net.X[0],grid_net.Y[0],final_acts[i],None) plt.show()
def display_with_modules(): ''' Create images of typical place cell input. ''' W = 3 # Size of room min_grid_size = .0004 G = 100 # Number of grid cells P = 4 # Number of place cells Ms = [0, 1, 5] # Number of modules C = .4 # Connectivity for j in range(len(Ms)): M = Ms[j] grid_net = GridNetwork(G,min_grid_size,W,W,modules=M) plc_net = PlaceNetwork(P,grid_net,wt_type='Monaco',C=C) logging.info('Calculating activity...') act = plc_net.activity() for i in range(1,5): plt.subplot(len(Ms),4,i+4*j) _plot_sub(grid_net.X[0],grid_net.Y[0],act[i-1],None) plt.suptitle('W=%i,G=%i,Ms=%s'%(W,G,str(Ms))) plt.show()
def _collect_one_round(params, get_relevant_activity): grid_net = GridNetwork(pm.grd_cells, pm.min_grid_size, pm.W,pm.H, pm.modules) plc_net = PlaceNetwork(pm.plc_cells, grid_net, wt_type=pm.wt_type, C=pm.C) acts = plc_net.activity() return get_relevant_activity(acts)