bmtool 0.6.2__py3-none-any.whl → 0.6.3__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/SLURM.py +26 -22
- bmtool/synapses.py +109 -1
- {bmtool-0.6.2.dist-info → bmtool-0.6.3.dist-info}/METADATA +16 -4
- {bmtool-0.6.2.dist-info → bmtool-0.6.3.dist-info}/RECORD +8 -8
- {bmtool-0.6.2.dist-info → bmtool-0.6.3.dist-info}/WHEEL +1 -1
- {bmtool-0.6.2.dist-info → bmtool-0.6.3.dist-info}/LICENSE +0 -0
- {bmtool-0.6.2.dist-info → bmtool-0.6.3.dist-info}/entry_points.txt +0 -0
- {bmtool-0.6.2.dist-info → bmtool-0.6.3.dist-info}/top_level.txt +0 -0
bmtool/SLURM.py
CHANGED
@@ -379,32 +379,36 @@ class BlockRunner:
|
|
379
379
|
if self.webhook:
|
380
380
|
message = "SIMULATION UPDATE: Simulations have been submited in parallel!"
|
381
381
|
send_teams_message(self.webhook,message)
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
382
|
+
if self.param_values == None:
|
383
|
+
print(f"skipping json editing for block {block.block_name}",flush=True)
|
384
|
+
else:
|
385
|
+
for i, block in enumerate(self.blocks):
|
386
|
+
if block.component_path == None:
|
387
|
+
raise Exception("Unable to use parallel submitter without defining the component path")
|
388
|
+
new_value = self.param_values[i]
|
389
|
+
|
390
|
+
source_dir = block.component_path
|
391
|
+
destination_dir = f"{source_dir}{i+1}"
|
392
|
+
block.component_path = destination_dir
|
393
|
+
|
394
|
+
shutil.copytree(source_dir, destination_dir) # create new components folder
|
395
|
+
json_file_path = os.path.join(destination_dir,self.json_file_path)
|
396
|
+
if self.syn_dict_list == None:
|
397
|
+
json_editor = seedSweep(json_file_path, self.param_name)
|
398
|
+
json_editor.edit_json(new_value)
|
399
|
+
else:
|
400
|
+
json_editor = multiSeedSweep(json_file_path,self.param_name,
|
401
|
+
self.syn_dict_list,base_ratio=1)
|
402
|
+
json_editor.edit_all_jsons(new_value)
|
400
403
|
|
401
404
|
# submit block with new component path
|
402
405
|
print(f"Submitting block: {block.block_name}", flush=True)
|
403
406
|
block.submit_block()
|
404
|
-
if i == len(self.blocks) - 1:
|
405
|
-
|
406
|
-
|
407
|
-
|
407
|
+
if i == len(self.blocks) - 1:
|
408
|
+
if self.webook:
|
409
|
+
while not block.check_block_completed():
|
410
|
+
print(f"Waiting for the last block {i} to complete...")
|
411
|
+
time.sleep(self.check_interval)
|
408
412
|
|
409
413
|
if self.webhook:
|
410
414
|
message = "SIMULATION UPDATE: Simulations are Done!"
|
bmtool/synapses.py
CHANGED
@@ -653,5 +653,113 @@ class SynapseTuner:
|
|
653
653
|
# run model with default parameters
|
654
654
|
update_ui()
|
655
655
|
|
656
|
+
class GapJunctionTuner:
|
657
|
+
def __init__(self, mechanisms_dir: str, templates_dir: str, general_settings: dict, conn_type_settings: dict):
|
658
|
+
neuron.load_mechanisms(mechanisms_dir)
|
659
|
+
h.load_file(templates_dir)
|
660
|
+
|
661
|
+
self.general_settings = general_settings
|
662
|
+
self.conn_type_settings = conn_type_settings
|
663
|
+
|
664
|
+
h.tstop = general_settings['tstart'] + general_settings['tdur'] + 100.
|
665
|
+
h.dt = general_settings['dt'] # Time step (resolution) of the simulation in ms
|
666
|
+
h.steps_per_ms = 1 / h.dt
|
667
|
+
h.celsius = general_settings['celsius']
|
668
|
+
|
669
|
+
self.cell_name = conn_type_settings['cell']
|
670
|
+
|
671
|
+
# set up gap junctions
|
672
|
+
pc = h.ParallelContext()
|
673
|
+
|
674
|
+
self.cell1 = getattr(h, self.cell_name)()
|
675
|
+
self.cell2 = getattr(h, self.cell_name)()
|
676
|
+
|
677
|
+
self.icl = h.IClamp(self.cell1.soma[0](0.5))
|
678
|
+
self.icl.delay = self.general_settings['tstart']
|
679
|
+
self.icl.dur = self.general_settings['tdur']
|
680
|
+
self.icl.amp = self.conn_type_settings['iclamp_amp'] # nA
|
681
|
+
|
682
|
+
sec1 = list(self.cell1.all)[conn_type_settings['sec_id']]
|
683
|
+
sec2 = list(self.cell2.all)[conn_type_settings['sec_id']]
|
684
|
+
|
685
|
+
pc.source_var(sec1(conn_type_settings['sec_x'])._ref_v, 0, sec=sec1)
|
686
|
+
self.gap_junc_1 = h.Gap(sec1(0.5))
|
687
|
+
pc.target_var(self.gap_junc_1 ._ref_vgap, 1)
|
688
|
+
|
689
|
+
pc.source_var(sec2(conn_type_settings['sec_x'])._ref_v, 1, sec=sec2)
|
690
|
+
self.gap_junc_2 = h.Gap(sec2(0.5))
|
691
|
+
pc.target_var(self.gap_junc_2._ref_vgap, 0)
|
656
692
|
|
657
|
-
|
693
|
+
pc.setup_transfer()
|
694
|
+
|
695
|
+
def model(self,resistance):
|
696
|
+
|
697
|
+
self.gap_junc_1.g = resistance
|
698
|
+
self.gap_junc_2.g = resistance
|
699
|
+
|
700
|
+
t_vec = h.Vector()
|
701
|
+
soma_v_1 = h.Vector()
|
702
|
+
soma_v_2 = h.Vector()
|
703
|
+
t_vec.record(h._ref_t)
|
704
|
+
soma_v_1.record(self.cell1.soma[0](0.5)._ref_v)
|
705
|
+
soma_v_2.record(self.cell2.soma[0](0.5)._ref_v)
|
706
|
+
|
707
|
+
self.t_vec = t_vec
|
708
|
+
self.soma_v_1 = soma_v_1
|
709
|
+
self.soma_v_2 = soma_v_2
|
710
|
+
|
711
|
+
h.finitialize(-70 * mV)
|
712
|
+
h.continuerun(h.tstop * ms)
|
713
|
+
|
714
|
+
|
715
|
+
def plot_model(self):
|
716
|
+
t_range = [self.general_settings['tstart'] - 100., self.general_settings['tstart']+self.general_settings['tdur'] + 100.]
|
717
|
+
t = np.array(self.t_vec)
|
718
|
+
v1 = np.array(self.soma_v_1)
|
719
|
+
v2 = np.array(self.soma_v_2)
|
720
|
+
tidx = (t >= t_range[0]) & (t <= t_range[1])
|
721
|
+
|
722
|
+
plt.figure()
|
723
|
+
plt.plot(t[tidx], v1[tidx], 'b', label=f'{self.cell_name} 1')
|
724
|
+
plt.plot(t[tidx], v2[tidx], 'r', label=f'{self.cell_name} 2')
|
725
|
+
plt.title(f"{self.cell_name} gap junction")
|
726
|
+
plt.xlabel('Time (ms)')
|
727
|
+
plt.ylabel('Membrane Voltage (mV)')
|
728
|
+
plt.legend()
|
729
|
+
plt.show()
|
730
|
+
|
731
|
+
|
732
|
+
def coupling_coefficient(self,t, v1, v2, t_start, t_end, dt=h.dt):
|
733
|
+
t = np.asarray(t)
|
734
|
+
v1 = np.asarray(v1)
|
735
|
+
v2 = np.asarray(v2)
|
736
|
+
idx1 = np.nonzero(t < t_start)[0][-1]
|
737
|
+
idx2 = np.nonzero(t < t_end)[0][-1]
|
738
|
+
return (v2[idx2] - v2[idx1]) / (v1[idx2] - v1[idx1])
|
739
|
+
|
740
|
+
|
741
|
+
def run_model(self):
|
742
|
+
w_run = widgets.Button(description='Run', icon='history', button_style='primary')
|
743
|
+
values = [i * 10**-4 for i in range(1, 101)] # From 1e-4 to 1e-2
|
744
|
+
|
745
|
+
# Create the SelectionSlider widget with appropriate formatting
|
746
|
+
resistance = widgets.SelectionSlider(
|
747
|
+
options=[("%g"%i,i) for i in values], # Use scientific notation for display
|
748
|
+
value=10**-3, # Default value
|
749
|
+
description='Resistance: ',
|
750
|
+
continuous_update=True
|
751
|
+
)
|
752
|
+
|
753
|
+
ui = VBox([w_run,resistance])
|
754
|
+
display(ui)
|
755
|
+
def on_button(*args):
|
756
|
+
clear_output()
|
757
|
+
display(ui)
|
758
|
+
resistance_for_gap = resistance.value
|
759
|
+
self.model(resistance_for_gap)
|
760
|
+
self.plot_model()
|
761
|
+
cc = self.coupling_coefficient(self.t_vec, self.soma_v_1, self.soma_v_2, 500, 1000)
|
762
|
+
print(f"coupling_coefficient is {cc:0.4f}")
|
763
|
+
|
764
|
+
on_button()
|
765
|
+
w_run.on_click(on_button)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: bmtool
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.3
|
4
4
|
Summary: BMTool
|
5
5
|
Home-page: https://github.com/cyneuro/bmtool
|
6
6
|
Download-URL:
|
@@ -31,6 +31,15 @@ Requires-Dist: pynmodlt
|
|
31
31
|
Requires-Dist: xarray
|
32
32
|
Requires-Dist: fooof
|
33
33
|
Requires-Dist: requests
|
34
|
+
Dynamic: author
|
35
|
+
Dynamic: author-email
|
36
|
+
Dynamic: classifier
|
37
|
+
Dynamic: description
|
38
|
+
Dynamic: description-content-type
|
39
|
+
Dynamic: home-page
|
40
|
+
Dynamic: license
|
41
|
+
Dynamic: requires-dist
|
42
|
+
Dynamic: summary
|
34
43
|
|
35
44
|
# bmtool
|
36
45
|
A collection of modules to make developing [Neuron](https://www.neuron.yale.edu/neuron/) and [BMTK](https://alleninstitute.github.io/bmtk/) models easier.
|
@@ -44,6 +53,7 @@ A collection of modules to make developing [Neuron](https://www.neuron.yale.edu/
|
|
44
53
|
- [Synapses](#synapses-module)
|
45
54
|
- [Connectors](#connectors-module)
|
46
55
|
- [Bmplot](#bmplot-module)
|
56
|
+
- [SLURM](#slurm-module)
|
47
57
|
- [Graphs](#graphs-module)
|
48
58
|
|
49
59
|
## Getting Started
|
@@ -338,9 +348,10 @@ ex: [https://github.com/tjbanks/two-cell-hco](https://github.com/tjbanks/two-cel
|
|
338
348
|
|
339
349
|
### Synapses Module
|
340
350
|
-[SynapticTuner](#synaptictuner)
|
351
|
+
-Gap Junction tuner
|
341
352
|
|
342
353
|
#### SynapticTuner - Aids in the tuning of synapses by printing out synaptic properties and giving the user sliders in a Jupyter notebook to tune the synapse. For more info view the example [here](examples/synapses/synaptic_tuner.ipynb)
|
343
|
-
|
354
|
+
#### GapJunctionTuner - Provides jupyter sliders to tune for coupling coefficient in a similar style to the SynapticTuner an example can be viewed [here](examples/synapses/gap_junction_tuner.ipynb)
|
344
355
|
|
345
356
|
### Connectors Module
|
346
357
|
- [UnidirectionConnector](#unidirectional-connector---unidirectional-connections-in-bmtk-network-model-with-given-probability-within-a-single-population-or-between-two-populations)
|
@@ -459,7 +470,8 @@ bmplot.plot_network_graph(config='config.json',sources='LA',targets='LA',tids='p
|
|
459
470
|
|
460
471
|

|
461
472
|
|
462
|
-
|
473
|
+
## SLURM Module
|
474
|
+
### This is an extremely helpful module that can simplify using SLURM too submit your models. There is also features to enable doing a seedSweep. This will vary the parameters of the simulation and make tuning the model easier. An example can be found [here](examples/SLURM/using_BlockRunner.ipynb)
|
463
475
|
|
464
476
|
|
465
477
|
## Graphs Module
|
@@ -1,4 +1,4 @@
|
|
1
|
-
bmtool/SLURM.py,sha256=
|
1
|
+
bmtool/SLURM.py,sha256=4KvtrPofaHv5iairetgrlXdhAdowJfg_aeTx9W59JDM,16618
|
2
2
|
bmtool/__init__.py,sha256=ZStTNkAJHJxG7Pwiy5UgCzC4KlhMS5pUNPtUJZVwL_Y,136
|
3
3
|
bmtool/__main__.py,sha256=TmFkmDxjZ6250nYD4cgGhn-tbJeEm0u-EMz2ajAN9vE,650
|
4
4
|
bmtool/bmplot.py,sha256=Im-Jrv8TK3CmTtksFzHrVogAve0l9ZwRrCW4q2MFRiA,53966
|
@@ -7,7 +7,7 @@ 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
9
|
bmtool/singlecell.py,sha256=Q4poQvG9fw0jlyMmHFzbRPrpcEkPz5MKS8Guuo73Bzs,26849
|
10
|
-
bmtool/synapses.py,sha256=
|
10
|
+
bmtool/synapses.py,sha256=xNq2ln9XRf5CZa6dZ_dabPTDrrufQTiVVoYYeqQmDN4,32597
|
11
11
|
bmtool/debug/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
12
|
bmtool/debug/commands.py,sha256=AwtcR7BUUheM0NxvU1Nu234zCdpobhJv5noX8x5K2vY,583
|
13
13
|
bmtool/debug/debug.py,sha256=xqnkzLiH3s-tS26Y5lZZL62qR2evJdi46Gud-HzxEN4,207
|
@@ -16,9 +16,9 @@ bmtool/util/commands.py,sha256=zJF-fiLk0b8LyzHDfvewUyS7iumOxVnj33IkJDzux4M,64396
|
|
16
16
|
bmtool/util/util.py,sha256=00vOAwTVIifCqouBoFoT0lBashl4fCalrk8fhg_Uq4c,56654
|
17
17
|
bmtool/util/neuron/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
18
|
bmtool/util/neuron/celltuner.py,sha256=xSRpRN6DhPFz4q5buq_W8UmsD7BbUrkzYBEbKVloYss,87194
|
19
|
-
bmtool-0.6.
|
20
|
-
bmtool-0.6.
|
21
|
-
bmtool-0.6.
|
22
|
-
bmtool-0.6.
|
23
|
-
bmtool-0.6.
|
24
|
-
bmtool-0.6.
|
19
|
+
bmtool-0.6.3.dist-info/LICENSE,sha256=qrXg2jj6kz5d0EnN11hllcQt2fcWVNumx0xNbV05nyM,1068
|
20
|
+
bmtool-0.6.3.dist-info/METADATA,sha256=tQ9eD3BcEnX6hwKmJ92Syr2OO8cR47KolGIcWud1-TM,19859
|
21
|
+
bmtool-0.6.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
22
|
+
bmtool-0.6.3.dist-info/entry_points.txt,sha256=0-BHZ6nUnh0twWw9SXNTiRmKjDnb1VO2DfG_-oprhAc,45
|
23
|
+
bmtool-0.6.3.dist-info/top_level.txt,sha256=gpd2Sj-L9tWbuJEd5E8C8S8XkNm5yUE76klUYcM-eWM,7
|
24
|
+
bmtool-0.6.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|