Skip to content

Commit

Permalink
Speed up points layer inititalization
Browse files Browse the repository at this point in the history
  • Loading branch information
cmalinmayor committed Nov 4, 2024
1 parent 15e634f commit 7147eb7
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/motile_plugin/data_views/views/layers/track_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ def __init__(
):
self.tracks_viewer = tracks_viewer
self.nodes = list(tracks_viewer.tracks.graph.nodes)
self.node_index_dict = dict(
zip(
self.nodes,
[self.nodes.index(node) for node in self.nodes],
strict=False,
)
)
self.node_index_dict = {node: idx for idx, node in enumerate(self.nodes)}

points = self.tracks_viewer.tracks.get_positions(self.nodes, incl_time=True)
track_ids = [
Expand Down Expand Up @@ -104,13 +98,7 @@ def _refresh(self):
) # do not listen to new events until updates are complete
self.nodes = list(self.tracks_viewer.tracks.graph.nodes)

self.node_index_dict = dict(
zip(
self.nodes,
[self.nodes.index(node) for node in self.nodes],
strict=False,
)
)
self.node_index_dict = {node: idx for idx, node in enumerate(self.nodes)}

track_ids = [
self.tracks_viewer.tracks.graph.nodes[node][NodeAttr.TRACK_ID.value]
Expand Down

0 comments on commit 7147eb7

Please sign in to comment.