@@ -42,7 +42,8 @@ def write_export_metadata(meta_path: str,
4242 frame_rate ,
4343 clothes_list ,
4444 param_labels : dict | None = None ,
45- limb_param_labels : dict | None = None ) -> None :
45+ limb_param_labels : dict | None = None ,
46+ labeling_time_seconds : float | None = None ) -> None :
4647 """
4748 Writes a JSON sidecar with all non-tabular export metadata that used to be
4849 stuffed into the first 5 lines of *_export.csv.
@@ -56,6 +57,8 @@ def write_export_metadata(meta_path: str,
5657 "Param Labels" : param_labels or {},
5758 "Limb Param Labels" : limb_param_labels or {},
5859 }
60+ if labeling_time_seconds is not None :
61+ meta ["Total Labeling Time (hours)" ] = round (float (labeling_time_seconds ) / 3600.0 , 4 )
5962 os .makedirs (os .path .dirname (meta_path ), exist_ok = True )
6063 with open (meta_path , "w" , encoding = "utf-8" ) as f :
6164 json .dump (meta , f , indent = 2 , ensure_ascii = False )
@@ -386,7 +389,6 @@ def _xy_str(lst):
386389 row [f"{ limb } _X" ] = _xy_str (rec .get ("X" , []))
387390 row [f"{ limb } _Y" ] = _xy_str (rec .get ("Y" , []))
388391 row [f"{ limb } _Onset" ] = rec .get ("Onset" , "" )
389- row [f"{ limb } _Look" ] = rec .get ("Look" , "" )
390392 row [f"{ limb } _Zones" ] = json .dumps (rec .get ("Zones" , []) or [])
391393
392394 # Global params (canonical keys → fixed columns)
@@ -409,7 +411,7 @@ def _xy_str(lst):
409411 # Exact legacy column order
410412 cols = ["Frame" , "Time_ms" ]
411413 for limb in ["LH" , "LL" , "RH" , "RL" ]:
412- cols += [f"{ limb } _X" , f"{ limb } _Y" , f"{ limb } _Onset" , f"{ limb } _Look" , f" { limb } _Zones" ]
414+ cols += [f"{ limb } _X" , f"{ limb } _Y" , f"{ limb } _Onset" , f"{ limb } _Zones" ]
413415 cols += ["Parameter_1" , "Parameter_2" , "Parameter_3" ]
414416 for limb in ["LH" , "LL" , "RH" , "RL" ]:
415417 cols += [f"{ limb } _Parameter_1" , f"{ limb } _Parameter_2" , f"{ limb } _Parameter_3" ]
@@ -630,10 +632,8 @@ def merge_and_flip_export(
630632 if col not in merged_df .columns :
631633 merged_df [col ] = None
632634
633- # normalize look columns
634- for limb in ['LH' , 'LL' , 'RH' , 'RL' ]:
635- merged_df = merged_df .drop ([c for c in merged_df .columns if c == f'{ limb } _Look_x' ], axis = 1 )
636- merged_df = merged_df .rename (columns = {f'{ limb } _Look_y' : f'{ limb } _Look_x' })
635+ # Drop legacy Look columns (no longer used in exports).
636+ merged_df = merged_df .drop (columns = [c for c in merged_df .columns if "_Look" in c ], errors = "ignore" )
637637
638638 merged_df = merged_df .drop_duplicates (subset = ['Frame' ])
639639 merged_df = merged_df .drop ([c for c in merged_df .columns if c .endswith ('_y' )], axis = 1 )
0 commit comments