Fit models to empirical result from a function in emp module

    Parameters
    ----------
    options : dict
        Option names and values for analysis
    core_results : list of tuples
        Output of function in emp

    Returns
    -------
    list of dicts
        Each element in list corresponds to a subset. The dict has a key for
        each model given in options, and the value is a list of fitted
        parameters (tuple), values (array), comparison statistic names (list),
        and comparison statistic values (list).

    Notes
    -----
    To determine if the empirical result refers to a curve or a distribution,
    the result dataframe is inspected for a column 'x', which indicates a
    curve.

def _fit_models(options, core_results):
    """
    Fit models to empirical result from a function in emp module

    Parameters
    ----------
    options : dict
        Option names and values for analysis
    core_results : list of tuples
        Output of function in emp

    Returns
    -------
    list of dicts
        Each element in list corresponds to a subset. The dict has a key for
        each model given in options, and the value is a list of fitted
        parameters (tuple), values (array), comparison statistic names (list),
        and comparison statistic values (list).

    Notes
    -----
    To determine if the empirical result refers to a curve or a distribution,
    the result dataframe is inspected for a column 'x', which indicates a
    curve.

    """

    logging.info("Fitting models")
    models = options['models'].replace(' ', '').split(';')

    # TODO: Make work for 2D results, i.e., curves, comm_sep, o_ring
    # TODO: Make work for curves in general (check if 'x' present in core_res)
    fit_results = []
    for core_result in core_results:  # Each subset
        fit_result = {}
        for model in models:
            fits = _get_fits(core_result, model, options)
            values = _get_values(core_result, model, fits)
            stat_names, stats = _get_comparison_stat(core_result, values,
                                                     model, fits)
            fit_result[model] = [fits, values, stat_names, stats]
        fit_results.append(fit_result)

    return fit_results