示例#1
0
    def __init__(self, parent=None, cnf={}, **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"] = (["t"], self.__optionCallback)
        # The Y column
        optionDefaults["bifurcation_y"] = ([1], self.__optionCallback)
        optionDefaults["solution_y"] = ([0], 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["bifurcation_symbol"] = ("B", self.__optionCallback)
        optionDefaults["limit_point_symbol"] = ("L", self.__optionCallback)
        optionDefaults["hopf_symbol"] = ("H", 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["use_labels"] = (1, self.__optionCallback)

        parser = ConfigParser.ConfigParser()
        parser.add_section("AUTO_plotter")
        if os.path.exists(os.path.expandvars("$AUTO_DIR/.autorc")):
            parser.read(os.path.expandvars("$AUTO_DIR/.autorc"))
        if os.path.exists(os.path.expandvars("$HOME/.autorc")):
            parser.read(os.path.expandvars("$HOME/.autorc"))
        if os.path.exists("./.autorc"):
            parser.read("./.autorc")

        for option in parser.options("AUTO_plotter"):
            optionDefaults[option] = (eval(parser.get("AUTO_plotter", option)), self.__optionCallback)

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

        dict = AUTOutil.cnfmerge((cnf, kw))
        self.addOptions(optionDefaults)
        plotter.config(self, dict)
示例#2
0
 def __init__(self,fort7_filename=None,fort8_filename=None):
     if (fort8_filename is None) and not(fort8_filename is None):
         raise AUTORuntimeError("Must set both both filenames")
     self.diagram = parseB.parseB()
     self.solution = parseS.parseS()
     self.dg = self.diagram
     self.sl = self.solution
     if not(fort7_filename is None):
         self.diagram.readFilename(fort7_filename)
         self.solution.readFilename(fort8_filename)
示例#3
0
 def __init__(self,
              fort7_filename=None,
              fort8_filename=None,
              fort9_filename=None):
     self.diagnostics = None
     if isinstance(fort7_filename, list):
         self.diagram = None
         self.solution = parseS.parseS(fort7_filename)
     elif fort8_filename is None and fort7_filename is not None:
         raise AUTOExceptions.AUTORuntimeError(
             "Must set both both filenames")
     elif isinstance(fort7_filename, str) or fort7_filename is None:
         self.diagram = parseB.parseB(fort7_filename)
         self.solution = parseS.parseS(fort8_filename)
         if not fort9_filename is None:
             self.diagnostics = parseD.parseD(fort9_filename)
     else:
         self.diagram = fort7_filename
         self.solution = fort8_filename
         self.diagnostics = fort9_filename
     if self.diagnostics is None:
         self.diagnostics = []
     self.dg = self.diagram
     self.sl = self.solution
def datab(r2, **kwargs):
    n1b = parseB.parseB(r2)
    ap = n1b[0]
    c = parseC.parseC(n1b[0])

    xlT = False
    ylT = False

    if kwargs.get('x'):
        x = kwargs.get('x')
        numx = re.sub('\D', '', x)
        param = x.strip(numx)
        if param == 'U':
            paramx = 'U(' + numx + ')'
        if param == 'P':
            paramx = 'PAR(' + numx + ')'
        if param == 'L':
            paramx = 'L2-NORM'
        if param == 'T':
            paramx = 'PERIOD'
    else:
        paramx = 'PAR(1)'

    if kwargs.get('y'):
        y = kwargs.get('y')
        numy = re.sub('\D', '', y)
        param = y.strip(numy)
        if param == 'U':
            paramy = 'U(' + numy + ')'
        if param == 'P':
            paramy = 'PAR(' + numy + ')'
        if param == 'L':
            paramy = 'L2-NORM'
        if param == 'T':
            paramy = 'PERIOD'
    else:
        paramy = 'L2-NORM'

    x = []
    y = []
    special = []
    Branch = 0
    BranchLast = 0
    if ap['PT'] > 0:
        current = True
        last = True
    else:
        current = False
        last = False

    try:
        xvalue = c[paramx]
    except KeyError:
        xvalue = c['MAX U(' + numx + ')']
    try:
        yvalue = c[paramy]
    except KeyError:
        yvalue = c['MAX U(' + numy + ')']

    if ap['TY name'] != 'No Label':
        special.append([ap['TY name'], xvalue, yvalue])

    x.append(xvalue)
    y.append(yvalue)
    Bchange = False  #branch change
    Bchecklast = ap['BR']
    Bcheckcurrent = Bchecklast
    Schange = False  #changed of stability
    #also can have different calculations
    for i in range(1, len(n1b)):
        if Schange == True or Bchange == True or i == len(n1b) - 1:
            if Bchange == True:
                Branch = BranchLast + 1
            # x=[]
            # y=[]
            ap = n1b[i]
            if ap['PT'] > 0:
                current = True
            else:
                current = False
            last = current
            Schange = False
            Bchange = False
        last = current
        Bcheckcurrent = ap['BR']
        ap = n1b[i]

        c = parseC.parseC(n1b[i])
        try:
            xvalue = c[paramx]
        except KeyError:
            #            print paramx
            xvalue = c['MAX U(' + numx + ')']
        try:
            yvalue = c[paramy]
        except KeyError:
            yvalue = c['MAX U(' + numy + ')']
        x.append(xvalue)
        y.append(yvalue)
        if ap['TY name'] != 'No Label':
            special.append([ap['TY name'], xvalue, yvalue])

        if ap['PT'] == 1 or ap['PT'] == -1 or Bchecklast != Bcheckcurrent:
            Bchange = True
#this is a fudge because sometimes ap['PT'] returned NoneType
# this should detect when new line is plotted as first point is 1
        if ap['PT'] > 0:
            current = True
        else:
            current = False
        if current != last:
            Schange = True
        BranchLast = Branch
        Bchecklast = Bcheckcurrent

    return x, y
def plotb(r2, **kwargs):
    colors = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
    fig = plt.figure()
    fig.clf()
    ax = fig.add_subplot(111)

    n1b = parseB.parseB(r2)
    ap = n1b[0]
    c = parseC.parseC(n1b[0])

    xlT = False
    ylT = False
    if kwargs.get('xlim'):
        ax.set_xlim(kwargs.get('xlim'))
        xl = kwargs.get('xlim')
        xlT = True
    if kwargs.get('ylim'):
        ax.set_ylim(kwargs.get('ylim'))
        yl = kwargs.get('ylim')
        ylT = True

    if kwargs.get('x'):
        x = kwargs.get('x')
        numx = re.sub('\D', '', x)
        param = x.strip(numx)
        if param == 'U':
            paramx = 'U(' + numx + ')'
        if param == 'P':
            paramx = 'PAR(' + numx + ')'
        if param == 'L':
            paramx = 'L2-NORM'
        if param == 'T':
            paramx = 'PERIOD'
    else:
        paramx = 'PAR(1)'

    if kwargs.get('y'):
        y = kwargs.get('y')
        numy = re.sub('\D', '', y)
        param = y.strip(numy)
        if param == 'U':
            paramy = 'U(' + numy + ')'
        if param == 'P':
            paramy = 'PAR(' + numy + ')'
        if param == 'L':
            paramy = 'L2-NORM'
        if param == 'T':
            paramy = 'PERIOD'
    else:
        paramy = 'L2-NORM'

    if kwargs.get('stable'):
        if kwargs.get('stable') == 'True':
            stab_dashed = True
    else:
        stab_dashed = False

    yl = kwargs.get('ylim')

    x = []
    y = []
    special = []
    Branch = 0
    BranchLast = 0
    if ap['PT'] > 0:
        current = True
        last = True
    else:
        current = False
        last = False

    try:
        xvalue = c[paramx]
    except KeyError:
        xvalue = c['MAX U(' + numx + ')']
    try:
        yvalue = c[paramy]
    except KeyError:
        yvalue = c['MAX U(' + numy + ')']

    if ap['TY name'] != 'No Label':
        special.append([ap['TY name'], xvalue, yvalue])

    x.append(xvalue)
    y.append(yvalue)
    Bchange = False  #branch change
    Bchecklast = ap['BR']
    Bcheckcurrent = Bchecklast
    Schange = False  #changed of stability
    #also can have different calculations
    for i in range(1, len(n1b)):
        if Schange == True or Bchange == True or i == len(n1b) - 1:
            color = colors[Branch % 7]
            if Bchange == True:
                Branch = BranchLast + 1
            if last == True and stab_dashed == True:
                ax.plot(x[0:len(x) - 2],
                        y[0:len(x) - 2],
                        color=color,
                        ls='dotted')
            else:
                ax.plot(x[0:len(x) - 2],
                        y[0:len(x) - 2],
                        color=color,
                        ls='solid')
            x = []
            y = []
            ap = n1b[i]
            if ap['PT'] > 0:
                current = True
            else:
                current = False
            last = current
            Schange = False
            Bchange = False
        last = current
        Bcheckcurrent = ap['BR']
        ap = n1b[i]

        c = parseC.parseC(n1b[i])
        try:
            xvalue = c[paramx]
        except KeyError:
            #            print paramx
            xvalue = c['MAX U(' + numx + ')']
        try:
            yvalue = c[paramy]
        except KeyError:
            yvalue = c['MAX U(' + numy + ')']
        x.append(xvalue)
        y.append(yvalue)
        if ap['TY name'] != 'No Label':
            special.append([ap['TY name'], xvalue, yvalue])

        if ap['PT'] == 1 or ap['PT'] == -1 or Bchecklast != Bcheckcurrent:
            Bchange = True


#this is a fudge because sometimes ap['PT'] returned NoneType
# this should detect when new line is plotted as first point is 1
        if ap['PT'] > 0:
            current = True
        else:
            current = False
        if current != last:
            Schange = True
        BranchLast = Branch
        Bchecklast = Bcheckcurrent

    for i, sp in enumerate(special):
        if xlT == True:
            if sp[1] > xl[0] and sp[1] < xl[1]:
                sp1 = sp[1]
            if ylT == True:
                if sp[2] > yl[0] and sp[2] < yl[1]:
                    sp2 = sp[2]
                    ax.plot(sp[1],
                            sp[2],
                            ls='None',
                            marker='x',
                            color='k',
                            markersize=3)
                    ax.text(sp[1], sp[2], sp[0])
            else:
                ax.plot(sp[1],
                        sp[2],
                        ls='None',
                        marker='x',
                        color='k',
                        markersize=3)
                ax.text(sp[1], sp[2], sp[0])
        elif ylT == True:
            if sp[2] > yl[0] and sp[2] < yl[1]:
                sp2 = sp[2]
                ax.plot(sp[1],
                        sp[2],
                        ls='None',
                        marker='x',
                        color='k',
                        markersize=3)
                ax.text(sp[1], sp[2], sp[0])
        else:
            ax.plot(sp[1],
                    sp[2],
                    ls='None',
                    marker='x',
                    color='k',
                    markersize=3)
            ax.text(sp[1], sp[2], sp[0])
    ax.set_xlabel(paramx)
    ax.set_ylabel(paramy)
    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"):
            optionDefaultsRC[option] = self.parseoption(
                option,parser.get("AUTO_plotter",option),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)
def datab(r2, **kwargs):
    n1b=parseB.parseB(r2)
    ap=n1b[0]
    c=parseC.parseC(n1b[0]) 

    xlT=False
    ylT=False
    
    if kwargs.get('x'):
        x=kwargs.get('x')
        numx=re.sub('\D', '',x)
        param=x.strip(numx)
        if param=='U':
            paramx='U('+numx+')'
        if param=='P':
                paramx='PAR('+numx+')'
        if param=='L':
            paramx='L2-NORM'
        if param=='T':
            paramx='PERIOD'
    else:
        paramx='PAR(1)'

    if kwargs.get('y'):
        y=kwargs.get('y')
        numy=re.sub('\D', '',y)
        param=y.strip(numy)
        if param=='U':
            paramy='U('+numy+')'
        if param=='P':
            paramy='PAR('+numy+')'
        if param=='L':
            paramy='L2-NORM'
        if param=='T':
            paramy='PERIOD'
    else:
        paramy='L2-NORM'

    x=[]
    y=[]
    special=[]
    Branch=0
    BranchLast=0
    if ap['PT']>0:
        current=True
        last=True
    else:
        current=False
        last=False

    try:
        xvalue=c[paramx]
    except KeyError:
        xvalue=c['MAX U('+numx+')']
    try:
        yvalue=c[paramy]
    except KeyError:
        yvalue=c['MAX U('+numy+')']

    if ap['TY name']!='No Label':
        special.append([ap['TY name'],xvalue,yvalue])
    
    x.append(xvalue)
    y.append(yvalue)
    Bchange=False #branch change
    Bchecklast=ap['BR']
    Bcheckcurrent=Bchecklast
    Schange=False #changed of stability
    #also can have different calculations
    for i in range(1,len(n1b)):
        if Schange==True or Bchange==True or i==len(n1b)-1:
            if Bchange==True:
                Branch=BranchLast+1
            # x=[]
            # y=[]
            ap=n1b[i]
            if ap['PT']>0:
                current=True
            else:
                current=False
            last=current
            Schange=False
            Bchange=False
        last=current
        Bcheckcurrent=ap['BR']
        ap=n1b[i]

        c=parseC.parseC(n1b[i]) 
        try:
            xvalue=c[paramx]
        except KeyError:
#            print paramx
            xvalue=c['MAX U('+numx+')']
        try:
            yvalue=c[paramy]
        except KeyError:
            yvalue=c['MAX U('+numy+')']
        x.append(xvalue)
        y.append(yvalue)
        if ap['TY name']!='No Label':
            special.append([ap['TY name'],xvalue,yvalue])

        if ap['PT']==1 or ap['PT']==-1 or Bchecklast!=Bcheckcurrent:
            Bchange=True
#this is a fudge because sometimes ap['PT'] returned NoneType
        # this should detect when new line is plotted as first point is 1
        if ap['PT']>0:
            current=True
        else:
            current=False
        if current!=last:
            Schange=True
        BranchLast=Branch
        Bchecklast=Bcheckcurrent

    return x,y
def plotb(r2, **kwargs):
    colors=['b', 'g', 'r', 'c', 'm', 'y', 'k']
    fig=plt.figure()
    fig.clf()
    ax=fig.add_subplot(111)

    n1b=parseB.parseB(r2)
    ap=n1b[0]
    c=parseC.parseC(n1b[0]) 

    xlT=False
    ylT=False
    if kwargs.get('xlim'):
        ax.set_xlim(kwargs.get('xlim'))
        xl=kwargs.get('xlim')
        xlT=True
    if kwargs.get('ylim'):
        ax.set_ylim(kwargs.get('ylim'))
        yl=kwargs.get('ylim')   
        ylT=True
    
    if kwargs.get('x'):
        x=kwargs.get('x')
        numx=re.sub('\D', '',x)
        param=x.strip(numx)
        if param=='U':
            paramx='U('+numx+')'
        if param=='P':
                paramx='PAR('+numx+')'
        if param=='L':
            paramx='L2-NORM'
        if param=='T':
            paramx='PERIOD'
    else:
        paramx='PAR(1)'

    if kwargs.get('y'):
        y=kwargs.get('y')
        numy=re.sub('\D', '',y)
        param=y.strip(numy)
        if param=='U':
            paramy='U('+numy+')'
        if param=='P':
            paramy='PAR('+numy+')'
        if param=='L':
            paramy='L2-NORM'
        if param=='T':
            paramy='PERIOD'
    else:
        paramy='L2-NORM'


    if kwargs.get('stable'):
        if  kwargs.get('stable')=='True':
            stab_dashed=True
    else:
        stab_dashed=False


    yl=kwargs.get('ylim')

    x=[]
    y=[]
    special=[]
    Branch=0
    BranchLast=0
    if ap['PT']>0:
        current=True
        last=True
    else:
        current=False
        last=False

    try:
        xvalue=c[paramx]
    except KeyError:
        xvalue=c['MAX U('+numx+')']
    try:
        yvalue=c[paramy]
    except KeyError:
        yvalue=c['MAX U('+numy+')']

    if ap['TY name']!='No Label':
        special.append([ap['TY name'],xvalue,yvalue])
    
    x.append(xvalue)
    y.append(yvalue)
    Bchange=False #branch change
    Bchecklast=ap['BR']
    Bcheckcurrent=Bchecklast
    Schange=False #changed of stability
    #also can have different calculations
    for i in range(1,len(n1b)):
        if Schange==True or Bchange==True or i==len(n1b)-1:
            color=colors[Branch%7]
            if Bchange==True:
                Branch=BranchLast+1
            if last==True and stab_dashed==True:
                ax.plot(x[0:len(x)-2],y[0:len(x)-2],color=color,ls='dotted')         
            else:
                ax.plot(x[0:len(x)-2],y[0:len(x)-2],color=color,ls='solid')
            x=[]
            y=[]
            ap=n1b[i]
            if ap['PT']>0:
                current=True
            else:
                current=False
            last=current
            Schange=False
            Bchange=False
        last=current
        Bcheckcurrent=ap['BR']
        ap=n1b[i]

        c=parseC.parseC(n1b[i]) 
        try:
            xvalue=c[paramx]
        except KeyError:
#            print paramx
            xvalue=c['MAX U('+numx+')']
        try:
            yvalue=c[paramy]
        except KeyError:
            yvalue=c['MAX U('+numy+')']
        x.append(xvalue)
        y.append(yvalue)
        if ap['TY name']!='No Label':
            special.append([ap['TY name'],xvalue,yvalue])

        if ap['PT']==1 or ap['PT']==-1 or Bchecklast!=Bcheckcurrent:
            Bchange=True
#this is a fudge because sometimes ap['PT'] returned NoneType
        # this should detect when new line is plotted as first point is 1
        if ap['PT']>0:
            current=True
        else:
            current=False
        if current!=last:
            Schange=True
        BranchLast=Branch
        Bchecklast=Bcheckcurrent

    for i,sp in enumerate(special):
        if xlT==True:
            if sp[1]>xl[0] and sp[1]<xl[1]:
                sp1=sp[1]
            if ylT==True:
                if sp[2]>yl[0] and sp[2]<yl[1]:
                    sp2=sp[2]
                    ax.plot(sp[1],sp[2],ls='None',marker='x',color='k',markersize=3)
                    ax.text(sp[1],sp[2],sp[0])
            else:
                ax.plot(sp[1],sp[2],ls='None',marker='x',color='k',markersize=3)
                ax.text(sp[1],sp[2],sp[0])
        elif ylT==True:
            if sp[2]>yl[0] and sp[2]<yl[1]:
                sp2=sp[2]
                ax.plot(sp[1],sp[2],ls='None',marker='x',color='k',markersize=3)
                ax.text(sp[1],sp[2],sp[0])
        else:
            ax.plot(sp[1],sp[2],ls='None',marker='x',color='k',markersize=3)
            ax.text(sp[1],sp[2],sp[0])
    ax.set_xlabel(paramx)
    ax.set_ylabel(paramy)
    def __init__(self,parent=None,cnf={},**kw):
        optionDefaults={}
        optionDefaults["problem"] = ("auto_plotter3d",self.__optionCallback)
        # 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"]        = (["t"],self.__optionCallback)
        # The Y column
        optionDefaults["bifurcation_y"]     = ([1],self.__optionCallback)
        optionDefaults["solution_y"]        = ([0],self.__optionCallback)
        # The Z column
        optionDefaults["bifurcation_z"]     = ([1],self.__optionCallback)
        optionDefaults["solution_z"]        = ([0],self.__optionCallback)
        # The Color column
        optionDefaults["bifurcation_color"] = ([1],self.__optionCallback)
        optionDefaults["solution_color"]    = ([0],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["mark_t_radius"]  = (0.01, self.__optionCallback)
        optionDefaults["mark_t_color"]   = ((1.0,1.0,1.0), self.__optionCallback)


        # Options for the GUI
        optionDefaults["bifurcation_x_scale"]       = (1.0,None)
        optionDefaults["bifurcation_y_scale"]       = (1.0,None)
        optionDefaults["bifurcation_z_scale"]       = (1.0,None)
        optionDefaults["bifurcation_x_trans"]       = (0.0,None)
        optionDefaults["bifurcation_y_trans"]       = (0.0,None)
        optionDefaults["bifurcation_z_trans"]       = (0.0,None)
        optionDefaults["solution_x_scale"]       = (1.0,None)
        optionDefaults["solution_y_scale"]       = (1.0,None)
        optionDefaults["solution_z_scale"]       = (1.0,None)
        optionDefaults["solution_x_trans"]       = (0.0,None)
        optionDefaults["solution_y_trans"]       = (0.0,None)
        optionDefaults["solution_z_trans"]       = (0.0,None)

        optionDefaults["line_width"]        = (1.0,None)
        optionDefaults["cylinder"]     = (0,None)
        optionDefaults["geom_comp"]    = (7,None)
        optionDefaults["light_comp"]   = (7,None)
        optionDefaults["write_points_on"] = (0,None)

        optionDefaults["grid_on"]       = (0,None)
        optionDefaults["grid_lines"]    = (6,None)
        optionDefaults["grid_1_start"]  = (-1.0,None)
        optionDefaults["grid_2_start"]  = (-1.0,None)
        optionDefaults["grid_1_end"]    = (1.0,None)
        optionDefaults["grid_2_end"]    = (1.0,None)
        optionDefaults["grid_width"]    = (1.0,None)
        optionDefaults["grid_R"]        = (1.0,None)
        optionDefaults["grid_G"]        = (1.0,None)
        optionDefaults["grid_B"]        = (1.0,None)
        optionDefaults["grid_cylinder"] = (0,None)
        optionDefaults["grid_direction"]= (["x","y","z"],None)

        optionDefaults["cube_on"]    = (1,None)
        optionDefaults["cube_R"]     = (1.0,None)
        optionDefaults["cube_G"]     = (1.0,None)
        optionDefaults["cube_B"]     = (1.0,None)
        

        optionDefaults["auto_center"]= (1,None)
        optionDefaults["auto_scale"]= (1,None)

        parser = ConfigParser.ConfigParser()
        parser.add_section("AUTO_plotter3D")
        if(os.path.exists(os.path.expandvars("$AUTO_DIR/.autorc"))):
            parser.read(os.path.expandvars("$AUTO_DIR/.autorc"))
        if(os.path.exists(os.path.expandvars("$HOME/.autorc"))):
            parser.read(os.path.expandvars("$HOME/.autorc"))
        if(os.path.exists("./.autorc")):
            parser.read("./.autorc")

        for option in parser.options("AUTO_plotter3D"):
            optionDefaults[option] = (eval(parser.get("AUTO_plotter3D",option)),self.__optionCallback)


        Tkinter.Frame.__init__(self,parent)
        optionHandler.OptionHandler.__init__(self)

        self.user_data = {}

        dict = AUTOutil.cnfmerge((cnf,kw))
        self.addOptions(optionDefaults)
        plotter3D.config(self,dict)
示例#10
0
    def __init__(self,parent=None,cnf={},**kw):
        optionDefaults={}
        optionDefaults["problem"] = ("auto_plotter3d",self.__optionCallback)
        # 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"]        = (["t"],self.__optionCallback)
        # The Y column
        optionDefaults["bifurcation_y"]     = ([1],self.__optionCallback)
        optionDefaults["solution_y"]        = ([0],self.__optionCallback)
        # The Z column
        optionDefaults["bifurcation_z"]     = ([1],self.__optionCallback)
        optionDefaults["solution_z"]        = ([0],self.__optionCallback)
        # The Color column
        optionDefaults["bifurcation_color"] = ([1],self.__optionCallback)
        optionDefaults["solution_color"]    = ([0],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["mark_t_radius"]  = (0.01, self.__optionCallback)
        optionDefaults["mark_t_color"]   = ((1.0,1.0,1.0), self.__optionCallback)

        optionDefaults["special_point"]  = (None, self.__optionCallback)
        optionDefaults["special_point_radius"] = (0.005, self.__optionCallback)
        optionDefaults["special_point_colors"] = ([[0.0,0.0,1.0],  #Blue for branch point
                                                  [0.0,1.0,0.0],  #Green for fold
                                                  [1.0,1.0,0.0],  #Yellow for hopf
                                                  [0.0,1.0,1.0],  #Cyan for Period Doubling
                                                  [1.0,0.0,0.0],  #Red for Torus 
                                                  [0.5,0.5,0.5],  #Grey for user requested point
                                                  [0.1,0.1,0.1]], #Dark grey for error
                                                  self.__optionCallback)  

        # Options for the GUI
        optionDefaults["bifurcation_x_scale"]       = (1.0,None)
        optionDefaults["bifurcation_y_scale"]       = (1.0,None)
        optionDefaults["bifurcation_z_scale"]       = (1.0,None)
        optionDefaults["bifurcation_x_trans"]       = (0.0,None)
        optionDefaults["bifurcation_y_trans"]       = (0.0,None)
        optionDefaults["bifurcation_z_trans"]       = (0.0,None)
        optionDefaults["solution_x_scale"]       = (1.0,None)
        optionDefaults["solution_y_scale"]       = (1.0,None)
        optionDefaults["solution_z_scale"]       = (1.0,None)
        optionDefaults["solution_x_trans"]       = (0.0,None)
        optionDefaults["solution_y_trans"]       = (0.0,None)
        optionDefaults["solution_z_trans"]       = (0.0,None)

        optionDefaults["line_width"]        = (1.0,None)
        optionDefaults["cylinder"]     = (0,None)
        optionDefaults["geom_comp"]    = (7,None)
        optionDefaults["light_comp"]   = (7,None)
        optionDefaults["write_points_on"] = (0,None)

        optionDefaults["grid_on"]       = (0,None)
        optionDefaults["grid_lines"]    = (6,None)
        optionDefaults["grid_1_start"]  = (-1.0,None)
        optionDefaults["grid_2_start"]  = (-1.0,None)
        optionDefaults["grid_1_end"]    = (1.0,None)
        optionDefaults["grid_2_end"]    = (1.0,None)
        optionDefaults["grid_width"]    = (1.0,None)
        optionDefaults["grid_R"]        = (1.0,None)
        optionDefaults["grid_G"]        = (1.0,None)
        optionDefaults["grid_B"]        = (1.0,None)
        optionDefaults["grid_cylinder"] = (0,None)
        optionDefaults["grid_direction"]= (["x","y","z"],None)

        optionDefaults["cube_on"]    = (1,None)
        optionDefaults["cube_R"]     = (1.0,None)
        optionDefaults["cube_G"]     = (1.0,None)
        optionDefaults["cube_B"]     = (1.0,None)
        

        optionDefaults["auto_center"]= (1,None)
        optionDefaults["auto_scale"]= (1,None)

        parser = ConfigParser.ConfigParser()
        parser.add_section("AUTO_plotter3D")
        if(os.path.exists(os.path.expandvars("$AUTO_DIR/.autorc"))):
            parser.read(os.path.expandvars("$AUTO_DIR/.autorc"))
        if(os.path.exists(os.path.expandvars("$HOME/.autorc"))):
            parser.read(os.path.expandvars("$HOME/.autorc"))
        if(os.path.exists("./.autorc")):
            parser.read("./.autorc")

        for option in parser.options("AUTO_plotter3D"):
            optionDefaults[option] = (eval(parser.get("AUTO_plotter3D",option)),self.__optionCallback)

	geom.Geometry.__init__(self,parent)

        optionHandler.OptionHandler.__init__(self,geom.Geometry)

        self.user_data = {}

        dict = AUTOutil.cnfmerge((cnf,kw))
        self.addOptions(optionDefaults)
        self.set_problem(self.cget("problem"))
        plotter3D.config(self,dict)

	self.zoom_scale = 0.03
	self.default_zoom = -10.0
        self.bind('<Lock-ButtonPress-3>',self.zoom_mouse_down)
        self.bind('<Lock-Button3-Motion>',self.zoom_mouse_move)
	self.zoom(0.15)

        self.bind('<ButtonPress-3>',self.translate_mouse_down)
        self.bind('<Button3-Motion>',self.translate_mouse_move)
        self.bind('<Shift-ButtonPress-2>',self.zoom_mouse_down)
        self.bind('<Shift-Button2-Motion>',self.zoom_mouse_move)
        self.bind('<ButtonPress-2>',self.rotate_mouse_down)
        self.bind('<Button2-Motion>',self.rotate_mouse_move)
        self.bind('<ButtonRelease-2>',self.spin_mouse)

        self.tk_focusFollowsMouse()
        self.bind('<KeyPress-Up>',self.KeyEvent)
        self.bind('<KeyPress-Down>',self.KeyEvent)
        self.bind('<KeyPress-Left>',self.KeyEvent)
        self.bind('<KeyPress-Right>',self.KeyEvent)
        self.bind('<KeyPress-Next>',self.KeyEvent)
        self.bind('<KeyPress-Prior>',self.KeyEvent)

        self.bind('<Control-KeyPress-Up>',self.KeyEvent)
        self.bind('<Control-KeyPress-Down>',self.KeyEvent)
        self.bind('<Control-KeyPress-Left>',self.KeyEvent)
        self.bind('<Control-KeyPress-Right>',self.KeyEvent)
        self.bind('<Control-KeyPress-Next>',self.KeyEvent)
        self.bind('<Control-KeyPress-Prior>',self.KeyEvent)