dgs.utils.track.Tracks¶
- class dgs.utils.track.Tracks(N: int, thresh: int | None = None, start_frame: int = 0)[source]¶
- Multiple Track objects stored as a dictionary, where the Track is the value and the key is this tracks’ unique ID. - Methods - add(tracks: dict[int, State], new: list[State]) list[int][source]¶
- Given tracks with existing Track-IDs update those and create new Tracks for States without Track-IDs. Additionally, mark Track-IDs that are not in either of the inputs as unseen and therefore as inactive for one more step. - Returns:
- The Track-IDs of the new_tracks in the same order as provided. 
 
 - add_empty_tracks(n: int = 1) list[int][source]¶
- Given a Track, compute the next track-ID, and save this track in data using this ID. - Parameters:
- n – The number of new Tracks to add. 
- Returns:
- The track-IDs of the added tracks. 
- Return type:
- tids 
 
 - clear() None. Remove all items from D.¶
 - classmethod fromkeys(iterable, value=None)¶
 - get(k[, d]) D[k] if k in D, else d. d defaults to None.¶
 - get_active_states() list[State][source]¶
- Get the last state of every active track in this object as a - State.
 - get_states() tuple[list[State], list[int]][source]¶
- Get the last state of every track in this object as a - State.
 - items() a set-like object providing a view on D's items¶
 - keys() a set-like object providing a view on D's keys¶
 - pop(k[, d]) v, remove specified key and return the corresponding value.¶
- If key is not found, d is returned if given, otherwise KeyError is raised. 
 - popitem() (k, v), remove and return some (key, value) pair¶
- as a 2-tuple; but raise KeyError if D is empty. 
 - reactivate_track(tid: int) None[source]¶
- Given the track-ID of a previously removed track, reactivate it. 
 - remove_tid(tid: int) None[source]¶
- Given a Track-ID, remove the track associated with it from this object. 
 - setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D¶
 - update([E, ]**F) None. Update D from mapping/iterable E and F.¶
- If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v 
 - values() an object providing a view on D's values¶
- Attributes - Get the age of all the tracks (in frames). - Get all the track-IDs in this object. - Get all the track-IDs currently active. - Get all the track-IDs currently inactive. - Get all the track-IDs that have been deleted. - Get the number of active Tracks. - Get the number of inactive Tracks. - Get the number of Tracks that have been removed. - All the Tracks that are currently tracked, including inactive Tracks as mapping 'Track-ID -> Track'. - All the inactive Tracks as 'Track-ID -> number of inactive frames / steps'. - The number of steps a Track can be inactive before deleting it. - All the Tracks that have been removed, to be able to reactivate them.