@@ -246,9 +246,11 @@ def to_sleap_analysis_file(
246
246
"track_names", "node_names", "tracks", "track_occupancy", "point_scores",
247
247
"instance_scores", "tracking_scores", "labels_path", "edge_names",
248
248
"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.
252
254
The other attributes and data variables that are not present in the input
253
255
dataset will contain default (empty) values.
254
256
@@ -293,7 +295,9 @@ def to_sleap_analysis_file(
293
295
point_scores = np .transpose (ds .confidence .data , (1 , 2 , 0 ))
294
296
instance_scores = np .full ((n_individuals , n_frames ), np .nan , dtype = float )
295
297
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
+ )
297
301
data_dict = dict (
298
302
track_names = individual_names ,
299
303
node_names = keypoint_names ,
@@ -302,7 +306,7 @@ def to_sleap_analysis_file(
302
306
point_scores = point_scores ,
303
307
instance_scores = instance_scores ,
304
308
tracking_scores = tracking_scores ,
305
- labels_path = ds . source_file ,
309
+ labels_path = labels_path ,
306
310
edge_names = [],
307
311
edge_inds = [],
308
312
video_path = "" ,
0 commit comments