# Path: msaf/exceptions.py
# class WrongFeaturesFormatError(MSAFError):
#     '''Exception class for worngly formatted features files'''
#     pass
# 
# class NoFeaturesFileError(MSAFError):
#     '''Exception class for missing features file'''
#     pass
# 
# class FeaturesNotFound(MSAFError):
#     '''Exception class for missing specific features in a file'''
#     pass
# 
# class FeatureTypeNotFound(MSAFError):
#     '''Exception class for feature type missing'''
#     pass
# 
# class FeatureParamsError(MSAFError):
#     '''Exception class for feature parameters missing'''
#     pass
# 
# class NoAudioFileError(MSAFError):
#     '''Exception class for audio file not found'''
#     pass


import collections
import datetime
import librosa
import logging
import jams
import json
import numpy as np
import os
import six
import msaf
from enum import Enum
from msaf.exceptions import WrongFeaturesFormatError, NoFeaturesFileError,\
    FeaturesNotFound, FeatureTypeNotFound, FeatureParamsError, NoAudioFileError
                                             [self._framesync_times[-1]]))
        return beatsync_feats, beatsync_times

    def read_features(self, tol=1e-3):
        """Reads the features from a file and stores them in the current
        object.

        Parameters
        ----------
        tol: float
            Tolerance level to detect duration of audio.
        """
        try:
            # Read JSON file
            with open(self.file_struct.features_file) as f:
                feats = json.load(f)

            # Store duration
            if self.dur is None:
                self.dur = float(feats["globals"]["dur"])

            # Check that we have the correct global parameters
            assert(np.isclose(
                self.dur, float(feats["globals"]["dur"]), rtol=tol))
            assert(self.sr == int(feats["globals"]["sample_rate"]))
            assert(self.hop_length == int(feats["globals"]["hop_length"]))
            assert(os.path.basename(self.file_struct.audio_file) ==
                   os.path.basename(feats["globals"]["audio_file"]))

            # Check for specific features params

# Path: msaf/exceptions.py
# class WrongFeaturesFormatError(MSAFError):
#     '''Exception class for worngly formatted features files'''
#     pass
# 
# class NoFeaturesFileError(MSAFError):
#     '''Exception class for missing features file'''
#     pass
# 
# class FeaturesNotFound(MSAFError):
#     '''Exception class for missing specific features in a file'''
#     pass
# 
# class FeatureTypeNotFound(MSAFError):
#     '''Exception class for feature type missing'''
#     pass
# 
# class FeatureParamsError(MSAFError):
#     '''Exception class for feature parameters missing'''
#     pass
# 
# class NoAudioFileError(MSAFError):
#     '''Exception class for audio file not found'''
#     pass


# Path: msaf/base.py
import collections
import datetime
import librosa
import logging
import jams
import json
import numpy as np
import os
import six
import msaf
from enum import Enum
from msaf.exceptions import WrongFeaturesFormatError, NoFeaturesFileError,\
    FeaturesNotFound, FeatureTypeNotFound, FeatureParamsError, NoAudioFileError

                                             [self._framesync_times[-1]]))
        return beatsync_feats, beatsync_times

    def read_features(self, tol=1e-3):
        """Reads the features from a file and stores them in the current
        object.

        Parameters
        ----------
        tol: float
            Tolerance level to detect duration of audio.
        """
        try:
            # Read JSON file
            with open(self.file_struct.features_file) as f:
                feats = json.load(f)

            # Store duration
            if self.dur is None:
                self.dur = float(feats["globals"]["dur"])

            # Check that we have the correct global parameters
            assert(np.isclose(
                self.dur, float(feats["globals"]["dur"]), rtol=tol))
            assert(self.sr == int(feats["globals"]["sample_rate"]))
            assert(self.hop_length == int(feats["globals"]["hop_length"]))
            assert(os.path.basename(self.file_struct.audio_file) ==
                   os.path.basename(feats["globals"]["audio_file"]))

            # Check for specific features params

            feat_params_err = FeatureParamsError(