Exemple #1
0
    def _setup_signals(self):
        self.comboBoxAcqMode.activated.connect(self.acquisition_mode)
        self.comboBoxBinning.activated.connect(self.binning)
        self.comboBoxReadMode.activated.connect(self.read_mode)
        self.comboBoxTrigMode.activated.connect(self.trigger)
        self.spinBoxNumFrames.valueChanged.connect(self.number_frames)
        self.spinBoxNumFrames.setRange(1, 1000000)
        self.spinBoxNumAccum.valueChanged.connect(self.number_accumulations)
        self.spinBoxNumRows.valueChanged.connect(self.number_rows)
        self.spinBoxCenterRow.valueChanged.connect(self.number_rows)
        self.checkBoxROI.stateChanged.connect(self.ROI)
        self.checkBoxCrop.stateChanged.connect(self.isolated_crop)
        self.checkBoxCooler.stateChanged.connect(self.cooler)
        self.checkBoxEMMode.stateChanged.connect(self.output_amplifier)
        self.spinBoxEMGain.valueChanged.connect(self.em_gain)
        self.lineEditExpT.editingFinished.connect(self.exposure)
        self.lineEditExpT.setValidator(QtGui.QDoubleValidator())
        self.pushButtonDiv5.clicked.connect(lambda: self.exposure('/'))
        self.pushButtonTimes5.clicked.connect(lambda: self.exposure('x'))

        self.pushButtonCapture.clicked.connect(self.Capture)
        self.pushButtonLive.clicked.connect(self.Live)
        self.pushButtonAbort.clicked.connect(self.Abort)
        self.save_pushButton.clicked.connect(self.Save)
        self.pushButtonTakeBG.clicked.connect(self.take_background)
        self.checkBoxRemoveBG.stateChanged.connect(self.remove_background)
        self.referesh_groups_pushButton.clicked.connect(self.update_groups_box)
        self.keep_shutter_open_checkBox.stateChanged.connect(
            self.update_shutter_mode)
        self.read_temperature_pushButton.clicked.connect(self.temperature_gui)
        self.live_temperature_checkBox.clicked.connect(self.temperature_gui)
        self.temperature_display_thread.ready.connect(
            self.update_temperature_display)
Exemple #2
0
    def __init__(self,
                 spectrometer,
                 ui_file=os.path.join(os.path.dirname(__file__),
                                      'spectrometer_controls.ui'),
                 parent=None):
        assert isinstance(spectrometer,
                          Spectrometer), "instrument must be a Spectrometer"
        super(SpectrometerControlUI, self).__init__()
        uic.loadUi(ui_file, self)
        self.spectrometer = spectrometer

        self.integration_time.setValidator(QtGui.QDoubleValidator())
        self.integration_time.textChanged.connect(self.check_state)
        self.integration_time.textChanged.connect(self.update_param)

        self.read_background_button.clicked.connect(self.button_pressed)
        self.read_reference_button.clicked.connect(self.button_pressed)
        self.clear_background_button.clicked.connect(self.button_pressed)
        self.clear_reference_button.clicked.connect(self.button_pressed)
        self.load_state_button.clicked.connect(self.button_pressed)

        self.background_subtracted.stateChanged.connect(self.state_changed)
        self.referenced.stateChanged.connect(self.state_changed)

        self.Absorption_checkBox.stateChanged.connect(self.state_changed)

        register_for_property_changes(self.spectrometer,
                                      'variable_int_enabled',
                                      self.variable_int_state_change)
        #        if self.spectrometer.variable_int_enabled:
        #                self.background_subtracted.blockSignals(True)
        #                self.background_subtracted.setCheckState(QtCore.Qt.Checked)
        #                self.background_subtracted.blockSignals(False)
        self.Variable_int.stateChanged.connect(self.state_changed)

        #                if self.spectrometer.variable_int_enabled:
        #                self.background_subtracted.blockSignals(True)
        #                self.background_subtracted.setCheckState(QtCore.Qt.Checked)
        #                self.background_subtracted.blockSignals(False)
        self.average_checkBox.stateChanged.connect(self.state_changed)
        self.Average_spinBox.valueChanged.connect(self.update_averages)

        self.referenceID_spinBox.valueChanged.connect(self.update_references)

        self.id_string.setText('{0} {1}'.format(
            self.spectrometer.model_name, self.spectrometer.serial_number))
        self.id_string.resize(self.id_string.sizeHint())

        self.integration_time.setText(str(spectrometer.integration_time))

        self.num_spectra_spinBox.valueChanged.connect(
            self.update_time_series_params)
        self.delay_doubleSpinBox.valueChanged.connect(
            self.update_time_series_params)
        self.time_series_name_lineEdit.textChanged.connect(
            self.update_time_series_name)
        self.time_series_pushButton.clicked.connect(self.time_series)
Exemple #3
0
    def __init__(self, spectrometer):
        assert isinstance(spectrometer, OceanOpticsSpectrometer), 'spectrometer must be an OceanOpticsSpectrometer'
        super(OceanOpticsControlUI, self).__init__(spectrometer,os.path.join(os.path.dirname(__file__),'ocean_optics_controls.ui'))


        self.tec_temperature.setValidator(QtGui.QDoubleValidator())
        self.tec_temperature.textChanged.connect(self.check_state)
        self.tec_temperature.textChanged.connect(self.update_param)
        self.tec_temperature.setText(str(spectrometer.tec_temperature))

        self.enable_tec.stateChanged.connect(self.update_enable_tec)
        self.enable_tec.setChecked(self.spectrometer.enable_tec)
        self.read_tec.clicked.connect(self.update_tec)
Exemple #4
0
    def set_image(self, phase, slm_monitor=None):
        """Sets an array on the QLabel.Pixmap

        :param phase: np.array from 0 to 2 pi
        :param slm_monitor: int. Optional. If given, it will move the SLM widget to the specified monitor
        :return:
        """
        phase = self.LUT(phase)

        img = phase.ravel()
        img_slm = np.dstack((img, img, img, img)).astype(np.uint8)
        self._QImage = QtGui.QImage(img_slm, phase.shape[1], phase.shape[0],
                                    QtGui.QImage.Format_RGB32)
        self._QLabel.setPixmap(QtGui.QPixmap(self._QImage))

        if slm_monitor is not None:
            app = get_qt_app()
            desktop = app.desktop()
            slm_screen = desktop.screen(slm_monitor)
            assert isinstance(slm_monitor, int)
            assert desktop.screenCount() > slm_monitor >= 0
            self.move(slm_screen.x(), slm_screen.y())
Exemple #5
0
    def __init__(self,
                 spectrometer,
                 ui_file=os.path.join(os.path.dirname(__file__),
                                      'spectrometer_view.ui'),
                 parent=None):
        assert isinstance(spectrometer, Spectrometer) or isinstance(spectrometer, Spectrometers),\
            "instrument must be a Spectrometer or an instance of Spectrometers"
        super(SpectrometerDisplayUI, self).__init__()
        uic.loadUi(ui_file, self)
        if isinstance(spectrometer,
                      Spectrometers) and spectrometer.num_spectrometers == 1:
            spectrometer = spectrometer.spectrometers[0]
        if isinstance(spectrometer, Spectrometer):
            spectrometer.num_spectrometers = 1
        self.spectrometer = spectrometer
        print(self.spectrometer)

        pg.setConfigOption('background', 'w')
        pg.setConfigOption('foreground', 'k')
        self.plotbox = QtWidgets.QGroupBox()
        self.plotbox.setLayout(QtWidgets.QGridLayout())
        self.plotlayout = self.plotbox.layout()
        self.plots = []

        for spectrometer_nom in range(self.spectrometer.num_spectrometers):
            self.plots.append(
                pg.PlotWidget(labels={'bottom': 'Wavelength (nm)'}))
            self.plotlayout.addWidget(self.plots[spectrometer_nom])

        self.figure_widget = self.replace_widget(self.display_layout,
                                                 self.figure_widget,
                                                 self.plotbox)
        self.take_spectrum_button.clicked.connect(self.button_pressed)
        self.live_button.clicked.connect(self.button_pressed)
        self.save_button.clicked.connect(self.button_pressed)
        self.threshold.setValidator(QtGui.QDoubleValidator())
        self.threshold.textChanged.connect(self.check_state)
        self._display_thread = DisplayThread(self)
        self._display_thread.spectrum_ready.connect(self.update_display)
        self._display_thread.spectra_ready.connect(self.update_display)

        self.period = 0.2
        self.filename_lineEdit.textChanged.connect(self.filename_changed_ui)

        register_for_property_changes(self.spectrometer, 'filename',
                                      self.filename_changed)
Exemple #6
0
    def __init__(self, scale=(1, 1), offset=(0, 0)):
        super(DisplayWidgetRoiScale, self).__init__()

        self._pxl_scale = scale
        self._pxl_offset = offset

        self.LineDisplay = self.ui.roiPlot
        self.LineDisplay.showGrid(x=True, y=True)
        self.ui.splitter.setHandleWidth(10)
        self.getHistogramWidget().gradient.restoreState(
            list(Gradients.values())[1])
        self.imageItem.setTransform(QtGui.QTransform())
        self.LineDisplay.show()

        self.plot = ()
        for ii in range(self._max_num_line_plots):
            self.plot += (self.LineDisplay.plot(
                pen=pyqtgraph.intColor(ii, self._max_num_line_plots)), )

        self.toggle_displays()

        self.checkbox_autorange = QtWidgets.QCheckBox('Autorange')
        self.tools.gridLayout.addWidget(self.checkbox_autorange, 0, 3, 1, 1)