@@ -62,7 +62,7 @@ def _get_conversion_factor(unit=UNIT, ready_tone_spl=READY_TONE_SPL):
6262 return fac
6363
6464
65- def welchogram (fs , wav , nswin = NS_WIN , overlap = OVERLAP , nperseg = NS_WELCH ):
65+ def welchogram (fs , wav , nswin = NS_WIN , overlap = OVERLAP , nperseg = NS_WELCH , detect_kwargs = None ):
6666 """
6767 Computes a spectrogram on a very large audio file.
6868
@@ -71,6 +71,7 @@ def welchogram(fs, wav, nswin=NS_WIN, overlap=OVERLAP, nperseg=NS_WELCH):
7171 :param nswin: n samples of the sliding window
7272 :param overlap: n samples of the overlap between windows
7373 :param nperseg: n samples for the computation of the spectrogram
74+ :param detect_kwargs: specified paramaters for detection
7475 :return: tscale, fscale, downsampled_spectrogram
7576 """
7677 ns = wav .shape [0 ]
@@ -84,7 +85,8 @@ def welchogram(fs, wav, nswin=NS_WIN, overlap=OVERLAP, nperseg=NS_WELCH):
8485 # load the current window into memory
8586 w = np .float64 (wav [first :last ]) * _get_conversion_factor ()
8687 # detection of ready tones
87- a = [d + first for d in detect_ready_tone (w , fs )]
88+ detect_kwargs = detect_kwargs or {}
89+ a = [d + first for d in detect_ready_tone (w , fs , ** detect_kwargs )]
8890 if len (a ):
8991 detect += a
9092 # the last window may not allow a pwelch
0 commit comments