bmtool 0.7.5.1__tar.gz → 0.7.6__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.7.5.1 → bmtool-0.7.6}/PKG-INFO +1 -1
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/bmplot/connections.py +4 -3
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/synapses.py +20 -25
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/util/util.py +29 -12
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool.egg-info/PKG-INFO +1 -1
- {bmtool-0.7.5.1 → bmtool-0.7.6}/setup.py +1 -1
- {bmtool-0.7.5.1 → bmtool-0.7.6}/LICENSE +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/README.md +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/SLURM.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/__init__.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/__main__.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/analysis/__init__.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/analysis/entrainment.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/analysis/lfp.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/analysis/netcon_reports.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/analysis/spikes.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/bmplot/__init__.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/bmplot/entrainment.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/bmplot/lfp.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/bmplot/netcon_reports.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/bmplot/spikes.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/connectors.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/debug/__init__.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/debug/commands.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/debug/debug.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/graphs.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/manage.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/plot_commands.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/singlecell.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/util/__init__.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/util/commands.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/util/neuron/__init__.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool/util/neuron/celltuner.py +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool.egg-info/SOURCES.txt +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool.egg-info/dependency_links.txt +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool.egg-info/entry_points.txt +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool.egg-info/requires.txt +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/bmtool.egg-info/top_level.txt +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/pyproject.toml +0 -0
- {bmtool-0.7.5.1 → bmtool-0.7.6}/setup.cfg +0 -0
@@ -661,7 +661,8 @@ def connection_histogram(
|
|
661
661
|
(edges[source_id_type] == source_id) & (edges[target_id_type] == target_id)
|
662
662
|
]
|
663
663
|
if not include_gap:
|
664
|
-
|
664
|
+
gap_col = temp["is_gap_junction"].fillna(False).astype(bool)
|
665
|
+
temp = temp[~gap_col]
|
665
666
|
node_pairs = temp.groupby("target_node_id")["source_node_id"].count()
|
666
667
|
try:
|
667
668
|
conn_mean = statistics.mean(node_pairs.values)
|
@@ -1022,8 +1023,8 @@ def plot_synapse_location(config: str, source: str, target: str, sids: str, tids
|
|
1022
1023
|
)
|
1023
1024
|
|
1024
1025
|
# Fix the validation logic - it was using 'or' instead of 'and'
|
1025
|
-
if syn_feature not in ["afferent_section_id", "afferent_section_pos"]:
|
1026
|
-
|
1026
|
+
#if syn_feature not in ["afferent_section_id", "afferent_section_pos"]:
|
1027
|
+
# raise ValueError("Currently only syn features supported are afferent_section_id or afferent_section_pos")
|
1027
1028
|
|
1028
1029
|
try:
|
1029
1030
|
# Load mechanisms and template
|
@@ -1175,7 +1175,9 @@ class SynapseTuner:
|
|
1175
1175
|
amp = np.array(amp)
|
1176
1176
|
amp = amp * 1000 # scale up
|
1177
1177
|
amp = amp.reshape(-1, amp.shape[-1])
|
1178
|
-
|
1178
|
+
|
1179
|
+
# Calculate 90th percentile amplitude for normalization
|
1180
|
+
percentile_90 = np.percentile(amp, 90)
|
1179
1181
|
|
1180
1182
|
def format_array(arr):
|
1181
1183
|
"""Format an array to 2 significant figures for cleaner output."""
|
@@ -1187,49 +1189,42 @@ class SynapseTuner:
|
|
1187
1189
|
f"Short Term Plasticity Results for {self.train_freq}Hz with {self.train_delay} Delay"
|
1188
1190
|
)
|
1189
1191
|
print("=" * 40)
|
1190
|
-
print("PPR: Above
|
1192
|
+
print("PPR: Above 0 is facilitating, below 0 is depressing.")
|
1191
1193
|
print("Induction: Above 0 is facilitating, below 0 is depressing.")
|
1192
1194
|
print("Recovery: A measure of how fast STP decays.\n")
|
1193
1195
|
|
1194
|
-
# PPR Calculation
|
1195
|
-
ppr = amp[:, 1:2]
|
1196
|
+
# PPR Calculation: (Avg 2nd pulse - Avg 1st pulse) / 90th percentile amplitude
|
1197
|
+
ppr = (np.mean(amp[:, 1:2]) - np.mean(amp[:, 0:1])) / percentile_90
|
1196
1198
|
print("Paired Pulse Response (PPR)")
|
1197
|
-
print("Calculation: 2nd pulse
|
1199
|
+
print("Calculation: (Avg 2nd pulse - Avg 1st pulse) / 90th percentile amplitude")
|
1198
1200
|
print(
|
1199
|
-
f"Values: ({
|
1201
|
+
f"Values: ({np.mean(amp[:, 1:2]):.3f} - {np.mean(amp[:, 0:1]):.3f}) / {percentile_90:.3f} = {ppr:.3f}\n"
|
1200
1202
|
)
|
1201
1203
|
|
1202
|
-
# Induction Calculation
|
1203
|
-
induction = np.mean(
|
1204
|
+
# Induction Calculation: (Avg (6th, 7th, 8th pulses) - Avg 1st pulse) / 90th percentile amplitude
|
1205
|
+
induction = (np.mean(amp[:, 5:8]) - np.mean(amp[:, :1])) / percentile_90
|
1204
1206
|
print("Induction")
|
1205
|
-
print("Calculation: (
|
1206
|
-
print(
|
1207
|
-
f"Values: avg({format_array(amp[:, 5:8])}) - {format_array(amp[:, :1])} / {format_array(maxamp)}"
|
1208
|
-
)
|
1207
|
+
print("Calculation: (Avg(6th, 7th, 8th pulses) - Avg 1st pulse) / 90th percentile amplitude")
|
1209
1208
|
print(
|
1210
|
-
f"
|
1209
|
+
f"Values: {np.mean(amp[:, 5:8]):.3f} - {np.mean(amp[:, :1]):.3f} / {percentile_90:.3f} = {induction:.3f}\n"
|
1211
1210
|
)
|
1212
1211
|
|
1213
|
-
# Recovery Calculation
|
1214
|
-
recovery = np.mean(
|
1212
|
+
# Recovery Calculation: (Avg (9th, 10th, 11th, 12th pulses) - Avg (1st, 2nd, 3rd, 4th pulses)) / 90th percentile amplitude
|
1213
|
+
recovery = (np.mean(amp[:, 8:12]) - np.mean(amp[:, :4])) / percentile_90
|
1215
1214
|
print("Recovery")
|
1216
1215
|
print(
|
1217
|
-
"Calculation: (
|
1218
|
-
)
|
1219
|
-
print(
|
1220
|
-
f"Values: avg({format_array(amp[:, 8:12])}) - avg({format_array(amp[:, :4])}) / {format_array(maxamp)}"
|
1216
|
+
"Calculation: (Avg(9th, 10th, 11th, 12th pulses) - Avg(1st to 4th pulses)) / 90th percentile amplitude"
|
1221
1217
|
)
|
1222
1218
|
print(
|
1223
|
-
f"
|
1219
|
+
f"Values: {np.mean(amp[:, 8:12]):.3f} - {np.mean(amp[:, :4]):.3f} / {percentile_90:.3f} = {recovery:.3f}\n"
|
1224
1220
|
)
|
1225
1221
|
|
1226
1222
|
print("=" * 40 + "\n")
|
1227
1223
|
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
maxamp = maxamp.max()
|
1224
|
+
# Calculate final metrics
|
1225
|
+
ppr = (np.mean(amp[:, 1:2]) - np.mean(amp[:, 0:1])) / percentile_90
|
1226
|
+
induction = (np.mean(amp[:, 5:8]) - np.mean(amp[:, :1])) / percentile_90
|
1227
|
+
recovery = (np.mean(amp[:, 8:12]) - np.mean(amp[:, :4])) / percentile_90
|
1233
1228
|
|
1234
1229
|
return ppr, induction, recovery
|
1235
1230
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import argparse
|
2
|
+
from logging import raiseExceptions
|
2
3
|
import math
|
3
4
|
import os
|
4
5
|
import smtplib
|
@@ -1081,7 +1082,9 @@ def connection_totals(
|
|
1081
1082
|
total = edges[(edges[source_id_type] == source_id) & (edges[target_id_type] == target_id)]
|
1082
1083
|
if not include_gap:
|
1083
1084
|
try:
|
1084
|
-
|
1085
|
+
# Handle mixed types and NaN values in is_gap_junction column
|
1086
|
+
gap_col = total["is_gap_junction"].fillna(False).astype(bool)
|
1087
|
+
total = total[~gap_col]
|
1085
1088
|
except:
|
1086
1089
|
# If there are no gap junctions, just continue
|
1087
1090
|
pass
|
@@ -1129,7 +1132,8 @@ def percent_connections(
|
|
1129
1132
|
cons = edges[(edges[source_id_type] == source_id) & (edges[target_id_type] == target_id)]
|
1130
1133
|
if not include_gap:
|
1131
1134
|
try:
|
1132
|
-
|
1135
|
+
# Handle mixed types and NaN values in is_gap_junction column
|
1136
|
+
gaps = cons["is_gap_junction"].fillna(False).astype(bool)
|
1133
1137
|
cons = cons[~gaps]
|
1134
1138
|
except:
|
1135
1139
|
raise Exception("no gap junctions found to drop from connections")
|
@@ -1200,9 +1204,17 @@ def connection_divergence(
|
|
1200
1204
|
cons = edges[(edges[source_id_type] == source_id) & (edges[target_id_type] == target_id)]
|
1201
1205
|
if not include_gap:
|
1202
1206
|
try:
|
1203
|
-
|
1207
|
+
# Handle mixed types and NaN values in is_gap_junction column
|
1208
|
+
gap_col = cons["is_gap_junction"].fillna(False).astype(bool)
|
1209
|
+
cons = cons[~gap_col]
|
1204
1210
|
except:
|
1205
|
-
raise Exception("
|
1211
|
+
raise Exception("error")
|
1212
|
+
|
1213
|
+
if cons.empty:
|
1214
|
+
if method == "mean+std":
|
1215
|
+
return (0, 0)
|
1216
|
+
else:
|
1217
|
+
return 0
|
1206
1218
|
|
1207
1219
|
if convergence:
|
1208
1220
|
if method == "min":
|
@@ -1213,15 +1225,16 @@ def connection_divergence(
|
|
1213
1225
|
return round(count, 2)
|
1214
1226
|
elif method == "std":
|
1215
1227
|
std = cons["target_node_id"].value_counts().std()
|
1216
|
-
return round(std, 2)
|
1228
|
+
return round(std, 2) if not np.isnan(std) else 0
|
1217
1229
|
elif method == "mean":
|
1218
1230
|
mean = cons["target_node_id"].value_counts().mean()
|
1219
|
-
return round(mean, 2)
|
1231
|
+
return round(mean, 2) if not np.isnan(mean) else 0
|
1220
1232
|
elif method == "mean+std": # default is mean + std
|
1221
1233
|
mean = cons["target_node_id"].value_counts().mean()
|
1222
1234
|
std = cons["target_node_id"].value_counts().std()
|
1223
|
-
|
1224
|
-
|
1235
|
+
mean = round(mean, 2) if not np.isnan(mean) else 0
|
1236
|
+
std = round(std, 2) if not np.isnan(std) else 0
|
1237
|
+
return (mean, std)
|
1225
1238
|
else: # divergence
|
1226
1239
|
if method == "min":
|
1227
1240
|
count = cons["source_node_id"].value_counts().min()
|
@@ -1231,14 +1244,16 @@ def connection_divergence(
|
|
1231
1244
|
return round(count, 2)
|
1232
1245
|
elif method == "std":
|
1233
1246
|
std = cons["source_node_id"].value_counts().std()
|
1234
|
-
return round(std, 2)
|
1247
|
+
return round(std, 2) if not np.isnan(std) else 0
|
1235
1248
|
elif method == "mean":
|
1236
1249
|
mean = cons["source_node_id"].value_counts().mean()
|
1237
|
-
return round(mean, 2)
|
1250
|
+
return round(mean, 2) if not np.isnan(mean) else 0
|
1238
1251
|
elif method == "mean+std": # default is mean + std
|
1239
1252
|
mean = cons["source_node_id"].value_counts().mean()
|
1240
1253
|
std = cons["source_node_id"].value_counts().std()
|
1241
|
-
|
1254
|
+
mean = round(mean, 2) if not np.isnan(mean) else 0
|
1255
|
+
std = round(std, 2) if not np.isnan(std) else 0
|
1256
|
+
return (mean, std)
|
1242
1257
|
|
1243
1258
|
return relation_matrix(
|
1244
1259
|
config,
|
@@ -1442,7 +1457,9 @@ def connection_probabilities(
|
|
1442
1457
|
]
|
1443
1458
|
if not include_gap:
|
1444
1459
|
try:
|
1445
|
-
|
1460
|
+
# Handle mixed types and NaN values in is_gap_junction column
|
1461
|
+
gap_col = relevant_edges["is_gap_junction"].fillna(False).astype(bool)
|
1462
|
+
relevant_edges = relevant_edges[~gap_col]
|
1446
1463
|
except:
|
1447
1464
|
raise Exception("no gap junctions found to drop from connections")
|
1448
1465
|
connected_distances = eudist(relevant_edges, dist_X, dist_Y, dist_Z).values.tolist()
|
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
|
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
|