def main():
    p = argparse.ArgumentParser(description="Python program clean up LuMP pulsar datafiles after running LOFAR_Station_Beamformed_Recorder on a single LOFAR recording computer.", epilog="See the accompanying manual for more information.")
    # General setup
    p.add_argument("--datadir", type=str, default=".", help="*OPTIONAL*  Name of the directory of the main data recording area in which the LuMP files reside.  An absolute or a relative path name may be specified.  The datadir '.' may also be specified.", required=False)
    p.add_argument("--filename_base",action="append", type=str,help="*REQUIRED*  The base filename of the data.  If multiple writers were used for the same pulsar, then multiple filename_base arguments should be given, with the various base filenames", required=True)
    p.add_argument("--source_name", type=str, default=None, help="*OPTIONAL*  The name of the pulsar", required=False)
    p.add_argument("--source_RA", type=str, default=None, help="*OPTIONAL*  The right ascension of the pulsar as a string, in standard HH:MM:SS.SSS format.", required=False)
    p.add_argument("--source_Dec", type=str, default=None, help="*OPTIONAL*  The declination of the pulsar as a string, in the standard +-DD:MM:SS.SS format.", required=False)
    p.add_argument("--obs_id", default=None, type=str, help="*OPTIONAL*  Observation ID of this observation, as a string.")
    p.add_argument("--telescope", default=None, type=str, help="*OPTIONAL*  Fake telescope name to provide, when downstream pulsar software does not understand the LOFAR station name provided.")
    p.add_argument("--use_pipe", type=str, default=None, help="*OPTIONAL*  Speficy whether to read the data from a pipe (True) or to not do this (False).", required=False)
    # Information for the user
    p = MPIfR_LOFAR_LuMP_Recorder_Common.set_option_parsing_user_info(p,PROGRAM_VERSION)
    if((len(sys.argv) == 2) and (sys.argv[1] == "--stdin")):
        argv = MPIfR_LOFAR_LuMP_Recorder_Common.read_arguments_from_stdin()
        options = p.parse_args(argv)
    else:
        options = p.parse_args()
    MPIfR_LOFAR_LuMP_Recorder_Common.change_to_data_directory(options.datadir)
    MPIfR_LOFAR_LuMP_Recorder_Common.setup_logging(PROGRAM_NAME,options)
    info = []
    start = -1E300
    for fb in options.filename_base:
        i = get_info(fb)
        info.append(i)
        start = max(start,i[3])
    # check for offsets between files
    align_files = True
    for i in info:
        diff = start-i[3]
        num = diff/i[1]
        err = num-math.floor(num+0.5)
        if(abs(err) < 0.001):
            pass
        else:
            logging.warning("file datapoint alignment not possible")
            align_files = False
    # Now run through all of the data files and fix them
    for i,fb in enumerate(options.filename_base):
        # For the LuMP0 format, with 1 subband per file,
        # bytes_per_line = num channels * bytes_per_samp * 2 polarizations
        # For the LuMP1 format, with 1 subband per file,
        # bytes_per_line = num channels * bytes_per_samp * 2 polarizations
        #                  * beamlets_per_sample
        bytes_per_samp = data_type_in_bytes(info[i][0])
        if(info[i][5] == "LOFAR_DOFF_LuMP0_OUT"):
            bytes_per_line = info[i][2] * bytes_per_samp * 2
        elif(info[i][5] == "LOFAR_DOFF_LuMP1_OUT"):
            bytes_per_line = info[i][2] * bytes_per_samp * 2 * info[i][4]
        else:
            logging.error("unsupported writer type '%s'", info[i][5])
            raise RuntimeError("unsupported writer type")
        offset = 0
        if(align_files):
            diff = start-info[i][3]
            num = diff/info[i][1]
            num = int(math.floor(num+0.5))
            offset = num * bytes_per_line
        file_filename = fb + ".file_lis"
        fp = open(file_filename, "r")
        for datafile in fp:
            filename = datafile
            if(filename[-1] == '\n'):
                filename=filename[:-1]
            fix_header(filename, offset, start,
                       options.source_name,
                       options.source_RA, options.source_Dec,
                       options.obs_id, options.telescope,
                       options.use_pipe)
    logging.info("command finished ok")