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
400 stars 131 forks source link

Remove repeated code in sensor #732

Closed gawebb-dstl closed 1 year ago

gawebb-dstl commented 1 year ago

I've abstracted the measure function in the radar & passive sensor. A smaller is_detectable function is used, which reuses far less code. It also leaves the door open for the probability of detection to be stochastic

codecov[bot] commented 1 year ago

Codecov Report

Base: 94.79% // Head: 94.76% // Decreases project coverage by -0.03% :warning:

Coverage data is based on head (b03afc7) compared to base (e5955f6). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #732 +/- ## ========================================== - Coverage 94.79% 94.76% -0.04% ========================================== Files 168 168 Lines 8190 8134 -56 Branches 1560 1198 -362 ========================================== - Hits 7764 7708 -56 Misses 317 317 Partials 109 109 ``` | Flag | Coverage Δ | | |---|---|---| | integration | `69.47% <94.91%> (+0.09%)` | :arrow_up: | | unittests | `92.57% <100.00%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/dstl/Stone-Soup/pull/732?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl) | Coverage Δ | | |---|---|---| | [stonesoup/sensor/passive.py](https://codecov.io/gh/dstl/Stone-Soup/pull/732/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL3NlbnNvci9wYXNzaXZlLnB5) | `100.00% <100.00%> (ø)` | | | [stonesoup/sensor/radar/radar.py](https://codecov.io/gh/dstl/Stone-Soup/pull/732/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL3NlbnNvci9yYWRhci9yYWRhci5weQ==) | `94.50% <100.00%> (-1.52%)` | :arrow_down: | | [stonesoup/sensor/sensor.py](https://codecov.io/gh/dstl/Stone-Soup/pull/732/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL3NlbnNvci9zZW5zb3IucHk=) | `97.01% <100.00%> (+1.89%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

sdhiscocks commented 1 year ago

Looks like this should also resolve #629 for current sensors.