def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--path', type=str, help='Path to the head of the dataset', required=True)
    parser.add_argument('--filename', type=str, help='Name of file to save', default=None)
    parser.add_argument('--preloads-name', type=str, help='Name of preload file', default=None)
    parser.add_argument('--processes-per-cpu', '-proc', type=int, help='Processes per cpu (default: %(default)s)', default=2)
    parser.add_argument('--speed-factor', '-sf', type=float, help='Speed factor to normalize data (default: %(default)s)', default=14.0)
    parser.add_argument('--plot-clients', action='store_true', help='Add flag to plot the actions and speed of a client')
    args = parser.parse_args()
    if (not os.path.exists(os.path.join(os.getcwd(), 'data_analysis'))):
        os.mkdir(os.path.join(os.getcwd(), 'data_analysis'))
    print('Getting the dataframe...')
    if (args.preloads_name is not None):
        (df, augmented) = get_augmented_df(preloads_name=args.preloads_name)
        save_name = os.path.basename(args.preloads_name).split('.')[0]
    else:
        assert (args.filename is not None)
        assert args.filename.endswith('.npy')
        (df, augmented) = get_original_df(args.path, args.filename, args.processes_per_cpu)
        save_name = os.path.basename(args.filename).split('.')[0]
    print('Plotting data...')
    violin_plot(df, save_name, augmented)
    if args.plot_clients:
        print(f'Plotting actions taken by all clients in {args.path}...')
        plot_clients(path=args.path, df=df, augmented=augmented, speed_factor=args.speed_factor)
    print('Done!')
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--path', type=str, help='Path to the head of the dataset', required=True)
    parser.add_argument('--filename', type=str, help='Name of file to save', default=None)
    parser.add_argument('--preloads-name', type=str, help='Name of preload file', default=None)
    parser.add_argument('--processes-per-cpu', '-proc', type=int, help='Processes per cpu (default: %(default)s)', default=2)
    parser.add_argument('--speed-factor', '-sf', type=float, help='Speed factor to normalize data (default: %(default)s)', default=14.0)
    parser.add_argument('--plot-clients', action='store_true', help='Add flag to plot the actions and speed of a client')
    args = parser.parse_args()
    if (not os.path.exists(os.path.join(os.getcwd(), 'data_analysis'))):
        os.mkdir(os.path.join(os.getcwd(), 'data_analysis'))
    print('Getting the dataframe...')
    if (args.preloads_name is not None):
        (df, augmented) = get_augmented_df(preloads_name=args.preloads_name)
        save_name = os.path.basename(args.preloads_name).split('.')[0]
    else:
        assert (args.filename is not None)
        assert args.filename.endswith('.npy')
        (df, augmented) = get_original_df(args.path, args.filename, args.processes_per_cpu)
        save_name = os.path.basename(args.filename).split('.')[0]
    print('Plotting data...')
    violin_plot(df, save_name, augmented)
    if args.plot_clients:
        print(f'Plotting actions taken by all clients in {args.path}...')
        plot_clients(path=args.path, df=df, augmented=augmented, speed_factor=args.speed_factor)
    print('Done!')