Permalink
Browse files

Fix formant measurement error

Drop nan measurements from list

    f1_list = [f1 for f1 in f1_list if str(f1) != 'nan']
    f2_list = [f2 for f2 in f2_list if str(f2) != 'nan']
    f3_list = [f3 for f3 in f3_list if str(f3) != 'nan']
    f4_list = [f4 for f4 in f4_list if str(f4) != 'nan']
  • Loading branch information...
drfeinberg committed Feb 6, 2019
1 parent 3a1babb commit 0c75983b934d202bda8eab643c93b8c6c62d85f9
Showing with 6 additions and 1 deletion.
  1. +6 −1 measure.py
@@ -66,7 +66,12 @@ def measureFormants(sound, wave_file, f0min, f0max):
f2_list.append(f2)
f3_list.append(f3)
f4_list.append(f4)


f1_list = [f1 for f1 in f1_list if str(f1) != 'nan']
f2_list = [f2 for f2 in f2_list if str(f2) != 'nan']
f3_list = [f3 for f3 in f3_list if str(f3) != 'nan']
f4_list = [f4 for f4 in f4_list if str(f4) != 'nan']

# calculate mean formants across pulses
f1_mean = statistics.mean(f1_list)
f2_mean = statistics.mean(f2_list)

0 comments on commit 0c75983

Please sign in to comment.