PolyPESTO Development Assistant
Expert assistance for working with PolyPESTO, a parameter estimation package for polymerization data using PyPESTO.
What This Skill Does
This skill provides comprehensive guidance for developing with the PolyPESTO framework, including:
Setting up the development environmentRunning tests and debuggingUnderstanding the architecture and design patternsAdding new polymerization modelsRunning parameter estimation workflowsWorking with SBML and AMICI integrationInstructions
When helping users work with PolyPESTO, follow these guidelines:
1. Development Environment Setup
For installation tasks:
Install in development mode using `pip install -e .`Verify dependencies are available: pypesto[amici,petab,fides], python-libsbml, h5pyCheck for visualization tools: plotly, matplotlib, seabornConfirm pytest and pytest-cov are installed for testing2. Testing Workflow
When running or writing tests:
Use `pytest` to run the full test suiteFor specific tests, use `pytest tests/path/to/specific_test.py` or `pytest -k "test_name_pattern"`Reference test fixtures in `tests/conftest.py`Test models include "BinaryIrreversible" and "LotkaVolterra"Tests use parameterized fixtures for different model types3. Architecture Understanding
When explaining or working with the codebase structure:
**polypesto.core** — Central framework components:
`Study` src/polypesto/core/study.py: Main class for managing parameter estimation studies across multiple problems and parameter sets`Problem` src/polypesto/core/problem.py: Individual optimization problems with model, data, and parameter definitions`experiment.py` src/polypesto/core/experiment.py: Experimental data handling`conditions.py` src/polypesto/core/conditions.py: Simulation condition management`params.py` src/polypesto/core/params.py: Parameter group and set definitions`petab.py` src/polypesto/core/petab.py: Integration with PEtab standard`pypesto/` src/polypesto/core/pypesto/: PyPESTO integration utilities**polypesto.models** — Model definitions:
`ModelBase` src/polypesto/models/base.py: Abstract base class for all models`binary/` src/polypesto/models/binary/: Binary polymerization models`example/` src/polypesto/models/example/: Example models like Lotka-Volterra`sbml.py` src/polypesto/models/sbml.py: SBML model utilitiesModels automatically generate AMICI models in `amici_models/` directory**polypesto.visualization** — Plotting and visualization utilities:
Modular visualization components for different analysis typesIntegration with plotly, matplotlib, and seaborn**polypesto.utils** — Utility functions:
`file.py`: JSON I/O utilities`logging.py`: Logging configuration`patches.py`: Compatibility patches4. Adding New Models
When creating new polymerization models:
1. Create a new model class inheriting from `ModelBase` in `src/polypesto/models/`
2. Implement required abstract methods for SBML definition
3. Add observables and parameter definitions following existing patterns
4. Test the new model using existing test framework fixtures in `tests/conftest.py`
5. Models should define chemical kinetics via SBML
6. Ensure AMICI models are generated correctly in `amici_models/` directory
5. Parameter Estimation Workflows
When working with parameter estimation:
Study objects coordinate parameter estimation across multiple problemsProblems contain model + data + parameter boundsPyPESTO performs the optimizationResults are stored and visualized through dedicated modulesReference example scripts in `src/polypesto/examples/` for typical workflows6. Key Design Patterns
Be aware of these patterns when reading or modifying code:
Models inherit from `ModelBase` and define SBML representationsStudy objects manage collections of problems with different parameter setsType aliases used extensively for complex nested dictionaries (e.g., `ProbParamDict`)AMICI integration provides efficient simulation and sensitivity analysis7. Data Flow
Understand the typical data flow:
1. Models define chemical kinetics via SBML
2. Study objects coordinate parameter estimation across multiple problems
3. Problems contain model + data + parameter bounds
4. PyPESTO performs optimization
5. Results stored and visualized through dedicated modules
Examples
**Running tests:**
```bash
Full test suite
pytest
Specific test file
pytest tests/test_models.py
Test by pattern
pytest -k "test_binary"
```
**Installing in development mode:**
```bash
pip install -e .
```
**Checking example workflows:**
Look in `src/polypesto/examples/` for reference implementations.
Important Notes
Always install in development mode (`pip install -e .`) when working on the codebaseTest fixtures are centralized in `tests/conftest.py` — use them for consistencyAMICI models are auto-generated — don't manually edit files in `amici_models/`Follow existing model patterns when adding new chemical kinetics modelsType hints and aliases are used extensively — respect them when adding new code