Esempio n. 1
0
 def Correct_file(self):
     if (self.chse.get()) or (self.chds.get()):
         if self.chds.get():
             spos = float(eval(self._dspos.get()))
             sold = float(eval(self._dsold.get()))
             snew = float(eval(self._dsnew.get()))
             if self.chse.get():
                 p1 = float(eval(self._pos.get()))
                 p2 = float(eval(self._npos.get()))
                 ds_1 = float(eval(self._dsse.get()))
                 ashift = bt.E2T(p2, ds_1) - bt.E2T(p1, ds_1)
             else:
                 ashift = 0
             for item in self.filesel.spectra:
                 item.E = bt.dspa_A_change(self.filesel.spectra[0].E, dsold,
                                           dsnew, dspos, ashift)
                 writefile = item.fullfilename + ".cor"
                 ############change for Bm29 files comment
                 bt.writedata(writefile, vstack((item.E, item.Mu)))
         elif self.chse.get():
             ds_1 = float(eval(self._dsse.get()))
             p1 = float(eval(self._pos.get()))
             p2 = float(eval(self._npos.get()))
             shift = bt.E2T(p2, ds_1) - bt.E2T(p1, ds_1)
             for item in self.filesel.spectra:
                 item.E = bt.Ashif(self.filesel.spectra[0].E, ds_1, shift)
                 writefile = item.fullfilename + ".cor"
                 bt.writedata(writefile, vstack((item.E, item.Mu)))
Esempio n. 2
0
 def plotall(self):
     if (self.chse.get()) or (self.chds.get()):
         if self.chds.get():
             dspos = float(eval(self._dspos.get()))
             dsold = float(eval(self._dsold.get()))
             dsnew = float(eval(self._dsnew.get()))
             if self.chse.get():
                 p1 = float(eval(self._pos.get()))
                 p2 = float(eval(self._npos.get()))
                 ds_1 = float(eval(self._dsse.get()))
                 ashift = bt.E2T(p2, ds_1) - bt.E2T(p1, ds_1)
             else:
                 ashift = 0
             self.E1 = bt.dspa_A_change(self.filesel.spectra[0].E, dsold,
                                        dsnew, dspos, ashift)
         elif self.chse.get():
             ds_1 = float(eval(self._dsse.get()))
             p1 = float(eval(self._pos.get()))
             p2 = float(eval(self._npos.get()))
             shift = bt.E2T(p2, ds_1) - bt.E2T(p1, ds_1)
             print "correct pippo1", shift, ds_1, p1, p2
             self.E1 = bt.Ashif(self.filesel.spectra[0].E, ds_1, shift)
     else:
         self.E1 = self.filesel.spectra[0].E
     #pylab.interactive(True)
     if not (hasattr(self, 'top')) or not (self.top.winfo_exists()):
         self.top = Toplevel()
         self.top.title('Grafico')
         self.fig = matplotlib.figure.Figure(figsize=(5, 4), dpi=100)
         self.canvas = FigureCanvasTkAgg(self.fig, master=self.top)
         self.toolbar = NavigationToolbar2TkAgg(self.canvas, self.top)
         self.canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1)
         self.canvas._tkcanvas.pack(side=TOP, fill=BOTH, expand=1)
         self.figsub = self.fig.add_subplot(111)
         self.figsub.set_autoscale_on(True)
         self.lines = self.figsub.plot(self.standardsel.spectra[0].E,
                                       self.standardsel.spectra[0].Mu,
                                       label="standard")
         self.lines += self.figsub.plot(self.E1,
                                        self.filesel.spectra[0].Mu,
                                        label="file")
         self.figsub.set_ylabel("Mu (a.u.)", fontsize=8)
         self.figsub.set_xlabel("Energy (eV)", fontsize=8)
         self.toolbar.update()
         print "pippo"
         self.figsub.legend()
         self.canvas.draw()
     self.lines[1].set_xdata(self.E1)
     self.figsub.set_autoscale_on(False)
     self.canvas.draw()
Esempio n. 3
0
 def setredraw(self, value):
     pippo = value
     #self.lbl.configure(text= pippo)
     #self.Ash.set(str(pippo))
     if (hasattr(self.filesel,
                 'spectra')):  #and hasattr(self.standardsel, 'spectra')
         self.Ec = bm29_tools.Ashif(self.filesel.spectra[0].E,
                                    self.filesel.spectra[0].dspac,
                                    float(pippo))
         self.drawagain()
         #self.fig.refresh()
         #pylab.focus()
         #radice.focus()
     pass
Esempio n. 4
0
 def plot_MuFp(self):
     self.pulsante_Mu.configure(relief="raised")
     self.pulsante_MuFp.configure(relief="sunken")
     self.filesel.spectra[0].bm29derE()
     self.standardsel.spectra[0].bm29derE()
     shift = float(self.Ash.get())
     self.Ec = bm29_tools.Ashif(self.filesel.spectra[0].E,
                                self.filesel.spectra[0].dspac, shift)
     if not (hasattr(self, 'top')) or not (self.top.winfo_exists()):
         self.cr_graph()
         self.qexaplot = self.figsub.plot(
             self.standardsel.spectra[0].E,
             self.standardsel.spectra[0].E_MuFp,
             label="standard")
         self.qexaplot += self.figsub.plot(self.Ec,
                                           self.filesel.spectra[0].E_MuFp,
                                           label="file")
         self.figsub.set_ylabel("first derivative Mu (a.u.)", fontsize=8)
         self.figsub.set_xlabel("Energy (eV)", fontsize=8)
         self.figsub.legend()
         self.canvas.draw()
     else:
         #self.figsub.set_autoscale_on(True)
         print self.figsub.set_autoscale_on(True)
         self.qexaplot[0].set_ydata(self.standardsel.spectra[0].E_MuFp)
         self.qexaplot[1].set_ydata(self.filesel.spectra[0].E_MuFp)
         ymin = min(
             list(self.filesel.spectra[0].E_MuFp) +
             list(self.standardsel.spectra[0].E_MuFp))
         ymax = max(
             list(self.filesel.spectra[0].E_MuFp) +
             list(self.standardsel.spectra[0].E_MuFp))
         srange = (ymax - ymin)
         ymin = ymin - abs(srange * .1)
         ymax = ymax + abs(srange * .1)
         self.figsub.axis([
             self.standardsel.spectra[0].E[0] - 20,
             self.standardsel.spectra[0].E[-1] + 20, ymin, ymax
         ])
         self.drawagain()
         self.figsub.set_autoscale_on(False)