bmtool 0.6.2__tar.gz → 0.6.3__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.
Files changed (29) hide show
  1. {bmtool-0.6.2 → bmtool-0.6.3}/PKG-INFO +16 -4
  2. {bmtool-0.6.2 → bmtool-0.6.3}/README.md +5 -2
  3. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/SLURM.py +26 -22
  4. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/synapses.py +109 -1
  5. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool.egg-info/PKG-INFO +16 -4
  6. {bmtool-0.6.2 → bmtool-0.6.3}/setup.py +3 -2
  7. {bmtool-0.6.2 → bmtool-0.6.3}/LICENSE +0 -0
  8. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/__init__.py +0 -0
  9. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/__main__.py +0 -0
  10. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/bmplot.py +0 -0
  11. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/connectors.py +0 -0
  12. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/debug/__init__.py +0 -0
  13. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/debug/commands.py +0 -0
  14. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/debug/debug.py +0 -0
  15. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/graphs.py +0 -0
  16. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/manage.py +0 -0
  17. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/plot_commands.py +0 -0
  18. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/singlecell.py +0 -0
  19. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/util/__init__.py +0 -0
  20. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/util/commands.py +0 -0
  21. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/util/neuron/__init__.py +0 -0
  22. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/util/neuron/celltuner.py +0 -0
  23. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool/util/util.py +0 -0
  24. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool.egg-info/SOURCES.txt +0 -0
  25. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool.egg-info/dependency_links.txt +0 -0
  26. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool.egg-info/entry_points.txt +0 -0
  27. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool.egg-info/requires.txt +0 -0
  28. {bmtool-0.6.2 → bmtool-0.6.3}/bmtool.egg-info/top_level.txt +0 -0
  29. {bmtool-0.6.2 → bmtool-0.6.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: bmtool
3
- Version: 0.6.2
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
  ![png](readme_figures/output_35_0.png)
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
@@ -10,6 +10,7 @@ A collection of modules to make developing [Neuron](https://www.neuron.yale.edu/
10
10
  - [Synapses](#synapses-module)
11
11
  - [Connectors](#connectors-module)
12
12
  - [Bmplot](#bmplot-module)
13
+ - [SLURM](#slurm-module)
13
14
  - [Graphs](#graphs-module)
14
15
 
15
16
  ## Getting Started
@@ -304,9 +305,10 @@ ex: [https://github.com/tjbanks/two-cell-hco](https://github.com/tjbanks/two-cel
304
305
 
305
306
  ### Synapses Module
306
307
  -[SynapticTuner](#synaptictuner)
308
+ -Gap Junction tuner
307
309
 
308
310
  #### 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)
309
-
311
+ #### 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)
310
312
 
311
313
  ### Connectors Module
312
314
  - [UnidirectionConnector](#unidirectional-connector---unidirectional-connections-in-bmtk-network-model-with-given-probability-within-a-single-population-or-between-two-populations)
@@ -425,7 +427,8 @@ bmplot.plot_network_graph(config='config.json',sources='LA',targets='LA',tids='p
425
427
 
426
428
  ![png](readme_figures/output_35_0.png)
427
429
 
428
-
430
+ ## SLURM Module
431
+ ### 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)
429
432
 
430
433
 
431
434
  ## Graphs Module
@@ -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
- for i, block in enumerate(self.blocks):
383
- if block.component_path == None:
384
- raise Exception("Unable to use parallel submitter without defining the component path")
385
- new_value = self.param_values[i]
386
-
387
- source_dir = block.component_path
388
- destination_dir = f"{source_dir}{i+1}"
389
- block.component_path = destination_dir
390
-
391
- shutil.copytree(source_dir, destination_dir) # create new components folder
392
- json_file_path = os.path.join(destination_dir,self.json_file_path)
393
- if self.syn_dict_list == None:
394
- json_editor = seedSweep(json_file_path, self.param_name)
395
- json_editor.edit_json(new_value)
396
- else:
397
- json_editor = multiSeedSweep(json_file_path,self.param_name,
398
- self.syn_dict_list,base_ratio=1)
399
- json_editor.edit_all_jsons(new_value)
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
- while not block.check_block_completed():
406
- print(f"Waiting for the last block {i} to complete...")
407
- time.sleep(self.check_interval)
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!"
@@ -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
1
+ Metadata-Version: 2.2
2
2
  Name: bmtool
3
- Version: 0.6.2
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
  ![png](readme_figures/output_35_0.png)
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
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
6
6
 
7
7
  setup(
8
8
  name="bmtool",
9
- version='0.6.2',
9
+ version='0.6.3',
10
10
  author="Neural Engineering Laboratory at the University of Missouri",
11
11
  author_email="gregglickert@mail.missouri.edu",
12
12
  description="BMTool",
@@ -41,7 +41,8 @@ setup(
41
41
  'Topic :: Software Development :: Libraries :: Python Modules',
42
42
  "Operating System :: OS Independent",
43
43
  ],
44
- packages=find_packages(exclude=['tests']),
44
+ packages=find_packages(), # Automatically finds all packages
45
+ include_package_data=True,
45
46
  entry_points={
46
47
  'console_scripts': [
47
48
  'bmtool = bmtool.manage:cli'
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