def freq(traj):
    ts = traj.getEventTimes('thresh_ev')
    if len(ts) > 1:
        return 1000./(ts[-1]-ts[-2])
    else:
        return 0
dataset/ETHPy150Open robclewley/compneuro/Ch13_1.py/freq/original