def timeseries_wrapper(timeseries, starttimeind=0):
    """Decorator to convert a list or numpy array into a function which accepts a timeind."""
    def out(timeind):
        return timeseries[timeind-starttimeind]
    return out