def load_run(filename, indir, args):
    (task, method, seed) = filename.relative_to(indir).parts[:(- 1)]
    prefix = f'indir{(args.indir.index(indir) + 1)}_'
    if (task == 'atari_jamesbond'):
        task = 'atari_james_bond'
    seed = (prefix + seed)
    if args.prefix:
        method = (prefix + method)
    df = load_jsonl(filename)
    if (df is None):
        print('Skipping empty run')
        return
    try:
        df = df[[args.xaxis, args.yaxis]].dropna()
        if args.maxval:
            df = df.replace([(+ np.inf)], (+ args.maxval))
            df = df.replace([(- np.inf)], (- args.maxval))
            df[args.yaxis] = df[args.yaxis].clip((- args.maxval), (+ args.maxval))
    except KeyError:
        return
    xs = df[args.xaxis].to_numpy()
    ys = df[args.yaxis].to_numpy()
    bins = (BINS[task.split('_')[0]] if (args.bins == (- 1)) else args.bins)
    if bins:
        borders = np.arange(0, (xs.max() + 1e-08), bins)
        (xs, ys) = bin_scores(xs, ys, borders)
    if (not len(xs)):
        print('Skipping empty run', task, method, seed)
        return
    return Run(task, method, seed, xs, ys)
def load_run(filename, indir, args):
    (task, method, seed) = filename.relative_to(indir).parts[:(- 1)]
    prefix = f'indir{(args.indir.index(indir) + 1)}_'
    if (task == 'atari_jamesbond'):
        task = 'atari_james_bond'
    seed = (prefix + seed)
    if args.prefix:
        method = (prefix + method)
    df = load_jsonl(filename)
    if (df is None):
        print('Skipping empty run')
        return
    try:
        df = df[[args.xaxis, args.yaxis]].dropna()
        if args.maxval:
            df = df.replace([(+ np.inf)], (+ args.maxval))
            df = df.replace([(- np.inf)], (- args.maxval))
            df[args.yaxis] = df[args.yaxis].clip((- args.maxval), (+ args.maxval))
    except KeyError:
        return
    xs = df[args.xaxis].to_numpy()
    ys = df[args.yaxis].to_numpy()
    bins = (BINS[task.split('_')[0]] if (args.bins == (- 1)) else args.bins)
    if bins:
        borders = np.arange(0, (xs.max() + 1e-08), bins)
        (xs, ys) = bin_scores(xs, ys, borders)
    if (not len(xs)):
        print('Skipping empty run', task, method, seed)
        return
    return Run(task, method, seed, xs, ys)