コード例 #1
0
ファイル: get_gids_to_record.py プロジェクト: MinaKh/bcpnn-mt
print 'w_out_good = weights to other well tuned neurons'
print 'w_in_good = weights from other well tuned neurons'
print 'w_out_total = sum of all outgoing weights'
print 'w_in_total = sum of all incoming weights'
print 'distance_to_stim = minimal distance to the moving stimulus (linear sum of  (time-varying) spatial distance and (constant) distance in velocity)'
print "\nGID\tnspikes\tdistance_to_stim\tw_out_good\tw_in_good\tw_out_total\tw_in_total\ttuning_prop"
for i in xrange(n):
    gid = indices[i]
    other_gids = list(indices)
    other_gids.remove(gid)
    w_in_good = conn_mat[other_gids, gid].sum()
    w_out_good = conn_mat[gid, other_gids].sum()
    w_in_sum = conn_mat[:, gid].sum()
    w_out_sum = conn_mat[gid, :].sum()
    distance_to_stim, spatial_dist = utils.get_min_distance_to_stim(mp, tp[gid, :])
    print '%d\t%d\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e' % (gid, nspikes[gid], distance_to_stim, w_out_good, w_in_good, w_out_sum, w_in_sum), tp[gid, :]
#    print '%d\t%d\t%.3e\t%.3e\t%.3e' % (gid, nspikes[gid], distance_to_stim, w_in_good, w_in_sum), tp[gid, :]

print '\n Look at the most active neurons in the network'
print 'w_out = weights to other mans (MostActiveNeuronS)'
print 'w_in = weights from other mans (MostActiveNeuronS)'
print 'w_out_total = sum of all outgoing weights'
print 'w_in_total = sum of all incoming weights'
print 'distance_to_stim = minimal distance to the moving stimulus (linear sum of  (time-varying) spatial distance and (constant) distance in velocity)'
print "\nGID\tnspikes\tdistance_to_stim\tw_out\tw_in\tw_out_total\tw_in_total\ttuning_prop"
for i in xrange(n):
    gid = mans[i]
    other_gids = list(mans)
    other_gids.remove(gid)
    w_in_good = conn_mat[other_gids, gid].sum()
コード例 #2
0
 def get_distances_between_cell_and_stimulus(self):
     n_cells = self.params['n_exc']
     self.dist_to_stim = np.zeros(n_cells)
     for i in xrange(n_cells):
         self.dist_to_stim[i], spatial_dist = utils.get_min_distance_to_stim(self.mp, self.tp[i, :])
コード例 #3
0
def get_tuning_curve(tp, blur_x, blur_v, v_x_stim=0.2, v_y_stim=.0):
    params['blur_X'] = blur_x
    params['blur_V'] = blur_v
    location_tuning = np.zeros((n_points, 5))
    direction_tuning = np.zeros((n_points, 5))
    # row = cell gid
    # column0 : minimal distance between cell and stimulus during stimulus presentation
    #       1 : maximum input
    #       2 : summed input
    #       3 : |v_cell - v_stim|
    #       4 : angle(v_cell, v_stim)


    dt = params['dt_rate']
    time = np.arange(0, params['t_sim'], dt)
    tp_ = np.array([[tp[0], tp[1], tp[2], tp[3]]])
    v_cell = np.sqrt(tp[2]**2 + tp[3]**2)

    # measure L_i vs location tuning curve
    x_stim_start = 0.2
    y_stim_start = np.linspace(0.2, 0.8, n_points)

    for stim in xrange(n_points):
        L_input = np.zeros(time.shape[0])
        mp = (x_stim_start, y_stim_start[stim], v_x_stim, v_y_stim)

        for i_time, time_ in enumerate(time):
            L_input[i_time] = utils.get_input(tp_, params, time_/params['t_stimulus'], motion_params=mp)

        debug_fn = 'delme_%d.dat' % stim
        np.savetxt(debug_fn, L_input)
        dist = utils.get_min_distance_to_stim(mp, tp, params)
        dist = dist[1]
        v_stim = np.sqrt(mp[2]**2 + mp[3]**2)
        location_tuning[stim, 0] = dist
        location_tuning[stim, 1] = L_input.max()
        location_tuning[stim, 2] = L_input.sum()
        location_tuning[stim, 3] = np.sqrt((mp[2] - tp[2])**2 + (mp[3] - tp[3])**2)
        location_tuning[stim, 4] = np.pi - np.arcsin(tp[2] / v_cell) - np.arcsin(mp[2] / v_stim)
#        print 'debug dist', stim, dist, 'L_input.max()=', location_tuning[stim, 1], '\n', mp, '\t', tp

    # measure L_i vs direction tuning curve
    v_theta = np.linspace(0, np.pi, n_points)
    v_stim = np.sqrt(v_x_stim**2 + v_y_stim**2)
    v_x_stim = v_stim * np.cos(v_theta)
    v_y_stim = v_stim * np.sin(v_theta)
    for stim in xrange(n_points):
        L_input = np.zeros(time.shape[0])
        x_stim_start = tp[0] - v_x_stim[stim]
        y_stim_start = tp[0] - v_y_stim[stim]
        mp = (x_stim_start, y_stim_start, v_x_stim[stim], v_y_stim[stim])
        for i_time, time_ in enumerate(time):
            L_input[i_time] = utils.get_input(tp_, params, time_/params['t_stimulus'], motion_params=mp)
        dist = utils.get_min_distance_to_stim(mp, tp, params)[1]
        v_stim = np.sqrt(mp[2]**2 + mp[3]**2)

        direction_tuning[stim, 0] = dist
        direction_tuning[stim, 1] = L_input.max()
        direction_tuning[stim, 2] = L_input.sum()
        direction_tuning[stim, 3] = np.sqrt((mp[2] - tp[2])**2 + (mp[3] - tp[3])**2)
        direction_tuning[stim, 4] = np.pi - np.arcsin(tp[2] / v_cell) - np.arcsin(mp[2] / v_stim)

    return location_tuning, direction_tuning