def __init__(self, name='sillyscope', show=True, block=False, pyvisa_py=False): if not _mp._visa: _s._warn('You need to install pyvisa to use the sillyscopes.') # Run the baseline stuff _visa_tools.visa_gui_base.__init__(self, name=name, show=False, block=False, api=sillyscope_api, pyvisa_py=pyvisa_py, window_size=[1000, 500]) # Build the GUI self.window.event_close = self._event_close self.button_1 = self.grid_top.place_object( _g.Button('1', True).set_width(25).set_checked(True)) self.button_2 = self.grid_top.place_object( _g.Button('2', True).set_width(25)) self.button_3 = self.grid_top.place_object( _g.Button('3', True).set_width(25)) self.button_4 = self.grid_top.place_object( _g.Button('4', True).set_width(25)) self.button_acquire = self.grid_top.place_object( _g.Button('Acquire', True).disable()) self.number_count = self.grid_top.place_object( _g.NumberBox(0).disable()) self.button_onair = self.grid_top.place_object( _g.Button('Waiting', True).set_width(70)) self.button_transfer = self.grid_top.place_object( _g.Button('Transfer', True).set_width(70)) self.tabs_data = self.grid_bot.place_object( _g.TabArea(name + '_tabs_data.txt'), alignment=0) self.tab_raw = self.tabs_data.add_tab('Raw') self.plot_raw = self.tab_raw.place_object(_g.DataboxPlot( '*.txt', name + '_plot_raw.txt'), alignment=0) # Keep track of previous plot self._previous_data = _s.data.databox() # Settings format self.settings.set_width(240) # Acquisition settings self.settings.add_parameter( 'Acquire/Iterations', 1, tip='How many iterations to perform. Set to 0 to keep looping.') self.settings.add_parameter( 'Acquire/Trigger', False, tip='Halt acquisition and arm / wait for a single trigger.') self.settings.add_parameter( 'Acquire/Get_First_Header', True, tip= 'Get the header (calibration) information the first time. Disabling this will return uncalibrated data.' ) self.settings.add_parameter( 'Acquire/Get_All_Headers', True, tip= 'Get the header (calibration) information EVERY time. Disabling this will use the first header repeatedly.' ) self.settings.add_parameter( 'Acquire/Discard_Identical', False, tip='Do not continue until the data is different.') # Device-specific settings self.settings.add_parameter( 'Acquire/RIGOL1000BDE/Trigger_Delay', 0.05, bounds=(1e-3, 10), siPrefix=True, suffix='s', dec=True, tip= 'How long after "trigger" command to wait before checking status. Some scopes appear to be done for a moment between the trigger command and arming.' ) self.settings.add_parameter( 'Acquire/RIGOL1000BDE/Unlock', True, tip='Unlock the device\'s frong panel after acquisition.') self.settings.add_parameter( 'Acquire/RIGOL1000Z/Always_Clear', True, tip= 'Clear the scope prior to acquisition even in untriggered mode (prevents duplicates but may slow acquisition).' ) # Connect all the signals self.settings.connect_signal_changed('Acquire/Trigger', self._settings_trigger_changed) self.button_acquire.signal_toggled.connect( self._button_acquire_clicked) self.button_1.signal_toggled.connect(self.save_gui_settings) self.button_2.signal_toggled.connect(self.save_gui_settings) self.button_3.signal_toggled.connect(self.save_gui_settings) self.button_4.signal_toggled.connect(self.save_gui_settings) # Run the base object stuff and autoload settings self._autosettings_controls = [ 'self.button_1', 'self.button_2', 'self.button_3', 'self.button_4' ] self.load_gui_settings() # Add additional analysis tabs self.tab_A1 = self.tabs_data.add_tab('A1') self.A1 = self.tab_A1.add(_g.DataboxProcessor('A1', self.plot_raw, '*.A1'), alignment=0) self.tab_A2 = self.tabs_data.add_tab('A2') self.A2 = self.tab_A2.add(_g.DataboxProcessor('A2', self.A1.plot, '*.A2'), alignment=0) self.tab_A3 = self.tabs_data.add_tab('A3') self.A3 = self.tab_A3.add(_g.DataboxProcessor('A3', self.A2.plot, '*.A3'), alignment=0) self.tab_B1 = self.tabs_data.add_tab('B1') self.B1 = self.tab_B1.add(_g.DataboxProcessor('B1', self.plot_raw, '*.B1'), alignment=0) self.tab_B2 = self.tabs_data.add_tab('B2') self.B2 = self.tab_B2.add(_g.DataboxProcessor('B2', self.B1.plot, '*.B2'), alignment=0) self.tab_B3 = self.tabs_data.add_tab('B3') self.B3 = self.tab_B3.add(_g.DataboxProcessor('B3', self.B2.plot, '*.B3'), alignment=0) self._libregexdisp_ctl() # After loading a raw file, run the processors self.plot_raw.after_load_file = self.after_load_file # Show it if show: self.window.show(block_command_line=block)
def __init__(self, name='TDS1012B', pyvisa_py=False, simulation=False, timeout=3e3, write_sleep=0.0): if not _mp._visa: _s._warn('You need to install pyvisa to use the sillyscopes.') # Run the basic stuff _visa_tools.visa_api_base.__init__(self, name=name, pyvisa_py=pyvisa_py, simulation=simulation, timeout=timeout, write_sleep=write_sleep) # Simulation settings self._simulation_sleep = 0.01 self._simulation_points = 1200 # Set up the info self.t_duty_cycle = 0 self.t_get_waveform = 0 self.previous_header = dict() self.previous_header[1] = dict(xzero1=0, xmultiplier1=1, yzero1=0, ymultiplier1=1) self.previous_header[2] = dict(xzero2=0, xmultiplier2=1, yzero2=0, ymultiplier2=1) self.previous_header[3] = dict(xzero3=0, xmultiplier3=1, yzero3=0, ymultiplier3=1) self.previous_header[4] = dict(xzero4=0, xmultiplier4=1, yzero4=0, ymultiplier4=1) self.model = None self._channel = 1 # Remember if it's a Tektronix scope if self.idn[0:9] == 'TEKTRONIX': self.model = 'TEKTRONIX' # Need to distinguish 'Rigol Technologies,DS1052E,DS1ET161453620,00.04.01.00.02' # Which is janky and not working. (What is the GD data format??) elif self.idn[0:5].upper() == 'RIGOL': # Get the model string m = self.idn.split(',')[1] # Find out if it's a d/e or a z: if m[-1] in ['Z']: self.model = 'RIGOLZ' elif m[-1] in ['B']: self.model = 'RIGOLB' else: self.model = 'RIGOLDE' # Poop out. else: self.model = None # Set the type of encoding for the binary data returned self.set_binary_encoding()