def METHOD_NAME(df, chan_info, window=250):
    chan = df.channel.unique()[0]
    df["isPulser"] = 0
    try:
        pi = chan_info.loc[chan]
    except KeyError:
        return df
    energy_name = pi.energy_name
    pulser_energy = pi.pulser_energy
    period = pi.pulser_period
    peak_e_err = pi.peak_e_err
    # pulser_energy, peak_e_err, period, energy_name = chan_info
    e_cut = (df[energy_name] < pulser_energy + peak_e_err) & (
        df[energy_name] > pulser_energy - peak_e_err
    )
    df_pulser = df[e_cut]
    time_since_last = np.zeros(len(df_pulser))
    time_since_last[1:] = (
        df_pulser.timestamp.values[1:] - df_pulser.timestamp.values[:-1]
    )
    # plt.figure()
    # plt.hist(time_since_last, bins=1000)
    # plt.show()
    mode_idxs = (time_since_last > period - window) & (
        time_since_last < period + window
    )
    pulser_events = np.count_nonzero(mode_idxs)
    # print("pulser events: {}".format(pulser_events))
    if pulser_events < 3:
        return df
    df_pulser = df_pulser[mode_idxs]
    ts = df_pulser.timestamp.values
    diff_zero = np.zeros(len(ts))
    diff_zero[1:] = np.around((ts[1:] - ts[:-1]) / period)
    diff_cum = np.cumsum(diff_zero)
    z = np.polyfit(diff_cum, ts, 1)
    p = np.poly1d(z)
    # plt.figure()
    # xp = np.linspace(0, diff_cum[-1])
    # plt.plot(xp,p(xp))
    # plt.scatter(diff_cum,ts)
    # plt.show()
    period = z[0]
    phase = z[1]
    mod = np.abs(df.timestamp - phase) % period
    # pulser_mod  =np.abs(df_pulser.timestamp - phase) %period
    # pulser_mod[ pulser_mod > 10*window] = period - pulser_mod[ pulser_mod > 10*window]
    # plt.hist(pulser_mod , bins="auto")
    # plt.show()
    period_cut = (mod < window) | ((period - mod) < window)
    # print("pulser events: {}".format(np.count_nonzero(e_cut & period_cut)))
    df.loc[e_cut & period_cut, "isPulser"] = 1
    return df