def timeshift(df, threshold, criterion="Infected", time="time"):
    """Add a series of adjusted times, zeroed on a threshold number
    of infections.

    Arguments:
    df -- A Pandas dataframe in the format output by the SIR function
    threshold -- an integer number of infections to be set to time zero

    Keyword arguments:
    criterion -- the column in df containing the critrion to which the
    threshold applies (default "Infected")
    time -- the column in df containing the time variable to adjust (default
    "time")
    """
    timeshift = df[df[criterion] >= threshold][time].min()
    df["time_adj"] = df[time] - timeshift
    return df