Exemple #1
0
    def test_drift_stream(self):
        escan = self.ebeam
        detector = self.sed
        ccd = self.ccd

        # Create the stream
        sems = stream.SEMStream("test sem", detector, detector.data, escan)
        ars = stream.ARSettingsStream("test ar", ccd, ccd.data, escan)
        sas = stream.SEMARMDStream("test sem-ar", [sems, ars])

        # Long acquisition
        ccd.exposureTime.value = 1e-02  # s

        dc = leech.AnchorDriftCorrector(escan, detector)
        dc.period.value = 5
        dc.roi.value = (0.525, 0.525, 0.6, 0.6)
        dc.dwellTime.value = 1e-04
        sems.leeches.append(dc)

        escan.dwellTime.value = 1e-02

        ars.roi.value = (0.4, 0.4, 0.6, 0.6)
        ars.repetition.value = (5, 5)

        start = time.time()
        for l in sas.leeches:
            l.series_start()
        f = sas.acquire()
        x = f.result()
        for l in sas.leeches:
            l.series_complete(x)
        dur = time.time() - start
        logging.debug("Acquisition took %g s", dur)
        self.assertTrue(f.done())
Exemple #2
0
    def __init__(self, microscope, main_app):
        """
        :param microscope: (Microscope or None) The main back-end component.
        :param main_app: (wx.App) The main GUI component.
        """
        super(CLAcqPlugin, self).__init__(microscope, main_app)

        # Can only be used with a microscope
        if not microscope:
            return
        else:
            # Check which stream the microscope supports
            self.main_data = self.main_app.main_data
            if not (self.main_data.ccd and self.main_data.ebeam):
                return

        self.exposureTime = self.main_data.ccd.exposureTime
        self.binning = self.main_data.ccd.binning
        # Trick to pass the component (ccd to binning_1d_from_2d())
        self.vaconf["binning"]["choices"] = (
            lambda cp, va, cf: cutil.binning_1d_from_2d(
                self.main_data.ccd, va, cf))

        self._survey_stream = None
        self._optical_stream = acqstream.BrightfieldStream(
            "Optical",
            self.main_data.ccd,
            self.main_data.ccd.data,
            emitter=None,
            focuser=self.main_data.focus)
        self._secom_cl_stream = SECOMCLSettingsStream("Secom-CL",
                                                      self.main_data.ccd,
                                                      self.main_data.ccd.data,
                                                      self.main_data.ebeam)
        self._sem_stream = acqstream.SEMStream(
            "Secondary electrons concurrent", self.main_data.sed,
            self.main_data.sed.data, self.main_data.ebeam)

        self._secom_sem_cl_stream = SECOMCLSEMMDStream(
            "SECOM SEM CL", [self._sem_stream, self._secom_cl_stream])

        self._driftCorrector = leech.AnchorDriftCorrector(
            self.main_data.ebeam, self.main_data.sed)

        self.conf = get_acqui_conf()
        self.expectedDuration = model.VigilantAttribute(1,
                                                        unit="s",
                                                        readonly=True)
        self.exposureTime.subscribe(self._update_exp_dur)

        self.filename = self._secom_sem_cl_stream.filename  # duplicate VA
        self.filename.subscribe(self._on_filename)

        self.addMenu("Acquisition/CL acquisition...", self.start)