Skip to content

Commit 59c9aa0

Browse files
committed
Fixed ZeroDivisionError when mfa_longer list is empty
1 parent c4629b5 commit 59c9aa0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/mfa_extraction/fix_mismatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def fix(base_path: str, dur_path: str, trimmed_dur_path: str, use_norm: str):
105105

106106
logging.info(
107107
f"{t} stats: number of mfa with longer duration: {len(mfa_longer)}, total diff: {sum(mfa_longer)}"
108-
f", mean diff: {sum(mfa_longer)/len(mfa_longer)}"
108+
f", mean diff: {sum(mfa_longer)/len(mfa_longer) if len(mfa_longer) > 0 else 0}"
109109
)
110110
logging.info(
111111
f"{t} stats: number of mfa with shorter duration: {len(mfa_shorter)}, total diff: {sum(mfa_shorter)}"

0 commit comments

Comments
 (0)