bmtool 0.5.1__tar.gz → 0.5.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 (27) hide show
  1. {bmtool-0.5.1 → bmtool-0.5.3}/PKG-INFO +420 -23
  2. {bmtool-0.5.1 → bmtool-0.5.3}/README.md +416 -20
  3. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/bmplot.py +84 -9
  4. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/connectors.py +216 -59
  5. bmtool-0.5.3/bmtool/graphs.py +170 -0
  6. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/singlecell.py +4 -4
  7. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/util/util.py +110 -43
  8. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool.egg-info/PKG-INFO +420 -23
  9. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool.egg-info/SOURCES.txt +1 -0
  10. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool.egg-info/requires.txt +1 -0
  11. {bmtool-0.5.1 → bmtool-0.5.3}/setup.py +5 -4
  12. {bmtool-0.5.1 → bmtool-0.5.3}/LICENSE +0 -0
  13. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/__init__.py +0 -0
  14. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/__main__.py +0 -0
  15. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/debug/__init__.py +0 -0
  16. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/debug/commands.py +0 -0
  17. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/debug/debug.py +0 -0
  18. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/manage.py +0 -0
  19. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/plot_commands.py +0 -0
  20. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/util/__init__.py +0 -0
  21. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/util/commands.py +0 -0
  22. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/util/neuron/__init__.py +0 -0
  23. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool/util/neuron/celltuner.py +0 -0
  24. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool.egg-info/dependency_links.txt +0 -0
  25. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool.egg-info/entry_points.txt +0 -0
  26. {bmtool-0.5.1 → bmtool-0.5.3}/bmtool.egg-info/top_level.txt +0 -0
  27. {bmtool-0.5.1 → bmtool-0.5.3}/setup.cfg +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bmtool
3
- Version: 0.5.1
3
+ Version: 0.5.3
4
4
  Summary: BMTool
5
5
  Home-page: https://github.com/cyneuro/bmtool
6
6
  Download-URL:
7
- Author: Tyler Banks
8
- Author-email: tbanks@mail.missouri.edu
7
+ Author: Neural Engineering Laboratory at the University of Missouri
8
+ Author-email: gregglickert@mail.missouri.edu
9
9
  License: MIT
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Intended Audience :: Education
@@ -28,6 +28,7 @@ Requires-Dist: numpy
28
28
  Requires-Dist: pandas
29
29
  Requires-Dist: questionary
30
30
  Requires-Dist: pynmodlt
31
+ Requires-Dist: plotly
31
32
 
32
33
  # bmtool
33
34
  A collection of modules to make developing [Neuron](https://www.neuron.yale.edu/neuron/) and [BMTK](https://alleninstitute.github.io/bmtk/) models easier.
@@ -40,6 +41,7 @@ A collection of modules to make developing [Neuron](https://www.neuron.yale.edu/
40
41
  - [Single Cell](#Single-Cell-Module)
41
42
  - [Connectors](#Connectors-Module)
42
43
  - [Bmplot](#bmplot-Module)
44
+ - [Graphs](#graphs-module)
43
45
 
44
46
  ## Getting Started
45
47
 
@@ -230,8 +232,8 @@ X, Y = run_and_plot(sim)
230
232
  plt.show()
231
233
  ```
232
234
 
233
- Injection location: Cell_Cf[23].soma[0](0.5)
234
- Recording: Cell_Cf[23].soma[0](0.5)._ref_v
235
+ Injection location: Cell_Cf[22].soma[0](0.5)
236
+ Recording: Cell_Cf[22].soma[0](0.5)._ref_v
235
237
  ZAP current simulation running...
236
238
 
237
239
  Chirp current injection with frequency changing from 0 to 15 Hz over 15 seconds
@@ -350,21 +352,21 @@ background = NetworkBuilder('background')
350
352
  background.add_nodes(N=300,pop_name='tON',potential='exc',model_type='virtual')
351
353
  ```
352
354
 
353
- #### Unidirectional connector - unidirectional connections in bmtk network model with given probability within a single population (or between two populations)
355
+ #### Unidirectional connector - Object for building unidirectional connections in bmtk network model with given probability within a single population (or between two populations).
354
356
  ```python
355
357
  from bmtool.connectors import UnidirectionConnector
356
358
  connector = UnidirectionConnector(p=0.15, n_syn=1)
357
359
  connector.setup_nodes(source=net.nodes(pop_name = 'PopA'), target=net.nodes(pop_name = 'PopB'))
358
360
  net.add_edges(**connector.edge_params())
359
361
  ```
360
- #### Recipical connector - buiilding connections in bmtk network model with reciprocal probability within a single population (or between two populations
362
+ #### Recipical connector - Object for building connections in bmtk network model with reciprocal probability within a single population (or between two populations)
361
363
  ```python
362
364
  from bmtool.connectors import ReciprocalConnector
363
365
  connector = ReciprocalConnector(p0=0.15, pr=0.06767705087, n_syn0=1, n_syn1=1,estimate_rho=False)
364
366
  connector.setup_nodes(source=net.nodes(pop_name = 'PopA'), target=net.nodes(pop_name = 'PopA'))
365
367
  net.add_edges(**connector.edge_params())
366
368
  ```
367
- #### CorrelatedGapJunction
369
+ #### CorrelatedGapJunction - Object for building gap junction connections in bmtk network model with given probabilities within a single population which could be correlated with the recurrent chemical synapses in this population.
368
370
  ```python
369
371
  from bmtool.connectors import ReciprocalConnector, CorrelatedGapJunction
370
372
  connector = ReciprocalConnector(p0=0.15, pr=0.06, n_syn0=1, n_syn1=1, estimate_rho=False)
@@ -376,7 +378,7 @@ conn = net.add_edges(is_gap_junction=True, syn_weight=0.0000495, target_sections
376
378
  **gap_junc.edge_params())
377
379
  ```
378
380
 
379
- #### OneToOneSequentialConnector
381
+ #### OneToOneSequentialConnector - Object for building one to one correspondence connections in bmtk network model with between two populations. One of the population can consist of multiple sub-populations.
380
382
  ```python
381
383
  from bmtool.connectors import OneToOneSequentialConnector
382
384
  connector = OneToOneSequentialConnector()
@@ -391,10 +393,12 @@ net.add_edges(**connector.edge_params())
391
393
  - [Percent connections](#Percent-connection-plot)
392
394
  - [Convergence connnections](#convergence-plot)
393
395
  - [Divergence connections](#divergence-plot)
396
+ - [Gap Junction connections](#gap-junction-plot)
394
397
  - [connection histogram](#connection-histogram)
395
398
  - [probability connection](#probability-of-connection-plot)
396
399
  - [3D location](#3d-position-plot)
397
400
  - [3D rotation](#cell-rotations)
401
+ - [Plot Connection Diagram](#plot-connection-diagram)
398
402
 
399
403
  ### Total connection plot
400
404
  #### Generates a table of total number of connections each neuron population recieves
@@ -402,7 +406,7 @@ net.add_edges(**connector.edge_params())
402
406
 
403
407
  ```python
404
408
  from bmtool import bmplot
405
- bmplot.total_connection_matrix(config='config.json',sources='LA',targets='LA',tids='pop_name',sids='pop_name',no_prepend_pop=True)
409
+ bmplot.total_connection_matrix(config='config.json',sources='LA',targets='LA',tids='pop_name',sids='pop_name',no_prepend_pop=True,include_gap=False)
406
410
  ```
407
411
 
408
412
 
@@ -412,11 +416,11 @@ bmplot.total_connection_matrix(config='config.json',sources='LA',targets='LA',ti
412
416
 
413
417
 
414
418
  ### Percent connection plot
415
- #### Generates a table of the percent connectivity of neuron populations.Method can change if you want the table to be total percent connectivity or only unidirectional connectivity or only bi directional connectvity
419
+ #### Generates a table of the percent connectivity of neuron populations.Method can change if you want the table to be total percent connectivity, only unidirectional connectivity or only bi directional connectvity
416
420
 
417
421
 
418
422
  ```python
419
- bmplot.percent_connection_matrix(config='config.json',sources='LA',targets='LA',tids='pop_name',sids='pop_name',no_prepend_pop=True,method='total')
423
+ bmplot.percent_connection_matrix(config='config.json',sources='LA',targets='LA',tids='pop_name',sids='pop_name',no_prepend_pop=True,method='total',include_gap=False)
420
424
  ```
421
425
 
422
426
 
@@ -426,11 +430,11 @@ bmplot.percent_connection_matrix(config='config.json',sources='LA',targets='LA',
426
430
 
427
431
 
428
432
  ### Convergence plot
429
- #### Generates a table of the mean convergence of neuron populations. Method can be changed to show max,and min convergence a cell recieves and also changed to show standard deviation of convergence
433
+ #### Generates a table of the mean convergence of neuron populations. Method can be changed to show max, min, mean, or std for convergence a cell recieves
430
434
 
431
435
 
432
436
  ```python
433
- bmplot.convergence_connection_matrix(config='config.json',sources='LA',targets='LA',tids='pop_name',sids='pop_name',no_prepend_pop=True)
437
+ bmplot.convergence_connection_matrix(config='config.json',sources='LA',targets='LA',tids='pop_name',sids='pop_name',no_prepend_pop=True,include_gap=False,method='mean+std')
434
438
  ```
435
439
 
436
440
 
@@ -440,17 +444,28 @@ bmplot.convergence_connection_matrix(config='config.json',sources='LA',targets='
440
444
 
441
445
 
442
446
  ### Divergence plot
443
- #### Generates a table of the mean divergence of neuron populations. Method can be changed to show max,and min divergence a cell recieves and also changed to show standard deviation of divergence
447
+ #### Generates a table of the mean divergence of neuron populations. Method can be changed to show max, min, mean or std divergence a cell recieves.
444
448
 
445
449
 
446
450
  ```python
447
- bmplot.divergence_connection_matrix(config='config.json',sources='LA',targets='LA',tids='pop_name',sids='pop_name')
451
+ bmplot.divergence_connection_matrix(config='config.json',sources='LA',targets='LA',tids='pop_name',sids='pop_name',no_prepend_pop=True,include_gap=False,method='mean+std')
448
452
  ```
449
453
 
450
454
 
451
455
 
452
- ![png]readme_figures/(output_25_0.png)
456
+ ![png](readme_figures/output_25_0.png)
453
457
 
458
+ ### Gap Junction plot
459
+ #### While gap junctions can be include in the above plots, you can use this function to only view gap junctions.Type can be either 'convergence' or 'percent' connections to generate different plots
460
+
461
+
462
+ ```python
463
+ bmplot.gap_junction_matrix(config='config.json',sources='LA',targets='LA',sids='pop_name',tids='pop_name',no_prepend_pop=True,type='percent')
464
+ ```
465
+
466
+
467
+
468
+ ![png](output_gap.png)
454
469
 
455
470
 
456
471
  ### Connection histogram
@@ -458,7 +473,7 @@ bmplot.divergence_connection_matrix(config='config.json',sources='LA',targets='L
458
473
 
459
474
 
460
475
  ```python
461
- bmplot.connection_histogram(config='config.json',sources='LA',targets='LA',tids='pop_name',sids='pop_name',source_cell='PNa',target_cell='PV')
476
+ bmplot.connection_histogram(config='config.json',sources='LA',targets='LA',tids='pop_name',sids='pop_name',source_cell='PV',target_cell='PV',include_gap=False)
462
477
  ```
463
478
 
464
479
 
@@ -476,17 +491,14 @@ bmplot.probability_connection_matrix(config='config.json',sources='LA',targets='
476
491
  ```
477
492
 
478
493
 
479
-
480
-
481
-
482
494
 
483
- ![png](readme_figures/output_29_1.png)
495
+ ![png](readme_figures/output_29_0.png)
484
496
 
485
497
 
486
498
 
487
499
 
488
500
 
489
- ![png](readme_figures/output_29_2.png)
501
+ ![png](readme_figures/output_29_1.png)
490
502
 
491
503
 
492
504
 
@@ -517,3 +529,388 @@ bmplot.cell_rotation_3d(config='config2.json',populations_list='all',group_by='p
517
529
  ![png](readme_figures/output_33_0.png)
518
530
 
519
531
 
532
+
533
+ ### Plot Connection Diagram
534
+
535
+
536
+ ```python
537
+ bmplot.plot_network_graph(config='config.json',sources='LA',targets='LA',tids='pop_name',sids='pop_name',no_prepend_pop=True)
538
+ ```
539
+
540
+
541
+
542
+ ![png](readme_figures/output_35_0.png)
543
+
544
+
545
+
546
+
547
+
548
+
549
+ ```python
550
+ from bmtool import bmplot
551
+ bmplot.plot_basic_cell_info(config_file='config.json')
552
+ ```
553
+
554
+ Network and node info:
555
+ LA:
556
+
557
+
558
+
559
+ <table border="1" class="dataframe">
560
+ <thead>
561
+ <tr style="text-align: right;">
562
+ <th></th>
563
+ <th>node_type</th>
564
+ <th>pop_name</th>
565
+ <th>model_type</th>
566
+ <th>model_template</th>
567
+ <th>morphology</th>
568
+ <th>count</th>
569
+ </tr>
570
+ </thead>
571
+ <tbody>
572
+ <tr>
573
+ <th>0</th>
574
+ <td>100</td>
575
+ <td>PNa</td>
576
+ <td>biophysical</td>
577
+ <td>hoc:Cell_Af</td>
578
+ <td>blank.swc</td>
579
+ <td>800</td>
580
+ </tr>
581
+ <tr>
582
+ <th>1</th>
583
+ <td>101</td>
584
+ <td>PNc</td>
585
+ <td>biophysical</td>
586
+ <td>hoc:Cell_Cf</td>
587
+ <td>blank.swc</td>
588
+ <td>800</td>
589
+ </tr>
590
+ <tr>
591
+ <th>2</th>
592
+ <td>102</td>
593
+ <td>PV</td>
594
+ <td>biophysical</td>
595
+ <td>hoc:InterneuronCellf</td>
596
+ <td>blank.swc</td>
597
+ <td>240</td>
598
+ </tr>
599
+ <tr>
600
+ <th>3</th>
601
+ <td>103</td>
602
+ <td>SOM</td>
603
+ <td>biophysical</td>
604
+ <td>hoc:LTS_Cell</td>
605
+ <td>blank.swc</td>
606
+ <td>160</td>
607
+ </tr>
608
+ </tbody>
609
+ </table>
610
+
611
+
612
+ thalamus_pyr:
613
+
614
+
615
+
616
+ <table border="1" class="dataframe">
617
+ <thead>
618
+ <tr style="text-align: right;">
619
+ <th></th>
620
+ <th>node_type</th>
621
+ <th>pop_name</th>
622
+ <th>model_type</th>
623
+ <th>count</th>
624
+ </tr>
625
+ </thead>
626
+ <tbody>
627
+ <tr>
628
+ <th>0</th>
629
+ <td>100</td>
630
+ <td>pyr_inp</td>
631
+ <td>virtual</td>
632
+ <td>1600</td>
633
+ </tr>
634
+ </tbody>
635
+ </table>
636
+
637
+
638
+ thalamus_pv:
639
+
640
+
641
+
642
+ <table border="1" class="dataframe">
643
+ <thead>
644
+ <tr style="text-align: right;">
645
+ <th></th>
646
+ <th>node_type</th>
647
+ <th>pop_name</th>
648
+ <th>model_type</th>
649
+ <th>count</th>
650
+ </tr>
651
+ </thead>
652
+ <tbody>
653
+ <tr>
654
+ <th>0</th>
655
+ <td>100</td>
656
+ <td>pv_inp</td>
657
+ <td>virtual</td>
658
+ <td>240</td>
659
+ </tr>
660
+ </tbody>
661
+ </table>
662
+
663
+
664
+ thalamus_som:
665
+
666
+
667
+
668
+ <table border="1" class="dataframe">
669
+ <thead>
670
+ <tr style="text-align: right;">
671
+ <th></th>
672
+ <th>node_type</th>
673
+ <th>pop_name</th>
674
+ <th>model_type</th>
675
+ <th>count</th>
676
+ </tr>
677
+ </thead>
678
+ <tbody>
679
+ <tr>
680
+ <th>0</th>
681
+ <td>100</td>
682
+ <td>som_inp</td>
683
+ <td>virtual</td>
684
+ <td>160</td>
685
+ </tr>
686
+ </tbody>
687
+ </table>
688
+
689
+
690
+ tone:
691
+
692
+
693
+
694
+ <table border="1" class="dataframe">
695
+ <thead>
696
+ <tr style="text-align: right;">
697
+ <th></th>
698
+ <th>node_type</th>
699
+ <th>pop_name</th>
700
+ <th>model_type</th>
701
+ <th>count</th>
702
+ </tr>
703
+ </thead>
704
+ <tbody>
705
+ <tr>
706
+ <th>0</th>
707
+ <td>100</td>
708
+ <td>tone</td>
709
+ <td>virtual</td>
710
+ <td>1840</td>
711
+ </tr>
712
+ </tbody>
713
+ </table>
714
+
715
+
716
+ shock:
717
+
718
+
719
+
720
+ <table border="1" class="dataframe">
721
+ <thead>
722
+ <tr style="text-align: right;">
723
+ <th></th>
724
+ <th>node_type</th>
725
+ <th>pop_name</th>
726
+ <th>model_type</th>
727
+ <th>count</th>
728
+ </tr>
729
+ </thead>
730
+ <tbody>
731
+ <tr>
732
+ <th>0</th>
733
+ <td>100</td>
734
+ <td>shock</td>
735
+ <td>virtual</td>
736
+ <td>400</td>
737
+ </tr>
738
+ </tbody>
739
+ </table>
740
+
741
+
742
+ shell:
743
+
744
+
745
+
746
+ <table border="1" class="dataframe">
747
+ <thead>
748
+ <tr style="text-align: right;">
749
+ <th></th>
750
+ <th>node_type</th>
751
+ <th>pop_name</th>
752
+ <th>model_type</th>
753
+ <th>count</th>
754
+ </tr>
755
+ </thead>
756
+ <tbody>
757
+ <tr>
758
+ <th>0</th>
759
+ <td>100</td>
760
+ <td>PNa</td>
761
+ <td>virtual</td>
762
+ <td>3975</td>
763
+ </tr>
764
+ <tr>
765
+ <th>1</th>
766
+ <td>101</td>
767
+ <td>PNc</td>
768
+ <td>virtual</td>
769
+ <td>3975</td>
770
+ </tr>
771
+ <tr>
772
+ <th>2</th>
773
+ <td>102</td>
774
+ <td>PV</td>
775
+ <td>virtual</td>
776
+ <td>1680</td>
777
+ </tr>
778
+ <tr>
779
+ <th>3</th>
780
+ <td>103</td>
781
+ <td>SOM</td>
782
+ <td>virtual</td>
783
+ <td>1120</td>
784
+ </tr>
785
+ </tbody>
786
+ </table>
787
+
788
+
789
+
790
+
791
+
792
+ 'LA'
793
+ ## Graphs Module
794
+ - [Generate graph](#generate-graph)
795
+ - [Plot Graph](#plot-graph)
796
+ - [Connectioon table](#generate-graph-connection-table)
797
+
798
+ ### Generate Graph
799
+
800
+
801
+ ```python
802
+ from bmtool import graphs
803
+ import networkx as nx
804
+
805
+ Graph = graphs.generate_graph(config='config.json',source='LA',target='LA')
806
+ print("Number of nodes:", Graph.number_of_nodes())
807
+ print("Number of edges:", Graph.number_of_edges())
808
+ print("Node labels:", set(nx.get_node_attributes(Graph, 'label').values()))
809
+ ```
810
+
811
+ Number of nodes: 2000
812
+ Number of edges: 84235
813
+ Node labels: {'SOM', 'PNc', 'PNa', 'PV'}
814
+
815
+
816
+ ### Plot Graph
817
+ #### Generates an interactive plot showing nodes, edges and # of connections
818
+
819
+
820
+ ```python
821
+ graphs.plot_graph(Graph)
822
+ ```
823
+
824
+
825
+
826
+ ### Generate graph connection table
827
+ #### Generates a CSV of all cells and the number of connections each individual cell receives
828
+
829
+
830
+ ```python
831
+ import pandas as pd
832
+ graphs.export_node_connections_to_csv(Graph, 'node_connections.csv')
833
+ df = pd.read_csv('node_connections.csv')
834
+ df.head()
835
+ ```
836
+
837
+
838
+
839
+
840
+ <div>
841
+ <style scoped>
842
+ .dataframe tbody tr th:only-of-type {
843
+ vertical-align: middle;
844
+ }
845
+
846
+ .dataframe tbody tr th {
847
+ vertical-align: top;
848
+ }
849
+
850
+ .dataframe thead th {
851
+ text-align: right;
852
+ }
853
+ </style>
854
+ <table border="1" class="dataframe">
855
+ <thead>
856
+ <tr style="text-align: right;">
857
+ <th></th>
858
+ <th>Unnamed: 0</th>
859
+ <th>Node Label</th>
860
+ <th>PNc Connections</th>
861
+ <th>PV Connections</th>
862
+ <th>SOM Connections</th>
863
+ <th>PNa Connections</th>
864
+ </tr>
865
+ </thead>
866
+ <tbody>
867
+ <tr>
868
+ <th>0</th>
869
+ <td>0</td>
870
+ <td>PNa</td>
871
+ <td>15</td>
872
+ <td>11</td>
873
+ <td>9</td>
874
+ <td>6</td>
875
+ </tr>
876
+ <tr>
877
+ <th>1</th>
878
+ <td>1</td>
879
+ <td>PNa</td>
880
+ <td>24</td>
881
+ <td>25</td>
882
+ <td>6</td>
883
+ <td>21</td>
884
+ </tr>
885
+ <tr>
886
+ <th>2</th>
887
+ <td>2</td>
888
+ <td>PNa</td>
889
+ <td>27</td>
890
+ <td>28</td>
891
+ <td>12</td>
892
+ <td>25</td>
893
+ </tr>
894
+ <tr>
895
+ <th>3</th>
896
+ <td>3</td>
897
+ <td>PNa</td>
898
+ <td>19</td>
899
+ <td>27</td>
900
+ <td>15</td>
901
+ <td>35</td>
902
+ </tr>
903
+ <tr>
904
+ <th>4</th>
905
+ <td>4</td>
906
+ <td>PNa</td>
907
+ <td>25</td>
908
+ <td>11</td>
909
+ <td>8</td>
910
+ <td>16</td>
911
+ </tr>
912
+ </tbody>
913
+ </table>
914
+ </div>
915
+
916
+