@@ -246,9 +246,11 @@ def to_sleap_analysis_file(
246246 "track_names", "node_names", "tracks", "track_occupancy", "point_scores",
247247 "instance_scores", "tracking_scores", "labels_path", "edge_names",
248248 "edge_inds", "video_path", "video_ind", "provenance" [1]_.
249- However, only "track_names", "node_names", "tracks", "track_occupancy",
250- "point_scores" and "labels_path" will contain data extracted from the
251- input dataset.
249+ However, only "track_names", "node_names", "tracks", "track_occupancy"
250+ and "point_scores" will contain data extracted from the input dataset.
251+ "labels_path" will contain the path to the input file only if the source
252+ file of the dataset is a SLEAP .slp file. Otherwise, it will be an empty
253+ string.
252254 The other attributes and data variables that are not present in the input
253255 dataset will contain default (empty) values.
254256
@@ -293,7 +295,9 @@ def to_sleap_analysis_file(
293295 point_scores = np .transpose (ds .confidence .data , (1 , 2 , 0 ))
294296 instance_scores = np .full ((n_individuals , n_frames ), np .nan , dtype = float )
295297 tracking_scores = np .full ((n_individuals , n_frames ), np .nan , dtype = float )
296-
298+ labels_path = (
299+ ds .source_file if Path (ds .source_file ).suffix == ".slp" else ""
300+ )
297301 data_dict = dict (
298302 track_names = individual_names ,
299303 node_names = keypoint_names ,
@@ -302,7 +306,7 @@ def to_sleap_analysis_file(
302306 point_scores = point_scores ,
303307 instance_scores = instance_scores ,
304308 tracking_scores = tracking_scores ,
305- labels_path = ds . source_file ,
309+ labels_path = labels_path ,
306310 edge_names = [],
307311 edge_inds = [],
308312 video_path = "" ,
0 commit comments