Cannot slice a track when StatesLengthLimiter is used
I'd like to use the StatesLengthLimiter wrapper for track initiation when processing a longer dataset. However, when I try slicing the resulting track, I receive this error:
Traceback (most recent call last): File "/Users/alexeynarykov/miniconda3/envs/godot_devel/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3526, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "
", line 1, in track_slice = next(iter(tracks))[1:] File "/Users/alexeynarykov/Workspace/GitHub/Stone-Soup-ESA/stonesoup/types/state.py", line 308, in getitem return StateMutableSequence(self.states.getitem(index)) TypeError: 'slice' object cannot be interpreted as an integer
An example based on '09_Initiators_&_Deleters.py' is provided here. The wrapper definition is on line 173 and slicing is attempted on line 213. When the wrapper definition is suppressed, the error is not showing up and the track slicing works OK.
Seems to be a limitation of deque that states length limiter use. Work around for now would be to use track_slice = list(next(iter(tracks)))[1:]
If all you want to do is [1:] this would be most performant I think track_slice = next(iter(tracks)).states.copy(); track_slice.popleft()