Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains re-writes of the caching objects for better efficiency. The most significant change is the removal of calls to
numpy.linalg.solve
, which will fix the performance issues in #233. There are a few other improvements, and the new low-level cython interpolation utilities in raysect are now used to generate the coefficient arrays for interpolating between cached sampled points instead of duplicating the code in Cherab.This PR is initially marked as a draft to get some feedback on the implementation of the 1D caching object: once the implementation details for that are approved I'll apply them to the 2D and 3D objects too.
The caching objects are essentially on-demand samplers and interpolators. They have a number of small but important differences to the raysect interpolators:
function_boundaries
argument for the user to specify these bounds and normalise the results to mitigate against numerical issues. This seems error prone to me: it's all too easy to get the bounds wrong and end up with some incorrect normalisation. Whether this is detrimental to the accuracy or not is unclear to me (after all, the results are un-normalised before being returned), but I'm currently inclined to drop support for this for the sake of simplicity.I'm happy to receive feedback on these design decisions.