OxIonics / ionics_fits

Small python fitting library with an emphasis on Atomic Molecular and Optical Physics
Apache License 2.0
0 stars 0 forks source link

Expand test coverage #47

Open AUTProgram opened 1 year ago

AUTProgram commented 1 year ago

There is currently at least one test (test_power_a) where the combination of floated parameters is not actually picked up by the estimate_parameters function of the model. We need to check if this is the only test where this is the case and fix them all.

hartytp commented 1 year ago

Agreed: we should expand the test coverage to cover every heuristic path.

It would also be good to get some tests which use noisy, sparsely-sampled data rather than relying on the noise-free, uniformly-sampled data we have in these tests. We did some of this kind of testing when developing the original fit functions (e.g. checking how FFT-based heuristics behave with sparsely-sampled data) but they never made it into the test suite.

It would also be nice to have some data which is not generated from exactly the same model we're fitting to -- e.g. real lab data where the model is a reasonable approximation of the underlying distribution, but there are still some noticeable systematics. We should still expect robust fits in this case.

A related question is more generally what we want to do about testing heuristics. At present we just check that the fit converges and take a view that "heuristics working means they get us close enough for the main solver to pass." That's a pretty decent functional definition, however it allows for the possibility that heuristics are considered working when they functioning as intended but aren't sufficiently broken to cause the fit to fail to converge. That seems rather unsatisfactory and allows bugs to hide undetected. Ideally we would have some tests specific to heuristics.

That is probably easy to implement but we need to decide what we want first. IME it's hard to put a tolerance on heuristics that is tight enough to catch errors but not so tight that they fail regularly. I'm not sure what the best approach here is.

hartytp commented 6 months ago

would be nice to set some heuristic tolerances as well. That will catch gross errors in the heuristics

hartytp commented 6 months ago