freqanalysis.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:audioanalysis 作者: jpalpant 项目源码 文件源码
def get_classification(self, idx):
        """Docs"""

        img_rows = self.params.get('img_rows', self.Sxx.shape[0])
        img_cols = self.params.get('img_cols', 1)

        if self.Sxx is None or self.active_song.classification is None:
            raise TypeError('No active song from which to get data')

        if np.amax(idx) > self.Sxx.shape[1]:
            raise IndexError('Data index of sample out of bounds, only {0} '
                    'samples in the dataset'.format(self.Sxx.shape[1] - img_cols))

        if np.amin(idx) < 0:
            raise IndexError('Data index of sample out of bounds, '
                    'negative index requested')

        # index out the data
        classification = self.active_song.classification[idx]

        return classification
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号