Skip to content

Commit

Permalink
Add docstring and keep imports as direct from traccuracy instead of r…
Browse files Browse the repository at this point in the history
…elative
  • Loading branch information
msschwartz21 committed Sep 8, 2023
1 parent e051353 commit 2c07e35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/traccuracy/_tracking_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def __init__(
self.start_frame = None
self.end_frame = None

self.update_graph(graph)
self._update_graph(graph)

self.node_errors = False
self.edge_errors = False
Expand Down Expand Up @@ -356,11 +356,17 @@ def get_subgraph(self, nodes):

new_graph = self.graph.subgraph(nodes).copy()
new_trackgraph = copy.deepcopy(self)
new_trackgraph.update_graph(new_graph)
new_trackgraph._update_graph(new_graph)

return new_trackgraph

def update_graph(self, graph):
def _update_graph(self, graph):
"""Given a new graph, which is expected to be a subgraph of the current graph,
update attributes which are dependent on the graph.
Args:
graph (nx.DiGraph): A networkx graph that is a subgraph of the original graph
"""
self.graph = graph

# construct a dictionary from frames to node ids for easy lookup
Expand Down
5 changes: 3 additions & 2 deletions src/traccuracy/metrics/_ctc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import TYPE_CHECKING

from .._tracking_graph import EdgeAttr, NodeAttr
from ..track_errors._ctc import evaluate_ctc_events
from traccuracy._tracking_graph import EdgeAttr, NodeAttr
from traccuracy.track_errors._ctc import evaluate_ctc_events

from ._base import Metric

if TYPE_CHECKING:
Expand Down

0 comments on commit 2c07e35

Please sign in to comment.