示例#1
0
def plotNorm(norm, name, params=None, gnuplot=None, interactive=False):
    """Plot a given norm using the name for the title/filename.
    For parametric norms, it uses several values of the parameter.
    These values depend on the valid range of the parameter.

    For different parameters a letter is inserted in the filename of get a consistent sorting of filenames.
    (They sort then according ascending parameter values.)
    
    If gnuplot is not None, use it for the plot, otherwise create a own instance.
    If interactive is True, wait after plotting for key press.
    """
    import fuzzy.norm.ParametricNorm
    if isinstance(norm, fuzzy.norm.ParametricNorm.ParametricNorm):
        if params is None:
            params = get_test_params(norm.p_range)
        # use letters to get sortable filenames
        for p, letter in zip(params, string.ascii_lowercase):
            try:
                norm.p = p
                title = "%s (p=%s)" % (name, p)
                filename = "%s_%s_%s" % (name, letter, p)
                plot(norm, title, filename, gnuplot, interactive)
            except:
                import traceback
                traceback.print_exc()
                raw_input('Please press return to continue...\n')
    else:
        title = "%s" % (name)
        filename = title
        plot(norm, title, filename, gnuplot, interactive)
def plotComplement(c,name,s,name2,params=None,gnuplot=None,interactive=False):
    """Plot a given complement with the given set, using the names for the title/filename.
    For parametric complements, it uses several values of the parameter.
    These values depend on the valid range of the parameter.

    For different parameters a letter is inserted in the filename of get a consistent sorting of filenames.
    (They sort then according ascending parameter values.)
    
    If gnuplot is not None, use it for the plot, otherwise create a own instance.
    If interactive is True, wait after plotting for key press.
    """    
    import fuzzy.complement.Parametric
    if isinstance(c,fuzzy.complement.Parametric.Parametric):
        if params is None:
            params = get_test_params(c.p_range)
        # use letters to get sortable filenames
        for p,letter in zip(params,string.ascii_lowercase):
            c.p = p
            title = "%s %s (p=%s)" % (name,name2,p)
            filename = "%s_%s_%s_%s" % (name,name2,letter,p)
            plot(c,s,title,filename,gnuplot,interactive)
    else:
        title = "%s_%s" % (name,name2)
        filename = "%s_%s" % (name,name2)
        plot(c,s,title,filename,gnuplot,interactive)
def plotComplement(c,
                   name,
                   s,
                   name2,
                   params=None,
                   gnuplot=None,
                   interactive=False):
    """Plot a given complement with the given set, using the names for the title/filename.
    For parametric complements, it uses several values of the parameter.
    These values depend on the valid range of the parameter.

    For different parameters a letter is inserted in the filename of get a consistent sorting of filenames.
    (They sort then according ascending parameter values.)
    
    If gnuplot is not None, use it for the plot, otherwise create a own instance.
    If interactive is True, wait after plotting for key press.
    """
    import fuzzy.complement.Parametric
    if isinstance(c, fuzzy.complement.Parametric.Parametric):
        if params is None:
            params = get_test_params(c.p_range)
        # use letters to get sortable filenames
        for p, letter in zip(params, string.ascii_lowercase):
            c.p = p
            title = "%s %s (p=%s)" % (name, name2, p)
            filename = "%s_%s_%s_%s" % (name, name2, letter, p)
            plot(c, s, title, filename, gnuplot, interactive)
    else:
        title = "%s_%s" % (name, name2)
        filename = "%s_%s" % (name, name2)
        plot(c, s, title, filename, gnuplot, interactive)
示例#4
0
def plotNorm(norm,name,params=None,gnuplot=None,interactive=False):
    """Plot a given norm using the name for the title/filename.
    For parametric norms, it uses several values of the parameter.
    These values depend on the valid range of the parameter.

    For different parameters a letter is inserted in the filename of get a consistent sorting of filenames.
    (They sort then according ascending parameter values.)
    
    If gnuplot is not None, use it for the plot, otherwise create a own instance.
    If interactive is True, wait after plotting for key press.
    """
    import fuzzy.norm.ParametricNorm
    if isinstance(norm,fuzzy.norm.ParametricNorm.ParametricNorm):
        if params is None:
            params = get_test_params(norm.p_range)
        # use letters to get sortable filenames
        for p,letter in zip(params,string.ascii_lowercase):
            try:
                norm.p = p
                title = "%s (p=%s)" % (name,p)
                filename = "%s_%s_%s" % (name,letter,p)
                plot(norm,title,filename,gnuplot,interactive)
            except:
                import traceback
                traceback.print_exc()
                raw_input('Please press return to continue...\n')
    else:
        title = "%s" % (name)
        filename = title
        plot(norm,title,filename,gnuplot,interactive)