diff --git a/sleap_io/io/slp.py b/sleap_io/io/slp.py index be0b0411..faf80187 100644 --- a/sleap_io/io/slp.py +++ b/sleap_io/io/slp.py @@ -207,11 +207,11 @@ def read_skeletons(labels_path: str) -> list[Skeleton]: # Re-index correctly. skeleton_node_inds = [node["id"] for node in skel["nodes"]] - node_names = [node_names[i] for i in skeleton_node_inds] + sorted_node_names = [node_names[i] for i in skeleton_node_inds] # Create nodes. nodes = [] - for name in node_names: + for name in sorted_node_names: nodes.append(Node(name=name)) # Create edges.