Data analysis and visualization package for Ethopy behavioral experiments
Project description
Ethopy Analysis
A comprehensive Python package for analyzing and visualizing behavioral data from Ethopy experiments.
๐ Documentation
Overview
Ethopy Analysis provides a modern, modular approach to behavioral data analysis with the following key features:
- DataFrame-based: Most of plotting functions work with pandas DataFrames, making them independent of data source
- Modular Design: Composable functions for different analysis levels (animal, session, comparison)
- DataJoint-based: Works with DataJoint databases and provides DataFrame interfaces
- Extensible: Modular function-based architecture for easy extension
- Production Ready: Command-line interface, proper packaging, and configuration management
Installation
From Source (Development)
Setting Up a Virtual Environmentยถ
Before installing dependencies, it's recommended to use a virtual environment to keep your project isolated and manageable.
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
installing dependencies:
# Clone the repository
git clone <repository-url>
cd ethopy_analysis
# Install in development mode
pip install -e .
Dependencies
- pandas >= 1.3.0
- matplotlib >= 3.5.0
- seaborn >= 0.11.0
- numpy >= 1.20.0
- plotly >= 5.0.0
- datajoint >= 0.13.0 (for database access)
- click >= 8.0.0 (for CLI)
Package Structure
ethopy-analysis/
โโโ src/ethopy_analysis/
โ โโโ data/ # Data loading and processing
โ โ โโโ loaders.py # DB loaders: sessions, trials, states,
โ โ โ # licks, proximity, state windows,
โ โ โ # ON-OFF pairs, per-trial raster data
โ โ โโโ analysis.py # Derived metrics: performance,
โ โ โ # port-exit-to-lick latency, summaries
โ โ โโโ utils.py # Utilities: consecutive runs,
โ โ # column mapping, group helpers
โ โโโ plots/ # Plotting functions (DataFrame-based)
โ โ โโโ animal.py # Animal-level plots across sessions
โ โ โโโ session.py # Session-level plots: licks, proximity,
โ โ โ # states, trial-events raster
โ โ โโโ comparison.py # Multi-animal/condition comparisons
โ โ โโโ utils.py # Plotting utilities
โ โโโ db/ # Database connectivity
โ โ โโโ schemas.py # DataJoint schema management and caching
โ โโโ config/ # Configuration management
โ โ โโโ settings.py # Config loading: ethopy_config.json,
โ โ โ # dj_conf.json, EthoPy local_conf.json,
โ โ โ # and environment variables
โ โ โโโ styles.py # Plot style presets
โ โ โโโ interactive.py # Interactive credential prompts
โ โโโ cli.py # Command-line interface
โโโ examples/ # Example notebooks
โ โโโ load_example.ipynb # Data loading walkthrough
โ โโโ animal_analysis_example.ipynb # Animal-level analysis
โ โโโ session_analysis_example.ipynb # Session-level analysis incl.
โ # proximity, state windows, raster plot
โโโ docs/ # Documentation
โโโ pyproject.toml # Package configuration
โโโ README.md
Configuration
Already using EthoPy?
If EthoPy is installed, ethopy-analysis automatically reads ~/.ethopy/local_conf.json โ
no extra setup needed.
Other options
| Method | How |
|---|---|
| Config file | Create ethopy_config.json in the project root (see docs/configuration.md) |
| Environment variables | export DJ_HOST=โฆ DJ_USER=โฆ DJ_PASSWORD=โฆ |
| Interactive | Run any loader โ credentials are prompted if nothing else is found |
See docs/configuration.md for the full priority order and format reference.
Examples and Tutorials
Check out the examples/ directory for comprehensive notebooks:
load_example.ipynb: Comprehensive animal-level analysisanimal_analysis_example.ipynb: Comprehensive animal-level analysissession_analysis_example.ipynb: Detailed session-level analysis
Contributing
Adding New Plot Functions
- Create your plotting function in the appropriate module
- Follow the DataFrame-based input convention
- Return
(fig, ax)or(fig, axes)tuple - Import and use directly in your analysis
Code Style
- Functions over classes where possible
- Clear, descriptive function names
- Pandas DataFrames for data exchange
- Matplotlib for plotting (with optional Plotly support)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ethopy_analysis-0.1.3.tar.gz.
File metadata
- Download URL: ethopy_analysis-0.1.3.tar.gz
- Upload date:
- Size: 5.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a55d05ab2e12af049194c4ef5dedbf879368359be36b617ca57ca8855331b5b
|
|
| MD5 |
ae22f6571fd7fbe3f70d9cceff10793c
|
|
| BLAKE2b-256 |
c04fe748457286de5ef51d3f3574f87d18c58e42a392676276401723e8342d7f
|
File details
Details for the file ethopy_analysis-0.1.3-py3-none-any.whl.
File metadata
- Download URL: ethopy_analysis-0.1.3-py3-none-any.whl
- Upload date:
- Size: 57.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
630dabc9bb0f661ce5cf2aa3ac42a973d495f2e5d43ba799270ace9a0f5dcdb1
|
|
| MD5 |
683c3172ebbce21912e0bbdaad2365bb
|
|
| BLAKE2b-256 |
ec3251cf1eb2e85ece0bea425152605421c9ae92d4b6a1e53c2ab85feab43a2f
|