def start_sem(self): main_data = self.main_app.main_data sem_stream = stream.SEMStream( "Secondary electrons survey", main_data.sed, main_data.sed.data, main_data.ebeam, focuser=main_data.ebeam_focus, emtvas=get_local_vas(main_data.ebeam), detvas=get_local_vas(main_data.sed), ) self.start(sem_stream)
def addst(self): main_data = self.main_app.main_data stctrl = self._tab.streambar_controller axes = stctrl._filter_axes( {"filter": ("band", main_data.light_filter)}) # TODO: special live stream? ar_stream = ARSettingsStream( "CL intensity on CCD", main_data.ccd, main_data.ccd.data, main_data.ebeam, sstage=main_data.scan_stage, opm=main_data.opm, axis_map=axes, detvas=get_local_vas(main_data.ccd, main_data.hw_settings_config), ) # TODO: Allow very large binning on the CCD # Make sure the binning is not crazy (especially can happen if CCD is shared for spectrometry) if model.hasVA(ar_stream, "detBinning"): b = ar_stream.detBinning.value if b[0] != b[1] or b[0] > 16: ar_stream.detBinning.value = ar_stream.detBinning.clip((1, 1)) ar_stream.detResolution.value = ar_stream.detResolution.range[ 1] # Create the equivalent MDStream sem_stream = self._tab.tab_data_model.semStream sem_cl_stream = SEMCLCCDStream("SEM CLi CCD", [sem_stream, ar_stream]) return stctrl._addRepStream(ar_stream, sem_cl_stream)
def addst(self): main_data = self.main_app.main_data # TODO: special live stream? ar_stream = ARSettingsStream( "CL intensity on CCD", main_data.ccd, main_data.ccd.data, main_data.ebeam, sstage=main_data.scan_stage, opm=main_data.opm, detvas=get_local_vas(main_data.ccd, main_data.hw_settings_config), ) # TODO: Allow very large binning on the CCD # Make sure the binning is not crazy (especially can happen if CCD is shared for spectrometry) if model.hasVA(ar_stream, "detBinning"): b = ar_stream.detBinning.value if b[0] != b[1] or b[0] > 16: ar_stream.detBinning.value = ar_stream.detBinning.clip((1, 1)) ar_stream.detResolution.value = ar_stream.detResolution.range[1] # Create the equivalent MDStream sem_stream = self._tab.tab_data_model.semStream sem_cl_stream = SEMCLCCDStream("SEM CLi CCD", [sem_stream, ar_stream]) stctrl = self._tab.streambar_controller return stctrl._addRepStream(ar_stream, sem_cl_stream, axes={"band": main_data.light_filter} )
def addSpectrum(self, name, detector): """ name (str): name of the stream detector (DigitalCamera): spectrometer to acquire the spectrum """ logging.debug("Adding spectrum stream for %s", detector.name) main_data = self.main_app.main_data stctrl = self._tab.streambar_controller spg = stctrl._getAffectingSpectrograph(detector) axes = { "wavelength": ("wavelength", spg), "grating": ("grating", spg), "slit-in": ("slit-in", spg), } # Also add light filter for the spectrum stream if it affects the detector for fw in (main_data.cl_filter, main_data.light_filter): if fw is None: continue if detector.name in fw.affects.value: axes["filter"] = ("band", fw) break axes = stctrl._filter_axes(axes) if model.hasVA(main_data.ebeam, "blanker"): blanker = main_data.ebeam.blanker else: logging.warning( "E-beam doesn't support blanker, but trying to use a BlankerSpectrum stream" ) blanker = None spec_stream = BlSpectrumSettingsStream( name, detector, detector.data, main_data.ebeam, sstage=main_data.scan_stage, opm=main_data.opm, axis_map=axes, detvas=get_local_vas(detector, main_data.hw_settings_config), blanker=blanker) stctrl._set_default_spectrum_axes(spec_stream) # Create the equivalent MDStream sem_stream = self._tab.tab_data_model.semStream sem_spec_stream = BlSEMSpectrumMDStream("SEM " + name, [sem_stream, spec_stream]) ret = stctrl._addRepStream(spec_stream, sem_spec_stream) # Force the ROI to full FoV, as for the alignment with the SEM image, we need to have always a full image spec_stream.roi.value = (0, 0, 1, 1) return ret
def start_fluo(self): main_data = self.main_app.main_data fluo_stream = stream.FluoStream( "Filtered colour", main_data.ccd, main_data.ccd.data, main_data.light, main_data.light_filter, focuser=main_data.focus, emtvas={"power"}, detvas=get_local_vas(main_data.ccd), ) self.start(fluo_stream)
def addSpectrum(self, name, detector): """ name (str): name of the stream detector (DigitalCamera): spectrometer to acquire the spectrum """ logging.debug("Adding spectrum stream for %s", detector.name) main_data = self.main_app.main_data stctrl = self._tab.streambar_controller spg = stctrl._getAffectingSpectrograph(detector) axes = { "wavelength": ("wavelength", spg), "grating": ("grating", spg), "slit-in": ("slit-in", spg), } # Also add light filter for the spectrum stream if it affects the detector for fw in (main_data.cl_filter, main_data.light_filter): if fw is None: continue if detector.name in fw.affects.value: axes["filter"] = ("band", fw) break axes = stctrl._filter_axes(axes) spec_stream = LASpectrumSettingsStream( name, detector, detector.data, main_data.ebeam, l2=self._lens2, analyzer=main_data.pol_analyzer, sstage=main_data.scan_stage, opm=main_data.opm, axis_map=axes, detvas=get_local_vas(detector, main_data.hw_settings_config), ) stctrl._set_default_spectrum_axes(spec_stream) # Create the equivalent MDStream sem_stream = self._tab.tab_data_model.semStream sem_spec_stream = LASEMSpectrumMDStream("SEM " + name, [sem_stream, spec_stream]) return stctrl._addRepStream(spec_stream, sem_spec_stream)
def addSpectrum(self, name, detector): """ name (str): name of the stream detector (DigitalCamera): spectrometer to acquire the spectrum """ logging.debug("Adding spectrum stream for %s", detector.name) main_data = self.main_app.main_data stctrl = self._tab.streambar_controller spg = stctrl._getAffectingSpectrograph(detector) spec_stream = LASpectrumSettingsStream( name, detector, detector.data, main_data.ebeam, l2=self._lens2, analyzer=main_data.pol_analyzer, sstage=main_data.scan_stage, opm=main_data.opm, detvas=get_local_vas(detector, main_data.hw_settings_config), ) # Create the equivalent MDStream sem_stream = self._tab.tab_data_model.semStream sem_spec_stream = LASEMSpectrumMDStream("SEM " + name, [sem_stream, spec_stream]) # TODO: all the axes, including the filter band should be local. The # band should be set to the pass-through by default axes = { "wavelength": spg, "grating": spg, "slit-in": spg, } # Also add light filter for the spectrum stream if it affects the detector for fw in (main_data.cl_filter, main_data.light_filter): if fw is None: continue if detector.name in fw.affects.value: axes["band"] = fw return stctrl._addRepStream(spec_stream, sem_spec_stream, axes=axes)
def addSpectrum(self, name, detector): """ name (str): name of the stream detector (DigitalCamera): spectrometer to acquire the spectrum """ logging.debug("Adding spectrum stream for %s", detector.name) main_data = self.main_app.main_data stctrl = self._tab.streambar_controller spg = stctrl._getAffectingSpectrograph(detector) spec_stream = LASpectrumSettingsStream( name, detector, detector.data, main_data.ebeam, l2=self._lens2, analyzer=main_data.pol_analyzer, sstage=main_data.scan_stage, opm=main_data.opm, detvas=get_local_vas(detector, main_data.hw_settings_config), ) # Create the equivalent MDStream sem_stream = self._tab.tab_data_model.semStream sem_spec_stream = LASEMSpectrumMDStream("SEM " + name, [sem_stream, spec_stream]) # TODO: all the axes, including the filter band should be local. The # band should be set to the pass-through by default axes = {"wavelength": spg, "grating": spg, "slit-in": spg, } # Also add light filter for the spectrum stream if it affects the detector for fw in (main_data.cl_filter, main_data.light_filter): if fw is None: continue if detector.name in fw.affects.value: axes["band"] = fw return stctrl._addRepStream(spec_stream, sem_spec_stream, axes=axes)
def __init__(self, microscope, main_app): super(QuickCLPlugin, self).__init__(microscope, main_app) # Can only be used with a SPARC with CL detector (or monochromator) if not microscope: return main_data = self.main_app.main_data if not main_data.ebeam or not (main_data.cld or main_data.monochromator): return self.conf = get_acqui_conf() self.filename = model.StringVA("") self.filename.subscribe(self._on_filename) self.expectedDuration = model.VigilantAttribute(1, unit="s", readonly=True) self.hasDatabar = model.BooleanVA(False) # Only put the VAs that do directly define the image as local, everything # else should be global. The advantage is double: the global VAs will # set the hardware even if another stream (also using the e-beam) is # currently playing, and if the VAs are changed externally, the settings # will be displayed correctly (and not reset the values on next play). emtvas = set() hwemtvas = set() for vaname in get_local_vas(main_data.ebeam, main_data.hw_settings_config): if vaname in ("resolution", "dwellTime", "scale"): emtvas.add(vaname) else: hwemtvas.add(vaname) self._sem_stream = stream.SEMStream( "Secondary electrons", main_data.sed, main_data.sed.data, main_data.ebeam, focuser=main_data.ebeam_focus, hwemtvas=hwemtvas, hwdetvas=None, emtvas=emtvas, detvas=get_local_vas(main_data.sed, main_data.hw_settings_config), ) # This stream is used both for rendering and acquisition. # LiveCLStream is more or less like a SEMStream, but ensures the icon in # the merge slider is correct, and provide a few extra. if main_data.cld: self._cl_stream = LiveCLStream( "CL intensity", main_data.cld, main_data.cld.data, main_data.ebeam, focuser=main_data.ebeam_focus, emtvas=emtvas, detvas=get_local_vas(main_data.cld, main_data.hw_settings_config), opm=main_data.opm, ) # TODO: allow to type in the resolution of the CL? # TODO: add the cl-filter axis (or reset it to pass-through?) self.logScale = self._cl_stream.logScale if hasattr(self._cl_stream, "detGain"): self._cl_stream.detGain.subscribe(self._on_cl_gain) # Update the acquisition time when it might change (ie, the scan settings # change) self._cl_stream.emtDwellTime.subscribe(self._update_exp_dur) self._cl_stream.emtResolution.subscribe(self._update_exp_dur) # Note: for now we don't really support SPARC with BOTH CL-detector and # monochromator. if main_data.monochromator: self._mn_stream = LiveCLStream( "Monochromator", main_data.monochromator, main_data.monochromator.data, main_data.ebeam, focuser=main_data.ebeam_focus, emtvas=emtvas, detvas=get_local_vas(main_data.monochromator, main_data.hw_settings_config), opm=main_data.opm, ) self._mn_stream.emtDwellTime.subscribe(self._update_exp_dur) self._mn_stream.emtResolution.subscribe(self._update_exp_dur) # spg = self._getAffectingSpectrograph(main_data.spectrometer) # TODO: show axes self._dlg = None self.addMenu("Acquisition/Quick CL...\tF2", self.start)