ndtatbristol / arim

A Python library for array imaging in ultrasonic testing.
MIT License
23 stars 13 forks source link

Rays #2

Closed nbud closed 7 years ago

nbud commented 8 years ago

I refactored arim.im.Rays and a part of arim.im.FermatSolver. When computing rays, the rays are now assembled more efficiently thanks to the new function Rays.expand_rays which replaces assemble_rays. This new function was written in C++ and wrapped with Cython; so there is one numba function less in arim (a small step towards getting rid of numba).

This PR does not change the way the FermatSolver is called so the example script multiview_tfm.py is untouched.

Performance wise I did a quick benchmark using the following interfaces:

Interfaces:
        P:Probe                 128 points
        P:Frontwall             1000 points
        P:Backwall              1000 points
        P:Grid          80802 points

Computing the 21 views takes on my machine 38.2 s with the previous version and 34.8 s with the new. That's an improvement of 8.9%. The bottleneck of FermatSolver.solve() is still arim.im.find_minimal_times which takes 75% of the runtime; this could be improved some day with a more memory efficient implementation.

There is a regression: the memory footprint is bigger because the indices are always stored as uint32 whereas they were stored before in uint8/uint16 if possible. I didn't bother implementing this optimisation yet.

@rltb: do you have time for reviewing this PR? If yes, please send me any suggestion or comment. Thanks