marm-viz 0.1.0__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 (37) hide show
  1. marm_viz-0.1.0/LICENSE +21 -0
  2. marm_viz-0.1.0/PKG-INFO +97 -0
  3. marm_viz-0.1.0/README.md +68 -0
  4. marm_viz-0.1.0/marm_viz/__init__.py +63 -0
  5. marm_viz-0.1.0/marm_viz/__main__.py +619 -0
  6. marm_viz-0.1.0/marm_viz/annotate/__init__.py +42 -0
  7. marm_viz-0.1.0/marm_viz/annotate/cage_boundaries.py +347 -0
  8. marm_viz-0.1.0/marm_viz/annotate/metadata.py +282 -0
  9. marm_viz-0.1.0/marm_viz/annotate/stim_center.py +197 -0
  10. marm_viz-0.1.0/marm_viz/collect/__init__.py +0 -0
  11. marm_viz-0.1.0/marm_viz/collect/geometry.py +368 -0
  12. marm_viz-0.1.0/marm_viz/collect/state_remap.py +196 -0
  13. marm_viz-0.1.0/marm_viz/collect/video_data.py +320 -0
  14. marm_viz-0.1.0/marm_viz/data/default_state_remap.txt +80 -0
  15. marm_viz-0.1.0/marm_viz/io/__init__.py +0 -0
  16. marm_viz-0.1.0/marm_viz/io/marm_behavior_loader.py +288 -0
  17. marm_viz-0.1.0/marm_viz/plot/__init__.py +0 -0
  18. marm_viz-0.1.0/marm_viz/plot/_overlays.py +95 -0
  19. marm_viz-0.1.0/marm_viz/plot/behavior_detail.py +398 -0
  20. marm_viz-0.1.0/marm_viz/plot/behavior_overview.py +192 -0
  21. marm_viz-0.1.0/marm_viz/plot/category_heatmaps.py +473 -0
  22. marm_viz-0.1.0/marm_viz/plot/correlation.py +249 -0
  23. marm_viz-0.1.0/marm_viz/plot/density_2d.py +288 -0
  24. marm_viz-0.1.0/marm_viz/plot/ethogram.py +134 -0
  25. marm_viz-0.1.0/marm_viz/plot/head_track.py +117 -0
  26. marm_viz-0.1.0/marm_viz/plot/qc_panels.py +272 -0
  27. marm_viz-0.1.0/marm_viz/plot/sources.py +165 -0
  28. marm_viz-0.1.0/marm_viz/plot/stim_time_series.py +346 -0
  29. marm_viz-0.1.0/marm_viz/types.py +245 -0
  30. marm_viz-0.1.0/marm_viz.egg-info/PKG-INFO +97 -0
  31. marm_viz-0.1.0/marm_viz.egg-info/SOURCES.txt +35 -0
  32. marm_viz-0.1.0/marm_viz.egg-info/dependency_links.txt +1 -0
  33. marm_viz-0.1.0/marm_viz.egg-info/entry_points.txt +2 -0
  34. marm_viz-0.1.0/marm_viz.egg-info/requires.txt +11 -0
  35. marm_viz-0.1.0/marm_viz.egg-info/top_level.txt +1 -0
  36. marm_viz-0.1.0/pyproject.toml +45 -0
  37. marm_viz-0.1.0/setup.cfg +4 -0
marm_viz-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 William Menegas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.1
2
+ Name: marm-viz
3
+ Version: 0.1.0
4
+ Summary: Visualization toolkit for marmoset homecage behavioral data (marm_behavior outputs).
5
+ Author-email: William Menegas <william.s.menegas@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/williammenegas/marm_viz
8
+ Project-URL: Repository, https://github.com/williammenegas/marm_viz
9
+ Project-URL: Issues, https://github.com/williammenegas/marm_viz/issues
10
+ Keywords: marmoset,behavior,visualization,neuroscience,ethogram
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Topic :: Scientific/Engineering :: Visualization
15
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
16
+ Classifier: Intended Audience :: Science/Research
17
+ Requires-Python: >=3.9
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: numpy>=1.22
21
+ Requires-Dist: scipy>=1.8
22
+ Requires-Dist: matplotlib>=3.5
23
+ Requires-Dist: h5py>=3.6
24
+ Provides-Extra: annotate
25
+ Requires-Dist: opencv-python>=4.5; extra == "annotate"
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7; extra == "dev"
28
+ Requires-Dist: opencv-python>=4.5; extra == "dev"
29
+
30
+ # marm_viz
31
+
32
+ Visualization toolkit for marmoset homecage behavioral data. Designed to work with outputs from [`marm_behavior`](https://github.com/williammenegas/marm_behavior).
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install marm-viz
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ Point `marm_viz` at a folder containing `marm_behavior` outputs (hlabel, hcoord, edges, depths files):
43
+
44
+ ```bash
45
+ # Generate all 10 plot types (default: JPG output)
46
+ python -m marm_viz /path/to/recording_folder
47
+
48
+ # Single plot type
49
+ python -m marm_viz /path/to/recording_folder --plot ethogram
50
+
51
+ # Vector output for Illustrator
52
+ python -m marm_viz /path/to/recording_folder --format svg
53
+ ```
54
+
55
+ ## Plot Types
56
+
57
+ | Flag | Output | Description |
58
+ |------|--------|-------------|
59
+ | `qc` | QC panels | 8-panel overview: head XY colored by depth/distance/angle/behavior + histograms |
60
+ | `heatmaps` | Category heatmaps | Per-category spatial occupancy + near-stimulus + overall occupancy + P(move) |
61
+ | `timeseries` | Stim proximity | Fraction near stimulus across time chunks + per-chunk heatmaps + pooled XY |
62
+ | `density` | 2D density | Smoothed occupancy density with contours |
63
+ | `behavior` | State usage + t-SNE | 80-state bar chart grouped by category + t-SNE centroid bubble plot |
64
+ | `ethogram` | Ethogram | Per-category binary raster for each animal across time |
65
+ | `transitions` | Transition matrix | 5x5 category transition probabilities (diagonal NaN'd) |
66
+ | `polar` | Head direction | Polar histogram of head angle relative to stimulus (near vs far) |
67
+ | `track` | Head tracks | Per-animal + merged XY trajectory line plots |
68
+ | `correlation` | Cagemate correlation | Pairwise Spearman correlation of 80-state usage vectors across time chunks |
69
+
70
+ ## CLI Options
71
+
72
+ ```
73
+ --plot TYPE Which plot to generate (default: all)
74
+ --format FMT Output format: jpg (default), svg, png, pdf
75
+ --output-dir DIR Output directory (default: <input>/marm_viz_output/)
76
+ --video STEM Only process this video stem
77
+ --type-to-use STR Only process videos whose filename contains STR (case-insensitive)
78
+ --verbose Print detailed diagnostic information
79
+ --fps N Frames per second (default: 60)
80
+ --chunk-minutes N Chunk size in minutes for time series (default: 5)
81
+ --radius-px N Near-stimulus radius in pixels (default: 120)
82
+ --augment Enable left/right flip augmentation
83
+ ```
84
+
85
+ ## Python API
86
+
87
+ ```python
88
+ from marm_viz import build_recording_set, plot_ethogram
89
+
90
+ data = build_recording_set("/path/to/folder")
91
+ fig = plot_ethogram(data, fps=60)
92
+ fig.savefig("ethogram.svg")
93
+ ```
94
+
95
+ ## License
96
+
97
+ MIT
@@ -0,0 +1,68 @@
1
+ # marm_viz
2
+
3
+ Visualization toolkit for marmoset homecage behavioral data. Designed to work with outputs from [`marm_behavior`](https://github.com/williammenegas/marm_behavior).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install marm-viz
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ Point `marm_viz` at a folder containing `marm_behavior` outputs (hlabel, hcoord, edges, depths files):
14
+
15
+ ```bash
16
+ # Generate all 10 plot types (default: JPG output)
17
+ python -m marm_viz /path/to/recording_folder
18
+
19
+ # Single plot type
20
+ python -m marm_viz /path/to/recording_folder --plot ethogram
21
+
22
+ # Vector output for Illustrator
23
+ python -m marm_viz /path/to/recording_folder --format svg
24
+ ```
25
+
26
+ ## Plot Types
27
+
28
+ | Flag | Output | Description |
29
+ |------|--------|-------------|
30
+ | `qc` | QC panels | 8-panel overview: head XY colored by depth/distance/angle/behavior + histograms |
31
+ | `heatmaps` | Category heatmaps | Per-category spatial occupancy + near-stimulus + overall occupancy + P(move) |
32
+ | `timeseries` | Stim proximity | Fraction near stimulus across time chunks + per-chunk heatmaps + pooled XY |
33
+ | `density` | 2D density | Smoothed occupancy density with contours |
34
+ | `behavior` | State usage + t-SNE | 80-state bar chart grouped by category + t-SNE centroid bubble plot |
35
+ | `ethogram` | Ethogram | Per-category binary raster for each animal across time |
36
+ | `transitions` | Transition matrix | 5x5 category transition probabilities (diagonal NaN'd) |
37
+ | `polar` | Head direction | Polar histogram of head angle relative to stimulus (near vs far) |
38
+ | `track` | Head tracks | Per-animal + merged XY trajectory line plots |
39
+ | `correlation` | Cagemate correlation | Pairwise Spearman correlation of 80-state usage vectors across time chunks |
40
+
41
+ ## CLI Options
42
+
43
+ ```
44
+ --plot TYPE Which plot to generate (default: all)
45
+ --format FMT Output format: jpg (default), svg, png, pdf
46
+ --output-dir DIR Output directory (default: <input>/marm_viz_output/)
47
+ --video STEM Only process this video stem
48
+ --type-to-use STR Only process videos whose filename contains STR (case-insensitive)
49
+ --verbose Print detailed diagnostic information
50
+ --fps N Frames per second (default: 60)
51
+ --chunk-minutes N Chunk size in minutes for time series (default: 5)
52
+ --radius-px N Near-stimulus radius in pixels (default: 120)
53
+ --augment Enable left/right flip augmentation
54
+ ```
55
+
56
+ ## Python API
57
+
58
+ ```python
59
+ from marm_viz import build_recording_set, plot_ethogram
60
+
61
+ data = build_recording_set("/path/to/folder")
62
+ fig = plot_ethogram(data, fps=60)
63
+ fig.savefig("ethogram.svg")
64
+ ```
65
+
66
+ ## License
67
+
68
+ MIT
@@ -0,0 +1,63 @@
1
+ """
2
+ marm_viz
3
+ ========
4
+
5
+ Visualization package for marm_behavior outputs. Loads the artifacts
6
+ written by the marm_behavior pipeline (edges_*.mat, depths_*.mat,
7
+ hlabel_*.csv) into a per-(video x animal) data structure and provides
8
+ a set of plotting routines for spatial, behavioural, and density
9
+ visualizations.
10
+
11
+ Quick-start (library use)::
12
+
13
+ from marm_viz import build_recording_set, plot_qc_panels
14
+ rs = build_recording_set('path/to/marm_behavior/folder')
15
+ fig = plot_qc_panels(rs)
16
+ fig.savefig('qc.png', dpi=150)
17
+
18
+ Quick-start (CLI)::
19
+
20
+ python -m marm_viz path/to/folder --plot qc
21
+ python -m marm_viz path/to/folder --plot heatmaps
22
+ python -m marm_viz path/to/folder --plot timeseries
23
+ python -m marm_viz path/to/folder --plot density --mid-color green
24
+ """
25
+
26
+ from .types import Recording, RecordingSet
27
+ from .collect.video_data import build_recording, build_recording_set
28
+ from .plot.qc_panels import plot_qc_panels
29
+ from .plot.category_heatmaps import (
30
+ plot_category_fraction_heatmaps,
31
+ plot_xy_occupancy_heatmap,
32
+ plot_stay_move_heatmaps,
33
+ )
34
+ from .plot.stim_time_series import plot_stim_proximity_time_series
35
+ from .plot.density_2d import plot_density_2d
36
+ from .plot.behavior_overview import plot_state_usage, plot_tsne_centroids
37
+ from .plot.ethogram import plot_ethogram
38
+ from .plot.behavior_detail import (
39
+ plot_transition_matrix,
40
+ plot_head_direction_polar,
41
+ )
42
+ from .plot.correlation import plot_cagemate_correlation
43
+
44
+ __all__ = [
45
+ "Recording",
46
+ "RecordingSet",
47
+ "build_recording",
48
+ "build_recording_set",
49
+ "plot_qc_panels",
50
+ "plot_category_fraction_heatmaps",
51
+ "plot_xy_occupancy_heatmap",
52
+ "plot_stay_move_heatmaps",
53
+ "plot_stim_proximity_time_series",
54
+ "plot_density_2d",
55
+ "plot_state_usage",
56
+ "plot_tsne_centroids",
57
+ "plot_ethogram",
58
+ "plot_transition_matrix",
59
+ "plot_head_direction_polar",
60
+ "plot_cagemate_correlation",
61
+ ]
62
+
63
+ __version__ = "0.1.0"