示例#1
0
    def onSave(self, event):
        if len(self.data) == 0:
            wx.MessageBox("Nothing to save yet!", "Save Last Scan", style=wx.OK)
            return

        dlg = wx.FileDialog(None, "Save Last Scan", os.getcwd(), "", "*.*", wx.SAVE)

        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetPath()

            # set new working directory
            directory = os.path.split(filename)
            if not os.path.isdir(filename):
                os.chdir(directory[0])

            # save averaged data
            cutils.saveFSRS(filename, self.data)

            # save intermediate steps
            if len(self.intdata) > 1:
                tmp = filename.split(".")
                if len(tmp) > 1:
                    basename = tmp[:-1].join()
                    ext = "." + tmp[-1]
                else:
                    basename = filename
                    ext = ""
                for i in range(len(self.intdata)):
                    cutils.saveFSRS("%s_%d%s" % (basename, i, ext), self.intdata[i])

        dlg.Destroy()
示例#2
0
    def onUpdate(self, val, grexc, step, set):

        # prepare data
        A, B, C = val
        mode = self.getPropertyByLabel("mode").getValue()
        if mode == 0:
            A = -np.log(A)
        elif mode == 1:
            A = -np.log10(A)

        # save data
        filename = cutils.formatFSRSFilename(mode, self.basename, step, set, grexc)
        cutils.saveFSRS(filename, [A, B, C])

        # update progress bar
        self.getPropertyByLabel("progress").setValue(next(self.progress_iterator))
        self.getPropertyByLabel("status").setValue("position %.0ffs, set %d/%d" % (step, set, self.Nsets))

        # plot in window
        if isinstance(self.plotWnd, wx.Frame):
            if self.plotInit:
                self.plotWnd.upperPlotCanvas.setLine(0, np.arange(len(A)), A)
                self.plotWnd.lowerPlotCanvas.setLine(0, np.arange(len(A)), B)
                self.plotWnd.lowerPlotCanvas.setLine(1, np.arange(len(A)), C)
            else:
                self.plotInit = True
                self.plotWnd.upperPlotCanvas.addLine(np.arange(len(A)), A)
                self.plotWnd.lowerPlotCanvas.addLine(np.arange(len(A)), B)
                self.plotWnd.lowerPlotCanvas.addLine(np.arange(len(A)), C)
        else:
            # user closed the plotWindow -> stop thread
            self.onStart()
示例#3
0
    def onSave(self, event):
        if len(self.data) == 0:
            wx.MessageBox("Nothing to save yet!", "Save Last Scan", style=wx.OK)
            return

        dlg = wx.FileDialog(None, "Save Last Scan", os.getcwd(), "", "*.*", wx.SAVE)

        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetPath()

            # set new working directory
            directory = os.path.split(filename)
            if not os.path.isdir(filename):
                os.chdir(directory[0])

            cutils.saveFSRS(filename, self.data)

        dlg.Destroy()