@@ -187,8 +187,7 @@ def _benchmark_for_clip(clip_id: str) -> dict:
187187def _position_differences (base : Sequence , other : Sequence ) -> int :
188188 n = min (len (base ), len (other ))
189189 diffs = sum (
190- (base [i ].string_idx , base [i ].fret ) != (other [i ].string_idx , other [i ].fret )
191- for i in range (n )
190+ (base [i ].string_idx , base [i ].fret ) != (other [i ].string_idx , other [i ].fret ) for i in range (n )
192191 )
193192 return diffs + abs (len (base ) - len (other ))
194193
@@ -236,9 +235,7 @@ def _sample_emission_terms(
236235 "string_idx" : c .string_idx ,
237236 "fret" : c .fret ,
238237 "vision_prob" : float (marginal [c .string_idx , c .fret ]),
239- "prior" : float (
240- np .asarray (ev .fret_prior )[c .string_idx , c .fret ]
241- ),
238+ "prior" : float (np .asarray (ev .fret_prior )[c .string_idx , c .fret ]),
242239 }
243240 for c in candidates
244241 ],
@@ -283,9 +280,7 @@ def _posterior_gold_alignment_stats(
283280
284281 gold_prob = float (marginal [gold .string_idx , gold .fret ])
285282 global_rank = _rank_cell (marginal , gold .string_idx , gold .fret )
286- candidate_probs = [
287- (c , float (marginal [c .string_idx , c .fret ])) for c in candidates
288- ]
283+ candidate_probs = [(c , float (marginal [c .string_idx , c .fret ])) for c in candidates ]
289284 candidate_probs .sort (key = lambda item : item [1 ], reverse = True )
290285 same_pitch_rank = next (
291286 i + 1
@@ -375,8 +370,7 @@ def _aligned_gold_events(
375370 )
376371 if audio_events :
377372 audio_like = [
378- _PitchTimeEvent (onset_s = ev .onset_s , pitch_midi = ev .pitch_midi )
379- for ev in audio_events
373+ _PitchTimeEvent (onset_s = ev .onset_s , pitch_midi = ev .pitch_midi ) for ev in audio_events
380374 ]
381375 aligned , offset_s , matches = _align_gold_to_audio_only (
382376 audio_only = audio_like ,
@@ -517,11 +511,7 @@ def _format_report(clip_id: str, video: Path, report: dict) -> str:
517511 )
518512 lines .append (" top_posterior:" )
519513 for cell in sample ["top_posterior_cells" ]:
520- lines .append (
521- " "
522- f"s={ cell ['string_idx' ]} f={ cell ['fret' ]} "
523- f"p={ cell ['prob' ]:.6f} "
524- )
514+ lines .append (f" s={ cell ['string_idx' ]} f={ cell ['fret' ]} p={ cell ['prob' ]:.6f} " )
525515 lines .append (" same_pitch_candidates:" )
526516 for c in sample ["same_pitch_candidates" ]:
527517 lines .append (
@@ -539,10 +529,7 @@ def _format_report(clip_id: str, video: Path, report: dict) -> str:
539529 )
540530 lines .append (" " + _stat_line ("prior_cost" , sample ["prior_cost" ]))
541531 lines .append (" " + _stat_line ("vision_cost" , sample ["vision_cost" ]))
542- lines .append (
543- " "
544- + _stat_line ("low_fret_open_cost" , sample ["low_fret_open_cost" ])
545- )
532+ lines .append (" " + _stat_line ("low_fret_open_cost" , sample ["low_fret_open_cost" ]))
546533 return "\n " .join (lines )
547534
548535
@@ -563,10 +550,7 @@ def _posterior_summary_line(label: str, stats: dict) -> str:
563550def _stat_line (label : str , stats : dict ) -> str :
564551 if stats ["min" ] is None :
565552 return f"{ label } : none"
566- return (
567- f"{ label } : min={ stats ['min' ]:.6f} mean={ stats ['mean' ]:.6f} "
568- f"max={ stats ['max' ]:.6f} "
569- )
553+ return f"{ label } : min={ stats ['min' ]:.6f} mean={ stats ['mean' ]:.6f} max={ stats ['max' ]:.6f} "
570554
571555
572556if __name__ == "__main__" :
0 commit comments