Skip to content

danielelotito/project4projects

Repository files navigation

Python Project Template with Hydra

A template repository for Python projects using Hydra for configuration management, featuring data analysis, visualization capabilities, and a clean project structure.

Features

  • Configuration Management: Using Hydra for flexible and hierarchical configuration
  • Data Analysis: Sample data analyzer implementation with numpy
  • Visualization: Matplotlib-based visualization tools with multiple plot types
  • Testing: Pytest setup with coverage reporting
  • Code Quality: Pre-commit hooks for code formatting and quality checks
  • Clean Project Structure: Organized directory layout for scalable projects
  • Hierarchical Project Structure: Organized directory for project in which you first do some simulations with main_inner.py and then collect the results and analyze them with main_outer.py. Each level has its own config files. You can also simply use the inner level and delete main_outer.py and the config_outer folder.

Project Structure

├── config/                  # Main configuration files
│   ├── model/              # Model-specific configs
│   ├── save/               # Save settings
│   └── visualizations/     # Visualization configs
├── config_outer/           # Outer loop configuration
├── src/                    # Source code
│   ├── core.py            # Core functionality
│   ├── main_inner.py      # Inner loop main script
│   ├── main_outer.py      # Outer loop main script
│   └── visualization.py    # Visualization tools
├── tests/                  # Test files
└── utils/                  # Utility functions

Requirements

  • Python ≥ 3.10
  • Dependencies listed in pyproject.toml

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/project-name.git
cd project-name
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install the package and dependencies:
pip install -e ".[dev]"
  1. Set up pre-commit hooks:
pre-commit install

Usage

Running the Analysis

The project uses Hydra for configuration management. To run the analysis:

python src/main_inner.py

This will:

  • Create necessary output directories
  • Generate sample data matrices (Of course you will change this to your needs)
  • Produce visualizations based on configuration
  • Save results in the output directory

Configuration

The project uses a hierarchical configuration system:

  • config/config.yaml: Main configuration file
  • config/model/model_default.yaml: Model-specific settings
  • config/save/save_default.yaml: Save settings
  • config/visualizations/visualizations.yaml: Visualization options

Visualization Types

The project supports multiple visualization types, you can already see:

  • Sample heatmaps
  • Categorical distribution plots
  • Binary classification maps

These plots are used in the repository related to the statistical analysis of my card game Mascarpone!

Testing

Run tests with coverage (when you will implement them):

pytest

Contributing

You can share your own idea and customizations, feel free to

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Daniele Lotito - name dot surname 1[at] gmail

About

Template for datascience and simulation science projects in Python using hydra and hierarchical ordering of scripts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages