Exemplo n.º 1
0
    def __init__(self, genitore):
        self.genitore=genitore
        self._geometry= StringVar()
        self._Absorber= StringVar()
        self._Scatter=  StringVar()
        self._bond = StringVar()
        self._edge = StringVar()
        self._edge.set("K")
        self._geometry.set("Tetrahedral")
        self._Absorber.set("Ti")
        self._Scatter.set("O")
        self._bond.set("1.81")
        LElfpack = {"side" : LEFT, "padx" :3, "ipadx" :0 }; LEepack ={"side" : LEFT, "expand" : NO, "padx" :0}

        self.quadro_genpath = LabelFrame(genitore, text = "Generate a sigle scattering path")
        self.quadro_genpath.pack(side = TOP, expand = YES, fill = X , anchor = W, ipadx = 5, ipady = 5)
        self.quadro_genpath1 = Frame(self.quadro_genpath)
        self.quadro_genpath1.pack(side = TOP, expand = YES, fill = X , anchor = W)
        self.quadro_geometry = LabelFrame(self.quadro_genpath1, text = "Geometry")
        self.quadro_geometry.pack(side = LEFT, expand = YES, anchor = W, ipadx = 5, ipady = 5)
        self.combo_geometry= ttk.Combobox(self.quadro_geometry, state="readonly",
                    textvariable=self._geometry,values=('Tetrahedral','Sq Planar','Octahedral','Icosahedral'))

        self.combo_geometry.pack(side=LEFT)
        self.quadro_edge = LabelFrame(self.quadro_genpath1, text = "Edge")
        self.quadro_edge.pack(side = LEFT, expand = YES,  anchor = W, ipadx = 5, ipady = 5)
        self.combo_edge= ttk.Combobox (self.quadro_edge, state="readonly",
                                textvariable=self._edge,values=('K', 'L1', 'L2', 'L3'))
        
        self.combo_edge.pack(side=LEFT)

        self.quadro_genpath2 = Frame(self.quadro_genpath)
        self.quadro_genpath2.pack(side = TOP, expand = YES, fill = X , anchor = W)
        self.Absorber_LE = ut.LabelEntry(self.quadro_genpath2, Ltext = "Absober",       EtextVar= self._Absorber, Ewith = 5, SLtext ="",
                                                                            labelframepack =LElfpack,entrypack=LEepack)
        self.Scatterer =   ut.LabelEntry(self.quadro_genpath2, Ltext = "Scatterer",     EtextVar= self._Scatter,  Ewith = 5, SLtext ="",
                                                                            labelframepack =LElfpack,entrypack=LEepack)
        self.Bond_LE =     ut.LabelEntry(self.quadro_genpath2, Ltext = "Bond Distance", EtextVar= self._bond,     Ewith = 7, SLtext ="",
                                                                            labelframepack =LElfpack,entrypack=LEepack)
        self.quadro_genpath3 = Frame(self.quadro_genpath)
        self.quadro_genpath3.pack(side = TOP, expand = YES, fill = X , anchor = W, ipady=2)
        self.pulsanteA = Button(self.quadro_genpath3, command = self.feffgenerate,  text = "Generate....", background ="pale goldenrod")
        self.pulsanteA.pack(side = LEFT, expand = NO, ipadx = 5, ipady = 3)
        Frame(genitore).pack(side = TOP, expand = YES, fill = X , anchor = W, ipady=2, pady=5)
        self.genpath=ut.Browse_filename(genitore, "Or select one", singlefile=1)
        self.genpath.pulsanteA.configure(background ="pale goldenrod", command=self.browse)
        self.genpath.filenames=[]
        Frame(genitore).pack(side = TOP, expand = YES, fill = X , anchor = W, ipady=2, pady=10)
        Define = Button(genitore, command = self.quit,  text = "Define and Quit", background ="green")
        Define.pack(side =TOP, anchor = W, ipady=5)
Exemplo n.º 2
0
   def __init__(self, *args,**kws):
      #-------------------------------    declare    ----------------------------------------------
        self.plotfit    = StringVar()
        self.label_path1 =StringVar()         #define the label of path1
        self._check_n1  = IntVar()            #define if the corresponding parameter is refined
        self._check_s1  = IntVar()            #define if the corresponding parameter is refined
        self._check_r1  = IntVar()            #define if the corresponding parameter is refined
        self._check_e1  = IntVar()            #define if the corresponding parameter is refined
        self._check_path1 = IntVar()          #def. if corresponding path is used
        
        self._s1     = StringVar()            #entry for parameters
        self._r1     = StringVar()            #entry for parameters
        self._e1     = StringVar()            #entry for parameters
        self._n1     = StringVar()            #entry for parameters


        packLabelFrame = {"side" : LEFT,  "expand" : YES, "anchor" : W, "pady" : 3, "ipadx" :3}
        packEntry      = {"side" : LEFT,   "anchor" : W, "pady" : 3, "padx" : 0, "fill" : X }   # "expand" :
        LElfpack = {"side" : LEFT, "padx" :3, "ipadx" :0 }; LEepack ={"side" : LEFT, "expand" : NO, "padx" :0}
      #---------------------------------  set      ------------------------------------------
        self._check_path1
      #--------------------------------- Structure     ------------------------------------------      
      
        LabelFrame.__init__(self,*args,**kws)
        self.text=kws['text']

        self.pathselect_1=ut.Browse_filename(self, "Path name", singlefile=1)
        self.pathselect_1.quadro_selezione.pack(side = TOP,  ipadx = 0, ipady = 3 )
        self.pathselect_1.pulsanteA.configure(command = self.browse_command2_1, text="Path", width=8, background ="pale goldenrod" )
        self.quadro_Path1_var = Frame(self)
        self.quadro_Path1_var.pack(side = TOP,  fill = X, pady= 0, ipadx = 0, ipady = 0)
        self.path1_Buttoncheck = Checkbutton(self.quadro_Path1_var, text="Use   " ,variable=self._check_path1 )
        self.path1_Buttoncheck.pack(side = LEFT,  fill = Y ,anchor = W, ipady = 1, padx = 0)
        self.n1_LE = ut.LabelEntry(self.quadro_Path1_var, Ltext = "n", EtextVar= self._n1, Ewith = 5, SLtext ="",
                                   labelframepack =LElfpack,entrypack=LEepack)
        self.n1_check = Checkbutton(self.n1_LE.LabFr, text="",variable=self._check_n1)
        self.n1_check.pack(side = LEFT,  fill = Y ,anchor = W, ipady = 1, padx = 0)
        self.r1_LE = ut.LabelEntry(self.quadro_Path1_var, Ltext = "r", EtextVar= self._r1, Ewith = 5, SLtext ="",
                                   labelframepack =LElfpack,entrypack=LEepack)
        self.r1_check = Checkbutton(self.r1_LE.LabFr, text="",variable=self._check_r1)
        self.r1_check.pack(side = LEFT,  fill = Y ,anchor = W, ipady = 1, padx = 0)
        self.s1_LE = ut.LabelEntry(self.quadro_Path1_var, Ltext = "ss", EtextVar= self._s1, Ewith = 5, SLtext ="",
                                   labelframepack =LElfpack,entrypack=LEepack)
        self.s1_check = Checkbutton(self.s1_LE.LabFr, text="" ,variable=self._check_s1 )
        self.s1_check.pack(side = LEFT,  fill = Y ,anchor = W, ipady = 1, padx = 0)
        self.e1_LE = ut.LabelEntry(self.quadro_Path1_var, Ltext = "e0", EtextVar= self._e1, Ewith = 5, SLtext ="",
                                   labelframepack =LElfpack,entrypack=LEepack)
        self.e1_check = Checkbutton(self.e1_LE.LabFr ,variable=self._check_e1 )
        self.e1_check.pack(side = LEFT,  fill = Y ,anchor = W, ipady = 1, padx = 1)
Exemplo n.º 3
0
    def __init__(self, genitore):
        #-----------------------------      Declare      --------------------------------------------------
        self.A = StringVar()
        self.B = StringVar()
        self.C = StringVar()
        self._r = StringVar()
        self.v = IntVar()
        self.v.set(2)

        #-----------------------------      Define      --------------------------------------------------
        self.A.set(0)
        self.B.set(1)
        self.C.set(0)
        #-----------------------------      geometry      --------------------------------------------------
        self.Cal_sel = ut.Browse_filename(genitore, "Calibration sample", 1)
        self.Disp_sel = ut.Browse_filename(genitore,
                                           "Dispersive Calibration sample", 1)
        self.quadro_Title = Frame(genitore)
        self.quadro_Title.pack(side=TOP, anchor=W, expand=Y, fill=BOTH)
        Label(self.quadro_Title,
              text=" Energy = A + B*Pixel + C*Pixel**2             ").pack(
                  side=LEFT, anchor=N)
        Radiobutton(self.quadro_Title,
                    text="Write text",
                    variable=self.v,
                    value=1,
                    command=self.radio_command).pack(side=LEFT, anchor=N)
        Radiobutton(self.quadro_Title,
                    text="Use sliders",
                    variable=self.v,
                    value=2,
                    command=self.radio_command).pack(side=LEFT, anchor=N)
        #-----------------------------      Calibration---------------------------------------------
        self.quadro_sliders = Frame(genitore)
        self.quadro_sliders.pack(side=TOP, anchor=W, expand=Y, fill=BOTH)
        self.quadro_A = Frame(self.quadro_sliders)
        self.quadro_A.pack(side=TOP, fill=BOTH)
        self.Aslider = Scale(
            self.quadro_A,
            from_=-.05,
            to=.05,
            command=self.setredraw_A,
            variable=self.A,
            resolution=0.0000001,
            orient=HORIZONTAL,  # label= "A",
            showvalue=0)
        self.Aslider.pack(side=LEFT,
                          fill=X,
                          anchor=W,
                          pady=3,
                          ipady=0,
                          expand=Y)
        Label(self.quadro_A, text=" A ").pack(side=LEFT)  #, anchor = SW
        #self.entry_A= Entry(self.quadro_A, width = 9, textvariable = self.A)
        #self.entry_A.pack(side = LEFT, ipadx = 5, ipady = 1, fill = Y, pady= 2)
        #self.entry_A.bind("<Key>", self.keymove)
        #self.entry_A.bind("<Return>", self.keyenter)
        self.quadro_B = Frame(self.quadro_sliders)
        self.quadro_B.pack(side=TOP, fill=BOTH)
        self.Bslider = Scale(
            self.quadro_B,
            from_=0,
            to=1.5,
            command=self.setredraw_B,
            variable=self.B,
            resolution=0.00001,
            orient=HORIZONTAL,  #label= "Angular shift"
            showvalue=0,
        )
        self.Bslider.pack(side=LEFT,
                          fill=X,
                          anchor=W,
                          pady=3,
                          ipady=0,
                          expand=Y)
        Label(self.quadro_B, text=" B ").pack(side=LEFT)
        self.quadro_C = Frame(self.quadro_sliders)
        self.quadro_C.pack(side=TOP, fill=BOTH)
        self.Cslider = Scale(
            self.quadro_C,
            from_=-.00005,
            to=.00005,
            command=self.setredraw_B,
            variable=self.C,
            resolution=0.00000001,
            orient=HORIZONTAL,
            showvalue=0,
        )
        self.Cslider.pack(side=LEFT,
                          fill=X,
                          anchor=W,
                          pady=3,
                          ipady=0,
                          expand=Y)
        Label(self.quadro_C, text=" C ").pack(side=LEFT)

        self.quadro_ABCtext = Frame(genitore)
        self.quadro_ABCtext.pack(side=TOP,
                                 expand=N,
                                 fill=X,
                                 pady=2,
                                 ipadx=5,
                                 ipady=5)
        self.entry_A = Entry(self.quadro_ABCtext,
                             width=9,
                             textvariable=self.A,
                             state='readonly')
        self.entry_A.pack(side=LEFT, ipadx=5, ipady=1, fill=None, pady=2)
        Label(self.quadro_ABCtext, text=" A   ").pack(side=LEFT)
        self.entry_B = Entry(self.quadro_ABCtext,
                             width=9,
                             textvariable=self.B,
                             state='readonly')
        self.entry_B.pack(side=LEFT, ipadx=5, ipady=1, fill=None, pady=2)
        Label(self.quadro_ABCtext, text=" B   ").pack(side=LEFT)
        self.entry_C = Entry(self.quadro_ABCtext,
                             width=9,
                             textvariable=self.C,
                             state='readonly')
        self.entry_C.pack(side=LEFT, ipadx=5, ipady=1, fill=None, pady=2)
        Label(self.quadro_ABCtext, text=" C   ").pack(side=LEFT)

        self.quadro_buttonp1 = Frame(genitore)
        self.quadro_buttonp1.pack(side=TOP,
                                  expand=N,
                                  fill=X,
                                  pady=2,
                                  ipadx=5,
                                  ipady=5)
        self.pulsante_plot = Button(self.quadro_buttonp1,
                                    command=self.plot,
                                    text="Plot Mu",
                                    background="violet",
                                    width=8,
                                    padx="3m",
                                    pady="2m")
        self.pulsante_plot.pack(side=LEFT, anchor=W)
        self.pulsante_dplot = Button(self.quadro_buttonp1,
                                     command=self.dplot,
                                     text="Plo Derivative",
                                     background="violet",
                                     width=8,
                                     padx="3m",
                                     pady="2m")
        self.pulsante_dplot.pack(side=LEFT, anchor=W)
        self.pulsante_Fitder = Button(self.quadro_buttonp1,
                                      command=self.fitder,
                                      text="Fit Derivative",
                                      background="violet",
                                      width=8,
                                      padx="3m",
                                      pady="2m")
        self.pulsante_Fitder.pack(side=LEFT, anchor=W)

        self.pulsante_Select = Button(self.quadro_buttonp1,
                                      command=self.select,
                                      text="Select",
                                      background="Green",
                                      width=8,
                                      padx="3m",
                                      pady="2m")
        self.pulsante_Select.pack(side=LEFT, anchor=W)

        self.quadro_push = Frame(genitore)
        self.quadro_push.pack(side=TOP,
                              expand=YES,
                              fill=BOTH,
                              pady=10,
                              ipadx=5,
                              ipady=5)

        #-----------------------------      Browsefiles ---------------------------------------------
        self.filesel = ut.Browse_filename(genitore, "Experiment Filenames", 0)
        self.filesel.pulsanteA.configure(command=self.browse_command2)
Exemplo n.º 4
0
    def __init__(self, genitore):
        #-----------------------------      Declare      --------------------------------------------------
        self.before = StringVar()
        self.after = StringVar()
        #self.energy = StringVar()
        self._function = StringVar()
        self._function_p = StringVar()
        self._All_spectra = StringVar()
        self._c_range = IntVar()
        #-----------------------------      Define       --------------------------------------------------
        self._function.set("Ref.der.")
        self._function_p.set("Ref")
        self._All_spectra.set("first spectra     ")

        #-----------------------------      Windows       --------------------------------------------------
        self.filesel = ut.Browse_filename(genitore, "Filenames", 0)
        self.filesel.pulsanteA.configure(command=self.browse_command2)
        #--------------------------- Quadro correction ----------------------------------------------
        self.quadro_Define = LabelFrame(genitore,
                                        text="Allign spectra respect to")
        self.quadro_Define.pack(side=TOP,
                                anchor=W,
                                fill=X,
                                pady=3,
                                ipadx=5,
                                ipady=3,
                                expand=N)  #, expand = YES
        #--------------------------- Quadro correction 1----------------------------------------------
        self.quadro_Define1 = Frame(self.quadro_Define)
        self.quadro_Define1.pack(side=TOP,
                                 anchor=W,
                                 fill=X,
                                 pady=0,
                                 ipadx=0,
                                 ipady=0,
                                 expand=N)
        self.combo_All = ttk.Combobox(self.quadro_Define1,
                                      state="readonly",
                                      textvariable=self._All_spectra,
                                      values=('first spectra     ',
                                              'Calibration sample'))
        self.combo_All.pack(side=LEFT)

        Label(self.quadro_Define1, text=" using ").pack(side=LEFT)
        self.combo_Cal = ttk.Combobox(self.quadro_Define1,
                                      textvariable=self._function,
                                      values=('Ref.der.', 'Ref', '-I0',
                                              'Cal. Mu', 'Cal. der.'))
        self.combo_Cal.pack(side=LEFT)
        #self.combo_Cal.insert(0, 'Ref.der.')

        Frame(self.quadro_Define1).pack(side=LEFT,
                                        anchor=W,
                                        fill=X,
                                        pady=2,
                                        ipadx=10,
                                        padx=5,
                                        ipady=3,
                                        expand=Y)
        Button(self.quadro_Define1,
               command=self.plot_set_Energy,
               text="Plot  correction ",
               background="violet",
               width=15,
               padx="1m",
               pady="2m").pack(side=LEFT, anchor=W)
        #--------------------------- Quadro correction 2----------------------------------------------
        self.quadro_Define2 = Frame(self.quadro_Define)
        self.quadro_Define2.pack(side=TOP,
                                 anchor=W,
                                 fill=X,
                                 pady=3,
                                 ipadx=0,
                                 ipady=3,
                                 expand=N)
        Label(self.quadro_Define2, text="In the range").pack(side=LEFT)
        self.check_range = Checkbutton(self.quadro_Define2,
                                       variable=self._c_range)
        self.check_range.pack(side=LEFT, fill=Y, anchor=W, ipady=1)
        Label(self.quadro_Define2, text=" between ").pack(side=LEFT)
        self.Define_before = Entry(self.quadro_Define2,
                                   textvariable=self.before,
                                   width=10)  #
        self.Define_before.pack(side=LEFT, padx=5, ipadx=5, ipady=3)
        Label(self.quadro_Define2, text=" and ").pack(side=LEFT)
        self.Define_after = Entry(self.quadro_Define2,
                                  textvariable=self.after,
                                  width=10)
        self.Define_after.pack(side=LEFT, padx=5, ipadx=5, ipady=3)
        Label(self.quadro_Define2, text=" eV ").pack(side=LEFT)
        #--------------------------- Quadro correction 3----------------------------------------------
        self.quadro_Define3 = Frame(self.quadro_Define)
        self.quadro_Define3.pack(side=TOP,
                                 anchor=W,
                                 fill=X,
                                 pady=0,
                                 ipadx=0,
                                 ipady=0,
                                 expand=N)

        self.calibsel = ut.Browse_file(self.quadro_Define3,
                                       "Calibration Sample", 1)

        #--------------------------- Quadro plot cor ----------------------------------------------
        self.quadro_plot = LabelFrame(genitore, text="Plot ")
        self.quadro_plot.pack(side=TOP,
                              expand=YES,
                              fill=X,
                              pady=10,
                              ipadx=5,
                              ipady=5)
        self.combo_Plot = ttk.Combobox(self.quadro_plot,
                                       state="readonly",
                                       textvariable=self._function_p,
                                       values=('Ref.der.', 'Ref', '-I0'))
        self.combo_Plot.pack(side=LEFT)

        self.pulsante_Plot_nc = Button(
            self.quadro_plot,
            command=lambda x="not": self.plot_all(x),
            text="not corrected",
            background="DeepPink2",
            width=10,
            padx="3m",
            pady="2m")
        self.pulsante_Plot_nc.pack(side=LEFT, anchor=W)
        self.pulsante_Plot_c = Button(
            self.quadro_plot,
            command=lambda z="cor": self.plot_all(z),
            text="  corrected  ",
            background="DeepPink2",
            width=10,
            padx="3m",
            pady="2m",
            relief="ridge",  #"solid",#"groove",#"flat",
            state=DISABLED)
        self.pulsante_Plot_c.pack(side=LEFT, anchor=W)
        #--------------------------- Quadro perform ----------------------------------------------
        self.quadro_buttonp3 = LabelFrame(genitore, text="Apply correction")
        self.quadro_buttonp3.pack(side=TOP,
                                  expand=YES,
                                  fill=X,
                                  pady=10,
                                  ipadx=5,
                                  ipady=5)
        self.pulsante_Defcor = Button(self.quadro_buttonp3,
                                      command=self.correct,
                                      text="Apply correction",
                                      background="Violet",
                                      width=10,
                                      padx="5m",
                                      pady="2m")
        self.pulsante_Defcor.pack(side=LEFT, anchor=W)
        self.pulsante_Remcor = Button(self.quadro_buttonp3,
                                      command=self.rem_correct,
                                      text="Remove correction",
                                      background="Violet",
                                      width=10,
                                      padx="5m",
                                      pady="2m")
        self.pulsante_Remcor.pack(side=LEFT, anchor=W)