Skip to content

Commit

Permalink
solved mypy issue
Browse files Browse the repository at this point in the history
  • Loading branch information
yfukai committed Aug 2, 2022
1 parent 3ef73cc commit 59f76e8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/laptrack/data_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import numpy as np
import pandas as pd

from ._typing_utils import Int
from ._typing_utils import NumArray

IntTuple = Tuple[Int, Int]


def convert_dataframe_to_coords(
df: pd.DataFrame,
Expand Down Expand Up @@ -88,8 +91,8 @@ def convert_tree_to_dataframe(
# tree.nodes[(frame, index)]["tree_id"] = track_id
tree2 = tree.copy()

splits = []
merges = []
splits: List[Tuple[IntTuple, List[IntTuple]]] = []
merges: List[Tuple[IntTuple, List[IntTuple]]] = []
for node in tree.nodes:
frame0, _index0 = node
neighbors = list(tree.neighbors(node))
Expand All @@ -101,13 +104,13 @@ def convert_tree_to_dataframe(
if tree2.has_edge(node, child):
tree2.remove_edge(node, child)
if node not in [p[0] for p in splits]:
splits.append([node, children])
splits.append((node, children))
if len(parents) > 1:
for parent in parents:
if tree2.has_edge(node, parent):
tree2.remove_edge(node, parent)
if node not in [p[0] for p in merges]:
merges.append([node, parents])
merges.append((node, parents))

connected_components = list(nx.connected_components(tree2))
for track_id, nodes in enumerate(connected_components):
Expand Down

0 comments on commit 59f76e8

Please sign in to comment.