hpfracc.validation โ architecture, dependencies, and maintenance๏
This note complements CONTRIBUTING.md, UTILS_ARCHITECTURE.md, BENCHMARKS_ARCHITECTURE.md, and SOLVERS_ARCHITECTURE.md. It maps validation modules, naming collisions with other packages, and tests / scripts.
1. Design goals๏
Reference checks for numerical methods: known analytical expressions, convergence studies over grid refinement, and benchmark suites (accuracy / performance).
No import cycles into core engines:
validationmay usehpfracc.utils(ErrorAnalyzer); it does not need to be imported byalgorithmsorcoreat startup.Explicit disambiguation from similarly named types elsewhere in the repo (see ยง4).
2. Module layout๏
File |
Responsibility |
|---|---|
|
|
|
|
|
|
|
Re-exports the public surface listed in |
3. Dependency edges๏
flowchart LR
VAL["hpfracc.validation"]
UTILS["hpfracc.utils.error_analysis"]
VAL --> UTILS
convergence_testsโ..utils.error_analysis(ErrorAnalyzerfor norms / errors).analytical_solutions/method_benchmarksโ standard scientific stack (NumPy, SciPy where used, psutil in benchmarks).
Intended: no validation โ algorithms / core imports at module level (keeps optional validation off the critical import path for derivative engines).
4. Naming collisions (read carefully)๏
Name here |
Also exists in |
Relation |
|---|---|---|
|
|
Different roles. Validation class orchestrates |
|
|
Different modules. BENCHMARKS_ARCHITECTURE.md describes the split; validation code is for method comparison in validation workflows, not the numerical |
|
Module function in |
Signatures differ by design; do not assume interchangeability. |
5. Entry points (scripts / tests)๏
scripts/run_validation_suite.py,scripts/run_comprehensive_validation.pyโ orchestrate imports fromhpfracc.validation.Tests:
tests/test_validation/, plustests/test_validation.pyand references intests/test_additional_coverage.py.
python -m pytest tests/test_validation/ tests/test_validation.py -q
6. Risks and mitigations๏
Risk |
Mitigation |
|---|---|
Legacy |
Use |
Confusing โbenchmarksโ |
Prefer |
Heavy or flaky CI |
Full validation suites may be slow; gate behind scripts or markers if you split CI later. |
ConvergenceTester calling convention: test_convergence passes the grid as the first positional argument x to method_func / analytical_func. Entries named x are removed from test_params before **test_params is applied, so a pre-filled x in the dict does not collide with the positional grid. Other parameter names (e.g. a second positional requirement in a mock) are the callerโs responsibility.