PEATDB/Ekin/Ekin_main.py
def showExpUncertaintyDialog(self):
        """Show dialog for doing Exp Uncertainty"""
        if self.fitdata == {}: return
        data = self.data; fitdata = self.fitdata
        model = fitdata['model']
        X = Fitting.getFitter(model)
        vrs = X.variables
        names = X.getVarNames()
        self.eeu_win = Toplevel(self.parent.master)
        self.parentapp.set_geometry(self.parentapp.ekin_win, self.eeu_win)
        self.eeu_win.title('Estimate experimental uncertainty')

        frame1 = Frame(self.eeu_win)
        frame1.pack()
        self.eeu_x_uncertainty = DoubleVar()
        self.eeu_x_uncertainty.set(0.01)
        self.eeu_y_uncertainty = DoubleVar()
        self.eeu_y_uncertainty.set(0.01)
        self.eeu_no_runs = IntVar()
        self.eeu_no_runs.set(10)
        row=1; col=1

        Label(frame1,text='Uncertainty of x-values:').grid(row=row,column=col);  col+=1
        Entry(frame1,textvariable=self.eeu_x_uncertainty,bg='white').grid(row=row,column=col); col=1
        row+=1
        Label(frame1,text='Uncertainty of y-values:').grid(row=row,column=col); col+=1
        Entry(frame1,textvariable=self.eeu_y_uncertainty,bg='white').grid(row=row,column=col); col=1
        row+=1
        Label(frame1,text='Number of runs:').grid(row=row,column=col); col+=1
        Entry(frame1,textvariable=self.eeu_no_runs,bg='white').grid(row=row,column=col); col=1
        row+=1

        frame2 = Frame(self.eeu_win)
        frame2.pack()
        no_runs = IntVar()
        no_runs.set(1)
        self.current_run = IntVar()
        self.current_run.set(0)
        row=0; col=0
        modellabel = Label(frame2,text='Model: '+model, font="bold").grid(row=row,column=col)
        row+=1; col=1
        self.eeu_averages={}; self.eeu_stdevs={}
        Label(frame2,text='Average',foreground='blue').grid(row=row,column=col,columnspan=1); col+=1
        Label(frame2,text='Standard dev.',foreground='blue').grid(row=row,column=col,columnspan=1)
        row+=1; col=0
        #fill in average and standard deviations for each var in model
        for n in names:
            self.eeu_averages[n] = DoubleVar()
            self.eeu_averages[n].set(0.0)
            self.eeu_stdevs[n] = DoubleVar()
            self.eeu_stdevs[n].set(0.0)
            Label(frame2, text='%s'%n ).grid(row=row,column=0,sticky='w',columnspan=3)
            Label(frame2,textvariable=self.eeu_averages[n]).grid(row=row,column=1,sticky='w')
            Label(frame2,textvariable=self.eeu_stdevs[n]).grid(row=row,column=2,sticky='w')
            row+=1

        # Errors and standard deviations
        self.eeu_sumsqaverages = DoubleVar()
        self.eeu_sumsqstdevs = DoubleVar()
        col=0
        Label(frame2,text='Sum of sq errors:').grid(row=row,column=col,sticky='w',columnspan=3)
        col+=1
        Label(frame2,textvariable=self.eeu_sumsqaverages).grid(row=row,column=col,sticky='w',)
        col+=1
        Label(frame2,textvariable=self.eeu_sumsqstdevs).grid(row=row,column=col,sticky='w')
        row+=1;col=0
        Label(frame2,text='Run number ').grid(row=row,column=col); col+=1
        Label(frame2,textvariable=self.current_run).grid(row=row,column=col); col+=1
        Label(frame2,text=' of ').grid(row=row,column=col); col+=1
        Label(frame2,textvariable=self.eeu_no_runs).grid(row=row,column=col); col=1
        row+=1;

        # stop and quit buttons
        frame3 = Frame(self.eeu_win)
        frame3.pack()
        row=1; col=1
        Button(frame3, text='Start', relief=GROOVE, bg='#B0C4DE',
               command=self.startestimateUncertainty).grid(row=row,column=col)
        col+=1
        Button(frame3,text='Stop', relief=GROOVE, bg='#B0C4DE',
               command=self.stopestimateUncertainty).grid(row=row,column=col)
        col+=1
        def close():
            self.eeu_win.destroy()
        Button(frame3,text='Close', relief=GROOVE, bg='#B0C4DE',
               command=close).grid(row=row,column=col)

        return
Show dialog for doing Exp Uncertainty
Show dialog for doing Exp Uncertainty
Show dialog for doing Exp Uncertainty
def showExpUncertaintyDialog(self):
        if self.fitdata == {}: return
        data = self.data; fitdata = self.fitdata
        model = fitdata['model']
        X = Fitting.getFitter(model)
        vrs = X.variables
        names = X.getVarNames()
        self.eeu_win = Toplevel(self.parent.master)
        self.parentapp.set_geometry(self.parentapp.ekin_win, self.eeu_win)
        self.eeu_win.title('Estimate experimental uncertainty')
        frame1 = Frame(self.eeu_win)
        frame1.pack()
        self.eeu_x_uncertainty = DoubleVar()
        self.eeu_x_uncertainty.set(0.01)
        self.eeu_y_uncertainty = DoubleVar()
        self.eeu_y_uncertainty.set(0.01)
        self.eeu_no_runs = IntVar()
        self.eeu_no_runs.set(10)
        row=1; col=1
        Label(frame1,text='Uncertainty of x-values:').grid(row=row,column=col);  col+=1
        Entry(frame1,textvariable=self.eeu_x_uncertainty,bg='white').grid(row=row,column=col); col=1
        row+=1
        Label(frame1,text='Uncertainty of y-values:').grid(row=row,column=col); col+=1
        Entry(frame1,textvariable=self.eeu_y_uncertainty,bg='white').grid(row=row,column=col); col=1
        row+=1
        Label(frame1,text='Number of runs:').grid(row=row,column=col); col+=1
        Entry(frame1,textvariable=self.eeu_no_runs,bg='white').grid(row=row,column=col); col=1
        row+=1
        frame2 = Frame(self.eeu_win)
        frame2.pack()
        no_runs = IntVar()
        no_runs.set(1)
        self.current_run = IntVar()
        self.current_run.set(0)
        row=0; col=0
        modellabel = Label(frame2,text='Model: '+model, font="bold").grid(row=row,column=col)
        row+=1; col=1
        self.eeu_averages={}; self.eeu_stdevs={}
        Label(frame2,text='Average',foreground='blue').grid(row=row,column=col,columnspan=1); col+=1
        Label(frame2,text='Standard dev.',foreground='blue').grid(row=row,column=col,columnspan=1)
        row+=1; col=0
        for n in names:
            self.eeu_averages[n] = DoubleVar()
            self.eeu_averages[n].set(0.0)
            self.eeu_stdevs[n] = DoubleVar()
            self.eeu_stdevs[n].set(0.0)
            Label(frame2, text='%s'%n ).grid(row=row,column=0,sticky='w',columnspan=3)
            Label(frame2,textvariable=self.eeu_averages[n]).grid(row=row,column=1,sticky='w')
            Label(frame2,textvariable=self.eeu_stdevs[n]).grid(row=row,column=2,sticky='w')
            row+=1
        self.eeu_sumsqaverages = DoubleVar()
        self.eeu_sumsqstdevs = DoubleVar()
        col=0
        Label(frame2,text='Sum of sq errors:').grid(row=row,column=col,sticky='w',columnspan=3)
        col+=1
        Label(frame2,textvariable=self.eeu_sumsqaverages).grid(row=row,column=col,sticky='w',)
        col+=1
        Label(frame2,textvariable=self.eeu_sumsqstdevs).grid(row=row,column=col,sticky='w')
        row+=1;col=0
        Label(frame2,text='Run number ').grid(row=row,column=col); col+=1
        Label(frame2,textvariable=self.current_run).grid(row=row,column=col); col+=1
        Label(frame2,text=' of ').grid(row=row,column=col); col+=1
        Label(frame2,textvariable=self.eeu_no_runs).grid(row=row,column=col); col=1
        row+=1;
        frame3 = Frame(self.eeu_win)
        frame3.pack()
        row=1; col=1
        Button(frame3, text='Start', relief=GROOVE, bg='#B0C4DE',
               command=self.startestimateUncertainty).grid(row=row,column=col)
        col+=1
        Button(frame3,text='Stop', relief=GROOVE, bg='#B0C4DE',
               command=self.stopestimateUncertainty).grid(row=row,column=col)
        col+=1
        def close():
            self.eeu_win.destroy()
        Button(frame3,text='Close', relief=GROOVE, bg='#B0C4DE',
               command=close).grid(row=row,column=col)
        return
def showExpUncertaintyDialog ( self ) : if self . fitdata == { } : return data = self . data ; fitdata = self . fitdata model = fitdata [ 'model' ] X = Fitting . getFitter ( model ) vrs = X . variables names = X . getVarNames ( ) self . eeu_win = Toplevel ( self . parent . master ) self . parentapp . set_geometry ( self . parentapp . ekin_win , self . eeu_win ) self . eeu_win . title ( 'Estimate experimental uncertainty' ) frame1 = Frame ( self . eeu_win ) frame1 . pack ( ) self . eeu_x_uncertainty = DoubleVar ( ) self . eeu_x_uncertainty . set ( 0.01 ) self . eeu_y_uncertainty = DoubleVar ( ) self . eeu_y_uncertainty . set ( 0.01 ) self . eeu_no_runs = IntVar ( ) self . eeu_no_runs . set ( 10 ) row = 1 ; col = 1 Label ( frame1 , text = 'Uncertainty of x-values:' ) . grid ( row = row , column = col ) ; col += 1 Entry ( frame1 , textvariable = self . eeu_x_uncertainty , bg = 'white' ) . grid ( row = row , column = col ) ; col = 1 row += 1 Label ( frame1 , text = 'Uncertainty of y-values:' ) . grid ( row = row , column = col ) ; col += 1 Entry ( frame1 , textvariable = self . eeu_y_uncertainty , bg = 'white' ) . grid ( row = row , column = col ) ; col = 1 row += 1 Label ( frame1 , text = 'Number of runs:' ) . grid ( row = row , column = col ) ; col += 1 Entry ( frame1 , textvariable = self . eeu_no_runs , bg = 'white' ) . grid ( row = row , column = col ) ; col = 1 row += 1 frame2 = Frame ( self . eeu_win ) frame2 . pack ( ) no_runs = IntVar ( ) no_runs . set ( 1 ) self . current_run = IntVar ( ) self . current_run . set ( 0 ) row = 0 ; col = 0 modellabel = Label ( frame2 , text = 'Model: ' + model , font = "bold" ) . grid ( row = row , column = col ) row += 1 ; col = 1 self . eeu_averages = { } ; self . eeu_stdevs = { } Label ( frame2 , text = 'Average' , foreground = 'blue' ) . grid ( row = row , column = col , columnspan = 1 ) ; col += 1 Label ( frame2 , text = 'Standard dev.' , foreground = 'blue' ) . grid ( row = row , column = col , columnspan = 1 ) row += 1 ; col = 0 for n in names : self . eeu_averages [ n ] = DoubleVar ( ) self . eeu_averages [ n ] . set ( 0.0 ) self . eeu_stdevs [ n ] = DoubleVar ( ) self . eeu_stdevs [ n ] . set ( 0.0 ) Label ( frame2 , text = '%s' % n ) . grid ( row = row , column = 0 , sticky = 'w' , columnspan = 3 ) Label ( frame2 , textvariable = self . eeu_averages [ n ] ) . grid ( row = row , column = 1 , sticky = 'w' ) Label ( frame2 , textvariable = self . eeu_stdevs [ n ] ) . grid ( row = row , column = 2 , sticky = 'w' ) row += 1 self . eeu_sumsqaverages = DoubleVar ( ) self . eeu_sumsqstdevs = DoubleVar ( ) col = 0 Label ( frame2 , text = 'Sum of sq errors:' ) . grid ( row = row , column = col , sticky = 'w' , columnspan = 3 ) col += 1 Label ( frame2 , textvariable = self . eeu_sumsqaverages ) . grid ( row = row , column = col , sticky = 'w' , ) col += 1 Label ( frame2 , textvariable = self . eeu_sumsqstdevs ) . grid ( row = row , column = col , sticky = 'w' ) row += 1 ; col = 0 Label ( frame2 , text = 'Run number ' ) . grid ( row = row , column = col ) ; col += 1 Label ( frame2 , textvariable = self . current_run ) . grid ( row = row , column = col ) ; col += 1 Label ( frame2 , text = ' of ' ) . grid ( row = row , column = col ) ; col += 1 Label ( frame2 , textvariable = self . eeu_no_runs ) . grid ( row = row , column = col ) ; col = 1 row += 1 ; frame3 = Frame ( self . eeu_win ) frame3 . pack ( ) row = 1 ; col = 1 Button ( frame3 , text = 'Start' , relief = GROOVE , bg = '#B0C4DE' , command = self . startestimateUncertainty ) . grid ( row = row , column = col ) col += 1 Button ( frame3 , text = 'Stop' , relief = GROOVE , bg = '#B0C4DE' , command = self . stopestimateUncertainty ) . grid ( row = row , column = col ) col += 1 def close ( ) : self . eeu_win . destroy ( ) Button ( frame3 , text = 'Close' , relief = GROOVE , bg = '#B0C4DE' , command = close ) . grid ( row = row , column = col ) return
Show dialog for doing Exp Uncertainty
Show dialog for doing Exp Uncertainty
"""Show dialog for doing Exp Uncertainty""" #fill in average and standard deviations for each var in model # Errors and standard deviations # stop and quit buttons
self