From 760f993592e804ad425db4619b085fbcdf347262 Mon Sep 17 00:00:00 2001 From: Balint Seeber Date: Mon, 27 Jul 2015 09:29:58 -0700 Subject: tools: Added mega_fft --- tools/mega_fft/MegaFFT-3.7.grc | 10459 +++++++++++++++++++++++++++++++++++++++ tools/mega_fft/README.md | 7 + tools/mega_fft/mega_fft.py | 2645 ++++++++++ tools/mega_fft/mega_fft_2ch.py | 2818 +++++++++++ 4 files changed, 15929 insertions(+) create mode 100644 tools/mega_fft/MegaFFT-3.7.grc create mode 100644 tools/mega_fft/README.md create mode 100755 tools/mega_fft/mega_fft.py create mode 100755 tools/mega_fft/mega_fft_2ch.py (limited to 'tools/mega_fft') diff --git a/tools/mega_fft/MegaFFT-3.7.grc b/tools/mega_fft/MegaFFT-3.7.grc new file mode 100644 index 000000000..500c7a8bb --- /dev/null +++ b/tools/mega_fft/MegaFFT-3.7.grc @@ -0,0 +1,10459 @@ + + + + Thu Feb 19 08:48:00 2015 + + options + + author + Balint Seeber, Ettus Research + + + alias + + + + category + Custom + + + comment + + + + description + Standard edition, single-channel + + + _enabled + True + + + _coordinate + (10, 10) + + + _rotation + 0 + + + generate_options + wx_gui + + + id + mega_fft + + + max_nouts + 0 + + + realtime_scheduling + 1 + + + run_options + prompt + + + run + True + + + thread_safe_setters + + + + title + Mega FFT + + + window_size + 2400, 1800 + + + + variable_any_code + + callback_mode + post + + + code + self.src.get_center_freq() + + + comment + + + + value + 0 + + + _enabled + True + + + first_eval + inline + + + _coordinate + (173, 1024) + + + _rotation + 0 + + + id + actual_center_freq + + + injection + variable + + + deps + {'tune_obj': tune_obj} + + + + variable_any_code + + callback_mode + post + + + code + self.src.get_samp_rate() + + + comment + + + + value + rate + + + _enabled + True + + + first_eval + inline + + + _coordinate + (762, 1310) + + + _rotation + 0 + + + id + actual_sample_rate + + + injection + variable + + + deps + {'requested_sample_rate': requested_sample_rate} + + + + variable_any_code + + callback_mode + post + + + code + self.src.get_antennas() + + + comment + + + + value + [''] + + + _enabled + True + + + first_eval + inline + + + _coordinate + (1361, 1211) + + + _rotation + 0 + + + id + antennas + + + injection + variable + + + deps + {} + + + + variable_any_code + + callback_mode + post + + + code + if self.fft_sink.controller['average']: self.fft_sink.controller['average'] = False; time.sleep(0.25); self.fft_sink.controller['average'] = True; + + + comment + + + + value + test + + + _enabled + True + + + first_eval + none + + + _coordinate + (496, 409) + + + _rotation + 0 + + + id + any_test_1 + + + injection + plain + + + deps + {'test': test} + + + + variable_any_code + + callback_mode + post + + + code + self.fft_sink.controller['average'] = True + + + comment + + + + value + any_test_1 + + + _enabled + False + + + first_eval + none + + + _coordinate + (617, 499) + + + _rotation + 0 + + + id + any_test_1_0 + + + injection + plain + + + deps + {'any_test': any_test_1} + + + + variable_check_box + + comment + + + + value + True + + + _enabled + True + + + false + False + + + _coordinate + (529, 632) + + + _rotation + 0 + + + grid_pos + + + + id + auto_dc_offset_removal + + + label + Auto DC offset removal + + + notebook + nb_analog, 1 + + + true + True + + + + variable_check_box + + comment + + + + value + True + + + _enabled + True + + + false + False + + + _coordinate + (576, 828) + + + _rotation + 0 + + + grid_pos + + + + id + auto_iq_correction + + + label + Auto IQ correction + + + notebook + nb_analog, 1 + + + true + True + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (505, 1023) + + + _rotation + 0 + + + id + clicked_freq + + + value + 0 + + + + variable_text_box + + comment + + + + converver + float_converter + + + value + clicked_freq + + + _enabled + True + + + formatter + None + + + _coordinate + (423, 921) + + + _rotation + 0 + + + grid_pos + + + + id + clicked_freq_txt + + + label + Clicked freq + + + notebook + nb_test, 0 + + + + variable_function_probe + + block_id + src + + + comment + + + + _enabled + True + + + function_args + + + + function_name + get_sensor_names + + + _coordinate + (2138, 153) + + + _rotation + 0 + + + id + daughterboard_sensor_names + + + poll_rate + sensor_interval + + + value + [] + + + + variable_any_code + + callback_mode + post + + + code + '\n'.join(map(lambda x: '%s: %s' % (x, str(self.src.get_sensor(x))), self.daughterboard_sensor_names)) + + + comment + + + + value + '(none)' + + + _enabled + True + + + first_eval + inline + + + _coordinate + (2143, 258) + + + _rotation + 0 + + + id + daughterboard_sensors + + + injection + variable + + + deps + {'daughterboard_sensor_names': daughterboard_sensor_names} + + + + variable + + comment + + + + _enabled + False + + + _coordinate + (441, 1338) + + + _rotation + 0 + + + id + decim + + + value + int(2**decim_idx) + + + + variable_slider + + comment + + + + converver + int_converter + + + value + 1 + + + _enabled + True + + + _coordinate + (769, 1062) + + + _rotation + 0 + + + grid_pos + + + + id + decim + + + label + Divide base sample rate + + + max + max_decim + + + min + 1 + + + notebook + nb_rate, 0 + + + num_steps + max_decim-1 + + + style + wx.SL_HORIZONTAL + + + + variable_slider + + comment + + + + converver + int_converter + + + value + 0 + + + _enabled + False + + + _coordinate + (472, 1150) + + + _rotation + 0 + + + grid_pos + + + + id + decim_idx + + + label + Decimate current sample rate + + + max + int(math.log(max_decim)/math.log(2)) + + + min + 0 + + + notebook + nb_rate, 0 + + + num_steps + int(math.log(max_decim)/math.log(2)) + + + style + wx.SL_HORIZONTAL + + + + variable_any_code_post_eval + + comment + + + + _enabled + False + + + _coordinate + (1619, 1219) + + + _rotation + 0 + + + id + dont_need_this_now_built_in_to_Any_Code_block + + + + variable_function_probe + + block_id + fft_sink + + + comment + + + + _enabled + True + + + function_args + + + + function_name + win['avg_alpha'] * [1.0/self.fft_sink.win['avg_alpha'],1.0][self.fft_sink.win['average']]; + + + _coordinate + (352, 311) + + + _rotation + 0 + + + id + fft_ave_probe + + + poll_rate + 5 + + + value + ave + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (1322, 397) + + + _rotation + 0 + + + id + fft_averaging + + + value + str_to_bool(averaging) + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (328, 1177) + + + _rotation + 0 + + + id + fft_center_freq + + + value + actual_center_freq * relative_freq + + + + variable_function_probe + + block_id + fft_max_idx_probe + + + comment + + + + _enabled + True + + + function_args + + + + function_name + level + + + _coordinate + (784, 373) + + + _rotation + 0 + + + id + fft_max_idx + + + poll_rate + probe_interval + + + value + (fft_size/2)*0 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (808, 682) + + + _rotation + 0 + + + id + fft_max_idx_norm + + + value + [fft_max_idx,fft_max_idx-fft_size][int(fft_max_idx>(fft_size/2))] + + + + variable_function_probe + + block_id + fft_max_lvl_probe + + + comment + + + + _enabled + True + + + function_args + + + + function_name + level + + + _coordinate + (937, 652) + + + _rotation + 0 + + + id + fft_max_lvl + + + poll_rate + probe_interval + + + value + 0.0 + + + + variable_function_probe + + block_id + fft_max_lvl_probe_2 + + + comment + + + + _enabled + False + + + function_args + + + + function_name + level + + + _coordinate + (1119, 1682) + + + _rotation + 0 + + + id + fft_max_lvl_2 + + + poll_rate + probe_interval + + + value + 0.0 + + + + variable + + comment + + + + _enabled + False + + + _coordinate + (1055, 490) + + + _rotation + 0 + + + id + fft_max_lvl_log + + + value + math.log10([fft_max_lvl,1.0][int(fft_max_lvl==0.0)])*10.0 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (947, 373) + + + _rotation + 0 + + + id + fft_max_lvl_value + + + value + fft_max_lvl + + + + variable + + comment + + + + _enabled + False + + + _coordinate + (1293, 1707) + + + _rotation + 0 + + + id + fft_max_lvl_value_2 + + + value + fft_max_lvl_2 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (1155, 399) + + + _rotation + 0 + + + id + fft_peak_hold + + + value + str_to_bool(peak_hold) + + + + variable_any_code + + callback_mode + post + + + code + ((freq <= freq_range.stop()) and (freq >= freq_range.start())) or self.set_requested_freq_txt(self.src.get_center_freq()); print self.src.get_center_freq() + + + comment + + + + value + None + + + _enabled + True + + + first_eval + post + + + _coordinate + (352, 665) + + + _rotation + 0 + + + id + fix_invalid_freq + + + injection + plain + + + deps + {} + + + + variable_slider + + comment + + + + converver + float_converter + + + value + 0 + + + _enabled + True + + + _coordinate + (277, 893) + + + _rotation + 0 + + + grid_pos + 2, 0, 1, 1 + + + id + freq_fine + + + label + Freq (fine) + + + max + freq_fine_range/2 + + + min + -freq_fine_range/2 + + + notebook + nb_freq, 0 + + + num_steps + 1000 + + + style + wx.SL_HORIZONTAL + + + + variable_any_code + + callback_mode + post + + + code + self.src.get_freq_range() + + + comment + + + + value + uhd.freq_range(freq,freq+1) + + + _enabled + True + + + first_eval + inline + + + _coordinate + (91, 795) + + + _rotation + 0 + + + id + freq_range + + + injection + variable + + + deps + {} + + + + variable_any_code + + callback_mode + post + + + code + [gain,initial_gain][gain==float('-inf')] + + + comment + + + + value + gain_range.start() + + + _enabled + True + + + first_eval + inline + + + _coordinate + (1467, 1032) + + + _rotation + 0 + + + id + gain_default + + + injection + variable + + + deps + {'initial_gain': initial_gain} + + + + variable_any_code + + callback_mode + post + + + code + self.src.get_gain_range() + + + comment + + + + value + uhd.gain_range(0,0,0) + + + _enabled + True + + + first_eval + inline + + + _coordinate + (1304, 1034) + + + _rotation + 0 + + + id + gain_range + + + injection + variable + + + deps + {} + + + + variable_any_code + + callback_mode + post + + + code + print self.src.get_antennas() + + + comment + + + + value + None + + + _enabled + False + + + first_eval + inline + + + _coordinate + (1361, 1127) + + + _rotation + 0 + + + id + get_antennas + + + injection + plain + + + deps + {} + + + + variable_any_code + + callback_mode + post + + + code + 'lo_locked' in self.src.get_sensor_names() + + + comment + + + + value + False + + + _enabled + True + + + first_eval + inline + + + _coordinate + (338, 1236) + + + _rotation + 0 + + + id + has_lo_locked + + + injection + variable + + + deps + {} + + + + variable_any_code + + callback_mode + post + + + code + [gain,gain_range.start() + ((gain_range.stop() - gain_range.start()) * 0.25)][gain==float('-inf')] + + + comment + + + + value + 0 + + + _enabled + True + + + first_eval + inline + + + _coordinate + (1380, 839) + + + _rotation + 0 + + + id + initial_gain + + + injection + variable + + + deps + {'gain_range': gain_range} + + + + variable + + comment + + + + _enabled + False + + + _coordinate + (1693, 976) + + + _rotation + 0 + + + id + initial_gain_old + + + value + gain_range.start() + ((gain_range.stop() - gain_range.start()) * 0.25) + + + + variable_text_box + + comment + + + + converver + float_converter + + + value + lo_offset + + + _enabled + True + + + formatter + None + + + _coordinate + (162, 729) + + + _rotation + 0 + + + grid_pos + 4, 0, 1, 1 + + + id + lo_offset_txt + + + label + LO offset (only for LO offset tuning mode) + + + notebook + nb_freq, 0 + + + + variable_function_probe + + block_id + src + + + comment + + + + _enabled + True + + + function_args + "'lo_locked'" + + + function_name + get_sensor + + + _coordinate + (7, 1282) + + + _rotation + 0 + + + id + locked_probe + + + poll_rate + lo_check_interval * float(has_lo_locked) + + + value + '(unknown)' + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (947, 489) + + + _rotation + 0 + + + id + max_bin_freq + + + value + fft_center_freq + (((1.0*fft_max_idx_norm) / fft_size) * samp_rate) + + + + variable + + comment + + + + _enabled + False + + + _coordinate + (947, 430) + + + _rotation + 0 + + + id + max_bin_freq_old + + + value + fft_center_freq + (((1.0*fft_max_idx_norm - (fft_size/2)) / fft_size) * samp_rate) + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (666, 1121) + + + _rotation + 0 + + + id + max_decim + + + value + 256 + + + + variable_function_probe + + block_id + src + + + comment + + + + _enabled + True + + + function_args + + + + function_name + get_mboard_sensor_names + + + _coordinate + (1950, 150) + + + _rotation + 0 + + + id + motherboard_sensor_names + + + poll_rate + sensor_interval + + + value + [] + + + + variable_any_code + + callback_mode + post + + + code + '\n'.join(map(lambda x: '%s: %s' % (x, str(self.src.get_mboard_sensor(x))), filter(lambda x: x.find('gps') != 0, self.motherboard_sensor_names))) + + + comment + + + + value + '(none)' + + + _enabled + True + + + first_eval + inline + + + _coordinate + (1954, 257) + + + _rotation + 0 + + + id + motherboard_sensors + + + injection + variable + + + deps + {'motherboard_sensor_names': motherboard_sensor_names} + + + + variable_check_box + + comment + + + + value + 1 + + + _enabled + False + + + false + 1 + + + _coordinate + (7, 1154) + + + _rotation + 0 + + + grid_pos + + + + id + relative_freq + + + label + Baseband Frequency Axis + + + notebook + nb_test, 0 + + + true + 0 + + + + variable_chooser + + choices + [1, 0] + + + comment + + + + value + 1 + + + _enabled + True + + + _coordinate + (179, 1108) + + + _rotation + 0 + + + grid_pos + 7, 0, 1, 1 + + + id + relative_freq + + + label + Frequency Axis + + + labels + ['RF', 'Baseband'] + + + notebook + nb_freq, 0 + + + style + wx.RA_HORIZONTAL + + + type + drop_down + + + + variable_chooser + + choices + [False, True] + + + comment + + + + value + True + + + _enabled + True + + + _coordinate + (1106, 901) + + + _rotation + 0 + + + grid_pos + 1, 0, 1, 1 + + + id + relative_time + + + label + Time display + + + labels + ['Absolute', 'Relative'] + + + notebook + nb_test, 0 + + + style + wx.RA_HORIZONTAL + + + type + drop_down + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (324, 1116) + + + _rotation + 0 + + + id + requested_freq + + + value + requested_freq_txt + freq_fine + + + + variable_slider + + comment + + + + converver + float_converter + + + value + freq + + + _enabled + True + + + _coordinate + (91, 706) + + + _rotation + 0 + + + grid_pos + 1, 0, 1, 1 + + + id + requested_freq_txt + + + label + Requested freq + + + max + [freq_range.stop(), freq_range.start() + 1.0][freq_range.start()==freq_range.stop()] + + + min + freq_range.start() + + + notebook + nb_freq, 0 + + + num_steps + [1000,1][freq_range.start()==freq_range.stop()] + + + style + wx.SL_HORIZONTAL + + + + variable_text_box + + comment + + + + converver + float_converter + + + value + freq + + + _enabled + False + + + formatter + None + + + _coordinate + (3, 748) + + + _rotation + 0 + + + grid_pos + 1, 0, 1, 1 + + + id + requested_freq_txt + + + label + Requested base freq + + + notebook + nb_freq, 0 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (608, 1062) + + + _rotation + 0 + + + id + requested_sample_rate + + + value + requested_sample_rate_base / (1.*decim) + + + + variable_text_box + + comment + + + + converver + float_converter + + + value + rate + + + _enabled + True + + + formatter + None + + + _coordinate + (588, 1282) + + + _rotation + 0 + + + grid_pos + 0, 0, 1, 1 + + + id + requested_sample_rate_base + + + label + Requested base sample rate + + + notebook + nb_rate, 0 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (498, 1281) + + + _rotation + 0 + + + id + samp_rate + + + value + int(actual_sample_rate) + + + + variable_chooser + + choices + [0, 1] + + + comment + + + + value + 0+1 + + + _enabled + True + + + _coordinate + (1442, 4) + + + _rotation + 0 + + + grid_pos + + + + id + scope_mode + + + label + Scope Mode + + + labels + ['Complex', 'Magnitude'] + + + notebook + nb, 1 + + + style + wx.RA_HORIZONTAL + + + type + radio_buttons + + + + variable_chooser + + choices + [0, 1] + + + comment + + + + value + 0+1 + + + _enabled + False + + + _coordinate + (1465, 1432) + + + _rotation + 0 + + + grid_pos + + + + id + scope_mode_2 + + + label + Scope Mode 2 + + + labels + ['Complex', 'Magnitude'] + + + notebook + nb, 1 + + + style + wx.RA_HORIZONTAL + + + type + radio_buttons + + + + variable_chooser + + choices + antennas + + + comment + + + + value + [ [antenna,antennas[0]][antenna not in antennas] ,antennas[0]][antenna==''] + + + _enabled + True + + + _coordinate + (1526, 1265) + + + _rotation + 0 + + + grid_pos + + + + id + selected_antenna + + + label + Antenna + + + labels + [antennas,['(default)']][antennas==('',)] + + + notebook + nb_analog, 0 + + + style + wx.RA_HORIZONTAL + + + type + radio_buttons + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (187, 5) + + + _rotation + 0 + + + id + selected_antenna_proxy + + + value + selected_antenna + + + + variable_slider + + comment + + + + converver + float_converter + + + value + gain_default + + + _enabled + True + + + _coordinate + (1554, 906) + + + _rotation + 0 + + + grid_pos + + + + id + selected_gain + + + label + Gain + + + max + [gain_range.stop(), gain_range.start() + 1.0][gain_range.stop()==gain_range.start()] + + + min + gain_range.start() + + + notebook + nb_analog, 0 + + + num_steps + [int((abs(gain_range.stop()-gain_range.start())/[gain_range.step(), 1.0][gain_range.step()==0])), 1][gain_range.stop()==gain_range.start()] + + + style + wx.SL_HORIZONTAL + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (207, 65) + + + _rotation + 0 + + + id + selected_gain_proxy + + + value + selected_gain + + + + variable_any_code + + callback_mode + post + + + code + self.src.set_antenna(self.selected_antenna) + + + comment + + + + value + None + + + _enabled + False + + + first_eval + none + + + _coordinate + (1526, 1127) + + + _rotation + 0 + + + id + set_antenna + + + injection + plain + + + deps + {'selected_antenna': selected_antenna} + + + + variable_check_box + + comment + + + + value + True + + + _enabled + True + + + false + False + + + _coordinate + (352, 411) + + + _rotation + 0 + + + grid_pos + 0, 1, 1, 1 + + + id + show_max_freq + + + label + Show max freq + + + notebook + nb_test, 0 + + + true + True + + + + variable_check_box + + comment + + + + value + True + + + _enabled + True + + + false + False + + + _coordinate + (352, 538) + + + _rotation + 0 + + + grid_pos + 0, 2, 1, 1 + + + id + show_max_lvl + + + label + Show max level + + + notebook + nb_test, 0 + + + true + True + + + + variable_check_box + + comment + + + + value + [False, True][show_stream_tags.lower() != 'false'] + + + _enabled + True + + + false + False + + + _coordinate + (1172, 578) + + + _rotation + 0 + + + grid_pos + 0, 0, 1, 1 + + + id + show_stream_tags_chk + + + label + Print stream tags + + + notebook + nb_test, 0 + + + true + True + + + + variable_function_probe + + block_id + probe_avg_mag + + + comment + + + + _enabled + True + + + function_args + + + + function_name + level + + + _coordinate + (765, 820) + + + _rotation + 0 + + + id + signal_probe + + + poll_rate + probe_interval + + + value + 0.0 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (916, 911) + + + _rotation + 0 + + + id + signal_probe_log + + + value + math.log10([signal_probe,1.0][signal_probe==0.0])*10 + + + + variable_any_code + + callback_mode + inline + + + code + if self.spec != "": self.src.set_subdev_spec(self.spec, 0); print self.spec + + + comment + + + + value + None + + + _enabled + False + + + first_eval + inline + + + _coordinate + (1795, 618) + + + _rotation + 0 + + + id + spec_proxy + + + injection + plain + + + deps + {} + + + + variable_static_text + + comment + + + + converver + str_converter + + + value + '"' + str(locked_probe) + '"' + + + _enabled + True + + + formatter + None + + + _coordinate + (172, 1234) + + + _rotation + 0 + + + grid_pos + + + + id + static_locked + + + label + Locked + + + notebook + nb_info, 0 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (1230, 251) + + + _rotation + 0 + + + id + str_to_bool + + + value + lambda x: len(x)>0 and x.lower()[0] not in ['0', 'n', 'f'] + + + + variable_any_code + + callback_mode + post + + + code + '[' + self.src.get_subdev_spec().strip() + ']' + + + comment + + + + value + '(unknown)' + + + _enabled + True + + + first_eval + inline + + + _coordinate + (954, 1201) + + + _rotation + 0 + + + id + subdev_spec + + + injection + variable + + + deps + {} + + + + variable_chooser + + choices + [1] + + + comment + + + + value + 1 + + + _enabled + True + + + _coordinate + (497, 497) + + + _rotation + 0 + + + grid_pos + + + + id + test + + + label + Test + + + labels + ['Reset FFT average'] + + + notebook + nb_test, 0 + + + style + wx.RA_HORIZONTAL + + + type + button + + + + variable_function_probe + + block_id + src + + + comment + + + + _enabled + True + + + function_args + + + + function_name + get_time_now + + + _coordinate + (1107, 702) + + + _rotation + 0 + + + id + time_probe + + + poll_rate + sensor_interval + + + value + uhd.time_spec_t() + + + + variable_chooser + + choices + [0, 1, 2] + + + comment + + + + value + [1,0][lo_offset==0.0] + + + _enabled + True + + + _coordinate + (8, 1017) + + + _rotation + 0 + + + grid_pos + 0, 0, 1, 1 + + + id + tune_mode + + + label + Tune mode + + + labels + ['Auto (no LO offset)', 'Auto with LO offset', 'Manual (no DSP)'] + + + notebook + nb_freq, 0 + + + style + wx.RA_HORIZONTAL + + + type + drop_down + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (176, 868) + + + _rotation + 0 + + + id + tune_obj + + + value + [requested_freq, uhd.tune_request(requested_freq, lo_offset_txt), uhd.tune_request(requested_freq, dsp_freq=0, dsp_freq_policy=uhd.tune_request.POLICY_MANUAL)][tune_mode] + + + + variable_any_code + + callback_mode + post + + + code + self.src.set_center_freq(self.tune_obj) + + + comment + + + + value + uhd.tune_result_t() + + + _enabled + True + + + first_eval + inline + + + _coordinate + (346, 88) + + + _rotation + 0 + + + id + tune_result + + + injection + variable + + + deps + {'tune_obj': tune_obj} + + + + variable_any_code + + callback_mode + inline + + + code + if self.ref != '': self.src.set_clock_source(self.ref, 0); print 'Ref =', self.ref; + + + comment + + + + value + None + + + _enabled + True + + + first_eval + inline + + + _coordinate + (1314, 748) + + + _rotation + 0 + + + id + update_clock_source + + + injection + plain + + + deps + {'ref': ref} + + + + variable_any_code + + callback_mode + inline + + + code + if self.pps != '': self.src.set_time_source(self.pps, 0); print '1 PPS =', self.pps; + + + comment + + + + value + None + + + _enabled + True + + + first_eval + inline + + + _coordinate + (1316, 664) + + + _rotation + 0 + + + id + update_time_source + + + injection + plain + + + deps + {'pps': pps} + + + + variable_any_code + + callback_mode + post + + + code + '%s (\'%s\'), %s' % (self.src.get_usrp_info().get('mboard_id'), self.src.get_usrp_info().get('mboard_name'), self.src.get_usrp_info().get('rx_subdev_name')) + + + comment + + + + value + '(unknown)' + + + _enabled + True + + + first_eval + inline + + + _coordinate + (1240, 1201) + + + _rotation + 0 + + + id + usrp_info + + + injection + variable + + + deps + {} + + + + variable_any_code + + callback_mode + post + + + code + ',\n'.join(map(lambda x: '%s: %s'%(x,self.src.get_usrp_info().get(x)), self.src.get_usrp_info().keys())) + + + comment + + + + value + '(unknown)' + + + _enabled + False + + + first_eval + inline + + + _coordinate + (1096, 1201) + + + _rotation + 0 + + + id + usrp_info_all + + + injection + variable + + + deps + {} + + + + variable_any_code + + callback_mode + post + + + code + [self.src.set_auto_dc_offset(self.auto_dc_offset_removal), self.auto_dc_offset_removal or self.src.set_dc_offset(0+0j)] + + + comment + + + + value + None + + + _enabled + True + + + first_eval + inline + + + _coordinate + (536, 744) + + + _rotation + 0 + + + id + variable_any_code_auto_dc_offset_removal + + + injection + plain + + + deps + {'auto_dc_offset_removal': auto_dc_offset_removal} + + + + variable_any_code + + callback_mode + post + + + code + self.fft_sink.win['average'] = fft_averaging + + + comment + + + + value + fft_averaging + + + _enabled + True + + + first_eval + post + + + _coordinate + (354, 227) + + + _rotation + 0 + + + id + variable_any_code_fft_sink_ave + + + injection + variable + + + deps + {'averaging': fft_averaging} + + + + variable_any_code + + callback_mode + post + + + code + self.fft_sink.win['peak_hold'] = fft_peak_hold + + + comment + + + + value + fft_peak_hold + + + _enabled + True + + + first_eval + inline + + + _coordinate + (355, 142) + + + _rotation + 0 + + + id + variable_any_code_fft_sink_peak_hold + + + injection + variable + + + deps + {'peak_hold': fft_peak_hold} + + + + variable_any_code + + callback_mode + post + + + code + [self.src.set_auto_iq_balance(self.auto_iq_correction), self.auto_iq_correction or self.src.set_iq_balance(0+0j)] + + + comment + + + + value + None + + + _enabled + True + + + first_eval + inline + + + _coordinate + (583, 940) + + + _rotation + 0 + + + id + variable_any_code_iq_correction + + + injection + plain + + + deps + {'auto_iq_correction': auto_iq_correction} + + + + variable_any_code + + callback_mode + post + + + code + self.waterfall_sink.win['average'] = fft_averaging + + + comment + + + + value + fft_averaging + + + _enabled + True + + + first_eval + post + + + _coordinate + (171, 643) + + + _rotation + 0 + + + id + variable_any_code_waterfall_ave + + + injection + variable + + + deps + {'averaging': fft_averaging} + + + + variable_config + + comment + + + + config_file + default + + + value + 0 + + + _enabled + False + + + _coordinate + (1670, 1266) + + + _rotation + 0 + + + id + variable_config_0 + + + option + key + + + section + main + + + type + real + + + writeback + None + + + + variable_static_text + + comment + + + + converver + float_converter + + + value + actual_center_freq + + + _enabled + False + + + formatter + None + + + _coordinate + (343, 724) + + + _rotation + 0 + + + grid_pos + + + + id + variable_static_actual_center_freq + + + label + Actual center frequency + + + notebook + nb_freq, 0 + + + + variable_static_text + + comment + + + + converver + float_converter + + + value + tune_result.actual_dsp_freq + + + _enabled + True + + + formatter + None + + + _coordinate + (5, 943) + + + _rotation + 0 + + + grid_pos + 6, 0, 1, 1 + + + id + variable_static_actual_dsp_freq + + + label + Actual DSP freq + + + notebook + nb_freq, 0 + + + + variable_static_text + + comment + + + + converver + float_converter + + + value + actual_sample_rate + + + _enabled + True + + + formatter + None + + + _coordinate + (762, 1196) + + + _rotation + 0 + + + grid_pos + 0, 1, 1, 1 + + + id + variable_static_actual_sample_rate + + + label + Actual + + + notebook + nb_rate, 0 + + + + variable_static_text + + comment + + + + converver + int_converter + + + value + fft_max_idx + + + _enabled + False + + + formatter + None + + + _coordinate + (779, 473) + + + _rotation + 0 + + + grid_pos + + + + id + variable_static_fft_max_idx + + + label + Idx + + + notebook + nb_test, 0 + + + + variable_static_text + + comment + + + + converver + float_converter + + + value + fft_max_lvl + + + _enabled + True + + + formatter + None + + + _coordinate + (948, 552) + + + _rotation + 0 + + + grid_pos + + + + id + variable_static_fft_max_lvl_log + + + label + Peak magnitude (dB) + + + notebook + nb_test, 0 + + + + variable_static_text + + comment + + + + converver + str_converter + + + value + window_fn_name_map[window] + + + _enabled + True + + + formatter + None + + + _coordinate + (1628, 204) + + + _rotation + 0 + + + grid_pos + + + + id + variable_static_fft_window_name + + + label + FFT window + + + notebook + nb_info, 0 + + + + variable_static_text + + comment + + + + converver + str_converter + + + value + gain_range.to_pp_string().strip() + + + _enabled + False + + + formatter + None + + + _coordinate + (1623, 1032) + + + _rotation + 0 + + + grid_pos + + + + id + variable_static_gain_range + + + label + Gain Range + + + notebook + + + + + variable_static_text + + comment + + + + converver + float_converter + + + value + signal_probe_log + + + _enabled + True + + + formatter + None + + + _coordinate + (748, 918) + + + _rotation + 0 + + + grid_pos + + + + id + variable_static_level_probe + + + label + Signal mag^2 (dB) + + + notebook + nb_test, 0 + + + + variable_static_text + + comment + + + + converver + float_converter + + + value + max_bin_freq + + + _enabled + True + + + formatter + None + + + _coordinate + (767, 579) + + + _rotation + 0 + + + grid_pos + + + + id + variable_static_max_bin_freq + + + label + Peak freq + + + notebook + nb_test, 0 + + + + variable_static_text + + comment + + + + converver + float_converter + + + value + requested_freq + + + _enabled + True + + + formatter + None + + + _coordinate + (271, 793) + + + _rotation + 0 + + + grid_pos + 3, 0, 1, 1 + + + id + variable_static_requested_freq + + + label + Requested base + fine freq + + + notebook + nb_freq, 0 + + + + variable_static_text + + comment + + + + converver + float_converter + + + value + tune_result.actual_rf_freq + + + _enabled + True + + + formatter + None + + + _coordinate + (5, 843) + + + _rotation + 0 + + + grid_pos + 5, 0, 1, 1 + + + id + variable_static_rf_freq + + + label + Actual RF freq + + + notebook + nb_freq, 0 + + + + variable_static_text + + comment + + + + converver + str_converter + + + value + subdev_spec + + + _enabled + True + + + formatter + None + + + _coordinate + (955, 1285) + + + _rotation + 0 + + + grid_pos + 1, 0, 1, 1 + + + id + variable_static_subdev_spec + + + label + Sub-device + + + notebook + nb_info, 0 + + + + variable_static_text + + comment + + + + converver + str_converter + + + value + motherboard_sensors + + + _enabled + True + + + formatter + None + + + _coordinate + (1955, 30) + + + _rotation + 0 + + + grid_pos + 0, 0, 1, 1 + + + id + variable_static_text_0 + + + label + Motherboard + + + notebook + nb, 3 + + + + variable_static_text + + comment + + + + converver + str_converter + + + value + daughterboard_sensors + + + _enabled + True + + + formatter + None + + + _coordinate + (2153, 37) + + + _rotation + 0 + + + grid_pos + 2, 0, 1, 1 + + + id + variable_static_text_0_0 + + + label + Daughterboard + + + notebook + nb, 3 + + + + variable_static_text + + comment + + + + converver + str_converter + + + value + str( [time.ctime(time_probe.get_real_secs()), datetime.timedelta(seconds=time_probe.get_real_secs()), time.gmtime(time_probe.get_real_secs())] [relative_time]) + + + _enabled + True + + + formatter + None + + + _coordinate + (1105, 802) + + + _rotation + 0 + + + grid_pos + 1, 1, 1, 2 + + + id + variable_static_time_now + + + label + Time now + + + notebook + nb_test, 0 + + + + variable_static_text + + comment + + + + converver + str_converter + + + value + usrp_info + + + _enabled + True + + + formatter + None + + + _coordinate + (1123, 1286) + + + _rotation + 0 + + + grid_pos + 0, 0, 1, 1*10 + + + id + variable_static_usrp_info + + + label + USRP + + + notebook + nb_info, 0 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (1538, 198) + + + _rotation + 0 + + + id + window_fn + + + value + window_fn_map[window] + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (1636, 144) + + + _rotation + 0 + + + id + window_fn_map + + + value + {'auto': None, 'bh': fft_win.blackmanharris, 'ham': fft_win.hamming, 'han': fft_win.hanning, 'rect': fft_win.rectangular, 'flat': fft_win.flattop} + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (1648, 3) + + + _rotation + 0 + + + id + window_fn_name_map + + + value + {'auto': 'Auto', 'bh': 'Blackman-Harris', 'ham': 'Hamming', 'han': 'Hanning', 'rect': 'Rectangular', 'flat': 'Flattop'} + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1367, 1295) + + + _rotation + 0 + + + id + antenna + + + label + Antenna (blank for default) + + + short_id + A + + + type + string + + + value + + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1635, 519) + + + _rotation + 0 + + + id + args + + + label + UHD device args + + + short_id + a + + + type + string + + + value + + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1525, 399) + + + _rotation + 0 + + + id + ave + + + label + Average FFT + + + short_id + + + + type + eng_float + + + value + 1*0 + 0.5 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1268, 311) + + + _rotation + 0 + + + id + averaging + + + label + Enable FFT averaging + + + short_id + + + + type + string + + + value + True + + + + baz_time_panel + + alias + + + + comment + + + + affinity + + + + mode + auto + + + _enabled + False + + + _coordinate + (1106, 1070) + + + _rotation + 0 + + + grid_pos + 1, 2, 1, 2 + + + id + baz_time_panel_0 + + + ignore_next_trigger + ['rx_rate', 'rx_freq'] + + + item_size + 8 + + + notebook + nb_test, 0 + + + relative + relative_time + + + samp_rate + samp_rate + + + rate + 4 + + + + blks2_logpwrfft_x + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (571, 275) + + + _rotation + 0 + + + id + blks2_logpwrfft_x_0 + + + average + True + + + avg_alpha + fft_ave_probe + + + fft_size + fft_size + + + frame_rate + fft_rate + + + ref_scale + fft_ref_scale + + + sample_rate + samp_rate + + + type + complex + + + + blks2_selector + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (1301, 51) + + + _rotation + 0 + + + id + blks2_selector_0 + + + input_index + scope_mode + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_inputs + 2 + + + num_outputs + 1 + + + output_index + 0 + + + type + complex + + + vlen + 1 + + + + blks2_selector + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (1083, 51) + + + _rotation + 0 + + + id + blks2_selector_0_0 + + + input_index + 0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_inputs + 1 + + + num_outputs + 2 + + + output_index + scope_mode + + + type + complex + + + vlen + 1 + + + + blks2_selector + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (1094, 1423) + + + _rotation + 0 + + + id + blks2_selector_0_0_0 + + + input_index + 0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_inputs + 1 + + + num_outputs + 2 + + + output_index + scope_mode_2 + + + type + complex + + + vlen + 1 + + + + blks2_selector + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (1312, 1423) + + + _rotation + 0 + + + id + blks2_selector_0_1 + + + input_index + scope_mode_2 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_inputs + 2 + + + num_outputs + 1 + + + output_index + 0 + + + type + complex + + + vlen + 1 + + + + blocks_argmax_xx + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (793, 259) + + + _rotation + 0 + + + id + blocks_argmax_xx_0 + + + type + float + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_inputs + 1 + + + vlen + fft_size + + + + blocks_argmax_xx + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (804, 1631) + + + _rotation + 0 + + + id + blocks_argmax_xx_0_0 + + + type + float + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_inputs + 1 + + + vlen + fft_size + + + + blocks_complex_to_mag + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (1083, 121) + + + _rotation + 0 + + + id + blocks_complex_to_mag_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_complex_to_mag + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (1094, 1493) + + + _rotation + 0 + + + id + blocks_complex_to_mag_0_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_complex_to_mag + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (823, 204) + + + _rotation + 0 + + + id + blocks_complex_to_mag_1 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + fft_size + + + + blocks_float_to_complex + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (1076, 160) + + + _rotation + 0 + + + id + blocks_float_to_complex_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_float_to_complex + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (1087, 1532) + + + _rotation + 0 + + + id + blocks_float_to_complex_0_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_max_xx + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (792, 326) + + + _rotation + 0 + + + id + blocks_max_xx_0 + + + type + float + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_inputs + 1 + + + vlen + fft_size + + + + blocks_max_xx + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (803, 1698) + + + _rotation + 0 + + + id + blocks_max_xx_0_0 + + + type + float + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_inputs + 1 + + + vlen + fft_size + + + + blocks_null_sink + + alias + + + + bus_conns + [[0,],] + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (1002, 291) + + + _rotation + 0 + + + id + blocks_null_sink_0 + + + type + short + + + num_inputs + 1 + + + vlen + 1 + + + + blocks_null_sink + + alias + + + + bus_conns + [[0,],] + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (1013, 1663) + + + _rotation + 0 + + + id + blocks_null_sink_0_0 + + + type + short + + + num_inputs + 1 + + + vlen + 1 + + + + blocks_stream_to_vector + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (572, 132) + + + _rotation + 0 + + + id + blocks_stream_to_vector_0 + + + type + complex + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_items + fft_size + + + vlen + 1 + + + + blocks_tag_debug + + alias + + + + comment + + + + affinity + + + + display + show_stream_tags_chk + + + _enabled + True + + + _coordinate + (1266, 521) + + + _rotation + 0 + + + id + blocks_tag_debug_0 + + + type + complex + + + filter + "" + + + name + + + + num_inputs + 1 + + + vlen + 1 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1630, 815) + + + _rotation + 0 + + + id + bw + + + label + Daughterboard bandwidth (where appropriate) + + + short_id + + + + type + eng_float + + + value + 0 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1663, 311) + + + _rotation + 0 + + + id + dyn_rng + + + label + Dynamic Range + + + short_id + + + + type + eng_float + + + value + 130 + + + + blocks_probe_signal_x + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (1002, 259) + + + _rotation + 0 + + + id + fft_max_idx_probe + + + type + short + + + + blocks_probe_signal_x + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (1013, 1631) + + + _rotation + 0 + + + id + fft_max_idx_probe_0 + + + type + short + + + + blocks_probe_signal_x + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (1001, 330) + + + _rotation + 0 + + + id + fft_max_lvl_probe + + + type + float + + + + blocks_probe_signal_x + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (1012, 1702) + + + _rotation + 0 + + + id + fft_max_lvl_probe_2 + + + type + float + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1425, 400) + + + _rotation + 0 + + + id + fft_rate + + + label + FFT Rate + + + short_id + + + + type + intx + + + value + 15 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1647, 399) + + + _rotation + 0 + + + id + fft_ref_scale + + + label + FFT Ref Scale (p2p) + + + short_id + + + + type + eng_float + + + value + 2.0 + + + + wxgui_fftsink2 + + avg_alpha + ave + + + average + True + + + baseband_freq + fft_center_freq + + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + fft_size + 1024*0 + fft_size + + + freqvar + clicked_freq + + + freq_of_interest + float('inf') + + + _coordinate + (162, 176) + + + _rotation + 0 + + + grid_pos + + + + id + fft_sink + + + fft_in + False + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + notebook + nb, 0 + + + fft_out + False + + + peak_hold + False + + + ref_level + ref_lvl + + + ref_scale + fft_ref_scale + + + fft_rate + fft_rate + + + always_run + False + + + samp_rate + samp_rate + + + threshold_level + float('inf') + + + title + FFT Plot + + + type + complex + + + win_size + + + + win + window_fn + + + y_divs + int(dyn_rng/10) + + + y_per_div + 10 + + + + wxgui_fftsink2 + + avg_alpha + ave + + + average + True + + + baseband_freq + fft_center_freq + + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + fft_size + 1024*0 + fft_size + + + freqvar + clicked_freq + + + freq_of_interest + [None,max_bin_freq][show_max_freq] + + + _coordinate + (215, 258) + + + _rotation + 0 + + + grid_pos + + + + id + fft_sink_2 + + + fft_in + False + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + notebook + nb, 0 + + + fft_out + False + + + peak_hold + False + + + ref_level + ref_lvl + + + ref_scale + fft_ref_scale + + + fft_rate + fft_rate + + + always_run + False + + + samp_rate + samp_rate + + + threshold_level + [None,fft_max_lvl_value][show_max_lvl] + + + title + FFT Plot + + + type + complex + + + win_size + + + + win + window_fn + + + y_divs + int(dyn_rng/10) + + + y_per_div + 10 + + + + wxgui_fftsink2 + + avg_alpha + ave + + + average + True + + + baseband_freq + fft_center_freq + + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + fft_size + 1024*0 + fft_size + + + freqvar + clicked_freq + + + freq_of_interest + float('inf') + + + _coordinate + (363, 1414) + + + _rotation + 0 + + + grid_pos + + + + id + fft_sink_two + + + fft_in + False + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + notebook + nb, 0 + + + fft_out + False + + + peak_hold + False + + + ref_level + ref_lvl + + + ref_scale + fft_ref_scale + + + fft_rate + fft_rate + + + always_run + False + + + samp_rate + samp_rate + + + threshold_level + [None,fft_max_lvl_value_2][show_max_lvl] + + + title + FFT Plot 2 + + + type + complex + + + win_size + + + + win + window_fn + + + y_divs + int(dyn_rng/10) + + + y_per_div + 10 + + + + wxgui_fftsink2 + + avg_alpha + ave + + + average + True + + + baseband_freq + fft_center_freq + + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + fft_size + 1024*0 + fft_size + + + freqvar + clicked_freq + + + freq_of_interest + float('inf') + + + _coordinate + (201, 1413) + + + _rotation + 0 + + + grid_pos + + + + id + fft_sink_two_1 + + + fft_in + False + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + notebook + nb, 0 + + + fft_out + False + + + peak_hold + False + + + ref_level + ref_lvl + + + ref_scale + fft_ref_scale + + + fft_rate + fft_rate + + + always_run + False + + + samp_rate + samp_rate + + + threshold_level + float('inf') + + + title + FFT Plot 2 + + + type + complex + + + win_size + + + + win + window_fn + + + y_divs + int(dyn_rng/10) + + + y_per_div + 10 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1429, 312) + + + _rotation + 0 + + + id + fft_size + + + label + FFT Size + + + short_id + + + + type + intx + + + value + 1024 + + + + fft_vxx + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + fft_size + fft_size + + + forward + True + + + _coordinate + (571, 176) + + + _rotation + 0 + + + id + fft_vxx_0 + + + type + complex + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + nthreads + 1 + + + shift + True + + + window + [fft_win.blackmanharris(fft_size),window_fn][int(window_fn!=None)] + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (173, 926) + + + _rotation + 0 + + + id + freq + + + label + Frequency + + + short_id + f + + + type + eng_float + + + value + 0 + 100e6 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (415, 830) + + + _rotation + 0 + + + id + freq_fine_range + + + label + Fine frequency slider range + + + short_id + + + + type + eng_float + + + value + 2e6 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1394, 927) + + + _rotation + 0 + + + id + gain + + + label + Gain (default '-inf' selects relative gain of 25%) + + + short_id + g + + + type + eng_float + + + value + float("-inf") + + + + parameter + + alias + + + + comment + + + + _enabled + False + + + _coordinate + (1310, 928) + + + _rotation + 0 + + + id + gain_auto + + + label + Gain + + + short_id + g + + + type + eng_float + + + value + gain_range.start() + ((gain_range.stop() - gain_range.start()) * 0.25) + + + + import + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1532, 258) + + + _rotation + 0 + + + id + import_0 + + + import + from gnuradio.fft import window as fft_win + + + + import + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1271, 849) + + + _rotation + 0 + + + id + import_1 + + + import + import time, datetime + + + + import + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1, 703) + + + _rotation + 0 + + + id + import_math + + + import + import math + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (172, 1324) + + + _rotation + 0 + + + id + lo_check_interval + + + label + LO lock check frequency (Hz) + + + short_id + + + + type + eng_float + + + value + 5 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (339, 1024) + + + _rotation + 0 + + + id + lo_offset + + + label + LO offset (selects LO offset tuning mode) + + + short_id + + + + type + eng_float + + + value + 0 + + + + logpwrfft_x + + avg_alpha + fft_ave_probe + + + average + False + + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + fft_size + fft_size + + + frame_rate + fft_rate + + + _coordinate + (574, 278) + + + _rotation + 0 + + + id + logpwrfft_x_0 + + + type + complex + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + ref_scale + fft_ref_scale + + + sample_rate + samp_rate + + + + logpwrfft_x + + avg_alpha + fft_ave_probe + + + average + False + + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + fft_size + fft_size + + + frame_rate + fft_rate + + + _coordinate + (585, 1650) + + + _rotation + 0 + + + id + logpwrfft_x_0_0 + + + type + complex + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + ref_scale + fft_ref_scale + + + sample_rate + samp_rate + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (913, 825) + + + _rotation + 0 + + + id + mag_alpha + + + label + Signal magnitude probe alpha + + + short_id + + + + type + eng_float + + + value + 1e-3 + + + + notebook + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (8, 82) + + + _rotation + 0 + + + grid_pos + 0, 0, 1, 1 + + + id + nb + + + labels + ['FFT', 'Scope', 'Waterfall', 'Sensors'] + + + notebook + + + + style + wx.NB_TOP + + + + notebook + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (6, 352) + + + _rotation + 0 + + + grid_pos + + + + id + nb_analog + + + labels + ['Analog', 'DC'] + + + notebook + nb_right, 0 + + + style + wx.NB_LEFT + + + + notebook + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (4, 532) + + + _rotation + 0 + + + grid_pos + + + + id + nb_freq + + + labels + ['Freq'] + + + notebook + nb_right, 0 + + + style + wx.NB_LEFT + + + + notebook + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (6, 168) + + + _rotation + 0 + + + grid_pos + 0, 0, 1, 1 + + + id + nb_info + + + labels + ['Info'] + + + notebook + nb_right, 0 + + + style + wx.NB_LEFT + + + + notebook + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (5, 615) + + + _rotation + 0 + + + grid_pos + + + + id + nb_rate + + + labels + ['Rate'] + + + notebook + nb_right, 0 + + + style + wx.NB_LEFT + + + + notebook + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (6, 265) + + + _rotation + 0 + + + grid_pos + 0, 1, 1, 1 + + + id + nb_right + + + labels + ['Params'] + + + notebook + + + + style + wx.NB_TOP + + + + notebook + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (6, 442) + + + _rotation + 0 + + + grid_pos + + + + id + nb_test + + + labels + ['Test'] + + + notebook + nb_right, 0 + + + style + wx.NB_LEFT + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1146, 312) + + + _rotation + 0 + + + id + peak_hold + + + label + FFT peak hold + + + short_id + + + + type + string + + + value + False + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1630, 730) + + + _rotation + 0 + + + id + pps + + + label + Time source (none, internal, external, mimo, gpsdo). <empty> leaves it at the default. + + + short_id + + + + type + string + + + value + '' + + + + analog_probe_avg_mag_sqrd_x + + alpha + mag_alpha + + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (945, 768) + + + _rotation + 0 + + + id + probe_avg_mag + + + threshold + 0 + + + type + c + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (908, 967) + + + _rotation + 0 + + + id + probe_interval + + + label + Signal probe frequency (Hz) + + + short_id + + + + type + eng_float + + + value + 3 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (644, 1183) + + + _rotation + 0 + + + id + rate + + + label + Sample Rate + + + short_id + s + + + type + eng_float + + + value + 1e6 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1467, 730) + + + _rotation + 0 + + + id + ref + + + label + Clock source (internal, external, mimo, gpsdo). <empty> leaves it at the default. + + + short_id + + + + type + string + + + value + '' + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1527, 311) + + + _rotation + 0 + + + id + ref_lvl + + + label + Reference Level + + + short_id + + + + type + eng_float + + + value + 0 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (936, 1087) + + + _rotation + 0 + + + id + sensor_interval + + + label + Sensor update frequency (Hz) + + + short_id + + + + type + eng_float + + + value + 2 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1323, 580) + + + _rotation + 0 + + + id + show_stream_tags + + + label + Print stream tags + + + short_id + + + + type + string + + + value + False + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1634, 618) + + + _rotation + 0 + + + id + spec + + + label + Sub-device specification (where appropriate) + + + short_id + + + + type + string + + + value + '' + + + + uhd_usrp_source + + alias + + + + ant0 + selected_antenna_proxy + + + bw0 + bw + + + center_freq0 + uhd.tune_request(freq, lo_offset) + + + norm_gain0 + False + + + gain0 + selected_gain_proxy + + + ant10 + + + + bw10 + 0 + + + center_freq10 + 0 + + + norm_gain10 + False + + + gain10 + 0 + + + ant11 + + + + bw11 + 0 + + + center_freq11 + 0 + + + norm_gain11 + False + + + gain11 + 0 + + + ant12 + + + + bw12 + 0 + + + center_freq12 + 0 + + + norm_gain12 + False + + + gain12 + 0 + + + ant13 + + + + bw13 + 0 + + + center_freq13 + 0 + + + norm_gain13 + False + + + gain13 + 0 + + + ant14 + + + + bw14 + 0 + + + center_freq14 + 0 + + + norm_gain14 + False + + + gain14 + 0 + + + ant15 + + + + bw15 + 0 + + + center_freq15 + 0 + + + norm_gain15 + False + + + gain15 + 0 + + + ant16 + + + + bw16 + 0 + + + center_freq16 + 0 + + + norm_gain16 + False + + + gain16 + 0 + + + ant17 + + + + bw17 + 0 + + + center_freq17 + 0 + + + norm_gain17 + False + + + gain17 + 0 + + + ant18 + + + + bw18 + 0 + + + center_freq18 + 0 + + + norm_gain18 + False + + + gain18 + 0 + + + ant19 + + + + bw19 + 0 + + + center_freq19 + 0 + + + norm_gain19 + False + + + gain19 + 0 + + + ant1 + + + + bw1 + 0 + + + center_freq1 + 0 + + + norm_gain1 + False + + + gain1 + 0 + + + ant20 + + + + bw20 + 0 + + + center_freq20 + 0 + + + norm_gain20 + False + + + gain20 + 0 + + + ant21 + + + + bw21 + 0 + + + center_freq21 + 0 + + + norm_gain21 + False + + + gain21 + 0 + + + ant22 + + + + bw22 + 0 + + + center_freq22 + 0 + + + norm_gain22 + False + + + gain22 + 0 + + + ant23 + + + + bw23 + 0 + + + center_freq23 + 0 + + + norm_gain23 + False + + + gain23 + 0 + + + ant24 + + + + bw24 + 0 + + + center_freq24 + 0 + + + norm_gain24 + False + + + gain24 + 0 + + + ant25 + + + + bw25 + 0 + + + center_freq25 + 0 + + + norm_gain25 + False + + + gain25 + 0 + + + ant26 + + + + bw26 + 0 + + + center_freq26 + 0 + + + norm_gain26 + False + + + gain26 + 0 + + + ant27 + + + + bw27 + 0 + + + center_freq27 + 0 + + + norm_gain27 + False + + + gain27 + 0 + + + ant28 + + + + bw28 + 0 + + + center_freq28 + 0 + + + norm_gain28 + False + + + gain28 + 0 + + + ant29 + + + + bw29 + 0 + + + center_freq29 + 0 + + + norm_gain29 + False + + + gain29 + 0 + + + ant2 + + + + bw2 + 0 + + + center_freq2 + 0 + + + norm_gain2 + False + + + gain2 + 0 + + + ant30 + + + + bw30 + 0 + + + center_freq30 + 0 + + + norm_gain30 + False + + + gain30 + 0 + + + ant31 + + + + bw31 + 0 + + + center_freq31 + 0 + + + norm_gain31 + False + + + gain31 + 0 + + + ant3 + + + + bw3 + 0 + + + center_freq3 + 0 + + + norm_gain3 + False + + + gain3 + 0 + + + ant4 + + + + bw4 + 0 + + + center_freq4 + 0 + + + norm_gain4 + False + + + gain4 + 0 + + + ant5 + + + + bw5 + 0 + + + center_freq5 + 0 + + + norm_gain5 + False + + + gain5 + 0 + + + ant6 + + + + bw6 + 0 + + + center_freq6 + 0 + + + norm_gain6 + False + + + gain6 + 0 + + + ant7 + + + + bw7 + 0 + + + center_freq7 + 0 + + + norm_gain7 + False + + + gain7 + 0 + + + ant8 + + + + bw8 + 0 + + + center_freq8 + 0 + + + norm_gain8 + False + + + gain8 + 0 + + + ant9 + + + + bw9 + 0 + + + center_freq9 + 0 + + + norm_gain9 + False + + + gain9 + 0 + + + clock_rate + 0.0 + + + comment + + + + affinity + + + + dev_addr + args + + + dev_args + "" + + + _enabled + True + + + _coordinate + (344, 4) + + + _rotation + 0 + + + id + src + + + maxoutbuf + 0 + + + clock_source0 + + + + sd_spec0 + spec + + + time_source0 + + + + clock_source1 + + + + sd_spec1 + + + + time_source1 + + + + clock_source2 + + + + sd_spec2 + + + + time_source2 + + + + clock_source3 + + + + sd_spec3 + + + + time_source3 + + + + clock_source4 + + + + sd_spec4 + + + + time_source4 + + + + clock_source5 + + + + sd_spec5 + + + + time_source5 + + + + clock_source6 + + + + sd_spec6 + + + + time_source6 + + + + clock_source7 + + + + sd_spec7 + + + + time_source7 + + + + minoutbuf + 0 + + + nchan + 1 + + + num_mboards + 1 + + + type + fc32 + + + samp_rate + requested_sample_rate + + + stream_args + stream_args + + + stream_chans + [] + + + stream_immediately + True + + + sync + + + + otw + wire_format + + + + uhd_usrp_source + + alias + + + + ant0 + selected_antenna_proxy + + + bw0 + bw + + + center_freq0 + uhd.tune_request(freq, lo_offset) + + + norm_gain0 + False + + + gain0 + selected_gain_proxy + + + ant10 + + + + bw10 + 0 + + + center_freq10 + 0 + + + norm_gain10 + False + + + gain10 + 0 + + + ant11 + + + + bw11 + 0 + + + center_freq11 + 0 + + + norm_gain11 + False + + + gain11 + 0 + + + ant12 + + + + bw12 + 0 + + + center_freq12 + 0 + + + norm_gain12 + False + + + gain12 + 0 + + + ant13 + + + + bw13 + 0 + + + center_freq13 + 0 + + + norm_gain13 + False + + + gain13 + 0 + + + ant14 + + + + bw14 + 0 + + + center_freq14 + 0 + + + norm_gain14 + False + + + gain14 + 0 + + + ant15 + + + + bw15 + 0 + + + center_freq15 + 0 + + + norm_gain15 + False + + + gain15 + 0 + + + ant16 + + + + bw16 + 0 + + + center_freq16 + 0 + + + norm_gain16 + False + + + gain16 + 0 + + + ant17 + + + + bw17 + 0 + + + center_freq17 + 0 + + + norm_gain17 + False + + + gain17 + 0 + + + ant18 + + + + bw18 + 0 + + + center_freq18 + 0 + + + norm_gain18 + False + + + gain18 + 0 + + + ant19 + + + + bw19 + 0 + + + center_freq19 + 0 + + + norm_gain19 + False + + + gain19 + 0 + + + ant1 + selected_antenna_proxy + + + bw1 + bw + + + center_freq1 + uhd.tune_request(freq, lo_offset) + + + norm_gain1 + False + + + gain1 + selected_gain_proxy + + + ant20 + + + + bw20 + 0 + + + center_freq20 + 0 + + + norm_gain20 + False + + + gain20 + 0 + + + ant21 + + + + bw21 + 0 + + + center_freq21 + 0 + + + norm_gain21 + False + + + gain21 + 0 + + + ant22 + + + + bw22 + 0 + + + center_freq22 + 0 + + + norm_gain22 + False + + + gain22 + 0 + + + ant23 + + + + bw23 + 0 + + + center_freq23 + 0 + + + norm_gain23 + False + + + gain23 + 0 + + + ant24 + + + + bw24 + 0 + + + center_freq24 + 0 + + + norm_gain24 + False + + + gain24 + 0 + + + ant25 + + + + bw25 + 0 + + + center_freq25 + 0 + + + norm_gain25 + False + + + gain25 + 0 + + + ant26 + + + + bw26 + 0 + + + center_freq26 + 0 + + + norm_gain26 + False + + + gain26 + 0 + + + ant27 + + + + bw27 + 0 + + + center_freq27 + 0 + + + norm_gain27 + False + + + gain27 + 0 + + + ant28 + + + + bw28 + 0 + + + center_freq28 + 0 + + + norm_gain28 + False + + + gain28 + 0 + + + ant29 + + + + bw29 + 0 + + + center_freq29 + 0 + + + norm_gain29 + False + + + gain29 + 0 + + + ant2 + + + + bw2 + 0 + + + center_freq2 + 0 + + + norm_gain2 + False + + + gain2 + 0 + + + ant30 + + + + bw30 + 0 + + + center_freq30 + 0 + + + norm_gain30 + False + + + gain30 + 0 + + + ant31 + + + + bw31 + 0 + + + center_freq31 + 0 + + + norm_gain31 + False + + + gain31 + 0 + + + ant3 + + + + bw3 + 0 + + + center_freq3 + 0 + + + norm_gain3 + False + + + gain3 + 0 + + + ant4 + + + + bw4 + 0 + + + center_freq4 + 0 + + + norm_gain4 + False + + + gain4 + 0 + + + ant5 + + + + bw5 + 0 + + + center_freq5 + 0 + + + norm_gain5 + False + + + gain5 + 0 + + + ant6 + + + + bw6 + 0 + + + center_freq6 + 0 + + + norm_gain6 + False + + + gain6 + 0 + + + ant7 + + + + bw7 + 0 + + + center_freq7 + 0 + + + norm_gain7 + False + + + gain7 + 0 + + + ant8 + + + + bw8 + 0 + + + center_freq8 + 0 + + + norm_gain8 + False + + + gain8 + 0 + + + ant9 + + + + bw9 + 0 + + + center_freq9 + 0 + + + norm_gain9 + False + + + gain9 + 0 + + + clock_rate + 0.0 + + + comment + + + + affinity + + + + dev_addr + args + + + dev_args + "" + + + _enabled + False + + + _coordinate + (344, 50) + + + _rotation + 0 + + + id + src_2 + + + maxoutbuf + 0 + + + clock_source0 + + + + sd_spec0 + spec + + + time_source0 + + + + clock_source1 + + + + sd_spec1 + + + + time_source1 + + + + clock_source2 + + + + sd_spec2 + + + + time_source2 + + + + clock_source3 + + + + sd_spec3 + + + + time_source3 + + + + clock_source4 + + + + sd_spec4 + + + + time_source4 + + + + clock_source5 + + + + sd_spec5 + + + + time_source5 + + + + clock_source6 + + + + sd_spec6 + + + + time_source6 + + + + clock_source7 + + + + sd_spec7 + + + + time_source7 + + + + minoutbuf + 0 + + + nchan + 2 + + + num_mboards + 1 + + + type + fc32 + + + samp_rate + requested_sample_rate + + + stream_args + stream_args + + + stream_chans + [] + + + stream_immediately + True + + + sync + + + + otw + wire_format + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1462, 617) + + + _rotation + 0 + + + id + stream_args + + + label + Stream arguments (e.g. scalar=1024) + + + short_id + + + + type + string + + + value + + + + + virtual_sink + + comment + + + + _enabled + True + + + _coordinate + (624, 4) + + + _rotation + 0 + + + id + virtual_sink_0 + + + stream_id + bb + + + + virtual_sink + + comment + + + + _enabled + False + + + _coordinate + (624, 45) + + + _rotation + 0 + + + id + virtual_sink_0_0 + + + stream_id + bb2 + + + + virtual_source + + comment + + + + _enabled + True + + + _coordinate + (1246, 478) + + + _rotation + 0 + + + id + virtual_source_0 + + + stream_id + bb + + + + virtual_source + + comment + + + + _enabled + True + + + _coordinate + (1081, 5) + + + _rotation + 0 + + + id + virtual_source_0_0 + + + stream_id + bb + + + + virtual_source + + comment + + + + _enabled + True + + + _coordinate + (173, 128) + + + _rotation + 0 + + + id + virtual_source_0_0_0 + + + stream_id + bb + + + + virtual_source + + comment + + + + _enabled + True + + + _coordinate + (760, 775) + + + _rotation + 0 + + + id + virtual_source_0_0_0_0 + + + stream_id + bb + + + + virtual_source + + comment + + + + _enabled + False + + + _coordinate + (1106, 1027) + + + _rotation + 0 + + + id + virtual_source_0_1 + + + stream_id + bb + + + + virtual_source + + comment + + + + _enabled + True + + + _coordinate + (571, 88) + + + _rotation + 0 + + + id + virtual_source_0_2 + + + stream_id + bb + + + + virtual_source + + comment + + + + _enabled + False + + + _coordinate + (27, 1456) + + + _rotation + 0 + + + id + virtual_source_0_2_0 + + + stream_id + bb2 + + + + wxgui_waterfallsink2 + + avg_alpha + ave + + + average + True + + + baseband_freq + fft_center_freq + + + alias + + + + comment + + + + affinity + + + + dynamic_range + dyn_rng + + + _enabled + True + + + fft_rate + fft_rate + + + fft_size + 512*0 + fft_size + + + freqvar + clicked_freq + + + _coordinate + (177, 458) + + + _rotation + 0 + + + grid_pos + + + + id + waterfall_sink + + + fft_in + False + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + notebook + nb, 2 + + + fft_out + False + + + ref_scale + fft_ref_scale + + + ref_level + ref_lvl + + + always_run + False + + + samp_rate + samp_rate + + + title + Waterfall Plot + + + type + complex + + + win_size + + + + win + window_fn + + + + wxgui_waterfallsink2 + + avg_alpha + ave + + + average + True + + + baseband_freq + fft_center_freq + + + alias + + + + comment + + + + affinity + + + + dynamic_range + dyn_rng + + + _enabled + False + + + fft_rate + fft_rate + + + fft_size + 512*0 + fft_size + + + freqvar + clicked_freq + + + _coordinate + (181, 1616) + + + _rotation + 0 + + + grid_pos + + + + id + waterfall_sink_0 + + + fft_in + False + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + notebook + nb, 2 + + + fft_out + False + + + ref_scale + fft_ref_scale + + + ref_level + ref_lvl + + + always_run + False + + + samp_rate + samp_rate + + + title + Waterfall Plot 2 + + + type + complex + + + win_size + + + + win + window_fn + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1641, 60) + + + _rotation + 0 + + + id + window + + + label + Window (bh: Blackman-Harris, ham: Hamming, han: Hanning, rect: Rectangular, flat: Flattop) + + + short_id + + + + type + string + + + value + auto + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (1471, 531) + + + _rotation + 0 + + + id + wire_format + + + label + Wire format (e.g. sc16, sc8) [blank = automatic] + + + short_id + + + + type + string + + + value + + + + + wxgui_scopesink2 + + ac_couple + False + + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (1291, 119) + + + _rotation + 0 + + + grid_pos + + + + id + wxgui_scopesink2_0 + + + notebook + nb, 1 + + + num_inputs + 1 + + + samp_rate + samp_rate + + + t_scale + 0 + + + title + Scope Plot + + + trig_mode + wxgui.TRIG_MODE_AUTO + + + type + complex + + + v_offset + 0 + + + v_scale + 0 + + + win_size + + + + xy_mode + False + + + y_axis_label + Counts + + + + wxgui_scopesink2 + + ac_couple + False + + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (1302, 1491) + + + _rotation + 0 + + + grid_pos + + + + id + wxgui_scopesink2_0_0 + + + notebook + nb, 1 + + + num_inputs + 1 + + + samp_rate + samp_rate + + + t_scale + 0 + + + title + Scope Plot 2 + + + trig_mode + wxgui.TRIG_MODE_AUTO + + + type + complex + + + v_offset + 0 + + + v_scale + 0 + + + win_size + + + + xy_mode + False + + + y_axis_label + Counts + + + + blks2_logpwrfft_x_0 + blocks_argmax_xx_0 + 0 + 0 + + + blks2_logpwrfft_x_0 + blocks_max_xx_0 + 0 + 0 + + + blks2_selector_0 + wxgui_scopesink2_0 + 0 + 0 + + + blks2_selector_0_0 + blks2_selector_0 + 0 + 0 + + + blks2_selector_0_0 + blocks_complex_to_mag_0 + 1 + 0 + + + blks2_selector_0_0_0 + blks2_selector_0_1 + 0 + 0 + + + blks2_selector_0_0_0 + blocks_complex_to_mag_0_0 + 1 + 0 + + + blks2_selector_0_1 + wxgui_scopesink2_0_0 + 0 + 0 + + + blocks_argmax_xx_0 + blocks_null_sink_0 + 1 + 0 + + + blocks_argmax_xx_0 + fft_max_idx_probe + 0 + 0 + + + blocks_argmax_xx_0_0 + blocks_null_sink_0_0 + 1 + 0 + + + blocks_argmax_xx_0_0 + fft_max_idx_probe_0 + 0 + 0 + + + blocks_complex_to_mag_0 + blocks_float_to_complex_0 + 0 + 1 + + + blocks_complex_to_mag_0 + blocks_float_to_complex_0 + 0 + 0 + + + blocks_complex_to_mag_0_0 + blocks_float_to_complex_0_0 + 0 + 1 + + + blocks_complex_to_mag_0_0 + blocks_float_to_complex_0_0 + 0 + 0 + + + blocks_complex_to_mag_1 + blocks_argmax_xx_0 + 0 + 0 + + + blocks_complex_to_mag_1 + blocks_max_xx_0 + 0 + 0 + + + blocks_float_to_complex_0 + blks2_selector_0 + 0 + 1 + + + blocks_float_to_complex_0_0 + blks2_selector_0_1 + 0 + 1 + + + blocks_max_xx_0 + fft_max_lvl_probe + 0 + 0 + + + blocks_max_xx_0_0 + fft_max_lvl_probe_2 + 0 + 0 + + + blocks_stream_to_vector_0 + fft_vxx_0 + 0 + 0 + + + fft_vxx_0 + blocks_complex_to_mag_1 + 0 + 0 + + + logpwrfft_x_0 + blocks_argmax_xx_0 + 0 + 0 + + + logpwrfft_x_0 + blocks_max_xx_0 + 0 + 0 + + + logpwrfft_x_0_0 + blocks_argmax_xx_0_0 + 0 + 0 + + + logpwrfft_x_0_0 + blocks_max_xx_0_0 + 0 + 0 + + + src + virtual_sink_0 + 0 + 0 + + + src_2 + virtual_sink_0 + 0 + 0 + + + src_2 + virtual_sink_0_0 + 1 + 0 + + + virtual_source_0 + blocks_tag_debug_0 + 0 + 0 + + + virtual_source_0_0 + blks2_selector_0_0 + 0 + 0 + + + virtual_source_0_0_0 + fft_sink + 0 + 0 + + + virtual_source_0_0_0 + fft_sink_2 + 0 + 0 + + + virtual_source_0_0_0 + waterfall_sink + 0 + 0 + + + virtual_source_0_0_0_0 + probe_avg_mag + 0 + 0 + + + virtual_source_0_1 + baz_time_panel_0 + 0 + 0 + + + virtual_source_0_2 + blks2_logpwrfft_x_0 + 0 + 0 + + + virtual_source_0_2 + blocks_stream_to_vector_0 + 0 + 0 + + + virtual_source_0_2 + logpwrfft_x_0 + 0 + 0 + + + virtual_source_0_2_0 + blks2_selector_0_0_0 + 0 + 0 + + + virtual_source_0_2_0 + fft_sink_two + 0 + 0 + + + virtual_source_0_2_0 + fft_sink_two_1 + 0 + 0 + + + virtual_source_0_2_0 + logpwrfft_x_0_0 + 0 + 0 + + + virtual_source_0_2_0 + waterfall_sink_0 + 0 + 0 + + diff --git a/tools/mega_fft/README.md b/tools/mega_fft/README.md new file mode 100644 index 000000000..c61207ec7 --- /dev/null +++ b/tools/mega_fft/README.md @@ -0,0 +1,7 @@ +== MegaFFT == + +Highly configurable tool similar to `uhd_fft`. + +Requirements: +* gr-baz required for GRC version + diff --git a/tools/mega_fft/mega_fft.py b/tools/mega_fft/mega_fft.py new file mode 100755 index 000000000..8dab89f4f --- /dev/null +++ b/tools/mega_fft/mega_fft.py @@ -0,0 +1,2645 @@ +#!/usr/bin/env python2 +################################################## +# GNU Radio Python Flow Graph +# Title: Mega FFT +# Author: Balint Seeber, Ettus Research +# Description: Standard edition, single-channel +# Generated: Fri Jul 24 11:56:33 2015 +################################################## + +if __name__ == '__main__': + import ctypes + import sys + if sys.platform.startswith('linux'): + try: + x11 = ctypes.cdll.LoadLibrary('libX11.so') + x11.XInitThreads() + except: + print "Warning: failed to XInitThreads()" + +from gnuradio import analog +from gnuradio import blocks +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio import uhd +from gnuradio import wxgui +from gnuradio.eng_option import eng_option +from gnuradio.fft import logpwrfft +from gnuradio.fft import window +from gnuradio.fft import window as fft_win +from gnuradio.filter import firdes +from gnuradio.wxgui import fftsink2 +from gnuradio.wxgui import forms +from gnuradio.wxgui import scopesink2 +from gnuradio.wxgui import waterfallsink2 +from grc_gnuradio import blks2 as grc_blks2 +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import math +import threading +import time +import time, datetime +import wx + +class mega_fft(grc_wxgui.top_block_gui): + + def __init__(self, antenna="", args="", ave=1*0 + 0.5, averaging="True", bw=0, dyn_rng=130, fft_rate=15, fft_ref_scale=2.0, fft_size=1024, freq=0 + 100e6, freq_fine_range=2e6, gain=float("-inf"), lo_check_interval=5, lo_offset=0, mag_alpha=1e-3, peak_hold="False", pps='', probe_interval=3, rate=1e6, ref='', ref_lvl=0, sensor_interval=2, show_stream_tags="False", spec='', stream_args="", window="auto", wire_format=""): + grc_wxgui.top_block_gui.__init__(self, title="Mega FFT") + + ################################################## + # Parameters + ################################################## + self.antenna = antenna + self.args = args + self.ave = ave + self.averaging = averaging + self.bw = bw + self.dyn_rng = dyn_rng + self.fft_rate = fft_rate + self.fft_ref_scale = fft_ref_scale + self.fft_size = fft_size + self.freq = freq + self.freq_fine_range = freq_fine_range + self.gain = gain + self.lo_check_interval = lo_check_interval + self.lo_offset = lo_offset + self.mag_alpha = mag_alpha + self.peak_hold = peak_hold + self.pps = pps + self.probe_interval = probe_interval + self.rate = rate + self.ref = ref + self.ref_lvl = ref_lvl + self.sensor_interval = sensor_interval + self.show_stream_tags = show_stream_tags + self.spec = spec + self.stream_args = stream_args + self.window = window + self.wire_format = wire_format + + ################################################## + # Variables + ################################################## + self.relative_freq = relative_freq = 1 + self.gain_range = gain_range = uhd.gain_range(0,0,0) + self.fft_max_idx = fft_max_idx = (fft_size/2)*0 + self.actual_sample_rate = actual_sample_rate = rate + self.actual_center_freq = actual_center_freq = 0 + self.str_to_bool = str_to_bool = lambda x: len(x)>0 and x.lower()[0] not in ['0', 'n', 'f'] + self.signal_probe = signal_probe = 0.0 + self.samp_rate = samp_rate = int(actual_sample_rate) + self.requested_freq_txt = requested_freq_txt = freq + self.gain_default = gain_default = gain_range.start() + self.freq_fine = freq_fine = 0 + self.fft_max_idx_norm = fft_max_idx_norm = [fft_max_idx,fft_max_idx-fft_size][int(fft_max_idx>(fft_size/2))] + self.fft_center_freq = fft_center_freq = actual_center_freq * relative_freq + self.antennas = antennas = [''] + self.window_fn_name_map = window_fn_name_map = {'auto': 'Auto', 'bh': 'Blackman-Harris', 'ham': 'Hamming', 'han': 'Hanning', 'rect': 'Rectangular', 'flat': 'Flattop'} + self.window_fn_map = window_fn_map = {'auto': None, 'bh': fft_win.blackmanharris, 'ham': fft_win.hamming, 'han': fft_win.hanning, 'rect': fft_win.rectangular, 'flat': fft_win.flattop} + self.usrp_info = usrp_info = '(unknown)' + self.tune_result = tune_result = uhd.tune_result_t() + self.tune_mode = tune_mode = [1,0][lo_offset==0.0] + self.time_probe = time_probe = uhd.time_spec_t() + self.test = test = 1 + self.subdev_spec = subdev_spec = '(unknown)' + self.signal_probe_log = signal_probe_log = math.log10([signal_probe,1.0][signal_probe==0.0])*10 + self.selected_gain = selected_gain = gain_default + self.selected_antenna = selected_antenna = [ [antenna,antennas[0]][antenna not in antennas] ,antennas[0]][antenna==''] + self.requested_sample_rate_base = requested_sample_rate_base = rate + self.requested_freq = requested_freq = requested_freq_txt + freq_fine + self.relative_time = relative_time = True + self.motherboard_sensors = motherboard_sensors = '(none)' + self.max_bin_freq = max_bin_freq = fft_center_freq + (((1.0*fft_max_idx_norm) / fft_size) * samp_rate) + self.locked_probe = locked_probe = '(unknown)' + self.lo_offset_txt = lo_offset_txt = lo_offset + self.fft_peak_hold = fft_peak_hold = str_to_bool(peak_hold) + self.fft_max_lvl = fft_max_lvl = 0.0 + self.fft_averaging = fft_averaging = str_to_bool(averaging) + self.decim = decim = 1 + self.daughterboard_sensors = daughterboard_sensors = '(none)' + self.clicked_freq = clicked_freq = 0 + self.window_fn = window_fn = window_fn_map[window] + self.variable_static_usrp_info = variable_static_usrp_info = usrp_info + self.variable_static_time_now = variable_static_time_now = str( [time.ctime(time_probe.get_real_secs()), datetime.timedelta(seconds=time_probe.get_real_secs()), time.gmtime(time_probe.get_real_secs())] [relative_time]) + self.variable_static_text_0_0 = variable_static_text_0_0 = daughterboard_sensors + self.variable_static_text_0 = variable_static_text_0 = motherboard_sensors + self.variable_static_subdev_spec = variable_static_subdev_spec = subdev_spec + self.variable_static_rf_freq = variable_static_rf_freq = tune_result.actual_rf_freq + self.variable_static_requested_freq = variable_static_requested_freq = requested_freq + self.variable_static_max_bin_freq = variable_static_max_bin_freq = max_bin_freq + self.variable_static_level_probe = variable_static_level_probe = signal_probe_log + self.variable_static_fft_window_name = variable_static_fft_window_name = window_fn_name_map[window] + self.variable_static_fft_max_lvl_log = variable_static_fft_max_lvl_log = fft_max_lvl + self.variable_static_actual_sample_rate = variable_static_actual_sample_rate = actual_sample_rate + self.variable_static_actual_dsp_freq = variable_static_actual_dsp_freq = tune_result.actual_dsp_freq + self.variable_any_code_waterfall_ave = variable_any_code_waterfall_ave = fft_averaging + self.variable_any_code_iq_correction = variable_any_code_iq_correction = None + self.variable_any_code_fft_sink_peak_hold = variable_any_code_fft_sink_peak_hold = fft_peak_hold + self.variable_any_code_fft_sink_ave = variable_any_code_fft_sink_ave = fft_averaging + self.variable_any_code_auto_dc_offset_removal = variable_any_code_auto_dc_offset_removal = None + self.update_time_source = update_time_source = None + self.update_clock_source = update_clock_source = None + self.tune_obj = tune_obj = [requested_freq, uhd.tune_request(requested_freq, lo_offset_txt), uhd.tune_request(requested_freq, dsp_freq=0, dsp_freq_policy=uhd.tune_request.POLICY_MANUAL)][tune_mode] + self.static_locked = static_locked = '"' + str(locked_probe) + '"' + self.show_stream_tags_chk = show_stream_tags_chk = [False, True][show_stream_tags.lower() != 'false'] + self.show_max_lvl = show_max_lvl = True + self.show_max_freq = show_max_freq = True + self.selected_gain_proxy = selected_gain_proxy = selected_gain + self.selected_antenna_proxy = selected_antenna_proxy = selected_antenna + self.scope_mode = scope_mode = 0+1 + self.requested_sample_rate = requested_sample_rate = requested_sample_rate_base / (1.*decim) + self.motherboard_sensor_names = motherboard_sensor_names = [] + self.max_decim = max_decim = 256 + self.initial_gain = initial_gain = 0 + self.has_lo_locked = has_lo_locked = False + self.freq_range = freq_range = uhd.freq_range(freq,freq+1) + self.fix_invalid_freq = fix_invalid_freq = None + self.fft_max_lvl_value = fft_max_lvl_value = fft_max_lvl + self.fft_ave_probe = fft_ave_probe = ave + self.daughterboard_sensor_names = daughterboard_sensor_names = [] + self.clicked_freq_txt = clicked_freq_txt = clicked_freq + self.auto_iq_correction = auto_iq_correction = True + self.auto_dc_offset_removal = auto_dc_offset_removal = True + self.any_test_1 = any_test_1 = test + + ################################################## + # Blocks + ################################################## + self.src = uhd.usrp_source( + ",".join((args, "")), + uhd.stream_args( + cpu_format="fc32", + channels=range(1), + ), + + ) + if spec != "": self.src.set_subdev_spec(spec, 0) + self.src.set_samp_rate(requested_sample_rate) + self.src.set_center_freq(uhd.tune_request(freq, lo_offset), 0) + self.src.set_gain(selected_gain_proxy, 0) + self.nb_right = self.nb_right = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.nb_right.AddPage(grc_wxgui.Panel(self.nb_right), "Params") + self.GridAdd(self.nb_right, 0, 1, 1, 1) + self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.nb.AddPage(grc_wxgui.Panel(self.nb), "FFT") + self.nb.AddPage(grc_wxgui.Panel(self.nb), "Scope") + self.nb.AddPage(grc_wxgui.Panel(self.nb), "Waterfall") + self.nb.AddPage(grc_wxgui.Panel(self.nb), "Sensors") + self.GridAdd(self.nb, 0, 0, 1, 1) + self.nb_test = self.nb_test = wx.Notebook(self.nb_right.GetPage(0).GetWin(), style=wx.NB_LEFT) + self.nb_test.AddPage(grc_wxgui.Panel(self.nb_test), "Test") + self.nb_right.GetPage(0).Add(self.nb_test) + self.nb_analog = self.nb_analog = wx.Notebook(self.nb_right.GetPage(0).GetWin(), style=wx.NB_LEFT) + self.nb_analog.AddPage(grc_wxgui.Panel(self.nb_analog), "Analog") + self.nb_analog.AddPage(grc_wxgui.Panel(self.nb_analog), "DC") + self.nb_right.GetPage(0).Add(self.nb_analog) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_gain_range(): + self._post_any_code_evaluators += [('gain_range', lambda: self._evalutate_gain_range(**{}))] + def __evalutate_gain_range(*args, **kwds): + try: + self.gain_range = self.src.get_gain_range() + self.set_gain_range(self.gain_range) + except AttributeError, e: + print "AttributeError while evaulating gain_range:", e + __post_evalutate_gain_range() + except Exception, e: + print "Exception while evaluating gain_range:", e + self._evalutate_gain_range = __evalutate_gain_range + self.__post_evalutate_gain_range = __post_evalutate_gain_range + self._evalutate_gain_range(**{}) + gain_range = self.gain_range + self.fft_sink = fftsink2.fft_sink_c( + self.nb.GetPage(0).GetWin(), + baseband_freq=fft_center_freq, + y_per_div=10, + y_divs=int(dyn_rng/10), + ref_level=ref_lvl, + ref_scale=fft_ref_scale, + sample_rate=samp_rate, + fft_size=1024*0 + fft_size, + fft_rate=fft_rate, + average=True, + avg_alpha=ave, + title="FFT Plot", + peak_hold=False, fft_in=False, + always_run=False, + fft_out=False, + ) + self.nb.GetPage(0).Add(self.fft_sink.win) + def fft_sink_callback(x, y): + self.set_clicked_freq(x) + + self.fft_sink.set_callback(fft_sink_callback) + self.waterfall_sink = waterfallsink2.waterfall_sink_c( + self.nb.GetPage(2).GetWin(), + baseband_freq=fft_center_freq, + dynamic_range=dyn_rng, + ref_level=ref_lvl, + ref_scale=fft_ref_scale, + sample_rate=samp_rate, + fft_size=512*0 + fft_size, + fft_rate=fft_rate, + average=True, + avg_alpha=ave, + title="Waterfall Plot", + fft_in=False, + always_run=False, + fft_out=False, + ) + self.nb.GetPage(2).Add(self.waterfall_sink.win) + def waterfall_sink_callback(x, y): + self.set_clicked_freq(x) + + self.waterfall_sink.set_callback(waterfall_sink_callback) + self._test_chooser = forms.button( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.test, + callback=self.set_test, + label="Test", + choices=[1], + labels=['Reset FFT average'], + ) + self.nb_test.GetPage(0).Add(self._test_chooser) + self._show_stream_tags_chk_check_box = forms.check_box( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.show_stream_tags_chk, + callback=self.set_show_stream_tags_chk, + label="Print stream tags", + true=True, + false=False, + ) + self.nb_test.GetPage(0).GridAdd(self._show_stream_tags_chk_check_box, 0, 0, 1, 1) + self._scope_mode_chooser = forms.radio_buttons( + parent=self.nb.GetPage(1).GetWin(), + value=self.scope_mode, + callback=self.set_scope_mode, + label="Scope Mode", + choices=[0, 1], + labels=['Complex', 'Magnitude'], + style=wx.RA_HORIZONTAL, + ) + self.nb.GetPage(1).Add(self._scope_mode_chooser) + self.probe_avg_mag = analog.probe_avg_mag_sqrd_c(0, mag_alpha) + self.nb_rate = self.nb_rate = wx.Notebook(self.nb_right.GetPage(0).GetWin(), style=wx.NB_LEFT) + self.nb_rate.AddPage(grc_wxgui.Panel(self.nb_rate), "Rate") + self.nb_right.GetPage(0).Add(self.nb_rate) + self.nb_info = self.nb_info = wx.Notebook(self.nb_right.GetPage(0).GetWin(), style=wx.NB_LEFT) + self.nb_info.AddPage(grc_wxgui.Panel(self.nb_info), "Info") + self.nb_right.GetPage(0).GridAdd(self.nb_info, 0, 0, 1, 1) + self.nb_freq = self.nb_freq = wx.Notebook(self.nb_right.GetPage(0).GetWin(), style=wx.NB_LEFT) + self.nb_freq.AddPage(grc_wxgui.Panel(self.nb_freq), "Freq") + self.nb_right.GetPage(0).Add(self.nb_freq) + if sensor_interval > 0: + self._motherboard_sensor_names_poll_rate = sensor_interval + else: + self._motherboard_sensor_names_poll_rate = 1 + self._motherboard_sensor_names_enabled = sensor_interval > 0 + def _set_motherboard_sensor_names_poll_rate(rate): + self._motherboard_sensor_names_enabled = rate > 0 + if rate > 0: + self._motherboard_sensor_names_poll_rate = rate + self.set_motherboard_sensor_names_poll_rate = _set_motherboard_sensor_names_poll_rate + def _motherboard_sensor_names_probe(): + while True: + if self._motherboard_sensor_names_enabled: + val = self.src.get_mboard_sensor_names() + try: + self.set_motherboard_sensor_names(val) + except AttributeError: + pass + time.sleep(1.0/(self._motherboard_sensor_names_poll_rate)) + _motherboard_sensor_names_thread = threading.Thread(target=_motherboard_sensor_names_probe) + _motherboard_sensor_names_thread.daemon = True + _motherboard_sensor_names_thread.start() + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_initial_gain(): + self._post_any_code_evaluators += [('initial_gain', lambda: self._evalutate_initial_gain(**{'gain_range': gain_range}))] + def __evalutate_initial_gain(*args, **kwds): + try: + self.initial_gain = [gain,gain_range.start() + ((gain_range.stop() - gain_range.start()) * 0.25)][gain==float('-inf')] + self.set_initial_gain(self.initial_gain) + except AttributeError, e: + print "AttributeError while evaulating initial_gain:", e + __post_evalutate_initial_gain() + except Exception, e: + print "Exception while evaluating initial_gain:", e + self._evalutate_initial_gain = __evalutate_initial_gain + self.__post_evalutate_initial_gain = __post_evalutate_initial_gain + self._evalutate_initial_gain(**{'gain_range': gain_range}) + initial_gain = self.initial_gain + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_has_lo_locked(): + self._post_any_code_evaluators += [('has_lo_locked', lambda: self._evalutate_has_lo_locked(**{}))] + def __evalutate_has_lo_locked(*args, **kwds): + try: + self.has_lo_locked = 'lo_locked' in self.src.get_sensor_names() + self.set_has_lo_locked(self.has_lo_locked) + except AttributeError, e: + print "AttributeError while evaulating has_lo_locked:", e + __post_evalutate_has_lo_locked() + except Exception, e: + print "Exception while evaluating has_lo_locked:", e + self._evalutate_has_lo_locked = __evalutate_has_lo_locked + self.__post_evalutate_has_lo_locked = __post_evalutate_has_lo_locked + self._evalutate_has_lo_locked(**{}) + has_lo_locked = self.has_lo_locked + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_freq_range(): + self._post_any_code_evaluators += [('freq_range', lambda: self._evalutate_freq_range(**{}))] + def __evalutate_freq_range(*args, **kwds): + try: + self.freq_range = self.src.get_freq_range() + self.set_freq_range(self.freq_range) + except AttributeError, e: + print "AttributeError while evaulating freq_range:", e + __post_evalutate_freq_range() + except Exception, e: + print "Exception while evaluating freq_range:", e + self._evalutate_freq_range = __evalutate_freq_range + self.__post_evalutate_freq_range = __post_evalutate_freq_range + self._evalutate_freq_range(**{}) + freq_range = self.freq_range + if 5 > 0: + self._fft_ave_probe_poll_rate = 5 + else: + self._fft_ave_probe_poll_rate = 1 + self._fft_ave_probe_enabled = 5 > 0 + def _set_fft_ave_probe_poll_rate(rate): + self._fft_ave_probe_enabled = rate > 0 + if rate > 0: + self._fft_ave_probe_poll_rate = rate + self.set_fft_ave_probe_poll_rate = _set_fft_ave_probe_poll_rate + def _fft_ave_probe_probe(): + while True: + if self._fft_ave_probe_enabled: + val = self.fft_sink.win['avg_alpha'] * [1.0/self.fft_sink.win['avg_alpha'],1.0][self.fft_sink.win['average']];() + try: + self.set_fft_ave_probe(val) + except AttributeError: + pass + time.sleep(1.0/(self._fft_ave_probe_poll_rate)) + _fft_ave_probe_thread = threading.Thread(target=_fft_ave_probe_probe) + _fft_ave_probe_thread.daemon = True + _fft_ave_probe_thread.start() + if sensor_interval > 0: + self._daughterboard_sensor_names_poll_rate = sensor_interval + else: + self._daughterboard_sensor_names_poll_rate = 1 + self._daughterboard_sensor_names_enabled = sensor_interval > 0 + def _set_daughterboard_sensor_names_poll_rate(rate): + self._daughterboard_sensor_names_enabled = rate > 0 + if rate > 0: + self._daughterboard_sensor_names_poll_rate = rate + self.set_daughterboard_sensor_names_poll_rate = _set_daughterboard_sensor_names_poll_rate + def _daughterboard_sensor_names_probe(): + while True: + if self._daughterboard_sensor_names_enabled: + val = self.src.get_sensor_names() + try: + self.set_daughterboard_sensor_names(val) + except AttributeError: + pass + time.sleep(1.0/(self._daughterboard_sensor_names_poll_rate)) + _daughterboard_sensor_names_thread = threading.Thread(target=_daughterboard_sensor_names_probe) + _daughterboard_sensor_names_thread.daemon = True + _daughterboard_sensor_names_thread.start() + self._auto_iq_correction_check_box = forms.check_box( + parent=self.nb_analog.GetPage(1).GetWin(), + value=self.auto_iq_correction, + callback=self.set_auto_iq_correction, + label="Auto IQ correction", + true=True, + false=False, + ) + self.nb_analog.GetPage(1).Add(self._auto_iq_correction_check_box) + self._auto_dc_offset_removal_check_box = forms.check_box( + parent=self.nb_analog.GetPage(1).GetWin(), + value=self.auto_dc_offset_removal, + callback=self.set_auto_dc_offset_removal, + label="Auto DC offset removal", + true=True, + false=False, + ) + self.nb_analog.GetPage(1).Add(self._auto_dc_offset_removal_check_box) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_antennas(): + self._post_any_code_evaluators += [('antennas', lambda: self._evalutate_antennas(**{}))] + def __evalutate_antennas(*args, **kwds): + try: + self.antennas = self.src.get_antennas() + self.set_antennas(self.antennas) + except AttributeError, e: + print "AttributeError while evaulating antennas:", e + __post_evalutate_antennas() + except Exception, e: + print "Exception while evaluating antennas:", e + self._evalutate_antennas = __evalutate_antennas + self.__post_evalutate_antennas = __post_evalutate_antennas + self._evalutate_antennas(**{}) + antennas = self.antennas + self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( + self.nb.GetPage(1).GetWin(), + title="Scope Plot", + sample_rate=samp_rate, + v_scale=0, + v_offset=0, + t_scale=0, + ac_couple=False, + xy_mode=False, + num_inputs=1, + trig_mode=wxgui.TRIG_MODE_AUTO, + y_axis_label="Counts", + ) + self.nb.GetPage(1).Add(self.wxgui_scopesink2_0.win) + self._variable_static_usrp_info_static_text = forms.static_text( + parent=self.nb_info.GetPage(0).GetWin(), + value=self.variable_static_usrp_info, + callback=self.set_variable_static_usrp_info, + label="USRP", + converter=forms.str_converter(), + ) + self.nb_info.GetPage(0).GridAdd(self._variable_static_usrp_info_static_text, 0, 0, 1, 10) + self._variable_static_time_now_static_text = forms.static_text( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.variable_static_time_now, + callback=self.set_variable_static_time_now, + label="Time now", + converter=forms.str_converter(), + ) + self.nb_test.GetPage(0).GridAdd(self._variable_static_time_now_static_text, 1, 1, 1, 2) + self._variable_static_text_0_0_static_text = forms.static_text( + parent=self.nb.GetPage(3).GetWin(), + value=self.variable_static_text_0_0, + callback=self.set_variable_static_text_0_0, + label="Daughterboard", + converter=forms.str_converter(), + ) + self.nb.GetPage(3).GridAdd(self._variable_static_text_0_0_static_text, 2, 0, 1, 1) + self._variable_static_text_0_static_text = forms.static_text( + parent=self.nb.GetPage(3).GetWin(), + value=self.variable_static_text_0, + callback=self.set_variable_static_text_0, + label="Motherboard", + converter=forms.str_converter(), + ) + self.nb.GetPage(3).GridAdd(self._variable_static_text_0_static_text, 0, 0, 1, 1) + self._variable_static_subdev_spec_static_text = forms.static_text( + parent=self.nb_info.GetPage(0).GetWin(), + value=self.variable_static_subdev_spec, + callback=self.set_variable_static_subdev_spec, + label="Sub-device", + converter=forms.str_converter(), + ) + self.nb_info.GetPage(0).GridAdd(self._variable_static_subdev_spec_static_text, 1, 0, 1, 1) + self._variable_static_rf_freq_static_text = forms.static_text( + parent=self.nb_freq.GetPage(0).GetWin(), + value=self.variable_static_rf_freq, + callback=self.set_variable_static_rf_freq, + label="Actual RF freq", + converter=forms.float_converter(), + ) + self.nb_freq.GetPage(0).GridAdd(self._variable_static_rf_freq_static_text, 5, 0, 1, 1) + self._variable_static_requested_freq_static_text = forms.static_text( + parent=self.nb_freq.GetPage(0).GetWin(), + value=self.variable_static_requested_freq, + callback=self.set_variable_static_requested_freq, + label="Requested base + fine freq", + converter=forms.float_converter(), + ) + self.nb_freq.GetPage(0).GridAdd(self._variable_static_requested_freq_static_text, 3, 0, 1, 1) + self._variable_static_max_bin_freq_static_text = forms.static_text( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.variable_static_max_bin_freq, + callback=self.set_variable_static_max_bin_freq, + label="Peak freq", + converter=forms.float_converter(), + ) + self.nb_test.GetPage(0).Add(self._variable_static_max_bin_freq_static_text) + self._variable_static_level_probe_static_text = forms.static_text( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.variable_static_level_probe, + callback=self.set_variable_static_level_probe, + label="Signal mag^2 (dB)", + converter=forms.float_converter(), + ) + self.nb_test.GetPage(0).Add(self._variable_static_level_probe_static_text) + self._variable_static_fft_window_name_static_text = forms.static_text( + parent=self.nb_info.GetPage(0).GetWin(), + value=self.variable_static_fft_window_name, + callback=self.set_variable_static_fft_window_name, + label="FFT window", + converter=forms.str_converter(), + ) + self.nb_info.GetPage(0).Add(self._variable_static_fft_window_name_static_text) + self._variable_static_fft_max_lvl_log_static_text = forms.static_text( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.variable_static_fft_max_lvl_log, + callback=self.set_variable_static_fft_max_lvl_log, + label="Peak magnitude (dB)", + converter=forms.float_converter(), + ) + self.nb_test.GetPage(0).Add(self._variable_static_fft_max_lvl_log_static_text) + self._variable_static_actual_sample_rate_static_text = forms.static_text( + parent=self.nb_rate.GetPage(0).GetWin(), + value=self.variable_static_actual_sample_rate, + callback=self.set_variable_static_actual_sample_rate, + label="Actual", + converter=forms.float_converter(), + ) + self.nb_rate.GetPage(0).GridAdd(self._variable_static_actual_sample_rate_static_text, 0, 1, 1, 1) + self._variable_static_actual_dsp_freq_static_text = forms.static_text( + parent=self.nb_freq.GetPage(0).GetWin(), + value=self.variable_static_actual_dsp_freq, + callback=self.set_variable_static_actual_dsp_freq, + label="Actual DSP freq", + converter=forms.float_converter(), + ) + self.nb_freq.GetPage(0).GridAdd(self._variable_static_actual_dsp_freq_static_text, 6, 0, 1, 1) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_variable_any_code_waterfall_ave(): + self._post_any_code_evaluators += [('variable_any_code_waterfall_ave', lambda: self._evalutate_variable_any_code_waterfall_ave(**{'averaging': fft_averaging}))] + def __evalutate_variable_any_code_waterfall_ave(*args, **kwds): + try: + self.variable_any_code_waterfall_ave = self.waterfall_sink.win['average'] = fft_averaging + self.set_variable_any_code_waterfall_ave(self.variable_any_code_waterfall_ave) + except AttributeError, e: + print "AttributeError while evaulating variable_any_code_waterfall_ave:", e + __post_evalutate_variable_any_code_waterfall_ave() + except Exception, e: + print "Exception while evaluating variable_any_code_waterfall_ave:", e + self._evalutate_variable_any_code_waterfall_ave = __evalutate_variable_any_code_waterfall_ave + self.__post_evalutate_variable_any_code_waterfall_ave = __post_evalutate_variable_any_code_waterfall_ave + self.__post_evalutate_variable_any_code_waterfall_ave() + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_variable_any_code_iq_correction(): + self._post_any_code_evaluators += [('variable_any_code_iq_correction', lambda: self._evalutate_variable_any_code_iq_correction(**{'auto_iq_correction': auto_iq_correction}))] + def __evalutate_variable_any_code_iq_correction(*args, **kwds): + try: + [self.src.set_auto_iq_balance(self.auto_iq_correction), self.auto_iq_correction or self.src.set_iq_balance(0+0j)] + self.set_variable_any_code_iq_correction(self.variable_any_code_iq_correction) + except AttributeError, e: + print "AttributeError while evaulating variable_any_code_iq_correction:", e + __post_evalutate_variable_any_code_iq_correction() + except Exception, e: + print "Exception while evaluating variable_any_code_iq_correction:", e + self._evalutate_variable_any_code_iq_correction = __evalutate_variable_any_code_iq_correction + self.__post_evalutate_variable_any_code_iq_correction = __post_evalutate_variable_any_code_iq_correction + self._evalutate_variable_any_code_iq_correction(**{'auto_iq_correction': auto_iq_correction}) + variable_any_code_iq_correction = self.variable_any_code_iq_correction + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_variable_any_code_fft_sink_peak_hold(): + self._post_any_code_evaluators += [('variable_any_code_fft_sink_peak_hold', lambda: self._evalutate_variable_any_code_fft_sink_peak_hold(**{'peak_hold': fft_peak_hold}))] + def __evalutate_variable_any_code_fft_sink_peak_hold(*args, **kwds): + try: + self.variable_any_code_fft_sink_peak_hold = self.fft_sink.win['peak_hold'] = fft_peak_hold + self.set_variable_any_code_fft_sink_peak_hold(self.variable_any_code_fft_sink_peak_hold) + except AttributeError, e: + print "AttributeError while evaulating variable_any_code_fft_sink_peak_hold:", e + __post_evalutate_variable_any_code_fft_sink_peak_hold() + except Exception, e: + print "Exception while evaluating variable_any_code_fft_sink_peak_hold:", e + self._evalutate_variable_any_code_fft_sink_peak_hold = __evalutate_variable_any_code_fft_sink_peak_hold + self.__post_evalutate_variable_any_code_fft_sink_peak_hold = __post_evalutate_variable_any_code_fft_sink_peak_hold + self._evalutate_variable_any_code_fft_sink_peak_hold(**{'peak_hold': fft_peak_hold}) + variable_any_code_fft_sink_peak_hold = self.variable_any_code_fft_sink_peak_hold + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_variable_any_code_fft_sink_ave(): + self._post_any_code_evaluators += [('variable_any_code_fft_sink_ave', lambda: self._evalutate_variable_any_code_fft_sink_ave(**{'averaging': fft_averaging}))] + def __evalutate_variable_any_code_fft_sink_ave(*args, **kwds): + try: + self.variable_any_code_fft_sink_ave = self.fft_sink.win['average'] = fft_averaging + self.set_variable_any_code_fft_sink_ave(self.variable_any_code_fft_sink_ave) + except AttributeError, e: + print "AttributeError while evaulating variable_any_code_fft_sink_ave:", e + __post_evalutate_variable_any_code_fft_sink_ave() + except Exception, e: + print "Exception while evaluating variable_any_code_fft_sink_ave:", e + self._evalutate_variable_any_code_fft_sink_ave = __evalutate_variable_any_code_fft_sink_ave + self.__post_evalutate_variable_any_code_fft_sink_ave = __post_evalutate_variable_any_code_fft_sink_ave + self.__post_evalutate_variable_any_code_fft_sink_ave() + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_variable_any_code_auto_dc_offset_removal(): + self._post_any_code_evaluators += [('variable_any_code_auto_dc_offset_removal', lambda: self._evalutate_variable_any_code_auto_dc_offset_removal(**{'auto_dc_offset_removal': auto_dc_offset_removal}))] + def __evalutate_variable_any_code_auto_dc_offset_removal(*args, **kwds): + try: + [self.src.set_auto_dc_offset(self.auto_dc_offset_removal), self.auto_dc_offset_removal or self.src.set_dc_offset(0+0j)] + self.set_variable_any_code_auto_dc_offset_removal(self.variable_any_code_auto_dc_offset_removal) + except AttributeError, e: + print "AttributeError while evaulating variable_any_code_auto_dc_offset_removal:", e + __post_evalutate_variable_any_code_auto_dc_offset_removal() + except Exception, e: + print "Exception while evaluating variable_any_code_auto_dc_offset_removal:", e + self._evalutate_variable_any_code_auto_dc_offset_removal = __evalutate_variable_any_code_auto_dc_offset_removal + self.__post_evalutate_variable_any_code_auto_dc_offset_removal = __post_evalutate_variable_any_code_auto_dc_offset_removal + self._evalutate_variable_any_code_auto_dc_offset_removal(**{'auto_dc_offset_removal': auto_dc_offset_removal}) + variable_any_code_auto_dc_offset_removal = self.variable_any_code_auto_dc_offset_removal + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_usrp_info(): + self._post_any_code_evaluators += [('usrp_info', lambda: self._evalutate_usrp_info(**{}))] + def __evalutate_usrp_info(*args, **kwds): + try: + self.usrp_info = '%s (\'%s\'), %s' % (self.src.get_usrp_info().get('mboard_id'), self.src.get_usrp_info().get('mboard_name'), self.src.get_usrp_info().get('rx_subdev_name')) + self.set_usrp_info(self.usrp_info) + except AttributeError, e: + print "AttributeError while evaulating usrp_info:", e + __post_evalutate_usrp_info() + except Exception, e: + print "Exception while evaluating usrp_info:", e + self._evalutate_usrp_info = __evalutate_usrp_info + self.__post_evalutate_usrp_info = __post_evalutate_usrp_info + self._evalutate_usrp_info(**{}) + usrp_info = self.usrp_info + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_update_time_source(): + self._post_any_code_evaluators += [('update_time_source', lambda: self._evalutate_update_time_source(**{'pps': pps}))] + def __evalutate_update_time_source(*args, **kwds): + try: + if self.pps != '': self.src.set_time_source(self.pps, 0); print '1 PPS =', self.pps; + self.set_update_time_source(self.update_time_source) + except AttributeError, e: + print "AttributeError while evaulating update_time_source:", e + __post_evalutate_update_time_source() + except Exception, e: + print "Exception while evaluating update_time_source:", e + self._evalutate_update_time_source = __evalutate_update_time_source + self.__post_evalutate_update_time_source = __post_evalutate_update_time_source + self._evalutate_update_time_source(**{'pps': pps}) + update_time_source = self.update_time_source + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_update_clock_source(): + self._post_any_code_evaluators += [('update_clock_source', lambda: self._evalutate_update_clock_source(**{'ref': ref}))] + def __evalutate_update_clock_source(*args, **kwds): + try: + if self.ref != '': self.src.set_clock_source(self.ref, 0); print 'Ref =', self.ref; + self.set_update_clock_source(self.update_clock_source) + except AttributeError, e: + print "AttributeError while evaulating update_clock_source:", e + __post_evalutate_update_clock_source() + except Exception, e: + print "Exception while evaluating update_clock_source:", e + self._evalutate_update_clock_source = __evalutate_update_clock_source + self.__post_evalutate_update_clock_source = __post_evalutate_update_clock_source + self._evalutate_update_clock_source(**{'ref': ref}) + update_clock_source = self.update_clock_source + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_tune_result(): + self._post_any_code_evaluators += [('tune_result', lambda: self._evalutate_tune_result(**{'tune_obj': tune_obj}))] + def __evalutate_tune_result(*args, **kwds): + try: + self.tune_result = self.src.set_center_freq(self.tune_obj) + self.set_tune_result(self.tune_result) + except AttributeError, e: + print "AttributeError while evaulating tune_result:", e + __post_evalutate_tune_result() + except Exception, e: + print "Exception while evaluating tune_result:", e + self._evalutate_tune_result = __evalutate_tune_result + self.__post_evalutate_tune_result = __post_evalutate_tune_result + self._evalutate_tune_result(**{'tune_obj': tune_obj}) + tune_result = self.tune_result + self._tune_mode_chooser = forms.drop_down( + parent=self.nb_freq.GetPage(0).GetWin(), + value=self.tune_mode, + callback=self.set_tune_mode, + label="Tune mode", + choices=[0, 1, 2], + labels=['Auto (no LO offset)', 'Auto with LO offset', 'Manual (no DSP)'], + ) + self.nb_freq.GetPage(0).GridAdd(self._tune_mode_chooser, 0, 0, 1, 1) + if sensor_interval > 0: + self._time_probe_poll_rate = sensor_interval + else: + self._time_probe_poll_rate = 1 + self._time_probe_enabled = sensor_interval > 0 + def _set_time_probe_poll_rate(rate): + self._time_probe_enabled = rate > 0 + if rate > 0: + self._time_probe_poll_rate = rate + self.set_time_probe_poll_rate = _set_time_probe_poll_rate + def _time_probe_probe(): + while True: + if self._time_probe_enabled: + val = self.src.get_time_now() + try: + self.set_time_probe(val) + except AttributeError: + pass + time.sleep(1.0/(self._time_probe_poll_rate)) + _time_probe_thread = threading.Thread(target=_time_probe_probe) + _time_probe_thread.daemon = True + _time_probe_thread.start() + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_subdev_spec(): + self._post_any_code_evaluators += [('subdev_spec', lambda: self._evalutate_subdev_spec(**{}))] + def __evalutate_subdev_spec(*args, **kwds): + try: + self.subdev_spec = '[' + self.src.get_subdev_spec().strip() + ']' + self.set_subdev_spec(self.subdev_spec) + except AttributeError, e: + print "AttributeError while evaulating subdev_spec:", e + __post_evalutate_subdev_spec() + except Exception, e: + print "Exception while evaluating subdev_spec:", e + self._evalutate_subdev_spec = __evalutate_subdev_spec + self.__post_evalutate_subdev_spec = __post_evalutate_subdev_spec + self._evalutate_subdev_spec(**{}) + subdev_spec = self.subdev_spec + self._static_locked_static_text = forms.static_text( + parent=self.nb_info.GetPage(0).GetWin(), + value=self.static_locked, + callback=self.set_static_locked, + label="Locked", + converter=forms.str_converter(), + ) + self.nb_info.GetPage(0).Add(self._static_locked_static_text) + if probe_interval > 0: + self._signal_probe_poll_rate = probe_interval + else: + self._signal_probe_poll_rate = 1 + self._signal_probe_enabled = probe_interval > 0 + def _set_signal_probe_poll_rate(rate): + self._signal_probe_enabled = rate > 0 + if rate > 0: + self._signal_probe_poll_rate = rate + self.set_signal_probe_poll_rate = _set_signal_probe_poll_rate + def _signal_probe_probe(): + while True: + if self._signal_probe_enabled: + val = self.probe_avg_mag.level() + try: + self.set_signal_probe(val) + except AttributeError: + pass + time.sleep(1.0/(self._signal_probe_poll_rate)) + _signal_probe_thread = threading.Thread(target=_signal_probe_probe) + _signal_probe_thread.daemon = True + _signal_probe_thread.start() + self._show_max_lvl_check_box = forms.check_box( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.show_max_lvl, + callback=self.set_show_max_lvl, + label="Show max level", + true=True, + false=False, + ) + self.nb_test.GetPage(0).GridAdd(self._show_max_lvl_check_box, 0, 2, 1, 1) + self._show_max_freq_check_box = forms.check_box( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.show_max_freq, + callback=self.set_show_max_freq, + label="Show max freq", + true=True, + false=False, + ) + self.nb_test.GetPage(0).GridAdd(self._show_max_freq_check_box, 0, 1, 1, 1) + _selected_gain_sizer = wx.BoxSizer(wx.VERTICAL) + self._selected_gain_text_box = forms.text_box( + parent=self.nb_analog.GetPage(0).GetWin(), + sizer=_selected_gain_sizer, + value=self.selected_gain, + callback=self.set_selected_gain, + label="Gain", + converter=forms.float_converter(), + proportion=0, + ) + self._selected_gain_slider = forms.slider( + parent=self.nb_analog.GetPage(0).GetWin(), + sizer=_selected_gain_sizer, + value=self.selected_gain, + callback=self.set_selected_gain, + minimum=gain_range.start(), + maximum=[gain_range.stop(), gain_range.start() + 1.0][gain_range.stop()==gain_range.start()], + num_steps=[int((abs(gain_range.stop()-gain_range.start())/[gain_range.step(), 1.0][gain_range.step()==0])), 1][gain_range.stop()==gain_range.start()], + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.nb_analog.GetPage(0).Add(_selected_gain_sizer) + self._selected_antenna_chooser = forms.radio_buttons( + parent=self.nb_analog.GetPage(0).GetWin(), + value=self.selected_antenna, + callback=self.set_selected_antenna, + label="Antenna", + choices=antennas, + labels=[antennas,['(default)']][antennas==('',)], + style=wx.RA_HORIZONTAL, + ) + self.nb_analog.GetPage(0).Add(self._selected_antenna_chooser) + self._requested_sample_rate_base_text_box = forms.text_box( + parent=self.nb_rate.GetPage(0).GetWin(), + value=self.requested_sample_rate_base, + callback=self.set_requested_sample_rate_base, + label="Requested base sample rate", + converter=forms.float_converter(), + ) + self.nb_rate.GetPage(0).GridAdd(self._requested_sample_rate_base_text_box, 0, 0, 1, 1) + _requested_freq_txt_sizer = wx.BoxSizer(wx.VERTICAL) + self._requested_freq_txt_text_box = forms.text_box( + parent=self.nb_freq.GetPage(0).GetWin(), + sizer=_requested_freq_txt_sizer, + value=self.requested_freq_txt, + callback=self.set_requested_freq_txt, + label="Requested freq", + converter=forms.float_converter(), + proportion=0, + ) + self._requested_freq_txt_slider = forms.slider( + parent=self.nb_freq.GetPage(0).GetWin(), + sizer=_requested_freq_txt_sizer, + value=self.requested_freq_txt, + callback=self.set_requested_freq_txt, + minimum=freq_range.start(), + maximum=[freq_range.stop(), freq_range.start() + 1.0][freq_range.start()==freq_range.stop()], + num_steps=[1000,1][freq_range.start()==freq_range.stop()], + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.nb_freq.GetPage(0).GridAdd(_requested_freq_txt_sizer, 1, 0, 1, 1) + self._relative_time_chooser = forms.drop_down( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.relative_time, + callback=self.set_relative_time, + label="Time display", + choices=[False, True], + labels=['Absolute', 'Relative'], + ) + self.nb_test.GetPage(0).GridAdd(self._relative_time_chooser, 1, 0, 1, 1) + self._relative_freq_chooser = forms.drop_down( + parent=self.nb_freq.GetPage(0).GetWin(), + value=self.relative_freq, + callback=self.set_relative_freq, + label="Frequency Axis", + choices=[1, 0], + labels=['RF', 'Baseband'], + ) + self.nb_freq.GetPage(0).GridAdd(self._relative_freq_chooser, 7, 0, 1, 1) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_motherboard_sensors(): + self._post_any_code_evaluators += [('motherboard_sensors', lambda: self._evalutate_motherboard_sensors(**{'motherboard_sensor_names': motherboard_sensor_names}))] + def __evalutate_motherboard_sensors(*args, **kwds): + try: + self.motherboard_sensors = '\n'.join(map(lambda x: '%s: %s' % (x, str(self.src.get_mboard_sensor(x))), filter(lambda x: x.find('gps') != 0, self.motherboard_sensor_names))) + self.set_motherboard_sensors(self.motherboard_sensors) + except AttributeError, e: + print "AttributeError while evaulating motherboard_sensors:", e + __post_evalutate_motherboard_sensors() + except Exception, e: + print "Exception while evaluating motherboard_sensors:", e + self._evalutate_motherboard_sensors = __evalutate_motherboard_sensors + self.__post_evalutate_motherboard_sensors = __post_evalutate_motherboard_sensors + self._evalutate_motherboard_sensors(**{'motherboard_sensor_names': motherboard_sensor_names}) + motherboard_sensors = self.motherboard_sensors + self.logpwrfft_x_0 = logpwrfft.logpwrfft_c( + sample_rate=samp_rate, + fft_size=fft_size, + ref_scale=fft_ref_scale, + frame_rate=fft_rate, + avg_alpha=fft_ave_probe, + average=False, + ) + if lo_check_interval * float(has_lo_locked) > 0: + self._locked_probe_poll_rate = lo_check_interval * float(has_lo_locked) + else: + self._locked_probe_poll_rate = 1 + self._locked_probe_enabled = lo_check_interval * float(has_lo_locked) > 0 + def _set_locked_probe_poll_rate(rate): + self._locked_probe_enabled = rate > 0 + if rate > 0: + self._locked_probe_poll_rate = rate + self.set_locked_probe_poll_rate = _set_locked_probe_poll_rate + def _locked_probe_probe(): + while True: + if self._locked_probe_enabled: + val = self.src.get_sensor('lo_locked') + try: + self.set_locked_probe(val) + except AttributeError: + pass + time.sleep(1.0/(self._locked_probe_poll_rate)) + _locked_probe_thread = threading.Thread(target=_locked_probe_probe) + _locked_probe_thread.daemon = True + _locked_probe_thread.start() + self._lo_offset_txt_text_box = forms.text_box( + parent=self.nb_freq.GetPage(0).GetWin(), + value=self.lo_offset_txt, + callback=self.set_lo_offset_txt, + label="LO offset (only for LO offset tuning mode)", + converter=forms.float_converter(), + ) + self.nb_freq.GetPage(0).GridAdd(self._lo_offset_txt_text_box, 4, 0, 1, 1) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_gain_default(): + self._post_any_code_evaluators += [('gain_default', lambda: self._evalutate_gain_default(**{'initial_gain': initial_gain}))] + def __evalutate_gain_default(*args, **kwds): + try: + self.gain_default = [gain,initial_gain][gain==float('-inf')] + self.set_gain_default(self.gain_default) + except AttributeError, e: + print "AttributeError while evaulating gain_default:", e + __post_evalutate_gain_default() + except Exception, e: + print "Exception while evaluating gain_default:", e + self._evalutate_gain_default = __evalutate_gain_default + self.__post_evalutate_gain_default = __post_evalutate_gain_default + self._evalutate_gain_default(**{'initial_gain': initial_gain}) + gain_default = self.gain_default + _freq_fine_sizer = wx.BoxSizer(wx.VERTICAL) + self._freq_fine_text_box = forms.text_box( + parent=self.nb_freq.GetPage(0).GetWin(), + sizer=_freq_fine_sizer, + value=self.freq_fine, + callback=self.set_freq_fine, + label="Freq (fine)", + converter=forms.float_converter(), + proportion=0, + ) + self._freq_fine_slider = forms.slider( + parent=self.nb_freq.GetPage(0).GetWin(), + sizer=_freq_fine_sizer, + value=self.freq_fine, + callback=self.set_freq_fine, + minimum=-freq_fine_range/2, + maximum=freq_fine_range/2, + num_steps=1000, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.nb_freq.GetPage(0).GridAdd(_freq_fine_sizer, 2, 0, 1, 1) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_fix_invalid_freq(): + self._post_any_code_evaluators += [('fix_invalid_freq', lambda: self._evalutate_fix_invalid_freq(**{}))] + def __evalutate_fix_invalid_freq(*args, **kwds): + try: + ((freq <= freq_range.stop()) and (freq >= freq_range.start())) or self.set_requested_freq_txt(self.src.get_center_freq()); print self.src.get_center_freq() + self.set_fix_invalid_freq(self.fix_invalid_freq) + except AttributeError, e: + print "AttributeError while evaulating fix_invalid_freq:", e + __post_evalutate_fix_invalid_freq() + except Exception, e: + print "Exception while evaluating fix_invalid_freq:", e + self._evalutate_fix_invalid_freq = __evalutate_fix_invalid_freq + self.__post_evalutate_fix_invalid_freq = __post_evalutate_fix_invalid_freq + self.__post_evalutate_fix_invalid_freq() + self.fft_max_lvl_probe = blocks.probe_signal_f() + if probe_interval > 0: + self._fft_max_lvl_poll_rate = probe_interval + else: + self._fft_max_lvl_poll_rate = 1 + self._fft_max_lvl_enabled = probe_interval > 0 + def _set_fft_max_lvl_poll_rate(rate): + self._fft_max_lvl_enabled = rate > 0 + if rate > 0: + self._fft_max_lvl_poll_rate = rate + self.set_fft_max_lvl_poll_rate = _set_fft_max_lvl_poll_rate + def _fft_max_lvl_probe(): + while True: + if self._fft_max_lvl_enabled: + val = self.fft_max_lvl_probe.level() + try: + self.set_fft_max_lvl(val) + except AttributeError: + pass + time.sleep(1.0/(self._fft_max_lvl_poll_rate)) + _fft_max_lvl_thread = threading.Thread(target=_fft_max_lvl_probe) + _fft_max_lvl_thread.daemon = True + _fft_max_lvl_thread.start() + self.fft_max_idx_probe = blocks.probe_signal_s() + if probe_interval > 0: + self._fft_max_idx_poll_rate = probe_interval + else: + self._fft_max_idx_poll_rate = 1 + self._fft_max_idx_enabled = probe_interval > 0 + def _set_fft_max_idx_poll_rate(rate): + self._fft_max_idx_enabled = rate > 0 + if rate > 0: + self._fft_max_idx_poll_rate = rate + self.set_fft_max_idx_poll_rate = _set_fft_max_idx_poll_rate + def _fft_max_idx_probe(): + while True: + if self._fft_max_idx_enabled: + val = self.fft_max_idx_probe.level() + try: + self.set_fft_max_idx(val) + except AttributeError: + pass + time.sleep(1.0/(self._fft_max_idx_poll_rate)) + _fft_max_idx_thread = threading.Thread(target=_fft_max_idx_probe) + _fft_max_idx_thread.daemon = True + _fft_max_idx_thread.start() + _decim_sizer = wx.BoxSizer(wx.VERTICAL) + self._decim_text_box = forms.text_box( + parent=self.nb_rate.GetPage(0).GetWin(), + sizer=_decim_sizer, + value=self.decim, + callback=self.set_decim, + label="Divide base sample rate", + converter=forms.int_converter(), + proportion=0, + ) + self._decim_slider = forms.slider( + parent=self.nb_rate.GetPage(0).GetWin(), + sizer=_decim_sizer, + value=self.decim, + callback=self.set_decim, + minimum=1, + maximum=max_decim, + num_steps=max_decim-1, + style=wx.SL_HORIZONTAL, + cast=int, + proportion=1, + ) + self.nb_rate.GetPage(0).Add(_decim_sizer) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_daughterboard_sensors(): + self._post_any_code_evaluators += [('daughterboard_sensors', lambda: self._evalutate_daughterboard_sensors(**{'daughterboard_sensor_names': daughterboard_sensor_names}))] + def __evalutate_daughterboard_sensors(*args, **kwds): + try: + self.daughterboard_sensors = '\n'.join(map(lambda x: '%s: %s' % (x, str(self.src.get_sensor(x))), self.daughterboard_sensor_names)) + self.set_daughterboard_sensors(self.daughterboard_sensors) + except AttributeError, e: + print "AttributeError while evaulating daughterboard_sensors:", e + __post_evalutate_daughterboard_sensors() + except Exception, e: + print "Exception while evaluating daughterboard_sensors:", e + self._evalutate_daughterboard_sensors = __evalutate_daughterboard_sensors + self.__post_evalutate_daughterboard_sensors = __post_evalutate_daughterboard_sensors + self._evalutate_daughterboard_sensors(**{'daughterboard_sensor_names': daughterboard_sensor_names}) + daughterboard_sensors = self.daughterboard_sensors + self._clicked_freq_txt_text_box = forms.text_box( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.clicked_freq_txt, + callback=self.set_clicked_freq_txt, + label="Clicked freq", + converter=forms.float_converter(), + ) + self.nb_test.GetPage(0).Add(self._clicked_freq_txt_text_box) + self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_gr_complex*1, "", ""); self.blocks_tag_debug_0.set_display(show_stream_tags_chk) + self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_short*1) + self.blocks_max_xx_0 = blocks.max_ff(fft_size) + self.blocks_float_to_complex_0 = blocks.float_to_complex(1) + self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) + self.blocks_argmax_xx_0 = blocks.argmax_fs(fft_size) + self.blks2_selector_0_0 = grc_blks2.selector( + item_size=gr.sizeof_gr_complex*1, + num_inputs=1, + num_outputs=2, + input_index=0, + output_index=scope_mode, + ) + self.blks2_selector_0 = grc_blks2.selector( + item_size=gr.sizeof_gr_complex*1, + num_inputs=2, + num_outputs=1, + input_index=scope_mode, + output_index=0, + ) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_any_test_1(): + self._post_any_code_evaluators += [('any_test_1', lambda: self._evalutate_any_test_1(**{'test': test}))] + def __evalutate_any_test_1(*args, **kwds): + try: + if self.fft_sink.controller['average']: self.fft_sink.controller['average'] = False; time.sleep(0.25); self.fft_sink.controller['average'] = True; + self.set_any_test_1(self.any_test_1) + except AttributeError, e: + print "AttributeError while evaulating any_test_1:", e + __post_evalutate_any_test_1() + except Exception, e: + print "Exception while evaluating any_test_1:", e + self._evalutate_any_test_1 = __evalutate_any_test_1 + self.__post_evalutate_any_test_1 = __post_evalutate_any_test_1 + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_actual_sample_rate(): + self._post_any_code_evaluators += [('actual_sample_rate', lambda: self._evalutate_actual_sample_rate(**{'requested_sample_rate': requested_sample_rate}))] + def __evalutate_actual_sample_rate(*args, **kwds): + try: + self.actual_sample_rate = self.src.get_samp_rate() + self.set_actual_sample_rate(self.actual_sample_rate) + except AttributeError, e: + print "AttributeError while evaulating actual_sample_rate:", e + __post_evalutate_actual_sample_rate() + except Exception, e: + print "Exception while evaluating actual_sample_rate:", e + self._evalutate_actual_sample_rate = __evalutate_actual_sample_rate + self.__post_evalutate_actual_sample_rate = __post_evalutate_actual_sample_rate + self._evalutate_actual_sample_rate(**{'requested_sample_rate': requested_sample_rate}) + actual_sample_rate = self.actual_sample_rate + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_actual_center_freq(): + self._post_any_code_evaluators += [('actual_center_freq', lambda: self._evalutate_actual_center_freq(**{'tune_obj': tune_obj}))] + def __evalutate_actual_center_freq(*args, **kwds): + try: + self.actual_center_freq = self.src.get_center_freq() + self.set_actual_center_freq(self.actual_center_freq) + except AttributeError, e: + print "AttributeError while evaulating actual_center_freq:", e + __post_evalutate_actual_center_freq() + except Exception, e: + print "Exception while evaluating actual_center_freq:", e + self._evalutate_actual_center_freq = __evalutate_actual_center_freq + self.__post_evalutate_actual_center_freq = __post_evalutate_actual_center_freq + self._evalutate_actual_center_freq(**{'tune_obj': tune_obj}) + actual_center_freq = self.actual_center_freq + + ################################################## + # Connections + ################################################## + self.connect((self.blks2_selector_0, 0), (self.wxgui_scopesink2_0, 0)) + self.connect((self.blks2_selector_0_0, 0), (self.blks2_selector_0, 0)) + self.connect((self.blks2_selector_0_0, 1), (self.blocks_complex_to_mag_0, 0)) + self.connect((self.blocks_argmax_xx_0, 1), (self.blocks_null_sink_0, 0)) + self.connect((self.blocks_argmax_xx_0, 0), (self.fft_max_idx_probe, 0)) + self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_float_to_complex_0, 1)) + self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_float_to_complex_0, 0)) + self.connect((self.blocks_float_to_complex_0, 0), (self.blks2_selector_0, 1)) + self.connect((self.blocks_max_xx_0, 0), (self.fft_max_lvl_probe, 0)) + self.connect((self.logpwrfft_x_0, 0), (self.blocks_argmax_xx_0, 0)) + self.connect((self.logpwrfft_x_0, 0), (self.blocks_max_xx_0, 0)) + self.connect((self.src, 0), (self.blocks_tag_debug_0, 0)) + self.connect((self.src, 0), (self.blks2_selector_0_0, 0)) + self.connect((self.src, 0), (self.fft_sink, 0)) + self.connect((self.src, 0), (self.waterfall_sink, 0)) + self.connect((self.src, 0), (self.probe_avg_mag, 0)) + self.connect((self.src, 0), (self.logpwrfft_x_0, 0)) + + + def get_antenna(self): + return self.antenna + + def set_antenna(self, antenna): + self.antenna = antenna + self.set_selected_antenna([ [self.antenna,self.antennas[0]][self.antenna not in self.antennas] ,self.antennas[0]][self.antenna=='']) + + def get_args(self): + return self.args + + def set_args(self, args): + self.args = args + + def get_ave(self): + return self.ave + + def set_ave(self, ave): + self.ave = ave + self.set_fft_ave_probe(self.ave) + + def get_averaging(self): + return self.averaging + + def set_averaging(self, averaging): + self.averaging = averaging + self.set_fft_averaging(self.str_to_bool(self.averaging)) + + def get_bw(self): + return self.bw + + def set_bw(self, bw): + self.bw = bw + self.src.set_bandwidth(self.bw, 0) + + def get_dyn_rng(self): + return self.dyn_rng + + def set_dyn_rng(self, dyn_rng): + self.dyn_rng = dyn_rng + + def get_fft_rate(self): + return self.fft_rate + + def set_fft_rate(self, fft_rate): + self.fft_rate = fft_rate + + def get_fft_ref_scale(self): + return self.fft_ref_scale + + def set_fft_ref_scale(self, fft_ref_scale): + self.fft_ref_scale = fft_ref_scale + + def get_fft_size(self): + return self.fft_size + + def set_fft_size(self, fft_size): + self.fft_size = fft_size + self.set_fft_max_idx((self.fft_size/2)*0) + self.set_fft_max_idx_norm([self.fft_max_idx,self.fft_max_idx-self.fft_size][int(self.fft_max_idx>(self.fft_size/2))]) + self.set_max_bin_freq(self.fft_center_freq + (((1.0*self.fft_max_idx_norm) / self.fft_size) * self.samp_rate)) + + def get_freq(self): + return self.freq + + def set_freq(self, freq): + self.freq = freq + self.set_requested_freq_txt(self.freq) + self.src.set_center_freq(uhd.tune_request(self.freq, self.lo_offset), 0) + + def get_freq_fine_range(self): + return self.freq_fine_range + + def set_freq_fine_range(self, freq_fine_range): + self.freq_fine_range = freq_fine_range + + def get_gain(self): + return self.gain + + def set_gain(self, gain): + self.gain = gain + + def get_lo_check_interval(self): + return self.lo_check_interval + + def set_lo_check_interval(self, lo_check_interval): + self.lo_check_interval = lo_check_interval + self.set_locked_probe_poll_rate(self.lo_check_interval * float(self.has_lo_locked)) + + def get_lo_offset(self): + return self.lo_offset + + def set_lo_offset(self, lo_offset): + self.lo_offset = lo_offset + self.set_lo_offset_txt(self.lo_offset) + self.set_tune_mode([1,0][self.lo_offset==0.0]) + self.src.set_center_freq(uhd.tune_request(self.freq, self.lo_offset), 0) + + def get_mag_alpha(self): + return self.mag_alpha + + def set_mag_alpha(self, mag_alpha): + self.mag_alpha = mag_alpha + self.probe_avg_mag.set_alpha(self.mag_alpha) + + def get_peak_hold(self): + return self.peak_hold + + def set_peak_hold(self, peak_hold): + self.peak_hold = peak_hold + self.set_fft_peak_hold(self.str_to_bool(self.peak_hold)) + + def get_pps(self): + return self.pps + + def set_pps(self, pps): + self.pps = pps + self._evalutate_update_time_source(**{'pps': self.pps}) + + def get_probe_interval(self): + return self.probe_interval + + def set_probe_interval(self, probe_interval): + self.probe_interval = probe_interval + self.set_fft_max_idx_poll_rate(self.probe_interval) + self.set_fft_max_lvl_poll_rate(self.probe_interval) + self.set_signal_probe_poll_rate(self.probe_interval) + + def get_rate(self): + return self.rate + + def set_rate(self, rate): + self.rate = rate + self.set_requested_sample_rate_base(self.rate) + + def get_ref(self): + return self.ref + + def set_ref(self, ref): + self.ref = ref + self._evalutate_update_clock_source(**{'ref': self.ref}) + + def get_ref_lvl(self): + return self.ref_lvl + + def set_ref_lvl(self, ref_lvl): + self.ref_lvl = ref_lvl + + def get_sensor_interval(self): + return self.sensor_interval + + def set_sensor_interval(self, sensor_interval): + self.sensor_interval = sensor_interval + self.set_daughterboard_sensor_names_poll_rate(self.sensor_interval) + self.set_motherboard_sensor_names_poll_rate(self.sensor_interval) + self.set_time_probe_poll_rate(self.sensor_interval) + + def get_show_stream_tags(self): + return self.show_stream_tags + + def set_show_stream_tags(self, show_stream_tags): + self.show_stream_tags = show_stream_tags + self.set_show_stream_tags_chk([False, True][self.show_stream_tags.lower() != 'false']) + + def get_spec(self): + return self.spec + + def set_spec(self, spec): + self.spec = spec + + def get_stream_args(self): + return self.stream_args + + def set_stream_args(self, stream_args): + self.stream_args = stream_args + + def get_window(self): + return self.window + + def set_window(self, window): + self.window = window + self.set_variable_static_fft_window_name(self.window_fn_name_map[self.window]) + self.set_window_fn(self.window_fn_map[self.window]) + + def get_wire_format(self): + return self.wire_format + + def set_wire_format(self, wire_format): + self.wire_format = wire_format + + def get_relative_freq(self): + return self.relative_freq + + def set_relative_freq(self, relative_freq): + self.relative_freq = relative_freq + self.set_fft_center_freq(self.actual_center_freq * self.relative_freq) + self._relative_freq_chooser.set_value(self.relative_freq) + + def get_gain_range(self): + return self.gain_range + + def set_gain_range(self, gain_range): + self.gain_range = gain_range + self._run_evaluators_later(('initial_gain', lambda: self._evalutate_initial_gain(**{'gain_range': self.gain_range}))) + + def get_fft_max_idx(self): + return self.fft_max_idx + + def set_fft_max_idx(self, fft_max_idx): + self.fft_max_idx = fft_max_idx + self.set_fft_max_idx_norm([self.fft_max_idx,self.fft_max_idx-self.fft_size][int(self.fft_max_idx>(self.fft_size/2))]) + + def get_actual_sample_rate(self): + return self.actual_sample_rate + + def set_actual_sample_rate(self, actual_sample_rate): + self.actual_sample_rate = actual_sample_rate + self.set_samp_rate(int(self.actual_sample_rate)) + self.set_variable_static_actual_sample_rate(self.actual_sample_rate) + + def get_actual_center_freq(self): + return self.actual_center_freq + + def set_actual_center_freq(self, actual_center_freq): + self.actual_center_freq = actual_center_freq + self.set_fft_center_freq(self.actual_center_freq * self.relative_freq) + + def get_str_to_bool(self): + return self.str_to_bool + + def set_str_to_bool(self, str_to_bool): + self.str_to_bool = str_to_bool + self.set_fft_averaging(self.str_to_bool(self.averaging)) + self.set_fft_peak_hold(self.str_to_bool(self.peak_hold)) + + def get_signal_probe(self): + return self.signal_probe + + def set_signal_probe(self, signal_probe): + self.signal_probe = signal_probe + self.set_signal_probe_log(math.log10([self.signal_probe,1.0][self.signal_probe==0.0])*10) + + def get_samp_rate(self): + return self.samp_rate + + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + self.set_max_bin_freq(self.fft_center_freq + (((1.0*self.fft_max_idx_norm) / self.fft_size) * self.samp_rate)) + self.fft_sink.set_sample_rate(self.samp_rate) + self.logpwrfft_x_0.set_sample_rate(self.samp_rate) + self.waterfall_sink.set_sample_rate(self.samp_rate) + self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate) + + def get_requested_freq_txt(self): + return self.requested_freq_txt + + def set_requested_freq_txt(self, requested_freq_txt): + self.requested_freq_txt = requested_freq_txt + self.set_requested_freq(self.requested_freq_txt + self.freq_fine) + self._requested_freq_txt_slider.set_value(self.requested_freq_txt) + self._requested_freq_txt_text_box.set_value(self.requested_freq_txt) + + def get_gain_default(self): + return self.gain_default + + def set_gain_default(self, gain_default): + self.gain_default = gain_default + self.set_selected_gain(self.gain_default) + + def get_freq_fine(self): + return self.freq_fine + + def set_freq_fine(self, freq_fine): + self.freq_fine = freq_fine + self._freq_fine_slider.set_value(self.freq_fine) + self._freq_fine_text_box.set_value(self.freq_fine) + self.set_requested_freq(self.requested_freq_txt + self.freq_fine) + + def get_fft_max_idx_norm(self): + return self.fft_max_idx_norm + + def set_fft_max_idx_norm(self, fft_max_idx_norm): + self.fft_max_idx_norm = fft_max_idx_norm + self.set_max_bin_freq(self.fft_center_freq + (((1.0*self.fft_max_idx_norm) / self.fft_size) * self.samp_rate)) + + def get_fft_center_freq(self): + return self.fft_center_freq + + def set_fft_center_freq(self, fft_center_freq): + self.fft_center_freq = fft_center_freq + self.set_max_bin_freq(self.fft_center_freq + (((1.0*self.fft_max_idx_norm) / self.fft_size) * self.samp_rate)) + self.fft_sink.set_baseband_freq(self.fft_center_freq) + self.waterfall_sink.set_baseband_freq(self.fft_center_freq) + + def get_antennas(self): + return self.antennas + + def set_antennas(self, antennas): + self.antennas = antennas + self.set_selected_antenna([ [self.antenna,self.antennas[0]][self.antenna not in self.antennas] ,self.antennas[0]][self.antenna=='']) + + def get_window_fn_name_map(self): + return self.window_fn_name_map + + def set_window_fn_name_map(self, window_fn_name_map): + self.window_fn_name_map = window_fn_name_map + self.set_variable_static_fft_window_name(self.window_fn_name_map[self.window]) + + def get_window_fn_map(self): + return self.window_fn_map + + def set_window_fn_map(self, window_fn_map): + self.window_fn_map = window_fn_map + self.set_window_fn(self.window_fn_map[self.window]) + + def get_usrp_info(self): + return self.usrp_info + + def set_usrp_info(self, usrp_info): + self.usrp_info = usrp_info + self.set_variable_static_usrp_info(self.usrp_info) + + def get_tune_result(self): + return self.tune_result + + def set_tune_result(self, tune_result): + self.tune_result = tune_result + self.set_variable_static_actual_dsp_freq(self.tune_result.actual_dsp_freq) + self.set_variable_static_rf_freq(self.tune_result.actual_rf_freq) + + def get_tune_mode(self): + return self.tune_mode + + def set_tune_mode(self, tune_mode): + self.tune_mode = tune_mode + self._tune_mode_chooser.set_value(self.tune_mode) + self.set_tune_obj([self.requested_freq, uhd.tune_request(self.requested_freq, self.lo_offset_txt), uhd.tune_request(self.requested_freq, dsp_freq=0, dsp_freq_policy=uhd.tune_request.POLICY_MANUAL)][self.tune_mode]) + + def get_time_probe(self): + return self.time_probe + + def set_time_probe(self, time_probe): + self.time_probe = time_probe + self.set_variable_static_time_now(str( [time.ctime(self.time_probe.get_real_secs()), datetime.timedelta(seconds=self.time_probe.get_real_secs()), time.gmtime(self.time_probe.get_real_secs())] [self.relative_time])) + + def get_test(self): + return self.test + + def set_test(self, test): + self.test = test + self._run_evaluators_later(('any_test_1', lambda: self._evalutate_any_test_1(**{'test': self.test}))) + self._test_chooser.set_value(self.test) + + def get_subdev_spec(self): + return self.subdev_spec + + def set_subdev_spec(self, subdev_spec): + self.subdev_spec = subdev_spec + self.set_variable_static_subdev_spec(self.subdev_spec) + + def get_signal_probe_log(self): + return self.signal_probe_log + + def set_signal_probe_log(self, signal_probe_log): + self.signal_probe_log = signal_probe_log + self.set_variable_static_level_probe(self.signal_probe_log) + + def get_selected_gain(self): + return self.selected_gain + + def set_selected_gain(self, selected_gain): + self.selected_gain = selected_gain + self._selected_gain_slider.set_value(self.selected_gain) + self._selected_gain_text_box.set_value(self.selected_gain) + self.set_selected_gain_proxy(self.selected_gain) + + def get_selected_antenna(self): + return self.selected_antenna + + def set_selected_antenna(self, selected_antenna): + self.selected_antenna = selected_antenna + self._selected_antenna_chooser.set_value(self.selected_antenna) + self.set_selected_antenna_proxy(self.selected_antenna) + + def get_requested_sample_rate_base(self): + return self.requested_sample_rate_base + + def set_requested_sample_rate_base(self, requested_sample_rate_base): + self.requested_sample_rate_base = requested_sample_rate_base + self.set_requested_sample_rate(self.requested_sample_rate_base / (1.*self.decim)) + self._requested_sample_rate_base_text_box.set_value(self.requested_sample_rate_base) + + def get_requested_freq(self): + return self.requested_freq + + def set_requested_freq(self, requested_freq): + self.requested_freq = requested_freq + self.set_tune_obj([self.requested_freq, uhd.tune_request(self.requested_freq, self.lo_offset_txt), uhd.tune_request(self.requested_freq, dsp_freq=0, dsp_freq_policy=uhd.tune_request.POLICY_MANUAL)][self.tune_mode]) + self.set_variable_static_requested_freq(self.requested_freq) + + def get_relative_time(self): + return self.relative_time + + def set_relative_time(self, relative_time): + self.relative_time = relative_time + self._relative_time_chooser.set_value(self.relative_time) + self.set_variable_static_time_now(str( [time.ctime(self.time_probe.get_real_secs()), datetime.timedelta(seconds=self.time_probe.get_real_secs()), time.gmtime(self.time_probe.get_real_secs())] [self.relative_time])) + + def get_motherboard_sensors(self): + return self.motherboard_sensors + + def set_motherboard_sensors(self, motherboard_sensors): + self.motherboard_sensors = motherboard_sensors + self.set_variable_static_text_0(self.motherboard_sensors) + + def get_max_bin_freq(self): + return self.max_bin_freq + + def set_max_bin_freq(self, max_bin_freq): + self.max_bin_freq = max_bin_freq + self.set_variable_static_max_bin_freq(self.max_bin_freq) + + def get_locked_probe(self): + return self.locked_probe + + def set_locked_probe(self, locked_probe): + self.locked_probe = locked_probe + self.set_static_locked('"' + str(self.locked_probe) + '"') + + def get_lo_offset_txt(self): + return self.lo_offset_txt + + def set_lo_offset_txt(self, lo_offset_txt): + self.lo_offset_txt = lo_offset_txt + self._lo_offset_txt_text_box.set_value(self.lo_offset_txt) + self.set_tune_obj([self.requested_freq, uhd.tune_request(self.requested_freq, self.lo_offset_txt), uhd.tune_request(self.requested_freq, dsp_freq=0, dsp_freq_policy=uhd.tune_request.POLICY_MANUAL)][self.tune_mode]) + + def get_fft_peak_hold(self): + return self.fft_peak_hold + + def set_fft_peak_hold(self, fft_peak_hold): + self.fft_peak_hold = fft_peak_hold + self._run_evaluators_later(('variable_any_code_fft_sink_peak_hold', lambda: self._evalutate_variable_any_code_fft_sink_peak_hold(**{'peak_hold': self.fft_peak_hold}))) + + def get_fft_max_lvl(self): + return self.fft_max_lvl + + def set_fft_max_lvl(self, fft_max_lvl): + self.fft_max_lvl = fft_max_lvl + self.set_fft_max_lvl_value(self.fft_max_lvl) + self.set_variable_static_fft_max_lvl_log(self.fft_max_lvl) + + def get_fft_averaging(self): + return self.fft_averaging + + def set_fft_averaging(self, fft_averaging): + self.fft_averaging = fft_averaging + self._run_evaluators_later(('variable_any_code_fft_sink_ave', lambda: self._evalutate_variable_any_code_fft_sink_ave(**{'averaging': self.fft_averaging}))) + self._run_evaluators_later(('variable_any_code_waterfall_ave', lambda: self._evalutate_variable_any_code_waterfall_ave(**{'averaging': self.fft_averaging}))) + + def get_decim(self): + return self.decim + + def set_decim(self, decim): + self.decim = decim + self._decim_slider.set_value(self.decim) + self._decim_text_box.set_value(self.decim) + self.set_requested_sample_rate(self.requested_sample_rate_base / (1.*self.decim)) + + def get_daughterboard_sensors(self): + return self.daughterboard_sensors + + def set_daughterboard_sensors(self, daughterboard_sensors): + self.daughterboard_sensors = daughterboard_sensors + self.set_variable_static_text_0_0(self.daughterboard_sensors) + + def get_clicked_freq(self): + return self.clicked_freq + + def set_clicked_freq(self, clicked_freq): + self.clicked_freq = clicked_freq + self.set_clicked_freq_txt(self.clicked_freq) + + def get_window_fn(self): + return self.window_fn + + def set_window_fn(self, window_fn): + self.window_fn = window_fn + + def get_variable_static_usrp_info(self): + return self.variable_static_usrp_info + + def set_variable_static_usrp_info(self, variable_static_usrp_info): + self.variable_static_usrp_info = variable_static_usrp_info + self._variable_static_usrp_info_static_text.set_value(self.variable_static_usrp_info) + + def get_variable_static_time_now(self): + return self.variable_static_time_now + + def set_variable_static_time_now(self, variable_static_time_now): + self.variable_static_time_now = variable_static_time_now + self._variable_static_time_now_static_text.set_value(self.variable_static_time_now) + + def get_variable_static_text_0_0(self): + return self.variable_static_text_0_0 + + def set_variable_static_text_0_0(self, variable_static_text_0_0): + self.variable_static_text_0_0 = variable_static_text_0_0 + self._variable_static_text_0_0_static_text.set_value(self.variable_static_text_0_0) + + def get_variable_static_text_0(self): + return self.variable_static_text_0 + + def set_variable_static_text_0(self, variable_static_text_0): + self.variable_static_text_0 = variable_static_text_0 + self._variable_static_text_0_static_text.set_value(self.variable_static_text_0) + + def get_variable_static_subdev_spec(self): + return self.variable_static_subdev_spec + + def set_variable_static_subdev_spec(self, variable_static_subdev_spec): + self.variable_static_subdev_spec = variable_static_subdev_spec + self._variable_static_subdev_spec_static_text.set_value(self.variable_static_subdev_spec) + + def get_variable_static_rf_freq(self): + return self.variable_static_rf_freq + + def set_variable_static_rf_freq(self, variable_static_rf_freq): + self.variable_static_rf_freq = variable_static_rf_freq + self._variable_static_rf_freq_static_text.set_value(self.variable_static_rf_freq) + + def get_variable_static_requested_freq(self): + return self.variable_static_requested_freq + + def set_variable_static_requested_freq(self, variable_static_requested_freq): + self.variable_static_requested_freq = variable_static_requested_freq + self._variable_static_requested_freq_static_text.set_value(self.variable_static_requested_freq) + + def get_variable_static_max_bin_freq(self): + return self.variable_static_max_bin_freq + + def set_variable_static_max_bin_freq(self, variable_static_max_bin_freq): + self.variable_static_max_bin_freq = variable_static_max_bin_freq + self._variable_static_max_bin_freq_static_text.set_value(self.variable_static_max_bin_freq) + + def get_variable_static_level_probe(self): + return self.variable_static_level_probe + + def set_variable_static_level_probe(self, variable_static_level_probe): + self.variable_static_level_probe = variable_static_level_probe + self._variable_static_level_probe_static_text.set_value(self.variable_static_level_probe) + + def get_variable_static_fft_window_name(self): + return self.variable_static_fft_window_name + + def set_variable_static_fft_window_name(self, variable_static_fft_window_name): + self.variable_static_fft_window_name = variable_static_fft_window_name + self._variable_static_fft_window_name_static_text.set_value(self.variable_static_fft_window_name) + + def get_variable_static_fft_max_lvl_log(self): + return self.variable_static_fft_max_lvl_log + + def set_variable_static_fft_max_lvl_log(self, variable_static_fft_max_lvl_log): + self.variable_static_fft_max_lvl_log = variable_static_fft_max_lvl_log + self._variable_static_fft_max_lvl_log_static_text.set_value(self.variable_static_fft_max_lvl_log) + + def get_variable_static_actual_sample_rate(self): + return self.variable_static_actual_sample_rate + + def set_variable_static_actual_sample_rate(self, variable_static_actual_sample_rate): + self.variable_static_actual_sample_rate = variable_static_actual_sample_rate + self._variable_static_actual_sample_rate_static_text.set_value(self.variable_static_actual_sample_rate) + + def get_variable_static_actual_dsp_freq(self): + return self.variable_static_actual_dsp_freq + + def set_variable_static_actual_dsp_freq(self, variable_static_actual_dsp_freq): + self.variable_static_actual_dsp_freq = variable_static_actual_dsp_freq + self._variable_static_actual_dsp_freq_static_text.set_value(self.variable_static_actual_dsp_freq) + + def get_variable_any_code_waterfall_ave(self): + return self.variable_any_code_waterfall_ave + + def set_variable_any_code_waterfall_ave(self, variable_any_code_waterfall_ave): + self.variable_any_code_waterfall_ave = variable_any_code_waterfall_ave + + def get_variable_any_code_iq_correction(self): + return self.variable_any_code_iq_correction + + def set_variable_any_code_iq_correction(self, variable_any_code_iq_correction): + self.variable_any_code_iq_correction = variable_any_code_iq_correction + + def get_variable_any_code_fft_sink_peak_hold(self): + return self.variable_any_code_fft_sink_peak_hold + + def set_variable_any_code_fft_sink_peak_hold(self, variable_any_code_fft_sink_peak_hold): + self.variable_any_code_fft_sink_peak_hold = variable_any_code_fft_sink_peak_hold + + def get_variable_any_code_fft_sink_ave(self): + return self.variable_any_code_fft_sink_ave + + def set_variable_any_code_fft_sink_ave(self, variable_any_code_fft_sink_ave): + self.variable_any_code_fft_sink_ave = variable_any_code_fft_sink_ave + + def get_variable_any_code_auto_dc_offset_removal(self): + return self.variable_any_code_auto_dc_offset_removal + + def set_variable_any_code_auto_dc_offset_removal(self, variable_any_code_auto_dc_offset_removal): + self.variable_any_code_auto_dc_offset_removal = variable_any_code_auto_dc_offset_removal + + def get_update_time_source(self): + return self.update_time_source + + def set_update_time_source(self, update_time_source): + self.update_time_source = update_time_source + + def get_update_clock_source(self): + return self.update_clock_source + + def set_update_clock_source(self, update_clock_source): + self.update_clock_source = update_clock_source + + def get_tune_obj(self): + return self.tune_obj + + def set_tune_obj(self, tune_obj): + self.tune_obj = tune_obj + self._run_evaluators_later(('actual_center_freq', lambda: self._evalutate_actual_center_freq(**{'tune_obj': self.tune_obj}))) + self._run_evaluators_later(('tune_result', lambda: self._evalutate_tune_result(**{'tune_obj': self.tune_obj}))) + + def get_static_locked(self): + return self.static_locked + + def set_static_locked(self, static_locked): + self.static_locked = static_locked + self._static_locked_static_text.set_value(self.static_locked) + + def get_show_stream_tags_chk(self): + return self.show_stream_tags_chk + + def set_show_stream_tags_chk(self, show_stream_tags_chk): + self.show_stream_tags_chk = show_stream_tags_chk + self._show_stream_tags_chk_check_box.set_value(self.show_stream_tags_chk) + self.blocks_tag_debug_0.set_display(self.show_stream_tags_chk) + + def get_show_max_lvl(self): + return self.show_max_lvl + + def set_show_max_lvl(self, show_max_lvl): + self.show_max_lvl = show_max_lvl + self._show_max_lvl_check_box.set_value(self.show_max_lvl) + + def get_show_max_freq(self): + return self.show_max_freq + + def set_show_max_freq(self, show_max_freq): + self.show_max_freq = show_max_freq + self._show_max_freq_check_box.set_value(self.show_max_freq) + + def get_selected_gain_proxy(self): + return self.selected_gain_proxy + + def set_selected_gain_proxy(self, selected_gain_proxy): + self.selected_gain_proxy = selected_gain_proxy + self.src.set_gain(self.selected_gain_proxy, 0) + + def get_selected_antenna_proxy(self): + return self.selected_antenna_proxy + + def set_selected_antenna_proxy(self, selected_antenna_proxy): + self.selected_antenna_proxy = selected_antenna_proxy + self.src.set_antenna(self.selected_antenna_proxy, 0) + + def get_scope_mode(self): + return self.scope_mode + + def set_scope_mode(self, scope_mode): + self.scope_mode = scope_mode + self._scope_mode_chooser.set_value(self.scope_mode) + self.blks2_selector_0.set_input_index(int(self.scope_mode)) + self.blks2_selector_0_0.set_output_index(int(self.scope_mode)) + + def get_requested_sample_rate(self): + return self.requested_sample_rate + + def set_requested_sample_rate(self, requested_sample_rate): + self.requested_sample_rate = requested_sample_rate + self._run_evaluators_later(('actual_sample_rate', lambda: self._evalutate_actual_sample_rate(**{'requested_sample_rate': self.requested_sample_rate}))) + self.src.set_samp_rate(self.requested_sample_rate) + + def get_motherboard_sensor_names(self): + return self.motherboard_sensor_names + + def set_motherboard_sensor_names(self, motherboard_sensor_names): + self.motherboard_sensor_names = motherboard_sensor_names + self._run_evaluators_later(('motherboard_sensors', lambda: self._evalutate_motherboard_sensors(**{'motherboard_sensor_names': self.motherboard_sensor_names}))) + + def get_max_decim(self): + return self.max_decim + + def set_max_decim(self, max_decim): + self.max_decim = max_decim + + def get_initial_gain(self): + return self.initial_gain + + def set_initial_gain(self, initial_gain): + self.initial_gain = initial_gain + self._run_evaluators_later(('gain_default', lambda: self._evalutate_gain_default(**{'initial_gain': self.initial_gain}))) + + def get_has_lo_locked(self): + return self.has_lo_locked + + def set_has_lo_locked(self, has_lo_locked): + self.has_lo_locked = has_lo_locked + self.set_locked_probe_poll_rate(self.lo_check_interval * float(self.has_lo_locked)) + + def get_freq_range(self): + return self.freq_range + + def set_freq_range(self, freq_range): + self.freq_range = freq_range + + def get_fix_invalid_freq(self): + return self.fix_invalid_freq + + def set_fix_invalid_freq(self, fix_invalid_freq): + self.fix_invalid_freq = fix_invalid_freq + + def get_fft_max_lvl_value(self): + return self.fft_max_lvl_value + + def set_fft_max_lvl_value(self, fft_max_lvl_value): + self.fft_max_lvl_value = fft_max_lvl_value + + def get_fft_ave_probe(self): + return self.fft_ave_probe + + def set_fft_ave_probe(self, fft_ave_probe): + self.fft_ave_probe = fft_ave_probe + self.logpwrfft_x_0.set_avg_alpha(self.fft_ave_probe) + + def get_daughterboard_sensor_names(self): + return self.daughterboard_sensor_names + + def set_daughterboard_sensor_names(self, daughterboard_sensor_names): + self.daughterboard_sensor_names = daughterboard_sensor_names + self._run_evaluators_later(('daughterboard_sensors', lambda: self._evalutate_daughterboard_sensors(**{'daughterboard_sensor_names': self.daughterboard_sensor_names}))) + + def get_clicked_freq_txt(self): + return self.clicked_freq_txt + + def set_clicked_freq_txt(self, clicked_freq_txt): + self.clicked_freq_txt = clicked_freq_txt + self._clicked_freq_txt_text_box.set_value(self.clicked_freq_txt) + + def get_auto_iq_correction(self): + return self.auto_iq_correction + + def set_auto_iq_correction(self, auto_iq_correction): + self.auto_iq_correction = auto_iq_correction + self._auto_iq_correction_check_box.set_value(self.auto_iq_correction) + self._run_evaluators_later(('variable_any_code_iq_correction', lambda: self._evalutate_variable_any_code_iq_correction(**{'auto_iq_correction': self.auto_iq_correction}))) + + def get_auto_dc_offset_removal(self): + return self.auto_dc_offset_removal + + def set_auto_dc_offset_removal(self, auto_dc_offset_removal): + self.auto_dc_offset_removal = auto_dc_offset_removal + self._auto_dc_offset_removal_check_box.set_value(self.auto_dc_offset_removal) + self._run_evaluators_later(('variable_any_code_auto_dc_offset_removal', lambda: self._evalutate_variable_any_code_auto_dc_offset_removal(**{'auto_dc_offset_removal': self.auto_dc_offset_removal}))) + + def get_any_test_1(self): + return self.any_test_1 + + def set_any_test_1(self, any_test_1): + self.any_test_1 = any_test_1 + + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + parser.add_option("-A", "--antenna", dest="antenna", type="string", default="", + help="Set Antenna (blank for default) [default=%default]") + parser.add_option("-a", "--args", dest="args", type="string", default="", + help="Set UHD device args [default=%default]") + parser.add_option("", "--ave", dest="ave", type="eng_float", default=eng_notation.num_to_str(1*0 + 0.5), + help="Set Average FFT [default=%default]") + parser.add_option("", "--averaging", dest="averaging", type="string", default="True", + help="Set Enable FFT averaging [default=%default]") + parser.add_option("", "--bw", dest="bw", type="eng_float", default=eng_notation.num_to_str(0), + help="Set Daughterboard bandwidth (where appropriate) [default=%default]") + parser.add_option("", "--dyn-rng", dest="dyn_rng", type="eng_float", default=eng_notation.num_to_str(130), + help="Set Dynamic Range [default=%default]") + parser.add_option("", "--fft-rate", dest="fft_rate", type="intx", default=15, + help="Set FFT Rate [default=%default]") + parser.add_option("", "--fft-ref-scale", dest="fft_ref_scale", type="eng_float", default=eng_notation.num_to_str(2.0), + help="Set FFT Ref Scale (p2p) [default=%default]") + parser.add_option("", "--fft-size", dest="fft_size", type="intx", default=1024, + help="Set FFT Size [default=%default]") + parser.add_option("-f", "--freq", dest="freq", type="eng_float", default=eng_notation.num_to_str(0 + 100e6), + help="Set Frequency [default=%default]") + parser.add_option("", "--freq-fine-range", dest="freq_fine_range", type="eng_float", default=eng_notation.num_to_str(2e6), + help="Set Fine frequency slider range [default=%default]") + parser.add_option("-g", "--gain", dest="gain", type="eng_float", default=eng_notation.num_to_str(float("-inf")), + help="Set Gain (default '-inf' selects relative gain of 25%) [default=%default]") + parser.add_option("", "--lo-check-interval", dest="lo_check_interval", type="eng_float", default=eng_notation.num_to_str(5), + help="Set LO lock check frequency (Hz) [default=%default]") + parser.add_option("", "--lo-offset", dest="lo_offset", type="eng_float", default=eng_notation.num_to_str(0), + help="Set LO offset (selects LO offset tuning mode) [default=%default]") + parser.add_option("", "--mag-alpha", dest="mag_alpha", type="eng_float", default=eng_notation.num_to_str(1e-3), + help="Set Signal magnitude probe alpha [default=%default]") + parser.add_option("", "--peak-hold", dest="peak_hold", type="string", default="False", + help="Set FFT peak hold [default=%default]") + parser.add_option("", "--pps", dest="pps", type="string", default='', + help="Set Time source (none, internal, external, mimo, gpsdo). leaves it at the default. [default=%default]") + parser.add_option("", "--probe-interval", dest="probe_interval", type="eng_float", default=eng_notation.num_to_str(3), + help="Set Signal probe frequency (Hz) [default=%default]") + parser.add_option("-s", "--rate", dest="rate", type="eng_float", default=eng_notation.num_to_str(1e6), + help="Set Sample Rate [default=%default]") + parser.add_option("", "--ref", dest="ref", type="string", default='', + help="Set Clock source (internal, external, mimo, gpsdo). leaves it at the default. [default=%default]") + parser.add_option("", "--ref-lvl", dest="ref_lvl", type="eng_float", default=eng_notation.num_to_str(0), + help="Set Reference Level [default=%default]") + parser.add_option("", "--sensor-interval", dest="sensor_interval", type="eng_float", default=eng_notation.num_to_str(2), + help="Set Sensor update frequency (Hz) [default=%default]") + parser.add_option("", "--show-stream-tags", dest="show_stream_tags", type="string", default="False", + help="Set Print stream tags [default=%default]") + parser.add_option("", "--spec", dest="spec", type="string", default='', + help="Set Sub-device specification (where appropriate) [default=%default]") + parser.add_option("", "--stream-args", dest="stream_args", type="string", default="", + help="Set Stream arguments (e.g. scalar=1024) [default=%default]") + parser.add_option("", "--window", dest="window", type="string", default="auto", + help="Set Window (bh: Blackman-Harris, ham: Hamming, han: Hanning, rect: Rectangular, flat: Flattop) [default=%default]") + parser.add_option("", "--wire-format", dest="wire_format", type="string", default="", + help="Set Wire format (e.g. sc16, sc8) [blank = automatic] [default=%default]") + (options, args) = parser.parse_args() + if gr.enable_realtime_scheduling() != gr.RT_OK: + print "Error: failed to enable realtime scheduling." + tb = mega_fft(antenna=options.antenna, args=options.args, ave=options.ave, averaging=options.averaging, bw=options.bw, dyn_rng=options.dyn_rng, fft_rate=options.fft_rate, fft_ref_scale=options.fft_ref_scale, fft_size=options.fft_size, freq=options.freq, freq_fine_range=options.freq_fine_range, gain=options.gain, lo_check_interval=options.lo_check_interval, lo_offset=options.lo_offset, mag_alpha=options.mag_alpha, peak_hold=options.peak_hold, pps=options.pps, probe_interval=options.probe_interval, rate=options.rate, ref=options.ref, ref_lvl=options.ref_lvl, sensor_interval=options.sensor_interval, show_stream_tags=options.show_stream_tags, spec=options.spec, stream_args=options.stream_args, window=options.window, wire_format=options.wire_format) + tb.Start(True) + tb.Wait() diff --git a/tools/mega_fft/mega_fft_2ch.py b/tools/mega_fft/mega_fft_2ch.py new file mode 100755 index 000000000..c8a74bc26 --- /dev/null +++ b/tools/mega_fft/mega_fft_2ch.py @@ -0,0 +1,2818 @@ +#!/usr/bin/env python2 +################################################## +# GNU Radio Python Flow Graph +# Title: Mega FFT +# Author: Balint Seeber, Ettus Research +# Description: Standard edition, dual-channel +# Generated: Sun Jul 26 20:09:53 2015 +################################################## + +if __name__ == '__main__': + import ctypes + import sys + if sys.platform.startswith('linux'): + try: + x11 = ctypes.cdll.LoadLibrary('libX11.so') + x11.XInitThreads() + except: + print "Warning: failed to XInitThreads()" + +from gnuradio import analog +from gnuradio import blocks +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio import uhd +from gnuradio import wxgui +from gnuradio.eng_option import eng_option +from gnuradio.fft import logpwrfft +from gnuradio.fft import window +from gnuradio.fft import window as fft_win +from gnuradio.filter import firdes +from gnuradio.wxgui import fftsink2 +from gnuradio.wxgui import forms +from gnuradio.wxgui import scopesink2 +from gnuradio.wxgui import waterfallsink2 +from grc_gnuradio import blks2 as grc_blks2 +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import math +import threading +import time +import time, datetime +import wx + +class mega_fft_2ch(grc_wxgui.top_block_gui): + + def __init__(self, antenna="", args="", ave=1*0 + 0.5, averaging="True", bw=0, dyn_rng=130, fft_rate=15, fft_ref_scale=2.0, fft_size=1024, freq=0 + 100e6, freq_fine_range=2e6, gain=float("-inf"), lo_check_interval=5, lo_offset=0, mag_alpha=1e-3, peak_hold="False", pps='', probe_interval=3, rate=1e6, ref='', ref_lvl=0, sensor_interval=2, show_stream_tags="False", spec='', stream_args="", window="auto", wire_format=""): + grc_wxgui.top_block_gui.__init__(self, title="Mega FFT") + + ################################################## + # Parameters + ################################################## + self.antenna = antenna + self.args = args + self.ave = ave + self.averaging = averaging + self.bw = bw + self.dyn_rng = dyn_rng + self.fft_rate = fft_rate + self.fft_ref_scale = fft_ref_scale + self.fft_size = fft_size + self.freq = freq + self.freq_fine_range = freq_fine_range + self.gain = gain + self.lo_check_interval = lo_check_interval + self.lo_offset = lo_offset + self.mag_alpha = mag_alpha + self.peak_hold = peak_hold + self.pps = pps + self.probe_interval = probe_interval + self.rate = rate + self.ref = ref + self.ref_lvl = ref_lvl + self.sensor_interval = sensor_interval + self.show_stream_tags = show_stream_tags + self.spec = spec + self.stream_args = stream_args + self.window = window + self.wire_format = wire_format + + ################################################## + # Variables + ################################################## + self.relative_freq = relative_freq = 1 + self.gain_range = gain_range = uhd.gain_range(0,0,0) + self.fft_max_idx = fft_max_idx = (fft_size/2)*0 + self.actual_sample_rate = actual_sample_rate = rate + self.actual_center_freq = actual_center_freq = 0 + self.str_to_bool = str_to_bool = lambda x: len(x)>0 and x.lower()[0] not in ['0', 'n', 'f'] + self.signal_probe = signal_probe = 0.0 + self.samp_rate = samp_rate = int(actual_sample_rate) + self.requested_freq_txt = requested_freq_txt = freq + self.gain_default = gain_default = gain_range.start() + self.freq_fine = freq_fine = 0 + self.fft_max_idx_norm = fft_max_idx_norm = [fft_max_idx,fft_max_idx-fft_size][int(fft_max_idx>(fft_size/2))] + self.fft_center_freq = fft_center_freq = actual_center_freq * relative_freq + self.antennas = antennas = [''] + self.window_fn_name_map = window_fn_name_map = {'auto': 'Auto', 'bh': 'Blackman-Harris', 'ham': 'Hamming', 'han': 'Hanning', 'rect': 'Rectangular', 'flat': 'Flattop'} + self.window_fn_map = window_fn_map = {'auto': None, 'bh': fft_win.blackmanharris, 'ham': fft_win.hamming, 'han': fft_win.hanning, 'rect': fft_win.rectangular, 'flat': fft_win.flattop} + self.usrp_info = usrp_info = '(unknown)' + self.tune_result = tune_result = uhd.tune_result_t() + self.tune_mode = tune_mode = [1,0][lo_offset==0.0] + self.time_probe = time_probe = uhd.time_spec_t() + self.test = test = 1 + self.subdev_spec = subdev_spec = '(unknown)' + self.signal_probe_log = signal_probe_log = math.log10([signal_probe,1.0][signal_probe==0.0])*10 + self.selected_gain = selected_gain = gain_default + self.selected_antenna = selected_antenna = [ [antenna,antennas[0]][antenna not in antennas] ,antennas[0]][antenna==''] + self.requested_sample_rate_base = requested_sample_rate_base = rate + self.requested_freq = requested_freq = requested_freq_txt + freq_fine + self.relative_time = relative_time = True + self.motherboard_sensors = motherboard_sensors = '(none)' + self.max_bin_freq = max_bin_freq = fft_center_freq + (((1.0*fft_max_idx_norm) / fft_size) * samp_rate) + self.locked_probe = locked_probe = '(unknown)' + self.lo_offset_txt = lo_offset_txt = lo_offset + self.fft_peak_hold = fft_peak_hold = str_to_bool(peak_hold) + self.fft_max_lvl_2 = fft_max_lvl_2 = 0.0 + self.fft_max_lvl = fft_max_lvl = 0.0 + self.fft_averaging = fft_averaging = str_to_bool(averaging) + self.decim = decim = 1 + self.daughterboard_sensors = daughterboard_sensors = '(none)' + self.clicked_freq = clicked_freq = 0 + self.window_fn = window_fn = window_fn_map[window] + self.variable_static_usrp_info = variable_static_usrp_info = usrp_info + self.variable_static_time_now = variable_static_time_now = str( [time.ctime(time_probe.get_real_secs()), datetime.timedelta(seconds=time_probe.get_real_secs()), time.gmtime(time_probe.get_real_secs())] [relative_time]) + self.variable_static_text_0_0 = variable_static_text_0_0 = daughterboard_sensors + self.variable_static_text_0 = variable_static_text_0 = motherboard_sensors + self.variable_static_subdev_spec = variable_static_subdev_spec = subdev_spec + self.variable_static_rf_freq = variable_static_rf_freq = tune_result.actual_rf_freq + self.variable_static_requested_freq = variable_static_requested_freq = requested_freq + self.variable_static_max_bin_freq = variable_static_max_bin_freq = max_bin_freq + self.variable_static_level_probe = variable_static_level_probe = signal_probe_log + self.variable_static_fft_window_name = variable_static_fft_window_name = window_fn_name_map[window] + self.variable_static_fft_max_lvl_log = variable_static_fft_max_lvl_log = fft_max_lvl + self.variable_static_actual_sample_rate = variable_static_actual_sample_rate = actual_sample_rate + self.variable_static_actual_dsp_freq = variable_static_actual_dsp_freq = tune_result.actual_dsp_freq + self.variable_any_code_waterfall_ave = variable_any_code_waterfall_ave = fft_averaging + self.variable_any_code_iq_correction = variable_any_code_iq_correction = None + self.variable_any_code_fft_sink_peak_hold = variable_any_code_fft_sink_peak_hold = fft_peak_hold + self.variable_any_code_fft_sink_ave = variable_any_code_fft_sink_ave = fft_averaging + self.variable_any_code_auto_dc_offset_removal = variable_any_code_auto_dc_offset_removal = None + self.update_time_source = update_time_source = None + self.update_clock_source = update_clock_source = None + self.tune_obj = tune_obj = [requested_freq, uhd.tune_request(requested_freq, lo_offset_txt), uhd.tune_request(requested_freq, dsp_freq=0, dsp_freq_policy=uhd.tune_request.POLICY_MANUAL)][tune_mode] + self.static_locked = static_locked = '"' + str(locked_probe) + '"' + self.show_stream_tags_chk = show_stream_tags_chk = [False, True][show_stream_tags.lower() != 'false'] + self.show_max_lvl = show_max_lvl = True + self.show_max_freq = show_max_freq = True + self.selected_gain_proxy = selected_gain_proxy = selected_gain + self.selected_antenna_proxy = selected_antenna_proxy = selected_antenna + self.scope_mode_2 = scope_mode_2 = 0+1 + self.scope_mode = scope_mode = 0+1 + self.requested_sample_rate = requested_sample_rate = requested_sample_rate_base / (1.*decim) + self.motherboard_sensor_names = motherboard_sensor_names = [] + self.max_decim = max_decim = 256 + self.initial_gain = initial_gain = 0 + self.has_lo_locked = has_lo_locked = False + self.freq_range = freq_range = uhd.freq_range(freq,freq+1) + self.fix_invalid_freq = fix_invalid_freq = None + self.fft_max_lvl_value_2 = fft_max_lvl_value_2 = fft_max_lvl_2 + self.fft_max_lvl_value = fft_max_lvl_value = fft_max_lvl + self.fft_ave_probe = fft_ave_probe = ave + self.daughterboard_sensor_names = daughterboard_sensor_names = [] + self.clicked_freq_txt = clicked_freq_txt = clicked_freq + self.auto_iq_correction = auto_iq_correction = True + self.auto_dc_offset_removal = auto_dc_offset_removal = True + self.any_test_1 = any_test_1 = test + + ################################################## + # Blocks + ################################################## + self.src = uhd.usrp_source( + ",".join((args, "")), + uhd.stream_args( + cpu_format="fc32", + channels=range(2), + ), + + ) + if spec != "": self.src.set_subdev_spec(spec, 0) + self.src.set_samp_rate(requested_sample_rate) + self.src.set_center_freq(uhd.tune_request(freq, lo_offset), 0) + self.src.set_gain(selected_gain_proxy, 0) + self.src.set_center_freq(uhd.tune_request(freq, lo_offset), 1) + self.src.set_gain(selected_gain_proxy, 1) + self.nb_right = self.nb_right = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.nb_right.AddPage(grc_wxgui.Panel(self.nb_right), "Params") + self.GridAdd(self.nb_right, 0, 1, 1, 1) + self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.nb.AddPage(grc_wxgui.Panel(self.nb), "FFT") + self.nb.AddPage(grc_wxgui.Panel(self.nb), "Scope") + self.nb.AddPage(grc_wxgui.Panel(self.nb), "Waterfall") + self.nb.AddPage(grc_wxgui.Panel(self.nb), "Sensors") + self.GridAdd(self.nb, 0, 0, 1, 1) + self.nb_test = self.nb_test = wx.Notebook(self.nb_right.GetPage(0).GetWin(), style=wx.NB_LEFT) + self.nb_test.AddPage(grc_wxgui.Panel(self.nb_test), "Test") + self.nb_right.GetPage(0).Add(self.nb_test) + self.nb_analog = self.nb_analog = wx.Notebook(self.nb_right.GetPage(0).GetWin(), style=wx.NB_LEFT) + self.nb_analog.AddPage(grc_wxgui.Panel(self.nb_analog), "Analog") + self.nb_analog.AddPage(grc_wxgui.Panel(self.nb_analog), "DC") + self.nb_right.GetPage(0).Add(self.nb_analog) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_gain_range(): + self._post_any_code_evaluators += [('gain_range', lambda: self._evalutate_gain_range(**{}))] + def __evalutate_gain_range(*args, **kwds): + try: + self.gain_range = self.src.get_gain_range() + self.set_gain_range(self.gain_range) + except AttributeError, e: + print "AttributeError while evaulating gain_range:", e + __post_evalutate_gain_range() + except Exception, e: + print "Exception while evaluating gain_range:", e + self._evalutate_gain_range = __evalutate_gain_range + self.__post_evalutate_gain_range = __post_evalutate_gain_range + self._evalutate_gain_range(**{}) + gain_range = self.gain_range + self.fft_sink = fftsink2.fft_sink_c( + self.nb.GetPage(0).GetWin(), + baseband_freq=fft_center_freq, + y_per_div=10, + y_divs=int(dyn_rng/10), + ref_level=ref_lvl, + ref_scale=fft_ref_scale, + sample_rate=samp_rate, + fft_size=1024*0 + fft_size, + fft_rate=fft_rate, + average=True, + avg_alpha=ave, + title="FFT Plot", + peak_hold=False, fft_in=False, + always_run=False, + fft_out=False, + ) + self.nb.GetPage(0).Add(self.fft_sink.win) + def fft_sink_callback(x, y): + self.set_clicked_freq(x) + + self.fft_sink.set_callback(fft_sink_callback) + self.waterfall_sink = waterfallsink2.waterfall_sink_c( + self.nb.GetPage(2).GetWin(), + baseband_freq=fft_center_freq, + dynamic_range=dyn_rng, + ref_level=ref_lvl, + ref_scale=fft_ref_scale, + sample_rate=samp_rate, + fft_size=512*0 + fft_size, + fft_rate=fft_rate, + average=True, + avg_alpha=ave, + title="Waterfall Plot", + fft_in=False, + always_run=False, + fft_out=False, + ) + self.nb.GetPage(2).Add(self.waterfall_sink.win) + def waterfall_sink_callback(x, y): + self.set_clicked_freq(x) + + self.waterfall_sink.set_callback(waterfall_sink_callback) + self._test_chooser = forms.button( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.test, + callback=self.set_test, + label="Test", + choices=[1], + labels=['Reset FFT average'], + ) + self.nb_test.GetPage(0).Add(self._test_chooser) + self._show_stream_tags_chk_check_box = forms.check_box( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.show_stream_tags_chk, + callback=self.set_show_stream_tags_chk, + label="Print stream tags", + true=True, + false=False, + ) + self.nb_test.GetPage(0).GridAdd(self._show_stream_tags_chk_check_box, 0, 0, 1, 1) + self._scope_mode_2_chooser = forms.radio_buttons( + parent=self.nb.GetPage(1).GetWin(), + value=self.scope_mode_2, + callback=self.set_scope_mode_2, + label="Scope Mode 2", + choices=[0, 1], + labels=['Complex', 'Magnitude'], + style=wx.RA_HORIZONTAL, + ) + self.nb.GetPage(1).Add(self._scope_mode_2_chooser) + self._scope_mode_chooser = forms.radio_buttons( + parent=self.nb.GetPage(1).GetWin(), + value=self.scope_mode, + callback=self.set_scope_mode, + label="Scope Mode", + choices=[0, 1], + labels=['Complex', 'Magnitude'], + style=wx.RA_HORIZONTAL, + ) + self.nb.GetPage(1).Add(self._scope_mode_chooser) + self.probe_avg_mag = analog.probe_avg_mag_sqrd_c(0, mag_alpha) + self.nb_rate = self.nb_rate = wx.Notebook(self.nb_right.GetPage(0).GetWin(), style=wx.NB_LEFT) + self.nb_rate.AddPage(grc_wxgui.Panel(self.nb_rate), "Rate") + self.nb_right.GetPage(0).Add(self.nb_rate) + self.nb_info = self.nb_info = wx.Notebook(self.nb_right.GetPage(0).GetWin(), style=wx.NB_LEFT) + self.nb_info.AddPage(grc_wxgui.Panel(self.nb_info), "Info") + self.nb_right.GetPage(0).GridAdd(self.nb_info, 0, 0, 1, 1) + self.nb_freq = self.nb_freq = wx.Notebook(self.nb_right.GetPage(0).GetWin(), style=wx.NB_LEFT) + self.nb_freq.AddPage(grc_wxgui.Panel(self.nb_freq), "Freq") + self.nb_right.GetPage(0).Add(self.nb_freq) + if sensor_interval > 0: + self._motherboard_sensor_names_poll_rate = sensor_interval + else: + self._motherboard_sensor_names_poll_rate = 1 + self._motherboard_sensor_names_enabled = sensor_interval > 0 + def _set_motherboard_sensor_names_poll_rate(rate): + self._motherboard_sensor_names_enabled = rate > 0 + if rate > 0: + self._motherboard_sensor_names_poll_rate = rate + self.set_motherboard_sensor_names_poll_rate = _set_motherboard_sensor_names_poll_rate + def _motherboard_sensor_names_probe(): + while True: + if self._motherboard_sensor_names_enabled: + val = self.src.get_mboard_sensor_names() + try: + self.set_motherboard_sensor_names(val) + except AttributeError: + pass + time.sleep(1.0/(self._motherboard_sensor_names_poll_rate)) + _motherboard_sensor_names_thread = threading.Thread(target=_motherboard_sensor_names_probe) + _motherboard_sensor_names_thread.daemon = True + _motherboard_sensor_names_thread.start() + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_initial_gain(): + self._post_any_code_evaluators += [('initial_gain', lambda: self._evalutate_initial_gain(**{'gain_range': gain_range}))] + def __evalutate_initial_gain(*args, **kwds): + try: + self.initial_gain = [gain,gain_range.start() + ((gain_range.stop() - gain_range.start()) * 0.25)][gain==float('-inf')] + self.set_initial_gain(self.initial_gain) + except AttributeError, e: + print "AttributeError while evaulating initial_gain:", e + __post_evalutate_initial_gain() + except Exception, e: + print "Exception while evaluating initial_gain:", e + self._evalutate_initial_gain = __evalutate_initial_gain + self.__post_evalutate_initial_gain = __post_evalutate_initial_gain + self._evalutate_initial_gain(**{'gain_range': gain_range}) + initial_gain = self.initial_gain + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_has_lo_locked(): + self._post_any_code_evaluators += [('has_lo_locked', lambda: self._evalutate_has_lo_locked(**{}))] + def __evalutate_has_lo_locked(*args, **kwds): + try: + self.has_lo_locked = 'lo_locked' in self.src.get_sensor_names() + self.set_has_lo_locked(self.has_lo_locked) + except AttributeError, e: + print "AttributeError while evaulating has_lo_locked:", e + __post_evalutate_has_lo_locked() + except Exception, e: + print "Exception while evaluating has_lo_locked:", e + self._evalutate_has_lo_locked = __evalutate_has_lo_locked + self.__post_evalutate_has_lo_locked = __post_evalutate_has_lo_locked + self._evalutate_has_lo_locked(**{}) + has_lo_locked = self.has_lo_locked + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_freq_range(): + self._post_any_code_evaluators += [('freq_range', lambda: self._evalutate_freq_range(**{}))] + def __evalutate_freq_range(*args, **kwds): + try: + self.freq_range = self.src.get_freq_range() + self.set_freq_range(self.freq_range) + except AttributeError, e: + print "AttributeError while evaulating freq_range:", e + __post_evalutate_freq_range() + except Exception, e: + print "Exception while evaluating freq_range:", e + self._evalutate_freq_range = __evalutate_freq_range + self.__post_evalutate_freq_range = __post_evalutate_freq_range + self._evalutate_freq_range(**{}) + freq_range = self.freq_range + self.fft_max_lvl_probe_2 = blocks.probe_signal_f() + if 5 > 0: + self._fft_ave_probe_poll_rate = 5 + else: + self._fft_ave_probe_poll_rate = 1 + self._fft_ave_probe_enabled = 5 > 0 + def _set_fft_ave_probe_poll_rate(rate): + self._fft_ave_probe_enabled = rate > 0 + if rate > 0: + self._fft_ave_probe_poll_rate = rate + self.set_fft_ave_probe_poll_rate = _set_fft_ave_probe_poll_rate + def _fft_ave_probe_probe(): + while True: + if self._fft_ave_probe_enabled: + val = self.fft_sink.win['avg_alpha'] * [1.0/self.fft_sink.win['avg_alpha'],1.0][self.fft_sink.win['average']];() + try: + self.set_fft_ave_probe(val) + except AttributeError: + pass + time.sleep(1.0/(self._fft_ave_probe_poll_rate)) + _fft_ave_probe_thread = threading.Thread(target=_fft_ave_probe_probe) + _fft_ave_probe_thread.daemon = True + _fft_ave_probe_thread.start() + if sensor_interval > 0: + self._daughterboard_sensor_names_poll_rate = sensor_interval + else: + self._daughterboard_sensor_names_poll_rate = 1 + self._daughterboard_sensor_names_enabled = sensor_interval > 0 + def _set_daughterboard_sensor_names_poll_rate(rate): + self._daughterboard_sensor_names_enabled = rate > 0 + if rate > 0: + self._daughterboard_sensor_names_poll_rate = rate + self.set_daughterboard_sensor_names_poll_rate = _set_daughterboard_sensor_names_poll_rate + def _daughterboard_sensor_names_probe(): + while True: + if self._daughterboard_sensor_names_enabled: + val = self.src.get_sensor_names() + try: + self.set_daughterboard_sensor_names(val) + except AttributeError: + pass + time.sleep(1.0/(self._daughterboard_sensor_names_poll_rate)) + _daughterboard_sensor_names_thread = threading.Thread(target=_daughterboard_sensor_names_probe) + _daughterboard_sensor_names_thread.daemon = True + _daughterboard_sensor_names_thread.start() + self._auto_iq_correction_check_box = forms.check_box( + parent=self.nb_analog.GetPage(1).GetWin(), + value=self.auto_iq_correction, + callback=self.set_auto_iq_correction, + label="Auto IQ correction", + true=True, + false=False, + ) + self.nb_analog.GetPage(1).Add(self._auto_iq_correction_check_box) + self._auto_dc_offset_removal_check_box = forms.check_box( + parent=self.nb_analog.GetPage(1).GetWin(), + value=self.auto_dc_offset_removal, + callback=self.set_auto_dc_offset_removal, + label="Auto DC offset removal", + true=True, + false=False, + ) + self.nb_analog.GetPage(1).Add(self._auto_dc_offset_removal_check_box) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_antennas(): + self._post_any_code_evaluators += [('antennas', lambda: self._evalutate_antennas(**{}))] + def __evalutate_antennas(*args, **kwds): + try: + self.antennas = self.src.get_antennas() + self.set_antennas(self.antennas) + except AttributeError, e: + print "AttributeError while evaulating antennas:", e + __post_evalutate_antennas() + except Exception, e: + print "Exception while evaluating antennas:", e + self._evalutate_antennas = __evalutate_antennas + self.__post_evalutate_antennas = __post_evalutate_antennas + self._evalutate_antennas(**{}) + antennas = self.antennas + self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c( + self.nb.GetPage(1).GetWin(), + title="Scope Plot 2", + sample_rate=samp_rate, + v_scale=0, + v_offset=0, + t_scale=0, + ac_couple=False, + xy_mode=False, + num_inputs=1, + trig_mode=wxgui.TRIG_MODE_AUTO, + y_axis_label="Counts", + ) + self.nb.GetPage(1).Add(self.wxgui_scopesink2_0_0.win) + self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( + self.nb.GetPage(1).GetWin(), + title="Scope Plot", + sample_rate=samp_rate, + v_scale=0, + v_offset=0, + t_scale=0, + ac_couple=False, + xy_mode=False, + num_inputs=1, + trig_mode=wxgui.TRIG_MODE_AUTO, + y_axis_label="Counts", + ) + self.nb.GetPage(1).Add(self.wxgui_scopesink2_0.win) + self.waterfall_sink_0 = waterfallsink2.waterfall_sink_c( + self.nb.GetPage(2).GetWin(), + baseband_freq=fft_center_freq, + dynamic_range=dyn_rng, + ref_level=ref_lvl, + ref_scale=fft_ref_scale, + sample_rate=samp_rate, + fft_size=512*0 + fft_size, + fft_rate=fft_rate, + average=True, + avg_alpha=ave, + title="Waterfall Plot 2", + fft_in=False, + always_run=False, + fft_out=False, + ) + self.nb.GetPage(2).Add(self.waterfall_sink_0.win) + def waterfall_sink_0_callback(x, y): + self.set_clicked_freq(x) + + self.waterfall_sink_0.set_callback(waterfall_sink_0_callback) + self._variable_static_usrp_info_static_text = forms.static_text( + parent=self.nb_info.GetPage(0).GetWin(), + value=self.variable_static_usrp_info, + callback=self.set_variable_static_usrp_info, + label="USRP", + converter=forms.str_converter(), + ) + self.nb_info.GetPage(0).GridAdd(self._variable_static_usrp_info_static_text, 0, 0, 1, 10) + self._variable_static_time_now_static_text = forms.static_text( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.variable_static_time_now, + callback=self.set_variable_static_time_now, + label="Time now", + converter=forms.str_converter(), + ) + self.nb_test.GetPage(0).GridAdd(self._variable_static_time_now_static_text, 1, 1, 1, 2) + self._variable_static_text_0_0_static_text = forms.static_text( + parent=self.nb.GetPage(3).GetWin(), + value=self.variable_static_text_0_0, + callback=self.set_variable_static_text_0_0, + label="Daughterboard", + converter=forms.str_converter(), + ) + self.nb.GetPage(3).GridAdd(self._variable_static_text_0_0_static_text, 2, 0, 1, 1) + self._variable_static_text_0_static_text = forms.static_text( + parent=self.nb.GetPage(3).GetWin(), + value=self.variable_static_text_0, + callback=self.set_variable_static_text_0, + label="Motherboard", + converter=forms.str_converter(), + ) + self.nb.GetPage(3).GridAdd(self._variable_static_text_0_static_text, 0, 0, 1, 1) + self._variable_static_subdev_spec_static_text = forms.static_text( + parent=self.nb_info.GetPage(0).GetWin(), + value=self.variable_static_subdev_spec, + callback=self.set_variable_static_subdev_spec, + label="Sub-device", + converter=forms.str_converter(), + ) + self.nb_info.GetPage(0).GridAdd(self._variable_static_subdev_spec_static_text, 1, 0, 1, 1) + self._variable_static_rf_freq_static_text = forms.static_text( + parent=self.nb_freq.GetPage(0).GetWin(), + value=self.variable_static_rf_freq, + callback=self.set_variable_static_rf_freq, + label="Actual RF freq", + converter=forms.float_converter(), + ) + self.nb_freq.GetPage(0).GridAdd(self._variable_static_rf_freq_static_text, 5, 0, 1, 1) + self._variable_static_requested_freq_static_text = forms.static_text( + parent=self.nb_freq.GetPage(0).GetWin(), + value=self.variable_static_requested_freq, + callback=self.set_variable_static_requested_freq, + label="Requested base + fine freq", + converter=forms.float_converter(), + ) + self.nb_freq.GetPage(0).GridAdd(self._variable_static_requested_freq_static_text, 3, 0, 1, 1) + self._variable_static_max_bin_freq_static_text = forms.static_text( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.variable_static_max_bin_freq, + callback=self.set_variable_static_max_bin_freq, + label="Peak freq", + converter=forms.float_converter(), + ) + self.nb_test.GetPage(0).Add(self._variable_static_max_bin_freq_static_text) + self._variable_static_level_probe_static_text = forms.static_text( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.variable_static_level_probe, + callback=self.set_variable_static_level_probe, + label="Signal mag^2 (dB)", + converter=forms.float_converter(), + ) + self.nb_test.GetPage(0).Add(self._variable_static_level_probe_static_text) + self._variable_static_fft_window_name_static_text = forms.static_text( + parent=self.nb_info.GetPage(0).GetWin(), + value=self.variable_static_fft_window_name, + callback=self.set_variable_static_fft_window_name, + label="FFT window", + converter=forms.str_converter(), + ) + self.nb_info.GetPage(0).Add(self._variable_static_fft_window_name_static_text) + self._variable_static_fft_max_lvl_log_static_text = forms.static_text( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.variable_static_fft_max_lvl_log, + callback=self.set_variable_static_fft_max_lvl_log, + label="Peak magnitude (dB)", + converter=forms.float_converter(), + ) + self.nb_test.GetPage(0).Add(self._variable_static_fft_max_lvl_log_static_text) + self._variable_static_actual_sample_rate_static_text = forms.static_text( + parent=self.nb_rate.GetPage(0).GetWin(), + value=self.variable_static_actual_sample_rate, + callback=self.set_variable_static_actual_sample_rate, + label="Actual", + converter=forms.float_converter(), + ) + self.nb_rate.GetPage(0).GridAdd(self._variable_static_actual_sample_rate_static_text, 0, 1, 1, 1) + self._variable_static_actual_dsp_freq_static_text = forms.static_text( + parent=self.nb_freq.GetPage(0).GetWin(), + value=self.variable_static_actual_dsp_freq, + callback=self.set_variable_static_actual_dsp_freq, + label="Actual DSP freq", + converter=forms.float_converter(), + ) + self.nb_freq.GetPage(0).GridAdd(self._variable_static_actual_dsp_freq_static_text, 6, 0, 1, 1) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_variable_any_code_waterfall_ave(): + self._post_any_code_evaluators += [('variable_any_code_waterfall_ave', lambda: self._evalutate_variable_any_code_waterfall_ave(**{'averaging': fft_averaging}))] + def __evalutate_variable_any_code_waterfall_ave(*args, **kwds): + try: + self.variable_any_code_waterfall_ave = self.waterfall_sink.win['average'] = fft_averaging + self.set_variable_any_code_waterfall_ave(self.variable_any_code_waterfall_ave) + except AttributeError, e: + print "AttributeError while evaulating variable_any_code_waterfall_ave:", e + __post_evalutate_variable_any_code_waterfall_ave() + except Exception, e: + print "Exception while evaluating variable_any_code_waterfall_ave:", e + self._evalutate_variable_any_code_waterfall_ave = __evalutate_variable_any_code_waterfall_ave + self.__post_evalutate_variable_any_code_waterfall_ave = __post_evalutate_variable_any_code_waterfall_ave + self.__post_evalutate_variable_any_code_waterfall_ave() + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_variable_any_code_iq_correction(): + self._post_any_code_evaluators += [('variable_any_code_iq_correction', lambda: self._evalutate_variable_any_code_iq_correction(**{'auto_iq_correction': auto_iq_correction}))] + def __evalutate_variable_any_code_iq_correction(*args, **kwds): + try: + [self.src.set_auto_iq_balance(self.auto_iq_correction), self.auto_iq_correction or self.src.set_iq_balance(0+0j)] + self.set_variable_any_code_iq_correction(self.variable_any_code_iq_correction) + except AttributeError, e: + print "AttributeError while evaulating variable_any_code_iq_correction:", e + __post_evalutate_variable_any_code_iq_correction() + except Exception, e: + print "Exception while evaluating variable_any_code_iq_correction:", e + self._evalutate_variable_any_code_iq_correction = __evalutate_variable_any_code_iq_correction + self.__post_evalutate_variable_any_code_iq_correction = __post_evalutate_variable_any_code_iq_correction + self._evalutate_variable_any_code_iq_correction(**{'auto_iq_correction': auto_iq_correction}) + variable_any_code_iq_correction = self.variable_any_code_iq_correction + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_variable_any_code_fft_sink_peak_hold(): + self._post_any_code_evaluators += [('variable_any_code_fft_sink_peak_hold', lambda: self._evalutate_variable_any_code_fft_sink_peak_hold(**{'peak_hold': fft_peak_hold}))] + def __evalutate_variable_any_code_fft_sink_peak_hold(*args, **kwds): + try: + self.variable_any_code_fft_sink_peak_hold = self.fft_sink.win['peak_hold'] = fft_peak_hold + self.set_variable_any_code_fft_sink_peak_hold(self.variable_any_code_fft_sink_peak_hold) + except AttributeError, e: + print "AttributeError while evaulating variable_any_code_fft_sink_peak_hold:", e + __post_evalutate_variable_any_code_fft_sink_peak_hold() + except Exception, e: + print "Exception while evaluating variable_any_code_fft_sink_peak_hold:", e + self._evalutate_variable_any_code_fft_sink_peak_hold = __evalutate_variable_any_code_fft_sink_peak_hold + self.__post_evalutate_variable_any_code_fft_sink_peak_hold = __post_evalutate_variable_any_code_fft_sink_peak_hold + self._evalutate_variable_any_code_fft_sink_peak_hold(**{'peak_hold': fft_peak_hold}) + variable_any_code_fft_sink_peak_hold = self.variable_any_code_fft_sink_peak_hold + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_variable_any_code_fft_sink_ave(): + self._post_any_code_evaluators += [('variable_any_code_fft_sink_ave', lambda: self._evalutate_variable_any_code_fft_sink_ave(**{'averaging': fft_averaging}))] + def __evalutate_variable_any_code_fft_sink_ave(*args, **kwds): + try: + self.variable_any_code_fft_sink_ave = self.fft_sink.win['average'] = fft_averaging + self.set_variable_any_code_fft_sink_ave(self.variable_any_code_fft_sink_ave) + except AttributeError, e: + print "AttributeError while evaulating variable_any_code_fft_sink_ave:", e + __post_evalutate_variable_any_code_fft_sink_ave() + except Exception, e: + print "Exception while evaluating variable_any_code_fft_sink_ave:", e + self._evalutate_variable_any_code_fft_sink_ave = __evalutate_variable_any_code_fft_sink_ave + self.__post_evalutate_variable_any_code_fft_sink_ave = __post_evalutate_variable_any_code_fft_sink_ave + self.__post_evalutate_variable_any_code_fft_sink_ave() + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_variable_any_code_auto_dc_offset_removal(): + self._post_any_code_evaluators += [('variable_any_code_auto_dc_offset_removal', lambda: self._evalutate_variable_any_code_auto_dc_offset_removal(**{'auto_dc_offset_removal': auto_dc_offset_removal}))] + def __evalutate_variable_any_code_auto_dc_offset_removal(*args, **kwds): + try: + [self.src.set_auto_dc_offset(self.auto_dc_offset_removal), self.auto_dc_offset_removal or self.src.set_dc_offset(0+0j)] + self.set_variable_any_code_auto_dc_offset_removal(self.variable_any_code_auto_dc_offset_removal) + except AttributeError, e: + print "AttributeError while evaulating variable_any_code_auto_dc_offset_removal:", e + __post_evalutate_variable_any_code_auto_dc_offset_removal() + except Exception, e: + print "Exception while evaluating variable_any_code_auto_dc_offset_removal:", e + self._evalutate_variable_any_code_auto_dc_offset_removal = __evalutate_variable_any_code_auto_dc_offset_removal + self.__post_evalutate_variable_any_code_auto_dc_offset_removal = __post_evalutate_variable_any_code_auto_dc_offset_removal + self._evalutate_variable_any_code_auto_dc_offset_removal(**{'auto_dc_offset_removal': auto_dc_offset_removal}) + variable_any_code_auto_dc_offset_removal = self.variable_any_code_auto_dc_offset_removal + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_usrp_info(): + self._post_any_code_evaluators += [('usrp_info', lambda: self._evalutate_usrp_info(**{}))] + def __evalutate_usrp_info(*args, **kwds): + try: + self.usrp_info = '%s (\'%s\'), %s' % (self.src.get_usrp_info().get('mboard_id'), self.src.get_usrp_info().get('mboard_name'), self.src.get_usrp_info().get('rx_subdev_name')) + self.set_usrp_info(self.usrp_info) + except AttributeError, e: + print "AttributeError while evaulating usrp_info:", e + __post_evalutate_usrp_info() + except Exception, e: + print "Exception while evaluating usrp_info:", e + self._evalutate_usrp_info = __evalutate_usrp_info + self.__post_evalutate_usrp_info = __post_evalutate_usrp_info + self._evalutate_usrp_info(**{}) + usrp_info = self.usrp_info + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_update_time_source(): + self._post_any_code_evaluators += [('update_time_source', lambda: self._evalutate_update_time_source(**{'pps': pps}))] + def __evalutate_update_time_source(*args, **kwds): + try: + if self.pps != '': self.src.set_time_source(self.pps, 0); print '1 PPS =', self.pps; + self.set_update_time_source(self.update_time_source) + except AttributeError, e: + print "AttributeError while evaulating update_time_source:", e + __post_evalutate_update_time_source() + except Exception, e: + print "Exception while evaluating update_time_source:", e + self._evalutate_update_time_source = __evalutate_update_time_source + self.__post_evalutate_update_time_source = __post_evalutate_update_time_source + self._evalutate_update_time_source(**{'pps': pps}) + update_time_source = self.update_time_source + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_update_clock_source(): + self._post_any_code_evaluators += [('update_clock_source', lambda: self._evalutate_update_clock_source(**{'ref': ref}))] + def __evalutate_update_clock_source(*args, **kwds): + try: + if self.ref != '': self.src.set_clock_source(self.ref, 0); print 'Ref =', self.ref; + self.set_update_clock_source(self.update_clock_source) + except AttributeError, e: + print "AttributeError while evaulating update_clock_source:", e + __post_evalutate_update_clock_source() + except Exception, e: + print "Exception while evaluating update_clock_source:", e + self._evalutate_update_clock_source = __evalutate_update_clock_source + self.__post_evalutate_update_clock_source = __post_evalutate_update_clock_source + self._evalutate_update_clock_source(**{'ref': ref}) + update_clock_source = self.update_clock_source + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_tune_result(): + self._post_any_code_evaluators += [('tune_result', lambda: self._evalutate_tune_result(**{'tune_obj': tune_obj}))] + def __evalutate_tune_result(*args, **kwds): + try: + self.tune_result = self.src.set_center_freq(self.tune_obj) + self.set_tune_result(self.tune_result) + except AttributeError, e: + print "AttributeError while evaulating tune_result:", e + __post_evalutate_tune_result() + except Exception, e: + print "Exception while evaluating tune_result:", e + self._evalutate_tune_result = __evalutate_tune_result + self.__post_evalutate_tune_result = __post_evalutate_tune_result + self._evalutate_tune_result(**{'tune_obj': tune_obj}) + tune_result = self.tune_result + self._tune_mode_chooser = forms.drop_down( + parent=self.nb_freq.GetPage(0).GetWin(), + value=self.tune_mode, + callback=self.set_tune_mode, + label="Tune mode", + choices=[0, 1, 2], + labels=['Auto (no LO offset)', 'Auto with LO offset', 'Manual (no DSP)'], + ) + self.nb_freq.GetPage(0).GridAdd(self._tune_mode_chooser, 0, 0, 1, 1) + if sensor_interval > 0: + self._time_probe_poll_rate = sensor_interval + else: + self._time_probe_poll_rate = 1 + self._time_probe_enabled = sensor_interval > 0 + def _set_time_probe_poll_rate(rate): + self._time_probe_enabled = rate > 0 + if rate > 0: + self._time_probe_poll_rate = rate + self.set_time_probe_poll_rate = _set_time_probe_poll_rate + def _time_probe_probe(): + while True: + if self._time_probe_enabled: + val = self.src.get_time_now() + try: + self.set_time_probe(val) + except AttributeError: + pass + time.sleep(1.0/(self._time_probe_poll_rate)) + _time_probe_thread = threading.Thread(target=_time_probe_probe) + _time_probe_thread.daemon = True + _time_probe_thread.start() + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_subdev_spec(): + self._post_any_code_evaluators += [('subdev_spec', lambda: self._evalutate_subdev_spec(**{}))] + def __evalutate_subdev_spec(*args, **kwds): + try: + self.subdev_spec = '[' + self.src.get_subdev_spec().strip() + ']' + self.set_subdev_spec(self.subdev_spec) + except AttributeError, e: + print "AttributeError while evaulating subdev_spec:", e + __post_evalutate_subdev_spec() + except Exception, e: + print "Exception while evaluating subdev_spec:", e + self._evalutate_subdev_spec = __evalutate_subdev_spec + self.__post_evalutate_subdev_spec = __post_evalutate_subdev_spec + self._evalutate_subdev_spec(**{}) + subdev_spec = self.subdev_spec + self._static_locked_static_text = forms.static_text( + parent=self.nb_info.GetPage(0).GetWin(), + value=self.static_locked, + callback=self.set_static_locked, + label="Locked", + converter=forms.str_converter(), + ) + self.nb_info.GetPage(0).Add(self._static_locked_static_text) + if probe_interval > 0: + self._signal_probe_poll_rate = probe_interval + else: + self._signal_probe_poll_rate = 1 + self._signal_probe_enabled = probe_interval > 0 + def _set_signal_probe_poll_rate(rate): + self._signal_probe_enabled = rate > 0 + if rate > 0: + self._signal_probe_poll_rate = rate + self.set_signal_probe_poll_rate = _set_signal_probe_poll_rate + def _signal_probe_probe(): + while True: + if self._signal_probe_enabled: + val = self.probe_avg_mag.level() + try: + self.set_signal_probe(val) + except AttributeError: + pass + time.sleep(1.0/(self._signal_probe_poll_rate)) + _signal_probe_thread = threading.Thread(target=_signal_probe_probe) + _signal_probe_thread.daemon = True + _signal_probe_thread.start() + self._show_max_lvl_check_box = forms.check_box( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.show_max_lvl, + callback=self.set_show_max_lvl, + label="Show max level", + true=True, + false=False, + ) + self.nb_test.GetPage(0).GridAdd(self._show_max_lvl_check_box, 0, 2, 1, 1) + self._show_max_freq_check_box = forms.check_box( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.show_max_freq, + callback=self.set_show_max_freq, + label="Show max freq", + true=True, + false=False, + ) + self.nb_test.GetPage(0).GridAdd(self._show_max_freq_check_box, 0, 1, 1, 1) + _selected_gain_sizer = wx.BoxSizer(wx.VERTICAL) + self._selected_gain_text_box = forms.text_box( + parent=self.nb_analog.GetPage(0).GetWin(), + sizer=_selected_gain_sizer, + value=self.selected_gain, + callback=self.set_selected_gain, + label="Gain", + converter=forms.float_converter(), + proportion=0, + ) + self._selected_gain_slider = forms.slider( + parent=self.nb_analog.GetPage(0).GetWin(), + sizer=_selected_gain_sizer, + value=self.selected_gain, + callback=self.set_selected_gain, + minimum=gain_range.start(), + maximum=[gain_range.stop(), gain_range.start() + 1.0][gain_range.stop()==gain_range.start()], + num_steps=[int((abs(gain_range.stop()-gain_range.start())/[gain_range.step(), 1.0][gain_range.step()==0])), 1][gain_range.stop()==gain_range.start()], + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.nb_analog.GetPage(0).Add(_selected_gain_sizer) + self._selected_antenna_chooser = forms.radio_buttons( + parent=self.nb_analog.GetPage(0).GetWin(), + value=self.selected_antenna, + callback=self.set_selected_antenna, + label="Antenna", + choices=antennas, + labels=[antennas,['(default)']][antennas==('',)], + style=wx.RA_HORIZONTAL, + ) + self.nb_analog.GetPage(0).Add(self._selected_antenna_chooser) + self._requested_sample_rate_base_text_box = forms.text_box( + parent=self.nb_rate.GetPage(0).GetWin(), + value=self.requested_sample_rate_base, + callback=self.set_requested_sample_rate_base, + label="Requested base sample rate", + converter=forms.float_converter(), + ) + self.nb_rate.GetPage(0).GridAdd(self._requested_sample_rate_base_text_box, 0, 0, 1, 1) + _requested_freq_txt_sizer = wx.BoxSizer(wx.VERTICAL) + self._requested_freq_txt_text_box = forms.text_box( + parent=self.nb_freq.GetPage(0).GetWin(), + sizer=_requested_freq_txt_sizer, + value=self.requested_freq_txt, + callback=self.set_requested_freq_txt, + label="Requested freq", + converter=forms.float_converter(), + proportion=0, + ) + self._requested_freq_txt_slider = forms.slider( + parent=self.nb_freq.GetPage(0).GetWin(), + sizer=_requested_freq_txt_sizer, + value=self.requested_freq_txt, + callback=self.set_requested_freq_txt, + minimum=freq_range.start(), + maximum=[freq_range.stop(), freq_range.start() + 1.0][freq_range.start()==freq_range.stop()], + num_steps=[1000,1][freq_range.start()==freq_range.stop()], + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.nb_freq.GetPage(0).GridAdd(_requested_freq_txt_sizer, 1, 0, 1, 1) + self._relative_time_chooser = forms.drop_down( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.relative_time, + callback=self.set_relative_time, + label="Time display", + choices=[False, True], + labels=['Absolute', 'Relative'], + ) + self.nb_test.GetPage(0).GridAdd(self._relative_time_chooser, 1, 0, 1, 1) + self._relative_freq_chooser = forms.drop_down( + parent=self.nb_freq.GetPage(0).GetWin(), + value=self.relative_freq, + callback=self.set_relative_freq, + label="Frequency Axis", + choices=[1, 0], + labels=['RF', 'Baseband'], + ) + self.nb_freq.GetPage(0).GridAdd(self._relative_freq_chooser, 7, 0, 1, 1) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_motherboard_sensors(): + self._post_any_code_evaluators += [('motherboard_sensors', lambda: self._evalutate_motherboard_sensors(**{'motherboard_sensor_names': motherboard_sensor_names}))] + def __evalutate_motherboard_sensors(*args, **kwds): + try: + self.motherboard_sensors = '\n'.join(map(lambda x: '%s: %s' % (x, str(self.src.get_mboard_sensor(x))), filter(lambda x: x.find('gps') != 0, self.motherboard_sensor_names))) + self.set_motherboard_sensors(self.motherboard_sensors) + except AttributeError, e: + print "AttributeError while evaulating motherboard_sensors:", e + __post_evalutate_motherboard_sensors() + except Exception, e: + print "Exception while evaluating motherboard_sensors:", e + self._evalutate_motherboard_sensors = __evalutate_motherboard_sensors + self.__post_evalutate_motherboard_sensors = __post_evalutate_motherboard_sensors + self._evalutate_motherboard_sensors(**{'motherboard_sensor_names': motherboard_sensor_names}) + motherboard_sensors = self.motherboard_sensors + self.logpwrfft_x_0_0 = logpwrfft.logpwrfft_c( + sample_rate=samp_rate, + fft_size=fft_size, + ref_scale=fft_ref_scale, + frame_rate=fft_rate, + avg_alpha=fft_ave_probe, + average=False, + ) + self.logpwrfft_x_0 = logpwrfft.logpwrfft_c( + sample_rate=samp_rate, + fft_size=fft_size, + ref_scale=fft_ref_scale, + frame_rate=fft_rate, + avg_alpha=fft_ave_probe, + average=False, + ) + if lo_check_interval * float(has_lo_locked) > 0: + self._locked_probe_poll_rate = lo_check_interval * float(has_lo_locked) + else: + self._locked_probe_poll_rate = 1 + self._locked_probe_enabled = lo_check_interval * float(has_lo_locked) > 0 + def _set_locked_probe_poll_rate(rate): + self._locked_probe_enabled = rate > 0 + if rate > 0: + self._locked_probe_poll_rate = rate + self.set_locked_probe_poll_rate = _set_locked_probe_poll_rate + def _locked_probe_probe(): + while True: + if self._locked_probe_enabled: + val = self.src.get_sensor('lo_locked') + try: + self.set_locked_probe(val) + except AttributeError: + pass + time.sleep(1.0/(self._locked_probe_poll_rate)) + _locked_probe_thread = threading.Thread(target=_locked_probe_probe) + _locked_probe_thread.daemon = True + _locked_probe_thread.start() + self._lo_offset_txt_text_box = forms.text_box( + parent=self.nb_freq.GetPage(0).GetWin(), + value=self.lo_offset_txt, + callback=self.set_lo_offset_txt, + label="LO offset (only for LO offset tuning mode)", + converter=forms.float_converter(), + ) + self.nb_freq.GetPage(0).GridAdd(self._lo_offset_txt_text_box, 4, 0, 1, 1) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_gain_default(): + self._post_any_code_evaluators += [('gain_default', lambda: self._evalutate_gain_default(**{'initial_gain': initial_gain}))] + def __evalutate_gain_default(*args, **kwds): + try: + self.gain_default = [gain,initial_gain][gain==float('-inf')] + self.set_gain_default(self.gain_default) + except AttributeError, e: + print "AttributeError while evaulating gain_default:", e + __post_evalutate_gain_default() + except Exception, e: + print "Exception while evaluating gain_default:", e + self._evalutate_gain_default = __evalutate_gain_default + self.__post_evalutate_gain_default = __post_evalutate_gain_default + self._evalutate_gain_default(**{'initial_gain': initial_gain}) + gain_default = self.gain_default + _freq_fine_sizer = wx.BoxSizer(wx.VERTICAL) + self._freq_fine_text_box = forms.text_box( + parent=self.nb_freq.GetPage(0).GetWin(), + sizer=_freq_fine_sizer, + value=self.freq_fine, + callback=self.set_freq_fine, + label="Freq (fine)", + converter=forms.float_converter(), + proportion=0, + ) + self._freq_fine_slider = forms.slider( + parent=self.nb_freq.GetPage(0).GetWin(), + sizer=_freq_fine_sizer, + value=self.freq_fine, + callback=self.set_freq_fine, + minimum=-freq_fine_range/2, + maximum=freq_fine_range/2, + num_steps=1000, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.nb_freq.GetPage(0).GridAdd(_freq_fine_sizer, 2, 0, 1, 1) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_fix_invalid_freq(): + self._post_any_code_evaluators += [('fix_invalid_freq', lambda: self._evalutate_fix_invalid_freq(**{}))] + def __evalutate_fix_invalid_freq(*args, **kwds): + try: + ((freq <= freq_range.stop()) and (freq >= freq_range.start())) or self.set_requested_freq_txt(self.src.get_center_freq()); print self.src.get_center_freq() + self.set_fix_invalid_freq(self.fix_invalid_freq) + except AttributeError, e: + print "AttributeError while evaulating fix_invalid_freq:", e + __post_evalutate_fix_invalid_freq() + except Exception, e: + print "Exception while evaluating fix_invalid_freq:", e + self._evalutate_fix_invalid_freq = __evalutate_fix_invalid_freq + self.__post_evalutate_fix_invalid_freq = __post_evalutate_fix_invalid_freq + self.__post_evalutate_fix_invalid_freq() + self.fft_sink_two_1 = fftsink2.fft_sink_c( + self.nb.GetPage(0).GetWin(), + baseband_freq=fft_center_freq, + y_per_div=10, + y_divs=int(dyn_rng/10), + ref_level=ref_lvl, + ref_scale=fft_ref_scale, + sample_rate=samp_rate, + fft_size=1024*0 + fft_size, + fft_rate=fft_rate, + average=True, + avg_alpha=ave, + title="FFT Plot 2", + peak_hold=False, fft_in=False, + always_run=False, + fft_out=False, + ) + self.nb.GetPage(0).Add(self.fft_sink_two_1.win) + def fft_sink_two_1_callback(x, y): + self.set_clicked_freq(x) + + self.fft_sink_two_1.set_callback(fft_sink_two_1_callback) + self.fft_max_lvl_probe = blocks.probe_signal_f() + if probe_interval > 0: + self._fft_max_lvl_2_poll_rate = probe_interval + else: + self._fft_max_lvl_2_poll_rate = 1 + self._fft_max_lvl_2_enabled = probe_interval > 0 + def _set_fft_max_lvl_2_poll_rate(rate): + self._fft_max_lvl_2_enabled = rate > 0 + if rate > 0: + self._fft_max_lvl_2_poll_rate = rate + self.set_fft_max_lvl_2_poll_rate = _set_fft_max_lvl_2_poll_rate + def _fft_max_lvl_2_probe(): + while True: + if self._fft_max_lvl_2_enabled: + val = self.fft_max_lvl_probe_2.level() + try: + self.set_fft_max_lvl_2(val) + except AttributeError: + pass + time.sleep(1.0/(self._fft_max_lvl_2_poll_rate)) + _fft_max_lvl_2_thread = threading.Thread(target=_fft_max_lvl_2_probe) + _fft_max_lvl_2_thread.daemon = True + _fft_max_lvl_2_thread.start() + if probe_interval > 0: + self._fft_max_lvl_poll_rate = probe_interval + else: + self._fft_max_lvl_poll_rate = 1 + self._fft_max_lvl_enabled = probe_interval > 0 + def _set_fft_max_lvl_poll_rate(rate): + self._fft_max_lvl_enabled = rate > 0 + if rate > 0: + self._fft_max_lvl_poll_rate = rate + self.set_fft_max_lvl_poll_rate = _set_fft_max_lvl_poll_rate + def _fft_max_lvl_probe(): + while True: + if self._fft_max_lvl_enabled: + val = self.fft_max_lvl_probe.level() + try: + self.set_fft_max_lvl(val) + except AttributeError: + pass + time.sleep(1.0/(self._fft_max_lvl_poll_rate)) + _fft_max_lvl_thread = threading.Thread(target=_fft_max_lvl_probe) + _fft_max_lvl_thread.daemon = True + _fft_max_lvl_thread.start() + self.fft_max_idx_probe_0 = blocks.probe_signal_s() + self.fft_max_idx_probe = blocks.probe_signal_s() + if probe_interval > 0: + self._fft_max_idx_poll_rate = probe_interval + else: + self._fft_max_idx_poll_rate = 1 + self._fft_max_idx_enabled = probe_interval > 0 + def _set_fft_max_idx_poll_rate(rate): + self._fft_max_idx_enabled = rate > 0 + if rate > 0: + self._fft_max_idx_poll_rate = rate + self.set_fft_max_idx_poll_rate = _set_fft_max_idx_poll_rate + def _fft_max_idx_probe(): + while True: + if self._fft_max_idx_enabled: + val = self.fft_max_idx_probe.level() + try: + self.set_fft_max_idx(val) + except AttributeError: + pass + time.sleep(1.0/(self._fft_max_idx_poll_rate)) + _fft_max_idx_thread = threading.Thread(target=_fft_max_idx_probe) + _fft_max_idx_thread.daemon = True + _fft_max_idx_thread.start() + _decim_sizer = wx.BoxSizer(wx.VERTICAL) + self._decim_text_box = forms.text_box( + parent=self.nb_rate.GetPage(0).GetWin(), + sizer=_decim_sizer, + value=self.decim, + callback=self.set_decim, + label="Divide base sample rate", + converter=forms.int_converter(), + proportion=0, + ) + self._decim_slider = forms.slider( + parent=self.nb_rate.GetPage(0).GetWin(), + sizer=_decim_sizer, + value=self.decim, + callback=self.set_decim, + minimum=1, + maximum=max_decim, + num_steps=max_decim-1, + style=wx.SL_HORIZONTAL, + cast=int, + proportion=1, + ) + self.nb_rate.GetPage(0).Add(_decim_sizer) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_daughterboard_sensors(): + self._post_any_code_evaluators += [('daughterboard_sensors', lambda: self._evalutate_daughterboard_sensors(**{'daughterboard_sensor_names': daughterboard_sensor_names}))] + def __evalutate_daughterboard_sensors(*args, **kwds): + try: + self.daughterboard_sensors = '\n'.join(map(lambda x: '%s: %s' % (x, str(self.src.get_sensor(x))), self.daughterboard_sensor_names)) + self.set_daughterboard_sensors(self.daughterboard_sensors) + except AttributeError, e: + print "AttributeError while evaulating daughterboard_sensors:", e + __post_evalutate_daughterboard_sensors() + except Exception, e: + print "Exception while evaluating daughterboard_sensors:", e + self._evalutate_daughterboard_sensors = __evalutate_daughterboard_sensors + self.__post_evalutate_daughterboard_sensors = __post_evalutate_daughterboard_sensors + self._evalutate_daughterboard_sensors(**{'daughterboard_sensor_names': daughterboard_sensor_names}) + daughterboard_sensors = self.daughterboard_sensors + self._clicked_freq_txt_text_box = forms.text_box( + parent=self.nb_test.GetPage(0).GetWin(), + value=self.clicked_freq_txt, + callback=self.set_clicked_freq_txt, + label="Clicked freq", + converter=forms.float_converter(), + ) + self.nb_test.GetPage(0).Add(self._clicked_freq_txt_text_box) + self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_gr_complex*1, "", ""); self.blocks_tag_debug_0.set_display(show_stream_tags_chk) + self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_short*1) + self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_short*1) + self.blocks_max_xx_0_0 = blocks.max_ff(fft_size) + self.blocks_max_xx_0 = blocks.max_ff(fft_size) + self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1) + self.blocks_float_to_complex_0 = blocks.float_to_complex(1) + self.blocks_complex_to_mag_0_0 = blocks.complex_to_mag(1) + self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) + self.blocks_argmax_xx_0_0 = blocks.argmax_fs(fft_size) + self.blocks_argmax_xx_0 = blocks.argmax_fs(fft_size) + self.blks2_selector_0_1 = grc_blks2.selector( + item_size=gr.sizeof_gr_complex*1, + num_inputs=2, + num_outputs=1, + input_index=scope_mode_2, + output_index=0, + ) + self.blks2_selector_0_0_0 = grc_blks2.selector( + item_size=gr.sizeof_gr_complex*1, + num_inputs=1, + num_outputs=2, + input_index=0, + output_index=scope_mode_2, + ) + self.blks2_selector_0_0 = grc_blks2.selector( + item_size=gr.sizeof_gr_complex*1, + num_inputs=1, + num_outputs=2, + input_index=0, + output_index=scope_mode, + ) + self.blks2_selector_0 = grc_blks2.selector( + item_size=gr.sizeof_gr_complex*1, + num_inputs=2, + num_outputs=1, + input_index=scope_mode, + output_index=0, + ) + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_any_test_1(): + self._post_any_code_evaluators += [('any_test_1', lambda: self._evalutate_any_test_1(**{'test': test}))] + def __evalutate_any_test_1(*args, **kwds): + try: + if self.fft_sink.controller['average']: self.fft_sink.controller['average'] = False; time.sleep(0.25); self.fft_sink.controller['average'] = True; + self.set_any_test_1(self.any_test_1) + except AttributeError, e: + print "AttributeError while evaulating any_test_1:", e + __post_evalutate_any_test_1() + except Exception, e: + print "Exception while evaluating any_test_1:", e + self._evalutate_any_test_1 = __evalutate_any_test_1 + self.__post_evalutate_any_test_1 = __post_evalutate_any_test_1 + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_actual_sample_rate(): + self._post_any_code_evaluators += [('actual_sample_rate', lambda: self._evalutate_actual_sample_rate(**{'requested_sample_rate': requested_sample_rate}))] + def __evalutate_actual_sample_rate(*args, **kwds): + try: + self.actual_sample_rate = self.src.get_samp_rate() + self.set_actual_sample_rate(self.actual_sample_rate) + except AttributeError, e: + print "AttributeError while evaulating actual_sample_rate:", e + __post_evalutate_actual_sample_rate() + except Exception, e: + print "Exception while evaluating actual_sample_rate:", e + self._evalutate_actual_sample_rate = __evalutate_actual_sample_rate + self.__post_evalutate_actual_sample_rate = __post_evalutate_actual_sample_rate + self._evalutate_actual_sample_rate(**{'requested_sample_rate': requested_sample_rate}) + actual_sample_rate = self.actual_sample_rate + if not hasattr(self, '_post_any_code_evaluators'): + self._post_any_code_evaluators = [] + self.wxEVT_AnyCode = wxEVT_AnyCode = wx.NewEventType() + def _run_evaluators(event): + _post_any_code_evaluators = self._post_any_code_evaluators + if len(_post_any_code_evaluators) > 0: + for id, evaluator in _post_any_code_evaluators: + try: + evaluator() + except Exception, e: + print "Exception while running Any Code evaluator for '%s':" % (id), e + del _post_any_code_evaluators[0:len(_post_any_code_evaluators)] + self._run_evaluators = _run_evaluators + try: + self.GetWin().Connect(-1, -1, wxEVT_AnyCode, _run_evaluators) + except: + pass # FIXME + def _run_evaluators_later(evaluator=None): + if evaluator is not None: + self._post_any_code_evaluators += [evaluator] + try: + de = wx.PyEvent() + de.SetEventType(wxEVT_AnyCode) + wx.PostEvent(self.GetWin(), de) + except TypeError: + pass + except AttributeError: # FIXME + print "Cannot post message" + self._run_evaluators_later = _run_evaluators_later + _run_evaluators_later() + def __post_evalutate_actual_center_freq(): + self._post_any_code_evaluators += [('actual_center_freq', lambda: self._evalutate_actual_center_freq(**{'tune_obj': tune_obj}))] + def __evalutate_actual_center_freq(*args, **kwds): + try: + self.actual_center_freq = self.src.get_center_freq() + self.set_actual_center_freq(self.actual_center_freq) + except AttributeError, e: + print "AttributeError while evaulating actual_center_freq:", e + __post_evalutate_actual_center_freq() + except Exception, e: + print "Exception while evaluating actual_center_freq:", e + self._evalutate_actual_center_freq = __evalutate_actual_center_freq + self.__post_evalutate_actual_center_freq = __post_evalutate_actual_center_freq + self._evalutate_actual_center_freq(**{'tune_obj': tune_obj}) + actual_center_freq = self.actual_center_freq + + ################################################## + # Connections + ################################################## + self.connect((self.blks2_selector_0, 0), (self.wxgui_scopesink2_0, 0)) + self.connect((self.blks2_selector_0_0, 0), (self.blks2_selector_0, 0)) + self.connect((self.blks2_selector_0_0, 1), (self.blocks_complex_to_mag_0, 0)) + self.connect((self.blks2_selector_0_0_0, 0), (self.blks2_selector_0_1, 0)) + self.connect((self.blks2_selector_0_0_0, 1), (self.blocks_complex_to_mag_0_0, 0)) + self.connect((self.blks2_selector_0_1, 0), (self.wxgui_scopesink2_0_0, 0)) + self.connect((self.blocks_argmax_xx_0, 1), (self.blocks_null_sink_0, 0)) + self.connect((self.blocks_argmax_xx_0, 0), (self.fft_max_idx_probe, 0)) + self.connect((self.blocks_argmax_xx_0_0, 1), (self.blocks_null_sink_0_0, 0)) + self.connect((self.blocks_argmax_xx_0_0, 0), (self.fft_max_idx_probe_0, 0)) + self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_float_to_complex_0, 1)) + self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_float_to_complex_0, 0)) + self.connect((self.blocks_complex_to_mag_0_0, 0), (self.blocks_float_to_complex_0_0, 1)) + self.connect((self.blocks_complex_to_mag_0_0, 0), (self.blocks_float_to_complex_0_0, 0)) + self.connect((self.blocks_float_to_complex_0, 0), (self.blks2_selector_0, 1)) + self.connect((self.blocks_float_to_complex_0_0, 0), (self.blks2_selector_0_1, 1)) + self.connect((self.blocks_max_xx_0, 0), (self.fft_max_lvl_probe, 0)) + self.connect((self.blocks_max_xx_0_0, 0), (self.fft_max_lvl_probe_2, 0)) + self.connect((self.logpwrfft_x_0, 0), (self.blocks_argmax_xx_0, 0)) + self.connect((self.logpwrfft_x_0, 0), (self.blocks_max_xx_0, 0)) + self.connect((self.logpwrfft_x_0_0, 0), (self.blocks_argmax_xx_0_0, 0)) + self.connect((self.logpwrfft_x_0_0, 0), (self.blocks_max_xx_0_0, 0)) + self.connect((self.src, 0), (self.blocks_tag_debug_0, 0)) + self.connect((self.src, 0), (self.blks2_selector_0_0, 0)) + self.connect((self.src, 0), (self.fft_sink, 0)) + self.connect((self.src, 0), (self.waterfall_sink, 0)) + self.connect((self.src, 0), (self.probe_avg_mag, 0)) + self.connect((self.src, 0), (self.logpwrfft_x_0, 0)) + self.connect((self.src, 1), (self.blks2_selector_0_0_0, 0)) + self.connect((self.src, 1), (self.fft_sink_two_1, 0)) + self.connect((self.src, 1), (self.logpwrfft_x_0_0, 0)) + self.connect((self.src, 1), (self.waterfall_sink_0, 0)) + + + def get_antenna(self): + return self.antenna + + def set_antenna(self, antenna): + self.antenna = antenna + self.set_selected_antenna([ [self.antenna,self.antennas[0]][self.antenna not in self.antennas] ,self.antennas[0]][self.antenna=='']) + + def get_args(self): + return self.args + + def set_args(self, args): + self.args = args + + def get_ave(self): + return self.ave + + def set_ave(self, ave): + self.ave = ave + self.set_fft_ave_probe(self.ave) + + def get_averaging(self): + return self.averaging + + def set_averaging(self, averaging): + self.averaging = averaging + self.set_fft_averaging(self.str_to_bool(self.averaging)) + + def get_bw(self): + return self.bw + + def set_bw(self, bw): + self.bw = bw + self.src.set_bandwidth(self.bw, 0) + self.src.set_bandwidth(self.bw, 1) + + def get_dyn_rng(self): + return self.dyn_rng + + def set_dyn_rng(self, dyn_rng): + self.dyn_rng = dyn_rng + + def get_fft_rate(self): + return self.fft_rate + + def set_fft_rate(self, fft_rate): + self.fft_rate = fft_rate + + def get_fft_ref_scale(self): + return self.fft_ref_scale + + def set_fft_ref_scale(self, fft_ref_scale): + self.fft_ref_scale = fft_ref_scale + + def get_fft_size(self): + return self.fft_size + + def set_fft_size(self, fft_size): + self.fft_size = fft_size + self.set_fft_max_idx((self.fft_size/2)*0) + self.set_fft_max_idx_norm([self.fft_max_idx,self.fft_max_idx-self.fft_size][int(self.fft_max_idx>(self.fft_size/2))]) + self.set_max_bin_freq(self.fft_center_freq + (((1.0*self.fft_max_idx_norm) / self.fft_size) * self.samp_rate)) + + def get_freq(self): + return self.freq + + def set_freq(self, freq): + self.freq = freq + self.set_requested_freq_txt(self.freq) + self.src.set_center_freq(uhd.tune_request(self.freq, self.lo_offset), 0) + self.src.set_center_freq(uhd.tune_request(self.freq, self.lo_offset), 1) + + def get_freq_fine_range(self): + return self.freq_fine_range + + def set_freq_fine_range(self, freq_fine_range): + self.freq_fine_range = freq_fine_range + + def get_gain(self): + return self.gain + + def set_gain(self, gain): + self.gain = gain + + def get_lo_check_interval(self): + return self.lo_check_interval + + def set_lo_check_interval(self, lo_check_interval): + self.lo_check_interval = lo_check_interval + self.set_locked_probe_poll_rate(self.lo_check_interval * float(self.has_lo_locked)) + + def get_lo_offset(self): + return self.lo_offset + + def set_lo_offset(self, lo_offset): + self.lo_offset = lo_offset + self.set_lo_offset_txt(self.lo_offset) + self.set_tune_mode([1,0][self.lo_offset==0.0]) + self.src.set_center_freq(uhd.tune_request(self.freq, self.lo_offset), 0) + self.src.set_center_freq(uhd.tune_request(self.freq, self.lo_offset), 1) + + def get_mag_alpha(self): + return self.mag_alpha + + def set_mag_alpha(self, mag_alpha): + self.mag_alpha = mag_alpha + self.probe_avg_mag.set_alpha(self.mag_alpha) + + def get_peak_hold(self): + return self.peak_hold + + def set_peak_hold(self, peak_hold): + self.peak_hold = peak_hold + self.set_fft_peak_hold(self.str_to_bool(self.peak_hold)) + + def get_pps(self): + return self.pps + + def set_pps(self, pps): + self.pps = pps + self._evalutate_update_time_source(**{'pps': self.pps}) + + def get_probe_interval(self): + return self.probe_interval + + def set_probe_interval(self, probe_interval): + self.probe_interval = probe_interval + self.set_fft_max_idx_poll_rate(self.probe_interval) + self.set_fft_max_lvl_poll_rate(self.probe_interval) + self.set_fft_max_lvl_2_poll_rate(self.probe_interval) + self.set_signal_probe_poll_rate(self.probe_interval) + + def get_rate(self): + return self.rate + + def set_rate(self, rate): + self.rate = rate + self.set_requested_sample_rate_base(self.rate) + + def get_ref(self): + return self.ref + + def set_ref(self, ref): + self.ref = ref + self._evalutate_update_clock_source(**{'ref': self.ref}) + + def get_ref_lvl(self): + return self.ref_lvl + + def set_ref_lvl(self, ref_lvl): + self.ref_lvl = ref_lvl + + def get_sensor_interval(self): + return self.sensor_interval + + def set_sensor_interval(self, sensor_interval): + self.sensor_interval = sensor_interval + self.set_daughterboard_sensor_names_poll_rate(self.sensor_interval) + self.set_motherboard_sensor_names_poll_rate(self.sensor_interval) + self.set_time_probe_poll_rate(self.sensor_interval) + + def get_show_stream_tags(self): + return self.show_stream_tags + + def set_show_stream_tags(self, show_stream_tags): + self.show_stream_tags = show_stream_tags + self.set_show_stream_tags_chk([False, True][self.show_stream_tags.lower() != 'false']) + + def get_spec(self): + return self.spec + + def set_spec(self, spec): + self.spec = spec + + def get_stream_args(self): + return self.stream_args + + def set_stream_args(self, stream_args): + self.stream_args = stream_args + + def get_window(self): + return self.window + + def set_window(self, window): + self.window = window + self.set_variable_static_fft_window_name(self.window_fn_name_map[self.window]) + self.set_window_fn(self.window_fn_map[self.window]) + + def get_wire_format(self): + return self.wire_format + + def set_wire_format(self, wire_format): + self.wire_format = wire_format + + def get_relative_freq(self): + return self.relative_freq + + def set_relative_freq(self, relative_freq): + self.relative_freq = relative_freq + self.set_fft_center_freq(self.actual_center_freq * self.relative_freq) + self._relative_freq_chooser.set_value(self.relative_freq) + + def get_gain_range(self): + return self.gain_range + + def set_gain_range(self, gain_range): + self.gain_range = gain_range + self._run_evaluators_later(('initial_gain', lambda: self._evalutate_initial_gain(**{'gain_range': self.gain_range}))) + + def get_fft_max_idx(self): + return self.fft_max_idx + + def set_fft_max_idx(self, fft_max_idx): + self.fft_max_idx = fft_max_idx + self.set_fft_max_idx_norm([self.fft_max_idx,self.fft_max_idx-self.fft_size][int(self.fft_max_idx>(self.fft_size/2))]) + + def get_actual_sample_rate(self): + return self.actual_sample_rate + + def set_actual_sample_rate(self, actual_sample_rate): + self.actual_sample_rate = actual_sample_rate + self.set_samp_rate(int(self.actual_sample_rate)) + self.set_variable_static_actual_sample_rate(self.actual_sample_rate) + + def get_actual_center_freq(self): + return self.actual_center_freq + + def set_actual_center_freq(self, actual_center_freq): + self.actual_center_freq = actual_center_freq + self.set_fft_center_freq(self.actual_center_freq * self.relative_freq) + + def get_str_to_bool(self): + return self.str_to_bool + + def set_str_to_bool(self, str_to_bool): + self.str_to_bool = str_to_bool + self.set_fft_averaging(self.str_to_bool(self.averaging)) + self.set_fft_peak_hold(self.str_to_bool(self.peak_hold)) + + def get_signal_probe(self): + return self.signal_probe + + def set_signal_probe(self, signal_probe): + self.signal_probe = signal_probe + self.set_signal_probe_log(math.log10([self.signal_probe,1.0][self.signal_probe==0.0])*10) + + def get_samp_rate(self): + return self.samp_rate + + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + self.set_max_bin_freq(self.fft_center_freq + (((1.0*self.fft_max_idx_norm) / self.fft_size) * self.samp_rate)) + self.fft_sink.set_sample_rate(self.samp_rate) + self.fft_sink_two_1.set_sample_rate(self.samp_rate) + self.logpwrfft_x_0.set_sample_rate(self.samp_rate) + self.logpwrfft_x_0_0.set_sample_rate(self.samp_rate) + self.waterfall_sink.set_sample_rate(self.samp_rate) + self.waterfall_sink_0.set_sample_rate(self.samp_rate) + self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate) + self.wxgui_scopesink2_0_0.set_sample_rate(self.samp_rate) + + def get_requested_freq_txt(self): + return self.requested_freq_txt + + def set_requested_freq_txt(self, requested_freq_txt): + self.requested_freq_txt = requested_freq_txt + self.set_requested_freq(self.requested_freq_txt + self.freq_fine) + self._requested_freq_txt_slider.set_value(self.requested_freq_txt) + self._requested_freq_txt_text_box.set_value(self.requested_freq_txt) + + def get_gain_default(self): + return self.gain_default + + def set_gain_default(self, gain_default): + self.gain_default = gain_default + self.set_selected_gain(self.gain_default) + + def get_freq_fine(self): + return self.freq_fine + + def set_freq_fine(self, freq_fine): + self.freq_fine = freq_fine + self._freq_fine_slider.set_value(self.freq_fine) + self._freq_fine_text_box.set_value(self.freq_fine) + self.set_requested_freq(self.requested_freq_txt + self.freq_fine) + + def get_fft_max_idx_norm(self): + return self.fft_max_idx_norm + + def set_fft_max_idx_norm(self, fft_max_idx_norm): + self.fft_max_idx_norm = fft_max_idx_norm + self.set_max_bin_freq(self.fft_center_freq + (((1.0*self.fft_max_idx_norm) / self.fft_size) * self.samp_rate)) + + def get_fft_center_freq(self): + return self.fft_center_freq + + def set_fft_center_freq(self, fft_center_freq): + self.fft_center_freq = fft_center_freq + self.set_max_bin_freq(self.fft_center_freq + (((1.0*self.fft_max_idx_norm) / self.fft_size) * self.samp_rate)) + self.fft_sink.set_baseband_freq(self.fft_center_freq) + self.fft_sink_two_1.set_baseband_freq(self.fft_center_freq) + self.waterfall_sink.set_baseband_freq(self.fft_center_freq) + self.waterfall_sink_0.set_baseband_freq(self.fft_center_freq) + + def get_antennas(self): + return self.antennas + + def set_antennas(self, antennas): + self.antennas = antennas + self.set_selected_antenna([ [self.antenna,self.antennas[0]][self.antenna not in self.antennas] ,self.antennas[0]][self.antenna=='']) + + def get_window_fn_name_map(self): + return self.window_fn_name_map + + def set_window_fn_name_map(self, window_fn_name_map): + self.window_fn_name_map = window_fn_name_map + self.set_variable_static_fft_window_name(self.window_fn_name_map[self.window]) + + def get_window_fn_map(self): + return self.window_fn_map + + def set_window_fn_map(self, window_fn_map): + self.window_fn_map = window_fn_map + self.set_window_fn(self.window_fn_map[self.window]) + + def get_usrp_info(self): + return self.usrp_info + + def set_usrp_info(self, usrp_info): + self.usrp_info = usrp_info + self.set_variable_static_usrp_info(self.usrp_info) + + def get_tune_result(self): + return self.tune_result + + def set_tune_result(self, tune_result): + self.tune_result = tune_result + self.set_variable_static_actual_dsp_freq(self.tune_result.actual_dsp_freq) + self.set_variable_static_rf_freq(self.tune_result.actual_rf_freq) + + def get_tune_mode(self): + return self.tune_mode + + def set_tune_mode(self, tune_mode): + self.tune_mode = tune_mode + self._tune_mode_chooser.set_value(self.tune_mode) + self.set_tune_obj([self.requested_freq, uhd.tune_request(self.requested_freq, self.lo_offset_txt), uhd.tune_request(self.requested_freq, dsp_freq=0, dsp_freq_policy=uhd.tune_request.POLICY_MANUAL)][self.tune_mode]) + + def get_time_probe(self): + return self.time_probe + + def set_time_probe(self, time_probe): + self.time_probe = time_probe + self.set_variable_static_time_now(str( [time.ctime(self.time_probe.get_real_secs()), datetime.timedelta(seconds=self.time_probe.get_real_secs()), time.gmtime(self.time_probe.get_real_secs())] [self.relative_time])) + + def get_test(self): + return self.test + + def set_test(self, test): + self.test = test + self._run_evaluators_later(('any_test_1', lambda: self._evalutate_any_test_1(**{'test': self.test}))) + self._test_chooser.set_value(self.test) + + def get_subdev_spec(self): + return self.subdev_spec + + def set_subdev_spec(self, subdev_spec): + self.subdev_spec = subdev_spec + self.set_variable_static_subdev_spec(self.subdev_spec) + + def get_signal_probe_log(self): + return self.signal_probe_log + + def set_signal_probe_log(self, signal_probe_log): + self.signal_probe_log = signal_probe_log + self.set_variable_static_level_probe(self.signal_probe_log) + + def get_selected_gain(self): + return self.selected_gain + + def set_selected_gain(self, selected_gain): + self.selected_gain = selected_gain + self._selected_gain_slider.set_value(self.selected_gain) + self._selected_gain_text_box.set_value(self.selected_gain) + self.set_selected_gain_proxy(self.selected_gain) + + def get_selected_antenna(self): + return self.selected_antenna + + def set_selected_antenna(self, selected_antenna): + self.selected_antenna = selected_antenna + self._selected_antenna_chooser.set_value(self.selected_antenna) + self.set_selected_antenna_proxy(self.selected_antenna) + + def get_requested_sample_rate_base(self): + return self.requested_sample_rate_base + + def set_requested_sample_rate_base(self, requested_sample_rate_base): + self.requested_sample_rate_base = requested_sample_rate_base + self.set_requested_sample_rate(self.requested_sample_rate_base / (1.*self.decim)) + self._requested_sample_rate_base_text_box.set_value(self.requested_sample_rate_base) + + def get_requested_freq(self): + return self.requested_freq + + def set_requested_freq(self, requested_freq): + self.requested_freq = requested_freq + self.set_tune_obj([self.requested_freq, uhd.tune_request(self.requested_freq, self.lo_offset_txt), uhd.tune_request(self.requested_freq, dsp_freq=0, dsp_freq_policy=uhd.tune_request.POLICY_MANUAL)][self.tune_mode]) + self.set_variable_static_requested_freq(self.requested_freq) + + def get_relative_time(self): + return self.relative_time + + def set_relative_time(self, relative_time): + self.relative_time = relative_time + self._relative_time_chooser.set_value(self.relative_time) + self.set_variable_static_time_now(str( [time.ctime(self.time_probe.get_real_secs()), datetime.timedelta(seconds=self.time_probe.get_real_secs()), time.gmtime(self.time_probe.get_real_secs())] [self.relative_time])) + + def get_motherboard_sensors(self): + return self.motherboard_sensors + + def set_motherboard_sensors(self, motherboard_sensors): + self.motherboard_sensors = motherboard_sensors + self.set_variable_static_text_0(self.motherboard_sensors) + + def get_max_bin_freq(self): + return self.max_bin_freq + + def set_max_bin_freq(self, max_bin_freq): + self.max_bin_freq = max_bin_freq + self.set_variable_static_max_bin_freq(self.max_bin_freq) + + def get_locked_probe(self): + return self.locked_probe + + def set_locked_probe(self, locked_probe): + self.locked_probe = locked_probe + self.set_static_locked('"' + str(self.locked_probe) + '"') + + def get_lo_offset_txt(self): + return self.lo_offset_txt + + def set_lo_offset_txt(self, lo_offset_txt): + self.lo_offset_txt = lo_offset_txt + self._lo_offset_txt_text_box.set_value(self.lo_offset_txt) + self.set_tune_obj([self.requested_freq, uhd.tune_request(self.requested_freq, self.lo_offset_txt), uhd.tune_request(self.requested_freq, dsp_freq=0, dsp_freq_policy=uhd.tune_request.POLICY_MANUAL)][self.tune_mode]) + + def get_fft_peak_hold(self): + return self.fft_peak_hold + + def set_fft_peak_hold(self, fft_peak_hold): + self.fft_peak_hold = fft_peak_hold + self._run_evaluators_later(('variable_any_code_fft_sink_peak_hold', lambda: self._evalutate_variable_any_code_fft_sink_peak_hold(**{'peak_hold': self.fft_peak_hold}))) + + def get_fft_max_lvl_2(self): + return self.fft_max_lvl_2 + + def set_fft_max_lvl_2(self, fft_max_lvl_2): + self.fft_max_lvl_2 = fft_max_lvl_2 + self.set_fft_max_lvl_value_2(self.fft_max_lvl_2) + + def get_fft_max_lvl(self): + return self.fft_max_lvl + + def set_fft_max_lvl(self, fft_max_lvl): + self.fft_max_lvl = fft_max_lvl + self.set_fft_max_lvl_value(self.fft_max_lvl) + self.set_variable_static_fft_max_lvl_log(self.fft_max_lvl) + + def get_fft_averaging(self): + return self.fft_averaging + + def set_fft_averaging(self, fft_averaging): + self.fft_averaging = fft_averaging + self._run_evaluators_later(('variable_any_code_fft_sink_ave', lambda: self._evalutate_variable_any_code_fft_sink_ave(**{'averaging': self.fft_averaging}))) + self._run_evaluators_later(('variable_any_code_waterfall_ave', lambda: self._evalutate_variable_any_code_waterfall_ave(**{'averaging': self.fft_averaging}))) + + def get_decim(self): + return self.decim + + def set_decim(self, decim): + self.decim = decim + self._decim_slider.set_value(self.decim) + self._decim_text_box.set_value(self.decim) + self.set_requested_sample_rate(self.requested_sample_rate_base / (1.*self.decim)) + + def get_daughterboard_sensors(self): + return self.daughterboard_sensors + + def set_daughterboard_sensors(self, daughterboard_sensors): + self.daughterboard_sensors = daughterboard_sensors + self.set_variable_static_text_0_0(self.daughterboard_sensors) + + def get_clicked_freq(self): + return self.clicked_freq + + def set_clicked_freq(self, clicked_freq): + self.clicked_freq = clicked_freq + self.set_clicked_freq_txt(self.clicked_freq) + + def get_window_fn(self): + return self.window_fn + + def set_window_fn(self, window_fn): + self.window_fn = window_fn + + def get_variable_static_usrp_info(self): + return self.variable_static_usrp_info + + def set_variable_static_usrp_info(self, variable_static_usrp_info): + self.variable_static_usrp_info = variable_static_usrp_info + self._variable_static_usrp_info_static_text.set_value(self.variable_static_usrp_info) + + def get_variable_static_time_now(self): + return self.variable_static_time_now + + def set_variable_static_time_now(self, variable_static_time_now): + self.variable_static_time_now = variable_static_time_now + self._variable_static_time_now_static_text.set_value(self.variable_static_time_now) + + def get_variable_static_text_0_0(self): + return self.variable_static_text_0_0 + + def set_variable_static_text_0_0(self, variable_static_text_0_0): + self.variable_static_text_0_0 = variable_static_text_0_0 + self._variable_static_text_0_0_static_text.set_value(self.variable_static_text_0_0) + + def get_variable_static_text_0(self): + return self.variable_static_text_0 + + def set_variable_static_text_0(self, variable_static_text_0): + self.variable_static_text_0 = variable_static_text_0 + self._variable_static_text_0_static_text.set_value(self.variable_static_text_0) + + def get_variable_static_subdev_spec(self): + return self.variable_static_subdev_spec + + def set_variable_static_subdev_spec(self, variable_static_subdev_spec): + self.variable_static_subdev_spec = variable_static_subdev_spec + self._variable_static_subdev_spec_static_text.set_value(self.variable_static_subdev_spec) + + def get_variable_static_rf_freq(self): + return self.variable_static_rf_freq + + def set_variable_static_rf_freq(self, variable_static_rf_freq): + self.variable_static_rf_freq = variable_static_rf_freq + self._variable_static_rf_freq_static_text.set_value(self.variable_static_rf_freq) + + def get_variable_static_requested_freq(self): + return self.variable_static_requested_freq + + def set_variable_static_requested_freq(self, variable_static_requested_freq): + self.variable_static_requested_freq = variable_static_requested_freq + self._variable_static_requested_freq_static_text.set_value(self.variable_static_requested_freq) + + def get_variable_static_max_bin_freq(self): + return self.variable_static_max_bin_freq + + def set_variable_static_max_bin_freq(self, variable_static_max_bin_freq): + self.variable_static_max_bin_freq = variable_static_max_bin_freq + self._variable_static_max_bin_freq_static_text.set_value(self.variable_static_max_bin_freq) + + def get_variable_static_level_probe(self): + return self.variable_static_level_probe + + def set_variable_static_level_probe(self, variable_static_level_probe): + self.variable_static_level_probe = variable_static_level_probe + self._variable_static_level_probe_static_text.set_value(self.variable_static_level_probe) + + def get_variable_static_fft_window_name(self): + return self.variable_static_fft_window_name + + def set_variable_static_fft_window_name(self, variable_static_fft_window_name): + self.variable_static_fft_window_name = variable_static_fft_window_name + self._variable_static_fft_window_name_static_text.set_value(self.variable_static_fft_window_name) + + def get_variable_static_fft_max_lvl_log(self): + return self.variable_static_fft_max_lvl_log + + def set_variable_static_fft_max_lvl_log(self, variable_static_fft_max_lvl_log): + self.variable_static_fft_max_lvl_log = variable_static_fft_max_lvl_log + self._variable_static_fft_max_lvl_log_static_text.set_value(self.variable_static_fft_max_lvl_log) + + def get_variable_static_actual_sample_rate(self): + return self.variable_static_actual_sample_rate + + def set_variable_static_actual_sample_rate(self, variable_static_actual_sample_rate): + self.variable_static_actual_sample_rate = variable_static_actual_sample_rate + self._variable_static_actual_sample_rate_static_text.set_value(self.variable_static_actual_sample_rate) + + def get_variable_static_actual_dsp_freq(self): + return self.variable_static_actual_dsp_freq + + def set_variable_static_actual_dsp_freq(self, variable_static_actual_dsp_freq): + self.variable_static_actual_dsp_freq = variable_static_actual_dsp_freq + self._variable_static_actual_dsp_freq_static_text.set_value(self.variable_static_actual_dsp_freq) + + def get_variable_any_code_waterfall_ave(self): + return self.variable_any_code_waterfall_ave + + def set_variable_any_code_waterfall_ave(self, variable_any_code_waterfall_ave): + self.variable_any_code_waterfall_ave = variable_any_code_waterfall_ave + + def get_variable_any_code_iq_correction(self): + return self.variable_any_code_iq_correction + + def set_variable_any_code_iq_correction(self, variable_any_code_iq_correction): + self.variable_any_code_iq_correction = variable_any_code_iq_correction + + def get_variable_any_code_fft_sink_peak_hold(self): + return self.variable_any_code_fft_sink_peak_hold + + def set_variable_any_code_fft_sink_peak_hold(self, variable_any_code_fft_sink_peak_hold): + self.variable_any_code_fft_sink_peak_hold = variable_any_code_fft_sink_peak_hold + + def get_variable_any_code_fft_sink_ave(self): + return self.variable_any_code_fft_sink_ave + + def set_variable_any_code_fft_sink_ave(self, variable_any_code_fft_sink_ave): + self.variable_any_code_fft_sink_ave = variable_any_code_fft_sink_ave + + def get_variable_any_code_auto_dc_offset_removal(self): + return self.variable_any_code_auto_dc_offset_removal + + def set_variable_any_code_auto_dc_offset_removal(self, variable_any_code_auto_dc_offset_removal): + self.variable_any_code_auto_dc_offset_removal = variable_any_code_auto_dc_offset_removal + + def get_update_time_source(self): + return self.update_time_source + + def set_update_time_source(self, update_time_source): + self.update_time_source = update_time_source + + def get_update_clock_source(self): + return self.update_clock_source + + def set_update_clock_source(self, update_clock_source): + self.update_clock_source = update_clock_source + + def get_tune_obj(self): + return self.tune_obj + + def set_tune_obj(self, tune_obj): + self.tune_obj = tune_obj + self._run_evaluators_later(('actual_center_freq', lambda: self._evalutate_actual_center_freq(**{'tune_obj': self.tune_obj}))) + self._run_evaluators_later(('tune_result', lambda: self._evalutate_tune_result(**{'tune_obj': self.tune_obj}))) + + def get_static_locked(self): + return self.static_locked + + def set_static_locked(self, static_locked): + self.static_locked = static_locked + self._static_locked_static_text.set_value(self.static_locked) + + def get_show_stream_tags_chk(self): + return self.show_stream_tags_chk + + def set_show_stream_tags_chk(self, show_stream_tags_chk): + self.show_stream_tags_chk = show_stream_tags_chk + self._show_stream_tags_chk_check_box.set_value(self.show_stream_tags_chk) + self.blocks_tag_debug_0.set_display(self.show_stream_tags_chk) + + def get_show_max_lvl(self): + return self.show_max_lvl + + def set_show_max_lvl(self, show_max_lvl): + self.show_max_lvl = show_max_lvl + self._show_max_lvl_check_box.set_value(self.show_max_lvl) + + def get_show_max_freq(self): + return self.show_max_freq + + def set_show_max_freq(self, show_max_freq): + self.show_max_freq = show_max_freq + self._show_max_freq_check_box.set_value(self.show_max_freq) + + def get_selected_gain_proxy(self): + return self.selected_gain_proxy + + def set_selected_gain_proxy(self, selected_gain_proxy): + self.selected_gain_proxy = selected_gain_proxy + self.src.set_gain(self.selected_gain_proxy, 0) + self.src.set_gain(self.selected_gain_proxy, 1) + + def get_selected_antenna_proxy(self): + return self.selected_antenna_proxy + + def set_selected_antenna_proxy(self, selected_antenna_proxy): + self.selected_antenna_proxy = selected_antenna_proxy + self.src.set_antenna(self.selected_antenna_proxy, 0) + self.src.set_antenna(self.selected_antenna_proxy, 1) + + def get_scope_mode_2(self): + return self.scope_mode_2 + + def set_scope_mode_2(self, scope_mode_2): + self.scope_mode_2 = scope_mode_2 + self._scope_mode_2_chooser.set_value(self.scope_mode_2) + self.blks2_selector_0_0_0.set_output_index(int(self.scope_mode_2)) + self.blks2_selector_0_1.set_input_index(int(self.scope_mode_2)) + + def get_scope_mode(self): + return self.scope_mode + + def set_scope_mode(self, scope_mode): + self.scope_mode = scope_mode + self._scope_mode_chooser.set_value(self.scope_mode) + self.blks2_selector_0.set_input_index(int(self.scope_mode)) + self.blks2_selector_0_0.set_output_index(int(self.scope_mode)) + + def get_requested_sample_rate(self): + return self.requested_sample_rate + + def set_requested_sample_rate(self, requested_sample_rate): + self.requested_sample_rate = requested_sample_rate + self._run_evaluators_later(('actual_sample_rate', lambda: self._evalutate_actual_sample_rate(**{'requested_sample_rate': self.requested_sample_rate}))) + self.src.set_samp_rate(self.requested_sample_rate) + + def get_motherboard_sensor_names(self): + return self.motherboard_sensor_names + + def set_motherboard_sensor_names(self, motherboard_sensor_names): + self.motherboard_sensor_names = motherboard_sensor_names + self._run_evaluators_later(('motherboard_sensors', lambda: self._evalutate_motherboard_sensors(**{'motherboard_sensor_names': self.motherboard_sensor_names}))) + + def get_max_decim(self): + return self.max_decim + + def set_max_decim(self, max_decim): + self.max_decim = max_decim + + def get_initial_gain(self): + return self.initial_gain + + def set_initial_gain(self, initial_gain): + self.initial_gain = initial_gain + self._run_evaluators_later(('gain_default', lambda: self._evalutate_gain_default(**{'initial_gain': self.initial_gain}))) + + def get_has_lo_locked(self): + return self.has_lo_locked + + def set_has_lo_locked(self, has_lo_locked): + self.has_lo_locked = has_lo_locked + self.set_locked_probe_poll_rate(self.lo_check_interval * float(self.has_lo_locked)) + + def get_freq_range(self): + return self.freq_range + + def set_freq_range(self, freq_range): + self.freq_range = freq_range + + def get_fix_invalid_freq(self): + return self.fix_invalid_freq + + def set_fix_invalid_freq(self, fix_invalid_freq): + self.fix_invalid_freq = fix_invalid_freq + + def get_fft_max_lvl_value_2(self): + return self.fft_max_lvl_value_2 + + def set_fft_max_lvl_value_2(self, fft_max_lvl_value_2): + self.fft_max_lvl_value_2 = fft_max_lvl_value_2 + + def get_fft_max_lvl_value(self): + return self.fft_max_lvl_value + + def set_fft_max_lvl_value(self, fft_max_lvl_value): + self.fft_max_lvl_value = fft_max_lvl_value + + def get_fft_ave_probe(self): + return self.fft_ave_probe + + def set_fft_ave_probe(self, fft_ave_probe): + self.fft_ave_probe = fft_ave_probe + self.logpwrfft_x_0.set_avg_alpha(self.fft_ave_probe) + self.logpwrfft_x_0_0.set_avg_alpha(self.fft_ave_probe) + + def get_daughterboard_sensor_names(self): + return self.daughterboard_sensor_names + + def set_daughterboard_sensor_names(self, daughterboard_sensor_names): + self.daughterboard_sensor_names = daughterboard_sensor_names + self._run_evaluators_later(('daughterboard_sensors', lambda: self._evalutate_daughterboard_sensors(**{'daughterboard_sensor_names': self.daughterboard_sensor_names}))) + + def get_clicked_freq_txt(self): + return self.clicked_freq_txt + + def set_clicked_freq_txt(self, clicked_freq_txt): + self.clicked_freq_txt = clicked_freq_txt + self._clicked_freq_txt_text_box.set_value(self.clicked_freq_txt) + + def get_auto_iq_correction(self): + return self.auto_iq_correction + + def set_auto_iq_correction(self, auto_iq_correction): + self.auto_iq_correction = auto_iq_correction + self._auto_iq_correction_check_box.set_value(self.auto_iq_correction) + self._run_evaluators_later(('variable_any_code_iq_correction', lambda: self._evalutate_variable_any_code_iq_correction(**{'auto_iq_correction': self.auto_iq_correction}))) + + def get_auto_dc_offset_removal(self): + return self.auto_dc_offset_removal + + def set_auto_dc_offset_removal(self, auto_dc_offset_removal): + self.auto_dc_offset_removal = auto_dc_offset_removal + self._auto_dc_offset_removal_check_box.set_value(self.auto_dc_offset_removal) + self._run_evaluators_later(('variable_any_code_auto_dc_offset_removal', lambda: self._evalutate_variable_any_code_auto_dc_offset_removal(**{'auto_dc_offset_removal': self.auto_dc_offset_removal}))) + + def get_any_test_1(self): + return self.any_test_1 + + def set_any_test_1(self, any_test_1): + self.any_test_1 = any_test_1 + + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + parser.add_option("-A", "--antenna", dest="antenna", type="string", default="", + help="Set Antenna (blank for default) [default=%default]") + parser.add_option("-a", "--args", dest="args", type="string", default="", + help="Set UHD device args [default=%default]") + parser.add_option("", "--ave", dest="ave", type="eng_float", default=eng_notation.num_to_str(1*0 + 0.5), + help="Set Average FFT [default=%default]") + parser.add_option("", "--averaging", dest="averaging", type="string", default="True", + help="Set Enable FFT averaging [default=%default]") + parser.add_option("", "--bw", dest="bw", type="eng_float", default=eng_notation.num_to_str(0), + help="Set Daughterboard bandwidth (where appropriate) [default=%default]") + parser.add_option("", "--dyn-rng", dest="dyn_rng", type="eng_float", default=eng_notation.num_to_str(130), + help="Set Dynamic Range [default=%default]") + parser.add_option("", "--fft-rate", dest="fft_rate", type="intx", default=15, + help="Set FFT Rate [default=%default]") + parser.add_option("", "--fft-ref-scale", dest="fft_ref_scale", type="eng_float", default=eng_notation.num_to_str(2.0), + help="Set FFT Ref Scale (p2p) [default=%default]") + parser.add_option("", "--fft-size", dest="fft_size", type="intx", default=1024, + help="Set FFT Size [default=%default]") + parser.add_option("-f", "--freq", dest="freq", type="eng_float", default=eng_notation.num_to_str(0 + 100e6), + help="Set Frequency [default=%default]") + parser.add_option("", "--freq-fine-range", dest="freq_fine_range", type="eng_float", default=eng_notation.num_to_str(2e6), + help="Set Fine frequency slider range [default=%default]") + parser.add_option("-g", "--gain", dest="gain", type="eng_float", default=eng_notation.num_to_str(float("-inf")), + help="Set Gain (default '-inf' selects relative gain of 25%) [default=%default]") + parser.add_option("", "--lo-check-interval", dest="lo_check_interval", type="eng_float", default=eng_notation.num_to_str(5), + help="Set LO lock check frequency (Hz) [default=%default]") + parser.add_option("", "--lo-offset", dest="lo_offset", type="eng_float", default=eng_notation.num_to_str(0), + help="Set LO offset (selects LO offset tuning mode) [default=%default]") + parser.add_option("", "--mag-alpha", dest="mag_alpha", type="eng_float", default=eng_notation.num_to_str(1e-3), + help="Set Signal magnitude probe alpha [default=%default]") + parser.add_option("", "--peak-hold", dest="peak_hold", type="string", default="False", + help="Set FFT peak hold [default=%default]") + parser.add_option("", "--pps", dest="pps", type="string", default='', + help="Set Time source (none, internal, external, mimo, gpsdo). leaves it at the default. [default=%default]") + parser.add_option("", "--probe-interval", dest="probe_interval", type="eng_float", default=eng_notation.num_to_str(3), + help="Set Signal probe frequency (Hz) [default=%default]") + parser.add_option("-s", "--rate", dest="rate", type="eng_float", default=eng_notation.num_to_str(1e6), + help="Set Sample Rate [default=%default]") + parser.add_option("", "--ref", dest="ref", type="string", default='', + help="Set Clock source (internal, external, mimo, gpsdo). leaves it at the default. [default=%default]") + parser.add_option("", "--ref-lvl", dest="ref_lvl", type="eng_float", default=eng_notation.num_to_str(0), + help="Set Reference Level [default=%default]") + parser.add_option("", "--sensor-interval", dest="sensor_interval", type="eng_float", default=eng_notation.num_to_str(2), + help="Set Sensor update frequency (Hz) [default=%default]") + parser.add_option("", "--show-stream-tags", dest="show_stream_tags", type="string", default="False", + help="Set Print stream tags [default=%default]") + parser.add_option("", "--spec", dest="spec", type="string", default='', + help="Set Sub-device specification (where appropriate) [default=%default]") + parser.add_option("", "--stream-args", dest="stream_args", type="string", default="", + help="Set Stream arguments (e.g. scalar=1024) [default=%default]") + parser.add_option("", "--window", dest="window", type="string", default="auto", + help="Set Window (bh: Blackman-Harris, ham: Hamming, han: Hanning, rect: Rectangular, flat: Flattop) [default=%default]") + parser.add_option("", "--wire-format", dest="wire_format", type="string", default="", + help="Set Wire format (e.g. sc16, sc8) [blank = automatic] [default=%default]") + (options, args) = parser.parse_args() + if gr.enable_realtime_scheduling() != gr.RT_OK: + print "Error: failed to enable realtime scheduling." + tb = mega_fft_2ch(antenna=options.antenna, args=options.args, ave=options.ave, averaging=options.averaging, bw=options.bw, dyn_rng=options.dyn_rng, fft_rate=options.fft_rate, fft_ref_scale=options.fft_ref_scale, fft_size=options.fft_size, freq=options.freq, freq_fine_range=options.freq_fine_range, gain=options.gain, lo_check_interval=options.lo_check_interval, lo_offset=options.lo_offset, mag_alpha=options.mag_alpha, peak_hold=options.peak_hold, pps=options.pps, probe_interval=options.probe_interval, rate=options.rate, ref=options.ref, ref_lvl=options.ref_lvl, sensor_interval=options.sensor_interval, show_stream_tags=options.show_stream_tags, spec=options.spec, stream_args=options.stream_args, window=options.window, wire_format=options.wire_format) + tb.Start(True) + tb.Wait() -- cgit v1.2.3