Plot all wfdb records in a directory (by finding header files), one at
    a time, until the 'enter' key is pressed.

    Parameters
    ----------
    directory : str, optional
        The directory in which to search for WFDB records. Defaults to
        current working directory.

def plot_all_records(directory=''):
    """
    Plot all wfdb records in a directory (by finding header files), one at
    a time, until the 'enter' key is pressed.

    Parameters
    ----------
    directory : str, optional
        The directory in which to search for WFDB records. Defaults to
        current working directory.

    """
    directory = directory or os.getcwd()

    headers = [f for f in os.listdir(directory) if os.path.isfile(
        os.path.join(directory, f))]
    headers = [f for f in headers if f.endswith('.hea')]

    records = [h.split('.hea')[0] for h in headers]
    records.sort()

    for record_name in records:
        record = rdrecord(os.path.join(directory, record_name))

        plot_wfdb(record, title='Record - %s' % record.record_name)
        input('Press enter to continue...')