bsplot 0.0.8__tar.gz → 0.0.10__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 (94) hide show
  1. bsplot-0.0.10/PKG-INFO +119 -0
  2. bsplot-0.0.10/README.md +89 -0
  3. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/__init__.py +10 -1
  4. bsplot-0.0.10/bsplot/ascii.py +1122 -0
  5. bsplot-0.0.10/bsplot/ascii_movie.py +805 -0
  6. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/colors.py +135 -11
  7. bsplot-0.0.10/bsplot/data/STN_lh.nii.gz +0 -0
  8. bsplot-0.0.10/bsplot/data/STN_rh.nii.gz +0 -0
  9. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/graph/edges.py +5 -11
  10. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/streamlines.py +3 -0
  11. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/style.py +198 -28
  12. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/styles/black.mplstyle +0 -1
  13. bsplot-0.0.10/bsplot/styles/template.mplstyle +83 -0
  14. bsplot-0.0.10/bsplot/styles/white.mplstyle +77 -0
  15. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/surface.py +142 -64
  16. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/templates.py +1 -0
  17. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/text.py +1 -0
  18. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot.egg-info/SOURCES.txt +9 -1
  19. {bsplot-0.0.8 → bsplot-0.0.10}/pyproject.toml +10 -1
  20. bsplot-0.0.10/tests/test_ascii.py +167 -0
  21. bsplot-0.0.10/tests/test_ascii_movie.py +319 -0
  22. bsplot-0.0.8/PKG-INFO +0 -60
  23. bsplot-0.0.8/README.md +0 -35
  24. {bsplot-0.0.8 → bsplot-0.0.10}/LICENSE +0 -0
  25. {bsplot-0.0.8 → bsplot-0.0.10}/MANIFEST.in +0 -0
  26. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/anat.py +0 -0
  27. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/animate.py +0 -0
  28. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/bioicons.py +0 -0
  29. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/brain.py +0 -0
  30. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/data/HCP_avg-SC.txt +0 -0
  31. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/data/MNI152.rh.pial +0 -0
  32. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/data/__init__.py +0 -0
  33. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/data/parcellations/HCP-MMP1.L.label.gii +0 -0
  34. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/data/parcellations/HCP-MMP1.R.label.gii +0 -0
  35. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/data/surface.py +0 -0
  36. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/figure.py +0 -0
  37. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/graph/__init__.py +0 -0
  38. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/graph/flowchart.py +0 -0
  39. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/graph/layout.py +0 -0
  40. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/graph/network.py +0 -0
  41. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/graph/nodes.py +0 -0
  42. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/panels.py +0 -0
  43. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/__init__.py +0 -0
  44. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/_sync_from_zenodo_download.sh +0 -0
  45. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/batlowK.txt +0 -0
  46. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/batlowW.txt +0 -0
  47. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/cyclic/bamO.txt +0 -0
  48. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/cyclic/brocO.txt +0 -0
  49. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/cyclic/corkO.txt +0 -0
  50. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/cyclic/romaO.txt +0 -0
  51. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/cyclic/vikO.txt +0 -0
  52. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/diverging/bam.txt +0 -0
  53. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/diverging/berlin.txt +0 -0
  54. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/diverging/broc.txt +0 -0
  55. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/diverging/cork.txt +0 -0
  56. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/diverging/lisbon.txt +0 -0
  57. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/diverging/managua.txt +0 -0
  58. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/diverging/roma.txt +0 -0
  59. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/diverging/tofino.txt +0 -0
  60. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/diverging/vanimo.txt +0 -0
  61. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/diverging/vik.txt +0 -0
  62. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/multisequential/bukavu.txt +0 -0
  63. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/multisequential/fes.txt +0 -0
  64. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/multisequential/oleron.txt +0 -0
  65. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/naviaW.txt +0 -0
  66. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/acton.txt +0 -0
  67. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/bamako.txt +0 -0
  68. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/batlow.txt +0 -0
  69. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/bilbao.txt +0 -0
  70. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/buda.txt +0 -0
  71. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/davos.txt +0 -0
  72. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/devon.txt +0 -0
  73. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/glasgow.txt +0 -0
  74. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/grayC.txt +0 -0
  75. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/hawaii.txt +0 -0
  76. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/imola.txt +0 -0
  77. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/lajolla.txt +0 -0
  78. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/lapaz.txt +0 -0
  79. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/lipari.txt +0 -0
  80. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/navia.txt +0 -0
  81. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/nuuk.txt +0 -0
  82. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/oslo.txt +0 -0
  83. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/tokyo.txt +0 -0
  84. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/scientific_color_maps/sequential/turku.txt +0 -0
  85. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/styles/bss.mplstyle +0 -0
  86. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/styles/bwcomp.mplstyle +0 -0
  87. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/styles/nature.mplstyle +0 -0
  88. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/styles/transparent.mplstyle +0 -0
  89. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/styles/tvbo.mplstyle +0 -0
  90. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/text2obj.py +0 -0
  91. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/timeseries.py +0 -0
  92. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/utils.py +0 -0
  93. {bsplot-0.0.8 → bsplot-0.0.10}/bsplot/volume.py +0 -0
  94. {bsplot-0.0.8 → bsplot-0.0.10}/setup.cfg +0 -0
bsplot-0.0.10/PKG-INFO ADDED
@@ -0,0 +1,119 @@
1
+ Metadata-Version: 2.4
2
+ Name: bsplot
3
+ Version: 0.0.10
4
+ Summary: Plotting utilities for neuroscience: styles, palettes, surfaces, glass-brain, and panel helpers.
5
+ License-Expression: EUPL-1.2
6
+ Project-URL: Repository, https://github.com/leon-k-martin/bsplot
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: matplotlib
11
+ Requires-Dist: pybtex
12
+ Requires-Dist: pyaml
13
+ Requires-Dist: scikit-image
14
+ Requires-Dist: nibabel
15
+ Requires-Dist: nilearn
16
+ Requires-Dist: templateflow
17
+ Requires-Dist: graphviz
18
+ Requires-Dist: cmap
19
+ Provides-Extra: docs
20
+ Requires-Dist: quarto; extra == "docs"
21
+ Requires-Dist: quartodoc; extra == "docs"
22
+ Requires-Dist: griffe<1.0; extra == "docs"
23
+ Requires-Dist: jupyter-cache; extra == "docs"
24
+ Requires-Dist: cairosvg; extra == "docs"
25
+ Provides-Extra: tvbo
26
+ Requires-Dist: xarray; extra == "tvbo"
27
+ Requires-Dist: h5netcdf; extra == "tvbo"
28
+ Requires-Dist: h5py; extra == "tvbo"
29
+ Dynamic: license-file
30
+
31
+ <h1>
32
+ bsplot
33
+ <img src="docs/Usage/_output/anim1.gif" alt="Sagittal volume animation" height="55" align="right">
34
+ <img src="docs/Usage/_output/anim4.gif" alt="Surface rotation animation" height="55" align="right">
35
+ </h1>
36
+
37
+ Neuroscience plotting utilities built on **matplotlib**.
38
+
39
+ ## Overview
40
+
41
+ ![](docs/overview_figure.png)
42
+
43
+ - Brain surfaces and glass-brain visualizations
44
+ - Volume slicing with anatomical overlays
45
+ - Tractography rendering
46
+ - Publication-ready styles and scientific colormaps
47
+ - Panel helpers for multi-figure layouts
48
+ - Terminal (ASCII) surface backend — render a lit brain as text, with data overlays
49
+
50
+ ## Terminal (ASCII) rendering
51
+
52
+ Render a cortical surface straight to text — no matplotlib figure — as a lit
53
+ "surface of letters", with optional scalar overlays and parcellations in colour.
54
+ The default is the folded **pial** cortex, and the output adapts to wherever it
55
+ is drawn: **terminal** (ANSI colour), **notebook/website** (`color_mode="html"`,
56
+ auto-selected in a notebook), or **README/plain-text** (`color_mode="none"`).
57
+
58
+ ```python
59
+ import bsplot
60
+
61
+ bsplot.plot_surf_ascii() # pial template brain, lateral
62
+ bsplot.plot_surf_ascii(data=my_stat_map) # scalar overlay, colour-mapped
63
+ bsplot.plot_surf_ascii(parcellation=labels) # coloured regions
64
+ bsplot.plot_surf_ascii(width=140) # width = resolution knob
65
+ bsplot.plot_surf_ascii(background="light") # for a white background
66
+ ```
67
+
68
+ ```bash
69
+ bsplot-ascii # pial fsaverage, lateral (or: python -m bsplot.ascii)
70
+ bsplot-ascii --view top --hemi both # both hemispheres, dorsal
71
+ bsplot-ascii --html > brain.html # emit an HTML block
72
+ bsplot-ascii --sphere # offline demo (no download)
73
+ ```
74
+
75
+ See the [Terminal surface guide](docs/Usage/AsciiSurface.qmd) for ramps, colormaps, views, and resolution.
76
+
77
+ ### Timeseries — recordings and simulations
78
+
79
+ Surface colouring over time, cheap enough to stream live. The geometry is
80
+ prepared once, so each frame only re-colours the visible faces: **~0.7 ms/frame
81
+ (>1000 fps)** against ~184 ms for a full render.
82
+
83
+ ```python
84
+ mov = bsplot.AsciiSurfaceMovie(data, hemi="lh", view="lateral", width=80)
85
+ mov.play(fps=20) # live in the terminal
86
+ mov.to_gif("sim.gif"); mov.to_html("sim.html"); mov.to_cast("sim.cast")
87
+
88
+ # region-level data (TVB-style) mapped onto the surface by an atlas
89
+ bsplot.AsciiSurfaceMovie(data, atlas="DesikanKilliany", region_labels=labels)
90
+
91
+ # straight from a tvbo simulation result
92
+ bsplot.AsciiSurfaceMovie.from_tvbo("exp-3_result.h5", atlas="dk").play()
93
+ ```
94
+
95
+ ```bash
96
+ bsplot-ascii-movie data.npy --atlas Destrieux --fps 20 # play
97
+ bsplot-ascii-movie result.h5 --tvbo -o sim.gif # or export
98
+ ```
99
+
100
+ See the [Timeseries guide](docs/Usage/AsciiTimeseries/AsciiTimeseries.qmd).
101
+ Reading tvbo result files needs `pip install "bsplot[tvbo]"`.
102
+
103
+ ![alt text](docs/figures/brain_network_with_insets.png)
104
+
105
+
106
+ ## Installation
107
+
108
+ ```bash
109
+ pip install bsplot
110
+ ```
111
+
112
+ ## Dependencies
113
+
114
+ - `matplotlib`
115
+ - `nibabel`
116
+ - `nilearn`
117
+ - `templateflow`
118
+ - `scikit-image`
119
+
@@ -0,0 +1,89 @@
1
+ <h1>
2
+ bsplot
3
+ <img src="docs/Usage/_output/anim1.gif" alt="Sagittal volume animation" height="55" align="right">
4
+ <img src="docs/Usage/_output/anim4.gif" alt="Surface rotation animation" height="55" align="right">
5
+ </h1>
6
+
7
+ Neuroscience plotting utilities built on **matplotlib**.
8
+
9
+ ## Overview
10
+
11
+ ![](docs/overview_figure.png)
12
+
13
+ - Brain surfaces and glass-brain visualizations
14
+ - Volume slicing with anatomical overlays
15
+ - Tractography rendering
16
+ - Publication-ready styles and scientific colormaps
17
+ - Panel helpers for multi-figure layouts
18
+ - Terminal (ASCII) surface backend — render a lit brain as text, with data overlays
19
+
20
+ ## Terminal (ASCII) rendering
21
+
22
+ Render a cortical surface straight to text — no matplotlib figure — as a lit
23
+ "surface of letters", with optional scalar overlays and parcellations in colour.
24
+ The default is the folded **pial** cortex, and the output adapts to wherever it
25
+ is drawn: **terminal** (ANSI colour), **notebook/website** (`color_mode="html"`,
26
+ auto-selected in a notebook), or **README/plain-text** (`color_mode="none"`).
27
+
28
+ ```python
29
+ import bsplot
30
+
31
+ bsplot.plot_surf_ascii() # pial template brain, lateral
32
+ bsplot.plot_surf_ascii(data=my_stat_map) # scalar overlay, colour-mapped
33
+ bsplot.plot_surf_ascii(parcellation=labels) # coloured regions
34
+ bsplot.plot_surf_ascii(width=140) # width = resolution knob
35
+ bsplot.plot_surf_ascii(background="light") # for a white background
36
+ ```
37
+
38
+ ```bash
39
+ bsplot-ascii # pial fsaverage, lateral (or: python -m bsplot.ascii)
40
+ bsplot-ascii --view top --hemi both # both hemispheres, dorsal
41
+ bsplot-ascii --html > brain.html # emit an HTML block
42
+ bsplot-ascii --sphere # offline demo (no download)
43
+ ```
44
+
45
+ See the [Terminal surface guide](docs/Usage/AsciiSurface.qmd) for ramps, colormaps, views, and resolution.
46
+
47
+ ### Timeseries — recordings and simulations
48
+
49
+ Surface colouring over time, cheap enough to stream live. The geometry is
50
+ prepared once, so each frame only re-colours the visible faces: **~0.7 ms/frame
51
+ (>1000 fps)** against ~184 ms for a full render.
52
+
53
+ ```python
54
+ mov = bsplot.AsciiSurfaceMovie(data, hemi="lh", view="lateral", width=80)
55
+ mov.play(fps=20) # live in the terminal
56
+ mov.to_gif("sim.gif"); mov.to_html("sim.html"); mov.to_cast("sim.cast")
57
+
58
+ # region-level data (TVB-style) mapped onto the surface by an atlas
59
+ bsplot.AsciiSurfaceMovie(data, atlas="DesikanKilliany", region_labels=labels)
60
+
61
+ # straight from a tvbo simulation result
62
+ bsplot.AsciiSurfaceMovie.from_tvbo("exp-3_result.h5", atlas="dk").play()
63
+ ```
64
+
65
+ ```bash
66
+ bsplot-ascii-movie data.npy --atlas Destrieux --fps 20 # play
67
+ bsplot-ascii-movie result.h5 --tvbo -o sim.gif # or export
68
+ ```
69
+
70
+ See the [Timeseries guide](docs/Usage/AsciiTimeseries/AsciiTimeseries.qmd).
71
+ Reading tvbo result files needs `pip install "bsplot[tvbo]"`.
72
+
73
+ ![alt text](docs/figures/brain_network_with_insets.png)
74
+
75
+
76
+ ## Installation
77
+
78
+ ```bash
79
+ pip install bsplot
80
+ ```
81
+
82
+ ## Dependencies
83
+
84
+ - `matplotlib`
85
+ - `nibabel`
86
+ - `nilearn`
87
+ - `templateflow`
88
+ - `scikit-image`
89
+
@@ -1,13 +1,22 @@
1
1
  # Copyright © Charité Universitätsmedizin Berlin. This software is licensed under the terms of the European Union Public Licence (EUPL) version 1.2 or later.
2
2
  from os.path import abspath, dirname, join
3
3
 
4
- __version__ = "0.0.8"
4
+ __version__ = "0.0.10"
5
5
 
6
6
  ROOT = abspath(dirname(__file__))
7
7
  datadir = join(ROOT, "data")
8
8
 
9
9
  from . import volume, anat, animate, brain, colors, data, figure, streamlines, style, timeseries, surface, templates, utils
10
+ from . import ascii
10
11
  from .surface import vol_to_mesh, LabeledMeshes, project_vol_to_surf, plot_surf
12
+ from .ascii import (
13
+ AsciiGrid,
14
+ AsciiSurfaceRenderer,
15
+ plot_surf_ascii,
16
+ prepare_surf_ascii,
17
+ render_surf_ascii,
18
+ )
19
+ from .ascii_movie import AsciiSurfaceMovie, animate_surf_ascii, load_atlas_labels
11
20
  from .brain import glass_brain
12
21
  from .volume import plot_slice, apply_brain_mask
13
22
  from .colors import explore_colormaps