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

Remove `hasattr` in Measures to avoid calling `mean` twice #680

Closed sdhiscocks closed 2 years ago

sdhiscocks commented 2 years ago

This is in particular an issue with Particle States as calculating the mean can be costly.

codecov[bot] commented 2 years ago

Codecov Report

Merging #680 (af1213d) into main (f36afad) will increase coverage by 0.01%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #680      +/-   ##
==========================================
+ Coverage   94.59%   94.61%   +0.01%     
==========================================
  Files         168      168              
  Lines        8516     8504      -12     
  Branches     1652     1646       -6     
==========================================
- Hits         8056     8046      -10     
+ Misses        342      341       -1     
+ Partials      118      117       -1     
Flag Coverage Δ
integration 68.67% <66.66%> (+0.07%) :arrow_up:
unittests 92.10% <100.00%> (+0.01%) :arrow_up:

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

Impacted Files Coverage Δ
stonesoup/measures.py 98.79% <100.00%> (+1.95%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f36afad...af1213d. Read the comment docs.