This file provides context for AI coding agents (GitHub Copilot, Claude, Codex, etc.) and new contributors working on this codebase.
AutoEmulate is a Python package that automatically fits and compares emulators (surrogate models) to replace slow simulations.
Key concepts:
- Emulator — a fast, data-driven proxy for a slow simulation
- AutoEmulate core — fits multiple emulators, cross-validates, and surfaces the best one
- Calibration — infers simulation parameters from data
- Sensitivity analysis — finds which inputs drive simulation outputs
- Active learning — chooses which simulations to run next
This project uses uv as the package manager.
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create a virtual environment and install all dependencies (including dev extras)
uv sync --extra dev
# Activate the environment
source .venv/bin/activate# Run the full test suite
uv run pytest
# Run a specific test file
uv run pytest tests/core/
# Run with coverage
uv run pytest --cov=autoemulate
# Apple Silicon (M-series) — some GP tests require MPS fallback to CPU
PYTORCH_ENABLE_MPS_FALLBACK=1 uv run pytest -q# Run pre-commit hooks (ruff, pyright, nbstripout)
uv run pre-commit run --all-filesPre-commit is enforced in CI on every PR — run it locally before pushing to catch failures early.
autoemulate/
├── autoemulate/
│ ├── core/ # AutoEmulate main class and cross-validation logic
│ ├── emulators/ # Individual emulator implementations (GP, SVM, RBF, etc.)
│ ├── calibration/ # Calibration methods
│ ├── data/ # Data handling and splitting utilities
│ ├── transforms/ # Input/output transforms (normalisation, PCA, etc.)
│ ├── learners/ # Active learning strategies
│ ├── datasets/ # Built-in simulation datasets for testing/demos
│ ├── simulations/ # Simple simulation wrappers
│ ├── callbacks/ # Training/fitting callbacks
│ └── feature_generation/ # Feature engineering utilities
├── tests/ # pytest test suite, mirrors autoemulate/ structure
├── docs/ # Sphinx + MyST documentation
└── case_studies/ # Jupyter notebooks for real-world use cases
See the adding emulators guide. In short:
- Create a new file in
autoemulate/emulators/ - Subclass
Emulator(or one of its subclasses, e.g.DeterministicEmulator/ProbabilisticEmulator, inautoemulate/emulators/base.py) and implement the required methods (__init__,_fit,_predict, etc.) - Register it via the
Registry/registermechanism inautoemulate/emulators/registry.py - Add tests in
tests/emulators/
Use NumPy-style docstrings throughout:
def fit(self, X: np.ndarray, y: np.ndarray) -> "MyEmulator":
"""Fit the emulator to training data.
Parameters
----------
X : np.ndarray of shape (n_samples, n_features)
Input simulation parameters.
y : np.ndarray of shape (n_samples,) or (n_samples, n_outputs)
Simulation outputs.
Returns
-------
self : MyEmulator
Fitted estimator.
"""- Tests pass:
uv run pytest -q - Pre-commit hooks pass:
uv run pre-commit run --all-files - New public functions have NumPy docstrings
- If adding an emulator: registered via the
Registry/registermechanism and tested
Questions? Reach the team at ai4physics@turing.ac.uk or open a GitHub issue.