Calculate a measure of a model in an output directory, averaged over
    all times when the model is at steady-state.

    Parameters
    ----------
    dirname: str
        Output directory
    measure_func: function
        Function which takes a :class:`Model` instance as a single argument,
        and returns the measure of interest, and its uncertainty.
    t_steady: None or float
        Time to consider the model to be at steady-state.
        `None` means just consider the latest time.

    Returns
    -------
    measure: numpy.ndarray
        Measure.
    measure_errs: numpy.ndarray
        Measure uncertainty.
        If no averaging is done, this is taken from the measure_func.
        Otherwise, the standard error over all samples is used.

def get_average_measure(dirname, measure_func, t_steady=None):
    """
    Calculate a measure of a model in an output directory, averaged over
    all times when the model is at steady-state.

    Parameters
    ----------
    dirname: str
        Output directory
    measure_func: function
        Function which takes a :class:`Model` instance as a single argument,
        and returns the measure of interest, and its uncertainty.
    t_steady: None or float
        Time to consider the model to be at steady-state.
        `None` means just consider the latest time.

    Returns
    -------
    measure: numpy.ndarray
        Measure.
    measure_errs: numpy.ndarray
        Measure uncertainty.
        If no averaging is done, this is taken from the measure_func.
        Otherwise, the standard error over all samples is used.
    """
    if t_steady is None:
        meas, meas_err = measure_func(get_recent_model(dirname))
        return meas, meas_err
    else:
        ms = [filename_to_model(fname) for fname in get_filenames(dirname)]
        ms_steady = [m for m in ms if m.t > t_steady]
        meas_list = [measure_func(m) for m in ms_steady]
        meases, meas_errs = zip(*meas_list)
        return np.mean(meases), sem(meases)