# Path: msaf/utils.py
# def lognormalize(F, floor=0.1, min_db=-80):
# def min_max_normalize(F, floor=0.001):
# def normalize(X, norm_type, floor=0.0, min_db=-80):
# def ensure_dir(directory):
# def times_to_intervals(times):
# def intervals_to_times(inters):
# def get_num_frames(dur, anal):
# def get_time_frames(dur, anal):
# def remove_empty_segments(times, labels):
# def sonify_clicks(audio, clicks, out_file, fs, offset=0):
# def synchronize_labels(new_bound_idxs, old_bound_idxs, old_labels, N):
# def process_segmentation_level(est_idxs, est_labels, N, frame_times, dur):
# def align_end_hierarchies(hier1, hier2, thres=0.5):
#     F = min_max_normalize(F, floor=floor)
#     F = np.abs(min_db) * np.log10(F)  # Normalize from min_db to 0
#     F = F / F.max(axis=0)
# 
# Path: msaf/exceptions.py
# class NoEstimationsError(MSAFError):
#     '''Exception class for missing estimations'''
#     pass


import datetime
import glob
import json
import logging
import os
import re
import jams
import numpy as np
import six
import msaf
from collections import defaultdict
from msaf import utils
from msaf.exceptions import NoEstimationsError

    Parameters
    ----------
    audio_path : str
        Path to the audio file

    Returns
    -------
    ref_times : list
        List of boundary times
    ref_labels : list
        List of labels

    Raises
    ------
    IOError: if `audio_path` doesn't exist.
    """
    # Dataset path
    ds_path = os.path.dirname(os.path.dirname(audio_path))

    # Read references
    jam_path = os.path.join(ds_path, ds_config.references_dir,
                            os.path.basename(audio_path)[:-4] +
                            ds_config.references_ext)

    jam = jams.load(jam_path, validate=False)
    ann = jam.search(namespace='segment_.*')[annotator_id]
    ref_inters, ref_labels = ann.to_interval_values()

    # Intervals to times

# Path: msaf/utils.py
# def lognormalize(F, floor=0.1, min_db=-80):
# def min_max_normalize(F, floor=0.001):
# def normalize(X, norm_type, floor=0.0, min_db=-80):
# def ensure_dir(directory):
# def times_to_intervals(times):
# def intervals_to_times(inters):
# def get_num_frames(dur, anal):
# def get_time_frames(dur, anal):
# def remove_empty_segments(times, labels):
# def sonify_clicks(audio, clicks, out_file, fs, offset=0):
# def synchronize_labels(new_bound_idxs, old_bound_idxs, old_labels, N):
# def process_segmentation_level(est_idxs, est_labels, N, frame_times, dur):
# def align_end_hierarchies(hier1, hier2, thres=0.5):
#     F = min_max_normalize(F, floor=floor)
#     F = np.abs(min_db) * np.log10(F)  # Normalize from min_db to 0
#     F = F / F.max(axis=0)
# 
# Path: msaf/exceptions.py
# class NoEstimationsError(MSAFError):
#     '''Exception class for missing estimations'''
#     pass


# Path: msaf/input_output.py
import datetime
import glob
import json
import logging
import os
import re
import jams
import numpy as np
import six
import msaf
from collections import defaultdict
from msaf import utils
from msaf.exceptions import NoEstimationsError


    Parameters
    ----------
    audio_path : str
        Path to the audio file

    Returns
    -------
    ref_times : list
        List of boundary times
    ref_labels : list
        List of labels

    Raises
    ------
    IOError: if `audio_path` doesn't exist.
    """
    # Dataset path
    ds_path = os.path.dirname(os.path.dirname(audio_path))

    # Read references
    jam_path = os.path.join(ds_path, ds_config.references_dir,
                            os.path.basename(audio_path)[:-4] +
                            ds_config.references_ext)

    jam = jams.load(jam_path, validate=False)
    ann = jam.search(namespace='segment_.*')[annotator_id]
    ref_inters, ref_labels = ann.to_interval_values()

    # Intervals to times

    ref_times = utils.intervals_to_times(ref_inters)