Exemplo n.º 1
0
    def __init__(self, parameters, parent):
        QtGui.QDialog.__init__(self, parent)
        halModule.HalModule.__init__(self)

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

        # General.
        self.offset_file = 0
        self.parameters = parameters
        self.jumpsize = 0.0
        self.tcp_message = None

        # Qt timer for checking focus lock
        self.focus_check_timer = QtCore.QTimer()
        self.focus_check_timer.setSingleShot(True)
        self.focus_check_timer.timeout.connect(self.tcpPollFocusStatus)
        self.num_focus_checks = 0
        self.accum_focus_checks = 0

        # Focus lock specific parameters.
        flock_params = self.parameters.get("focuslock")
        flock_params.add("qpd_mode", params.ParameterRangeInt("Current mode",
                                                              "qpd_mode",
                                                              0, 0, 6,
                                                              is_mutable = False,
                                                              is_saved = False))
        
        flock_params.add("cal_frames_to_pause", params.ParameterRangeInt("Frames to pause between steps (z-calibration)",
                                                                         "cal_frames_to_pause", 2, 1, 100))        
        flock_params.add("cal_deadtime", params.ParameterRangeInt("Frames before to pause at start (z-calibration)",
                                                                  "cal_deadtime", 20, 1, 100))
        flock_params.add("cal_range", params.ParameterRangeFloat("Distance +- z to move in nanometers (z-calibration)",
                                                                 "cal_range", 600, 100, 5000))
        flock_params.add("cal_step_size", params.ParameterRangeFloat("Step size in z in nanometers (z-calibration)",
                                                                     "cal_step_size", 10, 1, 100))
        
        flock_params.add("olock_bracket_step", params.ParameterRangeFloat("Distance +- z in nanometers (optimal lock)",
                                                                          "olock_bracket_step", 1000.0, 10.0, 10000.0))
        flock_params.add("olock_quality_threshold", params.ParameterRangeFloat("Minimum 'quality' signal (optimal lock)",
                                                                       "olock_quality_threshold", 0.0, 0.0, 1000.0))        
        flock_params.add("olock_scan_step", params.ParameterRangeFloat("Step size in z in nanometers (optimal lock)",
                                                                       "olock_scan_step", 100.0, 10.0, 1000.0))
        flock_params.add("olock_scan_hold", params.ParameterRangeInt("Frames to pause between steps (optimal lock)",
                                                                     "olock_scan_hold", 10, 1, 100))

        flock_params.add("zscan_focus_lock", params.ParameterSetBoolean("Lock focus between steps (z-scan)",
                                                                        "zscan_focus_lock", False))        
        flock_params.add("zscan_frames_to_pause", params.ParameterRangeInt("Frames to pause between steps (z-scan)",
                                                                           "zscan_frames_to_pause", 100, 1, 100000))
        flock_params.add("zscan_start", params.ParameterRangeFloat("Piezo starting position in micros (z-scan)",
                                                                   "zscan_start", 50.0, 0.0, 1000.0))
        flock_params.add("zscan_step", params.ParameterRangeFloat("Piezo step size in microns (z-scan)",
                                                                   "zscan_step", 0.1, 0.0, 100.0))
        flock_params.add("zscan_stop", params.ParameterRangeFloat("Piezo stopping position (z-scan)",
                                                                  "zscan_stop", 51.0, 0.0, 1000.0))
Exemplo n.º 2
0
    def __init__(self, hardware, parameters, parent=None):
        miscControl.MiscControl.__init__(self, parameters, parent)

        self.em_filter_pos = 0
        self.em_filter_wheel = prior.Prior(port=hardware.get("port"),
                                           baudrate=hardware.get("baud_rate"))

        # Add parameters.
        misc_params = parameters.addSubSection("misc")
        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 (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, "Quad"],
                           [self.ui.emFilter2Button, "750"],
                           [self.ui.emFilter3Button, "647"],
                           [self.ui.emFilter4Button, "560"],
                           [self.ui.emFilter5Button, "488"],
                           [self.ui.emFilter6Button, "Empty"]]
        for [afilter, name] in self.em_filters:
            afilter.clicked.connect(self.handleEmFilter)
            afilter.setText(name)
        if self.em_filter_wheel:
            self.em_filters[self.em_filter_wheel.getFilter() - 1][0].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):
        cameraControl.HWCameraControl.__init__(self, hardware, parameters, parent)

        if hardware:
            self.camera = hcam.HamamatsuCameraMR(hardware.get("camera_id", 0))
        else:
            self.camera = hcam.HamamatsuCameraMR(0)

        # Add Hamatsu Flash4 specific camera parameters.
        cam_params = parameters.get("camera1")

        # FIXME: These should all be obtained by querying the camere.
        cam_params.add("max_intensity", params.ParameterInt("",
                                                            "max_intensity",
                                                            4096,
                                                            is_mutable = False,
                                                            is_saved = False))

        cam_params.add("x_start", params.ParameterRangeInt("AOI X start",
                                                           "x_start",
                                                           768, 0, 2046))
        cam_params.add("x_end", params.ParameterRangeInt("AOI X end",
                                                         "x_end",
                                                         1279, 1, 2047))
        cam_params.add("y_start", params.ParameterRangeInt("AOI Y start",
                                                           "y_start",
                                                           768, 0, 2046))
        cam_params.add("y_end", params.ParameterRangeInt("AOI Y end",
                                                         "y_end",
                                                         1279, 1, 2047))

        cam_params.add("x_bin", params.ParameterRangeInt("Binning in X",
                                                         "x_bin",
                                                         1, 1, 4))
        cam_params.add("y_bin", params.ParameterRangeInt("Binning in Y",
                                                         "y_bin",
                                                         1, 1, 4))

        cam_params.add("exposure_time", params.ParameterRangeFloat("Exposure time (seconds)", 
                                                                   "exposure_time", 
                                                                   0.01, 0.0, 60.0))

        cam_params.add("defect_correct_mode", params.ParameterSetInt("Defect correction mode",
                                                                     "defect_correct_mode",
                                                                     1, [0, 1]))

        cam_params.add("external_trigger", params.ParameterSetInt("Use external trigger",
                                                                  "external_trigger",
                                                                  0, [0, 1]))
Exemplo n.º 4
0
    def __init__(self, hardware, parameters, parent=None):
        cameraControl.CameraControl.__init__(self, hardware, parameters,
                                             parent)

        self.fake_frame = 0
        self.fake_frame_size = [0, 0]
        self.parameters = parameters.get("camera1")
        self.sleep_time = 100

        # Add None Camera specific parameters.
        self.parameters.add(
            "max_intensity",
            params.ParameterInt("",
                                "max_intensity",
                                10000,
                                is_mutable=False,
                                is_saved=False))
        self.parameters.add(
            "x_start",
            params.ParameterRangeInt("X start pixel", "x_start", 1, 1, 512))
        self.parameters.add(
            "x_end",
            params.ParameterRangeInt("X end pixel", "x_end", 512, 1, 512))
        self.parameters.add(
            "y_start",
            params.ParameterRangeInt("Y start pixel", "y_start", 1, 1, 512))
        self.parameters.add(
            "y_end",
            params.ParameterRangeInt("Y end pixel", "y_end", 512, 1, 512))
        self.parameters.add(
            "x_bin", params.ParameterRangeInt("Binning in X", "x_bin", 1, 1,
                                              16))
        self.parameters.add(
            "y_bin", params.ParameterRangeInt("Binning in Y", "y_bin", 1, 1,
                                              16))
        self.parameters.add(
            "exposure_time",
            params.ParameterRangeFloat("Exposure time (seconds)",
                                       "exposure_time", 0.01, 0.01, 10.0))

        if hardware:
            self.roll = hardware.get("roll")
        else:
            self.roll = 0

        self.initCamera()
Exemplo n.º 5
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.º 6
0
    def __init__(self, hardware, parameters, parent):
        QtGui.QDialog.__init__(self, parent)
        halModule.HalModule.__init__(self)
        self.channels = False
        self.exp_channels = False
        self.linear_channels = False
        self.file_channels = False
        self.parameters = parameters
        self.use_was_checked = False
        self.which_checked = []

        # Add progression parameters.
        self.parameters.add(
            "progressions.use_progressions",
            params.ParameterSetBoolean("",
                                       "use_progressions",
                                       False,
                                       is_mutable=False))
        self.parameters.add(
            "progressions.pstart_value",
            params.ParameterRangeFloat("",
                                       "pstart_value",
                                       0.1,
                                       0.0,
                                       1.0,
                                       is_mutable=False,
                                       is_saved=False))
        self.parameters.add(
            "progressions.pinc_value",
            params.ParameterRangeFloat("",
                                       "pinc_value",
                                       0.01,
                                       0.0,
                                       1.0,
                                       is_mutable=False,
                                       is_saved=False))
        self.parameters.add(
            "progressions.pfile_name",
            params.ParameterStringFilename("Progression file name",
                                           "pfile_name", "", False))
        self.parameters.add(
            "progressions.pframe_value",
            params.ParameterRangeInt("",
                                     "pframe_value",
                                     1000,
                                     100,
                                     100000,
                                     is_mutable=False,
                                     is_saved=False))

        if parent:
            self.have_parent = 1
        else:
            self.have_parent = 0

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

        # 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)
        self.ui.progressionsCheckBox.stateChanged.connect(self.handleProgCheck)
        self.ui.loadFileButton.clicked.connect(self.newPowerFile)

        # set modeless
        self.setModal(False)
Exemplo n.º 7
0
    def __init__(self, parameters, parent=None):
        QtGui.QDialog.__init__(self, parent)
        halModule.HalModule.__init__(self)

        self.counters = [False, False]
        self.filming = 0
        self.filenames = [False, False]
        self.frame_interval = parameters.get("spotcounter.interval", 1)
        self.image_graphs = [False, False]
        self.parameters = parameters
        self.spot_counter = False
        self.spot_graphs = [False, False]

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

        # Add spot counter specific parameters.
        #
        # FIXME: We should just use a pixel length scale bar and drop the nm stuff, or
        #        we should get the nm_per_pixel from the mosaic settings and the current
        #        objective.
        #
        spotc_params = self.parameters.addSubSection("spotcounter")
        spotc_params.add(
            "cell_size",
            params.ParameterRangeInt("Cell size for background subtraction",
                                     "cell_size",
                                     32,
                                     8,
                                     128,
                                     is_mutable=False,
                                     is_saved=False))

        spotc_params.add(
            "max_spots",
            params.ParameterRangeInt(
                "Maximum counts for the spotcounter graph",
                "max_spots",
                500,
                0,
                1000,
                is_mutable=False,
                is_saved=False))

        spotc_params.add(
            "min_spots",
            params.ParameterRangeInt(
                "Minimum counts for the spotcounter graph",
                "min_spots",
                0,
                0,
                1000,
                is_mutable=False,
                is_saved=False))

        spotc_params.add(
            "nm_per_pixel",
            params.ParameterRangeFloat("Camera pixel size in nanometers",
                                       "nm_per_pixel", 160, 10, 1000))

        spotc_params.add(
            "scale_bar_len",
            params.ParameterRangeFloat("Scale bar length in nm",
                                       "scale_bar_len", 1000, 100, 10000))

        spotc_params.add(
            "threshold",
            params.ParameterRangeInt(
                "Spot detection threshold (camera counts)", "threshold", 250,
                1, 10000))

        # UI setup.
        self.ui.setupUi(self)
        self.setWindowTitle(parameters.get("setup_name") + " Spot Counter")
        self.setWindowIcon(qtAppIcon.QAppIcon())

        # Setup Counter objects.
        if (self.number_cameras == 1):
            self.counters = [
                Counter(self.ui.countsLabel1, self.ui.countsLabel2)
            ]
        else:
            self.counters = [
                Counter(self.ui.countsLabel1, self.ui.countsLabel2),
                Counter(self.ui.countsLabel3, self.ui.countsLabel4)
            ]

        # Setup spot counter.
        self.spot_counter = qtSpotCounter.QObjectCounter(
            parameters.get("spotcounter"))
        self.spot_counter.imageProcessed.connect(self.updateCounts)

        # Setup spot counts graph(s).
        if (self.number_cameras == 1):
            parents = [self.ui.graphFrame]
        else:
            parents = [self.ui.graphFrame, self.ui.graphFrame2]

        for i in range(self.number_cameras):
            graph_w = parents[i].width() - 4
            graph_h = parents[i].height() - 4
            self.spot_graphs[i] = QSpotGraph(
                graph_w,
                graph_h,
                parameters.get("spotcounter.min_spots"),
                parameters.get("spotcounter.max_spots"),
                parent=parents[i])
            self.spot_graphs[i].setGeometry(2, 2, graph_w, graph_h)
            self.spot_graphs[i].show()

        # Setup STORM image(s).
        if (self.number_cameras == 1):
            parents = [self.ui.imageFrame]
        else:
            parents = [self.ui.imageFrame, self.ui.imageFrame2]

        for i in range(self.number_cameras):
            image_w = parents[i].width() - 4
            image_h = parents[i].height() - 4

            self.image_graphs[i] = QImageGraph(image_w,
                                               image_h,
                                               parent=parents[i])
            self.image_graphs[i].setGeometry(2, 2, image_w, image_h)
            self.image_graphs[i].blank()
            self.image_graphs[i].show()

        # 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)
        self.ui.maxSpinBox.valueChanged.connect(self.handleMaxChange)
        self.ui.minSpinBox.valueChanged.connect(self.handleMinChange)

        # Set modeless.
        self.setModal(False)
Exemplo n.º 8
0
    def __init__(self, parameters, hardware_config):

        # Create serial control thread
        try:
            self.serial_thread = W1SerialThread(
                hardware_config.get("com_port"),
                baudrate=115200,
                timeout=0.01,
                verbose=hardware_config.get("verbose", False))
        except:
            print "Could not create serial port for spinning disk. Is it connected properly?"
            raise W1Exception("W1 Spinning Disk Initialization Error \n" +
                              " Could not properly initialize com_port: " +
                              str(hardware_config.get("com_port")))

        # Connect error signal from serial control thread
        self.serial_thread.error.connect(self.handleSerialThreadError)

        # Start thread
        self.serial_thread.start(QtCore.QThread.NormalPriority)

        # Create a local copy of the current W1 configuration
        self.params = params.StormXMLObject(
            [])  # Create empty parameters object

        # Record internal verbosity (debug purposes only)
        self.verbose = hardware_config.get("verbose")

        # Create dictionaries for the configuration of the filter wheels and two dichroic mirror sets
        self.filter_wheel_1_config = {}
        values = hardware_config.get("filter_wheel_1")
        filter_names = values.split(",")
        for pos, filter_name in enumerate(filter_names):
            self.filter_wheel_1_config[filter_name] = pos + 1

        self.filter_wheel_2_config = {}
        values = hardware_config.get("filter_wheel_2")
        filter_names = values.split(",")
        for pos, filter_name in enumerate(filter_names):
            self.filter_wheel_2_config[filter_name] = pos + 1

        self.dichroic_mirror_config = {}
        values = hardware_config.get("dichroic_mirror")
        dichroic_names = values.split(",")
        for pos, dichroic_name in enumerate(dichroic_names):
            self.dichroic_mirror_config[dichroic_name] = pos + 1

        self.camera_dichroic_config = {}
        values = hardware_config.get("camera_dichroic")
        camera_dichroic_names = values.split(",")
        for pos, camera_dichroic in enumerate(camera_dichroic_names):
            self.camera_dichroic_config[camera_dichroic] = pos + 1

        # Define error codes
        self.error_codes = {
            "30005": "Command name error",
            "30006": "Command argument number error",
            "30007": "Command argument value error",
            "30141": "Command argument value error",
            "30012": "Interlock alarm is on",
            "30133": "Interlock alarm is on",
            "30014": "Electricity alarm is on",
            "30015": "Shutter alarm is on",
            "30016": "Actuator alarm is on",
            "30017": "Disk alarm is on",
            "30018": "Data error alarm is on",
            "30019": "Other alarm is on",
            "30021": "Designated system is not defined",
            "30022": "Designated system does not exist",
            "30023": "Designated system is not detected",
            "30031": "Waiting for initialization to complete",
            "30032": "Under maintenance mode",
            "30201": "External SYNC signal is under use",
            "30204": "Disk rotation stopped",
            "30301": "Shutter error",
            "30302": "Shutter unopenable error",
            "1": "Unknown serial communication error"
        }

        # Initialize spinning disk parameters
        # Add spinning disk sub section
        sd_params = parameters.addSubSection("spinning_disk")

        # Add basic parameters
        sd_params.add(
            "bright_field_bypass",
            params.ParameterSetBoolean(
                "Bypass spinning disk for brightfield mode?",
                "bright_field_bypass", False))

        sd_params.add(
            "spin_disk",
            params.ParameterSetBoolean("Spin the disk?", "spin_disk", True))

        # Disk properties
        sd_params.add(
            "disk",
            params.ParameterSetString(
                "Disk pinhole size", "disk", "50-micron pinholes",
                ["50-micron pinholes", "25-micron pinholes"]))

        max_speed = self.getMaxSpeed()
        sd_params.add(
            "disk_speed",
            params.ParameterRangeInt("Disk speed (RPM)", "disk_speed",
                                     max_speed, 1, max_speed))

        # Dichroic mirror position
        values = sorted(self.dichroic_mirror_config.keys())
        sd_params.add(
            "dichroic_mirror",
            params.ParameterSetString("Dichroic mirror position",
                                      "dichroic_mirror", values[0], values))

        # Filter wheel positions
        values = sorted(self.filter_wheel_1_config.keys())
        sd_params.add(
            "filter_wheel_pos1",
            params.ParameterSetString("Camera 1 Filter Wheel Position (1-10)",
                                      "filter_wheel_pos1", values[0], values))

        values = sorted(self.filter_wheel_2_config.keys())
        sd_params.add(
            "filter_wheel_pos2",
            params.ParameterSetString("Camera 2 Filter Wheel Position (1-10)",
                                      "filter_wheel_pos2", values[0], values))

        # Camera dichroic positions
        values = sorted(self.camera_dichroic_config.keys())
        sd_params.add(
            "camera_dichroic_mirror",
            params.ParameterSetString("Camera dichroic mirror position (1-3)",
                                      "camera_dichroic_mirror", values[0],
                                      values))

        # Aperature settings
        sd_params.add(
            "aperture",
            params.ParameterRangeInt("Aperture value (1-10; small to large)",
                                     "aperture", 10, 1, 10))
Exemplo n.º 9
0
    def __init__(self, hardware, parameters, parent = None):
        cameraControl.HWCameraControl.__init__(self, hardware, parameters, parent)

        andor.loadSDK3DLL("C:/Program Files/Andor SOLIS/")
        if hardware:
            self.camera = andor.SDK3Camera(hardware.get("camera_id", 0))
        else:
            self.camera = andor.SDK3Camera()
        self.camera.setProperty("CycleMode", "enum", "Continuous")

        self.parameters = params.StormXMLObject([]) # Create empty parameters object

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

        max_intensity = 2**16
        cam_params.add("max_intensity", params.ParameterInt("",
                                                            "max_intensity",
                                                            max_intensity,
                                                            is_mutable = False,
                                                            is_saved = False))

##        [x_size, y_size] = [2048, 2048]
##        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] = [4,4]
##        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))

        cam_params.add("AOIBinning", params.ParameterSetString("AOI Binning",
                                                               "AOIBinning",
                                                               "1x1",
                                                               ["1x1", "2x2", "3x3", "4x4", "8x8"]))
        cam_params.add("AOIWidth", params.ParameterRangeInt("AOI Width",
                                                            "AOIWidth",
                                                            2048,
                                                            128, 2048))
        cam_params.add("AOIHeight", params.ParameterRangeInt("AOI Height",
                                                             "AOIHeight",
                                                             2048,
                                                             128, 2048))

        cam_params.add("AOILeft", params.ParameterRangeInt("AOI Left",
                                                           "AOILeft",
                                                           1,
                                                           1, 1028))

        cam_params.add("AOITop", params.ParameterRangeInt("AOI Top",
                                                          "AOITop",
                                                          1,
                                                          1, 1028))

        cam_params.add("FanSpeed", params.ParameterSetString("Fan Speed",
                                                              "FanSpeed",
                                                              "On",
                                                              ["On", "Off"]))

        cam_params.add("SensorCooling", params.ParameterSetBoolean("Sensor cooling",
                                                                   "SensorCooling",
                                                                   True))

        cam_params.add("SimplePreAmpGainControl", params.ParameterSetString("Pre-amp gain control",
                                                                             "SimplePreAmpGainControl",
                                                                             "16-bit (low noise & high well capacity)",
                                                                             ["16-bit (low noise & high well capacity)", 
                                                                              "Something else.."]))

        cam_params.add("ExposureTime", params.ParameterRangeFloat("Exposure time (seconds)", 
                                                                  "ExposureTime", 
                                                                  0.1, 0.0, 10.0))
Exemplo n.º 10
0
    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.º 11
0
 def getSpeed(self):
     # FIXME: Need to figure out units for this..
     return params.ParameterRangeInt("Stage speed in pulses per second",
                                     "stage_speed",
                                     2564800, 2464800, 2564800)
Exemplo n.º 12
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"))
Exemplo n.º 13
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)