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.
See https://3.basecamp.com/5595649/buckets/32341364/todos/8649700954 for discussion
I added a new xrutils function for memory and cpu-efficient multiplication of large matrices. xrutils.chunked_eff_xr_matmult performs the mutliplication using numpy only, chunks up the data and streams chunks to disk, before it reassembles everything and puts it back into an xarray. The output should be identical to xarrayA @ xarrayB, but less hard on memory and cpu overhead.
This function is then used in the updated forward_model.apply_inv_sensitivity function whenever timeseries data with more than 1000 samples is handed in, which can however be force-skipped by setting the optional "chunk" flag to false (true by default).
I did some testing on the output of both the conventional and new chunked conversion, and (ignoring very small floating point errors) both yield the same result.
Maybe its a quick review and you can merge it, otherwise this has time until later