bmtool 0.7.6__py3-none-any.whl → 0.7.8__py3-none-any.whl
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.
Potentially problematic release.
This version of bmtool might be problematic. Click here for more details.
- bmtool/analysis/entrainment.py +113 -0
- bmtool/analysis/lfp.py +1 -1
- bmtool/bmplot/connections.py +759 -337
- bmtool/bmplot/entrainment.py +169 -49
- bmtool/bmplot/lfp.py +146 -11
- bmtool/bmplot/netcon_reports.py +1 -0
- bmtool/bmplot/spikes.py +175 -18
- bmtool/connectors.py +386 -0
- bmtool/singlecell.py +474 -31
- bmtool/synapses.py +1684 -651
- bmtool/util/util.py +40 -5
- {bmtool-0.7.6.dist-info → bmtool-0.7.8.dist-info}/METADATA +1 -1
- {bmtool-0.7.6.dist-info → bmtool-0.7.8.dist-info}/RECORD +17 -17
- {bmtool-0.7.6.dist-info → bmtool-0.7.8.dist-info}/WHEEL +0 -0
- {bmtool-0.7.6.dist-info → bmtool-0.7.8.dist-info}/entry_points.txt +0 -0
- {bmtool-0.7.6.dist-info → bmtool-0.7.8.dist-info}/licenses/LICENSE +0 -0
- {bmtool-0.7.6.dist-info → bmtool-0.7.8.dist-info}/top_level.txt +0 -0
bmtool/util/util.py
CHANGED
|
@@ -1163,9 +1163,43 @@ def percent_connections(
|
|
|
1163
1163
|
num_sources = s_list[source_id_type].value_counts().sort_index().loc[source_id]
|
|
1164
1164
|
num_targets = t_list[target_id_type].value_counts().sort_index().loc[target_id]
|
|
1165
1165
|
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1166
|
+
# Check if this is a recurrent network (same source and target population)
|
|
1167
|
+
# For recurrent networks (e.g., FSI->FSI), we need special handling because:
|
|
1168
|
+
# - Each pair can have at most 2 directed connections (bidirectional)
|
|
1169
|
+
# - We want to count unique pairs, not directed connections
|
|
1170
|
+
# - The denominator should be n*(n-1)/2, not n*n
|
|
1171
|
+
is_recurrent = source_id == target_id
|
|
1172
|
+
|
|
1173
|
+
if is_recurrent:
|
|
1174
|
+
# For recurrent networks, calculate connectivity based on unique undirected pairs
|
|
1175
|
+
# This avoids double-counting reciprocal connections and uses correct denominator
|
|
1176
|
+
pair_counts = {}
|
|
1177
|
+
for _, row in cons.iterrows():
|
|
1178
|
+
sid = row['source_node_id']
|
|
1179
|
+
tid = row['target_node_id']
|
|
1180
|
+
if sid != tid: # Exclude self-connections
|
|
1181
|
+
# Use symmetric pair key to count connections per unique pair
|
|
1182
|
+
pair_key = (min(sid, tid), max(sid, tid))
|
|
1183
|
+
if pair_key not in pair_counts:
|
|
1184
|
+
pair_counts[pair_key] = 0
|
|
1185
|
+
pair_counts[pair_key] += 1
|
|
1186
|
+
|
|
1187
|
+
# Count pairs with exactly 1 connection (unidirectional) vs 2 connections (bidirectional)
|
|
1188
|
+
num_uni = sum(1 for count in pair_counts.values() if count == 1)
|
|
1189
|
+
num_bi = sum(1 for count in pair_counts.values() if count == 2)
|
|
1190
|
+
|
|
1191
|
+
# Total possible unique pairs (excluding self-connections)
|
|
1192
|
+
total_possible = num_sources * (num_sources - 1) / 2
|
|
1193
|
+
total = round((num_uni + num_bi) / total_possible * 100, 2)
|
|
1194
|
+
uni = round(num_uni / total_possible * 100, 2)
|
|
1195
|
+
bi = round(num_bi / total_possible * 100, 2)
|
|
1196
|
+
else:
|
|
1197
|
+
# For non-recurrent networks, use the original calculation
|
|
1198
|
+
# Each connection is unique (no double-counting issues)
|
|
1199
|
+
total = round(total_cons / (num_sources * num_targets) * 100, 2)
|
|
1200
|
+
uni = round(num_uni / (num_sources * num_targets) * 100, 2)
|
|
1201
|
+
bi = round(num_bi / (num_sources * num_targets) * 100, 2)
|
|
1202
|
+
|
|
1169
1203
|
if method == "total":
|
|
1170
1204
|
return total
|
|
1171
1205
|
if method == "uni":
|
|
@@ -1309,9 +1343,10 @@ def gap_junction_connections(
|
|
|
1309
1343
|
s_list = kwargs["source_nodes"]
|
|
1310
1344
|
|
|
1311
1345
|
cons = edges[(edges[source_id_type] == source_id) & (edges[target_id_type] == target_id)]
|
|
1312
|
-
#
|
|
1346
|
+
# print(cons)
|
|
1347
|
+
|
|
1313
1348
|
try:
|
|
1314
|
-
cons = cons[cons["is_gap_junction"]]
|
|
1349
|
+
cons = cons[cons["is_gap_junction"]==True]
|
|
1315
1350
|
except:
|
|
1316
1351
|
raise Exception("no gap junctions found to drop from connections")
|
|
1317
1352
|
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
bmtool/SLURM.py,sha256=UBfITY1MtYo95nyKglgGSqAC9Ds8PBvlHczsiNMFxvc,20573
|
|
2
2
|
bmtool/__init__.py,sha256=r_8fXc-2uj1DndCdhB4jME51r1pn6ESTD5zRc355BrU,134
|
|
3
3
|
bmtool/__main__.py,sha256=uCEqPwRxIuNRUASKhsvh4S8Nkp4dqnvfXTMUv-wWWRU,665
|
|
4
|
-
bmtool/connectors.py,sha256=
|
|
4
|
+
bmtool/connectors.py,sha256=tkCh9oVsIgaV5zzBzTFTG2Y6YVAoIHv2Pm-qxZAbca8,93124
|
|
5
5
|
bmtool/graphs.py,sha256=gBTzI6c2BBK49dWGcfWh9c56TAooyn-KaiEy0Im1HcI,6717
|
|
6
6
|
bmtool/manage.py,sha256=lsgRejp02P-x6QpA7SXcyXdalPhRmypoviIA2uAitQs,608
|
|
7
7
|
bmtool/plot_commands.py,sha256=Dxm_RaT4CtHnfsltTtUopJ4KVbfhxtktEB_b7bFEXII,12716
|
|
8
|
-
bmtool/singlecell.py,sha256=
|
|
9
|
-
bmtool/synapses.py,sha256=
|
|
8
|
+
bmtool/singlecell.py,sha256=KFCh9qN3bvOk_B8WArBHlp1fBDb4m3yCZQOijkhCbpA,67120
|
|
9
|
+
bmtool/synapses.py,sha256=gMJFG-3XwCzbLX4o_xObQ3oVs1CU_5L6WgxDQupiPGI,157967
|
|
10
10
|
bmtool/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
bmtool/analysis/entrainment.py,sha256=
|
|
12
|
-
bmtool/analysis/lfp.py,sha256=
|
|
11
|
+
bmtool/analysis/entrainment.py,sha256=l_loxU3GEJX5cDjgMEj3vpYkA5G78r3DqsLXH6o6HS0,29542
|
|
12
|
+
bmtool/analysis/lfp.py,sha256=b3uajzE_hyqJGhMM7dIBYerHusJ58XLQ_hA09uwXEUY,26570
|
|
13
13
|
bmtool/analysis/netcon_reports.py,sha256=VnPZNKPaQA7oh1q9cIatsqQudm4cOtzNtbGPXoiDCD0,2909
|
|
14
14
|
bmtool/analysis/spikes.py,sha256=3n-xmyEZ7w6CKEND7-aKOAvdDg0lwDuPI5sMdOuPwa0,24637
|
|
15
15
|
bmtool/bmplot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
-
bmtool/bmplot/connections.py,sha256=
|
|
17
|
-
bmtool/bmplot/entrainment.py,sha256=
|
|
18
|
-
bmtool/bmplot/lfp.py,sha256=
|
|
19
|
-
bmtool/bmplot/netcon_reports.py,sha256=
|
|
20
|
-
bmtool/bmplot/spikes.py,sha256=
|
|
16
|
+
bmtool/bmplot/connections.py,sha256=qUtkq8Sy3SP6IwVWKx6h95d74qy_fMGtYPw7xr5bnvw,73261
|
|
17
|
+
bmtool/bmplot/entrainment.py,sha256=q6eyftK3TUaLVzukZ1gBWTt-JoQq_69K138TjBxJghU,37046
|
|
18
|
+
bmtool/bmplot/lfp.py,sha256=tHRPqAe8npwiTIQSzBHfZl_PPxqcTDZpIPdn6eHwRbI,7253
|
|
19
|
+
bmtool/bmplot/netcon_reports.py,sha256=WkqQHqTpNxgDutcSgAJDtGhzp1LXO47XOiXzTT-6Pfk,22
|
|
20
|
+
bmtool/bmplot/spikes.py,sha256=gxPfxe0o4Jzo__TK6HgIm1zJoddEL8wDU3IhxJkeA54,21707
|
|
21
21
|
bmtool/debug/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
bmtool/debug/commands.py,sha256=VV00f6q5gzZI503vUPeG40ABLLen0bw_k4-EX-H5WZE,580
|
|
23
23
|
bmtool/debug/debug.py,sha256=9yUFvA4_Bl-x9s29quIEG3pY-S8hNJF3RKBfRBHCl28,208
|
|
24
24
|
bmtool/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
25
|
bmtool/util/commands.py,sha256=Nn-R-4e9g8ZhSPZvTkr38xeKRPfEMANB9Lugppj82UI,68564
|
|
26
|
-
bmtool/util/util.py,sha256=
|
|
26
|
+
bmtool/util/util.py,sha256=oXrY-Cc4wxPvgJVg2TqaAPua_gAl1Kj1nqrLgsqsXS8,77815
|
|
27
27
|
bmtool/util/neuron/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
28
|
bmtool/util/neuron/celltuner.py,sha256=lokRLUM1rsdSYBYrNbLBBo39j14mm8TBNVNRnSlhHCk,94868
|
|
29
|
-
bmtool-0.7.
|
|
30
|
-
bmtool-0.7.
|
|
31
|
-
bmtool-0.7.
|
|
32
|
-
bmtool-0.7.
|
|
33
|
-
bmtool-0.7.
|
|
34
|
-
bmtool-0.7.
|
|
29
|
+
bmtool-0.7.8.dist-info/licenses/LICENSE,sha256=qrXg2jj6kz5d0EnN11hllcQt2fcWVNumx0xNbV05nyM,1068
|
|
30
|
+
bmtool-0.7.8.dist-info/METADATA,sha256=hkf6T0q5HcIzDBSstste4hoAzJigGRTfPuGoEDP-V84,3595
|
|
31
|
+
bmtool-0.7.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
32
|
+
bmtool-0.7.8.dist-info/entry_points.txt,sha256=0-BHZ6nUnh0twWw9SXNTiRmKjDnb1VO2DfG_-oprhAc,45
|
|
33
|
+
bmtool-0.7.8.dist-info/top_level.txt,sha256=gpd2Sj-L9tWbuJEd5E8C8S8XkNm5yUE76klUYcM-eWM,7
|
|
34
|
+
bmtool-0.7.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|