else:  #read the file containing the percentage of observed redshifts per sector
        frac_redshift = np.loadtxt(args.fc_file,
                                   usecols=(int(args.fc_column), ))

    for fn in args.ifname:  #loop through the input file names

        if (args.verbose == True):
            print("Process catalogue '{0}'.".format(fn.name))
        cat = np.loadtxt(fn)
        if (args.verbose == True):
            print("Catalogue read")
        if (args.shuffle != None):  #if it is required to shuffle the catalogue
            np.random.shuffle(cat)  #shuffle the catalogue
            ofilesh, skip = mf.insert_src(
                fn.name,
                args.shuffle,
                overwrite=args.soverwrite,
                skip=args.sskip
            )  #create the file name for the shuffled catalogue
            if (skip == True):
                print("Skipping")
                continue
            fn = open(ofilesh,
                      "w")  #open the shuffled catalogue output file name
            if (args.header == True):
                of.write(headersh)  #add the header
            np.savetxt(fn, cat, fmt=args.sfmt, delimiter="\t")  #save the file
            fn.close()

        #create the output file name
        if (args.replace == None):
            ofile, skip = mf.insert_src(fn.name,
  p.add_argument("-c", "--column", action="store", type=int, default=4, help="Column number in the input file containing the covariance.")

  return p.parse_args(args=argv)


if __name__ == "__main__":   # if is the main

  args = parse(sys.argv[1:])

  for fn in args.ifname:  #file name loop
    if(args.verbose == True):
      print("Process catalogue '{0}'.".format(fn.name))

    #create the output file name and check it
    if(args.replace == None):
      ofile, skip = mf.insert_src(fn.name, args.insert, overwrite=args.overwrite, skip=args.skip)
    else:
      ofile, skip = mf.replace_src(fn.name, args.replace, overwrite=args.overwrite, skip=args.skip)
    if(skip == True):
      print("Skipping")
      continue

    cov = np.loadtxt(fn, usecols=[args.column])   #read the covariance

    dimcov = int(np.sqrt(cov.size))  #size of the output covariance matrix

    cov = cov.reshape([dimcov,dimcov])   #reshape to a square

    np.savetxt(ofile, cov, fmt="%8.7e", delimiter="\t")   #save the matrix
    if(args.verbose == True):
      print( "File '{0}' saved".format(ofile) )
                   default="%7.6e",
                   action="store",
                   nargs='+',
                   help="Format of the output files")

    return p.parse_args(args=argv)


if __name__ == "__main__":  #if it's the main

    args = parse(sys.argv[1:])

    #create the output file names
    if (args.replace == None):  #first file
        ofiled1, skip = mf.insert_src(args.catname.name,
                                      args.insert[::2],
                                      overwrite=args.overwrite)
        ofiled2, skip = mf.insert_src(args.catname.name,
                                      args.insert[1:],
                                      overwrite=args.overwrite)
    else:
        ofiled1, skip = mf.replace_src(args.catname.name,
                                       args.replace[:2],
                                       overwrite=args.overwrite)
        ofiled2, skip = mf.replace_src(args.catname.name,
                                       args.replace[::2],
                                       overwrite=args.overwrite)

    cat = np.loadtxt(args.catname)  #read the input catalogue
    if (args.sepname !=
            None):  #if a file with the criteria for the separation is given