dstl / Stone-Soup

A software project to provide the target tracking community with a framework for the development and testing of tracking algorithms.
https://stonesoup.rtfd.io
MIT License
403 stars 134 forks source link

Add caching of mean and covar on ParticleState #686

Closed sdhiscocks closed 2 years ago

sdhiscocks commented 2 years ago

This has significant performance improvements, for the trade off of limiting editing to state vector and weight of the ParticleState. However, they can still be replaced with another array, clearing the cache.

Minor issue is use of standard library functools.cached_property is only available from Python 3.8, so to maintain compatibility with Python 3.7, cached_property code snippet is also included.

codecov[bot] commented 2 years ago

Codecov Report

Merging #686 (e6b3b49) into main (bfbe6ec) will increase coverage by 0.02%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #686      +/-   ##
==========================================
+ Coverage   94.60%   94.63%   +0.02%     
==========================================
  Files         170      171       +1     
  Lines        8548     8575      +27     
  Branches     1654     1659       +5     
==========================================
+ Hits         8087     8115      +28     
+ Misses        342      339       -3     
- Partials      119      121       +2     
Flag Coverage Δ
integration 68.52% <81.81%> (+<0.01%) :arrow_up:
unittests 92.15% <100.00%> (+0.03%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
stonesoup/types/_util.py 100.00% <100.00%> (ø)
stonesoup/types/state.py 99.39% <100.00%> (-0.61%) :arrow_down:
stonesoup/plotter.py 96.03% <0.00%> (+1.48%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.