bmtool 0.3.7__py3-none-any.whl → 0.3.9__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 CHANGED
@@ -409,12 +409,13 @@ def cell_rotation_3d(**kwargs):
409
409
  populations_list = kwargs["populations"]
410
410
  config = kwargs["config"]
411
411
  group_keys = kwargs["group_by"]
412
- title = kwargs["title"]
412
+ title = kwargs.get("title")
413
413
  save_file = kwargs["save_file"]
414
414
  quiver_length = kwargs["quiver_length"]
415
415
  arrow_length_ratio = kwargs["arrow_length_ratio"]
416
416
  group = kwargs["group"]
417
- max_cells = kwargs["max_cells"]
417
+ max_cells = kwargs.get("max_cells",999999999)
418
+ init_vector = kwargs.get("init_vector","1,0,0")
418
419
 
419
420
  nodes = util.load_nodes_from_config(config)
420
421
 
@@ -480,8 +481,19 @@ def cell_rotation_3d(**kwargs):
480
481
  #Convert to arrow direction
481
482
  from scipy.spatial.transform import Rotation as R
482
483
  uvw = pd.DataFrame([U,V,W]).T
483
- rots = R.from_euler('zyx', uvw).as_rotvec().T
484
+ init_vector = init_vector.split(',')
485
+ init_vector = np.repeat([init_vector],len(X),axis=0)
486
+
487
+ # To get the final cell orientation after rotation,
488
+ # you need to use function Rotaion.apply(init_vec),
489
+ # where init_vec is a vector of the initial orientation of a cell
490
+ #rots = R.from_euler('xyz', uvw).apply(init_vector.astype(float))
491
+ #rots = R.from_euler('xyz', pd.DataFrame([rots[:,0],rots[:,1],rots[:,2]]).T).as_rotvec().T
492
+
493
+ rots = R.from_euler('zyx', uvw).apply(init_vector.astype(float)).T
484
494
  h = ax.quiver(X, Y, Z, rots[0],rots[1],rots[2],color=color,label=group_name, arrow_length_ratio = arrow_length_ratio, length=quiver_length)
495
+
496
+ #h = ax.quiver(X, Y, Z, rots[0],rots[1],rots[2],color=color,label=group_name, arrow_length_ratio = arrow_length_ratio, length=quiver_length)
485
497
  ax.scatter(X,Y,Z,color=color,label=group_name)
486
498
  handles.append(h)
487
499
  if not handles:
bmtool/plot_commands.py CHANGED
@@ -136,15 +136,17 @@ def cell(ctx,title,save_file):
136
136
  @click.option('--max-cells', type=click.INT, default=999999999, help="max number of cells to display [default: 999999999]")
137
137
  @click.option('--quiver-length', type=click.FLOAT, default=10, help="how long the arrows should be [default: 10]")
138
138
  @click.option('--arrow-length-ratio', type=click.FLOAT, default=0.2, help="ratio for the arrow of the quiver [default: 0.2]")
139
+ @click.option('--init-vector', type=click.STRING, default="1,0,0", help="comma delimited initial rotation vector specified by pt3dadd [default: 0,0,1]")
139
140
  @click.pass_context
140
- def rotation_3d(ctx,populations,group_by,group,max_cells,quiver_length,arrow_length_ratio):
141
+ def rotation_3d(ctx,populations,group_by,group,max_cells,quiver_length,arrow_length_ratio,init_vector):
141
142
  cell_rotation_3d(config=ctx.obj['config'],**ctx.obj['cell'],
142
143
  populations=populations,
143
144
  group_by=group_by,
144
145
  group=group,
145
146
  max_cells=max_cells,
146
147
  quiver_length=quiver_length,
147
- arrow_length_ratio=arrow_length_ratio)
148
+ arrow_length_ratio=arrow_length_ratio,
149
+ init_vector=init_vector)
148
150
  if ctx.obj['display']:
149
151
  plt.show()
150
152
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bmtool
3
- Version: 0.3.7
3
+ Version: 0.3.9
4
4
  Summary: BMTool
5
5
  Home-page: https://github.com/tjbanks/bmtool
6
6
  Download-URL:
@@ -352,6 +352,34 @@ This will plot cells in the `hippocampus` network, using the `pop_name` as the c
352
352
 
353
353
  All `point_process` cell types will be ignored since they do not have physical locations.
354
354
 
355
+ ### Plot 3d cell location and rotation
356
+ Plot the location and rotation of your cells. Plot all of your cells with a single command
357
+ ```
358
+ bmtool plot cell rotation
359
+ ```
360
+ ![bmtool](./figures/rotation3d_1.png "3d Rotation Figure")
361
+
362
+ Customize your plot by limiting the cells you want or selecting a max number of cells to plot.
363
+ ```
364
+ bmtool plot --config simulation_configECP.json cell rotation --group-by pop_name --group CR --max-cells 100 --quiver-length 100 --arrow-length-ratio 0.25
365
+ ```
366
+ ![bmtool](./figures/rotation3d_2.png "3d Rotation Figure")
367
+
368
+ Code
369
+ ```
370
+ from bmtool import
371
+ from bmtool import bmplot
372
+
373
+ bmplot.cell_rotation_3d(config=config,
374
+ populations=populations,
375
+ group_by=group_by,
376
+ group=group,
377
+ title=title,
378
+ max_cells=max_cells,
379
+ quiver_length=quiver_length,
380
+ arrow_length_ratio=arrow_length_ratio)
381
+ ```
382
+
355
383
  ### Plotting Current Clamp and Spike Train Info
356
384
  To plot all current clamp info involved in a simulation, use the following command (uses 'simulation_config.json' as default)
357
385
  ```
@@ -1,9 +1,9 @@
1
1
  bmtool/__init__.py,sha256=FrcSFNlD5lhNIWDYrX0kZiBYS_lDSK5rBkSXMuDoEWg,141
2
2
  bmtool/__main__.py,sha256=61s3Dd4-brkJt_amGpGapdIoV-3QNPbjRvIVQHlfZZI,676
3
- bmtool/bmplot.py,sha256=0CtiNXOMugzxQhKf8uz9hyEn9ZFN6BnOBiobxlCrXmI,28949
3
+ bmtool/bmplot.py,sha256=pf7TKzjHAEIqRCQiEdzJho3IXCBhr2-VDopRIP54EzQ,29723
4
4
  bmtool/manage.py,sha256=ALYltiBaljm1pBtz-0ifvrkrzlPNDiIu7Lr5q3-_oFU,688
5
5
  bmtool/plot.py,sha256=C1novNnisc_7IuQbY4p4ZbYcgj11UttUIqnHtpqHoJs,25374
6
- bmtool/plot_commands.py,sha256=ivA3W7faMMhATgsJlbSxX8zA_yMR1oVvvYz5d-xCqt8,12315
6
+ bmtool/plot_commands.py,sha256=U3up0PLZN8drcjyLsbrhsA4mVh9iXX-5dt0NsXgfjxI,12528
7
7
  bmtool/singlecell.py,sha256=3qWaELnCuYuYtxDOQwa-SzmQ8F8L32Q839FGy35LII0,14900
8
8
  bmtool/debug/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  bmtool/debug/commands.py,sha256=5xtXtAJhYMrlxM9vF6jvfLhE-kOTwDnibmDBIrPhYrA,602
@@ -30,9 +30,9 @@ bmtools/cli/plugins/util/commands.py,sha256=7BRj6PEm5XCQaYk4EhIGvqXNcsCbykw3I9l9
30
30
  bmtools/cli/plugins/util/util.py,sha256=ir7omOJgAMO3RxIKI39ZpIzI6to9LqToI6Dck4wkLyw,50126
31
31
  bmtools/cli/plugins/util/neuron/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  bmtools/cli/plugins/util/neuron/celltuner.py,sha256=d3WTbEq4WW6koHc5TdiUGGm2JWJU3LuPeiAFtUiaMgM,89264
33
- bmtool-0.3.7.dist-info/LICENSE,sha256=eOgqgvoeIS9FFSJjHbxCyfHyXdHUhk2YHLqQlWWzdXk,1089
34
- bmtool-0.3.7.dist-info/METADATA,sha256=ymdveEduCuBjnO9l12e6M-H8Vhqw5fD4FGjbuirEh08,17013
35
- bmtool-0.3.7.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
36
- bmtool-0.3.7.dist-info/entry_points.txt,sha256=0-BHZ6nUnh0twWw9SXNTiRmKjDnb1VO2DfG_-oprhAc,45
37
- bmtool-0.3.7.dist-info/top_level.txt,sha256=gpd2Sj-L9tWbuJEd5E8C8S8XkNm5yUE76klUYcM-eWM,7
38
- bmtool-0.3.7.dist-info/RECORD,,
33
+ bmtool-0.3.9.dist-info/LICENSE,sha256=eOgqgvoeIS9FFSJjHbxCyfHyXdHUhk2YHLqQlWWzdXk,1089
34
+ bmtool-0.3.9.dist-info/METADATA,sha256=c5iCJrjQ193_4LcJ1maVtBkBz3hF8y2GwmMlzN4CGIc,17987
35
+ bmtool-0.3.9.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
36
+ bmtool-0.3.9.dist-info/entry_points.txt,sha256=0-BHZ6nUnh0twWw9SXNTiRmKjDnb1VO2DfG_-oprhAc,45
37
+ bmtool-0.3.9.dist-info/top_level.txt,sha256=gpd2Sj-L9tWbuJEd5E8C8S8XkNm5yUE76klUYcM-eWM,7
38
+ bmtool-0.3.9.dist-info/RECORD,,
File without changes