Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true -diff
151 changes: 151 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Pixi
.pixi/
!.pixi/config.toml
build/
*.conda
output/
linux-64/
noarch/
osx-amd64/
public/

# Virtual environments
venv/
env/
ENV/
.venv

# Python
**/__pycache__/
**/*.egg-info/
*.py[codz]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Testing
.pytest_cache/
coverage/
.coverage
.coverage.*
.tox/
.nox/
htmlcov/
cobertura_report.xml
junit_report.xml
nosetests.xml
*.cover
*.py.cover
.hypothesis/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py


# Documentation building
docDir
htmldoc
doc/doc_src/snippets/*.md
doc/doc_src/doc

# MACOS
.DS_Store

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

# Abstra
# Abstra is an AI-powered process automation framework.
# Ignore directories containing user credentials, local state, and settings.
# Learn more at https://abstra.io/docs
.abstra/


# PyPI configuration file
.pypirc

#Ignore vscode AI rules
.github/instructions/codacy.instructions.md

# Type checking
.mypy_cache/
.dmypy.json
dmypy.json
.ruff_cache

# Generated files
*.png
*.jpg
*.pdf
*.csv
# include example_data.csv as example
!doc/doc_src/example_data/coffee_productivity.csv

# Jupyter
**/.ipynb_checkpoints/

# Cursor
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
# refer to https://docs.cursor.com/context/ignore-files
.cursorignore
.cursorindexingignore

# Marimo
marimo/_static/
marimo/_lsp/
__marimo__/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 PKoffee Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
90 changes: 86 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,93 @@
# pkoffee


Analysis for the paper _Quantifying the Relationship Between Coffee Consumption and Developer Productivity: An Observational Study_ by Jean Dupont, 2025
# PKoffee - Coffee Productivity Analysis

A Conda package implemented in python for analyzing the relationship between coffee consumption and productivity through statistical modeling and visualization.

Project inspired by _Le Café - Oldelaf_ for the S3 School 2026.

[![Le Café - Oldelaf - on YouTube](http://img.youtube.com/vi/UGtKGX8B9hU/0.jpg)](http://www.youtube.com/watch?v=UGtKGX8B9hU "Le Café - Oldelaf")


## Features

- **Data Analysis**: Load and analyze coffee consumption vs productivity datasets
- **Multiple Models**: Fit various mathematical models (quadratic, Michaelis-Menten, logistic, peak functions)
- **Visualization**: Beautiful violin plots with model overlays using Seaborn
- **Model Comparison**: Automatic R² scoring and ranking of models
- **Type-Safe**: Full type hints for better IDE support and code quality

## Installation

```bash
pixi install
```

## Quick Start

```python
from pathlib import Path
from pkoffee.data import load_csv
from pkoffee.productivity_analysis import fit_all_models
from pkoffee.visualization import plot_models

# Load your data
data = load_csv(Path("analysis/coffee_productivity.csv"))

# Fit models
fitted_models = fit_all_models(data)

# Create visualization
plot_models(data, fitted_models, output_path=Path("analysis/results.png"))
```

## Command Line Interface

```bash
# Analyze
cd analysis && pixi shell
# fit models and save to toml
pkoffee analyze --data-file coffee_productivity.csv --output fitted_models.toml --show-rankings
# plot models predictions
pkoffee plot --data-file coffee_productivity.csv --models fitted_models.toml --output analysis.png --y-max 7
```

## Project Structure

```
pkoffee-sol/
├── src/pkoffee/
│ ├── __init__.py # Python package
│ ├── cli.py # Command line interface
│ ├── data.py # Data loading utilities
│ ├── fit_model_io.py # Model writing/reading to file
│ ├── fit_model.py # Model definition and fitting
│ ├── log.py # Logging utilities
│ ├── metrics.py # Model evaluation metrics
│ ├── parametric_function.py # Mathematical models as parametric functions
│ ├── productivity_analysis.py # Coffee analysis
│ └── visualization.py # Plotting functions
├── README.md
├── pixi.toml
├── pixi.lock
└── pyproject.toml
```

## Models Implemented

1. **Quadratic**: `f(x) = a₀ + a₁x + a₂x²`
2. **Michaelis-Menten (Saturating)**: `f(x) = y₀ + Vₘₐₓ·x/(K + x)`
3. **Logistic**: `f(x) = y₀ + L/(1 + e^(-k(x - x₀)))`
4. **Peak**: `f(x) = a·x·e^(-x/b)`
5. **Peak2**: `f(x) = a·x²·e^(-x/b)`

## Development

```bash
# Activate the environment
pixi shell
# use development dependencies like jupyter notebooks/ipython
jupyterlab
```

## License

MIT License
File renamed without changes.
57 changes: 0 additions & 57 deletions main.py

This file was deleted.

Loading