- Convert an input equation and variable measurements into LaTeX that shows:
- evaluated central value (
mu) - uncertainty propagation (
sigma) - optional derivative/substitution steps
- evaluated central value (
parse_inputs()insrc/uncertainty_calculator/parsers.pyvalidate_inputs()insrc/uncertainty_calculator/validation.pycompute()insrc/uncertainty_calculator/compute.pyrender_output()insrc/uncertainty_calculator/render.py
Keep logic in the right layer. Prefer extending an existing stage over mixing concerns across modules.
- Preserve behavior and signatures of:
Equation,Variable,DigitsUncertaintyCalculatorandUncertaintyCalculator.run()
- Keep exports in
src/uncertainty_calculator/__init__.pyconsistent.
parsers.py: normalize and map inputs into SymPy-friendly structures.validation.py: reject undefined or invalid symbolic references.compute.py: derivatives and numeric uncertainty propagation.render.py: LaTeX structure/format (combined vs separate, insert vs non-insert).format.py: SymPy-to-LaTeX helper wrappers only.
- Maintain parity-sensitive output behavior unless explicitly changing product behavior.
- When changing rendering/computation, add or update focused tests in
tests/. - Keep tests deterministic and aligned with legacy parity expectations (
tests/legacy_calculator.py).
Always activate the project environment before running commands:
source .venv/bin/activate
pre-commit run --all-files
pytest -n auto --dist=loadscope tests/Use Python 3.12 assumptions from pyproject.toml.