-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track metadata handling update #121
Conversation
# from all hypotheses are retained, but more likely | ||
# hypotheses will over-write the metadata set by less likely | ||
# ones. | ||
for hypothesis in sorted(state.hypothesis, reverse=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is correct. My (possibly wrong) intuition says that calling sorted
on a MultipleHypothesis object should return a list of hypotheses, with the most likely being first. In the case of SingleProbabilityHypothesis
this means that the hypothesis with highest probability would come first, while for SingleDistanceHypothesis
the hypothesis with lowest distance would be first.. Thus, to have them sorted in reverse, I have included the argument reverse=True
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably also consider removal of states, and updating metadata. Might be worth making a note on the Track
type for now if not implemented.
@@ -61,6 +61,9 @@ class StateMutableSequence(Type, MutableSequence): | |||
def __init__(self, states=None, *args, **kwargs): | |||
if states is None: | |||
states = [] | |||
elif not isinstance(states, list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be better to check if states
is a collections.abc.MutableSequence
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me.
Following discussions with @sdhiscocks during Fusion in relation to #118, this pull request aims to solve the performance issues relating to reading metadata as follows:
Track.metadata()
setter method).As part of the above, a small correction has also been applied to
StateMutableSequence
to ensure that thestates
property is always a list after initialisation, even if a singleState
object is passed. Previously, a statement of the formtrack = Track(states=State(np.array([[1]]), timestamp=datetime.datetime.now())
would causetrack.states
to be aState
object, rather than a list of length 1.