Exemplo n.º 1
0
    def __init__(self, hardware, parameters, parent = None):
        cameraControl.HWCameraControl.__init__(self, hardware, parameters, parent)

        if hardware and hardware.has("pci_card"):
            self.initCamera(hardware.get("pci_card"))
        else:
            self.initCamera()

        # Add Andor EMCCD specific parameters.
        #
        cam_params = parameters.get("camera1")

        # FIXME: Need to get this value from the camera.
        max_intensity = self.camera.getMaxIntensity()
        cam_params.add("max_intensity", params.ParameterInt("",
                                                            "max_intensity",
                                                            max_intensity,
                                                            is_mutable = False,
                                                            is_saved = False))

        # FIXME: Need to update based on the current EM gain mode.
        [gain_low, gain_high] = self.camera.getEMGainRange()
        cam_params.add("emccd_gain", params.ParameterRangeInt("EMCCD Gain",
                                                              "emccd_gain",
                                                              gain_low, gain_low, gain_high))

        [x_size, y_size] = self.camera.getCameraSize()
        cam_params.add("x_start", params.ParameterRangeInt("AOI X start",
                                                           "x_start",
                                                           1, 1, x_size))
        cam_params.add("x_end", params.ParameterRangeInt("AOI X end",
                                                         "x_end",
                                                         x_size, 1, x_size))
        cam_params.add("y_start", params.ParameterRangeInt("AOI Y start",
                                                           "y_start",
                                                           1, 1, y_size))
        cam_params.add("y_end", params.ParameterRangeInt("AOI Y end",
                                                         "y_end",
                                                         y_size, 1, y_size))

        [x_max_bin, y_max_bin] = self.camera.getMaxBinning()
        cam_params.add("x_bin", params.ParameterRangeInt("Binning in X",
                                                         "x_bin",
                                                         1, 1, x_max_bin))
        cam_params.add("y_bin", params.ParameterRangeInt("Binning in Y",
                                                         "y_bin",
                                                         1, 1, y_max_bin))

        # FIXME: Need to check if camera supports frame transfer mode.
        cam_params.add("frame_transfer_mode", params.ParameterSetInt("Frame transfer mode (0 = off, 1 = on)",
                                                                     "frame_transfer_mode",
                                                                     1, [0, 1]))

        [mint, maxt] = self.camera.getTemperatureRange()
        cam_params.add("temperature", params.ParameterRangeInt("Temperature",
                                                               "temperature",
                                                               -70, mint, maxt))

        preamp_gains = self.camera.getPreampGains()
        cam_params.add("preampgain", params.ParameterSetFloat("Pre-amplifier gain",
                                                              "preampgain",
                                                              preamp_gains[0], preamp_gains))

        # FIXME: Need to update based on the AD channel.
        hs_speeds = self.camera.getHSSpeeds()[0]
        cam_params.add("hsspeed", params.ParameterSetFloat("Horizontal shift speed",
                                                           "hsspeed",
                                                           hs_speeds[0], hs_speeds))

        vs_speeds = self.camera.getVSSpeeds()
        cam_params.add("vsspeed", params.ParameterSetFloat("Vertical shift speed",
                                                           "vsspeed",
                                                           vs_speeds[-1], vs_speeds))

        max_exposure = self.camera.getMaxExposure()
        cam_params.add("exposure_time", params.ParameterRangeFloat("Exposure time (seconds)", 
                                                                   "exposure_time", 
                                                                   0.0, 0.0, max_exposure))

        cam_params.add("kinetic_cycle_time", params.ParameterRangeFloat("Kinetic cycle time (seconds)",
                                                                        "kinetic_cycle_time",
                                                                        0.0, 0.0, 100.0))

        ad_channels = range(self.camera.getNumberADChannels())
        cam_params.add("adchannel", params.ParameterSetInt("Analog to digital converter channel",
                                                           "adchannel",
                                                           0, ad_channels))

        n_modes = range(self.camera.getNumberEMGainModes())
        cam_params.add("emgainmode", params.ParameterSetInt("EMCCD gain mode",
                                                            "emgainmode",
                                                            0, n_modes))
        cam_params.add("baselineclamp", params.ParameterSetBoolean("Baseline clamp",
                                                                   "baselineclamp",
                                                                   True))

        # FIXME: Need to get amplitudes from the camera.
        cam_params.add("vsamplitude", params.ParameterSetInt("Vertical shift amplitude",
                                                             "vsamplitude",
                                                             0, [0, 1, 2]))
        cam_params.add("off_during_filming", params.ParameterSetBoolean("Fan off during filming",
                                                                        "off_during_filming",
                                                                        False))
        cam_params.add("low_during_filming", params.ParameterSetBoolean("Fan low during filming",
                                                                        "low_during_filming",
                                                                        False))
        cam_params.add("external_trigger", params.ParameterSetBoolean("Use an external camera trigger",
                                                                      "external_trigger",
                                                                      False))
        cam_params.add("head_model", params.ParameterString("Camera head model", "head_model", "",
                                                            is_mutable = False))

        cam_params.add("isolated_cropmode", params.ParameterSetBoolean("Isolated crop mode",
                                                                       "isolated_cropmode",
                                                                       False))
Exemplo n.º 2
0
    def __init__(self, hardware, parameters, parent=None):
        QtGui.QDialog.__init__(self, parent)
        halModule.HalModule.__init__(self)

        self.channels = []
        self.hardware_modules = {}
        self.fp = False
        self.parameters = parameters
        self.running_shutters = False
        self.spacing = 3

        if parent:
            self.have_parent = True
        else:
            self.have_parent = False

        # UI setup.
        self.ui = illuminationUi.Ui_Dialog()
        self.ui.setupUi(self)
        self.setWindowTitle(
            parameters.get("setup_name") + " Illumination Control")
        self.setWindowIcon(qtAppIcon.QAppIcon())

        # Parse XML that describes the hardware.
        hardware = xmlParser.parseHardwareXML("illumination/" +
                                              hardware.get("settings_xml"))

        # Add illumination specific settings.
        #
        # FIXME: These used to be customizable.
        #
        default_power = []
        on_off_state = []
        for i in range(len(hardware.channels)):
            default_power.append(1.0)
            on_off_state.append(False)
        self.parameters.set("illumination.default_power", default_power)
        self.parameters.set("illumination.on_off_state", on_off_state)

        # Check for button settings, use defaults if they do not exist.
        #
        buttons = []
        for i in range(len(hardware.channels)):
            buttons.append([["Max", 1.0], ["Low", 0.1]])
        power_buttons = params.ParameterCustom("Illumination power buttons",
                                               "power_buttons",
                                               buttons,
                                               1,
                                               is_mutable=True,
                                               is_saved=True)
        power_buttons.editor = buttonEditor.ParametersTablePowerButtonEditor
        self.parameters.add("illumination.power_buttons", power_buttons)

        # This parameter is used to be able to tell when the shutters file
        # has been changed for a given set of parameters.
        self.parameters.add(
            "illumination.last_shutters",
            params.ParameterString("Last shutters file name",
                                   "last_shutters",
                                   "",
                                   is_mutable=False,
                                   is_saved=False))

        # Default camera parameters.
        self.parameters.add(
            "illumination.shutters",
            params.ParameterStringFilename("Shutters file name", "shutters",
                                           "shutters_default.xml", False))

        # Hardware modules setup.
        for module in hardware.modules:
            m_name = module.module_name
            a_module = __import__(m_name, globals(), locals(), [m_name], -1)
            a_class = getattr(a_module, module.class_name)
            a_instance = a_class(module.parameters, self)
            if a_instance.isBuffered():
                a_instance.start(QtCore.QThread.NormalPriority)
            self.hardware_modules[module.name] = a_instance

        # Illumination channels setup.
        x = 7
        names = []
        for i, channel in enumerate(hardware.channels):
            a_instance = illuminationChannel.Channel(
                i, channel, parameters.get("illumination"),
                self.hardware_modules, self.ui.powerControlBox)
            x += a_instance.setPosition(x, 14) + self.spacing
            self.channels.append(a_instance)
            names.append(a_instance.getName())

        power_buttons.channel_names = names

        # Connect signals.
        if self.have_parent:
            self.ui.okButton.setText("Close")
            self.ui.okButton.clicked.connect(self.handleOk)
        else:
            self.ui.okButton.setText("Quit")
            self.ui.okButton.clicked.connect(self.handleQuit)
Exemplo n.º 3
0
    def __init__(self, hardware, parameters, parent=None):
        miscControl.MiscControl.__init__(self, parameters, parent)

        self.em_filter_pos = 0
        self.em_filter_wheel = filterWheel.QPriorFilterWheel()
        self.filter_wheel = filterWheel.QPriorFilterWheel()

        # Add parameters.
        misc_params = parameters.addSubSection("misc")
        misc_params.add(
            "filter_names",
            params.ParameterString("Filter names", "filter_names",
                                   "1,2,3,4,5,6"))
        misc_params.add(
            "filter_position",
            params.ParameterRangeInt("Filter position", "filter_position", 0,
                                     0, 5))
        misc_params.add(
            "em_checked",
            params.ParameterSetBoolean(
                "Change emission filter position during filming", "em_checked",
                False))
        misc_params.add(
            "em_filter",
            params.ParameterRangeInt("Emission filter position", "em_filter",
                                     0, 0, 5))
        misc_params.add(
            "em_period",
            params.ParameterInt("Emission filter update period in frames",
                                "em_period", 60))

        # UI setup
        self.ui = miscControlsUi.Ui_Dialog()
        self.ui.setupUi(self)
        self.setWindowTitle(parameters.get("setup_name") + " Misc Control")

        # connect signals
        if self.have_parent:
            self.ui.okButton.setText("Close")
            self.ui.okButton.clicked.connect(self.handleOk)
        else:
            self.ui.okButton.setText("Quit")
            self.ui.okButton.clicked.connect(self.handleQuit)

        # setup (turret) filter wheel
        self.filters = [
            self.ui.filter1Button, self.ui.filter2Button,
            self.ui.filter3Button, self.ui.filter4Button,
            self.ui.filter5Button, self.ui.filter6Button
        ]
        for afilter in self.filters:
            afilter.clicked.connect(self.handleFilter)
        if self.filter_wheel:
            self.filters[self.filter_wheel.getPosition(1) - 1].click()

        # setup (emission) filter wheel
        self.ui.emFilter6Button.hide()
        self.ui.emFilter7Button.hide()
        self.ui.emFilter8Button.hide()
        self.ui.emFilter9Button.hide()
        self.ui.emFilter10Button.hide()
        self.em_filters = [
            self.ui.emFilter1Button, self.ui.emFilter2Button,
            self.ui.emFilter3Button, self.ui.emFilter4Button,
            self.ui.emFilter5Button, self.ui.emFilter6Button,
            self.ui.emFilter7Button, self.ui.emFilter8Button,
            self.ui.emFilter9Button, self.ui.emFilter10Button
        ]
        for afilter in self.em_filters:
            afilter.clicked.connect(self.handleEmFilter)
        if self.em_filter_wheel:
            self.em_filters[self.filter_wheel.getPosition(2) - 1].click()

        self.ui.emCheckBox.setChecked(parameters.get("misc.em_checked"))
        self.ui.emSpinBox.setValue(parameters.get("misc.em_period"))
    def __init__(self, hardware, parameters, parent=None):
        # Jfocal specific focus lock parameters
        lock_params = parameters.addSubSection("focuslock")

        lock_params.add(
            "qpd_zcenter",
            params.ParameterRangeFloat("Piezo center position in microns",
                                       "qpd_zcenter", 100.0, 0.0, 200.0))

        lock_params.add(
            "qpd_scale",
            params.ParameterRangeFloat("Offset to nm calibration value",
                                       "qpd_scale", -1000.0, -10000, 10000.0))
        lock_params.add("qpd_sum_min", 50.0)
        lock_params.add("qpd_sum_max", 100000.0)
        lock_params.add(
            "is_locked_buffer_length",
            params.ParameterRangeInt("Length of in focus buffer",
                                     "is_locked_buffer_length", 3, 1, 100))
        lock_params.add(
            "is_locked_offset_thresh",
            params.ParameterRangeFloat(
                "Offset distance still considered in focus",
                "is_locked_offset_thresh", 1, 0.001, 1000))

        lock_params.add(
            "focus_rate",
            params.ParameterRangeFloat("Proportionality constant for focus",
                                       "focus_rate", 0.1, -1000, 1000))

        lock_params.add(
            "ir_power", params.ParameterInt("",
                                            "ir_power",
                                            6,
                                            is_mutable=False))

        # Add parameters for hardware timed z offsets
        lock_params.add(
            "z_offsets",
            params.ParameterString(
                "Comma separated list of offset positions per frame",
                "z_offsets", ""))

        # Create camera
        cam = uc480Cam.CameraQPD(camera_id=1,
                                 x_width=900,
                                 y_width=50,
                                 sigma=4.0,
                                 offset_file="cam_offsets_jfocal_1.txt",
                                 background=50000)
        stage = MCLVZC.MCLVZControl("PCIe-6351",
                                    0,
                                    scale=10.0 / 200.0,
                                    trigger_source="PFI0")

        lock_fn = lambda (x): lock_params.get("focus_rate") * x
        control_thread = stageOffsetControl.StageCamThread(
            cam, stage, lock_fn, parameters.get("focuslock.qpd_sum_min", 50.0),
            parameters.get("focuslock.qpd_zcenter"),
            parameters.get("focuslock.is_locked_buffer_length", 3),
            parameters.get("focuslock.is_locked_offset_thresh", 0.1))
        ir_laser = LDC210.LDC210PWMNI("PCIe-6351", 0)
        focusLockZ.FocusLockZCam.__init__(self, parameters, control_thread,
                                          ir_laser, parent)
Exemplo n.º 5
0
    def __init__(self, hardware, parameters, parent=None):
        miscControl.MiscControl.__init__(self, parameters, parent)

        self.filter_wheel = filterWheel.QPriorFilterWheel()
        self.move_timer = QtCore.QTimer(self)
        self.move_timer.setInterval(50)
        self.smc100 = SMC100.SMC100(port="COM10")

        # Add parameters
        misc_params = parameters.addSubSection("misc")
        misc_params.add("jog_size", 0.01)
        misc_params.add("epi_position", 17.92)
        misc_params.add("tirf_position", 20.76)

        misc_params.add(
            "filter_names",
            params.ParameterString("Filter names", "filter_names",
                                   "1,2,3,4,5,6"))
        misc_params.add(
            "filter_position",
            params.ParameterRangeInt("Filter position", "filter_position", 0,
                                     0, 5))

        # UI setup
        self.ui = miscControlsUi.Ui_Dialog()
        self.ui.setupUi(self)
        self.setWindowTitle(parameters.get("setup_name") + " Misc Control")

        # connect signals
        if self.have_parent:
            self.ui.okButton.setText("Close")
            self.ui.okButton.clicked.connect(self.handleOk)
        else:
            self.ui.okButton.setText("Quit")
            self.ui.okButton.clicked.connect(self.handleQuit)

        # setup epi/tir stage control
        self.ui.EPIButton.clicked.connect(self.goToEPI)
        self.ui.leftSmallButton.clicked.connect(self.smallLeft)
        self.ui.rightSmallButton.clicked.connect(self.smallRight)
        self.ui.leftLargeButton.clicked.connect(self.largeLeft)
        self.ui.rightLargeButton.clicked.connect(self.largeRight)
        self.ui.TIRFButton.clicked.connect(self.goToTIRF)
        self.ui.tirGoButton.clicked.connect(self.goToX)
        self.move_timer.timeout.connect(self.updatePosition)

        self.position = self.smc100.getPosition()
        self.setPositionText()

        # setup filter wheel
        self.filters = [
            self.ui.filter1Button, self.ui.filter2Button,
            self.ui.filter3Button, self.ui.filter4Button,
            self.ui.filter5Button, self.ui.filter6Button
        ]
        for filter in self.filters:
            filter.clicked.connect(self.handleFilter)
        self.filters[self.filter_wheel.getPosition() - 1].click()

        # Imagine Eyes stuff
        self.ie_accumulate = False
        self.ie_accumulate_count = 0
        self.ie_autosave = False
        self.ie_basename = "img.ch00."
        self.ie_capture = False
        self.ie_directory = "c:\\tif_directory\\"
        self.ie_index = 1
        self.ie_start_x = 0
        self.ie_start_y = 0
        self.ie_stop_x = 0
        self.ie_stop_y = 0
        self.ui.iEyesLabel.setText(self.getIEName())
        self.ui.iEyesLineEdit.setText(self.ie_basename)

        self.ui.iEyesAutoSaveButton.clicked.connect(self.handleAutoSave)
        self.ui.iEyesClearROIButton.clicked.connect(self.handleClearROI)
        self.ui.iEyesLineEdit.textChanged.connect(self.handleLineEdit)
        self.ui.iEyesResetButton.clicked.connect(self.handleReset)
        self.ui.iEyesSaveButton.clicked.connect(self.handleSave)

        self.newParameters(self.parameters)