vocalpy / hybrid-vocal-classifier

a Python machine learning library for animal vocalizations and bioacoustics
http://hybrid-vocal-classifier.readthedocs.io
BSD 3-Clause "New" or "Revised" License
23 stars 8 forks source link

remove uneccesary repetitive code in `hvc.audiofileIO.Spectrogram.make` #72

Open NickleDave opened 6 years ago

NickleDave commented 6 years ago

flow statements check for if window is None and if it is not then they explicitly pass window as a keyword argument, but its not necessary to check, since default behavior occurs when window is None (which is what happens when it's not passed as a keyword argument, and that's the intended behavior when window is set to None within the context of the Spectrogram.make function).

Example below, but notice same thing happens beneath it when self.spectFunc == 'mpl'

starting here: https://github.com/NickleDave/hybrid-vocal-classifier/blob/8dd2c69ee550601724771d0f73eea439d7c253f3/hvc/audiofileIO.py#L285

            if self.spectFunc == 'scipy':
                if self.window is not None:
                        freq_bins, time_bins, spect = scipy.signal.spectrogram(raw_audio,
                                                                               samp_freq,
                                                                               window=self.window,
                                                                               nperseg=self.nperseg,
                                                                               noverlap=self.noverlap)
                else:
                    freq_bins, time_bins, spect = scipy.signal.spectrogram(raw_audio,
                                                                           samp_freq,
                                                                           nperseg=self.nperseg,
noverlap=self.noverlap)