Skip to main content

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.

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)
  • Database Agnostic: Works with DataJoint databases, CSV files, or any pandas-compatible data source
  • Extensible: Plugin system for custom plots and analysis functions
  • 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 Visualisations

# 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          # Main data loading functions
│   │   ├── analysis.py         # Data analysis functions
│   │   └── utils.py            # Data processing utilities
│   ├── plots/                  # Plotting functions (DataFrame-based)
│   │   ├── animal.py           # Animal-level plots
│   │   ├── session.py          # Session-level plots
│   │   ├── comparison.py       # Multi-animal/condition comparisons
│   │   └── utils.py            # Plotting utilities and plugin system
│   ├── db/                     # Database connectivity
│   │   ├── schemas.py          # Database schema management
│   │   └── utils.py            # Database utility functions
│   ├── config/                 # Configuration management
│   │   └── settings.py         # Configuration loading and validation
│   └── cli.py                  # Command-line interface
├── examples/                   # Example notebooks and scripts
│   ├── load_example.ipynb
│   ├── animal_analysis_example.ipynb
│   └── session_analysis_example.ipynb
├── pyproject.toml              # Package configuration
└── README.md

Configuration

Database Setup

Create a configuration file for database access:

ethopy-analysis create-config --output-path config.json

Edit the configuration file:

{
  "database": {
    "host": "your-database.org:3306",
    "user": "your_username",
    "password": "your_password",
    "schemas": {
      "experiment": "lab_experiments",
      "stimulus": "lab_stimuli",
      "behavior": "lab_behavior"
    }
  }
}

Environment Variables

Alternatively, use environment variables:

export DJ_HOST="database.example.org:3306"
export DJ_USER="your_username"
export DJ_PASSWORD="your_password"

Examples and Tutorials

Check out the examples/ directory for comprehensive notebooks:

  • load_example.ipynb: Comprehensive animal-level analysis
  • animal_analysis_example.ipynb: Comprehensive animal-level analysis
  • session_analysis_example.ipynb: Detailed session-level analysis

Contributing

Adding New Plot Functions

  1. Create your plotting function in the appropriate module
  2. Follow the DataFrame-based input convention
  3. Return (fig, ax) or (fig, axes) tuple
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ethopy_analysis-0.1.2.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ethopy_analysis-0.1.2-py3-none-any.whl (47.3 kB view details)

Uploaded Python 3

File details

Details for the file ethopy_analysis-0.1.2.tar.gz.

File metadata

  • Download URL: ethopy_analysis-0.1.2.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for ethopy_analysis-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f7c5fa96fd6f50eac723a7d80874b0b268fd4f95a1d4a3e241ce995e1a17bc1b
MD5 235a56fd032f99d1b03912e3f8ab0289
BLAKE2b-256 7aa4da27aab644d8205e2a59e2c0123433102c0d4935caa8849bf22f43f3124e

See more details on using hashes here.

File details

Details for the file ethopy_analysis-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ethopy_analysis-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8ddb3eaada03d442d00c8106e3c8f6fca3376b5eea6b531762da35ca5b5d48a2
MD5 834b2f8408246967a08fe203d6fa1f63
BLAKE2b-256 b138f4ed8ab2f5ea36c772f4bce7933b294181a57151d5dfdf01d75a67b53e6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page