def __init__(self, parent, dev) :
		HardwareGUIControl.__init__(self, parent, dev)
		
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		################################################
		# Specify the communication port name
		sizer.Add (wx.StaticText(self, label="Communication port"), flag=wx.LEFT, border=5)
		port_name = wx.SpinCtrl (self, value="18")
		port_name.__label__ = "port"
		sizer.Add (port_name, flag=wx.EXPAND, border=5)
		
		################## Select filter ###################
		sizer.Add( wx.StaticText(self, label="\nSelect filter"), flag=wx.LEFT, border=5)
		self.filter_num_ctrl = wx.SpinCtrl (self, min=1, max=6, value="1")
		self.filter_num_ctrl.__label__ = "selected_filter"
		
		def GoToFilter (event) :
			if self.dev.Initialize( self.GetSettings() ) == RETURN_FAIL : return
			self.dev.SetFilter( self.filter_num_ctrl.GetValue() )
		
		self.filter_num_ctrl.Bind(wx.EVT_SPINCTRL, GoToFilter)
		sizer.Add (self.filter_num_ctrl, flag=wx.EXPAND, border=5)
		################################################
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		
		self.CreateSettingsDict()
	
		
	def __init__(self, parent, **kwards) :
		HardwareGUIControl.__init__(self, parent, manager_cls=ManagerNewportMovingStage, **kwards)
		
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		# Specify the communication port name
		sizer.Add (wx.StaticText(self, label="\nCommunication port"), flag=wx.LEFT, border=5)
		port_name = wx.TextCtrl (self, value="COM15")
		port_name.__label__ = "port"
		sizer.Add (port_name, flag=wx.EXPAND, border=5)
		
		# Spacer
		sizer.Add (wx.StaticText(self, label=""), flag=wx.LEFT, border=5)
		
		# Button to start joystick
		bind_joystick_button = MultiStateButton(self, states=[ 
				(self.StartJoystick, "Start joystick"), (self.StopJoystick, "STOP joystick")
			]
		)
		sizer.Add (bind_joystick_button, flag=wx.EXPAND, border=5)
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		
		self.CreateSettingsDict()
    def __init__(self, parent, dev):
        HardwareGUIControl.__init__(self, parent, dev)

        sizer = wx.BoxSizer(wx.VERTICAL)

        ################################################
        # Specify the communication port name
        sizer.Add(wx.StaticText(self, label="Communication port"),
                  flag=wx.LEFT,
                  border=5)
        port_name = wx.SpinCtrl(self, value="18")
        port_name.__label__ = "port"
        sizer.Add(port_name, flag=wx.EXPAND, border=5)

        ################## Select filter ###################
        sizer.Add(wx.StaticText(self, label="\nSelect filter"),
                  flag=wx.LEFT,
                  border=5)
        self.filter_num_ctrl = wx.SpinCtrl(self, min=1, max=6, value="1")
        self.filter_num_ctrl.__label__ = "selected_filter"

        def GoToFilter(event):
            if self.dev.Initialize(self.GetSettings()) == RETURN_FAIL: return
            self.dev.SetFilter(self.filter_num_ctrl.GetValue())

        self.filter_num_ctrl.Bind(wx.EVT_SPINCTRL, GoToFilter)
        sizer.Add(self.filter_num_ctrl, flag=wx.EXPAND, border=5)
        ################################################

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################

        self.CreateSettingsDict()
Exemplo n.º 4
0
    def __init__(self, parent, **kwards):
        HardwareGUIControl.__init__(self,
                                    parent,
                                    manager_cls=ManagerNewportMovingStage,
                                    **kwards)

        sizer = wx.BoxSizer(wx.VERTICAL)

        # Specify the communication port name
        sizer.Add(wx.StaticText(self, label="\nCommunication port"),
                  flag=wx.LEFT,
                  border=5)
        port_name = wx.TextCtrl(self, value="COM15")
        port_name.__label__ = "port"
        sizer.Add(port_name, flag=wx.EXPAND, border=5)

        # Spacer
        sizer.Add(wx.StaticText(self, label=""), flag=wx.LEFT, border=5)

        # Button to start joystick
        bind_joystick_button = MultiStateButton(self,
                                                states=[(self.StartJoystick,
                                                         "Start joystick"),
                                                        (self.StopJoystick,
                                                         "STOP joystick")])
        sizer.Add(bind_joystick_button, flag=wx.EXPAND, border=5)

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################

        self.CreateSettingsDict()
	def __init__(self, parent) :
		HardwareGUIControl.__init__(self, parent)

		sizer = wx.BoxSizer(wx.VERTICAL)
		
		# Starting pixel to calibrate 
		sizer.Add (wx.StaticText(self, label="Initial pixel"), flag=wx.LEFT, border=5)
		initial_pixel_ctr = wx.SpinCtrl (self, value="0", min=0, max=640)
		initial_pixel_ctr.SetLabel("initial pixel")
		sizer.Add (initial_pixel_ctr, flag=wx.EXPAND, border=5)
		
		# Final pixel to calibrate
		sizer.Add (wx.StaticText(self, label="Final pixel"), flag=wx.LEFT, border=5)
		final_pixel_ctr = wx.SpinCtrl (self, value="640", min=0, max=640)
		final_pixel_ctr.SetLabel("final pixel")
		sizer.Add (final_pixel_ctr, flag=wx.EXPAND, border=5)
		
		# Size of pixel bundle
		sizer.Add (wx.StaticText(self, label="\nPixels to bundle"), flag=wx.EXPAND, border=5)
		self.pixel_bundle_width = wx.SpinCtrl(self, value="1", min=1, max=640)
		self.pixel_bundle_width.SetLabel ("pixel bundle width")
		sizer.Add (self.pixel_bundle_width, flag=wx.EXPAND, border=5)
		
		# Correspondence between wavelength and pulse shaper pixel number 
		# entered as dictionary without the "{}"
		sizer.Add (wx.StaticText(self, 
			label="\nPixel to wavelength entered as \n<pixel1> : <lambda1>,\n<pixel2> : <lambda2>, etc.")
		, flag=wx.EXPAND, border=5)
		pixel2lambda_ctrl = wx.TextCtrl (self, value="", style=wx.TE_MULTILINE|wx.EXPAND)
		pixel2lambda_ctrl.__label__ = "pixel_to_lamba"
		sizer.Add (pixel2lambda_ctrl, flag=wx.EXPAND, border=5)
		
		# Initial voltage
		sizer.Add (wx.StaticText(self, label="\nInitial voltage"), flag=wx.LEFT, border=5)
		initial_voltage_ctr = wx.SpinCtrl (self, value="500", min=0, max=PULSESHAPER_MAX_VAL)
		initial_voltage_ctr.SetLabel("initial voltage")
		sizer.Add (initial_voltage_ctr, flag=wx.EXPAND, border=5)
		
		# Final voltage
		sizer.Add (wx.StaticText(self, label="Final voltage"), flag=wx.LEFT, border=5)
		final_voltage_ctr = wx.SpinCtrl (self, value="800", min=0, max=PULSESHAPER_MAX_VAL)
		final_voltage_ctr.SetLabel("final voltage")
		sizer.Add (final_voltage_ctr, flag=wx.EXPAND, border=5)
		
		# Voltage step size
		sizer.Add (wx.StaticText(self, label="Voltage scanning step"), flag=wx.LEFT, border=5)
		voltage_step_ctr = wx.SpinCtrl (self, value="10", min=0, max=PULSESHAPER_MAX_VAL)
		voltage_step_ctr.SetLabel("voltage step")
		sizer.Add (voltage_step_ctr, flag=wx.EXPAND, border=5)
	
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		self.CreateSettingsDict()
Exemplo n.º 6
0
    def __init__(self, parent):
        HardwareGUIControl.__init__(self, parent)

        sizer = wx.BoxSizer(wx.VERTICAL)

        ################################################

        sizer.Add(wx.StaticText(self, label="Exposure time (ms)"),
                  flag=wx.LEFT,
                  border=5)
        exposure_time_ctr = wx.SpinCtrl(self, value="20", min=1, max=1e6)
        exposure_time_ctr.SetLabel("Exposure time")
        sizer.Add(exposure_time_ctr, flag=wx.EXPAND, border=5)

        ################ Temperature ################
        sizer.Add(wx.StaticText(self, label="\nTemperature"),
                  flag=wx.LEFT,
                  border=5)
        temperature_ctr = wx.SpinCtrl(self, value="-10", min=-50, max=50)
        temperature_ctr.SetLabel("Temperature")
        sizer.Add(temperature_ctr, flag=wx.EXPAND, border=10)

        ################ Shamrock settings ################

        ################ Grating ################
        sizer.Add(wx.StaticText(self, label="\nGrating #"),
                  flag=wx.LEFT,
                  border=5)
        grating_ctr = wx.SpinCtrl(self, value="1", min=1, max=3)
        grating_ctr.SetLabel("grating")
        sizer.Add(grating_ctr, flag=wx.EXPAND, border=5)

        ################ Wavelength ################
        sizer.Add(wx.StaticText(self, label="\nWavelength (nm)"),
                  flag=wx.LEFT,
                  border=5)
        wavelength_ctr = wx.SpinCtrl(self, value="610", min=10, max=1000)
        wavelength_ctr.SetLabel("wavelength")
        sizer.Add(wavelength_ctr, flag=wx.EXPAND, border=5)

        ################ Slit width ################
        sizer.Add(wx.StaticText(self, label="\nSlit width (um)"),
                  flag=wx.LEFT,
                  border=5)
        slit_width_ctr = wx.SpinCtrl(self, value="500", min=0, max=2000)
        slit_width_ctr.SetLabel("slit width")
        sizer.Add(slit_width_ctr, flag=wx.EXPAND, border=5)

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################

        self.CreateSettingsDict()
Exemplo n.º 7
0
	def __init__(self, parent, dev) :
		HardwareGUIControl.__init__(self, parent, dev)
		
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		# Specify the communication port name
		sizer.Add (wx.StaticText(self, label="Communication port"), flag=wx.LEFT, border=5)
		port_name = wx.TextCtrl (self, value="COM15")
		port_name.__label__ = "port"
		sizer.Add (port_name, flag=wx.EXPAND, border=5)
		
		# How long to wait after new pulse shape was sent
		sizer.Add (wx.StaticText(self, label="\nWait to update (ms)"), flag=wx.LEFT, border=5)
		update_time_delay_ctr = wx.SpinCtrl (self, value="50", min=0, max=10000)
		update_time_delay_ctr.__label__ = "update_time_delay"
		sizer.Add (update_time_delay_ctr, flag=wx.EXPAND, border=5)	
		
		# Calibration file
		sizer.Add (wx.StaticText(self, label="\nCalibration file"), flag=wx.LEFT, border=5)
		calibration_file_ctr = wx.FilePickerCtrl(self, message="Chose pulse shaper calibration file...")
		calibration_file_ctr.__label__ = "calibration_file_name"
		sizer.Add (calibration_file_ctr, flag=wx.EXPAND, border=5)		
		
		# Select how to utilize calibration information
		sizer.Add (wx.StaticText(self, label="\nAmplitude/phase to voltage conversion"), flag=wx.LEFT, border=5)
		choices = AmplPhase2ShaperMasks.Choices()
		amplphase_convertion_ctrl = wx.ComboBox(self, choices=choices, value=choices[0], style=wx.CB_READONLY )
		amplphase_convertion_ctrl.__label__ = "amplphase2shapermasks"
		sizer.Add (amplphase_convertion_ctrl, flag=wx.EXPAND, border=5)
		
		# Transform limited phase 
		sizer.Add (wx.StaticText(self, label="\nTrasform limited phase (multi-line text)"), flag=wx.LEFT, border=5)
		self.transform_lim_phase_ctrl = wx.TextCtrl (self, style=wx.TE_MULTILINE)
		self.transform_lim_phase_ctrl.__label__ = "transform_limited_phase"
		sizer.Add (self.transform_lim_phase_ctrl, flag=wx.EXPAND, border=5)
		
		# Button to load transform limited phase
		load_tl_ctrl = wx.Button (self, label="Load transform limited phase")
		load_tl_ctrl.Bind (wx.EVT_BUTTON, self.LoadTransformLimited)
		sizer.Add (load_tl_ctrl, flag=wx.EXPAND, border=5)
		
		# Amplitude correction
		sizer.Add (wx.StaticText(self, label="\nAmplitude correction (multi-line text)"), flag=wx.LEFT, border=5)
		self.ampl_correction_ctrl = wx.TextCtrl (self, style=wx.TE_MULTILINE)
		self.ampl_correction_ctrl.__label__ = "ampl_correction"
		sizer.Add (self.ampl_correction_ctrl, flag=wx.EXPAND, border=5)
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		self.CreateSettingsDict()
    def __init__(self, parent, **kwards):
        HardwareGUIControl.__init__(self,
                                    parent,
                                    manager_cls=ManagerThorlabsCamera,
                                    **kwards)

        sizer = wx.BoxSizer(wx.VERTICAL)

        # Spacer
        sizer.Add(wx.StaticText(self, label=""), flag=wx.LEFT, border=5)

        # Check-box to draw gun-sight
        draw_gun_sight_ctl = wx.CheckBox(self, label="Draw gun-sight")
        draw_gun_sight_ctl.__label__ = "draw_gun_sight"
        sizer.Add(draw_gun_sight_ctl, flag=wx.EXPAND, border=5)
        # Enable interactive update
        draw_gun_sight_ctl.Bind(wx.EVT_CHECKBOX, self.UpdateSettings)

        # Radius of gun-sight
        sizer.Add(wx.StaticText(self, label="\nGun-sight radius"),
                  flag=wx.LEFT,
                  border=5)
        gun_sight_radius_ctrl = wx.SpinCtrl(self,
                                            value="43",
                                            min=0,
                                            max=min(CAMERA_IMG_WIDTH,
                                                    CAMERA_IMG_HIGHT))
        gun_sight_radius_ctrl.__label__ = "radius"
        sizer.Add(gun_sight_radius_ctrl, flag=wx.EXPAND, border=5)
        # Enable interactive update
        gun_sight_radius_ctrl.Bind(wx.EVT_SPINCTRL, self.UpdateSettings)

        # Spacer
        sizer.Add(wx.StaticText(self, label=""), flag=wx.LEFT, border=5)

        # Button for displaying image
        show_img_button = MultiStateButton(self,
                                           states=[(self.StartShowingImg,
                                                    "Show image"),
                                                   (self.StopShowingImg,
                                                    "STOP")])
        sizer.Add(show_img_button, flag=wx.EXPAND, border=5)

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################

        self.CreateSettingsDict()
	def __init__(self, parent) :
		HardwareGUIControl.__init__(self, parent)
		
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		################################################
		
		sizer.Add (wx.StaticText(self, label="Exposure time (ms)"), flag=wx.LEFT, border=5)
		exposure_time_ctr = wx.SpinCtrl (self, value="20", min=1, max=1e6)
		exposure_time_ctr.SetLabel("Exposure time")
		sizer.Add (exposure_time_ctr, flag=wx.EXPAND, border=5)

		################ Temperature ################
		sizer.Add (wx.StaticText(self, label="\nTemperature"), flag=wx.LEFT, border=5)
		temperature_ctr = wx.SpinCtrl (self, value="-10", min=-50, max=50)
		temperature_ctr.SetLabel ("Temperature")
		sizer.Add (temperature_ctr, flag=wx.EXPAND, border=10)
		
		################ Shamrock settings ################
		
		################ Grating ################
		sizer.Add (wx.StaticText(self, label="\nGrating #"), flag=wx.LEFT, border=5)
		grating_ctr = wx.SpinCtrl (self, value="1", min=1, max=3)
		grating_ctr.SetLabel("grating")
		sizer.Add (grating_ctr, flag=wx.EXPAND, border=5)
		
		################ Wavelength ################
		sizer.Add (wx.StaticText(self, label="\nWavelength (nm)"), flag=wx.LEFT, border=5)
		wavelength_ctr = wx.SpinCtrl (self, value="610", min=10, max=1000)
		wavelength_ctr.SetLabel("wavelength")
		sizer.Add (wavelength_ctr, flag=wx.EXPAND, border=5)
		
		################ Slit width ################
		sizer.Add (wx.StaticText(self, label="\nSlit width (um)"), flag=wx.LEFT, border=5)
		slit_width_ctr = wx.SpinCtrl (self, value="500", min=0, max=2000)
		slit_width_ctr.SetLabel("slit width")
		sizer.Add (slit_width_ctr, flag=wx.EXPAND, border=5)
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		
		self.CreateSettingsDict()
Exemplo n.º 10
0
    def __init__(self, parent=None, dev=None):
        HardwareGUIControl.__init__(self, parent, dev)

        sizer = wx.BoxSizer(wx.VERTICAL)

        sizer.Add(wx.StaticText(self, label="Description"),
                  flag=wx.LEFT,
                  border=5)

        # Text entry field
        dw, dh = wx.DisplaySize()
        info_txt = wx.TextCtrl(self,
                               style=wx.TE_MULTILINE | wx.TE_RICH2
                               | wx.TE_AUTO_URL,
                               size=(-1, 0.4 * dh))
        info_txt.__label__ = "info_txt"
        sizer.Add(info_txt, flag=wx.EXPAND, border=5)

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################
        self.CreateSettingsDict()
	def __init__ (self, parent) :
		HardwareGUIControl.__init__(self, parent)
		
		self.sizer = wx.BoxSizer(wx.VERTICAL)
		
		sizer.Add (wx.StaticText(self, label="Gaussian mutation:\nMean"), flag=wx.LEFT, border=5)
		mu_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=0.0, digits=3)
		mu_ctrl.__label__ = "gaussian_mutation_mu"
		sizer.Add (mu_ctrl , flag=wx.EXPAND, border=5)
		
		sizer.Add (wx.StaticText(self, label="Sigma"), flag=wx.LEFT, border=5)
		sigma_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=0.05, digits=3)
		sigma_ctrl.__label__ = "gaussian_mutation_sigma"
		sizer.Add (sigma_ctrl , flag=wx.EXPAND, border=5)
	
		sizer.Add (wx.StaticText(self, label="Independent  probability for attribute mutation"), flag=wx.LEFT, border=5)
		indpb_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=1., digits=3)
		indpb_ctrl.__label__ = "mutation_indpb"
		sizer.Add (indpb_ctrl, flag=wx.EXPAND, border=5)	
			
		# Separator
		sizer.Add (wx.StaticText(self), border=5)

		# cxpb - The probability of mating two individuals 
		sizer.Add (wx.StaticText(self, label="Mating probability"), flag=wx.LEFT, border=5)
		cxpb_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=0.5, digits=3)
		cxpb_ctrl.__label__ = "cxpb"
		sizer.Add (cxpb_ctrl, flag=wx.EXPAND, border=5)
		
		# mutpb - The probability of mutating an individuals
		sizer.Add (wx.StaticText(self, label="Mutating probability"), flag=wx.LEFT, border=5)
		mutpb_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=0.1, digits=3)
		mutpb_ctrl.__label__ = "mutpb"
		sizer.Add (mutpb_ctrl, flag=wx.EXPAND, border=5)
		
		self.SetSizer(self.sizer)
		
		############### GUI is created, now generate settings ######################
		self.CreateSettingsDict()
Exemplo n.º 12
0
	def __init__(self, parent, **kwards) :
		HardwareGUIControl.__init__(self, parent, manager_cls=ManagerThorlabsCamera, **kwards)
	 
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		# Spacer
		sizer.Add (wx.StaticText(self, label=""), flag=wx.LEFT, border=5)
		
		# Check-box to draw gun-sight
		draw_gun_sight_ctl = wx.CheckBox(self, label="Draw gun-sight")
		draw_gun_sight_ctl.__label__ = "draw_gun_sight"
		sizer.Add (draw_gun_sight_ctl, flag=wx.EXPAND, border=5)
		# Enable interactive update 
		draw_gun_sight_ctl.Bind(wx.EVT_CHECKBOX, self.UpdateSettings)
		
		# Radius of gun-sight
		sizer.Add (wx.StaticText(self, label="\nGun-sight radius"), flag=wx.LEFT, border=5)
		gun_sight_radius_ctrl = wx.SpinCtrl (self, value="43", min=0, 
											max=min(CAMERA_IMG_WIDTH, CAMERA_IMG_HIGHT) )
		gun_sight_radius_ctrl.__label__ = "radius"
		sizer.Add (gun_sight_radius_ctrl, flag=wx.EXPAND, border=5)
		# Enable interactive update 
		gun_sight_radius_ctrl.Bind (wx.EVT_SPINCTRL, self.UpdateSettings)
		
		# Spacer
		sizer.Add (wx.StaticText(self, label=""), flag=wx.LEFT, border=5)
		
		# Button for displaying image 
		show_img_button = MultiStateButton(self, states=[
				(self.StartShowingImg, "Show image"), (self.StopShowingImg, "STOP")
			]
		)
		sizer.Add (show_img_button, flag=wx.EXPAND, border=5)
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		
		self.CreateSettingsDict()
Exemplo n.º 13
0
    def __init__(self, parent):
        HardwareGUIControl.__init__(self, parent)
        sizer = wx.BoxSizer(wx.VERTICAL)

        # List of positions of channels
        sizer.Add(wx.StaticText(
            self, label="Channel number with pure samples for learning"),
                  flag=wx.LEFT,
                  border=5)
        self.chanel_odd_experiment_ctrl = wx.TextCtrl(self,
                                                      value="",
                                                      style=wx.TE_MULTILINE
                                                      | wx.EXPAND)
        self.chanel_odd_experiment_ctrl.__label__ = "channels"
        sizer.Add(self.chanel_odd_experiment_ctrl, flag=wx.EXPAND, border=5)

        # Filters (on filter wheel) to be used
        sizer.Add(wx.StaticText(self, label="Filter numbers"),
                  flag=wx.LEFT,
                  border=5)
        self.filters_ctrl = wx.TextCtrl(self,
                                        value="",
                                        style=wx.TE_MULTILINE | wx.EXPAND)
        self.filters_ctrl.__label__ = "filters"
        sizer.Add(self.filters_ctrl, flag=wx.EXPAND, border=5)

        sizer.Add(wx.StaticText(self, label="\nMax amplitude (ND filter)"),
                  flag=wx.LEFT,
                  border=5)
        max_ampl_ctrl = wxFloatSpin(self,
                                    min_val=0,
                                    max_val=1,
                                    increment=0.01,
                                    value=1.,
                                    digits=3)
        max_ampl_ctrl.__label__ = "max_ampl"
        sizer.Add(max_ampl_ctrl, flag=wx.EXPAND, border=5)

        ################ Parameters of reference mask ####################
        sb_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, label="Reference mask parameters: "),
            wx.VERTICAL)

        # Min value of coefficient
        sb_sizer.Add(wx.StaticText(self, label="min coefficient"),
                     flag=wx.LEFT,
                     border=5)
        coeff_min_ctrl = wxFloatSpin(self,
                                     min_val=-10,
                                     max_val=10,
                                     increment=0.01,
                                     value=-0.9,
                                     digits=3)
        coeff_min_ctrl.__label__ = "coeff_min"
        sb_sizer.Add(coeff_min_ctrl, flag=wx.EXPAND, border=5)

        # Max value of coefficient
        sb_sizer.Add(wx.StaticText(self, label="max coefficient"),
                     flag=wx.LEFT,
                     border=5)
        coeff_max_ctrl = wxFloatSpin(self,
                                     min_val=0,
                                     max_val=10,
                                     increment=0.01,
                                     value=0.9,
                                     digits=3)
        coeff_max_ctrl.__label__ = "coeff_max"
        sb_sizer.Add(coeff_max_ctrl, flag=wx.EXPAND, border=5)

        # Number of coeff scans
        sb_sizer.Add(wx.StaticText(self, label="number of scans"),
                     flag=wx.LEFT,
                     border=5)
        coeff_num_ctrl = wx.SpinCtrl(self, value="20", min=2, max=100000)
        coeff_num_ctrl.__label__ = "coeff_num"
        sb_sizer.Add(coeff_num_ctrl, flag=wx.EXPAND, border=5)

        # Polynomial basis type
        sb_sizer.Add(wx.StaticText(self, label="\nPolynomial basis type"),
                     flag=wx.LEFT,
                     border=5)
        self.polynomial_bases = {
            "Chebyshev": np.polynomial.chebyshev.Chebyshev,
            "Legendre": np.polynomial.legendre.Legendre,
            "Laguerre": np.polynomial.laguerre.Laguerre,
            "Hermite": np.polynomial.hermite.Hermite,
            "Monomials": np.polynomial.polynomial.Polynomial
        }
        choices = self.polynomial_bases.keys()
        polynomial_bais_ctrl = wx.ComboBox(self,
                                           choices=choices,
                                           value=choices[0],
                                           style=wx.CB_READONLY)
        polynomial_bais_ctrl.__label__ = "polynomial_basis"
        sb_sizer.Add(polynomial_bais_ctrl, flag=wx.EXPAND, border=5)

        # Initial polynomial order
        sb_sizer.Add(wx.StaticText(self, label="\nInitial polynomial order"),
                     flag=wx.LEFT,
                     border=5)
        min_poly_order_ctrl = wx.SpinCtrl(self, value="2", min=0, max=100000)
        min_poly_order_ctrl.__label__ = "min_polynomial_order"
        sb_sizer.Add(min_poly_order_ctrl, flag=wx.EXPAND, border=5)

        # Final polynomial order
        sb_sizer.Add(wx.StaticText(self, label="\nFinal polynomial order"),
                     flag=wx.LEFT,
                     border=5)
        max_poly_order_ctrl = wx.SpinCtrl(self, value="4", min=0, max=100000)
        max_poly_order_ctrl.__label__ = "max_polynomial_order"
        sb_sizer.Add(max_poly_order_ctrl, flag=wx.EXPAND, border=5)

        sizer.Add(sb_sizer, flag=wx.EXPAND, border=10)
        ################################################

        # Scan button
        self.get_coeff_scan_btn = wx.Button(self)
        self.get_coeff_scan_btn._start_label = "Scan polynomial coefficient"
        self.get_coeff_scan_btn._start_method = self.DoScannning
        self.get_coeff_scan_btn._stop_label = "STOP scanning"
        self.get_coeff_scan_btn._stop_method = self.StopScannning
        self.get_coeff_scan_btn.SetLabel(self.get_coeff_scan_btn._start_label)
        self.get_coeff_scan_btn.Bind(wx.EVT_BUTTON,
                                     self.get_coeff_scan_btn._start_method)
        sizer.Add(self.get_coeff_scan_btn, flag=wx.EXPAND, border=5)

        # Separator
        sizer.Add(wx.StaticText(self), border=5)

        # Record background signal
        background_signal_button = wx.Button(self, label="Record background")
        background_signal_button.Bind(wx.EVT_BUTTON, self.RecordBackground)
        sizer.Add(background_signal_button, flag=wx.EXPAND, border=5)

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################
        self.CreateSettingsDict()
Exemplo n.º 14
0
    def __init__(self, parent, dev):
        HardwareGUIControl.__init__(self, parent, dev)

        xpixels, ypixels = 1024, 1024

        sizer = wx.BoxSizer(wx.VERTICAL)

        ################ Readout mode settings ################
        boxsizer_ = wx.StaticBoxSizer(wx.StaticBox(self, label="Readout mode"),
                                      wx.HORIZONTAL)

        boxsizer_.Add(wx.RadioButton(self,
                                     label="Full vertical binning",
                                     style=wx.RB_GROUP),
                      flag=wx.EXPAND,
                      border=5)
        boxsizer_.Add(wx.RadioButton(self, label="Image"),
                      flag=wx.EXPAND,
                      border=5)

        sizer.Add(boxsizer_, flag=wx.EXPAND, border=10)

        ################ Image dimensions ################
        boxsizer_ = wx.StaticBoxSizer(
            wx.StaticBox(self, label="Image resolution (image mode only)"),
            wx.VERTICAL)

        boxsizer_.Add(wx.StaticText(self, label="X min"),
                      flag=wx.LEFT,
                      border=5)
        x_min_ctrl = wx.SpinCtrl(self, value="1", min=1, max=xpixels)
        x_min_ctrl.SetLabel("x_min")
        boxsizer_.Add(x_min_ctrl, flag=wx.EXPAND, border=5)

        boxsizer_.Add(wx.StaticText(self, label="X max"),
                      flag=wx.LEFT,
                      border=5)
        x_max_ctrl = wx.SpinCtrl(self, value=str(xpixels), min=1, max=xpixels)
        x_max_ctrl.SetLabel("x_max")
        boxsizer_.Add(x_max_ctrl, flag=wx.EXPAND, border=5)

        boxsizer_.Add(wx.StaticText(self, label="Y min"),
                      flag=wx.LEFT,
                      border=5)
        y_min_ctrl = wx.SpinCtrl(self, value="1", min=1, max=ypixels)
        y_min_ctrl.SetLabel("y_min")
        boxsizer_.Add(y_min_ctrl, flag=wx.EXPAND, border=5)

        boxsizer_.Add(wx.StaticText(self, label="Y max"),
                      flag=wx.LEFT,
                      border=5)
        y_max_ctrl = wx.SpinCtrl(self, value=str(ypixels), min=1, max=ypixels)
        y_max_ctrl.SetLabel("y_max")
        boxsizer_.Add(y_max_ctrl, flag=wx.EXPAND, border=5)

        # Image binning
        boxsizer_.Add(wx.StaticText(self, label="X binning"),
                      flag=wx.LEFT,
                      border=5)
        x_bin_ctrl = wx.SpinCtrl(self, value="1", min=1, max=xpixels)
        x_bin_ctrl.SetLabel("x_bin")
        boxsizer_.Add(x_bin_ctrl, flag=wx.EXPAND, border=5)

        boxsizer_.Add(wx.StaticText(self, label="Y binning"),
                      flag=wx.LEFT,
                      border=5)
        y_bin_ctrl = wx.SpinCtrl(self, value="1", min=1, max=ypixels)
        y_bin_ctrl.SetLabel("y_bin")
        boxsizer_.Add(y_bin_ctrl, flag=wx.EXPAND, border=5)

        sizer.Add(boxsizer_, flag=wx.EXPAND, border=10)
        ################################################

        sizer.Add(wx.StaticText(self, label="\nExposure time (ms)"),
                  flag=wx.LEFT,
                  border=5)
        exposure_time_ctr = wx.SpinCtrl(self, value="20", min=1, max=1e6)
        exposure_time_ctr.SetLabel("Exposure time")
        sizer.Add(exposure_time_ctr, flag=wx.EXPAND, border=5)

        sizer.Add(wx.StaticText(self, label="Scans to accumulate"),
                  flag=wx.LEFT,
                  border=5)
        scans_to_average_ctr = wx.SpinCtrl(self, value="1", min=1, max=1e6)
        scans_to_average_ctr.__label__ = "scans_to_accumulate"
        sizer.Add(scans_to_average_ctr, flag=wx.EXPAND, border=5)

        ################### Gain ################################
        sizer.Add(wx.StaticText(self, label="\nGain"), flag=wx.LEFT, border=5)
        gain_ctr = wx.SpinCtrl(self, value="1", min=1, max=1e6)
        gain_ctr.SetLabel("Gain")
        sizer.Add(gain_ctr, flag=wx.EXPAND, border=5)

        ################ Trigger modes ################
        boxsizer_ = wx.StaticBoxSizer(wx.StaticBox(self, label="Trigger mode"),
                                      wx.HORIZONTAL)

        boxsizer_.Add(wx.RadioButton(self, label="Internal",
                                     style=wx.RB_GROUP),
                      flag=wx.EXPAND,
                      border=5)
        boxsizer_.Add(wx.RadioButton(self, label="External"),
                      flag=wx.EXPAND,
                      border=5)

        sizer.Add(boxsizer_, flag=wx.EXPAND, border=10)

        ################ Parameters of DDG used only when the external trigger is on ################

        sizer.Add(wx.StaticText(self, label="\nDDG gate time delay (ns)"),
                  flag=wx.LEFT,
                  border=5)
        DDG_delay_time_ctr = wx.SpinCtrl(self, value="0", min=0, max=1e9)
        DDG_delay_time_ctr.SetLabel("DDG delay time")
        sizer.Add(DDG_delay_time_ctr, flag=wx.EXPAND, border=10)

        sizer.Add(wx.StaticText(self, label="DDG gate width time (ns)"),
                  flag=wx.LEFT,
                  border=5)
        DDG_width_ctr = wx.SpinCtrl(self, value="4", min=0, max=1e9)
        DDG_width_ctr.SetLabel("DDG width")
        sizer.Add(DDG_width_ctr, flag=wx.EXPAND, border=10)

        ################ Number of pulses for the integrate on chip option ################
        sizer.Add(wx.StaticText(
            self, label="\nNumber of pulses to integrate on chip"),
                  flag=wx.LEFT,
                  border=5)
        IOC_num_ctr = wx.SpinCtrl(self, value="1", min=0, max=1e6)
        IOC_num_ctr.SetLabel("IOCNumber")
        sizer.Add(IOC_num_ctr, flag=wx.EXPAND, border=10)

        ################ Temperature ################
        sizer.Add(wx.StaticText(self, label="\nTemperature"),
                  flag=wx.LEFT,
                  border=5)
        temperature_ctr = wx.SpinCtrl(self, value="0", min=-50, max=50)
        temperature_ctr.SetLabel("Temperature")
        sizer.Add(temperature_ctr, flag=wx.EXPAND, border=10)

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################

        self.CreateSettingsDict()
Exemplo n.º 15
0
	def __init__ (self, parent) :
	
		HardwareGUIControl.__init__(self, parent)
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		# List of positions of channels
		sizer.Add (wx.StaticText(self, label="Channel number with pure samples for learning"), flag=wx.LEFT, border=5)
		self.chanel_odd_experiment_ctrl = wx.TextCtrl (self, value="", style=wx.TE_MULTILINE|wx.EXPAND)
		self.chanel_odd_experiment_ctrl.__label__ = "channels"
		sizer.Add (self.chanel_odd_experiment_ctrl, flag=wx.EXPAND, border=5)
		
		# Separator
		sizer.Add (wx.StaticText(self), border=5)
		
		# Pulse shaping options
		sizer.Add ( wx.StaticText(self, label="Pulse shaping options") )
		pulse_shaping_options = {
			"amplitude only"		: 
				( 1, lambda ind : ( ind, np.zeros(len(ind)) ) ),
			"phase only"			: 
				( 1, lambda ind : ( np.ones(len(ind)), ind ) ),
			"amplitude and phase"	: 
				( 2, lambda ind : ( ind[:len(ind)/2], ind[len(ind)/2:] ) )
		} 
		self.Ind_length, self.ind2pulse_shape = zip(*pulse_shaping_options.values())
		# Multiplicative factor to determine the number of optimization variables  
		# controls the size of a single individual, which is equal to ind_len*self.num_pixels
		self.Ind_length 		= dict( zip(pulse_shaping_options.keys(), self.Ind_length) )
		# Function converting GA individual to pulse shape 
		self.ind2pulse_shape	= dict( zip(pulse_shaping_options.keys(), self.ind2pulse_shape) )
		
		choices = pulse_shaping_options.keys()
		pulse_shaping_ctrl = wx.ComboBox (self, choices=choices, value=choices[0], style=wx.CB_READONLY )
		pulse_shaping_ctrl.__label__ = "pulse_shaping_option"
		sizer.Add (pulse_shaping_ctrl,  flag=wx.EXPAND, border=5)	
		
		# Spectrum post-processing options
		sizer.Add ( wx.StaticText(self, label="Spectrum post-processing options") )
		choices = _SpectrumPostProcess.GetChoices()
		spectrum_options_ctrl = wx.ComboBox (self, choices=choices, value=choices[0], style=wx.CB_READONLY )
		spectrum_options_ctrl.__label__ = "spectrum_postprocess"
		sizer.Add (spectrum_options_ctrl,  flag=wx.EXPAND, border=5)	
		
		# Fitness function options
		sizer.Add ( wx.StaticText(self, label="Fitness function") )
		self.fitness_options = {
			"determinant"		:	lambda F : np.abs(np.linalg.det(F)),
			"min eigenvalue" 	:	lambda F : np.abs(np.linalg.eigvals(F)).min(),
			"max eigenvalue"	:	lambda F : np.abs(np.linalg.eigvals(F)).max()
		}
		choices = self.fitness_options.keys()
		fitness_options_ctrl = wx.ComboBox (self, choices=choices, value=choices[1], style=wx.CB_READONLY )
		fitness_options_ctrl.__label__ = "fitness_options"
		sizer.Add (fitness_options_ctrl,  flag=wx.EXPAND, border=5)
		
		# Separator
		#sizer.Add (wx.StaticText(self), border=5)
		
		
		# Size of pixel bundle
		sizer.Add (wx.StaticText(self, label="\nPixels to bundle"), flag=wx.EXPAND, border=5)
		pixel_bundle_width = wx.SpinCtrl(self, value="1", min=1, max=640)
		pixel_bundle_width.__label__ = "pixel_bundle_width"
		sizer.Add (pixel_bundle_width, flag=wx.EXPAND, border=5)
		
		# Population size
		sizer.Add (wx.StaticText(self, label="Population size"), flag=wx.LEFT, border=5)
		population_size_ctrl  = wx.SpinCtrl (self, value="10", min=1, max=100000)
		population_size_ctrl.__label__ = "population_size"
		sizer.Add (population_size_ctrl , flag=wx.EXPAND, border=5)
		
		# Separator
		sizer.Add (wx.StaticText(self), border=5)
			
		########################################################################
		# Setting characterizing mutation
		########################################################################
	
		# sizer.Add (wx.StaticText(self, label="Gaussian mutation:"), flag=wx.LEFT, border=5)
		
		sizer.Add (wx.StaticText(self, label="Gaussian mutation:\nMean"), flag=wx.LEFT, border=5)
		mu_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=0.0, digits=3)
		mu_ctrl.__label__ = "gaussian_mutation_mu"
		sizer.Add (mu_ctrl , flag=wx.EXPAND, border=5)
		
		sizer.Add (wx.StaticText(self, label="Sigma"), flag=wx.LEFT, border=5)
		sigma_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=0.05, digits=3)
		sigma_ctrl.__label__ = "gaussian_mutation_sigma"
		sizer.Add (sigma_ctrl , flag=wx.EXPAND, border=5)
	
		sizer.Add (wx.StaticText(self, label="Independent  probability for attribute mutation"), flag=wx.LEFT, border=5)
		indpb_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=1., digits=3)
		indpb_ctrl.__label__ = "mutation_indpb"
		sizer.Add (indpb_ctrl, flag=wx.EXPAND, border=5)	
			
		# Separator
		sizer.Add (wx.StaticText(self), border=5)

		# cxpb - The probability of mating two individuals 
		sizer.Add (wx.StaticText(self, label="Mating probability"), flag=wx.LEFT, border=5)
		cxpb_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=0.5, digits=3)
		cxpb_ctrl.__label__ = "cxpb"
		sizer.Add (cxpb_ctrl, flag=wx.EXPAND, border=5)
		
		# mutpb - The probability of mutating an individuals
		sizer.Add (wx.StaticText(self, label="Mutating probability"), flag=wx.LEFT, border=5)
		mutpb_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=0.1, digits=3)
		mutpb_ctrl.__label__ = "mutpb"
		sizer.Add (mutpb_ctrl, flag=wx.EXPAND, border=5)
		
		# Separator
		sizer.Add (wx.StaticText(self), border=5)
		
		# Record background signal
		background_signal_button = wx.Button (self, label="Record background")
		background_signal_button.Bind ( wx.EVT_BUTTON, self.RecordBackground )
		sizer.Add (background_signal_button, flag=wx.EXPAND, border=5)
		
		# ODD GA button
		self.odd_ga_button = wx.Button (self)
		self.odd_ga_button._start_label = "Start ODD optimization"
		self.odd_ga_button._start_method = partial(self.StartOptimization, DoGA=self.DoSingleIterGA_ODD)
		self.odd_ga_button._stop_label = "STOP ODD optimization"
		self.odd_ga_button.SetLabel (self.odd_ga_button._start_label)
		self.odd_ga_button.Bind( wx.EVT_BUTTON, self.odd_ga_button._start_method)
		sizer.Add(self.odd_ga_button, flag=wx.EXPAND, border=5)
		
		# Coherently suppress fluorescence button
		self.sup_fluor_button = wx.Button (self)
		self.sup_fluor_button._start_label = "Start GA to suppress fluorescence" 
		self.sup_fluor_button._start_method = partial(self.StartOptimization, DoGA=self.DoSingleIterGA_CoherentSuppression)
		self.sup_fluor_button._stop_label = "STOP GA to suppress fluorescence"
		self.sup_fluor_button.SetLabel (self.sup_fluor_button._start_label)
		self.sup_fluor_button.Bind( wx.EVT_BUTTON, self.sup_fluor_button._start_method )
		sizer.Add(self.sup_fluor_button, flag=wx.EXPAND, border=5)
		
		###################### Measuring concentrations ######################
		sb_sizer = wx.StaticBoxSizer( wx.StaticBox(self, label="Concentration measurements"),  wx.VERTICAL )
		
		# List of positions of channels_mixtures
		sb_sizer.Add (wx.StaticText(self, label="Channel number to measure concentrations"), flag=wx.LEFT, border=5)
		self.channel_mixtues_ctrl = wx.TextCtrl (self, value="", style=wx.TE_MULTILINE|wx.EXPAND)
		self.channel_mixtues_ctrl.__label__ = "channels_mixtures"
		sb_sizer.Add (self.channel_mixtues_ctrl, flag=wx.EXPAND, border=5)
		
		# ODD GA file
		sb_sizer.Add (wx.StaticText(self, label="ODD GA file"), flag=wx.LEFT, border=5)
		odd_ga_file_ctr = wx.FilePickerCtrl(self, message="Chose file containing optimization data...")
		odd_ga_file_ctr.__label__ = "odd_ga_file_name"
		sb_sizer.Add (odd_ga_file_ctr, flag=wx.EXPAND, border=5)
		
		# Number of pulses to be used
		sb_sizer.Add (wx.StaticText(self, label="Number of pulses to interrogate"), flag=wx.LEFT, border=5)
		num_pulses_ctrl  = wx.SpinCtrl (self, value="10", min=1, max=100000)
		num_pulses_ctrl.__label__ = "num_pulses"
		sb_sizer.Add (num_pulses_ctrl , flag=wx.EXPAND, border=5)
		
		# Measure concentration button (OLD way)
		measure_concentr_button = wx.Button (self)  
		measure_concentr_button._start_label 	= "OLD Measure concentration"
		measure_concentr_button._start_method 	= self.Old_MeasureConcentration
		measure_concentr_button._stop_label 	= "STOP measuring concentration"
		measure_concentr_button._stop_method 	= self.Stop_MeasureConcentration
		measure_concentr_button.SetLabel (measure_concentr_button._start_label)
		measure_concentr_button.Bind (wx.EVT_BUTTON, measure_concentr_button._start_method)
		sb_sizer.Add(measure_concentr_button, flag=wx.EXPAND, border=5) 
		
		# Measure concentration button (NEW way)
		measure_concentr_button = wx.Button (self)  
		measure_concentr_button._start_label 	= "Measure concentration"
		measure_concentr_button._start_method 	= self.MeasureConcentration
		measure_concentr_button._stop_label 	= "STOP measuring concentration"
		measure_concentr_button._stop_method 	= self.Stop_MeasureConcentration
		measure_concentr_button.SetLabel (measure_concentr_button._start_label)
		measure_concentr_button.Bind (wx.EVT_BUTTON, measure_concentr_button._start_method)
		sb_sizer.Add(measure_concentr_button, flag=wx.EXPAND, border=5) 
		
		sizer.Add (sb_sizer, flag=wx.EXPAND, border=5)
		######################################################################
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		self.CreateSettingsDict()
Exemplo n.º 16
0
    def __init__(self, parent, **kwards):
        HardwareGUIControl.__init__(self,
                                    parent,
                                    manager_cls=ManagerPicoHarp,
                                    **kwards)

        sizer = wx.BoxSizer(wx.VERTICAL)

        # Offset
        sizer.Add(wx.StaticText(self, label="Offset (ns)"),
                  flag=wx.LEFT | wx.TOP,
                  border=5)
        offset_ctrl = wx.SpinCtrl(self, value="0", min=0, max=1e6)
        offset_ctrl.__label__ = "offset"
        sizer.Add(offset_ctrl, flag=wx.EXPAND, border=5)
        # Enable interactive update
        offset_ctrl.Bind(
            wx.EVT_SPINCTRL,
            functools.partial(self.UpdateProperty, offset_ctrl,
                              "UpdateOffset"))

        # Zero level of channel 0
        sizer.Add(wx.StaticText(self, label="\nCFDZeroX0 (mV)"),
                  flag=wx.LEFT,
                  border=5)
        CFDZeroX0_ctrl = wx.SpinCtrl(self, value="10", min=0, max=1e3)
        CFDZeroX0_ctrl.__label__ = "cfdzerox0"
        sizer.Add(CFDZeroX0_ctrl, flag=wx.EXPAND, border=5)
        # Enable interactive update
        CFDZeroX0_ctrl.Bind(
            wx.EVT_SPINCTRL,
            functools.partial(self.UpdateProperty, CFDZeroX0_ctrl,
                              "UpdateCFDZero0"))

        # One level for channel 0
        sizer.Add(wx.StaticText(self, label="CFDLevel0 (mV)"),
                  flag=wx.LEFT,
                  border=5)
        CFDLevel0_ctrl = wx.SpinCtrl(self, value="80", min=0, max=1e3)
        CFDLevel0_ctrl.__label__ = "cfdlevelx0"
        sizer.Add(CFDLevel0_ctrl, flag=wx.EXPAND, border=5)
        # Enable interactive update
        CFDLevel0_ctrl.Bind(
            wx.EVT_SPINCTRL,
            functools.partial(self.UpdateProperty, CFDLevel0_ctrl,
                              "UpdateCFDLevel0"))

        # Zero level of channel 1
        sizer.Add(wx.StaticText(self, label="\nCFDZeroX1 (mV)"),
                  flag=wx.LEFT,
                  border=5)
        CFDZeroX1_ctrl = wx.SpinCtrl(self, value="10", min=0, max=1e3)
        CFDZeroX1_ctrl.__label__ = "cfdzerox1"
        sizer.Add(CFDZeroX1_ctrl, flag=wx.EXPAND, border=5)
        # Enable interactive update
        CFDZeroX1_ctrl.Bind(
            wx.EVT_SPINCTRL,
            functools.partial(self.UpdateProperty, CFDZeroX1_ctrl,
                              "UpdateCFDZero1"))

        # One level for channel 1
        sizer.Add(wx.StaticText(self, label="CFDLevel1 (mV)"),
                  flag=wx.LEFT,
                  border=5)
        CFDLevel1_ctrl = wx.SpinCtrl(self, value="80", min=0, max=1e3)
        CFDLevel1_ctrl.__label__ = "cfdlevelx1"
        sizer.Add(CFDLevel1_ctrl, flag=wx.EXPAND, border=5)
        # Enable interactive update
        CFDLevel1_ctrl.Bind(
            wx.EVT_SPINCTRL,
            functools.partial(self.UpdateProperty, CFDLevel1_ctrl,
                              "UpdateCFDLevel1"))

        # Divider
        sizer.Add(wx.StaticText(self, label="\nDivider"),
                  flag=wx.LEFT,
                  border=5)
        syncdiv_ctrl = wx.SpinCtrl(self, value="8", min=1, max=1e3)
        syncdiv_ctrl.__label__ = "syncdiv"
        sizer.Add(syncdiv_ctrl, flag=wx.EXPAND, border=5)
        # Enable interactive update
        syncdiv_ctrl.Bind(
            wx.EVT_SPINCTRL,
            functools.partial(self.UpdateProperty, syncdiv_ctrl,
                              "UpdateSyncDiv"))

        # Range
        sizer.Add(wx.StaticText(self, label="\nRange"), flag=wx.LEFT, border=5)
        range_ctrl = wx.SpinCtrl(self, value="2", min=0, max=1e6)
        range_ctrl.__label__ = "range"
        sizer.Add(range_ctrl, flag=wx.EXPAND, border=5)
        # Enable interactive update
        range_ctrl.Bind(
            wx.EVT_SPINCTRL,
            functools.partial(self.UpdateProperty, range_ctrl, "UpdateRange"))

        # Acquisition time
        sizer.Add(wx.StaticText(self, label="\nAcquisition time (ms)"),
                  flag=wx.LEFT,
                  border=5)
        tacq_ctrl = wx.SpinCtrl(self, value="1000", min=100, max=1e6)
        tacq_ctrl.__label__ = "tacq"
        sizer.Add(tacq_ctrl, flag=wx.EXPAND, border=5)
        # Enable interactive update
        tacq_ctrl.Bind(
            wx.EVT_SPINCTRL,
            functools.partial(self.UpdateProperty, tacq_ctrl, "UpdateTacq"))

        # Spacer
        sizer.Add(wx.StaticText(self, label=""), flag=wx.LEFT, border=5)

        # Button for displaying histogram
        show_histogram_button = MultiStateButton(
            self,
            states=[(self.StartShowingHistogram, "Show histogram"),
                    (self.StopShowingHistogram, "STOP histogram")])
        sizer.Add(show_histogram_button, flag=wx.EXPAND, border=5)

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################

        self.CreateSettingsDict()
Exemplo n.º 17
0
    def __init__(self, parent, dev):
        HardwareGUIControl.__init__(self, parent, dev)

        sizer = wx.BoxSizer(wx.VERTICAL)

        # Specify the communication port name
        sizer.Add(wx.StaticText(self, label="Communication port"),
                  flag=wx.LEFT,
                  border=5)
        port_name = wx.TextCtrl(self, value="COM15")
        port_name.__label__ = "port"
        sizer.Add(port_name, flag=wx.EXPAND, border=5)

        # How long to wait after new pulse shape was sent
        sizer.Add(wx.StaticText(self, label="\nWait to update (ms)"),
                  flag=wx.LEFT,
                  border=5)
        update_time_delay_ctr = wx.SpinCtrl(self, value="50", min=0, max=10000)
        update_time_delay_ctr.__label__ = "update_time_delay"
        sizer.Add(update_time_delay_ctr, flag=wx.EXPAND, border=5)

        # Calibration file
        sizer.Add(wx.StaticText(self, label="\nCalibration file"),
                  flag=wx.LEFT,
                  border=5)
        calibration_file_ctr = wx.FilePickerCtrl(
            self, message="Chose pulse shaper calibration file...")
        calibration_file_ctr.__label__ = "calibration_file_name"
        sizer.Add(calibration_file_ctr, flag=wx.EXPAND, border=5)

        # Select how to utilize calibration information
        sizer.Add(wx.StaticText(
            self, label="\nAmplitude/phase to voltage conversion"),
                  flag=wx.LEFT,
                  border=5)
        choices = AmplPhase2ShaperMasks.Choices()
        amplphase_convertion_ctrl = wx.ComboBox(self,
                                                choices=choices,
                                                value=choices[0],
                                                style=wx.CB_READONLY)
        amplphase_convertion_ctrl.__label__ = "amplphase2shapermasks"
        sizer.Add(amplphase_convertion_ctrl, flag=wx.EXPAND, border=5)

        # Transform limited phase
        sizer.Add(wx.StaticText(
            self, label="\nTrasform limited phase (multi-line text)"),
                  flag=wx.LEFT,
                  border=5)
        self.transform_lim_phase_ctrl = wx.TextCtrl(self,
                                                    style=wx.TE_MULTILINE)
        self.transform_lim_phase_ctrl.__label__ = "transform_limited_phase"
        sizer.Add(self.transform_lim_phase_ctrl, flag=wx.EXPAND, border=5)

        # Button to load transform limited phase
        load_tl_ctrl = wx.Button(self, label="Load transform limited phase")
        load_tl_ctrl.Bind(wx.EVT_BUTTON, self.LoadTransformLimited)
        sizer.Add(load_tl_ctrl, flag=wx.EXPAND, border=5)

        # Amplitude correction
        sizer.Add(wx.StaticText(
            self, label="\nAmplitude correction (multi-line text)"),
                  flag=wx.LEFT,
                  border=5)
        self.ampl_correction_ctrl = wx.TextCtrl(self, style=wx.TE_MULTILINE)
        self.ampl_correction_ctrl.__label__ = "ampl_correction"
        sizer.Add(self.ampl_correction_ctrl, flag=wx.EXPAND, border=5)

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################
        self.CreateSettingsDict()
Exemplo n.º 18
0
    def __init__(self, parent, dev):
        HardwareGUIControl.__init__(self, parent, dev)

        sizer = wx.BoxSizer(wx.VERTICAL)

        ################################################

        sizer.Add(wx.StaticText(self, label="Exposure time (millisecond)"),
                  flag=wx.LEFT,
                  border=5)
        exposure_time_ctr = wx.SpinCtrl(self, value="20", min=1, max=1e6)
        exposure_time_ctr.SetLabel("Exposure time")
        sizer.Add(exposure_time_ctr, flag=wx.EXPAND, border=5)

        ################################################

        sizer.Add(wx.StaticText(self, label="Scans to average"),
                  flag=wx.LEFT,
                  border=5)
        scans_average_ctr = wx.SpinCtrl(self, value="1", min=1, max=1e6)
        scans_average_ctr.SetLabel("scans_average")
        sizer.Add(scans_average_ctr, flag=wx.EXPAND, border=5)

        ################################################

        sizer.Add(wx.StaticText(self, label="\nStart wavelength (nm)"),
                  flag=wx.LEFT,
                  border=5)
        start_wavelength_ctr = wx.SpinCtrl(self, value="196", min=1, max=1e6)
        #start_wavelength_ctr = wx.SpinCtrl (self, value="580", min=1, max=1e6)
        start_wavelength_ctr.SetLabel("start_wavelength")
        sizer.Add(start_wavelength_ctr, flag=wx.EXPAND, border=5)

        ################################################

        sizer.Add(wx.StaticText(self, label="End wavelength (nm)"),
                  flag=wx.LEFT,
                  border=5)
        end_wavelength_ctr = wx.SpinCtrl(self, value="1118", min=1, max=1e6)
        #end_wavelength_ctr = wx.SpinCtrl (self, value="680", min=1, max=1e6)
        end_wavelength_ctr.SetLabel("end_wavelength")
        sizer.Add(end_wavelength_ctr, flag=wx.EXPAND, border=5)

        ############  Parameters for displaying spectrum #############
        # Spacer
        sizer.Add(wx.StaticText(self), flag=wx.LEFT, border=5)

        sb_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, label="Plotting options"), wx.VERTICAL)

        fix_vert_ax_ctrl = wx.CheckBox(self, label="Fix vertical axis")
        fix_vert_ax_ctrl.__label__ = "fix_vertical_axis"
        sb_sizer.Add(fix_vert_ax_ctrl, flag=wx.EXPAND, border=5)

        sb_sizer.Add(wx.StaticText(self, label="max val"),
                     flag=wx.LEFT,
                     border=5)
        max_val_ctr = wx.SpinCtrl(self, value="50000", min=1, max=1e6)
        max_val_ctr.SetLabel("vertical_axis_max_val")
        sb_sizer.Add(max_val_ctr, flag=wx.EXPAND, border=5)

        sb_sizer.Add(wx.StaticText(self, label="min val"),
                     flag=wx.LEFT,
                     border=5)
        min_val_ctr = wx.SpinCtrl(self, value="100", min=1, max=1e6)
        min_val_ctr.SetLabel("vertical_axis_min_val")
        sb_sizer.Add(min_val_ctr, flag=wx.EXPAND, border=5)

        sizer.Add(sb_sizer, flag=wx.EXPAND, border=5)
        ################################################

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################

        self.CreateSettingsDict()
Exemplo n.º 19
0
	def __init__(self, parent, dev) :
		"""
		`dev` is a sample switcher manager
		"""
		HardwareGUIControl.__init__(self, parent, dev)
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		# Specify the communication port name
		sizer.Add (wx.StaticText(self, label="Communication port"), flag=wx.LEFT, border=5)
		port_name = wx.TextCtrl (self, value="COM1")
		port_name.__label__ = "port"
		sizer.Add (port_name, flag=wx.EXPAND, border=5)
		
		# List of positions of channels
		sizer.Add (wx.StaticText(self, label="Position of channels"), flag=wx.LEFT, border=5)
		self.chanel_positions_ctrl = wx.TextCtrl (self, value="", style=wx.TE_MULTILINE|wx.EXPAND)
		self.chanel_positions_ctrl.__label__ = "chanel_positions"
		sizer.Add (self.chanel_positions_ctrl, flag=wx.EXPAND, border=5)
		
		# Spacer
		sizer.Add (wx.StaticText(self), flag=wx.LEFT, border=5)
		
		##################### Parameters for automatic calibration #######################
		
		sb_sizer = wx.StaticBoxSizer( wx.StaticBox(self, label="Automatic calibration"),  wx.VERTICAL )
		
		# Starting position for scanning
		sb_sizer.Add ( wx.StaticText(self, label="Beginning of scanning range (mm)") )
		init_scan_pos_ctrl = wxFloatSpin (self, increment=0.01, value=16, digits=3)
		init_scan_pos_ctrl.__label__ = "initial_scan_position"
		sb_sizer.Add (init_scan_pos_ctrl,  flag=wx.EXPAND, border=5)
		
		# Final position for scanning
		sb_sizer.Add ( wx.StaticText(self, label="End of scanning range (mm)") )
		fin_scan_pos_ctrl = wxFloatSpin (self, increment=0.01, value=80., digits=3)
		fin_scan_pos_ctrl.__label__ = "final_scan_position"
		sb_sizer.Add (fin_scan_pos_ctrl,  flag=wx.EXPAND, border=5)
		
		# Scanning step size
		sb_sizer.Add ( wx.StaticText(self, label="Scanning step size (mm)") )
		scan_step_size_ctrl = wxFloatSpin (self, increment=0.001, value=0.08,  digits=3, min_val=0.001, max_val=1)
		scan_step_size_ctrl.__label__ = "scan_step"
		sb_sizer.Add (scan_step_size_ctrl,  flag=wx.EXPAND, border=5)
		
		# Threshold to recognize peaks 
		sb_sizer.Add ( wx.StaticText(self, label="Background signal cut-off") )
		background_cutoff_ctrl = wxFloatSpin (self, increment=0.01, value=0.9, digits=3, min_val=0, max_val=1)
		background_cutoff_ctrl.__label__ = "background_cutoff"
		sb_sizer.Add (background_cutoff_ctrl,  flag=wx.EXPAND, border=5)
		
		# Methods to find peaks
		sb_sizer.Add ( wx.StaticText(self, label="Peak finding method") )
		self.peak_finders = { 
			"total fluoresce" 				: 
				lambda x : np.copy(x),
			"log(total fluoresce)"			: 
				lambda x : np.log10(x),
			"diff(total fluoresce)"			: 
				lambda x : gaussian_filter( np.abs(gaussian_filter(x, sigma=1, order=1)), sigma=1 ),
			"log(diff(total fluoresce))"	: 
				lambda x : gaussian_filter( np.log10(np.abs(gaussian_filter(x, sigma=1, order=1))), sigma=1 ),
			"diff(log(total fluoresce))"	: 
				lambda x : gaussian_filter( np.abs(gaussian_filter(np.log10(x), sigma=1, order=1)), sigma=1 )
		}
		choices = list(self.peak_finders.keys())
		peak_finder_ctrl = wx.ComboBox (self, choices=choices, value=choices[0], style=wx.CB_READONLY )
		peak_finder_ctrl.__label__ = "peak_finder"
		sb_sizer.Add (peak_finder_ctrl,  flag=wx.EXPAND, border=5)	
		
		# Spacer
		sb_sizer.Add (wx.StaticText(self), flag=wx.LEFT, border=5)
		
		# Calibrate button
		calibrate_button = wx.Button (self)
		calibrate_button._start_label ="Scan and calibrate"
		calibrate_button._stop_label ="STOP calibration"
		calibrate_button.SetLabel (calibrate_button._start_label)
		calibrate_button._start_method = self.CalibrateSampleSwitcher
		calibrate_button._stop_method = self.StopCalibration
		calibrate_button.Bind (wx.EVT_BUTTON, calibrate_button._start_method)
		sb_sizer.Add (calibrate_button,  flag=wx.EXPAND, border=5)	
		
		# Re-analysed calibration data
		analyse_button = wx.Button (self, label="Re-calibrate without scanning")
		analyse_button.Bind (wx.EVT_BUTTON, self.AnalyzeTotalFluorescence)
		sb_sizer.Add (analyse_button,  flag=wx.EXPAND, border=5)
		
		sizer.Add(sb_sizer, flag=wx.EXPAND, border=5)
		# Spacer
		sizer.Add (wx.StaticText(self), flag=wx.LEFT, border=5)
		##################### Parameters for automatic calibration #######################
		
		sb_sizer = wx.StaticBoxSizer( wx.StaticBox(self, label="Move to"),  wx.VERTICAL )
		
		sb_sizer.Add ( wx.StaticText(self, label="Position") )
		self.moving_stage_position_ctrl = wxFloatSpin (self, increment=0.01, value=80., digits=5)
		self.moving_stage_position_ctrl.__label__ = "move_to_position"
		sb_sizer.Add (self.moving_stage_position_ctrl,  flag=wx.EXPAND, border=5)
		
		# Update current position button
		def OnGetCurrentPosition (event) :
			if self.dev.Initialize( self.GetSettings() ) == RETURN_FAIL : return
			self.moving_stage_position_ctrl.SetValue( self.dev.GetCurrentPosition() )
		
		get_current_possition_button = wx.Button (self, label="Get current position")
		get_current_possition_button.Bind (wx.EVT_BUTTON, OnGetCurrentPosition)
		sb_sizer.Add (get_current_possition_button,  flag=wx.EXPAND, border=5)
		
		# Move-to position button
		def OnMoveTo (event) :
			if self.dev.Initialize( self.GetSettings() ) == RETURN_FAIL : return
			self.dev.MoveTo( self.moving_stage_position_ctrl.GetValue() )
			
		move_to_button = wx.Button (self, label="Go to")
		move_to_button.Bind (wx.EVT_BUTTON, OnMoveTo)
		sb_sizer.Add (move_to_button,  flag=wx.EXPAND, border=5)
		
		# Spacer
		sb_sizer.Add (wx.StaticText(self), flag=wx.LEFT, border=5)
		
		# Go to sample button
		def OnMoveToSample (event) :
			if self.dev.Initialize( self.GetSettings() ) == RETURN_FAIL : return
			button = event.GetEventObject()
			# Get current sample number
			label_split = button.GetLabel().split()
			sample_num = int(label_split[-1]) 
			# Get next sample number
			sample_num = (sample_num + 1) % self.dev.GetChannelNum()
			# Go to the sample
			self.dev.MoveToChannel( sample_num )
			# Update the label
			label_split[-1] = str(sample_num)
			button.SetLabel( " ".join(label_split) )
			
		move_to_sample = wx.Button (self, label="Go to sample 0")
		move_to_sample.Bind (wx.EVT_BUTTON, OnMoveToSample)
		sb_sizer.Add (move_to_sample,  flag=wx.EXPAND, border=5)
		
		sizer.Add(sb_sizer, flag=wx.EXPAND, border=5)
		###################################################################################
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		self.CreateSettingsDict()
Exemplo n.º 20
0
    def __init__(self, parent):

        HardwareGUIControl.__init__(self, parent)
        sizer = wx.BoxSizer(wx.VERTICAL)

        # Separator
        sizer.Add(wx.StaticText(self), border=5)

        # Pulse shaping options
        sizer.Add(wx.StaticText(self, label="Pulse shaping options"))
        pulse_shaping_options = {
            "amplitude only": (1, lambda ind: (ind, np.zeros(len(ind)))),
            "phase only": (1, lambda ind: (np.ones(len(ind)), ind)),
            "amplitude and phase": (2, lambda ind:
                                    (ind[:len(ind) / 2], ind[len(ind) / 2:]))
        }
        self.Ind_length, self.ind2pulse_shape = zip(
            *pulse_shaping_options.values())
        # Multiplicative factor to determine the number of optimization variables
        # controls the size of a single individual, which is equal to ind_len*self.num_pixels
        self.Ind_length = dict(
            zip(pulse_shaping_options.keys(), self.Ind_length))
        # Function converting GA individual to pulse shape
        self.ind2pulse_shape = dict(
            zip(pulse_shaping_options.keys(), self.ind2pulse_shape))

        choices = pulse_shaping_options.keys()
        pulse_shaping_ctrl = wx.ComboBox(self,
                                         choices=choices,
                                         value=choices[0],
                                         style=wx.CB_READONLY)
        pulse_shaping_ctrl.__label__ = "pulse_shaping_option"
        sizer.Add(pulse_shaping_ctrl, flag=wx.EXPAND, border=5)

        # Spectrum post-processing options
        sizer.Add(wx.StaticText(self,
                                label="Spectrum post-processing options"))
        choices = _SpectrumPostProcess.GetChoices()
        spectrum_options_ctrl = wx.ComboBox(self,
                                            choices=choices,
                                            value=choices[0],
                                            style=wx.CB_READONLY)
        spectrum_options_ctrl.__label__ = "spectrum_postprocess"
        sizer.Add(spectrum_options_ctrl, flag=wx.EXPAND, border=5)

        # Separator
        #sizer.Add (wx.StaticText(self), border=5)

        # Size of pixel bundle
        sizer.Add(wx.StaticText(self, label="\nPixels to bundle"),
                  flag=wx.EXPAND,
                  border=5)
        pixel_bundle_width = wx.SpinCtrl(self, value="1", min=1, max=640)
        pixel_bundle_width.__label__ = "pixel_bundle_width"
        sizer.Add(pixel_bundle_width, flag=wx.EXPAND, border=5)

        # Population size
        sizer.Add(wx.StaticText(self, label="Population size"),
                  flag=wx.LEFT,
                  border=5)
        population_size_ctrl = wx.SpinCtrl(self, value="10", min=1, max=100000)
        population_size_ctrl.__label__ = "population_size"
        sizer.Add(population_size_ctrl, flag=wx.EXPAND, border=5)

        # Separator
        sizer.Add(wx.StaticText(self), border=5)

        ########################################################################
        # Setting characterizing mutation
        ########################################################################

        # sizer.Add (wx.StaticText(self, label="Gaussian mutation:"), flag=wx.LEFT, border=5)

        sizer.Add(wx.StaticText(self, label="Gaussian mutation:\nMean"),
                  flag=wx.LEFT,
                  border=5)
        mu_ctrl = wxFloatSpin(self,
                              min_val=0,
                              max_val=1,
                              increment=0.01,
                              value=0.0,
                              digits=3)
        mu_ctrl.__label__ = "gaussian_mutation_mu"
        sizer.Add(mu_ctrl, flag=wx.EXPAND, border=5)

        sizer.Add(wx.StaticText(self, label="Sigma"), flag=wx.LEFT, border=5)
        sigma_ctrl = wxFloatSpin(self,
                                 min_val=0,
                                 max_val=1,
                                 increment=0.01,
                                 value=0.05,
                                 digits=3)
        sigma_ctrl.__label__ = "gaussian_mutation_sigma"
        sizer.Add(sigma_ctrl, flag=wx.EXPAND, border=5)

        sizer.Add(wx.StaticText(
            self, label="Independent  probability for attribute mutation"),
                  flag=wx.LEFT,
                  border=5)
        indpb_ctrl = wxFloatSpin(self,
                                 min_val=0,
                                 max_val=1,
                                 increment=0.01,
                                 value=1.,
                                 digits=3)
        indpb_ctrl.__label__ = "mutation_indpb"
        sizer.Add(indpb_ctrl, flag=wx.EXPAND, border=5)

        # Separator
        sizer.Add(wx.StaticText(self), border=5)

        # cxpb - The probability of mating two individuals
        sizer.Add(wx.StaticText(self, label="Mating probability"),
                  flag=wx.LEFT,
                  border=5)
        cxpb_ctrl = wxFloatSpin(self,
                                min_val=0,
                                max_val=1,
                                increment=0.01,
                                value=0.5,
                                digits=3)
        cxpb_ctrl.__label__ = "cxpb"
        sizer.Add(cxpb_ctrl, flag=wx.EXPAND, border=5)

        # mutpb - The probability of mutating an individuals
        sizer.Add(wx.StaticText(self, label="Mutating probability"),
                  flag=wx.LEFT,
                  border=5)
        mutpb_ctrl = wxFloatSpin(self,
                                 min_val=0,
                                 max_val=1,
                                 increment=0.01,
                                 value=0.1,
                                 digits=3)
        mutpb_ctrl.__label__ = "mutpb"
        sizer.Add(mutpb_ctrl, flag=wx.EXPAND, border=5)

        # Separator
        sizer.Add(wx.StaticText(self), border=5)

        # Record background signal
        background_signal_button = wx.Button(self, label="Record background")
        background_signal_button.Bind(wx.EVT_BUTTON, self.RecordBackground)
        sizer.Add(background_signal_button, flag=wx.EXPAND, border=5)

        # Coherently suppress fluorescence button
        self.max_shg_button = wx.Button(self)
        self.max_shg_button._start_label = "Start GA to maximize SHG"
        self.max_shg_button._start_method = partial(
            self.StartOptimization, DoGA=self.DoSingleIterGA_SHGMaximize)
        self.max_shg_button._stop_label = "STOP GA to maximize SHG"
        self.max_shg_button.SetLabel(self.max_shg_button._start_label)
        self.max_shg_button.Bind(wx.EVT_BUTTON,
                                 self.max_shg_button._start_method)
        sizer.Add(self.max_shg_button, flag=wx.EXPAND, border=5)

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################
        self.CreateSettingsDict()
Exemplo n.º 21
0
    def __init__(self, parent, dev):
        """
		`dev` is a sample switcher manager
		"""
        HardwareGUIControl.__init__(self, parent, dev)
        sizer = wx.BoxSizer(wx.VERTICAL)

        # Specify the communication port name
        sizer.Add(wx.StaticText(self, label="Communication port"),
                  flag=wx.LEFT,
                  border=5)
        port_name = wx.TextCtrl(self, value="COM1")
        port_name.__label__ = "port"
        sizer.Add(port_name, flag=wx.EXPAND, border=5)

        # List of positions of channels
        sizer.Add(wx.StaticText(self, label="Position of channels"),
                  flag=wx.LEFT,
                  border=5)
        self.chanel_positions_ctrl = wx.TextCtrl(self,
                                                 value="",
                                                 style=wx.TE_MULTILINE
                                                 | wx.EXPAND)
        self.chanel_positions_ctrl.__label__ = "chanel_positions"
        sizer.Add(self.chanel_positions_ctrl, flag=wx.EXPAND, border=5)

        # Spacer
        sizer.Add(wx.StaticText(self), flag=wx.LEFT, border=5)

        ##################### Parameters for automatic calibration #######################

        sb_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, label="Automatic calibration"), wx.VERTICAL)

        # Starting position for scanning
        sb_sizer.Add(
            wx.StaticText(self, label="Beginning of scanning range (mm)"))
        init_scan_pos_ctrl = wxFloatSpin(self,
                                         increment=0.01,
                                         value=16,
                                         digits=3)
        init_scan_pos_ctrl.__label__ = "initial_scan_position"
        sb_sizer.Add(init_scan_pos_ctrl, flag=wx.EXPAND, border=5)

        # Final position for scanning
        sb_sizer.Add(wx.StaticText(self, label="End of scanning range (mm)"))
        fin_scan_pos_ctrl = wxFloatSpin(self,
                                        increment=0.01,
                                        value=80.,
                                        digits=3)
        fin_scan_pos_ctrl.__label__ = "final_scan_position"
        sb_sizer.Add(fin_scan_pos_ctrl, flag=wx.EXPAND, border=5)

        # Scanning step size
        sb_sizer.Add(wx.StaticText(self, label="Scanning step size (mm)"))
        scan_step_size_ctrl = wxFloatSpin(self,
                                          increment=0.001,
                                          value=0.08,
                                          digits=3,
                                          min_val=0.001,
                                          max_val=1)
        scan_step_size_ctrl.__label__ = "scan_step"
        sb_sizer.Add(scan_step_size_ctrl, flag=wx.EXPAND, border=5)

        # Threshold to recognize peaks
        sb_sizer.Add(wx.StaticText(self, label="Background signal cut-off"))
        background_cutoff_ctrl = wxFloatSpin(self,
                                             increment=0.01,
                                             value=0.9,
                                             digits=3,
                                             min_val=0,
                                             max_val=1)
        background_cutoff_ctrl.__label__ = "background_cutoff"
        sb_sizer.Add(background_cutoff_ctrl, flag=wx.EXPAND, border=5)

        # Methods to find peaks
        sb_sizer.Add(wx.StaticText(self, label="Peak finding method"))
        self.peak_finders = {
            "total fluoresce":
            lambda x: np.copy(x),
            "log(total fluoresce)":
            lambda x: np.log10(x),
            "diff(total fluoresce)":
            lambda x: gaussian_filter(
                np.abs(gaussian_filter(x, sigma=1, order=1)), sigma=1),
            "log(diff(total fluoresce))":
            lambda x: gaussian_filter(np.log10(
                np.abs(gaussian_filter(x, sigma=1, order=1))),
                                      sigma=1),
            "diff(log(total fluoresce))":
            lambda x: gaussian_filter(np.abs(
                gaussian_filter(np.log10(x), sigma=1, order=1)),
                                      sigma=1)
        }
        choices = list(self.peak_finders.keys())
        peak_finder_ctrl = wx.ComboBox(self,
                                       choices=choices,
                                       value=choices[0],
                                       style=wx.CB_READONLY)
        peak_finder_ctrl.__label__ = "peak_finder"
        sb_sizer.Add(peak_finder_ctrl, flag=wx.EXPAND, border=5)

        # Spacer
        sb_sizer.Add(wx.StaticText(self), flag=wx.LEFT, border=5)

        # Calibrate button
        calibrate_button = wx.Button(self)
        calibrate_button._start_label = "Scan and calibrate"
        calibrate_button._stop_label = "STOP calibration"
        calibrate_button.SetLabel(calibrate_button._start_label)
        calibrate_button._start_method = self.CalibrateSampleSwitcher
        calibrate_button._stop_method = self.StopCalibration
        calibrate_button.Bind(wx.EVT_BUTTON, calibrate_button._start_method)
        sb_sizer.Add(calibrate_button, flag=wx.EXPAND, border=5)

        # Re-analysed calibration data
        analyse_button = wx.Button(self, label="Re-calibrate without scanning")
        analyse_button.Bind(wx.EVT_BUTTON, self.AnalyzeTotalFluorescence)
        sb_sizer.Add(analyse_button, flag=wx.EXPAND, border=5)

        sizer.Add(sb_sizer, flag=wx.EXPAND, border=5)
        # Spacer
        sizer.Add(wx.StaticText(self), flag=wx.LEFT, border=5)
        ##################### Parameters for automatic calibration #######################

        sb_sizer = wx.StaticBoxSizer(wx.StaticBox(self, label="Move to"),
                                     wx.VERTICAL)

        sb_sizer.Add(wx.StaticText(self, label="Position"))
        self.moving_stage_position_ctrl = wxFloatSpin(self,
                                                      increment=0.01,
                                                      value=80.,
                                                      digits=5)
        self.moving_stage_position_ctrl.__label__ = "move_to_position"
        sb_sizer.Add(self.moving_stage_position_ctrl, flag=wx.EXPAND, border=5)

        # Update current position button
        def OnGetCurrentPosition(event):
            if self.dev.Initialize(self.GetSettings()) == RETURN_FAIL: return
            self.moving_stage_position_ctrl.SetValue(
                self.dev.GetCurrentPosition())

        get_current_possition_button = wx.Button(self,
                                                 label="Get current position")
        get_current_possition_button.Bind(wx.EVT_BUTTON, OnGetCurrentPosition)
        sb_sizer.Add(get_current_possition_button, flag=wx.EXPAND, border=5)

        # Move-to position button
        def OnMoveTo(event):
            if self.dev.Initialize(self.GetSettings()) == RETURN_FAIL: return
            self.dev.MoveTo(self.moving_stage_position_ctrl.GetValue())

        move_to_button = wx.Button(self, label="Go to")
        move_to_button.Bind(wx.EVT_BUTTON, OnMoveTo)
        sb_sizer.Add(move_to_button, flag=wx.EXPAND, border=5)

        # Spacer
        sb_sizer.Add(wx.StaticText(self), flag=wx.LEFT, border=5)

        # Go to sample button
        def OnMoveToSample(event):
            if self.dev.Initialize(self.GetSettings()) == RETURN_FAIL: return
            button = event.GetEventObject()
            # Get current sample number
            label_split = button.GetLabel().split()
            sample_num = int(label_split[-1])
            # Get next sample number
            sample_num = (sample_num + 1) % self.dev.GetChannelNum()
            # Go to the sample
            self.dev.MoveToChannel(sample_num)
            # Update the label
            label_split[-1] = str(sample_num)
            button.SetLabel(" ".join(label_split))

        move_to_sample = wx.Button(self, label="Go to sample 0")
        move_to_sample.Bind(wx.EVT_BUTTON, OnMoveToSample)
        sb_sizer.Add(move_to_sample, flag=wx.EXPAND, border=5)

        sizer.Add(sb_sizer, flag=wx.EXPAND, border=5)
        ###################################################################################

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################
        self.CreateSettingsDict()
Exemplo n.º 22
0
    def __init__(self, parent):
        HardwareGUIControl.__init__(self, parent)

        sizer = wx.BoxSizer(wx.VERTICAL)

        # Starting pixel to calibrate
        sizer.Add(wx.StaticText(self, label="Initial pixel"),
                  flag=wx.LEFT,
                  border=5)
        initial_pixel_ctr = wx.SpinCtrl(self, value="0", min=0, max=640)
        initial_pixel_ctr.SetLabel("initial pixel")
        sizer.Add(initial_pixel_ctr, flag=wx.EXPAND, border=5)

        # Final pixel to calibrate
        sizer.Add(wx.StaticText(self, label="Final pixel"),
                  flag=wx.LEFT,
                  border=5)
        final_pixel_ctr = wx.SpinCtrl(self, value="640", min=0, max=640)
        final_pixel_ctr.SetLabel("final pixel")
        sizer.Add(final_pixel_ctr, flag=wx.EXPAND, border=5)

        # Size of pixel bundle
        sizer.Add(wx.StaticText(self, label="\nPixels to bundle"),
                  flag=wx.EXPAND,
                  border=5)
        self.pixel_bundle_width = wx.SpinCtrl(self, value="1", min=1, max=640)
        self.pixel_bundle_width.SetLabel("pixel bundle width")
        sizer.Add(self.pixel_bundle_width, flag=wx.EXPAND, border=5)

        # Correspondence between wavelength and pulse shaper pixel number
        # entered as dictionary without the "{}"
        sizer.Add(wx.StaticText(
            self,
            label=
            "\nPixel to wavelength entered as \n<pixel1> : <lambda1>,\n<pixel2> : <lambda2>, etc."
        ),
                  flag=wx.EXPAND,
                  border=5)
        pixel2lambda_ctrl = wx.TextCtrl(self,
                                        value="",
                                        style=wx.TE_MULTILINE | wx.EXPAND)
        pixel2lambda_ctrl.__label__ = "pixel_to_lamba"
        sizer.Add(pixel2lambda_ctrl, flag=wx.EXPAND, border=5)

        # Initial voltage
        sizer.Add(wx.StaticText(self, label="\nInitial voltage"),
                  flag=wx.LEFT,
                  border=5)
        initial_voltage_ctr = wx.SpinCtrl(self,
                                          value="500",
                                          min=0,
                                          max=PULSESHAPER_MAX_VAL)
        initial_voltage_ctr.SetLabel("initial voltage")
        sizer.Add(initial_voltage_ctr, flag=wx.EXPAND, border=5)

        # Final voltage
        sizer.Add(wx.StaticText(self, label="Final voltage"),
                  flag=wx.LEFT,
                  border=5)
        final_voltage_ctr = wx.SpinCtrl(self,
                                        value="800",
                                        min=0,
                                        max=PULSESHAPER_MAX_VAL)
        final_voltage_ctr.SetLabel("final voltage")
        sizer.Add(final_voltage_ctr, flag=wx.EXPAND, border=5)

        # Voltage step size
        sizer.Add(wx.StaticText(self, label="Voltage scanning step"),
                  flag=wx.LEFT,
                  border=5)
        voltage_step_ctr = wx.SpinCtrl(self,
                                       value="10",
                                       min=0,
                                       max=PULSESHAPER_MAX_VAL)
        voltage_step_ctr.SetLabel("voltage step")
        sizer.Add(voltage_step_ctr, flag=wx.EXPAND, border=5)

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################
        self.CreateSettingsDict()
Exemplo n.º 23
0
	def __init__(self, parent) :
		HardwareGUIControl.__init__(self, parent)
		
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		dw, dh = wx.DisplaySize()
		############################################################################
		#
		#	Geometry settings
		#
		############################################################################
		
		boxsizer = wx.StaticBoxSizer(wx.StaticBox(self, label="Scanning geometry"), wx.VERTICAL)	
	
		# Upper layer of points
		boxsizer.Add (wx.StaticText(self, label="Upper layer of points"), flag=wx.LEFT, border=5)
		self.upper_points_ctrl = wx.TextCtrl(self, style=wx.TE_MULTILINE, size=(0.1*dw, 0.15*dh))
		self.upper_points_ctrl.__label__ = "upper_points"
		boxsizer.Add(self.upper_points_ctrl)
		
		# Button to add point to upper layer
		add_upper_point_btn = wx.Button(self, label="Add point to upper layer")
		add_upper_point_btn.Bind( wx.EVT_BUTTON, 
					functools.partial(self.AddPoint, points_ctrl=self.upper_points_ctrl)
				)
		boxsizer.Add(add_upper_point_btn, flag=wx.EXPAND, border=5)
		
		# Lower layer of points
		boxsizer.Add (wx.StaticText(self, label="\nLower layer of points"), flag=wx.LEFT, border=5)
		self.lower_points_ctrl = wx.TextCtrl(self, style=wx.TE_MULTILINE, size=(0.1*dw, 0.15*dh))
		self.lower_points_ctrl.__label__ = "lower_points"
		boxsizer.Add(self.lower_points_ctrl)
		
		# Button to add point to lower layer
		add_lower_point_btn = wx.Button(self, label="Add point to lower layer")
		add_lower_point_btn.Bind( wx.EVT_BUTTON, 
					functools.partial(self.AddPoint, points_ctrl=self.lower_points_ctrl)
				)
		boxsizer.Add(add_lower_point_btn, flag=wx.EXPAND, border=5)
		
		# Initialize container for points and corresponding photos
		self.points = {}
		
		# Spacer
		boxsizer.Add (wx.StaticText(self, label=""), flag=wx.LEFT, border=5)
		
		# Delete all points button
		clear_all_points_btn = wx.Button(self, label="Delete all points")
		clear_all_points_btn.Bind (wx.EVT_BUTTON, self.ClearAllPoints)
		boxsizer.Add (clear_all_points_btn, flag=wx.EXPAND, border=5)
		
		sizer.Add (boxsizer, flag=wx.EXPAND, border=10)
		
		############################################################################
		#
		#	MySQL settings
		#
		############################################################################
		
		# Spacer
		sizer.Add (wx.StaticText(self, label=""), flag=wx.LEFT, border=5)
		
		boxsizer = wx.StaticBoxSizer(wx.StaticBox(self, label="My SQL settings"), wx.VERTICAL)
		
		# User 
		boxsizer.Add( wx.StaticText(self, label="User"), flag=wx.LEFT, border=5 )
		user_ctrl = wx.TextCtrl(self, value="fretmeter")
		user_ctrl.__label__ = "user"
		boxsizer.Add(user_ctrl, flag=wx.EXPAND, border=5)
		
		# Password
		boxsizer.Add( wx.StaticText(self, label="\nPassword"), flag=wx.LEFT, border=5 )
		password_ctrl = wx.TextCtrl(self, style=wx.TE_PASSWORD)
		password_ctrl.__label__ = "password"
		boxsizer.Add(password_ctrl, flag=wx.EXPAND, border=5)
		
		# Host
		boxsizer.Add( wx.StaticText(self, label="\nHost"), flag=wx.LEFT, border=5 )
		host_ctrl = wx.TextCtrl(self, value='localhost')
		host_ctrl.__label__ = "host"
		boxsizer.Add(host_ctrl, flag=wx.EXPAND, border=5)
		
		# Database
		boxsizer.Add( wx.StaticText(self, label="\nDatabase"), flag=wx.LEFT, border=5 )
		database_ctrl = wx.TextCtrl(self)
		database_ctrl.__label__ = "database"
		boxsizer.Add(database_ctrl, flag=wx.EXPAND, border=5)
		
		sizer.Add (boxsizer, flag=wx.EXPAND, border=10)
		
		# Spacer
		sizer.Add (wx.StaticText(self, label=""), flag=wx.LEFT, border=5)
		
		# Button to start scanning
		start_btn = wx.Button(self, label="Start scanning")
		start_btn.Bind(wx.EVT_BUTTON, self.StartScan)
		sizer.Add(start_btn, flag=wx.EXPAND, border=10)
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		
		self.CreateSettingsDict()
	def __init__ (self, parent) :
	
		HardwareGUIControl.__init__(self, parent)
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		######################################################################
		# List of positions of channels
		sizer.Add (wx.StaticText(self, label="Channel number with pure samples for learning"), flag=wx.LEFT, border=5)
		self.chanel_odd_experiment_ctrl = wx.TextCtrl (self, value="", style=wx.TE_MULTILINE|wx.EXPAND)
		self.chanel_odd_experiment_ctrl.__label__ = "channels"
		sizer.Add (self.chanel_odd_experiment_ctrl, flag=wx.EXPAND, border=5)
		
		# List of filters to be used in the motorized filter wheel
		sizer.Add (wx.StaticText(self, label="\nOptical filters in motorized wheel"), flag=wx.LEFT, border=5)
		self.filters_odd_experiment_ctrl = wx.TextCtrl (self, value="", style=wx.TE_MULTILINE|wx.EXPAND)
		self.filters_odd_experiment_ctrl.__label__ = "filters"
		sizer.Add (self.filters_odd_experiment_ctrl, flag=wx.EXPAND, border=5)
		
		# List of positions of channels_mixtures
		sizer.Add (wx.StaticText(self, label="\nChannel number to measure concentrations"), flag=wx.LEFT, border=5)
		self.channel_mixtues_ctrl = wx.TextCtrl (self, value="", style=wx.TE_MULTILINE|wx.EXPAND)
		self.channel_mixtues_ctrl.__label__ = "channels_mixtures"
		sizer.Add (self.channel_mixtues_ctrl, flag=wx.EXPAND, border=5)
		
		# Spectrum post-processing options
		sizer.Add ( wx.StaticText(self, label="\nSpectrum post-processing options") )
		choices = _SpectrumPostProcess.GetChoices()
		spectrum_options_ctrl = wx.ComboBox (self, choices=choices, value=choices[0], style=wx.CB_READONLY )
		spectrum_options_ctrl.__label__ = "spectrum_postprocess"
		sizer.Add (spectrum_options_ctrl,  flag=wx.EXPAND, border=5)	
		
		# Separator
		sizer.Add (wx.StaticText(self), border=5)
		
		# Record background signal
		background_signal_button = wx.Button (self, label="Record background")
		background_signal_button.Bind ( wx.EVT_BUTTON, self.RecordBackground )
		sizer.Add (background_signal_button, flag=wx.EXPAND, border=5)
		
		# Number of measurements taken sequentially
		sizer.Add (wx.StaticText(self, label="\nNumber of sequential measurements"), flag=wx.LEFT, border=5)
		num_seq_measurments_ctrl = wx.SpinCtrl (self, value="1", min=1)
		num_seq_measurments_ctrl.__label__ = "num_seq_measurments"
		sizer.Add (num_seq_measurments_ctrl, flag=wx.EXPAND, border=5)
		
		# Record spectra manually
		manualy_record_spectra_button = wx.Button (self, label="Manually record spectra")
		manualy_record_spectra_button.Bind( wx.EVT_BUTTON, self.ManualyRecordSpectra) 
		sizer.Add (manualy_record_spectra_button, flag=wx.EXPAND, border=5)
		
		# Measure concentration button
		measure_concentr_button = wx.Button (self)  
		measure_concentr_button._start_label 	= "Measure concentration"
		measure_concentr_button._start_method 	= self.MeasureConcentration
		measure_concentr_button._stop_label 	= "STOP measuring concentration"
		measure_concentr_button._stop_method 	= self.Stop_MeasureConcentration
		measure_concentr_button.SetLabel (measure_concentr_button._start_label)
		measure_concentr_button.Bind (wx.EVT_BUTTON, measure_concentr_button._start_method)
		sizer.Add(measure_concentr_button, flag=wx.EXPAND, border=5) 
		
		######################################################################
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		self.CreateSettingsDict()
Exemplo n.º 25
0
    def __init__(self, parent):
        HardwareGUIControl.__init__(self, parent)

        sizer = wx.BoxSizer(wx.VERTICAL)

        dw, dh = wx.DisplaySize()
        ############################################################################
        #
        #	Geometry settings
        #
        ############################################################################

        boxsizer = wx.StaticBoxSizer(
            wx.StaticBox(self, label="Scanning geometry"), wx.VERTICAL)

        # Upper layer of points
        boxsizer.Add(wx.StaticText(self, label="Upper layer of points"),
                     flag=wx.LEFT,
                     border=5)
        self.upper_points_ctrl = wx.TextCtrl(self,
                                             style=wx.TE_MULTILINE,
                                             size=(0.1 * dw, 0.15 * dh))
        self.upper_points_ctrl.__label__ = "upper_points"
        boxsizer.Add(self.upper_points_ctrl)

        # Button to add point to upper layer
        add_upper_point_btn = wx.Button(self, label="Add point to upper layer")
        add_upper_point_btn.Bind(
            wx.EVT_BUTTON,
            functools.partial(self.AddPoint,
                              points_ctrl=self.upper_points_ctrl))
        boxsizer.Add(add_upper_point_btn, flag=wx.EXPAND, border=5)

        # Lower layer of points
        boxsizer.Add(wx.StaticText(self, label="\nLower layer of points"),
                     flag=wx.LEFT,
                     border=5)
        self.lower_points_ctrl = wx.TextCtrl(self,
                                             style=wx.TE_MULTILINE,
                                             size=(0.1 * dw, 0.15 * dh))
        self.lower_points_ctrl.__label__ = "lower_points"
        boxsizer.Add(self.lower_points_ctrl)

        # Button to add point to lower layer
        add_lower_point_btn = wx.Button(self, label="Add point to lower layer")
        add_lower_point_btn.Bind(
            wx.EVT_BUTTON,
            functools.partial(self.AddPoint,
                              points_ctrl=self.lower_points_ctrl))
        boxsizer.Add(add_lower_point_btn, flag=wx.EXPAND, border=5)

        # Initialize container for points and corresponding photos
        self.points = {}

        # Spacer
        boxsizer.Add(wx.StaticText(self, label=""), flag=wx.LEFT, border=5)

        # Delete all points button
        clear_all_points_btn = wx.Button(self, label="Delete all points")
        clear_all_points_btn.Bind(wx.EVT_BUTTON, self.ClearAllPoints)
        boxsizer.Add(clear_all_points_btn, flag=wx.EXPAND, border=5)

        sizer.Add(boxsizer, flag=wx.EXPAND, border=10)

        ############################################################################
        #
        #	MySQL settings
        #
        ############################################################################

        # Spacer
        sizer.Add(wx.StaticText(self, label=""), flag=wx.LEFT, border=5)

        boxsizer = wx.StaticBoxSizer(
            wx.StaticBox(self, label="My SQL settings"), wx.VERTICAL)

        # User
        boxsizer.Add(wx.StaticText(self, label="User"), flag=wx.LEFT, border=5)
        user_ctrl = wx.TextCtrl(self, value="fretmeter")
        user_ctrl.__label__ = "user"
        boxsizer.Add(user_ctrl, flag=wx.EXPAND, border=5)

        # Password
        boxsizer.Add(wx.StaticText(self, label="\nPassword"),
                     flag=wx.LEFT,
                     border=5)
        password_ctrl = wx.TextCtrl(self, style=wx.TE_PASSWORD)
        password_ctrl.__label__ = "password"
        boxsizer.Add(password_ctrl, flag=wx.EXPAND, border=5)

        # Host
        boxsizer.Add(wx.StaticText(self, label="\nHost"),
                     flag=wx.LEFT,
                     border=5)
        host_ctrl = wx.TextCtrl(self, value='localhost')
        host_ctrl.__label__ = "host"
        boxsizer.Add(host_ctrl, flag=wx.EXPAND, border=5)

        # Database
        boxsizer.Add(wx.StaticText(self, label="\nDatabase"),
                     flag=wx.LEFT,
                     border=5)
        database_ctrl = wx.TextCtrl(self)
        database_ctrl.__label__ = "database"
        boxsizer.Add(database_ctrl, flag=wx.EXPAND, border=5)

        sizer.Add(boxsizer, flag=wx.EXPAND, border=10)

        # Spacer
        sizer.Add(wx.StaticText(self, label=""), flag=wx.LEFT, border=5)

        # Button to start scanning
        start_btn = wx.Button(self, label="Start scanning")
        start_btn.Bind(wx.EVT_BUTTON, self.StartScan)
        sizer.Add(start_btn, flag=wx.EXPAND, border=10)

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################

        self.CreateSettingsDict()
    def __init__(self, parent):

        HardwareGUIControl.__init__(self, parent)
        sizer = wx.BoxSizer(wx.VERTICAL)

        ######################################################################
        # List of positions of channels
        sizer.Add(wx.StaticText(
            self, label="Channel number with pure samples for learning"),
                  flag=wx.LEFT,
                  border=5)
        self.chanel_odd_experiment_ctrl = wx.TextCtrl(self,
                                                      value="",
                                                      style=wx.TE_MULTILINE
                                                      | wx.EXPAND)
        self.chanel_odd_experiment_ctrl.__label__ = "channels"
        sizer.Add(self.chanel_odd_experiment_ctrl, flag=wx.EXPAND, border=5)

        # List of filters to be used in the motorized filter wheel
        sizer.Add(wx.StaticText(self,
                                label="\nOptical filters in motorized wheel"),
                  flag=wx.LEFT,
                  border=5)
        self.filters_odd_experiment_ctrl = wx.TextCtrl(self,
                                                       value="",
                                                       style=wx.TE_MULTILINE
                                                       | wx.EXPAND)
        self.filters_odd_experiment_ctrl.__label__ = "filters"
        sizer.Add(self.filters_odd_experiment_ctrl, flag=wx.EXPAND, border=5)

        # List of positions of channels_mixtures
        sizer.Add(wx.StaticText(
            self, label="\nChannel number to measure concentrations"),
                  flag=wx.LEFT,
                  border=5)
        self.channel_mixtues_ctrl = wx.TextCtrl(self,
                                                value="",
                                                style=wx.TE_MULTILINE
                                                | wx.EXPAND)
        self.channel_mixtues_ctrl.__label__ = "channels_mixtures"
        sizer.Add(self.channel_mixtues_ctrl, flag=wx.EXPAND, border=5)

        # Spectrum post-processing options
        sizer.Add(
            wx.StaticText(self, label="\nSpectrum post-processing options"))
        choices = _SpectrumPostProcess.GetChoices()
        spectrum_options_ctrl = wx.ComboBox(self,
                                            choices=choices,
                                            value=choices[0],
                                            style=wx.CB_READONLY)
        spectrum_options_ctrl.__label__ = "spectrum_postprocess"
        sizer.Add(spectrum_options_ctrl, flag=wx.EXPAND, border=5)

        # Separator
        sizer.Add(wx.StaticText(self), border=5)

        # Record background signal
        background_signal_button = wx.Button(self, label="Record background")
        background_signal_button.Bind(wx.EVT_BUTTON, self.RecordBackground)
        sizer.Add(background_signal_button, flag=wx.EXPAND, border=5)

        # Number of measurements taken sequentially
        sizer.Add(wx.StaticText(self,
                                label="\nNumber of sequential measurements"),
                  flag=wx.LEFT,
                  border=5)
        num_seq_measurments_ctrl = wx.SpinCtrl(self, value="1", min=1)
        num_seq_measurments_ctrl.__label__ = "num_seq_measurments"
        sizer.Add(num_seq_measurments_ctrl, flag=wx.EXPAND, border=5)

        # Record spectra manually
        manualy_record_spectra_button = wx.Button(
            self, label="Manually record spectra")
        manualy_record_spectra_button.Bind(wx.EVT_BUTTON,
                                           self.ManualyRecordSpectra)
        sizer.Add(manualy_record_spectra_button, flag=wx.EXPAND, border=5)

        # Measure concentration button
        measure_concentr_button = wx.Button(self)
        measure_concentr_button._start_label = "Measure concentration"
        measure_concentr_button._start_method = self.MeasureConcentration
        measure_concentr_button._stop_label = "STOP measuring concentration"
        measure_concentr_button._stop_method = self.Stop_MeasureConcentration
        measure_concentr_button.SetLabel(measure_concentr_button._start_label)
        measure_concentr_button.Bind(wx.EVT_BUTTON,
                                     measure_concentr_button._start_method)
        sizer.Add(measure_concentr_button, flag=wx.EXPAND, border=5)

        ######################################################################

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################
        self.CreateSettingsDict()
Exemplo n.º 27
0
	def __init__ (self, parent) :
	
		HardwareGUIControl.__init__(self, parent)
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		# Separator
		sizer.Add (wx.StaticText(self), border=5)
		
		# Pulse shaping options
		sizer.Add ( wx.StaticText(self, label="Pulse shaping options") )
		pulse_shaping_options = {
			"amplitude only"		: 
				( 1, lambda ind : ( ind, np.zeros(len(ind)) ) ),
			"phase only"			: 
				( 1, lambda ind : ( np.ones(len(ind)), ind ) ),
			"amplitude and phase"	: 
				( 2, lambda ind : ( ind[:len(ind)/2], ind[len(ind)/2:] ) )
		} 
		self.Ind_length, self.ind2pulse_shape = zip(*pulse_shaping_options.values())
		# Multiplicative factor to determine the number of optimization variables  
		# controls the size of a single individual, which is equal to ind_len*self.num_pixels
		self.Ind_length 		= dict( zip(pulse_shaping_options.keys(), self.Ind_length) )
		# Function converting GA individual to pulse shape 
		self.ind2pulse_shape	= dict( zip(pulse_shaping_options.keys(), self.ind2pulse_shape) )
		
		choices = pulse_shaping_options.keys()
		pulse_shaping_ctrl = wx.ComboBox (self, choices=choices, value=choices[0], style=wx.CB_READONLY )
		pulse_shaping_ctrl.__label__ = "pulse_shaping_option"
		sizer.Add (pulse_shaping_ctrl,  flag=wx.EXPAND, border=5)	
		
		# Spectrum post-processing options
		sizer.Add ( wx.StaticText(self, label="Spectrum post-processing options") )
		choices = _SpectrumPostProcess.GetChoices()
		spectrum_options_ctrl = wx.ComboBox (self, choices=choices, value=choices[0], style=wx.CB_READONLY )
		spectrum_options_ctrl.__label__ = "spectrum_postprocess"
		sizer.Add (spectrum_options_ctrl,  flag=wx.EXPAND, border=5)	
		
		
		# Separator
		#sizer.Add (wx.StaticText(self), border=5)
		
		
		# Size of pixel bundle
		sizer.Add (wx.StaticText(self, label="\nPixels to bundle"), flag=wx.EXPAND, border=5)
		pixel_bundle_width = wx.SpinCtrl(self, value="1", min=1, max=640)
		pixel_bundle_width.__label__ = "pixel_bundle_width"
		sizer.Add (pixel_bundle_width, flag=wx.EXPAND, border=5)
		
		# Population size
		sizer.Add (wx.StaticText(self, label="Population size"), flag=wx.LEFT, border=5)
		population_size_ctrl  = wx.SpinCtrl (self, value="10", min=1, max=100000)
		population_size_ctrl.__label__ = "population_size"
		sizer.Add (population_size_ctrl , flag=wx.EXPAND, border=5)
		
		# Separator
		sizer.Add (wx.StaticText(self), border=5)
			
		########################################################################
		# Setting characterizing mutation
		########################################################################
	
		# sizer.Add (wx.StaticText(self, label="Gaussian mutation:"), flag=wx.LEFT, border=5)
		
		sizer.Add (wx.StaticText(self, label="Gaussian mutation:\nMean"), flag=wx.LEFT, border=5)
		mu_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=0.0, digits=3)
		mu_ctrl.__label__ = "gaussian_mutation_mu"
		sizer.Add (mu_ctrl , flag=wx.EXPAND, border=5)
		
		sizer.Add (wx.StaticText(self, label="Sigma"), flag=wx.LEFT, border=5)
		sigma_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=0.05, digits=3)
		sigma_ctrl.__label__ = "gaussian_mutation_sigma"
		sizer.Add (sigma_ctrl , flag=wx.EXPAND, border=5)
	
		sizer.Add (wx.StaticText(self, label="Independent  probability for attribute mutation"), flag=wx.LEFT, border=5)
		indpb_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=1., digits=3)
		indpb_ctrl.__label__ = "mutation_indpb"
		sizer.Add (indpb_ctrl, flag=wx.EXPAND, border=5)	
			
		# Separator
		sizer.Add (wx.StaticText(self), border=5)

		# cxpb - The probability of mating two individuals 
		sizer.Add (wx.StaticText(self, label="Mating probability"), flag=wx.LEFT, border=5)
		cxpb_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=0.5, digits=3)
		cxpb_ctrl.__label__ = "cxpb"
		sizer.Add (cxpb_ctrl, flag=wx.EXPAND, border=5)
		
		# mutpb - The probability of mutating an individuals
		sizer.Add (wx.StaticText(self, label="Mutating probability"), flag=wx.LEFT, border=5)
		mutpb_ctrl = wxFloatSpin (self, min_val=0, max_val=1, increment=0.01, value=0.1, digits=3)
		mutpb_ctrl.__label__ = "mutpb"
		sizer.Add (mutpb_ctrl, flag=wx.EXPAND, border=5)
		
		# Separator
		sizer.Add (wx.StaticText(self), border=5)
		
		# Record background signal
		background_signal_button = wx.Button (self, label="Record background")
		background_signal_button.Bind ( wx.EVT_BUTTON, self.RecordBackground )
		sizer.Add (background_signal_button, flag=wx.EXPAND, border=5)
		
		
		# Coherently suppress fluorescence button
		self.max_shg_button = wx.Button (self)
		self.max_shg_button._start_label = "Start GA to maximize SHG" 
		self.max_shg_button._start_method = partial(self.StartOptimization, DoGA=self.DoSingleIterGA_SHGMaximize)
		self.max_shg_button._stop_label = "STOP GA to maximize SHG"
		self.max_shg_button.SetLabel (self.max_shg_button._start_label)
		self.max_shg_button.Bind( wx.EVT_BUTTON, self.max_shg_button._start_method )
		sizer.Add(self.max_shg_button, flag=wx.EXPAND, border=5)
		
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		self.CreateSettingsDict()
Exemplo n.º 28
0
	def __init__ (self, parent) :
		
		HardwareGUIControl.__init__(self, parent)
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		sizer.Add (wx.StaticText(self, label="\nMax amplitude (ND filter)"), flag=wx.LEFT, border=5)
		max_ampl_ctrl = wxFloatSpin(self, min_val=0, max_val=1, increment=0.01, value=1., digits=3)
		max_ampl_ctrl.__label__ = "max_ampl"
		sizer.Add (max_ampl_ctrl , flag=wx.EXPAND, border=5)
		
		# Separator
		sizer.Add (wx.StaticText(self), border=5)
		
		################ Parameters of reference mask ####################
		sb_sizer = wx.StaticBoxSizer( wx.StaticBox(self, label="Reference mask parameters: "),  wx.VERTICAL )
		
		# Min value of coefficient
		sb_sizer.Add (wx.StaticText(self, label="min coefficient"), flag=wx.LEFT, border=5)
		coeff_min_ctrl = wxFloatSpin (self, min_val=-10, max_val=10, increment=0.01, value=-0.9, digits=3)
		coeff_min_ctrl.__label__ = "coeff_min"
		sb_sizer.Add (coeff_min_ctrl , flag=wx.EXPAND, border=5)
		
		# Max value of coefficient
		sb_sizer.Add (wx.StaticText(self, label="max coefficient"), flag=wx.LEFT, border=5)
		coeff_max_ctrl = wxFloatSpin (self, min_val=0, max_val=10, increment=0.01, value=0.9, digits=3)
		coeff_max_ctrl.__label__ = "coeff_max"
		sb_sizer.Add (coeff_max_ctrl , flag=wx.EXPAND, border=5)
		
		# Number of coeff scans
		sb_sizer.Add (wx.StaticText(self, label="number of scans"), flag=wx.LEFT, border=5)
		coeff_num_ctrl = wx.SpinCtrl (self, value="20", min=10, max=100000)
		coeff_num_ctrl.__label__ = "coeff_num"
		sb_sizer.Add (coeff_num_ctrl , flag=wx.EXPAND, border=5)
		
		# Polynomial basis type
		sb_sizer.Add (wx.StaticText(self, label="\nPolynomial basis type"), flag=wx.LEFT, border=5)
		self.polynomial_bases = {
			"Chebyshev"	:	np.polynomial.chebyshev.Chebyshev,
			"Legendre"	:	np.polynomial.legendre.Legendre,
			"Laguerre"	:	np.polynomial.laguerre.Laguerre,
			"Hermite"	:	np.polynomial.hermite.Hermite,
			"Monomials" :	np.polynomial.polynomial.Polynomial
		}  
		choices = self.polynomial_bases.keys()
		polynomial_bais_ctrl = wx.ComboBox (self, choices=choices, value=choices[0], style=wx.CB_READONLY )
		polynomial_bais_ctrl.__label__ = "polynomial_basis"
		sb_sizer.Add (polynomial_bais_ctrl,  flag=wx.EXPAND, border=5)
		
		# Polynomial order
		sb_sizer.Add (wx.StaticText(self, label="\npolynomial order"), flag=wx.LEFT, border=5)
		poly_order_ctrl = wx.SpinCtrl (self, value="2", min=0, max=100000)
		poly_order_ctrl.__label__ = "polynomial_order"
		sb_sizer.Add (poly_order_ctrl , flag=wx.EXPAND, border=5)
		
		sizer.Add (sb_sizer, flag=wx.EXPAND, border=10)
		################################################
		
		# Scan button
		self.get_coeff_scan_btn = wx.Button (self)
		self.get_coeff_scan_btn._start_label  = "Scan polynomial coefficient"
		self.get_coeff_scan_btn._start_method = self.GetDeltaScan
		self.get_coeff_scan_btn._stop_label  = "STOP scanning"
		self.get_coeff_scan_btn._stop_method = self.StopScannning
		self.get_coeff_scan_btn.SetLabel( self.get_coeff_scan_btn._start_label )
		self.get_coeff_scan_btn.Bind( wx.EVT_BUTTON, self.get_coeff_scan_btn._start_method )
		sizer.Add (self.get_coeff_scan_btn, flag=wx.EXPAND, border=5)
		
		# Separator
		sizer.Add (wx.StaticText(self), border=5)
		
		# Select current value of coefficient 
		sizer.Add (wx.StaticText(self, label="Value of current coefficient"), flag=wx.LEFT, border=5)
		self.current_coeff_val = wxFloatSpin (self, min_val=-10, max_val=10, increment=0.01, value=0., digits=3)
		self.current_coeff_val.__label__ = "current_coeff_val"
		sizer.Add (self.current_coeff_val , flag=wx.EXPAND, border=5)
		
		# Button to add the correction
		correct_phase = wx.Button (self, label="Add correction")
		correct_phase.Bind( wx.EVT_BUTTON, self.AddCurrentCorrection )
		sizer.Add (correct_phase, flag=wx.EXPAND, border=5)
		
		# Separator
		sizer.Add (wx.StaticText(self), border=5)
		
		# Buttons to save correcting procedure
		save_correction_log = wx.Button (self, label="Save correction log")
		save_correction_log.Bind( wx.EVT_BUTTON, self.SaveCorrectionLog )
		sizer.Add (save_correction_log, flag=wx.EXPAND, border=5)
		
		# Buttons to plot reference phase
		plot_reference_phase = wx.Button (self, label="Plot reference phase")
		plot_reference_phase.Bind( wx.EVT_BUTTON, self.PlotReferencePhase  )
		sizer.Add (plot_reference_phase, flag=wx.EXPAND, border=5)
		
		# Buttons to copy reference phase to clipboard
		reference_phase2clipboard = wx.Button (self, label="Copy reference phase to clipboard")
		reference_phase2clipboard.Bind( wx.EVT_BUTTON, self.ReferencePhase2Clipboard  )
		sizer.Add (reference_phase2clipboard, flag=wx.EXPAND, border=5)
		
		# Separator
		sizer.Add (wx.StaticText(self), border=5)
		
		# Clear all button
		clear_all = wx.Button (self, label="Clear all")
		clear_all.Bind( wx.EVT_BUTTON, self.ClearAllData )
		sizer.Add (clear_all, flag=wx.EXPAND, border=5)
		
		# Clear all info
		self.ClearAllData (None)
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		self.CreateSettingsDict()
	def __init__(self, parent, dev) :
		HardwareGUIControl.__init__(self, parent, dev)
		
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		################################################
		
		sizer.Add (wx.StaticText(self, label="Exposure time (millisecond)"), flag=wx.LEFT, border=5)
		exposure_time_ctr = wx.SpinCtrl (self, value="20", min=1, max=1e6)
		exposure_time_ctr.SetLabel("Exposure time")
		sizer.Add (exposure_time_ctr, flag=wx.EXPAND, border=5)
		
		################################################
		
		sizer.Add (wx.StaticText(self, label="Scans to average"), flag=wx.LEFT, border=5)
		scans_average_ctr = wx.SpinCtrl (self, value="1", min=1, max=1e6)
		scans_average_ctr.SetLabel("scans_average")
		sizer.Add (scans_average_ctr, flag=wx.EXPAND, border=5)
		
		################################################
		
		sizer.Add (wx.StaticText(self, label="\nStart wavelength (nm)"), flag=wx.LEFT, border=5)
		start_wavelength_ctr = wx.SpinCtrl (self, value="196", min=1, max=1e6)
		#start_wavelength_ctr = wx.SpinCtrl (self, value="580", min=1, max=1e6)
		start_wavelength_ctr.SetLabel("start_wavelength")
		sizer.Add (start_wavelength_ctr, flag=wx.EXPAND, border=5)
		
		################################################
		
		sizer.Add (wx.StaticText(self, label="End wavelength (nm)"), flag=wx.LEFT, border=5)
		end_wavelength_ctr = wx.SpinCtrl (self, value="1118", min=1, max=1e6)
		#end_wavelength_ctr = wx.SpinCtrl (self, value="680", min=1, max=1e6)
		end_wavelength_ctr.SetLabel("end_wavelength")
		sizer.Add (end_wavelength_ctr, flag=wx.EXPAND, border=5)
		
		############  Parameters for displaying spectrum #############
		# Spacer
		sizer.Add (wx.StaticText(self), flag=wx.LEFT, border=5)

		sb_sizer = wx.StaticBoxSizer( wx.StaticBox(self, label="Plotting options"),  wx.VERTICAL )
		
		fix_vert_ax_ctrl = wx.CheckBox(self, label="Fix vertical axis")
		fix_vert_ax_ctrl.__label__ = "fix_vertical_axis"
		sb_sizer.Add (fix_vert_ax_ctrl, flag=wx.EXPAND, border=5)
		
		sb_sizer.Add (wx.StaticText(self, label="max val"), flag=wx.LEFT, border=5)
		max_val_ctr = wx.SpinCtrl (self, value="50000", min=1, max=1e6)
		max_val_ctr.SetLabel("vertical_axis_max_val")
		sb_sizer.Add (max_val_ctr, flag=wx.EXPAND, border=5)
		
		sb_sizer.Add (wx.StaticText(self, label="min val"), flag=wx.LEFT, border=5)
		min_val_ctr = wx.SpinCtrl (self, value="100", min=1, max=1e6)
		min_val_ctr.SetLabel("vertical_axis_min_val")
		sb_sizer.Add (min_val_ctr, flag=wx.EXPAND, border=5)
		
		sizer.Add (sb_sizer, flag=wx.EXPAND, border=5)
		################################################
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		
		self.CreateSettingsDict()
Exemplo n.º 30
0
    def __init__(self, parent):

        HardwareGUIControl.__init__(self, parent)
        sizer = wx.BoxSizer(wx.VERTICAL)

        sizer.Add(wx.StaticText(self, label="\nMax amplitude (ND filter)"),
                  flag=wx.LEFT,
                  border=5)
        max_ampl_ctrl = wxFloatSpin(self,
                                    min_val=0,
                                    max_val=1,
                                    increment=0.01,
                                    value=1.,
                                    digits=3)
        max_ampl_ctrl.__label__ = "max_ampl"
        sizer.Add(max_ampl_ctrl, flag=wx.EXPAND, border=5)

        # Separator
        sizer.Add(wx.StaticText(self), border=5)

        ################ Parameters of reference mask ####################
        sb_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, label="Reference mask parameters: "),
            wx.VERTICAL)

        # Min value of coefficient
        sb_sizer.Add(wx.StaticText(self, label="min coefficient"),
                     flag=wx.LEFT,
                     border=5)
        coeff_min_ctrl = wxFloatSpin(self,
                                     min_val=-10,
                                     max_val=10,
                                     increment=0.01,
                                     value=-0.9,
                                     digits=3)
        coeff_min_ctrl.__label__ = "coeff_min"
        sb_sizer.Add(coeff_min_ctrl, flag=wx.EXPAND, border=5)

        # Max value of coefficient
        sb_sizer.Add(wx.StaticText(self, label="max coefficient"),
                     flag=wx.LEFT,
                     border=5)
        coeff_max_ctrl = wxFloatSpin(self,
                                     min_val=0,
                                     max_val=10,
                                     increment=0.01,
                                     value=0.9,
                                     digits=3)
        coeff_max_ctrl.__label__ = "coeff_max"
        sb_sizer.Add(coeff_max_ctrl, flag=wx.EXPAND, border=5)

        # Number of coeff scans
        sb_sizer.Add(wx.StaticText(self, label="number of scans"),
                     flag=wx.LEFT,
                     border=5)
        coeff_num_ctrl = wx.SpinCtrl(self, value="20", min=10, max=100000)
        coeff_num_ctrl.__label__ = "coeff_num"
        sb_sizer.Add(coeff_num_ctrl, flag=wx.EXPAND, border=5)

        # Polynomial basis type
        sb_sizer.Add(wx.StaticText(self, label="\nPolynomial basis type"),
                     flag=wx.LEFT,
                     border=5)
        self.polynomial_bases = {
            "Chebyshev": np.polynomial.chebyshev.Chebyshev,
            "Legendre": np.polynomial.legendre.Legendre,
            "Laguerre": np.polynomial.laguerre.Laguerre,
            "Hermite": np.polynomial.hermite.Hermite,
            "Monomials": np.polynomial.polynomial.Polynomial
        }
        choices = self.polynomial_bases.keys()
        polynomial_bais_ctrl = wx.ComboBox(self,
                                           choices=choices,
                                           value=choices[0],
                                           style=wx.CB_READONLY)
        polynomial_bais_ctrl.__label__ = "polynomial_basis"
        sb_sizer.Add(polynomial_bais_ctrl, flag=wx.EXPAND, border=5)

        # Polynomial order
        sb_sizer.Add(wx.StaticText(self, label="\npolynomial order"),
                     flag=wx.LEFT,
                     border=5)
        poly_order_ctrl = wx.SpinCtrl(self, value="2", min=0, max=100000)
        poly_order_ctrl.__label__ = "polynomial_order"
        sb_sizer.Add(poly_order_ctrl, flag=wx.EXPAND, border=5)

        sizer.Add(sb_sizer, flag=wx.EXPAND, border=10)
        ################################################

        # Scan button
        self.get_coeff_scan_btn = wx.Button(self)
        self.get_coeff_scan_btn._start_label = "Scan polynomial coefficient"
        self.get_coeff_scan_btn._start_method = self.GetDeltaScan
        self.get_coeff_scan_btn._stop_label = "STOP scanning"
        self.get_coeff_scan_btn._stop_method = self.StopScannning
        self.get_coeff_scan_btn.SetLabel(self.get_coeff_scan_btn._start_label)
        self.get_coeff_scan_btn.Bind(wx.EVT_BUTTON,
                                     self.get_coeff_scan_btn._start_method)
        sizer.Add(self.get_coeff_scan_btn, flag=wx.EXPAND, border=5)

        # Separator
        sizer.Add(wx.StaticText(self), border=5)

        # Select current value of coefficient
        sizer.Add(wx.StaticText(self, label="Value of current coefficient"),
                  flag=wx.LEFT,
                  border=5)
        self.current_coeff_val = wxFloatSpin(self,
                                             min_val=-10,
                                             max_val=10,
                                             increment=0.01,
                                             value=0.,
                                             digits=3)
        self.current_coeff_val.__label__ = "current_coeff_val"
        sizer.Add(self.current_coeff_val, flag=wx.EXPAND, border=5)

        # Button to add the correction
        correct_phase = wx.Button(self, label="Add correction")
        correct_phase.Bind(wx.EVT_BUTTON, self.AddCurrentCorrection)
        sizer.Add(correct_phase, flag=wx.EXPAND, border=5)

        # Separator
        sizer.Add(wx.StaticText(self), border=5)

        # Buttons to save correcting procedure
        save_correction_log = wx.Button(self, label="Save correction log")
        save_correction_log.Bind(wx.EVT_BUTTON, self.SaveCorrectionLog)
        sizer.Add(save_correction_log, flag=wx.EXPAND, border=5)

        # Buttons to plot reference phase
        plot_reference_phase = wx.Button(self, label="Plot reference phase")
        plot_reference_phase.Bind(wx.EVT_BUTTON, self.PlotReferencePhase)
        sizer.Add(plot_reference_phase, flag=wx.EXPAND, border=5)

        # Buttons to copy reference phase to clipboard
        reference_phase2clipboard = wx.Button(
            self, label="Copy reference phase to clipboard")
        reference_phase2clipboard.Bind(wx.EVT_BUTTON,
                                       self.ReferencePhase2Clipboard)
        sizer.Add(reference_phase2clipboard, flag=wx.EXPAND, border=5)

        # Separator
        sizer.Add(wx.StaticText(self), border=5)

        # Clear all button
        clear_all = wx.Button(self, label="Clear all")
        clear_all.Bind(wx.EVT_BUTTON, self.ClearAllData)
        sizer.Add(clear_all, flag=wx.EXPAND, border=5)

        # Clear all info
        self.ClearAllData(None)

        self.SetSizer(sizer)
        ############### GUI is created, now generate settings ######################
        self.CreateSettingsDict()
Exemplo n.º 31
0
	def __init__ (self, parent) :
		HardwareGUIControl.__init__(self, parent)
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		# List of positions of channels
		sizer.Add (wx.StaticText(self, label="Channel number with pure samples for learning"), flag=wx.LEFT, border=5)
		self.chanel_odd_experiment_ctrl = wx.TextCtrl (self, value="", style=wx.TE_MULTILINE|wx.EXPAND)
		self.chanel_odd_experiment_ctrl.__label__ = "channels"
		sizer.Add (self.chanel_odd_experiment_ctrl, flag=wx.EXPAND, border=5)
	
		sizer.Add (wx.StaticText(self, label="\nMax amplitude (ND filter)"), flag=wx.LEFT, border=5)
		max_ampl_ctrl = wxFloatSpin(self, min_val=0, max_val=1, increment=0.01, value=1., digits=3)
		max_ampl_ctrl.__label__ = "max_ampl"
		sizer.Add (max_ampl_ctrl , flag=wx.EXPAND, border=5)
	
		################ Parameters of reference mask ####################
		sb_sizer = wx.StaticBoxSizer( wx.StaticBox(self, label="Reference mask parameters: "),  wx.VERTICAL )
		
		# Min value of coefficient
		sb_sizer.Add (wx.StaticText(self, label="min coefficient"), flag=wx.LEFT, border=5)
		coeff_min_ctrl = wxFloatSpin (self, min_val=-10, max_val=10, increment=0.01, value=-0.9, digits=3)
		coeff_min_ctrl.__label__ = "coeff_min"
		sb_sizer.Add (coeff_min_ctrl , flag=wx.EXPAND, border=5)
		
		# Max value of coefficient
		sb_sizer.Add (wx.StaticText(self, label="max coefficient"), flag=wx.LEFT, border=5)
		coeff_max_ctrl = wxFloatSpin (self, min_val=0, max_val=10, increment=0.01, value=0.9, digits=3)
		coeff_max_ctrl.__label__ = "coeff_max"
		sb_sizer.Add (coeff_max_ctrl , flag=wx.EXPAND, border=5)
		
		# Number of coeff scans
		sb_sizer.Add (wx.StaticText(self, label="number of scans"), flag=wx.LEFT, border=5)
		coeff_num_ctrl = wx.SpinCtrl (self, value="20", min=10, max=100000)
		coeff_num_ctrl.__label__ = "coeff_num"
		sb_sizer.Add (coeff_num_ctrl , flag=wx.EXPAND, border=5)
		
		# Polynomial basis type
		sb_sizer.Add (wx.StaticText(self, label="\nPolynomial basis type"), flag=wx.LEFT, border=5)
		self.polynomial_bases = {
			"Chebyshev"	:	np.polynomial.chebyshev.Chebyshev,
			"Legendre"	:	np.polynomial.legendre.Legendre,
			"Laguerre"	:	np.polynomial.laguerre.Laguerre,
			"Hermite"	:	np.polynomial.hermite.Hermite,
			"Monomials" :	np.polynomial.polynomial.Polynomial
		}  
		choices = self.polynomial_bases.keys()
		polynomial_bais_ctrl = wx.ComboBox (self, choices=choices, value=choices[0], style=wx.CB_READONLY )
		polynomial_bais_ctrl.__label__ = "polynomial_basis"
		sb_sizer.Add (polynomial_bais_ctrl,  flag=wx.EXPAND, border=5)
		
		# Polynomial order
		sb_sizer.Add (wx.StaticText(self, label="\npolynomial order"), flag=wx.LEFT, border=5)
		poly_order_ctrl = wx.SpinCtrl (self, value="2", min=0, max=100000)
		poly_order_ctrl.__label__ = "polynomial_order"
		sb_sizer.Add (poly_order_ctrl , flag=wx.EXPAND, border=5)
		
		sizer.Add (sb_sizer, flag=wx.EXPAND, border=10)
		################################################
		
		# Scan button
		self.get_coeff_scan_btn = wx.Button (self)
		self.get_coeff_scan_btn._start_label  = "Scan polynomial coefficient"
		self.get_coeff_scan_btn._start_method = self.DoScannning
		self.get_coeff_scan_btn._stop_label  = "STOP scanning"
		self.get_coeff_scan_btn._stop_method = self.StopScannning
		self.get_coeff_scan_btn.SetLabel( self.get_coeff_scan_btn._start_label )
		self.get_coeff_scan_btn.Bind( wx.EVT_BUTTON, self.get_coeff_scan_btn._start_method )
		sizer.Add (self.get_coeff_scan_btn, flag=wx.EXPAND, border=5)
		
		# Separator
		sizer.Add (wx.StaticText(self), border=5)
		
		# Record background signal
		background_signal_button = wx.Button (self, label="Record background")
		background_signal_button.Bind ( wx.EVT_BUTTON, self.RecordBackground )
		sizer.Add (background_signal_button, flag=wx.EXPAND, border=5)
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		self.CreateSettingsDict()
Exemplo n.º 32
0
	def __init__(self, parent, **kwards) :
		HardwareGUIControl.__init__(self, parent, manager_cls=ManagerPicoHarp, **kwards)
		
		sizer = wx.BoxSizer(wx.VERTICAL)
		
		# Offset
		sizer.Add (wx.StaticText(self, label="Offset (ns)"), flag=wx.LEFT|wx.TOP, border=5)
		offset_ctrl = wx.SpinCtrl (self, value="0", min=0, max=1e6)
		offset_ctrl.__label__ = "offset"
		sizer.Add (offset_ctrl, flag=wx.EXPAND, border=5)
		# Enable interactive update 
		offset_ctrl.Bind (wx.EVT_SPINCTRL, 
			functools.partial(self.UpdateProperty, offset_ctrl, "UpdateOffset") 
		)
		
		# Zero level of channel 0
		sizer.Add (wx.StaticText(self, label="\nCFDZeroX0 (mV)"), flag=wx.LEFT, border=5)
		CFDZeroX0_ctrl = wx.SpinCtrl (self, value="10", min=0, max=1e3)
		CFDZeroX0_ctrl.__label__ = "cfdzerox0"
		sizer.Add (CFDZeroX0_ctrl, flag=wx.EXPAND, border=5)
		# Enable interactive update 
		CFDZeroX0_ctrl.Bind (wx.EVT_SPINCTRL, 
			functools.partial(self.UpdateProperty, CFDZeroX0_ctrl, "UpdateCFDZero0") 
		)
		
		# One level for channel 0
		sizer.Add (wx.StaticText(self, label="CFDLevel0 (mV)"), flag=wx.LEFT, border=5)
		CFDLevel0_ctrl = wx.SpinCtrl (self, value="80", min=0, max=1e3)
		CFDLevel0_ctrl.__label__ = "cfdlevelx0"
		sizer.Add (CFDLevel0_ctrl, flag=wx.EXPAND, border=5)
		# Enable interactive update 
		CFDLevel0_ctrl.Bind (wx.EVT_SPINCTRL, 
			functools.partial(self.UpdateProperty, CFDLevel0_ctrl, "UpdateCFDLevel0") 
		)
		
		# Zero level of channel 1
		sizer.Add (wx.StaticText(self, label="\nCFDZeroX1 (mV)"), flag=wx.LEFT, border=5)
		CFDZeroX1_ctrl = wx.SpinCtrl (self, value="10", min=0, max=1e3)
		CFDZeroX1_ctrl.__label__ = "cfdzerox1"
		sizer.Add (CFDZeroX1_ctrl, flag=wx.EXPAND, border=5)
		# Enable interactive update 
		CFDZeroX1_ctrl.Bind (wx.EVT_SPINCTRL, 
			functools.partial(self.UpdateProperty, CFDZeroX1_ctrl, "UpdateCFDZero1") 
		)
		
		# One level for channel 1
		sizer.Add (wx.StaticText(self, label="CFDLevel1 (mV)"), flag=wx.LEFT, border=5)
		CFDLevel1_ctrl = wx.SpinCtrl (self, value="80", min=0, max=1e3)
		CFDLevel1_ctrl.__label__ = "cfdlevelx1"
		sizer.Add (CFDLevel1_ctrl, flag=wx.EXPAND, border=5)
		# Enable interactive update 
		CFDLevel1_ctrl.Bind (wx.EVT_SPINCTRL, 
			functools.partial(self.UpdateProperty, CFDLevel1_ctrl, "UpdateCFDLevel1") 
		)
		
		# Divider
		sizer.Add (wx.StaticText(self, label="\nDivider"), flag=wx.LEFT, border=5)
		syncdiv_ctrl = wx.SpinCtrl (self, value="8", min=1, max=1e3)
		syncdiv_ctrl.__label__ = "syncdiv"
		sizer.Add (syncdiv_ctrl, flag=wx.EXPAND, border=5)
		# Enable interactive update 
		syncdiv_ctrl.Bind (wx.EVT_SPINCTRL, 
			functools.partial(self.UpdateProperty, syncdiv_ctrl, "UpdateSyncDiv") 
		)
		
		# Range	
		sizer.Add (wx.StaticText(self, label="\nRange"), flag=wx.LEFT, border=5)
		range_ctrl = wx.SpinCtrl (self, value="2", min=0, max=1e6)
		range_ctrl.__label__ = "range"
		sizer.Add (range_ctrl, flag=wx.EXPAND, border=5)
		# Enable interactive update 
		range_ctrl.Bind (wx.EVT_SPINCTRL, 
			functools.partial(self.UpdateProperty, range_ctrl, "UpdateRange") 
		)
		
		# Acquisition time
		sizer.Add (wx.StaticText(self, label="\nAcquisition time (ms)"), flag=wx.LEFT, border=5)
		tacq_ctrl = wx.SpinCtrl (self, value="1000", min=100, max=1e6)
		tacq_ctrl.__label__ = "tacq"
		sizer.Add (tacq_ctrl, flag=wx.EXPAND, border=5)
		# Enable interactive update 
		tacq_ctrl.Bind (wx.EVT_SPINCTRL, 
			functools.partial(self.UpdateProperty, tacq_ctrl, "UpdateTacq") 
		)
		
		# Spacer
		sizer.Add (wx.StaticText(self, label=""), flag=wx.LEFT, border=5)
		
		# Button for displaying histogram
		show_histogram_button = MultiStateButton(self, states=[
			 (self.StartShowingHistogram, "Show histogram"), 
			 (self.StopShowingHistogram, "STOP histogram")
			]
		)
		sizer.Add (show_histogram_button, flag=wx.EXPAND, border=5)
		
		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		
		self.CreateSettingsDict()