예제 #1
0
 def _modifyOption(self, key, entry):
     if key[-2:] == "_z" and entry == " 2D Plot ":
         self.grapher[key] = None
         return
     self.grapher[key] = self.grapher.parseoption(key, entry,
                                                  parseC.parseC())
     if key == "type":
         self.typeUpdateCallback()
예제 #2
0
 def load(self,**kw):
     """Load solution with the given AUTO constants.
     Returns a shallow copy with a copied set of updated constants
     """
     constants = kw.get("constants")
     if "constants" in kw:
         del kw["constants"]
     c = parseC.parseC(self.c)
     datakw = {}
     for key in self.data_keys:
         if key in kw and (key not in c or key in ["LAB", "TY"]):
             datakw[key] = kw[key]
             if key not in ["LAB", "TY"]:
                 del kw[key]
     oldirs = c["IRS"]
     c.update(constants, **kw)
     if oldirs is not None and c["IRS"] == 0:
         return AUTOSolution(constants=c, **datakw)
     if self["LAB"] != 0:
         c["IRS"] = self["LAB"]
     return AUTOSolution(self, constants=c, **datakw)
예제 #3
0
파일: runAUTO.py 프로젝트: ysarri/auto-07p
    def __init__(self, **kw):
        # Set the signal handler
        if hasattr(signal, 'SIGALRM') and demo_max_time > 0:
            signal.signal(signal.SIGALRM, self.__handler)

        self.options = {}
        self.options["log"] = None
        self.options["err"] = None
        self.options["auto_dir"] = None
        self.options["demos_dir"] = None
        self.options["equation"] = "all"
        self.options["verbose"] = "yes"  # note: this is ignored!
        self.options["clean"] = "no"
        self.options["dir"] = "."
        self.options["executable"] = None
        self.options["command"] = None
        self.options["makefile"] = None
        self.options["constants"] = parseC.parseC()
        self.options["solution"] = parseS.AUTOSolution()
        self.options["homcont"] = None
        self.options["selected_solution"] = None

        kw = self.config(**kw)
예제 #4
0
    def __init__(self,parent=None,**kw):

        optionDefaults = {}
        # The kind of diagram (single solution vs. bifur diagram)
        optionDefaults["type"]     = ("bifurcation",self.__optionCallback)  
        # The X column
        optionDefaults["bifurcation_x"] = ([0],self.__optionCallback)
        optionDefaults["solution_x"]    = ([-1],self.__optionCallback)
        # The Y column
        optionDefaults["bifurcation_y"] = ([1],self.__optionCallback)
        optionDefaults["solution_y"]    = ([0],self.__optionCallback)
        # The Z column
        optionDefaults["bifurcation_z"] = (None,self.__optionCallback)
        optionDefaults["solution_z"]    = (None,self.__optionCallback)
        # The coordinate names
        optionDefaults["bifurcation_coordnames"] = (None,self.__optionCallback)
        optionDefaults["solution_indepvarname"]  = (None,self.__optionCallback)
        optionDefaults["solution_coordnames"]    = (None,self.__optionCallback)
        optionDefaults["labelnames"]             = (None,self.__optionCallback)
        # Sets of labels that the user is likely to want to use
        optionDefaults["label_defaults"]   = (None,self.__optionCallback)
        # Sets of columns that the user is likely to want to use
        optionDefaults["bifurcation_column_defaults"]   = (None,self.__optionCallback)
        optionDefaults["solution_column_defaults"]   = (None,self.__optionCallback)
        # The index of the solution we wish to draw
        optionDefaults["index"]    = ([0],self.__optionCallback)
        # The label of the solution we wish to draw
        optionDefaults["label"]    = ([0],self.__optionCallback)

        # Already parsed data structures
        optionDefaults["bifurcation_diagram"]          = (parseB.parseB(),self.__optionCallback)
        optionDefaults["solution"]          = (parseS.parseS(),self.__optionCallback)
        optionDefaults["bifurcation_diagram_filename"] = ("",self.__optionCallback)
        optionDefaults["solution_filename"] = ("",self.__optionCallback)
        optionDefaults["runner"]         = (None,self.__optionCallback)
        optionDefaults["mark_t"]         = (None,self.__optionCallback)

        optionDefaults["letter_symbols"] = (True,self.__optionCallback)
        optionDefaults["bifurcation_symbol"]     = ("B",self.__optionCallback)
        optionDefaults["limit_point_symbol"]     = ("L",self.__optionCallback)
        optionDefaults["hopf_symbol"]            = ("H",self.__optionCallback)
        optionDefaults["zero_hopf_symbol"]       = ("ZH",self.__optionCallback)
        optionDefaults["bogdanov_takens_symbol"] = ("BT",self.__optionCallback)
        optionDefaults["cusp_symbol"]            = ("CP",self.__optionCallback)
        optionDefaults["generalized_hopf_symbol"]= ("GH",self.__optionCallback)
        optionDefaults["1_1_resonance_symbol"]   = ("R1",self.__optionCallback)
        optionDefaults["1_2_resonance_symbol"]   = ("R2",self.__optionCallback)
        optionDefaults["1_3_resonance_symbol"]   = ("R3",self.__optionCallback)
        optionDefaults["1_4_resonance_symbol"]   = ("R4",self.__optionCallback)
        optionDefaults["fold_flip_symbol"]       = ("LPD",self.__optionCallback)
        optionDefaults["fold_torus_symbol"]      = ("LTR",self.__optionCallback)
        optionDefaults["flip_torus_symbol"]      = ("PTR",self.__optionCallback)
        optionDefaults["torus_torus_symbol"]     = ("TTR",self.__optionCallback)
        optionDefaults["period_doubling_symbol"] = ("D",self.__optionCallback)
        optionDefaults["torus_symbol"]           = ("T",self.__optionCallback)
        optionDefaults["user_point_symbol"]      = ("U",self.__optionCallback)
        optionDefaults["error_symbol"]           = ("X",self.__optionCallback)

        optionDefaults["ps_colormode"]           = ("color",self.__optionCallback)
        optionDefaults["stability"]              = (False,self.__optionCallback)
        optionDefaults["coloring_method"]        = ("curve",self.__optionCallback)

        parser = AUTOutil.getAUTORC("AUTO_plotter")
        optionDefaultsRC = {}
        c = parseC.parseC()
        for option in parser.options("AUTO_plotter"):
            try:
                optionDefaultsRC[option] = self.parseoption(
                    option,parser.get("AUTO_plotter",option),c)
            except:
                optionDefaultsRC[option] = self.parseoption(
                    option,parser.get("AUTO_plotter",option,raw=True),c)
        # Let these override the RC options, if specified.
        for key in ["hide","xlabel","ylabel","zlabel"]:
            if key in kw:
                optionDefaultsRC[key] = kw[key]

        self.__needsPlot = None
        grapher.GUIGrapher.__init__(self,parent,**optionDefaultsRC)

        self.addOptions(**optionDefaults)
        self.addRCOptions(**optionDefaultsRC)
        for options in [optionDefaultsRC, kw]:
            if "letter_symbols" in options:
                self.__optionCallback("letter_symbols",
                                      options["letter_symbols"], options)
                del options["letter_symbols"]
        plotter._configNoDraw(self,**optionDefaultsRC)
        plotter._configNoDraw(self,**kw)
        self._plotNoDraw()
        self.__needsPlot = None
        for coord in 'x', 'y', 'z':
            if "min"+coord not in kw or "max"+coord not in kw:
                self.computeRange(coord,kw.get("min"+coord),
                                  kw.get("max"+coord))
        grapher.GUIGrapher.plot(self)
예제 #5
0
파일: bifDiag.py 프로젝트: ysarri/auto-07p
 def __realinit(self, fort7_filename, fort8_filename, fort9_filename,
                constants):
     ioerrors = []
     try:
         parseB.parseBR.__init__(self, fort7_filename)
         for i, d in enumerate(self):
             self[i] = bifDiagBranch(d)
     except IOError:
         ioerrors.append(str(sys.exc_info()[1]))
         parseB.parseBR.__init__(self)
         fort7_filename = None
     if isinstance(fort8_filename, parseS.AUTOSolution):
         fort8_filename = [fort8_filename]
     try:
         solution = parseS.parseS(fort8_filename)
     except IOError:
         ioerrors.append(str(sys.exc_info()[1]))
         solution = None
         if fort7_filename is None:
             raise AUTOExceptions.AUTORuntimeError('\n'.join(ioerrors))
     if fort7_filename is None and fort8_filename is not None:
         # simulate a bifurcation diagram
         labels = {}
         for s in solution:
             br = s["Branch number"]
             if labels == {} or br != branch.BR:
                 if labels != {}:
                     branch.labels = Points.PointInfo(labels)
                 branch = bifDiagBranch()
                 self.append(branch)
                 branch.BR = br
                 branch.coordarray = []
                 branch.coordnames = []
                 branch.headernames = []
                 branch.headerlist = []
                 branch.c = constants
                 labels = {}
                 base = 0
                 i = 0
             pt = s["PT"]
             lab = s["LAB"]
             ty = s["TY number"]
             if i >= base + pt - 1:
                 # point numbers wrapped around
                 base += 9999
             i = base + pt - 1
             labels[i] = {s["TY"]: {"LAB": lab, "TY number": ty, "PT": pt}}
         if labels != {}:
             branch.labels = Points.PointInfo(labels)
     if fort9_filename is not None and self.data != []:
         try:
             # for now just attach diagnostics information to first branch
             self[0].diagnostics = parseD.parseD(fort9_filename)
         except IOError:
             pass
     i = 0
     if solution is not None:
         for d in self:
             if constants is None and d.c is not None:
                 constants = d.c
             constants = parseC.parseC(constants)
             for k in constants:
                 if k in self.nonekeys:
                     constants[k] = None
             for ind in d.labels.getIndices():
                 if i >= len(solution):
                     break
                 x = d._gettypelabel(ind)[1]
                 s = solution[i]
                 if x.get("LAB", 0) != 0 or s["LAB"] == 0:
                     i = i + 1
                     s = x["solution"] = parseS.AUTOSolution(
                         s, constants=constants)
                     if d.coordnames != []:
                         s.b = d[ind]