Re #7494. Improve handling of error conditions.
Re #7494. Add tests that don't load data files.
Re #7494. Small tidy-ups in the algorithm.

Mostly the addition of const in several places.
Merge branch 'feature/7494_moderatorTZeroLinear_tidyups' into develop