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
411 stars 138 forks source link

Iterating over StateVectors #673

Closed jmbarr closed 2 years ago

jmbarr commented 2 years ago

You may wish to do:

for a_state_vector in state_vectors: do some operation on a_state_vector

For a set of StateVector in a StateVectors object.

But currently that doesn't work - you get an array of each state vector element for all 'particles'. To get an individual state vector you need to do for a_state_vector in state vectors.T: and then cast a_state_vector to the StateVector type.

Could/should we overwrite the __iter__() method in StateVectors so it does the sensible thing of running through the state vectors by default?

sdhiscocks commented 2 years ago

Completed in #677