bmtool 0.5.9__tar.gz → 0.5.9.5__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.5.9 → bmtool-0.5.9.5}/PKG-INFO +1 -1
  2. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/bmplot.py +70 -0
  3. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool.egg-info/PKG-INFO +1 -1
  4. {bmtool-0.5.9 → bmtool-0.5.9.5}/setup.py +1 -1
  5. {bmtool-0.5.9 → bmtool-0.5.9.5}/LICENSE +0 -0
  6. {bmtool-0.5.9 → bmtool-0.5.9.5}/README.md +0 -0
  7. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/SLURM.py +0 -0
  8. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/__init__.py +0 -0
  9. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/__main__.py +0 -0
  10. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/connectors.py +0 -0
  11. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/debug/__init__.py +0 -0
  12. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/debug/commands.py +0 -0
  13. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/debug/debug.py +0 -0
  14. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/graphs.py +0 -0
  15. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/manage.py +0 -0
  16. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/plot_commands.py +0 -0
  17. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/singlecell.py +0 -0
  18. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/synapses.py +0 -0
  19. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/util/__init__.py +0 -0
  20. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/util/commands.py +0 -0
  21. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/util/neuron/__init__.py +0 -0
  22. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/util/neuron/celltuner.py +0 -0
  23. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool/util/util.py +0 -0
  24. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool.egg-info/SOURCES.txt +0 -0
  25. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool.egg-info/dependency_links.txt +0 -0
  26. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool.egg-info/entry_points.txt +0 -0
  27. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool.egg-info/requires.txt +0 -0
  28. {bmtool-0.5.9 → bmtool-0.5.9.5}/bmtool.egg-info/top_level.txt +0 -0
  29. {bmtool-0.5.9 → bmtool-0.5.9.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bmtool
3
- Version: 0.5.9
3
+ Version: 0.5.9.5
4
4
  Summary: BMTool
5
5
  Home-page: https://github.com/cyneuro/bmtool
6
6
  Download-URL:
@@ -405,6 +405,76 @@ def connection_histogram(config=None,nodes=None,edges=None,sources=[],targets=[]
405
405
  tids = []
406
406
  util.relation_matrix(config,nodes,edges,sources,targets,sids,tids,prepend_pop,relation_func=connection_pair_histogram,synaptic_info=synaptic_info)
407
407
 
408
+ def connection_distance(config: str,source: str,target: str,
409
+ source_cell_id: int,target_id_type: str) -> None:
410
+ """
411
+ Plots the 3D spatial distribution of target nodes relative to a source node
412
+ and a histogram of distances from the source node to each target node.
413
+
414
+ Parameters:
415
+ ----------
416
+ config: (str) A BMTK simulation config
417
+ sources: (str) network name(s) to plot
418
+ targets: (str) network name(s) to plot
419
+ source_cell_id : (int) ID of the source cell for calculating distances to target nodes.
420
+ target_id_type : (str) A string to filter target nodes based off the target_query.
421
+
422
+ """
423
+ if not config:
424
+ raise Exception("config not defined")
425
+ if not source or not target:
426
+ raise Exception("Sources or targets not defined")
427
+ #if source != target:
428
+ #raise Exception("Code is setup for source and target to be the same! Look at source code for function to add feature")
429
+
430
+ # Load nodes and edges based on config file
431
+ nodes, edges = util.load_nodes_edges_from_config(config)
432
+
433
+ edge_network = source + "_to_" + target
434
+ node_network = source
435
+
436
+ # Filter edges to obtain connections originating from the source node
437
+ edge = edges[edge_network]
438
+ edge = edge[edge['source_node_id'] == source_cell_id]
439
+ if target_id_type:
440
+ edge = edge[edge['target_query'].str.contains(target_id_type, na=False)]
441
+
442
+ target_node_ids = edge['target_node_id']
443
+
444
+ # Filter nodes to obtain only the target and source nodes
445
+ node = nodes[node_network]
446
+ target_nodes = node.loc[node.index.isin(target_node_ids)]
447
+ source_node = node.loc[node.index == source_cell_id]
448
+
449
+ # Calculate distances between source node and each target node
450
+ target_positions = target_nodes[['pos_x', 'pos_y', 'pos_z']].values
451
+ source_position = np.array([source_node['pos_x'], source_node['pos_y'], source_node['pos_z']]).ravel() # Ensure 1D shape
452
+ distances = np.linalg.norm(target_positions - source_position, axis=1)
453
+
454
+ # Plot positions of source and target nodes in 3D space
455
+ fig = plt.figure(figsize=(8, 6))
456
+ ax = fig.add_subplot(111, projection='3d')
457
+
458
+ ax.scatter(target_nodes['pos_x'], target_nodes['pos_y'], target_nodes['pos_z'], c='blue', label="target cells")
459
+ ax.scatter(source_node['pos_x'], source_node['pos_y'], source_node['pos_z'], c='red', label="source cell")
460
+
461
+ # Optional: Add text annotations for distances
462
+ # for i, distance in enumerate(distances):
463
+ # ax.text(target_nodes['pos_x'].iloc[i], target_nodes['pos_y'].iloc[i], target_nodes['pos_z'].iloc[i],
464
+ # f'{distance:.2f}', color='black', fontsize=8, ha='center')
465
+
466
+ plt.legend()
467
+ plt.show()
468
+
469
+ # Plot distances in a separate 2D plot
470
+ plt.figure(figsize=(8, 6))
471
+ plt.hist(distances, bins=20, color='blue', edgecolor='black')
472
+ plt.xlabel("Distance")
473
+ plt.ylabel("Count")
474
+ plt.title("Distance from Source Node to Each Target Node")
475
+ plt.grid(True)
476
+ plt.show()
477
+
408
478
  def edge_histogram_matrix(config=None,sources = None,targets=None,sids=None,tids=None,no_prepend_pop=None,edge_property = None,time = None,time_compare = None,report=None,title=None,save_file=None):
409
479
  """
410
480
  write about function here
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bmtool
3
- Version: 0.5.9
3
+ Version: 0.5.9.5
4
4
  Summary: BMTool
5
5
  Home-page: https://github.com/cyneuro/bmtool
6
6
  Download-URL:
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
6
6
 
7
7
  setup(
8
8
  name="bmtool",
9
- version='0.5.9',
9
+ version='0.5.9.5',
10
10
  author="Neural Engineering Laboratory at the University of Missouri",
11
11
  author_email="gregglickert@mail.missouri.edu",
12
12
  description="BMTool",
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