bmtool 0.6.9.1__py3-none-any.whl → 0.6.9.2__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.
- bmtool/bmplot.py +228 -36
- bmtool/singlecell.py +501 -34
- bmtool/synapses.py +270 -41
- {bmtool-0.6.9.1.dist-info → bmtool-0.6.9.2.dist-info}/METADATA +1 -1
- {bmtool-0.6.9.1.dist-info → bmtool-0.6.9.2.dist-info}/RECORD +9 -9
- {bmtool-0.6.9.1.dist-info → bmtool-0.6.9.2.dist-info}/WHEEL +0 -0
- {bmtool-0.6.9.1.dist-info → bmtool-0.6.9.2.dist-info}/entry_points.txt +0 -0
- {bmtool-0.6.9.1.dist-info → bmtool-0.6.9.2.dist-info}/licenses/LICENSE +0 -0
- {bmtool-0.6.9.1.dist-info → bmtool-0.6.9.2.dist-info}/top_level.txt +0 -0
bmtool/synapses.py
CHANGED
@@ -437,13 +437,22 @@ class SynapseTuner:
|
|
437
437
|
|
438
438
|
def _response_amplitude(self):
|
439
439
|
"""
|
440
|
-
Calculates the amplitude of
|
440
|
+
Calculates the amplitude of synaptic responses for each pulse in a train.
|
441
441
|
|
442
442
|
Returns:
|
443
443
|
--------
|
444
444
|
amp : list
|
445
|
-
A list containing the peak amplitudes for each
|
445
|
+
A list containing the peak amplitudes for each pulse in the recorded synaptic current.
|
446
446
|
|
447
|
+
Notes:
|
448
|
+
------
|
449
|
+
This method:
|
450
|
+
1. Extracts and normalizes the synaptic current
|
451
|
+
2. Identifies spike times and segments the current accordingly
|
452
|
+
3. Calculates the peak response amplitude for each segment
|
453
|
+
4. Records the indices of peak amplitudes for visualization
|
454
|
+
|
455
|
+
The amplitude values are returned in the original current units (before pA conversion).
|
447
456
|
"""
|
448
457
|
isyn = np.array(self.rec_vectors[self.current_name].to_python())
|
449
458
|
tspk = np.append(np.asarray(self.tspk), h.tstop)
|
@@ -486,25 +495,32 @@ class SynapseTuner:
|
|
486
495
|
return max_amp * 1000 # scale unit
|
487
496
|
|
488
497
|
|
489
|
-
def _calc_ppr_induction_recovery(self,amp, normalize_by_trial=True,print_math=True):
|
498
|
+
def _calc_ppr_induction_recovery(self, amp, normalize_by_trial=True, print_math=True):
|
490
499
|
"""
|
491
|
-
Calculates induction and recovery metrics from
|
500
|
+
Calculates paired-pulse ratio, induction, and recovery metrics from response amplitudes.
|
492
501
|
|
493
502
|
Parameters:
|
494
503
|
-----------
|
495
504
|
amp : array-like
|
496
|
-
Array containing the amplitudes of synaptic responses.
|
505
|
+
Array containing the amplitudes of synaptic responses to a pulse train.
|
497
506
|
normalize_by_trial : bool, optional
|
498
507
|
If True, normalize the amplitudes within each trial. Default is True.
|
508
|
+
print_math : bool, optional
|
509
|
+
If True, print detailed calculation steps and explanations. Default is True.
|
499
510
|
|
500
511
|
Returns:
|
501
512
|
--------
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
513
|
+
tuple
|
514
|
+
A tuple containing:
|
515
|
+
- ppr: Paired-pulse ratio (2nd pulse / 1st pulse)
|
516
|
+
- induction: Measure of facilitation/depression during initial pulses
|
517
|
+
- recovery: Measure of recovery after the delay period
|
518
|
+
|
519
|
+
Notes:
|
520
|
+
------
|
521
|
+
- PPR > 1 indicates facilitation, PPR < 1 indicates depression
|
522
|
+
- Induction > 0 indicates facilitation, Induction < 0 indicates depression
|
523
|
+
- Recovery compares the response after delay to the initial pulses
|
508
524
|
"""
|
509
525
|
amp = np.array(amp)
|
510
526
|
amp = (amp * 1000) # scale up
|
@@ -579,7 +595,12 @@ class SynapseTuner:
|
|
579
595
|
Delay period in milliseconds between the 8th and 9th pulses.
|
580
596
|
vclamp : bool or None, optional
|
581
597
|
Whether to use voltage clamp. If None, the current setting is used. Default is None.
|
582
|
-
|
598
|
+
|
599
|
+
Notes:
|
600
|
+
------
|
601
|
+
This method handles two different input modes:
|
602
|
+
- Standard train mode with 8 initial pulses followed by a delay and 4 additional pulses
|
603
|
+
- Continuous input mode where stimulation continues for a specified duration
|
583
604
|
"""
|
584
605
|
if self.input_mode == False:
|
585
606
|
self.tstop = self._set_drive_train(input_frequency, delay)
|
@@ -604,8 +625,24 @@ class SynapseTuner:
|
|
604
625
|
|
605
626
|
def InteractiveTuner(self):
|
606
627
|
"""
|
607
|
-
Sets up interactive sliders for short-term plasticity (STP)
|
628
|
+
Sets up interactive sliders for tuning short-term plasticity (STP) parameters in a Jupyter Notebook.
|
608
629
|
|
630
|
+
This method creates an interactive UI with sliders for:
|
631
|
+
- Input frequency
|
632
|
+
- Delay between pulse trains
|
633
|
+
- Duration of stimulation (for continuous input mode)
|
634
|
+
- Synaptic parameters (e.g., Use, tau_f, tau_d) based on the syn model
|
635
|
+
|
636
|
+
It also provides buttons for:
|
637
|
+
- Running a single event simulation
|
638
|
+
- Running a train input simulation
|
639
|
+
- Toggling voltage clamp mode
|
640
|
+
- Switching between standard and continuous input modes
|
641
|
+
|
642
|
+
Notes:
|
643
|
+
------
|
644
|
+
Ideal for exploratory parameter tuning and interactive visualization of
|
645
|
+
synapse behavior with different parameter values and stimulation protocols.
|
609
646
|
"""
|
610
647
|
# Widgets setup (Sliders)
|
611
648
|
freqs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 35, 50, 100, 200]
|
@@ -706,19 +743,35 @@ class SynapseTuner:
|
|
706
743
|
"""
|
707
744
|
Analyze synaptic response across different stimulation frequencies.
|
708
745
|
|
746
|
+
This method systematically tests how the synapse model responds to different
|
747
|
+
stimulation frequencies, calculating key short-term plasticity (STP) metrics
|
748
|
+
for each frequency.
|
749
|
+
|
709
750
|
Parameters:
|
710
751
|
-----------
|
711
752
|
freqs : list, optional
|
712
|
-
List of frequencies to analyze (in Hz)
|
753
|
+
List of frequencies to analyze (in Hz). Default covers a wide range from 1-200 Hz.
|
713
754
|
delay : float, optional
|
714
|
-
Delay between pulse trains in ms
|
755
|
+
Delay between pulse trains in ms. Default is 250 ms.
|
715
756
|
plot : bool, optional
|
716
|
-
Whether to plot the results
|
757
|
+
Whether to plot the results. Default is True.
|
758
|
+
log_plot : bool, optional
|
759
|
+
Whether to use logarithmic scale for frequency axis. Default is True.
|
717
760
|
|
718
761
|
Returns:
|
719
762
|
--------
|
720
763
|
dict
|
721
|
-
Dictionary containing frequency-dependent metrics
|
764
|
+
Dictionary containing frequency-dependent metrics with keys:
|
765
|
+
- 'frequencies': List of tested frequencies
|
766
|
+
- 'ppr': Paired-pulse ratios at each frequency
|
767
|
+
- 'induction': Induction values at each frequency
|
768
|
+
- 'recovery': Recovery values at each frequency
|
769
|
+
|
770
|
+
Notes:
|
771
|
+
------
|
772
|
+
This method is particularly useful for characterizing the frequency-dependent
|
773
|
+
behavior of synapses, such as identifying facilitating vs. depressing regimes
|
774
|
+
or the frequency at which a synapse transitions between these behaviors.
|
722
775
|
"""
|
723
776
|
results = {
|
724
777
|
'frequencies': freqs,
|
@@ -748,14 +801,30 @@ class SynapseTuner:
|
|
748
801
|
return results
|
749
802
|
|
750
803
|
|
751
|
-
def _plot_frequency_analysis(self, results,log_plot):
|
804
|
+
def _plot_frequency_analysis(self, results, log_plot):
|
752
805
|
"""
|
753
806
|
Plot the frequency-dependent synaptic properties.
|
754
807
|
|
755
808
|
Parameters:
|
756
809
|
-----------
|
757
810
|
results : dict
|
758
|
-
Dictionary containing frequency analysis results
|
811
|
+
Dictionary containing frequency analysis results with keys:
|
812
|
+
- 'frequencies': List of tested frequencies
|
813
|
+
- 'ppr': Paired-pulse ratios at each frequency
|
814
|
+
- 'induction': Induction values at each frequency
|
815
|
+
- 'recovery': Recovery values at each frequency
|
816
|
+
log_plot : bool
|
817
|
+
Whether to use logarithmic scale for frequency axis
|
818
|
+
|
819
|
+
Notes:
|
820
|
+
------
|
821
|
+
Creates a figure with three subplots showing:
|
822
|
+
1. Paired-pulse ratio vs. frequency
|
823
|
+
2. Induction vs. frequency
|
824
|
+
3. Recovery vs. frequency
|
825
|
+
|
826
|
+
Each plot includes a horizontal reference line at y=0 or y=1 to indicate
|
827
|
+
the boundary between facilitation and depression.
|
759
828
|
"""
|
760
829
|
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(15, 5))
|
761
830
|
|
@@ -798,6 +867,20 @@ class SynapseTuner:
|
|
798
867
|
|
799
868
|
class GapJunctionTuner:
|
800
869
|
def __init__(self, mechanisms_dir: str, templates_dir: str, general_settings: dict, conn_type_settings: dict):
|
870
|
+
"""
|
871
|
+
Initialize the GapJunctionTuner class.
|
872
|
+
|
873
|
+
Parameters:
|
874
|
+
-----------
|
875
|
+
mechanisms_dir : str
|
876
|
+
Directory path containing the compiled mod files needed for NEURON mechanisms.
|
877
|
+
templates_dir : str
|
878
|
+
Directory path containing cell template files (.hoc or .py) loaded into NEURON.
|
879
|
+
general_settings : dict
|
880
|
+
General settings dictionary including parameters like simulation time step, duration, and temperature.
|
881
|
+
conn_type_settings : dict
|
882
|
+
A dictionary containing connection-specific settings for gap junctions.
|
883
|
+
"""
|
801
884
|
neuron.load_mechanisms(mechanisms_dir)
|
802
885
|
h.load_file(templates_dir)
|
803
886
|
|
@@ -836,7 +919,19 @@ class GapJunctionTuner:
|
|
836
919
|
pc.setup_transfer()
|
837
920
|
|
838
921
|
def model(self,resistance):
|
839
|
-
|
922
|
+
"""
|
923
|
+
Run a simulation with a specified gap junction resistance.
|
924
|
+
|
925
|
+
Parameters:
|
926
|
+
-----------
|
927
|
+
resistance : float
|
928
|
+
The gap junction resistance value (in MOhm) to use for the simulation.
|
929
|
+
|
930
|
+
Notes:
|
931
|
+
------
|
932
|
+
This method sets up the gap junction resistance, initializes recording vectors for time
|
933
|
+
and membrane voltages of both cells, and runs the NEURON simulation.
|
934
|
+
"""
|
840
935
|
self.gap_junc_1.g = resistance
|
841
936
|
self.gap_junc_2.g = resistance
|
842
937
|
|
@@ -856,6 +951,12 @@ class GapJunctionTuner:
|
|
856
951
|
|
857
952
|
|
858
953
|
def plot_model(self):
|
954
|
+
"""
|
955
|
+
Plot the voltage traces of both cells to visualize gap junction coupling.
|
956
|
+
|
957
|
+
This method creates a plot showing the membrane potential of both cells over time,
|
958
|
+
highlighting the effect of gap junction coupling when a current step is applied to cell 1.
|
959
|
+
"""
|
859
960
|
t_range = [self.general_settings['tstart'] - 100., self.general_settings['tstart']+self.general_settings['tdur'] + 100.]
|
860
961
|
t = np.array(self.t_vec)
|
861
962
|
v1 = np.array(self.soma_v_1)
|
@@ -873,6 +974,30 @@ class GapJunctionTuner:
|
|
873
974
|
|
874
975
|
|
875
976
|
def coupling_coefficient(self,t, v1, v2, t_start, t_end, dt=h.dt):
|
977
|
+
"""
|
978
|
+
Calculate the coupling coefficient between two cells connected by a gap junction.
|
979
|
+
|
980
|
+
Parameters:
|
981
|
+
-----------
|
982
|
+
t : array-like
|
983
|
+
Time vector.
|
984
|
+
v1 : array-like
|
985
|
+
Voltage trace of the cell receiving the current injection.
|
986
|
+
v2 : array-like
|
987
|
+
Voltage trace of the coupled cell.
|
988
|
+
t_start : float
|
989
|
+
Start time for calculating the steady-state voltage change.
|
990
|
+
t_end : float
|
991
|
+
End time for calculating the steady-state voltage change.
|
992
|
+
dt : float, optional
|
993
|
+
Time step of the simulation. Default is h.dt.
|
994
|
+
|
995
|
+
Returns:
|
996
|
+
--------
|
997
|
+
float
|
998
|
+
The coupling coefficient, defined as the ratio of voltage change in cell 2
|
999
|
+
to voltage change in cell 1 (ΔV₂/ΔV₁).
|
1000
|
+
"""
|
876
1001
|
t = np.asarray(t)
|
877
1002
|
v1 = np.asarray(v1)
|
878
1003
|
v2 = np.asarray(v2)
|
@@ -934,16 +1059,59 @@ class SynapseOptimizer:
|
|
934
1059
|
self.param_scales = {}
|
935
1060
|
|
936
1061
|
def _normalize_params(self, params: np.ndarray, param_names: List[str]) -> np.ndarray:
|
937
|
-
"""
|
1062
|
+
"""
|
1063
|
+
Normalize parameters to similar scales for better optimization performance.
|
1064
|
+
|
1065
|
+
Parameters:
|
1066
|
+
-----------
|
1067
|
+
params : np.ndarray
|
1068
|
+
Original parameter values.
|
1069
|
+
param_names : List[str]
|
1070
|
+
Names of the parameters corresponding to the values.
|
1071
|
+
|
1072
|
+
Returns:
|
1073
|
+
--------
|
1074
|
+
np.ndarray
|
1075
|
+
Normalized parameter values.
|
1076
|
+
"""
|
938
1077
|
return np.array([params[i] / self.param_scales[name] for i, name in enumerate(param_names)])
|
939
1078
|
|
940
1079
|
def _denormalize_params(self, normalized_params: np.ndarray, param_names: List[str]) -> np.ndarray:
|
941
|
-
"""
|
1080
|
+
"""
|
1081
|
+
Convert normalized parameters back to original scale.
|
1082
|
+
|
1083
|
+
Parameters:
|
1084
|
+
-----------
|
1085
|
+
normalized_params : np.ndarray
|
1086
|
+
Normalized parameter values.
|
1087
|
+
param_names : List[str]
|
1088
|
+
Names of the parameters corresponding to the normalized values.
|
1089
|
+
|
1090
|
+
Returns:
|
1091
|
+
--------
|
1092
|
+
np.ndarray
|
1093
|
+
Denormalized parameter values in their original scale.
|
1094
|
+
"""
|
942
1095
|
return np.array([normalized_params[i] * self.param_scales[name] for i, name in enumerate(param_names)])
|
943
1096
|
|
944
1097
|
def _calculate_metrics(self) -> Dict[str, float]:
|
945
|
-
"""
|
1098
|
+
"""
|
1099
|
+
Calculate standard metrics from the current simulation.
|
946
1100
|
|
1101
|
+
This method runs either a single event simulation, a train input simulation,
|
1102
|
+
or both based on configuration flags, and calculates relevant synaptic metrics.
|
1103
|
+
|
1104
|
+
Returns:
|
1105
|
+
--------
|
1106
|
+
Dict[str, float]
|
1107
|
+
Dictionary of calculated metrics including:
|
1108
|
+
- induction: measure of synaptic facilitation/depression
|
1109
|
+
- ppr: paired-pulse ratio
|
1110
|
+
- recovery: recovery from facilitation/depression
|
1111
|
+
- max_amplitude: maximum synaptic response amplitude
|
1112
|
+
- rise_time: time for synaptic response to rise from 20% to 80% of peak
|
1113
|
+
- decay_time: time constant of synaptic response decay
|
1114
|
+
"""
|
947
1115
|
# Set these to 0 for when we return the dict
|
948
1116
|
induction = 0
|
949
1117
|
ppr = 0
|
@@ -973,9 +1141,23 @@ class SynapseOptimizer:
|
|
973
1141
|
}
|
974
1142
|
|
975
1143
|
def _default_cost_function(self, metrics: Dict[str, float], target_metrics: Dict[str, float]) -> float:
|
976
|
-
"""
|
977
|
-
|
1144
|
+
"""
|
1145
|
+
Default cost function that minimizes the squared difference between achieved and target induction.
|
978
1146
|
|
1147
|
+
Parameters:
|
1148
|
+
-----------
|
1149
|
+
metrics : Dict[str, float]
|
1150
|
+
Dictionary of calculated metrics from the current simulation.
|
1151
|
+
target_metrics : Dict[str, float]
|
1152
|
+
Dictionary of target metrics to optimize towards.
|
1153
|
+
|
1154
|
+
Returns:
|
1155
|
+
--------
|
1156
|
+
float
|
1157
|
+
The squared error between achieved and target induction.
|
1158
|
+
"""
|
1159
|
+
return float((metrics['induction'] - target_metrics['induction']) ** 2)
|
1160
|
+
|
979
1161
|
def _objective_function(self,
|
980
1162
|
normalized_params: np.ndarray,
|
981
1163
|
param_names: List[str],
|
@@ -1010,7 +1192,7 @@ class SynapseOptimizer:
|
|
1010
1192
|
self.optimization_history.append(history_entry)
|
1011
1193
|
|
1012
1194
|
return error
|
1013
|
-
|
1195
|
+
|
1014
1196
|
def optimize_parameters(self, target_metrics: Dict[str, float],
|
1015
1197
|
param_bounds: Dict[str, Tuple[float, float]],
|
1016
1198
|
run_single_event:bool = False, run_train_input:bool = True,
|
@@ -1018,20 +1200,25 @@ class SynapseOptimizer:
|
|
1018
1200
|
cost_function: Optional[Callable] = None,
|
1019
1201
|
method: str = 'SLSQP',init_guess='random') -> SynapseOptimizationResult:
|
1020
1202
|
"""
|
1021
|
-
Optimize synaptic parameters
|
1203
|
+
Optimize synaptic parameters to achieve target metrics.
|
1022
1204
|
|
1023
1205
|
Parameters:
|
1024
1206
|
-----------
|
1025
1207
|
target_metrics : Dict[str, float]
|
1026
|
-
Target values for synaptic metrics
|
1208
|
+
Target values for synaptic metrics (e.g., {'induction': 0.2, 'rise_time': 0.5})
|
1027
1209
|
param_bounds : Dict[str, Tuple[float, float]]
|
1028
|
-
Bounds for each parameter to optimize
|
1210
|
+
Bounds for each parameter to optimize (e.g., {'tau_d': (5, 50), 'Use': (0.1, 0.9)})
|
1211
|
+
run_single_event : bool, optional
|
1212
|
+
Whether to run single event simulations during optimization (default: False)
|
1213
|
+
run_train_input : bool, optional
|
1214
|
+
Whether to run train input simulations during optimization (default: True)
|
1029
1215
|
train_frequency : float, optional
|
1030
1216
|
Frequency of the stimulus train in Hz (default: 50)
|
1031
1217
|
train_delay : float, optional
|
1032
1218
|
Delay between pulse trains in ms (default: 250)
|
1033
1219
|
cost_function : Optional[Callable]
|
1034
|
-
Custom cost function for optimization
|
1220
|
+
Custom cost function for optimization. If None, uses default cost function
|
1221
|
+
that optimizes induction.
|
1035
1222
|
method : str, optional
|
1036
1223
|
Optimization method to use (default: 'SLSQP')
|
1037
1224
|
init_guess : str, optional
|
@@ -1040,8 +1227,14 @@ class SynapseOptimizer:
|
|
1040
1227
|
Returns:
|
1041
1228
|
--------
|
1042
1229
|
SynapseOptimizationResult
|
1043
|
-
Results of the optimization
|
1044
|
-
|
1230
|
+
Results of the optimization including optimal parameters, achieved metrics,
|
1231
|
+
target metrics, final error, and optimization path.
|
1232
|
+
|
1233
|
+
Notes:
|
1234
|
+
------
|
1235
|
+
This function uses scipy.optimize.minimize to find the optimal parameter values
|
1236
|
+
that minimize the difference between achieved and target metrics.
|
1237
|
+
"""
|
1045
1238
|
self.optimization_history = []
|
1046
1239
|
self.train_frequency = train_frequency
|
1047
1240
|
self.train_delay = train_delay
|
@@ -1100,7 +1293,24 @@ class SynapseOptimizer:
|
|
1100
1293
|
)
|
1101
1294
|
|
1102
1295
|
def plot_optimization_results(self, result: SynapseOptimizationResult):
|
1103
|
-
"""
|
1296
|
+
"""
|
1297
|
+
Plot optimization results including convergence and final traces.
|
1298
|
+
|
1299
|
+
Parameters:
|
1300
|
+
-----------
|
1301
|
+
result : SynapseOptimizationResult
|
1302
|
+
Results from optimization as returned by optimize_parameters()
|
1303
|
+
|
1304
|
+
Notes:
|
1305
|
+
------
|
1306
|
+
This method generates three plots:
|
1307
|
+
1. Error convergence plot showing how the error decreased over iterations
|
1308
|
+
2. Parameter convergence plots showing how each parameter changed
|
1309
|
+
3. Final model response with the optimal parameters
|
1310
|
+
|
1311
|
+
It also prints a summary of the optimization results including target vs. achieved
|
1312
|
+
metrics and the optimal parameter values.
|
1313
|
+
"""
|
1104
1314
|
# Ensure errors are properly shaped for plotting
|
1105
1315
|
iterations = range(len(result.optimization_path))
|
1106
1316
|
errors = np.array([float(h['error']) for h in result.optimization_path]).flatten()
|
@@ -1224,21 +1434,32 @@ class GapJunctionOptimizer:
|
|
1224
1434
|
resistance_bounds: tuple = (1e-4, 1e-2),
|
1225
1435
|
method: str = 'bounded') -> GapOptimizationResult:
|
1226
1436
|
"""
|
1227
|
-
Optimize gap junction resistance to achieve target coupling coefficient
|
1437
|
+
Optimize gap junction resistance to achieve a target coupling coefficient.
|
1228
1438
|
|
1229
1439
|
Parameters:
|
1230
1440
|
-----------
|
1231
1441
|
target_cc : float
|
1232
|
-
Target coupling coefficient to achieve
|
1442
|
+
Target coupling coefficient to achieve (between 0 and 1)
|
1233
1443
|
resistance_bounds : tuple, optional
|
1234
|
-
(min, max) bounds for resistance search
|
1444
|
+
(min, max) bounds for resistance search in MOhm. Default is (1e-4, 1e-2).
|
1235
1445
|
method : str, optional
|
1236
|
-
Optimization method to use
|
1446
|
+
Optimization method to use. Default is 'bounded' which works well
|
1447
|
+
for single-parameter optimization.
|
1237
1448
|
|
1238
1449
|
Returns:
|
1239
1450
|
--------
|
1240
1451
|
GapOptimizationResult
|
1241
|
-
Container with optimization results
|
1452
|
+
Container with optimization results including:
|
1453
|
+
- optimal_resistance: The optimized resistance value
|
1454
|
+
- achieved_cc: The coupling coefficient achieved with the optimal resistance
|
1455
|
+
- target_cc: The target coupling coefficient
|
1456
|
+
- error: The final error (squared difference between target and achieved)
|
1457
|
+
- optimization_path: List of all values tried during optimization
|
1458
|
+
|
1459
|
+
Notes:
|
1460
|
+
------
|
1461
|
+
Uses scipy.optimize.minimize_scalar with bounded method, which is
|
1462
|
+
appropriate for this single-parameter optimization problem.
|
1242
1463
|
"""
|
1243
1464
|
self.optimization_history = []
|
1244
1465
|
|
@@ -1330,16 +1551,24 @@ class GapJunctionOptimizer:
|
|
1330
1551
|
|
1331
1552
|
def parameter_sweep(self, resistance_range: np.ndarray) -> dict:
|
1332
1553
|
"""
|
1333
|
-
Perform a parameter sweep across different resistance values
|
1554
|
+
Perform a parameter sweep across different resistance values.
|
1334
1555
|
|
1335
1556
|
Parameters:
|
1336
1557
|
-----------
|
1337
1558
|
resistance_range : np.ndarray
|
1338
|
-
Array of resistance values to test
|
1559
|
+
Array of resistance values to test.
|
1339
1560
|
|
1340
1561
|
Returns:
|
1341
1562
|
--------
|
1342
|
-
dict
|
1563
|
+
dict
|
1564
|
+
Dictionary containing the results of the parameter sweep, with keys:
|
1565
|
+
- 'resistance': List of resistance values tested
|
1566
|
+
- 'coupling_coefficient': Corresponding coupling coefficients
|
1567
|
+
|
1568
|
+
Notes:
|
1569
|
+
------
|
1570
|
+
This method is useful for understanding the relationship between gap junction
|
1571
|
+
resistance and coupling coefficient before attempting optimization.
|
1343
1572
|
"""
|
1344
1573
|
results = {
|
1345
1574
|
'resistance': [],
|
@@ -1,13 +1,13 @@
|
|
1
1
|
bmtool/SLURM.py,sha256=PST_jOD5ZmwbJj15Tgq3UIvdq4FYN4EkPuDt66P8OXU,20136
|
2
2
|
bmtool/__init__.py,sha256=ZStTNkAJHJxG7Pwiy5UgCzC4KlhMS5pUNPtUJZVwL_Y,136
|
3
3
|
bmtool/__main__.py,sha256=TmFkmDxjZ6250nYD4cgGhn-tbJeEm0u-EMz2ajAN9vE,650
|
4
|
-
bmtool/bmplot.py,sha256=
|
4
|
+
bmtool/bmplot.py,sha256=bCXg20c8SVKsq8GyWg91x0ObADt1mqSxKUGtFuBudyo,61999
|
5
5
|
bmtool/connectors.py,sha256=hWkUUcJ4tmas8NDOFPPjQT-TgTlPcpjuZsYyAW2WkPA,72242
|
6
6
|
bmtool/graphs.py,sha256=K8BiughRUeXFVvAgo8UzrwpSClIVg7UfmIcvtEsEsk0,6020
|
7
7
|
bmtool/manage.py,sha256=_lCU0qBQZ4jSxjzAJUd09JEetb--cud7KZgxQFbLGSY,657
|
8
8
|
bmtool/plot_commands.py,sha256=Tqujyf0c0u8olhiHOMwgUSJXIIE1hgjv6otb25G9cA0,12298
|
9
|
-
bmtool/singlecell.py,sha256=
|
10
|
-
bmtool/synapses.py,sha256=
|
9
|
+
bmtool/singlecell.py,sha256=imcdxIzvYVkaOLSGDxYp8WGGssGwXXBCRhzhlqVp7hA,44267
|
10
|
+
bmtool/synapses.py,sha256=6h1V64b_KYHN589NFikHrt_Q3lXPvtEgIpwYFlInWb0,64551
|
11
11
|
bmtool/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
12
|
bmtool/analysis/lfp.py,sha256=KTDMzqhkpTI308sWqoJnbHeCMSFScaJCO4u50Kd4FzA,33570
|
13
13
|
bmtool/analysis/spikes.py,sha256=qqJ4zD8xfvSwltlWm_Bhicdngzl6uBqH6Kn5wOMKRc8,11507
|
@@ -19,9 +19,9 @@ bmtool/util/commands.py,sha256=zJF-fiLk0b8LyzHDfvewUyS7iumOxVnj33IkJDzux4M,64396
|
|
19
19
|
bmtool/util/util.py,sha256=00vOAwTVIifCqouBoFoT0lBashl4fCalrk8fhg_Uq4c,56654
|
20
20
|
bmtool/util/neuron/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
21
|
bmtool/util/neuron/celltuner.py,sha256=xSRpRN6DhPFz4q5buq_W8UmsD7BbUrkzYBEbKVloYss,87194
|
22
|
-
bmtool-0.6.9.
|
23
|
-
bmtool-0.6.9.
|
24
|
-
bmtool-0.6.9.
|
25
|
-
bmtool-0.6.9.
|
26
|
-
bmtool-0.6.9.
|
27
|
-
bmtool-0.6.9.
|
22
|
+
bmtool-0.6.9.2.dist-info/licenses/LICENSE,sha256=qrXg2jj6kz5d0EnN11hllcQt2fcWVNumx0xNbV05nyM,1068
|
23
|
+
bmtool-0.6.9.2.dist-info/METADATA,sha256=VNP1CATKbibkPPsmIoFv0HHG4Oyi7RfxxhbH7unnR-4,20478
|
24
|
+
bmtool-0.6.9.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
25
|
+
bmtool-0.6.9.2.dist-info/entry_points.txt,sha256=0-BHZ6nUnh0twWw9SXNTiRmKjDnb1VO2DfG_-oprhAc,45
|
26
|
+
bmtool-0.6.9.2.dist-info/top_level.txt,sha256=gpd2Sj-L9tWbuJEd5E8C8S8XkNm5yUE76klUYcM-eWM,7
|
27
|
+
bmtool-0.6.9.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|