示例#1
0
文件: XCScan.py 项目: ddietze/pyFSRS
    def onStart(self, event=None):
        if self.running:
            module.Experiment.stop(self)

        else:
            if self.plotWnd is not None:
                self.plotWnd.Destroy()
            self.plotInit = False
            self.plotID = 0

            self.plotWnd = FSRSplot.PlotFrame(None, title=time.strftime("XC Scan"), size=(640, 640))
            self.plotWnd.plotCanvas.tightx = True
            self.plotWnd.plotCanvas.tighty = True
            self.plotWnd.Show()

            self.data = []
            self.points = []
            self.bg = []

            s_type = self.getPropertyByLabel("type").getValue()
            s_ccd = self.cameras[self.getPropertyByLabel("camera").getValue()]
            s_axis = self.axes[self.getPropertyByLabel("axis").getValue()]
            s_shutter = self.shutters[self.getPropertyByLabel("shutter").getValue()]
            s_frames = int(self.getPropertyByLabel("frames").getValue())

            self.points = cutils.prepareScanPoints(self)

            self.s_points_iterator = itertools.cycle(self.points)
            self.progress_iterator = itertools.cycle(np.arange(len(self.points) * 1 + 1) * 100 / (len(self.points) * 1))
            self.getPropertyByLabel("progress").setValue(next(self.progress_iterator))

            self.running = True

            module.Experiment.start(self, ScanThread, type=s_type, ccd=s_ccd, axis=s_axis, shutter=s_shutter, frames=s_frames, points=self.points, sets=1)
示例#2
0
    def onStart(self, event=None):
        if self.running:
            module.Experiment.stop(self)
        else:
            if self.plotWnd is not None:
                self.plotWnd.Destroy()
            self.plotInit = False

            self.plotWnd = FSRSplot.DualPlotFrame(None, title=time.strftime("FSRS Scan"), size=(800, 600))
            self.plotWnd.upperPlotCanvas.tightx = True
            self.plotWnd.lowerPlotCanvas.tightx = True
            self.plotWnd.lowerPlotCanvas.setXLabel("Wavenumber (px)")
            self.plotWnd.lowerPlotCanvas.setYLabel("Counts")

            s_type = self.getPropertyByLabel("type").getValue()
            if s_type == 0:
                self.plotWnd.upperPlotCanvas.setYLabel("Gain")
            elif s_type == 1:
                self.plotWnd.upperPlotCanvas.setYLabel("OD")
            else:
                self.plotWnd.upperPlotCanvas.setYLabel("dT / T0")

            self.plotWnd.Show()

            s_ccd = self.cameras[self.getPropertyByLabel("camera").getValue()]
            s_axis = self.axes[self.getPropertyByLabel("axis").getValue()]
            s_shutter = self.shutters[self.getPropertyByLabel("shutter").getValue()]
            s_frames = int(self.getPropertyByLabel("frames").getValue())
            s_ref = self.inputs[self.getPropertyByLabel("take ref.").getValue() - 1] if self.getPropertyByLabel("take ref.").getValue() >= 1 else None

            s_points = cutils.prepareScanPoints(self)
            self.Nsteps = len(s_points) + 1
            s_sets = int(self.getPropertyByLabel("sets").getValue())
            self.Nsets = s_sets

            self.s_points_iterator = itertools.cycle(s_points)
            self.progress_iterator = itertools.cycle(np.linspace(0, 100, len(s_points) * s_sets).astype(int))
            self.getPropertyByLabel("progress").setValue(0)

            self.basename = os.path.join(self.getPropertyByLabel("path").getValue(), self.getPropertyByLabel("basename").getValue())

            # save a timepoints file
            np.savetxt(self.basename + "_timepoints.txt", np.sort(s_points))

            module.Experiment.start(self, ScanThread, type=s_type, ccd=s_ccd, axis=s_axis, shutter=s_shutter, frames=s_frames, points=s_points, sets=s_sets, reference=s_ref)
示例#3
0
文件: DAQScan.py 项目: ddietze/pyFSRS
    def onStart(self, event=None):
        if self.running:
            module.Experiment.stop(self)
        else:
            self.data = []
            self.points = []

            if self.plotWnd is not None:
                self.plotWnd.Destroy()
            self.plotID = -1

            self.plotWnd = FSRSplot.PlotFrame(None, title="DAQScan", size=(640, 480))
            self.plotWnd.Show()

            s_axis = self.axes[self.getPropertyByLabel("axis").getValue()]
            s_daq = self.daqs[self.getPropertyByLabel("daq").getValue()]
            self.points = cutils.prepareScanPoints(self)

            self.progress_iterator = itertools.cycle(np.arange(len(self.points) + 1) * 100 / (len(self.points)))
            self.getPropertyByLabel("progress").setValue(next(self.progress_iterator))

            module.Experiment.start(self, DAQScanThread, daq=s_daq, axis=s_axis, points=self.points)