def __init__( self, parent, controller, size, title, msg_key, alpha_key, beta_key, gain_mu_key, gain_omega_key, omega_key, sample_rate_key, ): pubsub.pubsub.__init__(self) #proxy the keys self.proxy(MSG_KEY, controller, msg_key) self.proxy(ALPHA_KEY, controller, alpha_key) self.proxy(BETA_KEY, controller, beta_key) self.proxy(GAIN_MU_KEY, controller, gain_mu_key) self.proxy(GAIN_OMEGA_KEY, controller, gain_omega_key) self.proxy(OMEGA_KEY, controller, omega_key) self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key) #initialize values self[RUNNING_KEY] = True self[X_DIVS_KEY] = 8 self[Y_DIVS_KEY] = 8 self[MARKER_KEY] = DEFAULT_MARKER_TYPE #init panel and plot wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.channel_plotter(self) self.plotter.SetSize(wx.Size(*size)) self.plotter.set_title(title) self.plotter.set_x_label('Inphase') self.plotter.set_y_label('Quadrature') self.plotter.enable_point_label(True) self.plotter.enable_grid_lines(True) #setup the box with plot and controls self.control_panel = control_panel(self) main_box = wx.BoxSizer(wx.HORIZONTAL) main_box.Add(self.plotter, 1, wx.EXPAND) main_box.Add(self.control_panel, 0, wx.EXPAND) self.SetSizerAndFit(main_box) #alpha and gain mu 2nd orders def set_beta(alpha): self[BETA_KEY] = .25 * alpha**2 self.subscribe(ALPHA_KEY, set_beta) def set_gain_omega(gain_mu): self[GAIN_OMEGA_KEY] = .25 * gain_mu**2 self.subscribe(GAIN_MU_KEY, set_gain_omega) #register events self.subscribe(MSG_KEY, self.handle_msg) self.subscribe(X_DIVS_KEY, self.update_grid) self.subscribe(Y_DIVS_KEY, self.update_grid) #initial update self.update_grid()
def __init__( self, parent, controller, size, title, msg_key, alpha_key, beta_key, gain_mu_key, gain_omega_key, omega_key, sample_rate_key, ): pubsub.pubsub.__init__(self) # proxy the keys self.proxy(MSG_KEY, controller, msg_key) self.proxy(ALPHA_KEY, controller, alpha_key) self.proxy(BETA_KEY, controller, beta_key) self.proxy(GAIN_MU_KEY, controller, gain_mu_key) self.proxy(GAIN_OMEGA_KEY, controller, gain_omega_key) self.proxy(OMEGA_KEY, controller, omega_key) self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key) # initialize values self[RUNNING_KEY] = True self[X_DIVS_KEY] = 8 self[Y_DIVS_KEY] = 8 self[MARKER_KEY] = DEFAULT_MARKER_TYPE # init panel and plot wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.channel_plotter(self) self.plotter.SetSize(wx.Size(*size)) self.plotter.set_title(title) self.plotter.set_x_label("Inphase") self.plotter.set_y_label("Quadrature") self.plotter.enable_point_label(True) self.plotter.enable_grid_lines(True) # setup the box with plot and controls self.control_panel = control_panel(self) main_box = wx.BoxSizer(wx.HORIZONTAL) main_box.Add(self.plotter, 1, wx.EXPAND) main_box.Add(self.control_panel, 0, wx.EXPAND) self.SetSizerAndFit(main_box) # alpha and gain mu 2nd orders def set_beta(alpha): self[BETA_KEY] = 0.25 * alpha ** 2 self.subscribe(ALPHA_KEY, set_beta) def set_gain_omega(gain_mu): self[GAIN_OMEGA_KEY] = 0.25 * gain_mu ** 2 self.subscribe(GAIN_MU_KEY, set_gain_omega) # register events self.subscribe(MSG_KEY, self.handle_msg) self.subscribe(X_DIVS_KEY, self.update_grid) self.subscribe(Y_DIVS_KEY, self.update_grid) # initial update self.update_grid()
def __init__(self, parent, controller, size, title, real, fft_size, baseband_freq, sample_rate_key, y_per_div, y_divs, ref_level, average_key, avg_alpha_key, peak_hold, msg_key, use_persistence, persist_alpha, functionCallbackWhenHandleMessage=None, analog_sig_source=None, blocks_throttle=None): #-------------NOIS CUSTOMIZE------------------- print 'INIT FFT WINDOW' if functionCallbackWhenHandleMessage is None: print 'function call back in fft_window is null' self.callbackFunc = self.defaultCallbackFunc else: self.callbackFunc = functionCallbackWhenHandleMessage pubsub.pubsub.__init__(self) #--------------NOIS CUSTOMIZE--------------------------- #setup self.samples = EMPTY_TRACE self.real = real self.fft_size = fft_size self._reset_peak_vals() self._traces = dict() #proxy the keys self.proxy(MSG_KEY, controller, msg_key) self.proxy(AVERAGE_KEY, controller, average_key) self.proxy(AVG_ALPHA_KEY, controller, avg_alpha_key) self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key) #initialize values self[PEAK_HOLD_KEY] = peak_hold self[Y_PER_DIV_KEY] = y_per_div self[Y_DIVS_KEY] = y_divs self[X_DIVS_KEY] = 8 #approximate self[REF_LEVEL_KEY] = ref_level self[BASEBAND_FREQ_KEY] = baseband_freq self[RUNNING_KEY] = True self[USE_PERSISTENCE_KEY] = use_persistence self[PERSIST_ALPHA_KEY] = persist_alpha for trace in TRACES: #a function that returns a function #so the function wont use local trace def new_store_trace(my_trace): def store_trace(*args): self._traces[my_trace] = self.samples self.update_grid() return store_trace def new_toggle_trace(my_trace): def toggle_trace(toggle): #do an automatic store if toggled on and empty trace if toggle and not len(self._traces[my_trace]): self._traces[my_trace] = self.samples self.update_grid() return toggle_trace self._traces[trace] = EMPTY_TRACE self[TRACE_STORE_KEY + trace] = False self[TRACE_SHOW_KEY + trace] = False self.subscribe(TRACE_STORE_KEY + trace, new_store_trace(trace)) self.subscribe(TRACE_SHOW_KEY + trace, new_toggle_trace(trace)) #init panel and plot wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.channel_plotter(self) self.plotter.SetSize(wx.Size(*size)) self.plotter.SetSizeHints(*size) self.plotter.set_title(title) self.plotter.enable_legend(True) self.plotter.enable_point_label(True) self.plotter.enable_grid_lines(True) self.plotter.set_use_persistence(use_persistence) self.plotter.set_persist_alpha(persist_alpha) #setup the box with plot and controls self.control_panel = control_panel(self) main_box = wx.BoxSizer(wx.HORIZONTAL) main_box.Add(self.plotter, 1, wx.EXPAND) main_box.Add(self.control_panel, 0, wx.EXPAND) self.SetSizerAndFit(main_box) #register events self.subscribe(AVERAGE_KEY, self._reset_peak_vals) self.subscribe(MSG_KEY, self.handle_msg) self.subscribe(SAMPLE_RATE_KEY, self.update_grid) for key in ( BASEBAND_FREQ_KEY, Y_PER_DIV_KEY, X_DIVS_KEY, Y_DIVS_KEY, REF_LEVEL_KEY, ): self.subscribe(key, self.update_grid) self.subscribe(USE_PERSISTENCE_KEY, self.plotter.set_use_persistence) self.subscribe(PERSIST_ALPHA_KEY, self.plotter.set_persist_alpha) #initial update self.update_grid()
def __init__( self, parent, controller, size, title, frame_rate, num_inputs, sample_rate_key, t_scale, v_scale, v_offset, xy_mode, ac_couple_key, trigger_level_key, trigger_mode_key, trigger_slope_key, trigger_channel_key, decimation_key, msg_key, use_persistence, persist_alpha, trig_mode, y_axis_label, ): pubsub.pubsub.__init__(self) #check num inputs assert num_inputs <= len(CHANNEL_COLOR_SPECS) #setup self.sampleses = None self.num_inputs = num_inputs autorange = not v_scale self.autorange_ts = 0 v_scale = v_scale or 1 self.frame_rate_ts = 0 #proxy the keys self.proxy(MSG_KEY, controller, msg_key) self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key) self.proxy(TRIGGER_LEVEL_KEY, controller, trigger_level_key) self.proxy(TRIGGER_MODE_KEY, controller, trigger_mode_key) self.proxy(TRIGGER_SLOPE_KEY, controller, trigger_slope_key) self.proxy(TRIGGER_CHANNEL_KEY, controller, trigger_channel_key) self.proxy(DECIMATION_KEY, controller, decimation_key) #initialize values self[RUNNING_KEY] = True self[XY_MARKER_KEY] = 2.0 self[CHANNEL_OPTIONS_KEY] = 0 self[XY_MODE_KEY] = xy_mode self[X_CHANNEL_KEY] = 0 self[Y_CHANNEL_KEY] = self.num_inputs - 1 self[AUTORANGE_KEY] = autorange self[T_PER_DIV_KEY] = t_scale self[X_PER_DIV_KEY] = v_scale self[Y_PER_DIV_KEY] = v_scale self[T_OFF_KEY] = 0 self[X_OFF_KEY] = v_offset self[Y_OFF_KEY] = v_offset self[T_DIVS_KEY] = 8 self[X_DIVS_KEY] = 8 self[Y_DIVS_KEY] = 8 self[Y_AXIS_LABEL] = y_axis_label self[FRAME_RATE_KEY] = frame_rate self[TRIGGER_LEVEL_KEY] = 0 self[TRIGGER_CHANNEL_KEY] = 0 self[TRIGGER_MODE_KEY] = trig_mode self[TRIGGER_SLOPE_KEY] = gr.gr_TRIG_SLOPE_POS self[T_FRAC_OFF_KEY] = 0.5 self[USE_PERSISTENCE_KEY] = use_persistence self[PERSIST_ALPHA_KEY] = persist_alpha if self[TRIGGER_MODE_KEY] == gr.gr_TRIG_MODE_STRIPCHART: self[T_FRAC_OFF_KEY] = 0.0 for i in range(num_inputs): self.proxy(common.index_key(AC_COUPLE_KEY, i), controller, common.index_key(ac_couple_key, i)) #init panel and plot wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.channel_plotter(self) self.plotter.SetSize(wx.Size(*size)) self.plotter.SetSizeHints(*size) self.plotter.set_title(title) self.plotter.enable_legend(True) self.plotter.enable_point_label(True) self.plotter.enable_grid_lines(True) self.plotter.set_use_persistence(use_persistence) self.plotter.set_persist_alpha(persist_alpha) #setup the box with plot and controls self.control_panel = control_panel(self) main_box = wx.BoxSizer(wx.HORIZONTAL) main_box.Add(self.plotter, 1, wx.EXPAND) main_box.Add(self.control_panel, 0, wx.EXPAND) self.SetSizerAndFit(main_box) #register events for message self.subscribe(MSG_KEY, self.handle_msg) #register events for grid for key in [ common.index_key(MARKER_KEY, i) for i in range(self.num_inputs) ] + [ TRIGGER_LEVEL_KEY, TRIGGER_MODE_KEY, T_PER_DIV_KEY, X_PER_DIV_KEY, Y_PER_DIV_KEY, T_OFF_KEY, X_OFF_KEY, Y_OFF_KEY, T_DIVS_KEY, X_DIVS_KEY, Y_DIVS_KEY, XY_MODE_KEY, AUTORANGE_KEY, T_FRAC_OFF_KEY, TRIGGER_SHOW_KEY, XY_MARKER_KEY, X_CHANNEL_KEY, Y_CHANNEL_KEY, ]: self.subscribe(key, self.update_grid) #register events for plotter settings self.subscribe(USE_PERSISTENCE_KEY, self.plotter.set_use_persistence) self.subscribe(PERSIST_ALPHA_KEY, self.plotter.set_persist_alpha) #initial update self.update_grid()
def __init__( self, parent, controller, size, title, frame_rate, num_inputs, sample_rate_key, t_scale, v_scale, v_offset, xy_mode, ac_couple_key, trigger_level_key, trigger_mode_key, trigger_slope_key, trigger_channel_key, decimation_key, msg_key, use_persistence, persist_alpha, trig_mode, y_axis_label, ): pubsub.pubsub.__init__(self) #check num inputs assert num_inputs <= len(CHANNEL_COLOR_SPECS) #setup self.sampleses = None self.num_inputs = num_inputs autorange = not v_scale self.autorange_ts = 0 v_scale = v_scale or 1 self.frame_rate_ts = 0 #proxy the keys self.proxy(MSG_KEY, controller, msg_key) self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key) self.proxy(TRIGGER_LEVEL_KEY, controller, trigger_level_key) self.proxy(TRIGGER_MODE_KEY, controller, trigger_mode_key) self.proxy(TRIGGER_SLOPE_KEY, controller, trigger_slope_key) self.proxy(TRIGGER_CHANNEL_KEY, controller, trigger_channel_key) self.proxy(DECIMATION_KEY, controller, decimation_key) #initialize values self[RUNNING_KEY] = True self[XY_MARKER_KEY] = 2.0 self[CHANNEL_OPTIONS_KEY] = 0 self[XY_MODE_KEY] = xy_mode self[X_CHANNEL_KEY] = 0 self[Y_CHANNEL_KEY] = self.num_inputs-1 self[AUTORANGE_KEY] = autorange self[T_PER_DIV_KEY] = t_scale self[X_PER_DIV_KEY] = v_scale self[Y_PER_DIV_KEY] = v_scale self[T_OFF_KEY] = 0 self[X_OFF_KEY] = v_offset self[Y_OFF_KEY] = v_offset self[T_DIVS_KEY] = 8 self[X_DIVS_KEY] = 8 self[Y_DIVS_KEY] = 8 self[Y_AXIS_LABEL] = y_axis_label self[FRAME_RATE_KEY] = frame_rate self[TRIGGER_LEVEL_KEY] = 0 self[TRIGGER_CHANNEL_KEY] = 0 self[TRIGGER_MODE_KEY] = trig_mode self[TRIGGER_SLOPE_KEY] = wxgui.TRIG_SLOPE_POS self[T_FRAC_OFF_KEY] = 0.5 self[USE_PERSISTENCE_KEY] = use_persistence self[PERSIST_ALPHA_KEY] = persist_alpha if self[TRIGGER_MODE_KEY] == wxgui.TRIG_MODE_STRIPCHART: self[T_FRAC_OFF_KEY] = 0.0 for i in range(num_inputs): self.proxy(common.index_key(AC_COUPLE_KEY, i), controller, common.index_key(ac_couple_key, i)) #init panel and plot wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.channel_plotter(self) self.plotter.SetSize(wx.Size(*size)) self.plotter.SetSizeHints(*size) self.plotter.set_title(title) self.plotter.enable_legend(True) self.plotter.enable_point_label(True) self.plotter.enable_grid_lines(True) self.plotter.set_use_persistence(use_persistence) self.plotter.set_persist_alpha(persist_alpha) #setup the box with plot and controls self.control_panel = control_panel(self) main_box = wx.BoxSizer(wx.HORIZONTAL) main_box.Add(self.plotter, 1, wx.EXPAND) main_box.Add(self.control_panel, 0, wx.EXPAND) self.SetSizerAndFit(main_box) #register events for message self.subscribe(MSG_KEY, self.handle_msg) #register events for grid for key in [common.index_key(MARKER_KEY, i) for i in range(self.num_inputs)] + [ TRIGGER_LEVEL_KEY, TRIGGER_MODE_KEY, T_PER_DIV_KEY, X_PER_DIV_KEY, Y_PER_DIV_KEY, T_OFF_KEY, X_OFF_KEY, Y_OFF_KEY, T_DIVS_KEY, X_DIVS_KEY, Y_DIVS_KEY, XY_MODE_KEY, AUTORANGE_KEY, T_FRAC_OFF_KEY, TRIGGER_SHOW_KEY, XY_MARKER_KEY, X_CHANNEL_KEY, Y_CHANNEL_KEY, ]: self.subscribe(key, self.update_grid) #register events for plotter settings self.subscribe(USE_PERSISTENCE_KEY, self.plotter.set_use_persistence) self.subscribe(PERSIST_ALPHA_KEY, self.plotter.set_persist_alpha) #initial update self.update_grid()
def __init__( self, parent, controller, size, title, real, fft_size, baseband_freq, sample_rate_key, y_per_div, y_divs, ref_level, average_key, avg_alpha_key, peak_hold, msg_key, use_persistence, persist_alpha, ): pubsub.pubsub.__init__(self) #setup self.samples = EMPTY_TRACE self.real = real self.fft_size = fft_size self._reset_peak_vals() self._traces = dict() #proxy the keys self.proxy(MSG_KEY, controller, msg_key) self.proxy(AVERAGE_KEY, controller, average_key) self.proxy(AVG_ALPHA_KEY, controller, avg_alpha_key) self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key) #initialize values self[PEAK_HOLD_KEY] = peak_hold self[Y_PER_DIV_KEY] = y_per_div self[Y_DIVS_KEY] = y_divs self[X_DIVS_KEY] = 8 #approximate self[REF_LEVEL_KEY] = ref_level self[BASEBAND_FREQ_KEY] = baseband_freq self[RUNNING_KEY] = True self[USE_PERSISTENCE_KEY] = use_persistence self[PERSIST_ALPHA_KEY] = persist_alpha for trace in TRACES: #a function that returns a function #so the function wont use local trace def new_store_trace(my_trace): def store_trace(*args): self._traces[my_trace] = self.samples self.update_grid() return store_trace def new_toggle_trace(my_trace): def toggle_trace(toggle): #do an automatic store if toggled on and empty trace if toggle and not len(self._traces[my_trace]): self._traces[my_trace] = self.samples self.update_grid() return toggle_trace self._traces[trace] = EMPTY_TRACE self[TRACE_STORE_KEY+trace] = False self[TRACE_SHOW_KEY+trace] = False self.subscribe(TRACE_STORE_KEY+trace, new_store_trace(trace)) self.subscribe(TRACE_SHOW_KEY+trace, new_toggle_trace(trace)) #init panel and plot wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.channel_plotter(self) self.plotter.SetSize(wx.Size(*size)) self.plotter.set_title(title) self.plotter.enable_legend(True) self.plotter.enable_point_label(True) self.plotter.enable_grid_lines(True) self.plotter.set_use_persistence(use_persistence) self.plotter.set_persist_alpha(persist_alpha) #setup the box with plot and controls self.control_panel = control_panel(self) main_box = wx.BoxSizer(wx.HORIZONTAL) main_box.Add(self.plotter, 1, wx.EXPAND) main_box.Add(self.control_panel, 0, wx.EXPAND) self.SetSizerAndFit(main_box) #register events self.subscribe(AVERAGE_KEY, self._reset_peak_vals) self.subscribe(MSG_KEY, self.handle_msg) self.subscribe(SAMPLE_RATE_KEY, self.update_grid) for key in ( BASEBAND_FREQ_KEY, Y_PER_DIV_KEY, X_DIVS_KEY, Y_DIVS_KEY, REF_LEVEL_KEY, ): self.subscribe(key, self.update_grid) self.subscribe(USE_PERSISTENCE_KEY, self.plotter.set_use_persistence) self.subscribe(PERSIST_ALPHA_KEY, self.plotter.set_persist_alpha) #initial update self.update_grid()
def __init__( self, parent, controller, size, title, real, fft_size, baseband_freq, sample_rate_key, y_per_div, y_divs, ref_level, average_key, avg_alpha_key, peak_hold, msg_key, ): pubsub.pubsub.__init__(self) # ensure y_per_div if y_per_div not in DIV_LEVELS: y_per_div = DIV_LEVELS[0] # setup self.samples = list() self.real = real self.fft_size = fft_size self._reset_peak_vals() # proxy the keys self.proxy(MSG_KEY, controller, msg_key) self.proxy(AVERAGE_KEY, controller, average_key) self.proxy(AVG_ALPHA_KEY, controller, avg_alpha_key) self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key) # initialize values self[PEAK_HOLD_KEY] = peak_hold self[Y_PER_DIV_KEY] = y_per_div self[Y_DIVS_KEY] = y_divs self[X_DIVS_KEY] = 8 # approximate self[REF_LEVEL_KEY] = ref_level self[BASEBAND_FREQ_KEY] = baseband_freq self[RUNNING_KEY] = True # init panel and plot wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.channel_plotter(self) self.plotter.SetSize(wx.Size(*size)) self.plotter.set_title(title) self.plotter.enable_legend(True) self.plotter.enable_point_label(True) self.plotter.enable_grid_lines(True) # setup the box with plot and controls self.control_panel = control_panel(self) main_box = wx.BoxSizer(wx.HORIZONTAL) main_box.Add(self.plotter, 1, wx.EXPAND) main_box.Add(self.control_panel, 0, wx.EXPAND) self.SetSizerAndFit(main_box) # register events self.subscribe(AVERAGE_KEY, lambda x: self._reset_peak_vals()) self.subscribe(MSG_KEY, self.handle_msg) self.subscribe(SAMPLE_RATE_KEY, self.update_grid) for key in (BASEBAND_FREQ_KEY, Y_PER_DIV_KEY, X_DIVS_KEY, Y_DIVS_KEY, REF_LEVEL_KEY): self.subscribe(key, self.update_grid) # initial update self.update_grid()