# Path: msaf/base.py
# class MetaFeatures(type):
# class Features(six.with_metaclass(MetaFeatures)):
#     def __new__(meta, name, bases, class_dict):
#     def __init__(self, file_struct, sr, hop_length, feat_type):
#     def compute_HPSS(self):
#     def estimate_beats(self):
#     def read_ann_beats(self):
#     def compute_beat_sync_features(self, beat_frames, beat_times, pad):
#     def read_features(self, tol=1e-3):
#     def write_features(self):
#     def get_param_names(self):
#     def _compute_framesync_times(self):
#     def _compute_all_features(self):
#     def frame_times(self):
#     def features(self):
#     def select_features(cls, features_id, file_struct, annot_beats, framesync):
#     def compute_features(self):
#     def get_id(self):
# 
# Path: msaf/exceptions.py
# class NoAudioFileError(MSAFError):
#     '''Exception class for audio file not found'''
#     pass
# 
# class FeatureParamsError(MSAFError):
#     '''Exception class for feature parameters missing'''
#     pass
# 
# class FeatureTypeNotFound(MSAFError):
#     '''Exception class for feature type missing'''
#     pass
# 
# 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/input_output.py
# class FileStruct:
#     def __init__(self, audio_file):
#         """Creates the entire file structure given the audio file."""
#         self.ds_path = os.path.dirname(os.path.dirname(audio_file))
#         self.audio_file = audio_file
#         self.est_file = self._get_dataset_file(ds_config.estimations_dir,
#                                                ds_config.estimations_ext)
#         self.features_file = self._get_dataset_file(ds_config.features_dir,
#                                                     ds_config.features_ext)
#         self.ref_file = self._get_dataset_file(ds_config.references_dir,
#                                                ds_config.references_ext)
# 
#     def _get_dataset_file(self, dir, ext):
#         """Gets the desired dataset file."""
#         audio_file_ext = "." + self.audio_file.split(".")[-1]
#         base_file = os.path.basename(self.audio_file).replace(
#             audio_file_ext, ext)
#         return os.path.join(self.ds_path, dir, base_file)
# 
#     def __repr__(self):
#         """Prints the file structure."""
#         return "FileStruct(\n\tds_path=%s,\n\taudio_file=%s,\n\test_file=%s," \
#             "\n\tfeatures_file=%s,\n\tref_file=%s\n)" % (
#                 self.ds_path, self.audio_file, self.est_file,
#                 self.features_file, self.ref_file)


from enum import Enum
from nose.tools import raises
from msaf.base import FeatureTypes
from msaf.exceptions import (NoAudioFileError, FeatureParamsError,
                             FeatureTypeNotFound)
from msaf.features import CQT, PCP, Tonnetz, MFCC, Tempogram, Features
from msaf.input_output import FileStruct
import json
import librosa
import numpy as np
import os
import msaf
    """PCP features should run and create the proper entry in the json file."""
    run_framesync(PCP)


def test_standard_mfcc():
    """MFCC features should run and create the proper entry in the json
    file."""
    run_framesync(MFCC)


def test_standard_tonnetz():
    """Tonnetz features should run and create the proper entry in the json
    file."""
    run_framesync(Tonnetz)


def test_ref_power_mfcc():
    """Test for different possible parameters for the ref_power of the mfcc."""
    run_ref_power(MFCC)


@raises(FeatureParamsError)
def test_wrong_ref_power_mfcc():
    """Test for wrong parameters for ref_power of the mfcc."""
    MFCC(file_struct, FeatureTypes.framesync, ref_power="caca")


def test_standard_tempogram():
    """Tempogram features should run and create the proper entry in the json
    file."""

# Path: msaf/base.py
# class MetaFeatures(type):
# class Features(six.with_metaclass(MetaFeatures)):
#     def __new__(meta, name, bases, class_dict):
#     def __init__(self, file_struct, sr, hop_length, feat_type):
#     def compute_HPSS(self):
#     def estimate_beats(self):
#     def read_ann_beats(self):
#     def compute_beat_sync_features(self, beat_frames, beat_times, pad):
#     def read_features(self, tol=1e-3):
#     def write_features(self):
#     def get_param_names(self):
#     def _compute_framesync_times(self):
#     def _compute_all_features(self):
#     def frame_times(self):
#     def features(self):
#     def select_features(cls, features_id, file_struct, annot_beats, framesync):
#     def compute_features(self):
#     def get_id(self):
# 
# Path: msaf/exceptions.py
# class NoAudioFileError(MSAFError):
#     '''Exception class for audio file not found'''
#     pass
# 
# class FeatureParamsError(MSAFError):
#     '''Exception class for feature parameters missing'''
#     pass
# 
# class FeatureTypeNotFound(MSAFError):
#     '''Exception class for feature type missing'''
#     pass
# 
# 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/input_output.py
# class FileStruct:
#     def __init__(self, audio_file):
#         """Creates the entire file structure given the audio file."""
#         self.ds_path = os.path.dirname(os.path.dirname(audio_file))
#         self.audio_file = audio_file
#         self.est_file = self._get_dataset_file(ds_config.estimations_dir,
#                                                ds_config.estimations_ext)
#         self.features_file = self._get_dataset_file(ds_config.features_dir,
#                                                     ds_config.features_ext)
#         self.ref_file = self._get_dataset_file(ds_config.references_dir,
#                                                ds_config.references_ext)
# 
#     def _get_dataset_file(self, dir, ext):
#         """Gets the desired dataset file."""
#         audio_file_ext = "." + self.audio_file.split(".")[-1]
#         base_file = os.path.basename(self.audio_file).replace(
#             audio_file_ext, ext)
#         return os.path.join(self.ds_path, dir, base_file)
# 
#     def __repr__(self):
#         """Prints the file structure."""
#         return "FileStruct(\n\tds_path=%s,\n\taudio_file=%s,\n\test_file=%s," \
#             "\n\tfeatures_file=%s,\n\tref_file=%s\n)" % (
#                 self.ds_path, self.audio_file, self.est_file,
#                 self.features_file, self.ref_file)


# Path: tests/test_features.py
from enum import Enum
from nose.tools import raises
from msaf.base import FeatureTypes
from msaf.exceptions import (NoAudioFileError, FeatureParamsError,
                             FeatureTypeNotFound)
from msaf.features import CQT, PCP, Tonnetz, MFCC, Tempogram, Features
from msaf.input_output import FileStruct
import json
import librosa
import numpy as np
import os
import msaf

    """PCP features should run and create the proper entry in the json file."""
    run_framesync(PCP)


def test_standard_mfcc():
    """MFCC features should run and create the proper entry in the json
    file."""
    run_framesync(MFCC)


def test_standard_tonnetz():
    """Tonnetz features should run and create the proper entry in the json
    file."""
    run_framesync(Tonnetz)


def test_ref_power_mfcc():
    """Test for different possible parameters for the ref_power of the mfcc."""
    run_ref_power(MFCC)


@raises(FeatureParamsError)
def test_wrong_ref_power_mfcc():
    """Test for wrong parameters for ref_power of the mfcc."""
    MFCC(file_struct, FeatureTypes.framesync, ref_power="caca")


def test_standard_tempogram():
    """Tempogram features should run and create the proper entry in the json
    file."""

    run_framesync(Tempogram)