def read_estimations(est_file, boundaries_id, labels_id=None, **params):
    """Reads the estimations (boundaries and/or labels) from a jams file
    containing the estimations of an algorithm.

    Parameters
    ----------
    est_file : str
        Path to the estimated file (JAMS file).
    boundaries_id : str
        Identifier of the algorithm used to compute the boundaries.
    labels_id : str
        Identifier of the algorithm used to compute the labels.
    params : dict
        Additional search parameters. E.g. {"feature" : "pcp"}.

    Returns
    -------
    boundaries : np.array((N,2))
        Array containing the estimated boundaries in intervals.
    labels : np.array(N)
        Array containing the estimated labels.
        Empty array if labels_id is None.
    """
    # Open file and read jams
    jam = jams.load(est_file)

    # Find correct estimation
    est = find_estimation(jam, boundaries_id, labels_id, params)
    if est is None:
        raise NoEstimationsError("No estimations for file: %s" % est_file)

    # Get data values
    all_boundaries, all_labels = est.to_interval_values()

    if params["hier"]:
        hier_bounds = defaultdict(list)
        hier_labels = defaultdict(list)
        for bounds, labels in zip(all_boundaries, all_labels):
            level = labels["level"]
            hier_bounds[level].append(bounds)
            hier_labels[level].append(labels["label"])
        # Order
        all_boundaries = []
        all_labels = []
        for key in sorted(list(hier_bounds.keys())):
            all_boundaries.append(np.asarray(hier_bounds[key]))
            all_labels.append(np.asarray(hier_labels[key]))

    return all_boundaries, all_labels
def read_estimations(est_file, boundaries_id, labels_id=None, **params):
    """Reads the estimations (boundaries and/or labels) from a jams file
    containing the estimations of an algorithm.

    Parameters
    ----------
    est_file : str
        Path to the estimated file (JAMS file).
    boundaries_id : str
        Identifier of the algorithm used to compute the boundaries.
    labels_id : str
        Identifier of the algorithm used to compute the labels.
    params : dict
        Additional search parameters. E.g. {"feature" : "pcp"}.

    Returns
    -------
    boundaries : np.array((N,2))
        Array containing the estimated boundaries in intervals.
    labels : np.array(N)
        Array containing the estimated labels.
        Empty array if labels_id is None.
    """
    # Open file and read jams
    jam = jams.load(est_file)

    # Find correct estimation
    est = find_estimation(jam, boundaries_id, labels_id, params)
    if est is None:
        raise NoEstimationsError("No estimations for file: %s" % est_file)

    # Get data values
    all_boundaries, all_labels = est.to_interval_values()

    if params["hier"]:
        hier_bounds = defaultdict(list)
        hier_labels = defaultdict(list)
        for bounds, labels in zip(all_boundaries, all_labels):
            level = labels["level"]
            hier_bounds[level].append(bounds)
            hier_labels[level].append(labels["label"])
        # Order
        all_boundaries = []
        all_labels = []
        for key in sorted(list(hier_bounds.keys())):
            all_boundaries.append(np.asarray(hier_bounds[key]))
            all_labels.append(np.asarray(hier_labels[key]))

    return all_boundaries, all_labels
def read_estimations ( est_file , boundaries_id , labels_id = None , * * params ) : # Open file and read jams jam = jams . load ( est_file ) # Find correct estimation est = find_estimation ( jam , boundaries_id , labels_id , params ) if est is None : raise NoEstimationsError ( "No estimations for file: %s" % est_file ) # Get data values all_boundaries , all_labels = est . to_interval_values ( ) if params [ "hier" ] : hier_bounds = defaultdict ( list ) hier_labels = defaultdict ( list ) for bounds , labels in zip ( all_boundaries , all_labels ) : level = labels [ "level" ] hier_bounds [ level ] . append ( bounds ) hier_labels [ level ] . append ( labels [ "label" ] ) # Order all_boundaries = [ ] all_labels = [ ] for key in sorted ( list ( hier_bounds . keys ( ) ) ) : all_boundaries . append ( np . asarray ( hier_bounds [ key ] ) ) all_labels . append ( np . asarray ( hier_labels [ key ] ) ) return all_boundaries , all_labels
Reads the estimations (boundaries and/or labels) from a jams file
    containing the estimations of an algorithm.

    Parameters
    ----------
    est_file : str
        Path to the estimated file (JAMS file).
    boundaries_id : str
        Identifier of the algorithm used to compute the boundaries.
    labels_id : str
        Identifier of the algorithm used to compute the labels.
    params : dict
        Additional search parameters. E.g. {"feature" : "pcp"}.

    Returns
    -------
    boundaries : np.array((N,2))
        Array containing the estimated boundaries in intervals.
    labels : np.array(N)
        Array containing the estimated labels.
        Empty array if labels_id is None.
Reads the estimations ( boundaries and / or labels ) from a jams file containing the estimations of an algorithm .