parmfiles = np.array(parmfiles)[~bad_idx].tolist()
    manager = BAPHYExperiment(parmfiles)

    # make sure only loaded actives
    pf_mask = [
        True if k['BehaveObjectClass'] == 'RewardTargetLBHB' else False
        for k in manager.get_baphy_exptparams()
    ]
    if sum(pf_mask) == len(manager.parmfile):
        pass
    else:
        parmfiles = np.array(manager.parmfile)[pf_mask].tolist()
        manager = BAPHYExperiment(parmfiles)

    # get reaction times of targets, only for "correct" trials
    bev = manager.get_behavior_events(**options)
    bev = manager._stack_events(bev)
    bev = bev[bev.invalidTrial == False]
    bev, params = TBP(bev, manager.get_baphy_exptparams()[0])
    _rts = get_reaction_times(params, bev, **options)

    # get early / middle / late rts
    nTrials = len(bev.Trial.unique())
    edges = np.quantile(range(nTrials), [.25, .5, .75]).astype(int)
    edges = bev.Trial.unique()[edges]
    # then define three overlapping ranges. Early, middle, late
    if rel:
        t1 = range(1, edges[1])
        t2 = range(edges[0], edges[2])
        t3 = range(edges[1], max(bev.Trial))
    if absolute:
parmfiles['date'] = [
    dt.datetime.strptime('-'.join(x.split('_')[1:-2]), '%Y-%m-%d')
    for x in parmfiles.parmfile
]
ed = dt.datetime.strptime(earliest_date, '%Y_%m_%d')
parmfiles = parmfiles[parmfiles.date > ed]

results = pd.DataFrame(index=parmfiles['date'].unique(),
                       columns=['Early', 'Late', 'Overall', 'nTrials'])
options = {}
for date in parmfiles['date'].unique():
    files = [p for i, p in parmfiles.iterrows() if p.date == date]
    files = [f['resppath'] + f['parmfile'] for f in files]

    manager = BAPHYExperiment(files)
    events = manager.get_behavior_events(correction_method='baphy', **options)
    events = manager._stack_events(events)

    good_trials = events[(~events.invalidTrial)].Trial.unique()
    # note, number of target trials in performance dict doesn't have to add up to
    # number of window_length trials. There could (definitely are) FA trials
    # that are "valid trials", but not counted for behavior analysis bc target never
    # played

    params = manager.get_baphy_exptparams()[0]
    targets = np.array(params['TrialObject'][1]['TargetHandle'][1]['Names'])
    pump_dur = np.array(params['BehaveObject'][1]['PumpDuration'])
    r_tar = targets[pump_dur > 0][0]
    nr_tar = targets[pump_dur == 0][0]

    if len(good_trials) < (window_length * 1.5):