# yeticheese/thetagammaanalysis-yeticheese architecture

> Architecture diagram of the GitHub repository yeticheese/thetagammaanalysis-yeticheese, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yeticheese/thetagammaanalysis-yeticheese
- Repository: https://github.com/yeticheese/thetagammaanalysis-yeticheese

## Overview

Theta Gamma Analysis is a Python research toolkit for analyzing hippocampal signals and theta–gamma coupling. Its documented workflow is notebook-led: researchers extract theta signals, detect cycles, inspect frequency–phase plots, and batch-process trials. The source supports a batch coordinator that discovers trial files and dispatches supplied processing functions, signal-processing classes, REM/state and cycle analysis, and HDF5/CSV-oriented dataset helpers. Some notebook and batch internals are unsampled, so the graph shows only documented or source-supported links and omits uncertain wiring.

Main entry points: [`src/signal.py`](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/signal.py) (Signal processing), [`src/utils.py`](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/utils.py) (Batch dispatch), [`src/process_functions.py`](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/process_functions.py) (Dataset export), [`notebooks/Tutorial_4_Batch Analysis.ipynb`](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/notebooks/Tutorial_4_Batch%20Analysis.ipynb) (Batch tutorials)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_batch["Batch workflow"]
  node_batch_tutorials["Batch tutorials"]
  node_file_discovery["File discovery<br/>[utils.py]"]
  node_batch_dispatch["Batch dispatch<br/>[utils.py]"]
  node_mat_inputs["HPC and states"]
  node_trial_models["Trial models<br/>[Trial.py]"]
  node_dataset_notebook["Dataset builder"]
end

subgraph group_signal["Signal analysis"]
  node_signal_processor["Signal processing<br/>[signal.py]"]
  node_emd_analysis["EMD analysis<br/>[signal.py]"]
  node_theta_split["Band splitting<br/>[functions.py]"]
  node_state_segments["State segmentation<br/>[functions.py]"]
  node_cycle_detection["Cycle detection<br/>[functions.py]"]
  node_theta_tutorial["Theta tutorial"]
  node_cycle_tutorial["Cycle tutorial"]
end

subgraph group_metrics["Analysis outputs"]
  node_cycle_features["Cycle features<br/>[signal.py]"]
  node_fpp_analysis["Frequency phase plots<br/>[functions.py]"]
  node_dataset_build["Dataset building<br/>[signal.py]"]
  node_fpp_tutorial["Frequency phase tutorial"]
end

subgraph group_storage["Data persistence"]
  node_hdf5_io["HDF5 helpers<br/>[utils.py]"]
  node_dataset_export["Dataset export"]
  node_hdf5_files[("HDF5 data")]
  node_csv_output["CSV output"]
end

node_researcher(("Researcher"))

node_researcher -->|"uses"| node_theta_tutorial
node_researcher -->|"uses"| node_cycle_tutorial
node_researcher -->|"uses"| node_fpp_tutorial
node_researcher -->|"uses"| node_batch_tutorials
node_researcher -->|"uses"| node_dataset_notebook
node_batch_tutorials -->|"invokes"| node_file_discovery
node_dataset_notebook -->|"invokes"| node_file_discovery
node_file_discovery -->|"passes files"| node_batch_dispatch
node_mat_inputs -->|"loads"| node_batch_dispatch
node_batch_dispatch -->|"dispatches"| node_signal_processor
node_batch_dispatch -->|"dispatches"| node_state_segments
node_trial_models -->|"extends"| node_signal_processor
node_signal_processor -->|"computes"| node_emd_analysis
node_signal_processor -->|"splits bands"| node_theta_split
node_signal_processor -->|"detects cycles"| node_cycle_detection
node_signal_processor -->|"extracts"| node_cycle_features
node_signal_processor -->|"bins power"| node_fpp_analysis
node_signal_processor -->|"builds dataset"| node_dataset_build
node_cycle_features -->|"provides cycles"| node_fpp_analysis
node_dataset_build -->|"exports data"| node_dataset_export
node_dataset_export -->|"writes"| node_csv_output
node_dataset_export -->|"writes"| node_hdf5_files
node_hdf5_io -->|"reads and writes"| node_hdf5_files

click node_batch_tutorials "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/notebooks/Tutorial_4_Batch%20Analysis.ipynb"
click node_file_discovery "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/utils.py"
click node_batch_dispatch "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/utils.py"
click node_trial_models "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/Trial.py"
click node_signal_processor "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/signal.py"
click node_emd_analysis "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/signal.py"
click node_theta_split "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/functions.py"
click node_state_segments "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/functions.py"
click node_cycle_detection "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/functions.py"
click node_cycle_features "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/signal.py"
click node_fpp_analysis "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/functions.py"
click node_dataset_build "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/signal.py"
click node_hdf5_io "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/utils.py"
click node_dataset_export "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/process_functions.py"
click node_theta_tutorial "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/notebooks/Tutorial_1_Theta_Signal_Extraction.ipynb"
click node_cycle_tutorial "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/notebooks/Tutorial_2_Cycle_Detection.ipynb"
click node_fpp_tutorial "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/notebooks/Tutorial_3_Frequency_Phase_Plots.ipynb"
click node_dataset_notebook "https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/notebooks/Dataset_Builder_Notebook.ipynb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_batch_tutorials,node_file_discovery,node_batch_dispatch,node_mat_inputs,node_trial_models,node_dataset_notebook toneBlue
class node_signal_processor,node_emd_analysis,node_theta_split,node_state_segments,node_cycle_detection,node_theta_tutorial,node_cycle_tutorial toneAmber
class node_cycle_features,node_fpp_analysis,node_dataset_build,node_fpp_tutorial toneMint
class node_hdf5_io,node_dataset_export,node_hdf5_files,node_csv_output toneRose
class node_researcher toneIndigo
```

## Components

### Batch workflow

- [Batch tutorials](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/notebooks/Tutorial_4_Batch%20Analysis.ipynb): `notebooks/Tutorial_4_Batch Analysis.ipynb`
- [File discovery](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/utils.py): `src/utils.py`
- [Batch dispatch](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/utils.py): `src/utils.py`
- **HPC and states**
- [Trial models](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/Trial.py): `src/Trial.py`
- [Dataset builder](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/notebooks/Dataset_Builder_Notebook.ipynb): `notebooks/Dataset_Builder_Notebook.ipynb`

### Signal analysis

- [Signal processing](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/signal.py): `src/signal.py`
- [EMD analysis](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/signal.py): `src/signal.py`
- [Band splitting](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/functions.py): `src/functions.py`
- [State segmentation](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/functions.py): `src/functions.py`
- [Cycle detection](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/functions.py): `src/functions.py`
- [Theta tutorial](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/notebooks/Tutorial_1_Theta_Signal_Extraction.ipynb): `notebooks/Tutorial_1_Theta_Signal_Extraction.ipynb`
- [Cycle tutorial](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/notebooks/Tutorial_2_Cycle_Detection.ipynb): `notebooks/Tutorial_2_Cycle_Detection.ipynb`

### Analysis outputs

- [Cycle features](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/signal.py): `src/signal.py`
- [Frequency phase plots](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/functions.py): `src/functions.py`
- [Dataset building](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/signal.py): `src/signal.py`
- [Frequency phase tutorial](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/notebooks/Tutorial_3_Frequency_Phase_Plots.ipynb): `notebooks/Tutorial_3_Frequency_Phase_Plots.ipynb`

### Data persistence

- [HDF5 helpers](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/utils.py): `src/utils.py`
- [Dataset export](https://github.com/yeticheese/thetagammaanalysis-yeticheese/blob/main/src/process_functions.py): `src/process_functions.py`
- **HDF5 data**
- **CSV output**

### Other components

- **Researcher**

## Connections

- Researcher → Theta tutorial: uses
- Researcher → Cycle tutorial: uses
- Researcher → Frequency phase tutorial: uses
- Researcher → Batch tutorials: uses
- Researcher → Dataset builder: uses
- Batch tutorials → File discovery: invokes
- Dataset builder → File discovery: invokes
- File discovery → Batch dispatch: passes files
- HPC and states → Batch dispatch: loads
- Batch dispatch → Signal processing: dispatches
- Batch dispatch → State segmentation: dispatches
- Trial models → Signal processing: extends
- Signal processing → EMD analysis: computes
- Signal processing → Band splitting: splits bands
- Signal processing → Cycle detection: detects cycles
- Signal processing → Cycle features: extracts
- Signal processing → Frequency phase plots: bins power
- Signal processing → Dataset building: builds dataset
- Cycle features → Frequency phase plots: provides cycles
- Dataset building → Dataset export: exports data
- Dataset export → CSV output: writes
- Dataset export → HDF5 data: writes
- HDF5 helpers → HDF5 data: reads and writes
