PEATDB/Ekin/Ekin_main.py
def doFrame(self):
        """Create GUI elements for fitting frame"""
        self.model_button_width=40
        self.model_button=Menubutton(self,textvariable=self.model_type,relief=RAISED,
                                    width=self.model_button_width)
        self.model_menu=Menu(self.model_button,tearoff=0)
        self.model_button['menu']=self.model_menu
        row=1
        self.doModelButton()
        self.optionsButton()
        paramsFrame = Frame(self,bg='lightblue')
        paramsFrame.grid(row=row,column=0,columnspan=3)

        text=['Include','Name','Start value','','Fitted value']
        col = 0
        for t in text:
            Label(paramsFrame,text=t,font='times12bold').grid(row=0,column=col,sticky='news')
            col = col+1

        # Make space for parameters
        r=1
        for i in range(7):
            Checkbutton(paramsFrame,variable=self.fvars[i][0]).grid(row=r,column=0,sticky='news')
            Label(paramsFrame,textvariable=self.fvars[i][1]).grid(row=r,column=1,sticky='news')
            Entry(paramsFrame,width=8,justify='center',text=self.fvars[i][2],
                        bg='#FFFF99').grid(row=r,column=2,sticky='news')
            def transferVal(var=i):
                """Set the starting value to the fitted value"""
                if self.fvars[var][3].get() != '-':
                    self.fvars[var][2].set(self.fvars[var][3].get())
                return
            Button(paramsFrame,text='<--',command=transferVal,relief='groove').grid(row=r,column=3)
            Label(paramsFrame,textvariable=self.fvars[i][3]).grid(row=r,column=4,sticky='news')
            r=r+1

        # Button for calculating fit
        row=row+1
        self.sqdiff=StringVar()
        self.sqdiff.set('No fit')
        Label(self,text='Sum of sq diffs').grid(row=row,column=1,padx=2,pady=1,sticky='news')
        Label(self,textvariable=self.sqdiff).grid(row=row,column=2,padx=2,pady=1,sticky='news')
        row=row+1
        Button(self,text='Calculate best fit',command=self.doFit,relief='groove',
                    bg='lightblue').grid(row=row,column=0,padx=2,pady=2,sticky='news')

        # Button for just updating the fit
        row=row+1
        b=Button(self,text='Preview fit', command=self.previewFit,relief='groove',
                         bg='lightblue')
        b.grid(row=row,column=0,padx=2,pady=2,sticky='news',columnspan=1)
        Pmw.Balloon(self).bind(b, 'Update curve to reflect manual start parameters')

        # Button for estimation of experimental uncertainty
        b=Button(self,text='Estimate exp. uncertainty', command=self.showExpUncertaintyDialog,
                    relief='groove',bg='lightblue')
        b.grid(row=row,column=1,padx=2,pady=2,sticky='news',columnspan=2)
        Pmw.Balloon(self).bind(b, 'Get an error estimate for the fit params')

        # Radio button to select fitting method
        self.fitting_method = IntVar()
        row=row+1

        n=Frame(self)
        Label(n,text='Rounds:').pack(side=LEFT)
        Entry(n,textvariable=self.no_iter,width=6).pack(side=LEFT)
        n.grid(row=row,column=0,padx=2,pady=2,sticky='news')

        Label(self,text='LM damper start value').grid(row=row,column=1)
        Entry(self,width=8,justify='center',
              textvariable=self.LM_damper).grid(row=row,column=2,sticky='ns')

        lbl1=Label(self,text='Conv. criteria (error/gradient):')
        lbl1.grid(row=row+1,column=0,padx=3,pady=2)
        guessconvchk = Checkbutton(self,onvalue=1,offvalue=0,variable=self.guess_converg_diff)
        guessconvchk.grid(row=row+1,column=3,padx=1,pady=2)
        entry1=Entry(self,textvariable=self.converg_diff,width=8,justify='center',bg='white')
        entry1.grid(row=row+1,column=1,sticky='ns',padx=3,pady=2)

        entry2=Entry(self,textvariable=self.grad_crit,width=8,justify='center',bg='white')
        entry2.grid(row=row+1,column=2,sticky='ns',padx=3,pady=2)
        return
Create GUI elements for fitting frame
Create GUI elements for fitting frame
Create GUI elements for fitting frame
def doFrame(self):
        self.model_button_width=40
        self.model_button=Menubutton(self,textvariable=self.model_type,relief=RAISED,
                                    width=self.model_button_width)
        self.model_menu=Menu(self.model_button,tearoff=0)
        self.model_button['menu']=self.model_menu
        row=1
        self.doModelButton()
        self.optionsButton()
        paramsFrame = Frame(self,bg='lightblue')
        paramsFrame.grid(row=row,column=0,columnspan=3)
        text=['Include','Name','Start value','','Fitted value']
        col = 0
        for t in text:
            Label(paramsFrame,text=t,font='times12bold').grid(row=0,column=col,sticky='news')
            col = col+1
        r=1
        for i in range(7):
            Checkbutton(paramsFrame,variable=self.fvars[i][0]).grid(row=r,column=0,sticky='news')
            Label(paramsFrame,textvariable=self.fvars[i][1]).grid(row=r,column=1,sticky='news')
            Entry(paramsFrame,width=8,justify='center',text=self.fvars[i][2],
                        bg='#FFFF99').grid(row=r,column=2,sticky='news')
            def transferVal(var=i):
                if self.fvars[var][3].get() != '-':
                    self.fvars[var][2].set(self.fvars[var][3].get())
                return
            Button(paramsFrame,text='<--',command=transferVal,relief='groove').grid(row=r,column=3)
            Label(paramsFrame,textvariable=self.fvars[i][3]).grid(row=r,column=4,sticky='news')
            r=r+1
        row=row+1
        self.sqdiff=StringVar()
        self.sqdiff.set('No fit')
        Label(self,text='Sum of sq diffs').grid(row=row,column=1,padx=2,pady=1,sticky='news')
        Label(self,textvariable=self.sqdiff).grid(row=row,column=2,padx=2,pady=1,sticky='news')
        row=row+1
        Button(self,text='Calculate best fit',command=self.doFit,relief='groove',
                    bg='lightblue').grid(row=row,column=0,padx=2,pady=2,sticky='news')
        row=row+1
        b=Button(self,text='Preview fit', command=self.previewFit,relief='groove',
                         bg='lightblue')
        b.grid(row=row,column=0,padx=2,pady=2,sticky='news',columnspan=1)
        Pmw.Balloon(self).bind(b, 'Update curve to reflect manual start parameters')
        b=Button(self,text='Estimate exp. uncertainty', command=self.showExpUncertaintyDialog,
                    relief='groove',bg='lightblue')
        b.grid(row=row,column=1,padx=2,pady=2,sticky='news',columnspan=2)
        Pmw.Balloon(self).bind(b, 'Get an error estimate for the fit params')
        self.fitting_method = IntVar()
        row=row+1
        n=Frame(self)
        Label(n,text='Rounds:').pack(side=LEFT)
        Entry(n,textvariable=self.no_iter,width=6).pack(side=LEFT)
        n.grid(row=row,column=0,padx=2,pady=2,sticky='news')
        Label(self,text='LM damper start value').grid(row=row,column=1)
        Entry(self,width=8,justify='center',
              textvariable=self.LM_damper).grid(row=row,column=2,sticky='ns')
        lbl1=Label(self,text='Conv. criteria (error/gradient):')
        lbl1.grid(row=row+1,column=0,padx=3,pady=2)
        guessconvchk = Checkbutton(self,onvalue=1,offvalue=0,variable=self.guess_converg_diff)
        guessconvchk.grid(row=row+1,column=3,padx=1,pady=2)
        entry1=Entry(self,textvariable=self.converg_diff,width=8,justify='center',bg='white')
        entry1.grid(row=row+1,column=1,sticky='ns',padx=3,pady=2)
        entry2=Entry(self,textvariable=self.grad_crit,width=8,justify='center',bg='white')
        entry2.grid(row=row+1,column=2,sticky='ns',padx=3,pady=2)
        return
def doFrame ( self ) : self . model_button_width = 40 self . model_button = Menubutton ( self , textvariable = self . model_type , relief = RAISED , width = self . model_button_width ) self . model_menu = Menu ( self . model_button , tearoff = 0 ) self . model_button [ 'menu' ] = self . model_menu row = 1 self . doModelButton ( ) self . optionsButton ( ) paramsFrame = Frame ( self , bg = 'lightblue' ) paramsFrame . grid ( row = row , column = 0 , columnspan = 3 ) text = [ 'Include' , 'Name' , 'Start value' , '' , 'Fitted value' ] col = 0 for t in text : Label ( paramsFrame , text = t , font = 'times12bold' ) . grid ( row = 0 , column = col , sticky = 'news' ) col = col + 1 r = 1 for i in range ( 7 ) : Checkbutton ( paramsFrame , variable = self . fvars [ i ] [ 0 ] ) . grid ( row = r , column = 0 , sticky = 'news' ) Label ( paramsFrame , textvariable = self . fvars [ i ] [ 1 ] ) . grid ( row = r , column = 1 , sticky = 'news' ) Entry ( paramsFrame , width = 8 , justify = 'center' , text = self . fvars [ i ] [ 2 ] , bg = '#FFFF99' ) . grid ( row = r , column = 2 , sticky = 'news' ) def transferVal ( var = i ) : """Set the starting value to the fitted value""" if self . fvars [ var ] [ 3 ] . get ( ) != '-' : self . fvars [ var ] [ 2 ] . set ( self . fvars [ var ] [ 3 ] . get ( ) ) return Button ( paramsFrame , text = '<--' , command = transferVal , relief = 'groove' ) . grid ( row = r , column = 3 ) Label ( paramsFrame , textvariable = self . fvars [ i ] [ 3 ] ) . grid ( row = r , column = 4 , sticky = 'news' ) r = r + 1 row = row + 1 self . sqdiff = StringVar ( ) self . sqdiff . set ( 'No fit' ) Label ( self , text = 'Sum of sq diffs' ) . grid ( row = row , column = 1 , padx = 2 , pady = 1 , sticky = 'news' ) Label ( self , textvariable = self . sqdiff ) . grid ( row = row , column = 2 , padx = 2 , pady = 1 , sticky = 'news' ) row = row + 1 Button ( self , text = 'Calculate best fit' , command = self . doFit , relief = 'groove' , bg = 'lightblue' ) . grid ( row = row , column = 0 , padx = 2 , pady = 2 , sticky = 'news' ) row = row + 1 b = Button ( self , text = 'Preview fit' , command = self . previewFit , relief = 'groove' , bg = 'lightblue' ) b . grid ( row = row , column = 0 , padx = 2 , pady = 2 , sticky = 'news' , columnspan = 1 ) Pmw . Balloon ( self ) . bind ( b , 'Update curve to reflect manual start parameters' ) b = Button ( self , text = 'Estimate exp. uncertainty' , command = self . showExpUncertaintyDialog , relief = 'groove' , bg = 'lightblue' ) b . grid ( row = row , column = 1 , padx = 2 , pady = 2 , sticky = 'news' , columnspan = 2 ) Pmw . Balloon ( self ) . bind ( b , 'Get an error estimate for the fit params' ) self . fitting_method = IntVar ( ) row = row + 1 n = Frame ( self ) Label ( n , text = 'Rounds:' ) . pack ( side = LEFT ) Entry ( n , textvariable = self . no_iter , width = 6 ) . pack ( side = LEFT ) n . grid ( row = row , column = 0 , padx = 2 , pady = 2 , sticky = 'news' ) Label ( self , text = 'LM damper start value' ) . grid ( row = row , column = 1 ) Entry ( self , width = 8 , justify = 'center' , textvariable = self . LM_damper ) . grid ( row = row , column = 2 , sticky = 'ns' ) lbl1 = Label ( self , text = 'Conv. criteria (error/gradient):' ) lbl1 . grid ( row = row + 1 , column = 0 , padx = 3 , pady = 2 ) guessconvchk = Checkbutton ( self , onvalue = 1 , offvalue = 0 , variable = self . guess_converg_diff ) guessconvchk . grid ( row = row + 1 , column = 3 , padx = 1 , pady = 2 ) entry1 = Entry ( self , textvariable = self . converg_diff , width = 8 , justify = 'center' , bg = 'white' ) entry1 . grid ( row = row + 1 , column = 1 , sticky = 'ns' , padx = 3 , pady = 2 ) entry2 = Entry ( self , textvariable = self . grad_crit , width = 8 , justify = 'center' , bg = 'white' ) entry2 . grid ( row = row + 1 , column = 2 , sticky = 'ns' , padx = 3 , pady = 2 ) return
Create GUI elements for fitting frame
Create GUI elements for fitting frame
"""Create GUI elements for fitting frame""" # Make space for parameters """Set the starting value to the fitted value""" # Button for calculating fit # Button for just updating the fit # Button for estimation of experimental uncertainty # Radio button to select fitting method
self