# Path: msaf/features.py
# class CQT(Features):
# class MFCC(Features):
# class PCP(Features):
# class Tonnetz(Features):
# class Tempogram(Features):
#     def __init__(self, file_struct, feat_type, sr=config.sample_rate,
#                  hop_length=config.hop_size, n_bins=config.cqt.bins,
#                  norm=config.cqt.norm, filter_scale=config.cqt.filter_scale,
#                  ref_power=config.cqt.ref_power):
#     def get_id(self):
#     def compute_features(self):
#     def __init__(self, file_struct, feat_type, sr=config.sample_rate,
#                  hop_length=config.hop_size, n_fft=config.n_fft,
#                  n_mels=config.mfcc.n_mels, n_mfcc=config.mfcc.n_mfcc,
#                  ref_power=config.mfcc.ref_power):
#     def get_id(self):
#     def compute_features(self):
#     def __init__(self, file_struct, feat_type, sr=config.sample_rate,
#                  hop_length=config.hop_size, n_bins=config.pcp.bins,
#                  norm=config.pcp.norm, f_min=config.pcp.f_min,
#                  n_octaves=config.pcp.n_octaves):
#     def get_id(self):
#     def compute_features(self):
#     def __init__(self, file_struct, feat_type, sr=config.sample_rate,
#                  hop_length=config.hop_size, n_bins=config.tonnetz.bins,
#                  norm=config.tonnetz.norm, f_min=config.tonnetz.f_min,
#                  n_octaves=config.tonnetz.n_octaves):
#     def get_id(self):
#     def compute_features(self):
#     def __init__(self, file_struct, feat_type, sr=config.sample_rate,
#                  hop_length=config.hop_size,
#                  win_length=config.tempogram.win_length):
#     def get_id(self):
#     def compute_features(self):
#         S = librosa.feature.melspectrogram(self._audio,
#                                            sr=self.sr,
#                                            n_fft=self.n_fft,
#                                            hop_length=self.hop_length,
#                                            n_mels=self.n_mels)
# 
# Path: msaf/exceptions.py
# class NoHierBoundaryError(MSAFError):
#     '''Exception class for missing hierarchical boundary algorithm'''
#     pass
# 
# class FeaturesNotFound(MSAFError):
#     '''Exception class for missing specific features in a file'''
#     pass
# 
# class NoAudioFileError(MSAFError):
#     '''Exception class for audio file not found'''
#     pass


import matplotlib
import matplotlib.style
import numpy.testing as npt
import os
import msaf
from mpl_ic import image_comparison
from nose.tools import assert_raises
from nose.tools import raises
from types import ModuleType
from msaf.features import Features
from msaf.exceptions import (NoHierBoundaryError, FeaturesNotFound,
                             NoAudioFileError)
    file_struct.features_file = msaf.config.features_tmp_file
    file_struct.est_file = "tmp.json"

    config = {}
    config["feature"] = "pcp"
    config["annot_beats"] = False
    config["framesync"] = False
    config["hier"] = False
    est_times, est_labels = msaf.run.process_track(
        file_struct, bounds_id, labels_id, config)

    assert os.path.isfile(file_struct.est_file)
    os.remove(file_struct.est_file)


def test_process_with_gt():
    bounds_id = "gt"
    labels_id = "fmc2d"
    est_times, est_labels = msaf.run.process(
        long_audio_file, boundaries_id=bounds_id, labels_id=labels_id)
    assert est_times[0] == 0
    assert len(est_times) == len(est_labels) + 1


@raises(FeaturesNotFound)
def test_process_wrong_feature():
    feature = "caca"
    est_times, est_labels = msaf.run.process(long_audio_file, feature=feature)



# Path: msaf/features.py
# class CQT(Features):
# class MFCC(Features):
# class PCP(Features):
# class Tonnetz(Features):
# class Tempogram(Features):
#     def __init__(self, file_struct, feat_type, sr=config.sample_rate,
#                  hop_length=config.hop_size, n_bins=config.cqt.bins,
#                  norm=config.cqt.norm, filter_scale=config.cqt.filter_scale,
#                  ref_power=config.cqt.ref_power):
#     def get_id(self):
#     def compute_features(self):
#     def __init__(self, file_struct, feat_type, sr=config.sample_rate,
#                  hop_length=config.hop_size, n_fft=config.n_fft,
#                  n_mels=config.mfcc.n_mels, n_mfcc=config.mfcc.n_mfcc,
#                  ref_power=config.mfcc.ref_power):
#     def get_id(self):
#     def compute_features(self):
#     def __init__(self, file_struct, feat_type, sr=config.sample_rate,
#                  hop_length=config.hop_size, n_bins=config.pcp.bins,
#                  norm=config.pcp.norm, f_min=config.pcp.f_min,
#                  n_octaves=config.pcp.n_octaves):
#     def get_id(self):
#     def compute_features(self):
#     def __init__(self, file_struct, feat_type, sr=config.sample_rate,
#                  hop_length=config.hop_size, n_bins=config.tonnetz.bins,
#                  norm=config.tonnetz.norm, f_min=config.tonnetz.f_min,
#                  n_octaves=config.tonnetz.n_octaves):
#     def get_id(self):
#     def compute_features(self):
#     def __init__(self, file_struct, feat_type, sr=config.sample_rate,
#                  hop_length=config.hop_size,
#                  win_length=config.tempogram.win_length):
#     def get_id(self):
#     def compute_features(self):
#         S = librosa.feature.melspectrogram(self._audio,
#                                            sr=self.sr,
#                                            n_fft=self.n_fft,
#                                            hop_length=self.hop_length,
#                                            n_mels=self.n_mels)
# 
# Path: msaf/exceptions.py
# class NoHierBoundaryError(MSAFError):
#     '''Exception class for missing hierarchical boundary algorithm'''
#     pass
# 
# class FeaturesNotFound(MSAFError):
#     '''Exception class for missing specific features in a file'''
#     pass
# 
# class NoAudioFileError(MSAFError):
#     '''Exception class for audio file not found'''
#     pass


# Path: tests/test_run.py
import matplotlib
import matplotlib.style
import numpy.testing as npt
import os
import msaf
from mpl_ic import image_comparison
from nose.tools import assert_raises
from nose.tools import raises
from types import ModuleType
from msaf.features import Features
from msaf.exceptions import (NoHierBoundaryError, FeaturesNotFound,
                             NoAudioFileError)

    file_struct.features_file = msaf.config.features_tmp_file
    file_struct.est_file = "tmp.json"

    config = {}
    config["feature"] = "pcp"
    config["annot_beats"] = False
    config["framesync"] = False
    config["hier"] = False
    est_times, est_labels = msaf.run.process_track(
        file_struct, bounds_id, labels_id, config)

    assert os.path.isfile(file_struct.est_file)
    os.remove(file_struct.est_file)


def test_process_with_gt():
    bounds_id = "gt"
    labels_id = "fmc2d"
    est_times, est_labels = msaf.run.process(
        long_audio_file, boundaries_id=bounds_id, labels_id=labels_id)
    assert est_times[0] == 0
    assert len(est_times) == len(est_labels) + 1


@raises(FeaturesNotFound)
def test_process_wrong_feature():
    feature = "caca"
    est_times, est_labels = msaf.run.process(long_audio_file, feature=feature)



@raises(NoAudioFileError)