Exemple #1
0
def export_system(system, directory) :
    from fuzzy.doc.plot.gnuplot import doc
    
    d = doc.Doc(directory)
    d.createDoc(system)

    import fuzzy.doc.structure.dot.dot
    import subprocess
    for name,rule in system.rules.items():
            cmd = "dot -T png -o '%s/fuzzy-Rule %s.png'" % (directory,name)
            f = subprocess.Popen(cmd, shell=True, bufsize=32768, stdin=subprocess.PIPE).stdin
            fuzzy.doc.structure.dot.dot.print_header(f,"XXX")
            fuzzy.doc.structure.dot.dot.print_dot(rule,f,system,"")
            fuzzy.doc.structure.dot.dot.print_footer(f)
    cmd = "dot -T png -o '%s/fuzzy-System.png'" % directory
    f = subprocess.Popen(cmd, shell=True, bufsize=32768, stdin=subprocess.PIPE).stdin
    fuzzy.doc.structure.dot.dot.printDot(system,f)

    d.overscan=0
    in_vars = [name for name,var in system.variables.items() if isinstance(var,fuzzy.InputVariable.InputVariable)]
    out_vars = [name for name,var in system.variables.items() if isinstance(var,fuzzy.OutputVariable.OutputVariable)]
    
    if len(in_vars) == 2 and not (
            isinstance(system.variables[in_vars[0]].fuzzify,fuzzy.fuzzify.Dict.Dict)
        or
            isinstance(system.variables[in_vars[1]].fuzzify,fuzzy.fuzzify.Dict.Dict)
    ):
        for out_var in out_vars:
            args = []
            if isinstance(system.variables[out_var].defuzzify,fuzzy.defuzzify.Dict.Dict):
                for adj in system.variables[out_var].adjectives:
                    d.create3DPlot_adjective(system, in_vars[0], in_vars[1], out_var, adj, {})
            else:
                d.create3DPlot(system, in_vars[0], in_vars[1], out_var, {})
Exemple #2
0
 def createDoc(self, directory):
     from fuzzy.doc.plot.gnuplot import doc
     d = doc.Doc(directory)
     d.createDoc(self.system)
     d.overscan = 0
     d.create3DPlot(self.system, "Phi", "dPhi_dT", "a", {
         "X": 0.,
         "dX_dT": 0.
     })
def plotxxx(controller):
    from fuzzy.doc.plot.gnuplot import doc
    from fuzzy.OutputVariable import OutputVariable
    directory = "../doc/fuzzy"
    d = doc.Doc(directory)
    for name, v in controller.system.variables.items():
        if isinstance(v, OutputVariable):
            d.createDocSets(v.defuzzify.activated_sets,
                            name + "_activated_sets")
            d.createDocSets({"accumulate": v.defuzzify.accumulated_set},
                            name + "_accumulate")
 def createDoc(self, directory):
     """
     \brief Crea documentacion de todas las variables.
     \details Crea documentacion de todas las variables.
     \param self este parametro no es necesario escribir
     \param directory direccion en donde se van a generar los archivos
     """
     from fuzzy.doc.plot.gnuplot import doc
     d = doc.Doc(directory)
     d.createDoc(self.system)
     d.overscan = 0
     d.create3DPlot(self.system, "error", "vel", {"X": 0., "dX_dT": 0.})