def read_wv_master_file(wv_master_file, lines='brightest', debugplot=0):
    """read arc line wavelengths from external file.

    Parameters
    ----------
    wv_master_file : string
        File name of txt file containing the wavelength database.
    lines : string
        Indicates which lines to read. For files with a single column
        or two columns this parameter is irrelevant. For files with
        three columns, lines='brightest' indicates that only the
        brightest lines are read, whereas lines='all' means that all
        the lines are considered.
    debugplot : int
        Determines whether intermediate computations and/or plots
        are displayed. The valid codes are defined in
        numina.array.display.pause_debugplot.

    Returns
    -------
    wv_master : 1d numpy array
        Array with arc line wavelengths.

    """

    # protection
    if lines not in ['brightest', 'all']:
        raise ValueError('Unexpected lines=' + str(lines))

    # read table from txt file
    master_table = np.genfromtxt(wv_master_file)

    wv_master = read_wv_master_from_array(master_table, lines)

    if abs(debugplot) >= 10:
        print("Reading master table: " + wv_master_file)
        print("wv_master:\n", wv_master)

    return wv_master