def object_generator(path, mass):
     for s in os.listdir(path):
         # find the .txt files
         if '.txt' in s:
             f_path = os.path.join(path, s)
             yield rd.CV(filename=f_path, mass=mass)
def multi_cv(
        ax,
        path,
        title=None,
        mass=1.0,
        color_set=['black', 'blue', 'green', 'red', 'pink', 'brown', 'yellow'],
        xlabel=None,
        ylabel=None,
        filter_on=False,
        smooth_range=None,
        legend_font=12,
        **kwargs):
    '''Draw multiple cv curves on a single axe\
       Arguments:\
       ax\
       path: the path of the file containing .txt files\
       title\
       mass: mass or surface area or volume of the sample'''

    gp.Update_axe(ax, title=title, **kwargs)
    # the list for Dataframe objects
    cv = []
    for s in os.listdir(path):
        # find the .txt files
        if '.txt' in s:
            f_path = os.path.join(path, s)
            obj = rd.CV(filename=f_path, mass=mass)

            cv.append(obj)
    # the list for line objects in an axe

    for counter, obj in enumerate(cv):
        #  if filter is on
        if filter_on == True and smooth_range is not None:
            gp.MultiLine(smoother_cv(obj, smooth_range),
                         ax,
                         label=obj.scan_rate,
                         color=color_set[counter])

        # or not...
        else:
            gp.MultiLine(obj,
                         ax,
                         label=obj.scan_rate,
                         color=color_set[counter])

    if xlabel == None:

        ax.set_xlabel(cv[0].columns[0])

    else:
        ax.set_xlabel(xlabel)

    if ylabel == None:
        ax.set_ylabel(cv[0].columns[1])

    else:
        ax.set_ylabel(ylabel)

    gp.Auto_legend(ax,
                   bbox_to_anchor=(0, 1.03),
                   loc='upper left',
                   fontsize=legend_font)