bmtool 0.5.0__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bmtool-0.5.0 → bmtool-0.5.1}/PKG-INFO +1 -1
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/bmplot.py +31 -19
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/connectors.py +4 -4
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/util/util.py +19 -8
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool.egg-info/PKG-INFO +1 -1
- {bmtool-0.5.0 → bmtool-0.5.1}/setup.py +1 -1
- {bmtool-0.5.0 → bmtool-0.5.1}/LICENSE +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/README.md +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/__init__.py +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/__main__.py +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/debug/__init__.py +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/debug/commands.py +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/debug/debug.py +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/manage.py +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/plot_commands.py +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/singlecell.py +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/util/__init__.py +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/util/commands.py +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/util/neuron/__init__.py +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool/util/neuron/celltuner.py +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool.egg-info/SOURCES.txt +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool.egg-info/dependency_links.txt +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool.egg-info/entry_points.txt +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool.egg-info/requires.txt +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/bmtool.egg-info/top_level.txt +0 -0
- {bmtool-0.5.0 → bmtool-0.5.1}/setup.cfg +0 -0
@@ -14,6 +14,7 @@ import matplotlib.colors as colors
|
|
14
14
|
import matplotlib.gridspec as gridspec
|
15
15
|
from mpl_toolkits.mplot3d import Axes3D
|
16
16
|
from IPython import get_ipython
|
17
|
+
from IPython.display import display, HTML
|
17
18
|
import statistics
|
18
19
|
import pandas as pd
|
19
20
|
import os
|
@@ -44,7 +45,7 @@ def is_notebook() -> bool:
|
|
44
45
|
except NameError:
|
45
46
|
return False # Probably standard Python interpreter
|
46
47
|
|
47
|
-
def total_connection_matrix(config=None,title=None,sources=None, targets=None, sids=None, tids=None,no_prepend_pop=False,save_file=None,synaptic_info='0'):
|
48
|
+
def total_connection_matrix(config=None,title=None,sources=None, targets=None, sids=None, tids=None,no_prepend_pop=False,save_file=None,synaptic_info='0',include_gap=True):
|
48
49
|
"""
|
49
50
|
Generates connection plot displaying total connection or other stats
|
50
51
|
config: A BMTK simulation config
|
@@ -55,6 +56,7 @@ def total_connection_matrix(config=None,title=None,sources=None, targets=None, s
|
|
55
56
|
no_prepend_pop: dictates if population name is displayed before sid or tid when displaying graph
|
56
57
|
save_file: If plot should be saved
|
57
58
|
synaptic_info: '0' for total connections, '1' for mean and stdev connections, '2' for all synapse .mod files used, '3' for all synapse .json files used
|
59
|
+
include_gap: Determines if connectivity shown should include gap junctions + chemical synapses. False will only include chemical
|
58
60
|
"""
|
59
61
|
if not config:
|
60
62
|
raise Exception("config not defined")
|
@@ -70,7 +72,7 @@ def total_connection_matrix(config=None,title=None,sources=None, targets=None, s
|
|
70
72
|
tids = tids.split(",")
|
71
73
|
else:
|
72
74
|
tids = []
|
73
|
-
text,num, source_labels, target_labels = util.connection_totals(config=config,nodes=None,edges=None,sources=sources,targets=targets,sids=sids,tids=tids,prepend_pop=not no_prepend_pop,synaptic_info=synaptic_info)
|
75
|
+
text,num, source_labels, target_labels = util.connection_totals(config=config,nodes=None,edges=None,sources=sources,targets=targets,sids=sids,tids=tids,prepend_pop=not no_prepend_pop,synaptic_info=synaptic_info,include_gap=include_gap)
|
74
76
|
|
75
77
|
if title == None or title=="":
|
76
78
|
title = "Total Connections"
|
@@ -84,7 +86,7 @@ def total_connection_matrix(config=None,title=None,sources=None, targets=None, s
|
|
84
86
|
plot_connection_info(text,num,source_labels,target_labels,title, syn_info=synaptic_info, save_file=save_file)
|
85
87
|
return
|
86
88
|
|
87
|
-
def percent_connection_matrix(config=None,nodes=None,edges=None,title=None,sources=None, targets=None, sids=None, tids=None, no_prepend_pop=False,save_file=None,method = 'total'):
|
89
|
+
def percent_connection_matrix(config=None,nodes=None,edges=None,title=None,sources=None, targets=None, sids=None, tids=None, no_prepend_pop=False,save_file=None,method = 'total',include_gap=True):
|
88
90
|
"""
|
89
91
|
Generates a plot showing the percent connectivity of a network
|
90
92
|
config: A BMTK simulation config
|
@@ -95,6 +97,7 @@ def percent_connection_matrix(config=None,nodes=None,edges=None,title=None,sourc
|
|
95
97
|
no_prepend_pop: dictates if population name is displayed before sid or tid when displaying graph
|
96
98
|
method: what percent to displace on the graph 'total','uni',or 'bi' for total connections, unidirectional connections or bidirectional connections
|
97
99
|
save_file: If plot should be saved
|
100
|
+
include_gap: Determines if connectivity shown should include gap junctions + chemical synapses. False will only include chemical
|
98
101
|
"""
|
99
102
|
if not config:
|
100
103
|
raise Exception("config not defined")
|
@@ -111,7 +114,7 @@ def percent_connection_matrix(config=None,nodes=None,edges=None,title=None,sourc
|
|
111
114
|
tids = tids.split(",")
|
112
115
|
else:
|
113
116
|
tids = []
|
114
|
-
text,num, source_labels, target_labels = util.percent_connections(config=config,nodes=None,edges=None,sources=sources,targets=targets,sids=sids,tids=tids,prepend_pop=not no_prepend_pop,method=method)
|
117
|
+
text,num, source_labels, target_labels = util.percent_connections(config=config,nodes=None,edges=None,sources=sources,targets=targets,sids=sids,tids=tids,prepend_pop=not no_prepend_pop,method=method,include_gap=include_gap)
|
115
118
|
if title == None or title=="":
|
116
119
|
title = "Percent Connectivity"
|
117
120
|
|
@@ -120,7 +123,7 @@ def percent_connection_matrix(config=None,nodes=None,edges=None,title=None,sourc
|
|
120
123
|
return
|
121
124
|
|
122
125
|
def probability_connection_matrix(config=None,nodes=None,edges=None,title=None,sources=None, targets=None, sids=None, tids=None,
|
123
|
-
no_prepend_pop=False,save_file=None, dist_X=True,dist_Y=True,dist_Z=True,bins=8,line_plot=False,verbose=False):
|
126
|
+
no_prepend_pop=False,save_file=None, dist_X=True,dist_Y=True,dist_Z=True,bins=8,line_plot=False,verbose=False,include_gap=True):
|
124
127
|
"""
|
125
128
|
Generates probability graphs
|
126
129
|
need to look into this more to see what it does
|
@@ -145,7 +148,7 @@ def probability_connection_matrix(config=None,nodes=None,edges=None,title=None,s
|
|
145
148
|
|
146
149
|
throwaway, data, source_labels, target_labels = util.connection_probabilities(config=config,nodes=None,
|
147
150
|
edges=None,sources=sources,targets=targets,sids=sids,tids=tids,
|
148
|
-
prepend_pop=not no_prepend_pop,dist_X=dist_X,dist_Y=dist_Y,dist_Z=dist_Z,num_bins=bins)
|
151
|
+
prepend_pop=not no_prepend_pop,dist_X=dist_X,dist_Y=dist_Y,dist_Z=dist_Z,num_bins=bins,include_gap=include_gap)
|
149
152
|
if not data.any():
|
150
153
|
return
|
151
154
|
if data[0][0]==-1:
|
@@ -195,7 +198,7 @@ def probability_connection_matrix(config=None,nodes=None,edges=None,title=None,s
|
|
195
198
|
|
196
199
|
return
|
197
200
|
|
198
|
-
def convergence_connection_matrix(config=None,title=None,sources=None, targets=None, sids=None, tids=None, no_prepend_pop=False,save_file=None,convergence=True,method='mean'):
|
201
|
+
def convergence_connection_matrix(config=None,title=None,sources=None, targets=None, sids=None, tids=None, no_prepend_pop=False,save_file=None,convergence=True,method='mean',include_gap=True):
|
199
202
|
"""
|
200
203
|
Generates connection plot displaying convergence data
|
201
204
|
config: A BMTK simulation config
|
@@ -211,9 +214,9 @@ def convergence_connection_matrix(config=None,title=None,sources=None, targets=N
|
|
211
214
|
raise Exception("config not defined")
|
212
215
|
if not sources or not targets:
|
213
216
|
raise Exception("Sources or targets not defined")
|
214
|
-
return divergence_connection_matrix(config,title ,sources, targets, sids, tids, no_prepend_pop, save_file ,convergence, method)
|
217
|
+
return divergence_connection_matrix(config,title ,sources, targets, sids, tids, no_prepend_pop, save_file ,convergence, method,include_gap=include_gap)
|
215
218
|
|
216
|
-
def divergence_connection_matrix(config=None,title=None,sources=None, targets=None, sids=None, tids=None, no_prepend_pop=False,save_file=None,convergence=False,method='mean'):
|
219
|
+
def divergence_connection_matrix(config=None,title=None,sources=None, targets=None, sids=None, tids=None, no_prepend_pop=False,save_file=None,convergence=False,method='mean',include_gap=True):
|
217
220
|
"""
|
218
221
|
Generates connection plot displaying divergence data
|
219
222
|
config: A BMTK simulation config
|
@@ -240,7 +243,7 @@ def divergence_connection_matrix(config=None,title=None,sources=None, targets=No
|
|
240
243
|
else:
|
241
244
|
tids = []
|
242
245
|
|
243
|
-
syn_info, data, source_labels, target_labels = util.connection_divergence(config=config,nodes=None,edges=None,sources=sources,targets=targets,sids=sids,tids=tids,prepend_pop=not no_prepend_pop,convergence=convergence,method=method)
|
246
|
+
syn_info, data, source_labels, target_labels = util.connection_divergence(config=config,nodes=None,edges=None,sources=sources,targets=targets,sids=sids,tids=tids,prepend_pop=not no_prepend_pop,convergence=convergence,method=method,include_gap=include_gap)
|
244
247
|
|
245
248
|
|
246
249
|
#data, labels = util.connection_divergence_average(config=config,nodes=nodes,edges=edges,populations=populations)
|
@@ -265,7 +268,7 @@ def divergence_connection_matrix(config=None,title=None,sources=None, targets=No
|
|
265
268
|
return
|
266
269
|
|
267
270
|
def connection_histogram(config=None,nodes=None,edges=None,sources=[],targets=[],sids=[],tids=[],prepend_pop=True,synaptic_info='0',
|
268
|
-
source_cell = None,target_cell = None):
|
271
|
+
source_cell = None,target_cell = None,include_gap=True):
|
269
272
|
"""
|
270
273
|
Generates histogram of number of connections individual cells in a population receieve from another population
|
271
274
|
config: A BMTK simulation config
|
@@ -286,6 +289,8 @@ def connection_histogram(config=None,nodes=None,edges=None,sources=[],targets=[]
|
|
286
289
|
target_id = kwargs["target_id"]
|
287
290
|
if source_id == source_cell and target_id == target_cell:
|
288
291
|
temp = edges[(edges[source_id_type] == source_id) & (edges[target_id_type]==target_id)]
|
292
|
+
if include_gap == False:
|
293
|
+
temp = temp[temp['is_gap_junction'] != True]
|
289
294
|
node_pairs = temp.groupby('target_node_id')['source_node_id'].count()
|
290
295
|
conn_mean = statistics.mean(node_pairs.values)
|
291
296
|
conn_std = statistics.stdev(node_pairs.values)
|
@@ -684,7 +689,7 @@ def plot_network_graph(config=None,nodes=None,edges=None,title=None,sources=None
|
|
684
689
|
tids = tids.split(",")
|
685
690
|
else:
|
686
691
|
tids = []
|
687
|
-
data, source_labels, target_labels = util.connection_graph_edge_types(nodes=None,edges=None,sources=sources,targets=targets,sids=sids,tids=tids,prepend_pop=not no_prepend_pop,edge_property=edge_property)
|
692
|
+
throw_away, data, source_labels, target_labels = util.connection_graph_edge_types(config=config,nodes=None,edges=None,sources=sources,targets=targets,sids=sids,tids=tids,prepend_pop=not no_prepend_pop,edge_property=edge_property)
|
688
693
|
|
689
694
|
if title == None or title=="":
|
690
695
|
title = "Network Graph"
|
@@ -800,7 +805,7 @@ def sim_setup(config_file='simulation_config.json',network=None):
|
|
800
805
|
# Plot spike train info
|
801
806
|
plot_inspikes(config_file)
|
802
807
|
# Using bmtool, print total number of connections between cell groups
|
803
|
-
|
808
|
+
total_connection_matrix(config=config_file,sources='all',targets='all',sids='pop_name',tids='pop_name',title='All Connections found', size_scalar=2, no_prepend_pop=True, synaptic_info='0')
|
804
809
|
# Plot 3d positions of the network
|
805
810
|
plot_3d_positions(populations='all',config=config_file,group_by='pop_name',title='3D Positions',save_file=None)
|
806
811
|
|
@@ -823,7 +828,7 @@ def plot_I_clamps(fp):
|
|
823
828
|
plt.legend()
|
824
829
|
num_clamps=num_clamps+1
|
825
830
|
|
826
|
-
def plot_basic_cell_info(config_file
|
831
|
+
def plot_basic_cell_info(config_file):
|
827
832
|
print("Network and node info:")
|
828
833
|
nodes=util.load_nodes_from_config(config_file)
|
829
834
|
if not nodes:
|
@@ -857,7 +862,11 @@ def plot_basic_cell_info(config_file,notebook=0):
|
|
857
862
|
count=1
|
858
863
|
df1 = pd.DataFrame(CELLS, columns = ["node_type","pop_name","model_type","count"])
|
859
864
|
print(j+':')
|
860
|
-
|
865
|
+
notebook = is_notebook()
|
866
|
+
if notebook == True:
|
867
|
+
display(HTML(df1.to_html()))
|
868
|
+
else:
|
869
|
+
print(df1)
|
861
870
|
elif node['model_type'][0]=='biophysical':
|
862
871
|
CELLS=[]
|
863
872
|
count=1
|
@@ -871,7 +880,7 @@ def plot_basic_cell_info(config_file,notebook=0):
|
|
871
880
|
pop_name=node['pop_name'][i]
|
872
881
|
model_type=node['model_type'][i]
|
873
882
|
model_template=node['model_template'][i]
|
874
|
-
morphology=node['morphology'][i] if node
|
883
|
+
morphology=node['morphology'][i] if node['morphology'][i] else ''
|
875
884
|
CELLS.append([node_type,pop_name,model_type,model_template,morphology,count])
|
876
885
|
count=1
|
877
886
|
else:
|
@@ -879,17 +888,20 @@ def plot_basic_cell_info(config_file,notebook=0):
|
|
879
888
|
pop_name=node['pop_name'][i]
|
880
889
|
model_type=node['model_type'][i]
|
881
890
|
model_template=node['model_template'][i]
|
882
|
-
morphology=node['morphology'][i] if node
|
891
|
+
morphology=node['morphology'][i] if node['morphology'][i] else ''
|
883
892
|
CELLS.append([node_type,pop_name,model_type,model_template,morphology,count])
|
884
893
|
count=1
|
885
894
|
df2 = pd.DataFrame(CELLS, columns = ["node_type","pop_name","model_type","model_template","morphology","count"])
|
886
895
|
print(j+':')
|
887
896
|
bio.append(j)
|
888
|
-
|
897
|
+
notebook = is_notebook()
|
898
|
+
if notebook == True:
|
899
|
+
display(HTML(df2.to_html()))
|
900
|
+
else:
|
901
|
+
print(df2)
|
889
902
|
if len(bio)>0:
|
890
903
|
return bio[0]
|
891
904
|
|
892
|
-
|
893
905
|
def plot_inspikes(fp):
|
894
906
|
|
895
907
|
print("Plotting spike Train info...")
|
@@ -303,7 +303,7 @@ def rho_2_pr(p0, p1, rho):
|
|
303
303
|
|
304
304
|
class ReciprocalConnector(AbstractConnector):
|
305
305
|
"""
|
306
|
-
Object for
|
306
|
+
Object for building connections in bmtk network model with reciprocal
|
307
307
|
probability within a single population (or between two populations).
|
308
308
|
|
309
309
|
Algorithm:
|
@@ -949,7 +949,7 @@ class ReciprocalConnector(AbstractConnector):
|
|
949
949
|
|
950
950
|
class UnidirectionConnector(AbstractConnector):
|
951
951
|
"""
|
952
|
-
Object for
|
952
|
+
Object for building unidirectional connections in bmtk network model with
|
953
953
|
given probability within a single population (or between two populations).
|
954
954
|
|
955
955
|
Parameters:
|
@@ -1083,7 +1083,7 @@ class UnidirectionConnector(AbstractConnector):
|
|
1083
1083
|
|
1084
1084
|
class CorrelatedGapJunction(UnidirectionConnector):
|
1085
1085
|
"""
|
1086
|
-
Object for
|
1086
|
+
Object for building gap junction connections in bmtk network model with
|
1087
1087
|
given probabilities within a single population which could be correlated
|
1088
1088
|
with the recurrent chemical synapses in this population.
|
1089
1089
|
|
@@ -1190,7 +1190,7 @@ class CorrelatedGapJunction(UnidirectionConnector):
|
|
1190
1190
|
|
1191
1191
|
|
1192
1192
|
class OneToOneSequentialConnector(AbstractConnector):
|
1193
|
-
"""Object for
|
1193
|
+
"""Object for building one to one correspondence connections in bmtk
|
1194
1194
|
network model with between two populations. One of the population can
|
1195
1195
|
consist of multiple sub-populations. These sub-populations need to be added
|
1196
1196
|
sequentially using setup_nodes() and edge_params() methods followed by BMTK
|
@@ -592,7 +592,7 @@ def relation_matrix(config=None, nodes=None,edges=None,sources=[],targets=[],sid
|
|
592
592
|
|
593
593
|
return syn_info, e_matrix, source_pop_names, target_pop_names
|
594
594
|
|
595
|
-
def connection_totals(config=None,nodes=None,edges=None,sources=[],targets=[],sids=[],tids=[],prepend_pop=True,synaptic_info='0'):
|
595
|
+
def connection_totals(config=None,nodes=None,edges=None,sources=[],targets=[],sids=[],tids=[],prepend_pop=True,synaptic_info='0',include_gap=True):
|
596
596
|
|
597
597
|
def total_connection_relationship(**kwargs):
|
598
598
|
edges = kwargs["edges"]
|
@@ -601,12 +601,15 @@ def connection_totals(config=None,nodes=None,edges=None,sources=[],targets=[],si
|
|
601
601
|
source_id = kwargs["source_id"]
|
602
602
|
target_id = kwargs["target_id"]
|
603
603
|
|
604
|
-
total = edges[(edges[source_id_type] == source_id) & (edges[target_id_type]==target_id)]
|
604
|
+
total = edges[(edges[source_id_type] == source_id) & (edges[target_id_type]==target_id)]
|
605
|
+
if include_gap == False:
|
606
|
+
total = total[total['is_gap_junction'] != True]
|
607
|
+
total = total.count()
|
605
608
|
total = total.source_node_id # may not be the best way to pick
|
606
609
|
return total
|
607
610
|
return relation_matrix(config,nodes,edges,sources,targets,sids,tids,prepend_pop,relation_func=total_connection_relationship,synaptic_info=synaptic_info)
|
608
611
|
|
609
|
-
def percent_connections(config=None,nodes=None,edges=None,sources=[],targets=[],sids=[],tids=[],prepend_pop=True,method=None):
|
612
|
+
def percent_connections(config=None,nodes=None,edges=None,sources=[],targets=[],sids=[],tids=[],prepend_pop=True,method=None,include_gap=True):
|
610
613
|
|
611
614
|
def precent_func(**kwargs):
|
612
615
|
edges = kwargs["edges"]
|
@@ -618,6 +621,8 @@ def percent_connections(config=None,nodes=None,edges=None,sources=[],targets=[],
|
|
618
621
|
s_list = kwargs["source_nodes"]
|
619
622
|
|
620
623
|
cons = edges[(edges[source_id_type] == source_id) & (edges[target_id_type]==target_id)]
|
624
|
+
if include_gap == False:
|
625
|
+
cons = cons[cons['is_gap_junction'] != True]
|
621
626
|
total_cons = cons.count().source_node_id
|
622
627
|
# to determine reciprocal connectivity
|
623
628
|
# create a copy and flip source/dest
|
@@ -649,8 +654,7 @@ def percent_connections(config=None,nodes=None,edges=None,sources=[],targets=[],
|
|
649
654
|
|
650
655
|
return relation_matrix(config,nodes,edges,sources,targets,sids,tids,prepend_pop,relation_func=precent_func)
|
651
656
|
|
652
|
-
|
653
|
-
def connection_divergence(config=None,nodes=None,edges=None,sources=[],targets=[],sids=[],tids=[],prepend_pop=True,convergence=False,method='mean'):
|
657
|
+
def connection_divergence(config=None,nodes=None,edges=None,sources=[],targets=[],sids=[],tids=[],prepend_pop=True,convergence=False,method='mean',include_gap=True):
|
654
658
|
|
655
659
|
import pandas as pd
|
656
660
|
|
@@ -665,6 +669,8 @@ def connection_divergence(config=None,nodes=None,edges=None,sources=[],targets=[
|
|
665
669
|
count = 1
|
666
670
|
|
667
671
|
cons = edges[(edges[source_id_type] == source_id) & (edges[target_id_type]==target_id)]
|
672
|
+
if include_gap == False:
|
673
|
+
cons = cons[cons['is_gap_junction'] != True]
|
668
674
|
|
669
675
|
if convergence:
|
670
676
|
if method == 'min':
|
@@ -697,7 +703,10 @@ def connection_divergence(config=None,nodes=None,edges=None,sources=[],targets=[
|
|
697
703
|
count = vc.loc[source_id]#count = s_list[s_list[source_id_type]==source_id]
|
698
704
|
|
699
705
|
# Only executed when mean
|
700
|
-
total = edges[(edges[source_id_type] == source_id) & (edges[target_id_type]==target_id)]
|
706
|
+
total = edges[(edges[source_id_type] == source_id) & (edges[target_id_type]==target_id)]
|
707
|
+
if include_gap == False:
|
708
|
+
total = total[total['is_gap_junction'] != True]
|
709
|
+
total = total.count()
|
701
710
|
total = total.source_node_id # may not be the best way to pick
|
702
711
|
ret = round(total/count,1)
|
703
712
|
if ret == 0:
|
@@ -707,7 +716,7 @@ def connection_divergence(config=None,nodes=None,edges=None,sources=[],targets=[
|
|
707
716
|
return relation_matrix(config,nodes,edges,sources,targets,sids,tids,prepend_pop,relation_func=total_connection_relationship)
|
708
717
|
|
709
718
|
def connection_probabilities(config=None,nodes=None,edges=None,sources=[],
|
710
|
-
targets=[],sids=[],tids=[],prepend_pop=True,dist_X=True,dist_Y=True,dist_Z=True,num_bins=10):
|
719
|
+
targets=[],sids=[],tids=[],prepend_pop=True,dist_X=True,dist_Y=True,dist_Z=True,num_bins=10,include_gap=True):
|
711
720
|
|
712
721
|
import pandas as pd
|
713
722
|
from scipy.spatial import distance
|
@@ -782,7 +791,9 @@ def connection_probabilities(config=None,nodes=None,edges=None,sources=[],
|
|
782
791
|
return ret
|
783
792
|
|
784
793
|
relevant_edges = edges[(edges[source_id_type] == source_id) & (edges[target_id_type]==target_id)]
|
785
|
-
|
794
|
+
if include_gap == False:
|
795
|
+
relevant_edges = relevant_edges[relevant_edges['is_gap_junction'] != True]
|
796
|
+
connected_distances = eudist(relevant_edges,dist_X,dist_Y,dist_Z).values.tolist()
|
786
797
|
if len(connected_distances)>0:
|
787
798
|
if connected_distances[0]==0:
|
788
799
|
return -1
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|