Skip to content

Commit

Permalink
Rename update_probability to drop
Browse files Browse the repository at this point in the history
  • Loading branch information
ntolley authored and jasmainak committed May 19, 2021
1 parent 76d513c commit d187a58
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/plot_connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
# all the same cell type allowing for easy modifications.
for conn in net.connectivity:
if conn['src_type'] == 'L2_basket':
conn.update_probability(0.1)
conn.drop(0.1)

net_remove = net.copy()
dpl_remove = simulate_dipole(net_remove, n_trials=1)
Expand Down
6 changes: 3 additions & 3 deletions hnn_core/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ def add_connection(self, src_gids, target_gids, loc, receptor,
conn['nc_dict'][key] = item

if probability != 1.0:
conn.update_probability(probability)
conn.drop(probability)
conn['probability'] = probability

self.connectivity.append(deepcopy(conn))
Expand Down Expand Up @@ -1178,7 +1178,7 @@ def __repr__(self):

return entr

def update_probability(self, probability):
def drop(self, probability):
"""Remove/keep a random subset of connections.
Parameters
Expand Down Expand Up @@ -1206,7 +1206,7 @@ def update_probability(self, probability):
target_src_pair in self['gid_pairs'].values()])
n_connections = np.round(
len(all_connections) * probability).astype(int)
print(len(all_connections), n_connections)

# Select a random subset of connections to retain.
new_connections = np.random.choice(
range(len(all_connections)), n_connections, replace=False)
Expand Down
2 changes: 1 addition & 1 deletion hnn_core/tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_network():
n_connections = np.sum(
[len(t_gids) for
t_gids in net.connectivity[0]['gid_pairs'].values()])
net.connectivity[0].update_probability(0.5)
net.connectivity[0].drop(0.5)
n_connections_new = np.sum(
[len(t_gids) for
t_gids in net.connectivity[0]['gid_pairs'].values()])
Expand Down

0 comments on commit d187a58

Please sign in to comment.