# 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
        finally:
            # Specific parameters of the current features
            out_json[self.get_id()] = {}
            out_json[self.get_id()]["params"] = {}
            for param_name in self.get_param_names():
                value = getattr(self, param_name)
                # Check for special case of functions
                if hasattr(value, '__call__'):
                    value = value.__name__
                else:
                    value = str(value)
                out_json[self.get_id()]["params"][param_name] = value

            # Actual features
            out_json[self.get_id()]["framesync"] = \
                self._framesync_features.tolist()
            out_json[self.get_id()]["est_beatsync"] = \
                self._est_beatsync_features.tolist()
            if self._ann_beatsync_features is not None:
                out_json[self.get_id()]["ann_beatsync"] = \
                    self._ann_beatsync_features.tolist()

            # Save it
            with open(self.file_struct.features_file, "w") as f:
                json.dump(out_json, f, indent=2)

    def get_param_names(self):
        """Returns the parameter names for these features, avoiding
        the global parameters."""
        return [name for name in vars(self) if not name.startswith('_') and

# 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

        finally:
            # Specific parameters of the current features
            out_json[self.get_id()] = {}
            out_json[self.get_id()]["params"] = {}
            for param_name in self.get_param_names():
                value = getattr(self, param_name)
                # Check for special case of functions
                if hasattr(value, '__call__'):
                    value = value.__name__
                else:
                    value = str(value)
                out_json[self.get_id()]["params"][param_name] = value

            # Actual features
            out_json[self.get_id()]["framesync"] = \
                self._framesync_features.tolist()
            out_json[self.get_id()]["est_beatsync"] = \
                self._est_beatsync_features.tolist()
            if self._ann_beatsync_features is not None:
                out_json[self.get_id()]["ann_beatsync"] = \
                    self._ann_beatsync_features.tolist()

            # Save it
            with open(self.file_struct.features_file, "w") as f:
                json.dump(out_json, f, indent=2)

    def get_param_names(self):
        """Returns the parameter names for these features, avoiding
        the global parameters."""
        return [name for name in vars(self) if not name.startswith('_') and

                name not in self._global_param_names]