Loading scripts/pyaudio3dtools/audioarray.py +6 −6 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ """ import logging import warnings import math import multiprocessing as mp import platform Loading Loading @@ -569,12 +570,11 @@ def ssnr( ss.append(ss_seg) if np.all(segment_counter == 0): # the reference signal was outside of [thresh_lowm thresh_high] for all segments -> return -inf # note that this is not in line with the mpeg conf tool which gives +/-0.0 in this case ssnr = np.asarray([-np.inf] * len(segment_counter)) else: # round to 2 decimals. this is just to be in line with the mpeg conformance tool # if the reference signal was outside the thresholds for all segments in a channel, segment_counter is zero # for that channel and the division here would trigger a warning. We supress the warning and later # set the SSNr for those channels to -inf manually instead (overwriting later is simply easier than adding ifs here) with warnings.catch_warnings(): ssnr = np.round(10 * np.log10(10 ** (np.sum(ss, axis=0) / segment_counter) - 1), 2) ssnr[segment_counter == 0] = -np.inf return ssnr Loading
scripts/pyaudio3dtools/audioarray.py +6 −6 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ """ import logging import warnings import math import multiprocessing as mp import platform Loading Loading @@ -569,12 +570,11 @@ def ssnr( ss.append(ss_seg) if np.all(segment_counter == 0): # the reference signal was outside of [thresh_lowm thresh_high] for all segments -> return -inf # note that this is not in line with the mpeg conf tool which gives +/-0.0 in this case ssnr = np.asarray([-np.inf] * len(segment_counter)) else: # round to 2 decimals. this is just to be in line with the mpeg conformance tool # if the reference signal was outside the thresholds for all segments in a channel, segment_counter is zero # for that channel and the division here would trigger a warning. We supress the warning and later # set the SSNr for those channels to -inf manually instead (overwriting later is simply easier than adding ifs here) with warnings.catch_warnings(): ssnr = np.round(10 * np.log10(10 ** (np.sum(ss, axis=0) / segment_counter) - 1), 2) ssnr[segment_counter == 0] = -np.inf return ssnr