def setup(self): """ Runs once during App initialization. This is the place to load a user interface file, define settings, and set up data structures. """ # Define ui file to be used as a graphical interface # This file can be edited graphically with Qt Creator # sibling_path function allows python to find a file in the same folder # as this python module self.name = "TransientStepResponse" #Load ui file and convert it to a live QWidget of the user interface self.ui_filename = self.app.appctxt.get_resource( "transient_step_response.ui") self.ui = load_qt_ui_file(self.ui_filename) self.settings.New('drain_bias', unit='V', initial=-.6) self.settings.New('first_bias_settle', unit='ms', initial=2000) self.settings.New('initial_gate_setting', unit='V', initial=0) self.settings.New('delay_gate', unit='s', initial=30) self.settings.New('setpoint', unit='V', initial=.5) self.settings.New('software_averages', int, initial=10) self.settings.New('delay_between_averages', unit='ms', initial=300) self.settings.New('total_measurement_time', unit='s', initial=120) self.g_hw = self.app.hardware['keithley2400_sourcemeter1'] self.ds_hw = self.app.hardware['keithley2400_sourcemeter2']
def setup(self): self.display_update_period = 0.1 #seconds S = self.settings S.New('save_h5', dtype=bool, initial=True) S.New('continuous', dtype=bool, initial=False) S.New('use_calc_hist_chans', dtype=bool, initial=True) # hardware ph_hw = self.picoharp_hw = self.app.hardware['picoharp'] # UI self.ui_filename = sibling_path(__file__, "picoharp_hist_measure.ui") self.ui = load_qt_ui_file(self.ui_filename) self.ui.setWindowTitle(self.name) #connect events S.progress.connect_to_widget(self.ui.progressBar) self.ui.start_pushButton.clicked.connect(self.start) self.ui.interrupt_pushButton.clicked.connect(self.interrupt) S.continuous.connect_to_widget(self.ui.continuous_checkBox) S.use_calc_hist_chans.connect_to_widget( self.ui.use_calc_hist_chans_checkBox) ph_hw.settings.Tacq.connect_to_widget( self.ui.picoharp_tacq_doubleSpinBox) ph_hw.settings.Binning.connect_to_widget(self.ui.Binning_comboBox) ph_hw.settings.histogram_channels.connect_to_widget( self.ui.histogram_channels_doubleSpinBox) ph_hw.settings.count_rate0.connect_to_widget(self.ui.ch0_doubleSpinBox) ph_hw.settings.count_rate1.connect_to_widget(self.ui.ch1_doubleSpinBox) S.save_h5.connect_to_widget(self.ui.save_h5_checkBox)
def setup(self): """ Runs once during App initialization. This is the place to load a user interface file, define settings, and set up data structures. """ # Define ui file to be used as a graphical interface # This file can be edited graphically with Qt Creator # sibling_path function allows python to find a file in the same folder # as this python module self.name = "oceanoptics_measure" self.ui_filename = sibling_path(__file__, "spec_plot.ui") #Load ui file and convert it to a live QWidget of the user interface self.ui = load_qt_ui_file(self.ui_filename) # Measurement Specific Settings # This setting allows the option to save data to an h5 data file during a run # All settings are automatically added to the Microscope user interface self.settings.New('save_every_spec', dtype=bool, initial=False) self.settings.New('scans_to_avg', dtype=int, initial=1, vmin=1) # Define how often to update display during a run self.display_update_period = 0.1 # Create empty numpy array to serve as a buffer for the acquired data self.buffer = np.zeros(120, dtype=float) self.save_array = np.zeros(shape=(2048, 2)) self.point_counter = 0 # Convenient reference to the hardware used in the measurement self.spec_hw = self.app.hardware['oceanoptics']
def setup(self): self.ui_filename = sibling_path(__file__, "form.ui") self.ui = load_qt_ui_file(self.ui_filename) #self.settings.New('save_h5', dtype=bool, initial=False) self.settings.New('refresh_period', dtype=float, initial=0.08, vmin=0, vmax=10) self.settings.New('auto_range', dtype=bool, initial=True) self.settings.New('auto_levels', dtype=bool, initial=True) self.settings.New('level_min', dtype=int, initial=60) self.settings.New('level_max', dtype=int, initial=140) self.settings.New('extract_roi', dtype=bool, initial=False) self.settings.New('roi_half_side', dtype=int, initial=75) self.settings.New('min_cell_size', dtype=int, initial=1600) self.camera = self.app.hardware['FakeCameraHardware'] self.display_update_period = self.settings.refresh_period.val self.cnt = [] self.cx = [] self.cy = [] self.roi_num = 0
def setup(self): self.ui_filename = sibling_path(__file__, "particle_selection.ui") #Load ui file and convert it to a live QWidget of the user interface self.ui = load_qt_ui_file(self.ui_filename) self.settings.New('Magnification', dtype=float, choices=[("50x", 50), ("75x", 75), ("100x", 100), ("150x", 150)], initial=75) self.settings.New('W1', dtype=float) self.settings.New('H1', dtype=float) self.settings.New('W2', dtype=float) self.settings.New('H2', dtype=float) self.settings.New('dW', dtype=float, ro=True) self.settings.New('dH', dtype=float, ro=True) self.settings.New('dX', dtype=float, ro=True) self.settings.New('dY', dtype=float, ro=True) self.PIXEL_SIZE = 7.4 self.scaling_factor = self.calc_scaling_factor( ) #initial scaling factor #for selecting multiple points self.point_counter = 0 self.relative_movements = [] self.x_origin = 0 self.y_origin = 0 self.pi_device_hw = self.app.hardware['piezostage']
def setup(self): self.name = "TestDevice" self.ui_filename = self.app.appctxt.get_resource("test_device.ui") #Load ui file and convert it to a live QWidget of the user interface self.ui = load_qt_ui_file(self.ui_filename) TransferCurveMeasure.create_settings(self) self.switch_setting() #configure variables for output curve OutputCurveMeasure.create_settings(self) self.switch_setting() #configure variables for transfer curve #create automeasure specific settings self.dimension_choice = { '4000 x 20': [4000, 20], '2000 x 20': [2000, 20], '1000 x 20': [1000, 20], '800 x 20': [800, 20], '400 x 20': [400, 20], '200 x 20': [200, 20], '100 x 20': [100, 20] } self.settings.New('number_of_transfer_curves', int, initial=1, vmin=1) self.settings.New('number_of_output_curves', int, initial=1, vmin=1, vmax=5) self.settings.New('dimension', str, choices=self.dimension_choice.keys(), initial='4000 x 20') self.settings.New('thickness', unit="nm", initial=50) self.v_g_spinboxes = self.ui.v_g_groupBox.findChildren( QtGui.QDoubleSpinBox) #array of v_g spinboxes
def setup_figure(self): ui_filename = sibling_path(__file__, "picoharp_channel_optimizer.ui") self.ui = load_qt_ui_file(ui_filename) self.settings.activation.connect_to_widget(self.ui.run_checkBox) self.settings.c0_visible.connect_to_widget(self.ui.c0_visible_checkBox) self.settings.c1_visible.connect_to_widget(self.ui.c1_visible_checkBox) self.settings.history_len.connect_to_widget( self.ui.history_len_doubleSpinBox) ph_hw = self.picoharp_hw ph_hw.settings.count_rate0.connect_to_widget(self.ui.c0_doubleSpinBox) ph_hw.settings.count_rate1.connect_to_widget(self.ui.c1_doubleSpinBox) self.graph_layout = pg.GraphicsLayoutWidget() self.ui.plot_groupBox.layout().addWidget(self.graph_layout) self.plot = self.graph_layout.addPlot( title="Picoharp Channel Optimizer") self.c0_plotline = self.plot.plot() self.c1_plotline = self.plot.plot() self.settings.c0_visible.add_listener(self.c0_plotline.setVisible, bool) self.settings.c1_visible.add_listener(self.c1_plotline.setVisible, bool) self.vline = pg.InfiniteLine(angle=90, movable=False) self.plot.addItem(self.vline, ignoreBounds=True)
def setup(self): self.ui_filename = sibling_path(__file__, "h5_pkl_view_gui.ui") self.ui = load_qt_ui_file(self.ui_filename) self.ui.show() self.ui.raise_() self.views = OrderedDict() self.settings.New('data_filename', dtype='file') self.settings.New('auto_select_view',dtype=bool, initial=True) self.settings.New('view_name', dtype=str, initial='0', choices=('0',)) self.settings.data_filename.add_listener(self.on_change_data_filename) # UI Connections/ self.settings.data_filename.connect_to_browse_widgets(self.ui.data_filename_lineEdit, self.ui.data_filename_browse_pushButton) # set views self.h5treeview = H5TreeSearchView(self) self.load_view(self.h5treeview) self.pkltreeview = PklTreeSearchView(self) self.load_view(self.pkltreeview) self.settings.view_name.add_listener(self.on_change_view_name) self.current_view = None self.ui.show()
def setup_figure(self): hh_hw = self.hydraharp_hw HS = hh_hw.settings ui_filename = sibling_path(__file__, "hydraharp_channel_optimizer.ui") self.ui = load_qt_ui_file(ui_filename) #Connect hardware settings spinboxes = ['DeviceIndex', 'HistogramBins', 'Tacq', 'Resolution', 'StopCount', 'SyncOffset', 'CFDLevelSync', 'CFDZeroCrossSync', 'SyncRate', 'SyncPeriod',] for spinbox in spinboxes: widget = getattr(self.ui, '{}_doubleSpinBox'.format(spinbox)) getattr(HS, spinbox).connect_to_widget(widget) HS.SyncDivider.connect_to_widget(self.ui.SyncDivider_comboBox) HS.connected.connect_to_widget(self.ui.connected_checkBox) HS.Mode.connect_to_widget(self.ui.Mode_comboBox) HS.RefSource.connect_to_widget(self.ui.RefSource_comboBox) HS.StopOnOverflow.connect_to_widget(self.ui.StopOnOverflow_checkBox) HS.Binning.connect_to_widget(self.ui.Binning_comboBox) #settings for each channel: for i in range(self.n_channels): if i%2==0: q = int(i/2) self.add_timing_module(channels=np.arange(q,q+2)) #Channel optimizer self.settings.activation.connect_to_widget(self.ui.run_checkBox) self.settings.SyncRate_visible.connect_to_widget(self.ui.SyncRate_visible_checkBox) self.settings.history_len.connect_to_widget(self.ui.history_len_doubleSpinBox) self.settings.avg_len.connect_to_widget(self.ui.avg_len_doubleSpinBox) for i in range(self.n_channels): checkBox = QtWidgets.QCheckBox('show CountRate{}'.format(i)) if i%2 == 0: VLayout = QtWidgets.QVBoxLayout() self.ui.optimizer_layout.addLayout(VLayout) VLayout.addWidget(checkBox) self.settings.get_lq('CountRate{}_visible'.format(i)).connect_to_widget(checkBox) self.graph_layout=pg.GraphicsLayoutWidget() self.ui.channel_optimizer_GroupBox.layout().addWidget(self.graph_layout) self.plot = self.graph_layout.addPlot(title="Hydraharp Channel Optimizer") self.plotlines = {} self.avglines = {} colors = ['y','r','g','b'] for i,rate in enumerate(self.rates): self.plotlines.update({rate:self.plot.plot(pen=colors[i])}) avg_line = pg.InfiniteLine(angle=0, movable=False, pen=colors[i%len(colors)]) self.plot.addItem(avg_line) self.avglines.update({rate:avg_line})
def setup(self): self.ui_filename = sibling_path(__file__, 'stage_delta_control.ui') self.ui = load_qt_ui_file(self.ui_filename) self.settings.New("xy_step", dtype=str, initial='10um', choices=('1um', '10um', '100um', '1mm', '10mm')) self.settings.New("z_step", dtype=str, initial='10um', choices=('0.1um','1um', '10um', '100um', '1mm')) self.settings.New("rot_step", dtype=str, initial='1.0_deg', choices=('0.1_deg', '1.0_deg', '10_deg')) for ax in ['x', 'y', 'z', 'rot']: for direction in ['up', 'down']: button = getattr(self.ui, "{}_{}_pushButton".format(ax, direction)) button.released.connect(lambda ax=ax, direction=direction: self.step_axis(ax, direction)) self.remcon = self.app.hardware['sem_remcon'] for ax in ['x', 'y', 'z', 'rot']: widget = getattr(self.ui, ax + "_pos_doubleSpinBox") lq = self.remcon.settings.get_lq("stage_" + ax) lq.connect_to_widget(widget) self.ui.read_current_pos_pushButton.clicked.connect(self.remcon.settings.stage_position.read_from_hardware) self.settings.xy_step.connect_to_widget(self.ui.step_xy_comboBox) self.settings.z_step.connect_to_widget(self.ui.step_z_comboBox) self.settings.rot_step.connect_to_widget(self.ui.step_rot_comboBox) self.remcon.settings.stage_is_moving.connect_to_widget(self.ui.is_moving_checkBox) self.remcon.settings.stage_initialized.connect_to_widget(self.ui.initialized_checkBox) self.remcon.settings.connected.connect_to_widget(self.ui.connected_checkBox) self.ui.move_to_insert_pushButton.clicked.connect(self.move_to_insert_position)
def setup(self): "..." self.ui_filename = sibling_path(__file__, "form.ui") self.ui = load_qt_ui_file(self.ui_filename) self.settings.New('record', dtype=bool, initial=False, hardware_set_func=self.setRecord, hardware_read_func=self.getRecord, reread_from_hardware_after_write=True) self.settings.New('save_h5', dtype=bool, initial=False, hardware_set_func=self.setSaveH5, hardware_read_func=self.getSaveH5) self.settings.New('refresh_period', dtype=float, unit='s', spinbox_decimals = 4, initial=0.02 , hardware_set_func=self.setRefresh, vmin = 0) self.settings.New('autoRange', dtype=bool, initial=True, hardware_set_func=self.setautoRange) self.settings.New('autoLevels', dtype=bool, initial=True, hardware_set_func=self.setautoLevels) self.settings.New('level_min', dtype=int, initial=60, hardware_set_func=self.setminLevel, hardware_read_func = self.getminLevel) self.settings.New('level_max', dtype=int, initial=150, hardware_set_func=self.setmaxLevel, hardware_read_func = self.getmaxLevel) self.settings.New('threshold', dtype=int, initial=500, hardware_set_func=self.setThreshold) self.settings.New('extractRoi', dtype=bool, initial=False, hardware_set_func=self.setExtractRoi, hardware_read_func=self.getExtractRoi) self.settings.New('dimRoi', dtype=int, initial=150, hardware_set_func=self.setDimRoi, hardware_read_func = self.getDimRoi) self.settings.New('minCellSize', dtype=int, initial=1600, hardware_set_func=self.setMinCellSize, hardware_read_func = self.getMinCellSize) self.camera = self.app.hardware['HamamatsuHardware'] self.autoRange = self.settings.autoRange.val self.display_update_period = self.settings.refresh_period.val self.autoLevels = self.settings.autoLevels.val self.level_min = self.settings.level_min.val self.level_max = self.settings.level_max.val self.dimRoi = self.settings.dimRoi.val self.minCellSize = self.settings.minCellSize.val
def setup(self): """ Runs once during App initialization. This is the place to load a user interface file, define settings, and set up data structures. """ # Define ui file to be used as a graphical interface # This file can be edited graphically with Qt Creator # sibling_path function allows python to find a file in the same folder # as this python module self.ui_filename = sibling_path(__file__, "sapphire_laser_plot.ui") #Load ui file and convert it to a live QWidget of the user interface self.ui = load_qt_ui_file(self.ui_filename) # Measurement Specific Settings # This setting allows the option to save data to an h5 data file during a run # All settings are automatically added to the Microscope user interface self.settings.New('save_h5', dtype=bool, initial=False) self.settings.New('sampling_period', dtype=float, unit='s', initial=0.1) self.settings.New('instant_power', dtype=float, unit='mW', initial=0.0) # Create empty numpy array to serve as a buffer for the acquired data self.buffer = np.zeros(120, dtype=float) # Define how often to update display during a run self.display_update_period = 0.1 # Convenient reference to the hardware used in the measurement self.signal_gen = self.app.hardware['SapphireLaser']
def setup(self): self.ui_filename = sibling_path(__file__, "h5_view_and_plot_gui.ui") self.ui = load_qt_ui_file(self.ui_filename) self.ui.show() self.ui.raise_() self.settings.New('data_filename', dtype='file') self.settings.data_filename.add_listener(self.on_change_data_filename) self.settings.New('view_name', dtype=str, initial='0', choices=('0',)) # UI Connections self.settings.data_filename.connect_to_browse_widgets(self.ui.data_filename_lineEdit, self.ui.data_filename_browse_pushButton) self.ui.plot_pushButton.clicked.connect(self.plot_dataset) self.ui.dataset_listWidget.currentItemChanged.connect(self.on_data_selection) self.ui.plot_radioButton.toggled.connect(self.update_data_widget) self.ui.image_radioButton.toggled.connect(self.update_data_widget) #set up image item for 2d array self.data_img_layout = pg.GraphicsLayoutWidget() self.ui.imageItem_page.layout().addWidget(self.data_img_layout) self.data_img_layout = self.data_img_layout.addViewBox() self.data_img = pg.ImageItem() self.data_img_layout.addItem(self.data_img) #set up image view for 3d array self.ui.data_imageView.getView().invertY(False) self.h5treeview = H5TreeSearchView(self) self.ui.dataview_page.layout().addWidget(self.h5treeview.ui) self.h5treeview.ui.hide() self.ui.show()
def setup_figure(self): ui_filename = sibling_path(__file__, "tenma_ps_monitor.ui") self.ui = load_qt_ui_file(ui_filename) self.settings.activation.connect_to_widget(self.ui.run_checkBox) self.settings.history_len.connect_to_widget(self.ui.history_len_doubleSpinBox) self.settings.poll_time.connect_to_widget(self.ui.poll_time_doubleSpinBox) self.graph_layout=pg.GraphicsLayoutWidget() self.ui.plot_groupBox.layout().addWidget(self.graph_layout) self.plot_i = self.graph_layout.addPlot(title="Current") self.graph_layout.nextRow() self.plot_i = self.graph_layout.addPlot(title="Voltage") self.c0_plotline = self.plot.plot() self.c1_plotline = self.plot.plot() self.settings.c0_visible.add_listener(self.c0_plotline.setVisible, bool) self.settings.c1_visible.add_listener(self.c1_plotline.setVisible, bool) self.vline = pg.InfiniteLine(angle=90, movable=False) self.plot.addItem(self.vline, ignoreBounds=True) hw = self.tenma_hw hw.settings.device_name.connect_to_widget(self.ui.device_name_label) hw.settings.set_current.connect_to_widget(self.ui.set_current_doubleSpinBox) hw.settings.actual_current.connect_to_widget(self.ui.actual_current_doubleSpinBox) hw.settings.set_voltage.connect_to_widget(self.ui.set_voltage_doubleSpinBox) hw.settings.actual_voltage.connect_to_widget(self.ui.actual_voltage_doubleSpinBox)
def setup(self): AEA = self.add_hardware_component(AugerElectronAnalyzerHW(self)) self.ui.show() self.ui_analyzer = load_qt_ui_file(sibling_path(__file__, "auger_electron_analyzer_viewer.ui")) widget_connections = [ ('CAE_mode', 'cae_checkBox'), ('multiplier', 'multiplier_checkBox'), ('KE', 'KE_doubleSpinBox'), ('work_function', 'work_func_doubleSpinBox'), ('pass_energy', 'pass_energy_doubleSpinBox'), ('crr_ratio', 'crr_ratio_doubleSpinBox'), ('resolution', 'resolution_doubleSpinBox'), ('quad_X1', 'qX1_doubleSpinBox'), ('quad_Y1', 'qY1_doubleSpinBox'), ('quad_X2', 'qX2_doubleSpinBox'), ('quad_Y2', 'qY2_doubleSpinBox'), ] for lq_name, widget_name in widget_connections: AEA.settings.get_lq(lq_name).connect_bidir_to_widget(getattr(self.ui_analyzer, widget_name)) #self.ui_analyzer.show() self.ui.centralwidget.layout().addWidget(self.ui_analyzer) self.ui.setWindowTitle(self.name) AEA.settings['debug_mode'] = True AEA.settings.connected.update_value(True)
def setup(self): self.settings.New_Range('sweep_wls', dtype=float) self.ui_filename = sibling_path(__file__, 'andor_spec_calib_measure.ui') self.ui = load_qt_ui_file(self.ui_filename)
def setup(self): # Microscope specific (also provide move_stage_and_wait(x,y) ) self.stage_hw = self.app.hardware['pi_piezo_stage'] self.shutter_lq = self.app.hardware['shutter'].settings.laser_shutter self.settings.New('live_cam_show', dtype=bool, initial=True) self.settings.New('live_cam_cx', dtype=float, initial=512, unit='pixel') self.settings.New('live_cam_cy', dtype=float, initial=384, unit='pixel') self.settings.New('live_cam_scale', dtype=float, initial=0.001, spinbox_decimals=4, unit='um/pixel') self.ui_filename = sibling_path(__file__, "laser_line_writer.ui") self.ui = load_qt_ui_file(self.ui_filename) self.ui.update_move_display_pushButton.clicked.connect( self.update_move_display) self.ui.start_pushButton.clicked.connect(self.start) self.ui.interrupt_pushButton.clicked.connect(self.interrupt)
def setup(self): """ """ # Define ui file to be used as a graphical interface # This file can be edited graphically with Qt Creator # sibling_path function allows python to find a file in the same folder # as this python module self.ui_filename = sibling_path(__file__, "sine_plot.ui") #Load ui file and convert it to a live QWidget of the user interface self.ui = load_qt_ui_file(self.ui_filename) # Measurement Specific Settings # This setting allows the option to save data to an h5 data file during a run # All settings are automatically added to the Microscope user interface self.settings.New('save_h5', dtype=bool, initial=True) self.settings.New('sampling_period', dtype=float, unit='s', initial=0.1) # Create empty numpy array to serve as a buffer for the acquired data self.buffer = np.zeros(120, dtype=float) # Define how often to update display during a run self.display_update_period = 0.1 # Convenient reference to the hardware used in the measurement self.func_gen = self.app.hardware['virtual_function_gen'] """ THIS CONNECTS THE JOYSTICK TO THE MEASUREMENT """ self.joystick = self.app.hardware['joystickHW']
def setup(self): """ Runs once during App initialization. This is the place to load a user interface file, define settings, and set up data structures. """ # Define ui file to be used as a graphical interface # This file can be edited graphically with Qt Creator # sibling_path function allows python to find a file in the same folder # as this python module if self.SWEEP == "DS": self.name = "output_curve_measure" elif self.SWEEP == "G": self.name = "transfer_curve_measure" # self.ui_filename = sibling_path(__file__, "general_curve.ui") self.ui_filename = self.app.appctxt.get_resource("general_curve.ui") #Load ui file and convert it to a live QWidget of the user interface self.ui = load_qt_ui_file(self.ui_filename) self.create_settings() self.dimension_choice = { '4000 x 20': [4000, 20], '2000 x 20': [2000, 20], '1000 x 20': [1000, 20], '800 x 20': [800, 20], '400 x 20': [400, 20], '200 x 20': [200, 20], '100 x 20': [100, 20] } self.settings.New('dimension', str, choices=self.dimension_choice.keys(), initial='4000 x 20') self.settings.New('thickness', unit="nm", initial=50) self.settings.New('num_cycles', int, initial=1)
def setup_figure(self): self.ui = load_qt_ui_file(sibling_path(__file__,'flircam_live_measure.ui')) self.hw = self.app.hardware['flircam'] self.settings.activation.connect_to_widget(self.ui.live_checkBox) self.settings.auto_level.connect_to_widget(self.ui.auto_level_checkBox) self.settings.crosshairs.connect_to_widget(self.ui.crosshairs_checkBox) self.hw.settings.connected.connect_to_widget(self.ui.cam_connect_checkBox) self.hw.settings.cam_index.connect_to_widget(self.ui.cam_index_doubleSpinBox) self.hw.settings.frame_rate.connect_to_widget(self.ui.framerate_doubleSpinBox) self.hw.settings.exposure.connect_to_widget(self.ui.exp_doubleSpinBox) self.imview = pg.ImageView() def switch_camera_view(): self.ui.plot_groupBox.layout().addWidget(self.imview) self.imview.showMaximized() self.ui.show_pushButton.clicked.connect(switch_camera_view) self.ui.plot_groupBox.layout().addWidget(self.imview) self.ui.auto_exposure_comboBox.addItem("placeholder") self.ui.auto_exposure_comboBox.setCurrentIndex(0) def apply_auto_exposure_index(): self.hw.cam.set_auto_exposure(self.ui.auto_exposure_comboBox.currentIndex()) self.ui.auto_exposure_comboBox.currentIndexChanged.connect(apply_auto_exposure_index) self.ui.save_pushButton.clicked.connect(self.save_image)
def setup(self): """ Runs once during App initialization. This is the place to load a user interface file, define settings, and set up data structures. For Pointgrey Grasshopper CMOS the pixelsize is: 5.86um """ self.ui_filename = sibling_path(__file__, "camera.ui") self.ui = load_qt_ui_file(self.ui_filename) self.settings.New('save_h5', dtype=bool, initial=False) self.settings.New('refresh_period', dtype = float, unit ='s', spinbox_decimals = 3, initial = 0.05, vmin = 0) self.settings.New('xsampling', dtype=float, unit='um', initial=0.0586, spinbox_decimals = 3) self.settings.New('ysampling', dtype=float, unit='um', initial=0.0586, spinbox_decimals = 3) self.settings.New('zsampling', dtype=float, unit='um', initial=1.0) self.auto_range = self.settings.New('auto_range', dtype=bool, initial=True) self.settings.New('auto_levels', dtype=bool, initial=True) self.settings.New('level_min', dtype=int, initial=60) self.settings.New('level_max', dtype=int, initial=4000) self.image_gen = self.app.hardware['FLIRhw']
def setup(self): """ Runs once during App initialization. This is the place to load a user interface file, define settings, and set up data structures. """ # Define ui file to be used as a graphical interface # This file can be edited graphically with Qt Creator # sibling_path function allows python to find a file in the same folder # as this python module self.ui_filename = sibling_path(__file__, "random_images.ui") #Load ui file and convert it to a live QWidget of the user interface self.ui = load_qt_ui_file(self.ui_filename) # Measurement Specific Settings # This setting allows the option to save data to an h5 data file during a run # All settings are automatically added to the Microscope user interface self.settings.New('save_h5', dtype=bool, initial=False) self.settings.New('number_of_images_to_save', dtype=int, initial=10) self.settings.New('sampling_period', dtype=float, unit='s', initial=0.1) self.settings.New('xsampling', dtype=float, unit='um', initial=0.5) self.settings.New('ysampling', dtype=float, unit='um', initial=0.5) self.settings.New('zsampling', dtype=float, unit='um', initial=3.0) # Define how often to update display during a run self.display_update_period = 0.05 # Convenient reference to the hardware used in the measurement self.image_gen = self.app.hardware['virtual_image_gen'] # Create an empty image with the size defined by the hardware #self.img = np.empty([self.image_gen.settings['size'],self.image_gen.settings['size']], dtype = float) self.img = self.image_gen.image_data
def setup(self): # load ui file self.ui_filename = sibling_path(__file__, "hexsim_analysis.ui") self.ui = load_qt_ui_file(self.ui_filename) # Message window self.messageWindow = None self.settings.New('refresh_period', dtype=float, unit='s', spinbox_decimals=4, initial=0.02, hardware_set_func=self.setRefresh, vmin=0) self.add_operation('terminate', self.terminate) self.display_update_period = self.settings.refresh_period.val # Initialize condition labels self.isUpdateImageViewer = False self.showCalibrationResult = False self.isProcessingFinished = False self.isCalibrationSaved = False self.isFileLoad = False self.standardProcessEvent = Event() self.standardProcessFinished = Event() self.standardSimulationEvent = Event() # self.batchMeasureEvent = Event() self.batchProcessEvent = Event() self.batchProcessFinished = Event() self.batchSimulationEvent = Event() # self.calibrationMeasureEvent = Event() self.calibrationProcessEvent = Event() self.calibrationFinished = Event() self.processValue = 0
def setup(self): self.ui = load_qt_ui_file(sibling_path(__file__, "data_browser.ui")) self.ui.show() self.ui.raise_() self.views = OrderedDict() self.current_view = None self.settings.New('data_filename', dtype='file') self.settings.New('browse_dir', dtype='file', is_dir=True, initial='/') self.settings.New('file_filter', dtype=str, initial='*.*,') self.settings.data_filename.add_listener(self.on_change_data_filename) self.settings.New('auto_select_view', dtype=bool, initial=True) self.settings.New('view_name', dtype=str, initial='0', choices=('0', )) # UI Connections self.settings.data_filename.connect_to_browse_widgets( self.ui.data_filename_lineEdit, self.ui.data_filename_browse_pushButton) self.settings.browse_dir.connect_to_browse_widgets( self.ui.browse_dir_lineEdit, self.ui.browse_dir_browse_pushButton) self.settings.view_name.connect_bidir_to_widget( self.ui.view_name_comboBox) self.settings.file_filter.connect_bidir_to_widget( self.ui.file_filter_lineEdit) # file system tree self.fs_model = QtWidgets.QFileSystemModel() self.fs_model.setRootPath(QtCore.QDir.currentPath()) self.ui.treeView.setModel(self.fs_model) self.ui.treeView.setIconSize(QtCore.QSize(16, 16)) self.ui.treeView.setSortingEnabled(True) #for i in (1,2,3): # self.ui.treeView.hideColumn(i) #print("="*80, self.ui.treeView.selectionModel()) self.tree_selectionModel = self.ui.treeView.selectionModel() self.tree_selectionModel.selectionChanged.connect( self.on_treeview_selection_change) self.settings.browse_dir.add_listener(self.on_change_browse_dir) self.settings['browse_dir'] = os.getcwd() # set views self.load_view(FileInfoView(self)) self.load_view(NPZView(self)) self.settings.view_name.add_listener(self.on_change_view_name) self.settings['view_name'] = "file_info" self.settings.file_filter.add_listener(self.on_change_file_filter) #self.console_widget.show() self.ui.console_pushButton.clicked.connect(self.console_widget.show) self.ui.show()
def setup_figure(self): #if hasattr(self, 'graph_layout'): # self.graph_layout.deleteLater() # see http://stackoverflow.com/questions/9899409/pyside-removing-a-widget-from-a-layout # del self.graph_layout ui = self.ui = load_qt_ui_file(sibling_path(__file__, 'andor_ccd_readout.ui')) ## ui connection self.hw = andor = self.app.hardware['andor_ccd'] andor.settings.exposure_time.connect_to_widget(ui.andor_ccd_int_time_doubleSpinBox) andor.settings.em_gain.connect_to_widget(ui.andor_ccd_emgain_doubleSpinBox) andor.settings.temperature.connect_to_widget(ui.andor_ccd_temp_doubleSpinBox) andor.settings.ccd_status.connect_to_widget(ui.andor_ccd_status_label) andor.settings.shutter_open.connect_to_widget(ui.andor_ccd_shutter_open_checkBox) self.settings.bg_subtract.connect_to_widget(ui.andor_ccd_bgsub_checkBox) ui.andor_ccd_acquire_cont_checkBox.stateChanged.connect(self.start_stop) ui.andor_ccd_acq_bg_pushButton.clicked.connect(self.acquire_bg_start) ui.andor_ccd_read_single_pushButton.clicked.connect(self.acquire_single_start) andor.settings.temp_status.connect_to_widget(self.ui.temp_status_label) andor.settings.temp_setpoint.connect_to_widget(self.ui.temp_setpoint_doubleSpinBox) self.settings.save_h5.connect_to_widget(self.ui.save_h5_checkBox) andor.settings.connected.connect_to_widget(self.ui.hw_connect_checkBox) self.settings.wl_calib.connect_to_widget(self.ui.wl_calib_comboBox) #### PLot window self.graph_layout = pg.GraphicsLayoutWidget() self.ui.plot_groupBox.layout().addWidget(self.graph_layout) self.spec_plot = self.graph_layout.addPlot() self.spec_plot_line = self.spec_plot.plot([1,3,2,4,3,5]) self.spec_plot.enableAutoRange() self.spec_infline = pg.InfiniteLine(movable=True, angle=90, label='x={value:0.2f}', labelOpts={'position':0.1, 'color': (200,200,100), 'fill': (200,200,200,50), 'movable': True}) self.spec_plot.addItem(self.spec_infline) self.graph_layout.nextRow() self.img_plot = self.graph_layout.addPlot() #self.img_plot.getViewBox().setLimits(minXRange=-10, maxXRange=100, minYRange=-10, maxYRange=100) self.img_plot.showGrid(x=True, y=True) self.img_plot.setAspectLocked(lock=True, ratio=1) self.img_item = pg.ImageItem() self.img_plot.addItem(self.img_item) self.hist_lut = pg.HistogramLUTItem() self.hist_lut.autoHistogramRange() self.hist_lut.setImageItem(self.img_item) self.graph_layout.addItem(self.hist_lut)
def setup(self): self.name = 'piezo_independent_movement' self.ui_filename = sibling_path(__file__, "independent_movement.ui") self.settings.New("sleep_time", dtype=float, unit="s", vmin=0) #Load ui file and convert it to a live QWidget of the user interface self.ui = load_qt_ui_file(self.ui_filename) self.pi_device_hw = self.app.hardware['piezostage']
def __init__(self, app): self.ui_filename = sibling_path(__file__, "sine_gen.ui") self.ui = load_qt_ui_file(self.ui_filename) self.ui.setWindowTitle(self.name) Measurement.__init__(self, app)
def setup(self): # load ui file self.ui_filename = sibling_path(__file__, "hexsim_analysis.ui") self.ui = load_qt_ui_file(self.ui_filename) self.settings.New('debug', dtype=bool, initial=False) self.ui.start_pushButton.clicked.connect(self.start) self.settings.New('cleanup', dtype=bool, initial=False)
def setup(self): # Microscope specific (also provide move_stage_and_wait(x,y) ) self.stage_hw = self.app.hardware['attocube_xyz_stage'] self.shutter_lq = self.app.hardware[ 'pololu_servo_hw'].settings.servo2_toggle self.ui_filename = sibling_path(__file__, "laser_line_writer.ui") self.ui = load_qt_ui_file(self.ui_filename)
def setup(self): self.ui_filename = sibling_path(__file__, "stage_control.ui") #Load ui file and convert it to a live QWidget of the user interface self.ui = load_qt_ui_file(self.ui_filename) self.settings.New('step_size', dtype=float, unit='um', vmin=.001) self.pi_device_hw = self.app.hardware['piezostage']