def __init__(self): gr.top_block.__init__( self, "NsfIntegrate: Average+Record Astronomical Obs.") Qt.QWidget.__init__(self) self.setWindowTitle("NsfIntegrate: Average+Record Astronomical Obs.") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "NsfIntegrate64") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.ObsName = ObsName = "Integrate64" self.ConfigFile = ConfigFile = ObsName + ".conf" self._Frequencys_config = ConfigParser.ConfigParser() self._Frequencys_config.read(ConfigFile) try: Frequencys = self._Frequencys_config.getfloat('main', 'Frequency') except: Frequencys = 1420.4e6 self.Frequencys = Frequencys self._Bandwidths_config = ConfigParser.ConfigParser() self._Bandwidths_config.read(ConfigFile) try: Bandwidths = self._Bandwidths_config.getfloat('main', 'Bandwidth') except: Bandwidths = 6.4e6 self.Bandwidths = Bandwidths self._fftsize_save_config = ConfigParser.ConfigParser() self._fftsize_save_config.read(ConfigFile) try: fftsize_save = self._fftsize_save_config.getint('main', 'fftsize') except: fftsize_save = 1024 self.fftsize_save = fftsize_save self.Frequency = Frequency = Frequencys self.Bandwidth = Bandwidth = Bandwidths self._xaxis_save_config = ConfigParser.ConfigParser() self._xaxis_save_config.read(ConfigFile) try: xaxis_save = self._xaxis_save_config.getint('main', 'Xaxis') except: xaxis_save = 0 self.xaxis_save = xaxis_save self._telescope_save_config = ConfigParser.ConfigParser() self._telescope_save_config.read(ConfigFile) try: telescope_save = self._telescope_save_config.get( 'main', 'telescope') except: telescope_save = 'Bubble Wrap Horn' self.telescope_save = telescope_save self._observers_save_config = ConfigParser.ConfigParser() self._observers_save_config.read(ConfigFile) try: observers_save = self._observers_save_config.get( 'main', 'observers') except: observers_save = 'Science Aficionado' self.observers_save = observers_save self.numin = numin = (Frequency - (Bandwidth / 2.)) self._nAves_config = ConfigParser.ConfigParser() self._nAves_config.read(ConfigFile) try: nAves = self._nAves_config.getint('main', 'nave') except: nAves = 20 self.nAves = nAves self.fftsize = fftsize = fftsize_save self._device_save_config = ConfigParser.ConfigParser() self._device_save_config.read(ConfigFile) try: device_save = self._device_save_config.get('main', 'device') except: device_save = 'airspy,bias=1,pack=1' self.device_save = device_save self.H1 = H1 = 1420.406E6 self._Gain1s_config = ConfigParser.ConfigParser() self._Gain1s_config.read(ConfigFile) try: Gain1s = self._Gain1s_config.getfloat('main', 'gain1') except: Gain1s = 49. self.Gain1s = Gain1s self._Elevation_save_config = ConfigParser.ConfigParser() self._Elevation_save_config.read(ConfigFile) try: Elevation_save = self._Elevation_save_config.getfloat( 'main', 'elevation') except: Elevation_save = 90. self.Elevation_save = Elevation_save self._Azimuth_save_config = ConfigParser.ConfigParser() self._Azimuth_save_config.read(ConfigFile) try: Azimuth_save = self._Azimuth_save_config.getfloat( 'main', 'azimuth') except: Azimuth_save = 90. self.Azimuth_save = Azimuth_save self.yunits = yunits = [ "Counts", "Power (dB)", "Intensity (Kelvins)", "Intensity(K)" ] self.ymins = ymins = [0.01, -20, 90., -.5] self.ymaxs = ymaxs = [5., 10., 180., 80.] self.xsteps = xsteps = [ Bandwidth * 1.E-6 / fftsize, -Bandwidth * 3.E5 / (H1 * fftsize), 1 ] self.xmins = xmins = [numin * 1E-6, (H1 - numin) * (3E5 / H1), 0] self._xaxis_save_0_config = ConfigParser.ConfigParser() self._xaxis_save_0_config.read(ConfigFile) try: xaxis_save_0 = self._xaxis_save_0_config.getint('main', 'Xaxis') except: xaxis_save_0 = 0 self.xaxis_save_0 = xaxis_save_0 self.units = units = 0 self.obstype = obstype = 0 self.observer = observer = observers_save self.nAve = nAve = nAves self.Xaxis = Xaxis = xaxis_save self.Telescope = Telescope = telescope_save self.Record = Record = 1 self.Gain2 = Gain2 = 12. self.Gain1 = Gain1 = Gain1s self.Elevation = Elevation = Elevation_save self.Device = Device = device_save self.Azimuth = Azimuth = Azimuth_save ################################################## # Blocks ################################################## self._units_options = ( 0, 1, 2, 3, ) self._units_labels = ( 'Counts', 'dB', 'Kelvins', 'K - Fit', ) self._units_tool_bar = Qt.QToolBar(self) self._units_tool_bar.addWidget(Qt.QLabel('Units' + ": ")) self._units_combo_box = Qt.QComboBox() self._units_tool_bar.addWidget(self._units_combo_box) for label in self._units_labels: self._units_combo_box.addItem(label) self._units_callback = lambda i: Qt.QMetaObject.invokeMethod( self._units_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._units_options.index(i))) self._units_callback(self.units) self._units_combo_box.currentIndexChanged.connect( lambda i: self.set_units(self._units_options[i])) self.top_grid_layout.addWidget(self._units_tool_bar, 7, 0, 1, 1) for r in range(7, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._obstype_options = ( 0, 1, 3, ) self._obstype_labels = ( 'Survey', 'Hot/Cold', 'Ref', ) self._obstype_tool_bar = Qt.QToolBar(self) self._obstype_tool_bar.addWidget(Qt.QLabel('Obs' + ": ")) self._obstype_combo_box = Qt.QComboBox() self._obstype_tool_bar.addWidget(self._obstype_combo_box) for label in self._obstype_labels: self._obstype_combo_box.addItem(label) self._obstype_callback = lambda i: Qt.QMetaObject.invokeMethod( self._obstype_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._obstype_options.index(i))) self._obstype_callback(self.obstype) self._obstype_combo_box.currentIndexChanged.connect( lambda i: self.set_obstype(self._obstype_options[i])) self.top_grid_layout.addWidget(self._obstype_tool_bar, 6, 0, 1, 1) for r in range(6, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._observer_tool_bar = Qt.QToolBar(self) self._observer_tool_bar.addWidget(Qt.QLabel('Who' + ": ")) self._observer_line_edit = Qt.QLineEdit(str(self.observer)) self._observer_tool_bar.addWidget(self._observer_line_edit) self._observer_line_edit.returnPressed.connect( lambda: self.set_observer( str(str(self._observer_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._observer_tool_bar, 0, 0, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._nAve_tool_bar = Qt.QToolBar(self) self._nAve_tool_bar.addWidget(Qt.QLabel('N_Ave.' + ": ")) self._nAve_line_edit = Qt.QLineEdit(str(self.nAve)) self._nAve_tool_bar.addWidget(self._nAve_line_edit) self._nAve_line_edit.returnPressed.connect(lambda: self.set_nAve( int(str(self._nAve_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._nAve_tool_bar, 0, 2, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._fftsize_tool_bar = Qt.QToolBar(self) self._fftsize_tool_bar.addWidget(Qt.QLabel('FFT_size' + ": ")) self._fftsize_line_edit = Qt.QLineEdit(str(self.fftsize)) self._fftsize_tool_bar.addWidget(self._fftsize_line_edit) self._fftsize_line_edit.returnPressed.connect(lambda: self.set_fftsize( int(str(self._fftsize_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._fftsize_tool_bar, 1, 2, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._Xaxis_options = ( 0, 1, 2, ) self._Xaxis_labels = ( 'Frequency (MHz)', 'Velocity (km/sec)', 'Channels', ) self._Xaxis_tool_bar = Qt.QToolBar(self) self._Xaxis_tool_bar.addWidget(Qt.QLabel('Xaxis' + ": ")) self._Xaxis_combo_box = Qt.QComboBox() self._Xaxis_tool_bar.addWidget(self._Xaxis_combo_box) for label in self._Xaxis_labels: self._Xaxis_combo_box.addItem(label) self._Xaxis_callback = lambda i: Qt.QMetaObject.invokeMethod( self._Xaxis_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._Xaxis_options.index(i))) self._Xaxis_callback(self.Xaxis) self._Xaxis_combo_box.currentIndexChanged.connect( lambda i: self.set_Xaxis(self._Xaxis_options[i])) self.top_grid_layout.addWidget(self._Xaxis_tool_bar, 7, 4, 1, 2) for r in range(7, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._Record_options = ( 0, 1, 2, ) self._Record_labels = ( '! ! Wait ! !', 'AVERAGE', 'Save', ) self._Record_tool_bar = Qt.QToolBar(self) self._Record_tool_bar.addWidget(Qt.QLabel('Rec' + ": ")) self._Record_combo_box = Qt.QComboBox() self._Record_tool_bar.addWidget(self._Record_combo_box) for label in self._Record_labels: self._Record_combo_box.addItem(label) self._Record_callback = lambda i: Qt.QMetaObject.invokeMethod( self._Record_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._Record_options.index(i))) self._Record_callback(self.Record) self._Record_combo_box.currentIndexChanged.connect( lambda i: self.set_Record(self._Record_options[i])) self.top_grid_layout.addWidget(self._Record_tool_bar, 5, 0, 1, 1) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._Gain1_tool_bar = Qt.QToolBar(self) self._Gain1_tool_bar.addWidget(Qt.QLabel('Gain1' + ": ")) self._Gain1_line_edit = Qt.QLineEdit(str(self.Gain1)) self._Gain1_tool_bar.addWidget(self._Gain1_line_edit) self._Gain1_line_edit.returnPressed.connect(lambda: self.set_Gain1( eng_notation.str_to_num(str(self._Gain1_line_edit.text().toAscii()) ))) self.top_grid_layout.addWidget(self._Gain1_tool_bar, 3, 0, 1, 1) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._Frequency_tool_bar = Qt.QToolBar(self) self._Frequency_tool_bar.addWidget(Qt.QLabel('Freq. Hz' + ": ")) self._Frequency_line_edit = Qt.QLineEdit(str(self.Frequency)) self._Frequency_tool_bar.addWidget(self._Frequency_line_edit) self._Frequency_line_edit.returnPressed.connect( lambda: self.set_Frequency( eng_notation.str_to_num( str(self._Frequency_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._Frequency_tool_bar, 0, 5, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 7): self.top_grid_layout.setColumnStretch(c, 1) self._Elevation_tool_bar = Qt.QToolBar(self) self._Elevation_tool_bar.addWidget(Qt.QLabel('Elevation' + ": ")) self._Elevation_line_edit = Qt.QLineEdit(str(self.Elevation)) self._Elevation_tool_bar.addWidget(self._Elevation_line_edit) self._Elevation_line_edit.returnPressed.connect( lambda: self.set_Elevation( eng_notation.str_to_num( str(self._Elevation_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._Elevation_tool_bar, 1, 7, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 9): self.top_grid_layout.setColumnStretch(c, 1) self._Bandwidth_tool_bar = Qt.QToolBar(self) self._Bandwidth_tool_bar.addWidget(Qt.QLabel('Bandwidth' + ": ")) self._Bandwidth_line_edit = Qt.QLineEdit(str(self.Bandwidth)) self._Bandwidth_tool_bar.addWidget(self._Bandwidth_line_edit) self._Bandwidth_line_edit.returnPressed.connect( lambda: self.set_Bandwidth( eng_notation.str_to_num( str(self._Bandwidth_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._Bandwidth_tool_bar, 1, 5, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 7): self.top_grid_layout.setColumnStretch(c, 1) self._Azimuth_tool_bar = Qt.QToolBar(self) self._Azimuth_tool_bar.addWidget(Qt.QLabel('Azimuth' + ": ")) self._Azimuth_line_edit = Qt.QLineEdit(str(self.Azimuth)) self._Azimuth_tool_bar.addWidget(self._Azimuth_line_edit) self._Azimuth_line_edit.returnPressed.connect(lambda: self.set_Azimuth( eng_notation.str_to_num( str(self._Azimuth_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._Azimuth_tool_bar, 0, 7, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 9): self.top_grid_layout.setColumnStretch(c, 1) self.radio_astro_vmedian_0_0_1 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_ra_integrate_1 = radio_astro.ra_integrate( ObsName + ".not", observers_save, fftsize, Frequencys, Bandwidths, Azimuth, Elevation, Record, obstype, int(4**5), units, 295., 10.) self.radio_astro_ra_ascii_sink_0 = radio_astro.ra_ascii_sink( ObsName + ".not", observer, fftsize, Frequencys, Bandwidths, Azimuth, Elevation, Record, obstype, 4**5, nAve, telescope_save, device_save, float(Gain1), float(Gain2), float(Gain2)) self.qtgui_vector_sink_f_0_0 = qtgui.vector_sink_f( fftsize, xmins[Xaxis], xsteps[Xaxis], "", 'Intensity', "", 5 # Number of inputs ) self.qtgui_vector_sink_f_0_0.set_update_time(.5) self.qtgui_vector_sink_f_0_0.set_y_axis(ymins[units], ymaxs[units]) self.qtgui_vector_sink_f_0_0.enable_autoscale(False) self.qtgui_vector_sink_f_0_0.enable_grid(False) self.qtgui_vector_sink_f_0_0.set_x_axis_units("") self.qtgui_vector_sink_f_0_0.set_y_axis_units("") self.qtgui_vector_sink_f_0_0.set_ref_level( 0.5 * (ymins[units] + ymaxs[units])) labels = ['Latest', 'Median', 'Hot', 'Cold', 'Ref', '', '', '', '', ''] widths = [1, 3, 2, 2, 3, 1, 1, 1, 1, 1] colors = [ "gold", "dark green", "red", "blue", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [2., 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(5): if len(labels[i]) == 0: self.qtgui_vector_sink_f_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_vector_sink_f_0_0.set_line_label(i, labels[i]) self.qtgui_vector_sink_f_0_0.set_line_width(i, widths[i]) self.qtgui_vector_sink_f_0_0.set_line_color(i, colors[i]) self.qtgui_vector_sink_f_0_0.set_line_alpha(i, alphas[i]) self._qtgui_vector_sink_f_0_0_win = sip.wrapinstance( self.qtgui_vector_sink_f_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_vector_sink_f_0_0_win, 2, 2, 5, 6) for r in range(2, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1) self.qtgui_number_sink_0.set_update_time(1.) self.qtgui_number_sink_0.set_title("") labels = ['T Remains:', '', '', '', '', '', '', '', '', ''] units = ['(s)', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, 0.) self.qtgui_number_sink_0.set_max( i, nAve * fftsize * 1024. / Bandwidth) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win, 7, 6, 1, 2) for r in range(7, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_histogram_sink_x_0 = qtgui.histogram_sink_f( fftsize, 100, -.5, .5, "", 2) self.qtgui_histogram_sink_x_0.set_update_time(1.) self.qtgui_histogram_sink_x_0.enable_autoscale(True) self.qtgui_histogram_sink_x_0.enable_accumulate(False) self.qtgui_histogram_sink_x_0.enable_grid(False) self.qtgui_histogram_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_histogram_sink_x_0.disable_legend() labels = ['I', 'Q', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_histogram_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_histogram_sink_x_0.set_line_label(i, labels[i]) self.qtgui_histogram_sink_x_0.set_line_width(i, widths[i]) self.qtgui_histogram_sink_x_0.set_line_color(i, colors[i]) self.qtgui_histogram_sink_x_0.set_line_style(i, styles[i]) self.qtgui_histogram_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_histogram_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_histogram_sink_x_0_win = sip.wrapinstance( self.qtgui_histogram_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_histogram_sink_x_0_win, 4, 0, 1, 2) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.pluto_source_0 = iio.pluto_source('192.168.2.1', int(int(Frequency)), int(int(Bandwidth)), int(20000000), 0x8000, False, False, True, "manual", float(Gain1), '', True) self.fft_vxx_0 = fft.fft_vcc(fftsize, True, (window.hamming(fftsize)), True, 1) self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, fftsize) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared( fftsize) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self._Telescope_tool_bar = Qt.QToolBar(self) self._Telescope_tool_bar.addWidget(Qt.QLabel('Tel' + ": ")) self._Telescope_line_edit = Qt.QLineEdit(str(self.Telescope)) self._Telescope_tool_bar.addWidget(self._Telescope_line_edit) self._Telescope_line_edit.returnPressed.connect( lambda: self.set_Telescope( str(str(self._Telescope_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._Telescope_tool_bar, 1, 0, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Device_tool_bar = Qt.QToolBar(self) self._Device_tool_bar.addWidget(Qt.QLabel('Dev' + ": ")) self._Device_line_edit = Qt.QLineEdit(str(self.Device)) self._Device_tool_bar.addWidget(self._Device_line_edit) self._Device_line_edit.returnPressed.connect(lambda: self.set_Device( str(str(self._Device_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._Device_tool_bar, 2, 0, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_float_0, 1), (self.qtgui_histogram_sink_x_0, 1)) self.connect((self.blocks_complex_to_float_0, 0), (self.qtgui_histogram_sink_x_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.radio_astro_vmedian_0_0_0, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.pluto_source_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.pluto_source_0, 0), (self.blocks_stream_to_vector_0_0, 0)) self.connect((self.radio_astro_ra_ascii_sink_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.radio_astro_ra_integrate_1, 1), (self.qtgui_vector_sink_f_0_0, 1)) self.connect((self.radio_astro_ra_integrate_1, 3), (self.qtgui_vector_sink_f_0_0, 3)) self.connect((self.radio_astro_ra_integrate_1, 2), (self.qtgui_vector_sink_f_0_0, 2)) self.connect((self.radio_astro_ra_integrate_1, 0), (self.qtgui_vector_sink_f_0_0, 0)) self.connect((self.radio_astro_ra_integrate_1, 4), (self.qtgui_vector_sink_f_0_0, 4)) self.connect((self.radio_astro_vmedian_0, 0), (self.radio_astro_ra_ascii_sink_0, 0)) self.connect((self.radio_astro_vmedian_0, 0), (self.radio_astro_ra_integrate_1, 0)) self.connect((self.radio_astro_vmedian_0_0, 0), (self.radio_astro_vmedian_0, 0)) self.connect((self.radio_astro_vmedian_0_0_0, 0), (self.radio_astro_vmedian_0_0_0_0, 0)) self.connect((self.radio_astro_vmedian_0_0_0_0, 0), (self.radio_astro_vmedian_0_0_1, 0)) self.connect((self.radio_astro_vmedian_0_0_1, 0), (self.radio_astro_vmedian_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "NSF Watch for Events whille recording spectra") Qt.QWidget.__init__(self) self.setWindowTitle("NSF Watch for Events whille recording spectra") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "NsfWatch100") self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.ObsName = ObsName = "Integrate100" self.ConfigFile = ConfigFile = ObsName+".conf" self._Frequencys_config = ConfigParser.ConfigParser() self._Frequencys_config.read(ConfigFile) try: Frequencys = self._Frequencys_config.getfloat('main', 'Frequency') except: Frequencys = 1420.4e6 self.Frequencys = Frequencys self._Bandwidths_config = ConfigParser.ConfigParser() self._Bandwidths_config.read(ConfigFile) try: Bandwidths = self._Bandwidths_config.getfloat('main', 'Bandwidth') except: Bandwidths = 10.e6 self.Bandwidths = Bandwidths self._telescope_save_config = ConfigParser.ConfigParser() self._telescope_save_config.read(ConfigFile) try: telescope_save = self._telescope_save_config.get('main', 'telescope') except: telescope_save = 'Bubble Wrap Horn' self.telescope_save = telescope_save self._observers_save_config = ConfigParser.ConfigParser() self._observers_save_config.read(ConfigFile) try: observers_save = self._observers_save_config.get('main', 'observers') except: observers_save = 'Science Aficionado' self.observers_save = observers_save self._nAves_config = ConfigParser.ConfigParser() self._nAves_config.read(ConfigFile) try: nAves = self._nAves_config.getint('main', 'nave') except: nAves = 20 self.nAves = nAves self._fftsize_save_config = ConfigParser.ConfigParser() self._fftsize_save_config.read(ConfigFile) try: fftsize_save = self._fftsize_save_config.getint('main', 'fftsize') except: fftsize_save = 1024 self.fftsize_save = fftsize_save self._device_save_config = ConfigParser.ConfigParser() self._device_save_config.read(ConfigFile) try: device_save = self._device_save_config.get('main', 'device') except: device_save = 'airspy,bias=1,pack=1' self.device_save = device_save self._Gain1s_config = ConfigParser.ConfigParser() self._Gain1s_config.read(ConfigFile) try: Gain1s = self._Gain1s_config.getfloat('main', 'gain1') except: Gain1s = 49. self.Gain1s = Gain1s self.Frequency = Frequency = Frequencys self._Elevation_save_config = ConfigParser.ConfigParser() self._Elevation_save_config.read(ConfigFile) try: Elevation_save = self._Elevation_save_config.getfloat('main', 'elevation') except: Elevation_save = 90. self.Elevation_save = Elevation_save self.Bandwidth = Bandwidth = Bandwidths self._Azimuth_save_config = ConfigParser.ConfigParser() self._Azimuth_save_config.read(ConfigFile) try: Azimuth_save = self._Azimuth_save_config.getfloat('main', 'azimuth') except: Azimuth_save = 90. self.Azimuth_save = Azimuth_save self.observer = observer = observers_save self.numin = numin = (Frequency - (Bandwidth/2.)) self.nsigma = nsigma = 5.0 self.nAve = nAve = nAves self.fftsize = fftsize = fftsize_save self.Telescope = Telescope = telescope_save self.Record = Record = 0 self.H1 = H1 = 1420.406E6 self.Gain2 = Gain2 = 12. self.Gain1 = Gain1 = Gain1s self.EventMode = EventMode = 0 self.Elevation = Elevation = Elevation_save self.Device = Device = device_save self.Azimuth = Azimuth = Azimuth_save ################################################## # Blocks ################################################## self._observer_tool_bar = Qt.QToolBar(self) self._observer_tool_bar.addWidget(Qt.QLabel('Who'+": ")) self._observer_line_edit = Qt.QLineEdit(str(self.observer)) self._observer_tool_bar.addWidget(self._observer_line_edit) self._observer_line_edit.returnPressed.connect( lambda: self.set_observer(str(str(self._observer_line_edit.text())))) self.top_grid_layout.addWidget(self._observer_tool_bar, 0, 0, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._nsigma_range = Range(0., 10., .1, 5.0, 100) self._nsigma_win = RangeWidget(self._nsigma_range, self.set_nsigma, 'N Sigma', "counter", float) self.top_grid_layout.addWidget(self._nsigma_win, 2, 5, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 7): self.top_grid_layout.setColumnStretch(c, 1) self._nAve_tool_bar = Qt.QToolBar(self) self._nAve_tool_bar.addWidget(Qt.QLabel('N_Ave.'+": ")) self._nAve_line_edit = Qt.QLineEdit(str(self.nAve)) self._nAve_tool_bar.addWidget(self._nAve_line_edit) self._nAve_line_edit.returnPressed.connect( lambda: self.set_nAve(int(str(self._nAve_line_edit.text())))) self.top_grid_layout.addWidget(self._nAve_tool_bar, 0, 2, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._fftsize_tool_bar = Qt.QToolBar(self) self._fftsize_tool_bar.addWidget(Qt.QLabel('FFT_size'+": ")) self._fftsize_line_edit = Qt.QLineEdit(str(self.fftsize)) self._fftsize_tool_bar.addWidget(self._fftsize_line_edit) self._fftsize_line_edit.returnPressed.connect( lambda: self.set_fftsize(int(str(self._fftsize_line_edit.text())))) self.top_grid_layout.addWidget(self._fftsize_tool_bar, 1, 2, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._Telescope_tool_bar = Qt.QToolBar(self) self._Telescope_tool_bar.addWidget(Qt.QLabel('Tel'+": ")) self._Telescope_line_edit = Qt.QLineEdit(str(self.Telescope)) self._Telescope_tool_bar.addWidget(self._Telescope_line_edit) self._Telescope_line_edit.returnPressed.connect( lambda: self.set_Telescope(str(str(self._Telescope_line_edit.text())))) self.top_grid_layout.addWidget(self._Telescope_tool_bar, 1, 0, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Record_options = (0, 1, ) self._Record_labels = ('! ! Wait ! !', 'AVERAGE', ) self._Record_tool_bar = Qt.QToolBar(self) self._Record_tool_bar.addWidget(Qt.QLabel('Spec. Mode'+": ")) self._Record_combo_box = Qt.QComboBox() self._Record_tool_bar.addWidget(self._Record_combo_box) for label in self._Record_labels: self._Record_combo_box.addItem(label) self._Record_callback = lambda i: Qt.QMetaObject.invokeMethod(self._Record_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._Record_options.index(i))) self._Record_callback(self.Record) self._Record_combo_box.currentIndexChanged.connect( lambda i: self.set_Record(self._Record_options[i])) self.top_grid_layout.addWidget(self._Record_tool_bar, 3, 2, 1, 3) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 5): self.top_grid_layout.setColumnStretch(c, 1) self._Gain1_tool_bar = Qt.QToolBar(self) self._Gain1_tool_bar.addWidget(Qt.QLabel('Gain1'+": ")) self._Gain1_line_edit = Qt.QLineEdit(str(self.Gain1)) self._Gain1_tool_bar.addWidget(self._Gain1_line_edit) self._Gain1_line_edit.returnPressed.connect( lambda: self.set_Gain1(eng_notation.str_to_num(str(self._Gain1_line_edit.text())))) self.top_grid_layout.addWidget(self._Gain1_tool_bar, 3, 0, 1, 2) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Frequency_tool_bar = Qt.QToolBar(self) self._Frequency_tool_bar.addWidget(Qt.QLabel('Freq. Hz'+": ")) self._Frequency_line_edit = Qt.QLineEdit(str(self.Frequency)) self._Frequency_tool_bar.addWidget(self._Frequency_line_edit) self._Frequency_line_edit.returnPressed.connect( lambda: self.set_Frequency(eng_notation.str_to_num(str(self._Frequency_line_edit.text())))) self.top_grid_layout.addWidget(self._Frequency_tool_bar, 0, 5, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 7): self.top_grid_layout.setColumnStretch(c, 1) self._EventMode_options = (0, 1, ) self._EventMode_labels = ('! ! Wait ! !', 'Write', ) self._EventMode_tool_bar = Qt.QToolBar(self) self._EventMode_tool_bar.addWidget(Qt.QLabel('Event Mode'+": ")) self._EventMode_combo_box = Qt.QComboBox() self._EventMode_tool_bar.addWidget(self._EventMode_combo_box) for label in self._EventMode_labels: self._EventMode_combo_box.addItem(label) self._EventMode_callback = lambda i: Qt.QMetaObject.invokeMethod(self._EventMode_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._EventMode_options.index(i))) self._EventMode_callback(self.EventMode) self._EventMode_combo_box.currentIndexChanged.connect( lambda i: self.set_EventMode(self._EventMode_options[i])) self.top_grid_layout.addWidget(self._EventMode_tool_bar, 2, 2, 1, 3) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 5): self.top_grid_layout.setColumnStretch(c, 1) self._Elevation_tool_bar = Qt.QToolBar(self) self._Elevation_tool_bar.addWidget(Qt.QLabel('Elevation'+": ")) self._Elevation_line_edit = Qt.QLineEdit(str(self.Elevation)) self._Elevation_tool_bar.addWidget(self._Elevation_line_edit) self._Elevation_line_edit.returnPressed.connect( lambda: self.set_Elevation(eng_notation.str_to_num(str(self._Elevation_line_edit.text())))) self.top_grid_layout.addWidget(self._Elevation_tool_bar, 1, 7, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 9): self.top_grid_layout.setColumnStretch(c, 1) self._Device_tool_bar = Qt.QToolBar(self) self._Device_tool_bar.addWidget(Qt.QLabel('Dev'+": ")) self._Device_line_edit = Qt.QLineEdit(str(self.Device)) self._Device_tool_bar.addWidget(self._Device_line_edit) self._Device_line_edit.returnPressed.connect( lambda: self.set_Device(str(str(self._Device_line_edit.text())))) self.top_grid_layout.addWidget(self._Device_tool_bar, 2, 0, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Bandwidth_tool_bar = Qt.QToolBar(self) self._Bandwidth_tool_bar.addWidget(Qt.QLabel('Bandwidth'+": ")) self._Bandwidth_line_edit = Qt.QLineEdit(str(self.Bandwidth)) self._Bandwidth_tool_bar.addWidget(self._Bandwidth_line_edit) self._Bandwidth_line_edit.returnPressed.connect( lambda: self.set_Bandwidth(eng_notation.str_to_num(str(self._Bandwidth_line_edit.text())))) self.top_grid_layout.addWidget(self._Bandwidth_tool_bar, 1, 5, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 7): self.top_grid_layout.setColumnStretch(c, 1) self._Azimuth_tool_bar = Qt.QToolBar(self) self._Azimuth_tool_bar.addWidget(Qt.QLabel('Azimuth'+": ")) self._Azimuth_line_edit = Qt.QLineEdit(str(self.Azimuth)) self._Azimuth_tool_bar.addWidget(self._Azimuth_line_edit) self._Azimuth_line_edit.returnPressed.connect( lambda: self.set_Azimuth(eng_notation.str_to_num(str(self._Azimuth_line_edit.text())))) self.top_grid_layout.addWidget(self._Azimuth_tool_bar, 0, 7, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 9): self.top_grid_layout.setColumnStretch(c, 1) self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + Device ) self.rtlsdr_source_0.set_sample_rate(Bandwidth) self.rtlsdr_source_0.set_center_freq(Frequency, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(float(Gain1), 0) self.rtlsdr_source_0.set_if_gain(float(Gain2), 0) self.rtlsdr_source_0.set_bb_gain(float(Gain2), 0) self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(Bandwidth, 0) (self.rtlsdr_source_0).set_processor_affinity([3]) self.radio_astro_vmedian_0_0_1_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_1 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_ra_event_sink_0 = radio_astro.ra_event_sink(ObsName+"Event.not", fftsize, Frequency*1.E-6, Bandwidth*1.E-6, EventMode, 'Event Detection', 'Observer', Telescope, Device, float(Gain1), Azimuth, Elevation) self.radio_astro_ra_ascii_sink_0 = radio_astro.ra_ascii_sink(ObsName+".not", observer, fftsize, Frequency, Bandwidth, Azimuth, Elevation, Record, 0, 4**5, nAve, telescope_save, device_save, float(Gain1), float(Gain2), float(Gain2)) self.radio_astro_detect_0 = radio_astro.detect(fftsize, nsigma, Frequency, Bandwidth, fftsize*1.e-6/Bandwidth, 2) self.qtgui_number_sink_0 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1 ) self.qtgui_number_sink_0.set_update_time(1.) self.qtgui_number_sink_0.set_title("") labels = ['T Remains:', '', '', '', '', '', '', '', '', ''] units = ['(s)', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, 0.) self.qtgui_number_sink_0.set_max(i, nAve * fftsize * 1024. / Bandwidth) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance(self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win, 3, 5, 1, 3) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_histogram_sink_x_0 = qtgui.histogram_sink_f( fftsize, 100, -.4, .4, "", 2 ) self.qtgui_histogram_sink_x_0.set_update_time(1.) self.qtgui_histogram_sink_x_0.enable_autoscale(True) self.qtgui_histogram_sink_x_0.enable_accumulate(False) self.qtgui_histogram_sink_x_0.enable_grid(False) self.qtgui_histogram_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_histogram_sink_x_0.disable_legend() labels = ['I', 'Q', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_histogram_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_histogram_sink_x_0.set_line_label(i, labels[i]) self.qtgui_histogram_sink_x_0.set_line_width(i, widths[i]) self.qtgui_histogram_sink_x_0.set_line_color(i, colors[i]) self.qtgui_histogram_sink_x_0.set_line_style(i, styles[i]) self.qtgui_histogram_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_histogram_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_histogram_sink_x_0_win = sip.wrapinstance(self.qtgui_histogram_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_histogram_sink_x_0_win, 4, 0, 1, 5) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 5): self.top_grid_layout.setColumnStretch(c, 1) self.fft_vxx_0 = fft.fft_vcc(fftsize, True, (window.hamming(fftsize)), True, 1) self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fftsize) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(fftsize) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_float_0, 1), (self.qtgui_histogram_sink_x_0, 1)) self.connect((self.blocks_complex_to_float_0, 0), (self.qtgui_histogram_sink_x_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.radio_astro_vmedian_0_0_1, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.radio_astro_detect_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.radio_astro_ra_event_sink_0, 0)) self.connect((self.radio_astro_ra_ascii_sink_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.radio_astro_vmedian_0, 0), (self.radio_astro_ra_ascii_sink_0, 0)) self.connect((self.radio_astro_vmedian_0_0, 0), (self.radio_astro_vmedian_0, 0)) self.connect((self.radio_astro_vmedian_0_0_0, 0), (self.radio_astro_vmedian_0_0, 0)) self.connect((self.radio_astro_vmedian_0_0_1, 0), (self.radio_astro_vmedian_0_0_1_0, 0)) self.connect((self.radio_astro_vmedian_0_0_1_0, 0), (self.radio_astro_vmedian_0_0_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0_0, 0))
def __init__(self): gr.top_block.__init__( self, "NsfIntegrate: Average+Record Astronomical Obs.") Qt.QWidget.__init__(self) self.setWindowTitle("NsfIntegrate: Average+Record Astronomical Obs.") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "NsfIntegrate30") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.ObsName = ObsName = "Integrate30" self.ConfigFile = ConfigFile = ObsName + ".conf" self._Frequencys_config = ConfigParser.ConfigParser() self._Frequencys_config.read(ConfigFile) try: Frequencys = self._Frequencys_config.getfloat("main", "Frequency") except: Frequencys = 1420.4e6 self.Frequencys = Frequencys self._Bandwidths_config = ConfigParser.ConfigParser() self._Bandwidths_config.read(ConfigFile) try: Bandwidths = self._Bandwidths_config.getfloat("main", "Bandwidth") except: Bandwidths = 3.e6 self.Bandwidths = Bandwidths self._fftsize_save_config = ConfigParser.ConfigParser() self._fftsize_save_config.read(ConfigFile) try: fftsize_save = self._fftsize_save_config.getint("main", "fftsize") except: fftsize_save = 1024 self.fftsize_save = fftsize_save self.Frequency = Frequency = Frequencys self.Bandwidth = Bandwidth = Bandwidths self._xaxis_save_config = ConfigParser.ConfigParser() self._xaxis_save_config.read(ConfigFile) try: xaxis_save = self._xaxis_save_config.getint("main", "Xaxis") except: xaxis_save = 0 self.xaxis_save = xaxis_save self._telescope_save_config = ConfigParser.ConfigParser() self._telescope_save_config.read(ConfigFile) try: telescope_save = self._telescope_save_config.get( "main", "telescope") except: telescope_save = "Bubble Wrap Horn" self.telescope_save = telescope_save self._observers_save_config = ConfigParser.ConfigParser() self._observers_save_config.read(ConfigFile) try: observers_save = self._observers_save_config.get( "main", "observers") except: observers_save = "Science Aficionado" self.observers_save = observers_save self.numin = numin = (Frequency - (Bandwidth / 2.)) self._nAves_config = ConfigParser.ConfigParser() self._nAves_config.read(ConfigFile) try: nAves = self._nAves_config.getint("main", "nave") except: nAves = 20 self.nAves = nAves self.fftsize = fftsize = fftsize_save self._device_save_config = ConfigParser.ConfigParser() self._device_save_config.read(ConfigFile) try: device_save = self._device_save_config.get("main", "device") except: device_save = "rtlsdr=0,bias=1" self.device_save = device_save self.H1 = H1 = 1420.406E6 self._Gain3s_config = ConfigParser.ConfigParser() self._Gain3s_config.read(ConfigFile) try: Gain3s = self._Gain3s_config.getfloat("main", "gain3") except: Gain3s = 14. self.Gain3s = Gain3s self._Gain2s_config = ConfigParser.ConfigParser() self._Gain2s_config.read(ConfigFile) try: Gain2s = self._Gain2s_config.getfloat("main", "gain2") except: Gain2s = 14. self.Gain2s = Gain2s self._Gain1s_config = ConfigParser.ConfigParser() self._Gain1s_config.read(ConfigFile) try: Gain1s = self._Gain1s_config.getfloat("main", "gain1") except: Gain1s = 49. self.Gain1s = Gain1s self._Elevation_save_config = ConfigParser.ConfigParser() self._Elevation_save_config.read(ConfigFile) try: Elevation_save = self._Elevation_save_config.getfloat( "main", "elevation") except: Elevation_save = 90. self.Elevation_save = Elevation_save self._Azimuth_save_config = ConfigParser.ConfigParser() self._Azimuth_save_config.read(ConfigFile) try: Azimuth_save = self._Azimuth_save_config.getfloat( "main", "azimuth") except: Azimuth_save = 90. self.Azimuth_save = Azimuth_save self.yunits = yunits = [ "Counts", "Power (dB)", "Intensity (Kelvins)", "Intensity (K)" ] self.ymins = ymins = [0.01, -22, 90., -5.] self.ymaxs = ymaxs = [3., 10., 180., 50.] self.xsteps = xsteps = [ Bandwidth * 1.E-6 / fftsize, -Bandwidth * 3.E5 / (H1 * fftsize), 1 ] self.xmins = xmins = [numin * 1E-6, (H1 - numin) * (3E5 / H1), 0, -5.] self._xaxis_save_0_config = ConfigParser.ConfigParser() self._xaxis_save_0_config.read(ConfigFile) try: xaxis_save_0 = self._xaxis_save_0_config.getint("main", "Xaxis") except: xaxis_save_0 = 0 self.xaxis_save_0 = xaxis_save_0 self.units = units = 0 self.obstype = obstype = 0 self.observer = observer = observers_save self.nAve = nAve = nAves self.Xaxis = Xaxis = xaxis_save self.Telescope = Telescope = telescope_save self.Record = Record = 0 self.Gain3 = Gain3 = Gain3s self.Gain2 = Gain2 = Gain2s self.Gain1 = Gain1 = Gain1s self.Elevation = Elevation = Elevation_save self.Device = Device = device_save self.Azimuth = Azimuth = Azimuth_save ################################################## # Blocks ################################################## self._units_options = ( 0, 1, 2, 3, ) self._units_labels = ( "Counts", "dB", "Kelvins", "Kelvins-Fit", ) self._units_tool_bar = Qt.QToolBar(self) self._units_tool_bar.addWidget(Qt.QLabel("Units" + ": ")) self._units_combo_box = Qt.QComboBox() self._units_tool_bar.addWidget(self._units_combo_box) for label in self._units_labels: self._units_combo_box.addItem(label) self._units_callback = lambda i: Qt.QMetaObject.invokeMethod( self._units_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._units_options.index(i))) self._units_callback(self.units) self._units_combo_box.currentIndexChanged.connect( lambda i: self.set_units(self._units_options[i])) self.top_grid_layout.addWidget(self._units_tool_bar, 9, 0, 1, 2) self._obstype_options = ( 0, 1, 3, ) self._obstype_labels = ( "Survey", "Hot/Cold", "Ref", ) self._obstype_tool_bar = Qt.QToolBar(self) self._obstype_tool_bar.addWidget(Qt.QLabel("Obs" + ": ")) self._obstype_combo_box = Qt.QComboBox() self._obstype_tool_bar.addWidget(self._obstype_combo_box) for label in self._obstype_labels: self._obstype_combo_box.addItem(label) self._obstype_callback = lambda i: Qt.QMetaObject.invokeMethod( self._obstype_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._obstype_options.index(i))) self._obstype_callback(self.obstype) self._obstype_combo_box.currentIndexChanged.connect( lambda i: self.set_obstype(self._obstype_options[i])) self.top_grid_layout.addWidget(self._obstype_tool_bar, 8, 0, 1, 2) self._observer_tool_bar = Qt.QToolBar(self) self._observer_tool_bar.addWidget(Qt.QLabel("Who" + ": ")) self._observer_line_edit = Qt.QLineEdit(str(self.observer)) self._observer_tool_bar.addWidget(self._observer_line_edit) self._observer_line_edit.returnPressed.connect( lambda: self.set_observer( str(str(self._observer_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._observer_tool_bar, 0, 0, 1, 2) self._nAve_tool_bar = Qt.QToolBar(self) self._nAve_tool_bar.addWidget(Qt.QLabel("N_Ave." + ": ")) self._nAve_line_edit = Qt.QLineEdit(str(self.nAve)) self._nAve_tool_bar.addWidget(self._nAve_line_edit) self._nAve_line_edit.returnPressed.connect(lambda: self.set_nAve( int(str(self._nAve_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._nAve_tool_bar, 0, 2, 1, 2) self._fftsize_tool_bar = Qt.QToolBar(self) self._fftsize_tool_bar.addWidget(Qt.QLabel("FFT_size" + ": ")) self._fftsize_line_edit = Qt.QLineEdit(str(self.fftsize)) self._fftsize_tool_bar.addWidget(self._fftsize_line_edit) self._fftsize_line_edit.returnPressed.connect(lambda: self.set_fftsize( int(str(self._fftsize_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._fftsize_tool_bar, 1, 2, 1, 2) self._Xaxis_options = ( 0, 1, 2, ) self._Xaxis_labels = ( "Frequency (MHz)", "Velocity (km/sec)", "Channels", ) self._Xaxis_tool_bar = Qt.QToolBar(self) self._Xaxis_tool_bar.addWidget(Qt.QLabel("Xaxis" + ": ")) self._Xaxis_combo_box = Qt.QComboBox() self._Xaxis_tool_bar.addWidget(self._Xaxis_combo_box) for label in self._Xaxis_labels: self._Xaxis_combo_box.addItem(label) self._Xaxis_callback = lambda i: Qt.QMetaObject.invokeMethod( self._Xaxis_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._Xaxis_options.index(i))) self._Xaxis_callback(self.Xaxis) self._Xaxis_combo_box.currentIndexChanged.connect( lambda i: self.set_Xaxis(self._Xaxis_options[i])) self.top_grid_layout.addWidget(self._Xaxis_tool_bar, 9, 3, 1, 3) self._Record_options = ( 0, 1, 2, ) self._Record_labels = ( "! ! Wait ! !", "AVERAGE", "Save", ) self._Record_tool_bar = Qt.QToolBar(self) self._Record_tool_bar.addWidget(Qt.QLabel("Rec" + ": ")) self._Record_combo_box = Qt.QComboBox() self._Record_tool_bar.addWidget(self._Record_combo_box) for label in self._Record_labels: self._Record_combo_box.addItem(label) self._Record_callback = lambda i: Qt.QMetaObject.invokeMethod( self._Record_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._Record_options.index(i))) self._Record_callback(self.Record) self._Record_combo_box.currentIndexChanged.connect( lambda i: self.set_Record(self._Record_options[i])) self.top_grid_layout.addWidget(self._Record_tool_bar, 7, 0, 1, 2) self._Gain3_tool_bar = Qt.QToolBar(self) self._Gain3_tool_bar.addWidget(Qt.QLabel("Gain3" + ": ")) self._Gain3_line_edit = Qt.QLineEdit(str(self.Gain3)) self._Gain3_tool_bar.addWidget(self._Gain3_line_edit) self._Gain3_line_edit.returnPressed.connect(lambda: self.set_Gain3( eng_notation.str_to_num(str(self._Gain3_line_edit.text().toAscii()) ))) self.top_grid_layout.addWidget(self._Gain3_tool_bar, 2, 6, 1, 2) self._Gain2_tool_bar = Qt.QToolBar(self) self._Gain2_tool_bar.addWidget(Qt.QLabel("Gain2" + ": ")) self._Gain2_line_edit = Qt.QLineEdit(str(self.Gain2)) self._Gain2_tool_bar.addWidget(self._Gain2_line_edit) self._Gain2_line_edit.returnPressed.connect(lambda: self.set_Gain2( eng_notation.str_to_num(str(self._Gain2_line_edit.text().toAscii()) ))) self.top_grid_layout.addWidget(self._Gain2_tool_bar, 2, 4, 1, 2) self._Gain1_tool_bar = Qt.QToolBar(self) self._Gain1_tool_bar.addWidget(Qt.QLabel("Gain1" + ": ")) self._Gain1_line_edit = Qt.QLineEdit(str(self.Gain1)) self._Gain1_tool_bar.addWidget(self._Gain1_line_edit) self._Gain1_line_edit.returnPressed.connect(lambda: self.set_Gain1( eng_notation.str_to_num(str(self._Gain1_line_edit.text().toAscii()) ))) self.top_grid_layout.addWidget(self._Gain1_tool_bar, 2, 2, 1, 2) self._Frequency_tool_bar = Qt.QToolBar(self) self._Frequency_tool_bar.addWidget(Qt.QLabel("Freq. Hz" + ": ")) self._Frequency_line_edit = Qt.QLineEdit(str(self.Frequency)) self._Frequency_tool_bar.addWidget(self._Frequency_line_edit) self._Frequency_line_edit.returnPressed.connect( lambda: self.set_Frequency( eng_notation.str_to_num( str(self._Frequency_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._Frequency_tool_bar, 0, 4, 1, 2) self._Elevation_tool_bar = Qt.QToolBar(self) self._Elevation_tool_bar.addWidget(Qt.QLabel("Elevation" + ": ")) self._Elevation_line_edit = Qt.QLineEdit(str(self.Elevation)) self._Elevation_tool_bar.addWidget(self._Elevation_line_edit) self._Elevation_line_edit.returnPressed.connect( lambda: self.set_Elevation( eng_notation.str_to_num( str(self._Elevation_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._Elevation_tool_bar, 1, 6, 1, 2) self._Device_tool_bar = Qt.QToolBar(self) self._Device_tool_bar.addWidget(Qt.QLabel("Dev" + ": ")) self._Device_line_edit = Qt.QLineEdit(str(self.Device)) self._Device_tool_bar.addWidget(self._Device_line_edit) self._Device_line_edit.returnPressed.connect(lambda: self.set_Device( str(str(self._Device_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._Device_tool_bar, 2, 0, 1, 2) self._Bandwidth_tool_bar = Qt.QToolBar(self) self._Bandwidth_tool_bar.addWidget(Qt.QLabel("Bandwidth" + ": ")) self._Bandwidth_line_edit = Qt.QLineEdit(str(self.Bandwidth)) self._Bandwidth_tool_bar.addWidget(self._Bandwidth_line_edit) self._Bandwidth_line_edit.returnPressed.connect( lambda: self.set_Bandwidth( eng_notation.str_to_num( str(self._Bandwidth_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._Bandwidth_tool_bar, 1, 4, 1, 2) self._Azimuth_tool_bar = Qt.QToolBar(self) self._Azimuth_tool_bar.addWidget(Qt.QLabel("Azimuth" + ": ")) self._Azimuth_line_edit = Qt.QLineEdit(str(self.Azimuth)) self._Azimuth_tool_bar.addWidget(self._Azimuth_line_edit) self._Azimuth_line_edit.returnPressed.connect(lambda: self.set_Azimuth( eng_notation.str_to_num( str(self._Azimuth_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._Azimuth_tool_bar, 0, 6, 1, 2) self.radio_astro_vmedian_0_0_0_1 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_ra_integrate_1 = radio_astro.ra_integrate( ObsName + ".not", observers_save, fftsize, Frequency, Bandwidth, Azimuth, Elevation, Record, obstype, int(4**5), units, 295., 10.) self.radio_astro_ra_ascii_sink_0 = radio_astro.ra_ascii_sink( ObsName + ".not", observer, fftsize, Frequency, Bandwidth, Azimuth, Elevation, Record, obstype, 4**5, nAve, telescope_save, device_save, Gain1, 11, 11) self.qtgui_vector_sink_f_0_0 = qtgui.vector_sink_f( fftsize, xmins[Xaxis], xsteps[Xaxis], "", "Intensity", "", 5 # Number of inputs ) self.qtgui_vector_sink_f_0_0.set_update_time(.5) self.qtgui_vector_sink_f_0_0.set_y_axis(ymins[units], ymaxs[units]) self.qtgui_vector_sink_f_0_0.enable_autoscale(False) self.qtgui_vector_sink_f_0_0.enable_grid(False) self.qtgui_vector_sink_f_0_0.set_x_axis_units("") self.qtgui_vector_sink_f_0_0.set_y_axis_units("") self.qtgui_vector_sink_f_0_0.set_ref_level( 0.5 * (ymins[units] + ymaxs[units])) labels = ["Latest", "Median", "Hot", "Cold", "Ref", "", "", "", "", ""] widths = [1, 2, 1, 1, 2, 1, 1, 1, 1, 1] colors = [ "black", "dark green", "red", "blue", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [2., 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(5): if len(labels[i]) == 0: self.qtgui_vector_sink_f_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_vector_sink_f_0_0.set_line_label(i, labels[i]) self.qtgui_vector_sink_f_0_0.set_line_width(i, widths[i]) self.qtgui_vector_sink_f_0_0.set_line_color(i, colors[i]) self.qtgui_vector_sink_f_0_0.set_line_alpha(i, alphas[i]) self._qtgui_vector_sink_f_0_0_win = sip.wrapinstance( self.qtgui_vector_sink_f_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_vector_sink_f_0_0_win, 3, 2, 6, 6) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1) self.qtgui_number_sink_0.set_update_time(1.) self.qtgui_number_sink_0.set_title("") labels = ["T Remains:", "", "", "", "", "", "", "", "", ""] units = ["(s)", "", "", "", "", "", "", "", "", ""] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, 0.) self.qtgui_number_sink_0.set_max( i, nAve * fftsize * 1024. / Bandwidth) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win, 9, 6, 1, 2) self.qtgui_histogram_sink_x_0 = qtgui.histogram_sink_f( fftsize, 100, -.5, .5, "", 2) self.qtgui_histogram_sink_x_0.set_update_time(1.) self.qtgui_histogram_sink_x_0.enable_autoscale(True) self.qtgui_histogram_sink_x_0.enable_accumulate(False) self.qtgui_histogram_sink_x_0.enable_grid(False) if not True: self.qtgui_histogram_sink_x_0.disable_legend() labels = ["I", "Q", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_histogram_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_histogram_sink_x_0.set_line_label(i, labels[i]) self.qtgui_histogram_sink_x_0.set_line_width(i, widths[i]) self.qtgui_histogram_sink_x_0.set_line_color(i, colors[i]) self.qtgui_histogram_sink_x_0.set_line_style(i, styles[i]) self.qtgui_histogram_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_histogram_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_histogram_sink_x_0_win = sip.wrapinstance( self.qtgui_histogram_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_histogram_sink_x_0_win, 3, 0, 4, 2) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + Device) self.osmosdr_source_0.set_sample_rate(Bandwidth) self.osmosdr_source_0.set_center_freq(Frequency, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_dc_offset_mode(0, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(Gain1, 0) self.osmosdr_source_0.set_if_gain(Gain2, 0) self.osmosdr_source_0.set_bb_gain(Gain3, 0) self.osmosdr_source_0.set_antenna("1", 0) self.osmosdr_source_0.set_bandwidth(Bandwidth, 0) self.fft_vxx_0 = fft.fft_vcc(fftsize, True, (window.hamming(fftsize)), True, 1) self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, fftsize) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared( fftsize) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self._Telescope_tool_bar = Qt.QToolBar(self) self._Telescope_tool_bar.addWidget(Qt.QLabel("Tel" + ": ")) self._Telescope_line_edit = Qt.QLineEdit(str(self.Telescope)) self._Telescope_tool_bar.addWidget(self._Telescope_line_edit) self._Telescope_line_edit.returnPressed.connect( lambda: self.set_Telescope( str(str(self._Telescope_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._Telescope_tool_bar, 1, 0, 1, 2) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_float_0, 1), (self.qtgui_histogram_sink_x_0, 1)) self.connect((self.blocks_complex_to_float_0, 0), (self.qtgui_histogram_sink_x_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.radio_astro_vmedian_0_0_0, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_stream_to_vector_0_0, 0)) self.connect((self.radio_astro_ra_ascii_sink_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.radio_astro_ra_integrate_1, 1), (self.qtgui_vector_sink_f_0_0, 1)) self.connect((self.radio_astro_ra_integrate_1, 3), (self.qtgui_vector_sink_f_0_0, 3)) self.connect((self.radio_astro_ra_integrate_1, 2), (self.qtgui_vector_sink_f_0_0, 2)) self.connect((self.radio_astro_ra_integrate_1, 0), (self.qtgui_vector_sink_f_0_0, 0)) self.connect((self.radio_astro_ra_integrate_1, 4), (self.qtgui_vector_sink_f_0_0, 4)) self.connect((self.radio_astro_vmedian_0, 0), (self.radio_astro_ra_ascii_sink_0, 0)) self.connect((self.radio_astro_vmedian_0, 0), (self.radio_astro_ra_integrate_1, 0)) self.connect((self.radio_astro_vmedian_0_0, 0), (self.radio_astro_vmedian_0, 0)) self.connect((self.radio_astro_vmedian_0_0_0, 0), (self.radio_astro_vmedian_0_0_0_1, 0)) self.connect((self.radio_astro_vmedian_0_0_0_0, 0), (self.radio_astro_vmedian_0_0, 0)) self.connect((self.radio_astro_vmedian_0_0_0_1, 0), (self.radio_astro_vmedian_0_0_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "NSF Watch 9MHz SDRPlay") ################################################## # Variables ################################################## self.ObsName = ObsName = "Integrate90" self.ConfigFile = ConfigFile = ObsName + ".conf" self._Frequencys_config = ConfigParser.ConfigParser() self._Frequencys_config.read(ConfigFile) try: Frequencys = self._Frequencys_config.getfloat('main', 'Frequency') except: Frequencys = 1420.4e6 self.Frequencys = Frequencys self._Bandwidths_config = ConfigParser.ConfigParser() self._Bandwidths_config.read(ConfigFile) try: Bandwidths = self._Bandwidths_config.getfloat('main', 'Bandwidth') except: Bandwidths = 9.e6 self.Bandwidths = Bandwidths self._telescope_save_config = ConfigParser.ConfigParser() self._telescope_save_config.read(ConfigFile) try: telescope_save = self._telescope_save_config.get( 'main', 'telescope') except: telescope_save = 'Bubble Wrap Horn' self.telescope_save = telescope_save self._observers_save_config = ConfigParser.ConfigParser() self._observers_save_config.read(ConfigFile) try: observers_save = self._observers_save_config.get( 'main', 'observers') except: observers_save = 'Science Aficionado' self.observers_save = observers_save self._nsigmas_config = ConfigParser.ConfigParser() self._nsigmas_config.read(ConfigFile) try: nsigmas = self._nsigmas_config.getfloat('main', 'nsigma') except: nsigmas = 5.5 self.nsigmas = nsigmas self._nAves_config = ConfigParser.ConfigParser() self._nAves_config.read(ConfigFile) try: nAves = self._nAves_config.getint('main', 'nave') except: nAves = 20 self.nAves = nAves self._fftsize_save_config = ConfigParser.ConfigParser() self._fftsize_save_config.read(ConfigFile) try: fftsize_save = self._fftsize_save_config.getint('main', 'fftsize') except: fftsize_save = 1024 self.fftsize_save = fftsize_save self._device_save_config = ConfigParser.ConfigParser() self._device_save_config.read(ConfigFile) try: device_save = self._device_save_config.get('main', 'device') except: device_save = 'airspy,bias=1,pack=1' self.device_save = device_save self._IQMode_save_config = ConfigParser.ConfigParser() self._IQMode_save_config.read(ConfigFile) try: IQMode_save = self._IQMode_save_config.getboolean('main', 'iqmode') except: IQMode_save = False self.IQMode_save = IQMode_save self._IF_attn_save_config = ConfigParser.ConfigParser() self._IF_attn_save_config.read(ConfigFile) try: IF_attn_save = self._IF_attn_save_config.getfloat('main', 'ifattn') except: IF_attn_save = 30 self.IF_attn_save = IF_attn_save self._Gain1s_config = ConfigParser.ConfigParser() self._Gain1s_config.read(ConfigFile) try: Gain1s = self._Gain1s_config.getfloat('main', 'gain1') except: Gain1s = 49. self.Gain1s = Gain1s self.Frequency = Frequency = Frequencys self._Elevation_save_config = ConfigParser.ConfigParser() self._Elevation_save_config.read(ConfigFile) try: Elevation_save = self._Elevation_save_config.getfloat( 'main', 'elevation') except: Elevation_save = 90. self.Elevation_save = Elevation_save self._DebugOn_save_config = ConfigParser.ConfigParser() self._DebugOn_save_config.read(ConfigFile) try: DebugOn_save = self._DebugOn_save_config.getboolean( 'main', 'debugon') except: DebugOn_save = False self.DebugOn_save = DebugOn_save self._DcOffsetMode_save_config = ConfigParser.ConfigParser() self._DcOffsetMode_save_config.read(ConfigFile) try: DcOffsetMode_save = self._DcOffsetMode_save_config.getboolean( 'main', 'dcoffsetmode') except: DcOffsetMode_save = False self.DcOffsetMode_save = DcOffsetMode_save self._DabNotch_save_config = ConfigParser.ConfigParser() self._DabNotch_save_config.read(ConfigFile) try: DabNotch_save = self._DabNotch_save_config.getboolean( 'main', 'dabnotch') except: DabNotch_save = False self.DabNotch_save = DabNotch_save self._BroadcastNotch_save_config = ConfigParser.ConfigParser() self._BroadcastNotch_save_config.read(ConfigFile) try: BroadcastNotch_save = self._BroadcastNotch_save_config.getboolean( 'main', 'broadcastnotch') except: BroadcastNotch_save = False self.BroadcastNotch_save = BroadcastNotch_save self._BiasOn_save_config = ConfigParser.ConfigParser() self._BiasOn_save_config.read(ConfigFile) try: BiasOn_save = self._BiasOn_save_config.getboolean('main', 'biason') except: BiasOn_save = False self.BiasOn_save = BiasOn_save self.Bandwidth = Bandwidth = Bandwidths self._Azimuth_save_config = ConfigParser.ConfigParser() self._Azimuth_save_config.read(ConfigFile) try: Azimuth_save = self._Azimuth_save_config.getfloat( 'main', 'azimuth') except: Azimuth_save = 90. self.Azimuth_save = Azimuth_save self.observer = observer = observers_save self.numin = numin = (Frequency - (Bandwidth / 2.)) self.nsigma = nsigma = nsigmas self.nAve = nAve = nAves self.fftsize = fftsize = fftsize_save self.Telescope = Telescope = telescope_save self.Record = Record = 1 self.IQMode = IQMode = IQMode_save self.IF_attn = IF_attn = IF_attn_save self.H1 = H1 = 1420.406E6 self.Gain2_1 = Gain2_1 = 12. self.Gain1 = Gain1 = Gain1s self.EventMode = EventMode = 1 self.Elevation = Elevation = Elevation_save self.Device = Device = device_save self.DebugOn = DebugOn = DebugOn_save self.DcOffsetMode = DcOffsetMode = DcOffsetMode_save self.DabNotch = DabNotch = DabNotch_save self.BroadcastNotch = BroadcastNotch = BroadcastNotch_save self.BiasOn = BiasOn = BiasOn_save self.Azimuth = Azimuth = Azimuth_save ################################################## # Blocks ################################################## self.time_remaining = blocks.null_sink(gr.sizeof_float * 1) self.sdrplay_rsp1a_source_0 = sdrplay.rsp1a_source( int(Frequency), 8000, False, int(IF_attn), DcOffsetMode, IQMode, bool(DebugOn), 0, 1, int(Bandwidth), BroadcastNotch, DabNotch, int(Gain1), bool(BiasOn), '0') self.radio_astro_vmedian_0_0_1_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_1 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_ra_event_sink_0 = radio_astro.ra_event_sink( ObsName + "Event.not", 2 * fftsize, Frequency * 1.E-6, Bandwidth * 1.E-6, EventMode, 'Event Detection', 'Observer', Telescope, Device, float(Gain1), Azimuth, Elevation) self.radio_astro_ra_event_log_0 = radio_astro.ra_event_log( '', 'Event Detection', 2 * fftsize, Bandwidth * 1.e-6) self.radio_astro_ra_ascii_sink_0 = radio_astro.ra_ascii_sink( ObsName + ".not", observer, fftsize, Frequency, Bandwidth, Azimuth, Elevation, Record, 0, 4**5, nAve, telescope_save, device_save, float(Gain1), float(IF_attn), float(IF_attn)) self.radio_astro_detect_0 = radio_astro.detect( 2 * fftsize, nsigma, Frequency, Bandwidth, fftsize * 1.e-6 / Bandwidth, EventMode) self.fft_vxx_0 = fft.fft_vcc(fftsize, True, (window.hamming(fftsize)), True, 1) self.blocks_stream_to_vector_0_0_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 2 * fftsize) self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, fftsize) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared( fftsize) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.radio_astro_vmedian_0_0_1, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_stream_to_vector_0_0_0, 0), (self.radio_astro_detect_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.radio_astro_ra_event_log_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.radio_astro_ra_event_sink_0, 0)) self.connect((self.radio_astro_ra_ascii_sink_0, 0), (self.time_remaining, 0)) self.connect((self.radio_astro_vmedian_0, 0), (self.radio_astro_ra_ascii_sink_0, 0)) self.connect((self.radio_astro_vmedian_0_0, 0), (self.radio_astro_vmedian_0, 0)) self.connect((self.radio_astro_vmedian_0_0_0, 0), (self.radio_astro_vmedian_0_0, 0)) self.connect((self.radio_astro_vmedian_0_0_1, 0), (self.radio_astro_vmedian_0_0_1_0, 0)) self.connect((self.radio_astro_vmedian_0_0_1_0, 0), (self.radio_astro_vmedian_0_0_0, 0)) self.connect((self.sdrplay_rsp1a_source_0, 0), (self.blocks_stream_to_vector_0_0, 0)) self.connect((self.sdrplay_rsp1a_source_0, 0), (self.blocks_stream_to_vector_0_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "NSF Watch 9MHz SDRPlay") Qt.QWidget.__init__(self) self.setWindowTitle("NSF Watch 9MHz SDRPlay") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "NsfFull90") self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.ObsName = ObsName = "Integrate70" self.ConfigFile = ConfigFile = ObsName+".conf" self._Frequencys_config = ConfigParser.ConfigParser() self._Frequencys_config.read(ConfigFile) try: Frequencys = self._Frequencys_config.getfloat('main', 'Frequency') except: Frequencys = 1420.4e6 self.Frequencys = Frequencys self._Bandwidths_config = ConfigParser.ConfigParser() self._Bandwidths_config.read(ConfigFile) try: Bandwidths = self._Bandwidths_config.getfloat('main', 'Bandwidth') except: Bandwidths = 9.e6 self.Bandwidths = Bandwidths self._telescope_save_config = ConfigParser.ConfigParser() self._telescope_save_config.read(ConfigFile) try: telescope_save = self._telescope_save_config.get('main', 'telescope') except: telescope_save = 'Bubble Wrap Horn' self.telescope_save = telescope_save self._observers_save_config = ConfigParser.ConfigParser() self._observers_save_config.read(ConfigFile) try: observers_save = self._observers_save_config.get('main', 'observers') except: observers_save = 'Science Aficionado' self.observers_save = observers_save self._nAves_config = ConfigParser.ConfigParser() self._nAves_config.read(ConfigFile) try: nAves = self._nAves_config.getint('main', 'nave') except: nAves = 20 self.nAves = nAves self._fftsize_save_config = ConfigParser.ConfigParser() self._fftsize_save_config.read(ConfigFile) try: fftsize_save = self._fftsize_save_config.getint('main', 'fftsize') except: fftsize_save = 1024 self.fftsize_save = fftsize_save self._device_save_config = ConfigParser.ConfigParser() self._device_save_config.read(ConfigFile) try: device_save = self._device_save_config.get('main', 'device') except: device_save = 'airspy,bias=1,pack=1' self.device_save = device_save self._IFattns_config = ConfigParser.ConfigParser() self._IFattns_config.read(ConfigFile) try: IFattns = self._IFattns_config.getfloat('main', 'ifattn') except: IFattns = 25 self.IFattns = IFattns self._Gain1s_config = ConfigParser.ConfigParser() self._Gain1s_config.read(ConfigFile) try: Gain1s = self._Gain1s_config.getfloat('main', 'gain1') except: Gain1s = 49. self.Gain1s = Gain1s self.Frequency = Frequency = Frequencys self._Elevation_save_config = ConfigParser.ConfigParser() self._Elevation_save_config.read(ConfigFile) try: Elevation_save = self._Elevation_save_config.getfloat('main', 'elevation') except: Elevation_save = 90. self.Elevation_save = Elevation_save self.Bandwidth = Bandwidth = Bandwidths self._Azimuth_save_config = ConfigParser.ConfigParser() self._Azimuth_save_config.read(ConfigFile) try: Azimuth_save = self._Azimuth_save_config.getfloat('main', 'azimuth') except: Azimuth_save = 90. self.Azimuth_save = Azimuth_save self.observer = observer = observers_save self.numin = numin = (Frequency - (Bandwidth/2.)) self.nsigma = nsigma = 5.0 self.nAve = nAve = nAves self.fftsize = fftsize = fftsize_save self.Telescope = Telescope = telescope_save self.Record = Record = 1 self.IQMode = IQMode = False self.IFattn = IFattn = IFattns self.H1 = H1 = 1420.406E6 self.Gain2 = Gain2 = 12. self.Gain1 = Gain1 = Gain1s self.EventMode = EventMode = 1 self.Elevation = Elevation = Elevation_save self.Device = Device = device_save self.DebugOn = DebugOn = False self.DcOffsetMode = DcOffsetMode = True self.BroadcastNotch = BroadcastNotch = True self.BiasOn = BiasOn = False self.Azimuth = Azimuth = Azimuth_save ################################################## # Blocks ################################################## self._observer_tool_bar = Qt.QToolBar(self) self._observer_tool_bar.addWidget(Qt.QLabel('Who'+": ")) self._observer_line_edit = Qt.QLineEdit(str(self.observer)) self._observer_tool_bar.addWidget(self._observer_line_edit) self._observer_line_edit.returnPressed.connect( lambda: self.set_observer(str(str(self._observer_line_edit.text())))) self.top_grid_layout.addWidget(self._observer_tool_bar, 0, 0, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._nsigma_range = Range(0., 10., .1, 5.0, 100) self._nsigma_win = RangeWidget(self._nsigma_range, self.set_nsigma, 'N Sigma', "counter", float) self.top_grid_layout.addWidget(self._nsigma_win, 2, 5, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 7): self.top_grid_layout.setColumnStretch(c, 1) self._nAve_tool_bar = Qt.QToolBar(self) self._nAve_tool_bar.addWidget(Qt.QLabel('N_Ave.'+": ")) self._nAve_line_edit = Qt.QLineEdit(str(self.nAve)) self._nAve_tool_bar.addWidget(self._nAve_line_edit) self._nAve_line_edit.returnPressed.connect( lambda: self.set_nAve(int(str(self._nAve_line_edit.text())))) self.top_grid_layout.addWidget(self._nAve_tool_bar, 0, 2, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._fftsize_tool_bar = Qt.QToolBar(self) self._fftsize_tool_bar.addWidget(Qt.QLabel('FFT_size'+": ")) self._fftsize_line_edit = Qt.QLineEdit(str(self.fftsize)) self._fftsize_tool_bar.addWidget(self._fftsize_line_edit) self._fftsize_line_edit.returnPressed.connect( lambda: self.set_fftsize(int(str(self._fftsize_line_edit.text())))) self.top_grid_layout.addWidget(self._fftsize_tool_bar, 1, 2, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._Telescope_tool_bar = Qt.QToolBar(self) self._Telescope_tool_bar.addWidget(Qt.QLabel('Tel'+": ")) self._Telescope_line_edit = Qt.QLineEdit(str(self.Telescope)) self._Telescope_tool_bar.addWidget(self._Telescope_line_edit) self._Telescope_line_edit.returnPressed.connect( lambda: self.set_Telescope(str(str(self._Telescope_line_edit.text())))) self.top_grid_layout.addWidget(self._Telescope_tool_bar, 1, 0, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Record_options = (0, 1, ) self._Record_labels = ('! ! Wait ! !', 'AVERAGE', ) self._Record_tool_bar = Qt.QToolBar(self) self._Record_tool_bar.addWidget(Qt.QLabel('Spec. Mode'+": ")) self._Record_combo_box = Qt.QComboBox() self._Record_tool_bar.addWidget(self._Record_combo_box) for label in self._Record_labels: self._Record_combo_box.addItem(label) self._Record_callback = lambda i: Qt.QMetaObject.invokeMethod(self._Record_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._Record_options.index(i))) self._Record_callback(self.Record) self._Record_combo_box.currentIndexChanged.connect( lambda i: self.set_Record(self._Record_options[i])) self.top_grid_layout.addWidget(self._Record_tool_bar, 3, 2, 1, 3) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 5): self.top_grid_layout.setColumnStretch(c, 1) _IQMode_check_box = Qt.QCheckBox('IQMode') self._IQMode_choices = {True: True, False: False} self._IQMode_choices_inv = dict((v,k) for k,v in self._IQMode_choices.iteritems()) self._IQMode_callback = lambda i: Qt.QMetaObject.invokeMethod(_IQMode_check_box, "setChecked", Qt.Q_ARG("bool", self._IQMode_choices_inv[i])) self._IQMode_callback(self.IQMode) _IQMode_check_box.stateChanged.connect(lambda i: self.set_IQMode(self._IQMode_choices[bool(i)])) self.top_grid_layout.addWidget(_IQMode_check_box, 7, 5, 1, 1) for r in range(7, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 6): self.top_grid_layout.setColumnStretch(c, 1) self._IFattn_tool_bar = Qt.QToolBar(self) self._IFattn_tool_bar.addWidget(Qt.QLabel('IFattn'+": ")) self._IFattn_line_edit = Qt.QLineEdit(str(self.IFattn)) self._IFattn_tool_bar.addWidget(self._IFattn_line_edit) self._IFattn_line_edit.returnPressed.connect( lambda: self.set_IFattn(eng_notation.str_to_num(str(self._IFattn_line_edit.text())))) self.top_grid_layout.addWidget(self._IFattn_tool_bar, 3, 7, 1, 2) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 9): self.top_grid_layout.setColumnStretch(c, 1) self._Gain1_tool_bar = Qt.QToolBar(self) self._Gain1_tool_bar.addWidget(Qt.QLabel('Gain1'+": ")) self._Gain1_line_edit = Qt.QLineEdit(str(self.Gain1)) self._Gain1_tool_bar.addWidget(self._Gain1_line_edit) self._Gain1_line_edit.returnPressed.connect( lambda: self.set_Gain1(eng_notation.str_to_num(str(self._Gain1_line_edit.text())))) self.top_grid_layout.addWidget(self._Gain1_tool_bar, 3, 0, 1, 2) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Frequency_tool_bar = Qt.QToolBar(self) self._Frequency_tool_bar.addWidget(Qt.QLabel('Freq. Hz'+": ")) self._Frequency_line_edit = Qt.QLineEdit(str(self.Frequency)) self._Frequency_tool_bar.addWidget(self._Frequency_line_edit) self._Frequency_line_edit.returnPressed.connect( lambda: self.set_Frequency(eng_notation.str_to_num(str(self._Frequency_line_edit.text())))) self.top_grid_layout.addWidget(self._Frequency_tool_bar, 0, 5, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 7): self.top_grid_layout.setColumnStretch(c, 1) self._EventMode_options = (0, 1, ) self._EventMode_labels = ('! ! Wait ! !', 'Write', ) self._EventMode_tool_bar = Qt.QToolBar(self) self._EventMode_tool_bar.addWidget(Qt.QLabel('Event Mode'+": ")) self._EventMode_combo_box = Qt.QComboBox() self._EventMode_tool_bar.addWidget(self._EventMode_combo_box) for label in self._EventMode_labels: self._EventMode_combo_box.addItem(label) self._EventMode_callback = lambda i: Qt.QMetaObject.invokeMethod(self._EventMode_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._EventMode_options.index(i))) self._EventMode_callback(self.EventMode) self._EventMode_combo_box.currentIndexChanged.connect( lambda i: self.set_EventMode(self._EventMode_options[i])) self.top_grid_layout.addWidget(self._EventMode_tool_bar, 2, 2, 1, 3) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 5): self.top_grid_layout.setColumnStretch(c, 1) self._Elevation_tool_bar = Qt.QToolBar(self) self._Elevation_tool_bar.addWidget(Qt.QLabel('Elevation'+": ")) self._Elevation_line_edit = Qt.QLineEdit(str(self.Elevation)) self._Elevation_tool_bar.addWidget(self._Elevation_line_edit) self._Elevation_line_edit.returnPressed.connect( lambda: self.set_Elevation(eng_notation.str_to_num(str(self._Elevation_line_edit.text())))) self.top_grid_layout.addWidget(self._Elevation_tool_bar, 1, 7, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 9): self.top_grid_layout.setColumnStretch(c, 1) self._Device_tool_bar = Qt.QToolBar(self) self._Device_tool_bar.addWidget(Qt.QLabel('Dev'+": ")) self._Device_line_edit = Qt.QLineEdit(str(self.Device)) self._Device_tool_bar.addWidget(self._Device_line_edit) self._Device_line_edit.returnPressed.connect( lambda: self.set_Device(str(str(self._Device_line_edit.text())))) self.top_grid_layout.addWidget(self._Device_tool_bar, 2, 0, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) _DebugOn_check_box = Qt.QCheckBox('DebugOn') self._DebugOn_choices = {True: True, False: False} self._DebugOn_choices_inv = dict((v,k) for k,v in self._DebugOn_choices.iteritems()) self._DebugOn_callback = lambda i: Qt.QMetaObject.invokeMethod(_DebugOn_check_box, "setChecked", Qt.Q_ARG("bool", self._DebugOn_choices_inv[i])) self._DebugOn_callback(self.DebugOn) _DebugOn_check_box.stateChanged.connect(lambda i: self.set_DebugOn(self._DebugOn_choices[bool(i)])) self.top_grid_layout.addWidget(_DebugOn_check_box, 7, 7, 1, 1) for r in range(7, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 8): self.top_grid_layout.setColumnStretch(c, 1) _DcOffsetMode_check_box = Qt.QCheckBox('DcOffsetMode') self._DcOffsetMode_choices = {True: True, False: False} self._DcOffsetMode_choices_inv = dict((v,k) for k,v in self._DcOffsetMode_choices.iteritems()) self._DcOffsetMode_callback = lambda i: Qt.QMetaObject.invokeMethod(_DcOffsetMode_check_box, "setChecked", Qt.Q_ARG("bool", self._DcOffsetMode_choices_inv[i])) self._DcOffsetMode_callback(self.DcOffsetMode) _DcOffsetMode_check_box.stateChanged.connect(lambda i: self.set_DcOffsetMode(self._DcOffsetMode_choices[bool(i)])) self.top_grid_layout.addWidget(_DcOffsetMode_check_box, 7, 0, 1, 1) for r in range(7, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) _BroadcastNotch_check_box = Qt.QCheckBox('BroadcastNotch') self._BroadcastNotch_choices = {True: True, False: False} self._BroadcastNotch_choices_inv = dict((v,k) for k,v in self._BroadcastNotch_choices.iteritems()) self._BroadcastNotch_callback = lambda i: Qt.QMetaObject.invokeMethod(_BroadcastNotch_check_box, "setChecked", Qt.Q_ARG("bool", self._BroadcastNotch_choices_inv[i])) self._BroadcastNotch_callback(self.BroadcastNotch) _BroadcastNotch_check_box.stateChanged.connect(lambda i: self.set_BroadcastNotch(self._BroadcastNotch_choices[bool(i)])) self.top_grid_layout.addWidget(_BroadcastNotch_check_box, 7, 2, 1, 1) for r in range(7, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) _BiasOn_check_box = Qt.QCheckBox('BiasOn') self._BiasOn_choices = {True: True, False: False} self._BiasOn_choices_inv = dict((v,k) for k,v in self._BiasOn_choices.iteritems()) self._BiasOn_callback = lambda i: Qt.QMetaObject.invokeMethod(_BiasOn_check_box, "setChecked", Qt.Q_ARG("bool", self._BiasOn_choices_inv[i])) self._BiasOn_callback(self.BiasOn) _BiasOn_check_box.stateChanged.connect(lambda i: self.set_BiasOn(self._BiasOn_choices[bool(i)])) self.top_grid_layout.addWidget(_BiasOn_check_box, 7, 6, 1, 1) for r in range(7, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 7): self.top_grid_layout.setColumnStretch(c, 1) self._Bandwidth_tool_bar = Qt.QToolBar(self) self._Bandwidth_tool_bar.addWidget(Qt.QLabel('Bandwidth'+": ")) self._Bandwidth_line_edit = Qt.QLineEdit(str(self.Bandwidth)) self._Bandwidth_tool_bar.addWidget(self._Bandwidth_line_edit) self._Bandwidth_line_edit.returnPressed.connect( lambda: self.set_Bandwidth(eng_notation.str_to_num(str(self._Bandwidth_line_edit.text())))) self.top_grid_layout.addWidget(self._Bandwidth_tool_bar, 1, 5, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 7): self.top_grid_layout.setColumnStretch(c, 1) self._Azimuth_tool_bar = Qt.QToolBar(self) self._Azimuth_tool_bar.addWidget(Qt.QLabel('Azimuth'+": ")) self._Azimuth_line_edit = Qt.QLineEdit(str(self.Azimuth)) self._Azimuth_tool_bar.addWidget(self._Azimuth_line_edit) self._Azimuth_line_edit.returnPressed.connect( lambda: self.set_Azimuth(eng_notation.str_to_num(str(self._Azimuth_line_edit.text())))) self.top_grid_layout.addWidget(self._Azimuth_tool_bar, 0, 7, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 9): self.top_grid_layout.setColumnStretch(c, 1) self.sdrplay_rsp1a_source_0 = sdrplay.rsp1a_source(Frequency, 7000, False, int(IFattn), DcOffsetMode, IQMode, bool(DebugOn), 0, 1, Bandwidth, BroadcastNotch, False, int(Gain1), bool(BiasOn), '0') self.radio_astro_vmedian_0_0_1_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_1 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_ra_event_sink_0 = radio_astro.ra_event_sink(ObsName+"Event.not", fftsize, Frequency*1.E-6, Bandwidth*1.E-6, EventMode, 'Event Detection', 'Observer', Telescope, Device, float(Gain1), Azimuth, Elevation) self.radio_astro_ra_ascii_sink_0 = radio_astro.ra_ascii_sink(ObsName+".not", observer, fftsize, Frequency, Bandwidth, Azimuth, Elevation, Record, 0, 4**5, nAve, telescope_save, device_save, float(Gain1), float(Gain2), float(Gain2)) self.radio_astro_detect_0 = radio_astro.detect(fftsize, nsigma, Frequency, Bandwidth, fftsize*1.e-6/Bandwidth, 2) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c( fftsize, #size Bandwidth, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(1) self.qtgui_time_sink_x_0_0.set_y_axis(-.3, .3) self.qtgui_time_sink_x_0_0.set_y_label('Event', "") self.qtgui_time_sink_x_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0.enable_autoscale(True) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) self.qtgui_time_sink_x_0_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['I', 'Q', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: if(i % 2 == 0): self.qtgui_time_sink_x_0_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 4, 3, 3, 6) for r in range(4, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 9): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_number_sink_0 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1 ) self.qtgui_number_sink_0.set_update_time(1.) self.qtgui_number_sink_0.set_title("") labels = ['T Remains:', '', '', '', '', '', '', '', '', ''] units = ['(s)', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, 0.) self.qtgui_number_sink_0.set_max(i, nAve * fftsize * 1024. / Bandwidth) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance(self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win, 3, 5, 1, 2) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 7): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_histogram_sink_x_0 = qtgui.histogram_sink_f( fftsize, 100, -.4, .4, "", 2 ) self.qtgui_histogram_sink_x_0.set_update_time(1.) self.qtgui_histogram_sink_x_0.enable_autoscale(True) self.qtgui_histogram_sink_x_0.enable_accumulate(False) self.qtgui_histogram_sink_x_0.enable_grid(False) self.qtgui_histogram_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_histogram_sink_x_0.disable_legend() labels = ['I', 'Q', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_histogram_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_histogram_sink_x_0.set_line_label(i, labels[i]) self.qtgui_histogram_sink_x_0.set_line_width(i, widths[i]) self.qtgui_histogram_sink_x_0.set_line_color(i, colors[i]) self.qtgui_histogram_sink_x_0.set_line_style(i, styles[i]) self.qtgui_histogram_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_histogram_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_histogram_sink_x_0_win = sip.wrapinstance(self.qtgui_histogram_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_histogram_sink_x_0_win, 4, 0, 1, 3) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 3): self.top_grid_layout.setColumnStretch(c, 1) self.fft_vxx_0 = fft.fft_vcc(fftsize, True, (window.hamming(fftsize)), True, 1) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, fftsize) self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fftsize) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(fftsize) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_float_0, 1), (self.qtgui_histogram_sink_x_0, 1)) self.connect((self.blocks_complex_to_float_0, 0), (self.qtgui_histogram_sink_x_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.radio_astro_vmedian_0_0_1, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.radio_astro_detect_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.radio_astro_ra_event_sink_0, 0)) self.connect((self.radio_astro_ra_ascii_sink_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.radio_astro_vmedian_0, 0), (self.radio_astro_ra_ascii_sink_0, 0)) self.connect((self.radio_astro_vmedian_0_0, 0), (self.radio_astro_vmedian_0, 0)) self.connect((self.radio_astro_vmedian_0_0_0, 0), (self.radio_astro_vmedian_0_0, 0)) self.connect((self.radio_astro_vmedian_0_0_1, 0), (self.radio_astro_vmedian_0_0_1_0, 0)) self.connect((self.radio_astro_vmedian_0_0_1_0, 0), (self.radio_astro_vmedian_0_0_0, 0)) self.connect((self.sdrplay_rsp1a_source_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.sdrplay_rsp1a_source_0, 0), (self.blocks_stream_to_vector_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "NSF Airspy 10 MHz - No Gui") ################################################## # Variables ################################################## self.ObsName = ObsName = "Integrate100" self.ConfigFile = ConfigFile = ObsName+".conf" self._telescope_save_config = ConfigParser.ConfigParser() self._telescope_save_config.read(ConfigFile) try: telescope_save = self._telescope_save_config.get('main', 'telescope') except: telescope_save = 'Bubble Wrap Horn' self.telescope_save = telescope_save self._observers_save_config = ConfigParser.ConfigParser() self._observers_save_config.read(ConfigFile) try: observers_save = self._observers_save_config.get('main', 'observers') except: observers_save = 'Science Aficionado' self.observers_save = observers_save self._nsigmas_config = ConfigParser.ConfigParser() self._nsigmas_config.read(ConfigFile) try: nsigmas = self._nsigmas_config.getfloat('main', 'nsigma') except: nsigmas = 5.5 self.nsigmas = nsigmas self._nAves_config = ConfigParser.ConfigParser() self._nAves_config.read(ConfigFile) try: nAves = self._nAves_config.getint('main', 'nave') except: nAves = 20 self.nAves = nAves self._fftsize_save_config = ConfigParser.ConfigParser() self._fftsize_save_config.read(ConfigFile) try: fftsize_save = self._fftsize_save_config.getint('main', 'fftsize') except: fftsize_save = 1024 self.fftsize_save = fftsize_save self._device_save_config = ConfigParser.ConfigParser() self._device_save_config.read(ConfigFile) try: device_save = self._device_save_config.get('main', 'device') except: device_save = 'airspy,bias=1,pack=1' self.device_save = device_save self._Gain3s_config = ConfigParser.ConfigParser() self._Gain3s_config.read(ConfigFile) try: Gain3s = self._Gain3s_config.getfloat('main', 'gain3') except: Gain3s = 13 self.Gain3s = Gain3s self._Gain2s_config = ConfigParser.ConfigParser() self._Gain2s_config.read(ConfigFile) try: Gain2s = self._Gain2s_config.getfloat('main', 'gain2') except: Gain2s = 12 self.Gain2s = Gain2s self._Gain1s_config = ConfigParser.ConfigParser() self._Gain1s_config.read(ConfigFile) try: Gain1s = self._Gain1s_config.getfloat('main', 'gain1') except: Gain1s = 14. self.Gain1s = Gain1s self._Frequencys_config = ConfigParser.ConfigParser() self._Frequencys_config.read(ConfigFile) try: Frequencys = self._Frequencys_config.getfloat('main', 'Frequency') except: Frequencys = 1420.4e6 self.Frequencys = Frequencys self._Elevation_save_config = ConfigParser.ConfigParser() self._Elevation_save_config.read(ConfigFile) try: Elevation_save = self._Elevation_save_config.getfloat('main', 'elevation') except: Elevation_save = 90. self.Elevation_save = Elevation_save self._Bandwidths_config = ConfigParser.ConfigParser() self._Bandwidths_config.read(ConfigFile) try: Bandwidths = self._Bandwidths_config.getfloat('main', 'Bandwidth') except: Bandwidths = 10.e6 self.Bandwidths = Bandwidths self._Azimuth_save_config = ConfigParser.ConfigParser() self._Azimuth_save_config.read(ConfigFile) try: Azimuth_save = self._Azimuth_save_config.getfloat('main', 'azimuth') except: Azimuth_save = 90. self.Azimuth_save = Azimuth_save self.observer = observer = observers_save self.nsigma = nsigma = nsigmas self.nAve = nAve = nAves self.fftsize = fftsize = fftsize_save self.Telescope = Telescope = telescope_save self.Record = Record = 1 self.Gain3 = Gain3 = Gain3s self.Gain2 = Gain2 = Gain2s self.Gain1 = Gain1 = Gain1s self.Frequency = Frequency = Frequencys self.EventMode = EventMode = 1 self.Elevation = Elevation = Elevation_save self.Device = Device = device_save self.Bandwidth = Bandwidth = Bandwidths self.Azimuth = Azimuth = Azimuth_save ################################################## # Blocks ################################################## self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + Device ) self.rtlsdr_source_0.set_sample_rate(Bandwidth) self.rtlsdr_source_0.set_center_freq(Frequency, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(float(Gain1), 0) self.rtlsdr_source_0.set_if_gain(float(Gain2), 0) self.rtlsdr_source_0.set_bb_gain(float(Gain2), 0) self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(Bandwidth, 0) (self.rtlsdr_source_0).set_processor_affinity([3]) self.radio_astro_vmedian_0_0_1_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_1 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_ra_event_sink_0 = radio_astro.ra_event_sink(ObsName+"Event.not", 2*fftsize, Frequency*1.E-6, Bandwidth*1.E-6, EventMode, 'Event Detection', 'Observer', Telescope, Device, float(Gain1), Azimuth, Elevation) self.radio_astro_ra_event_log_0 = radio_astro.ra_event_log('', 'Event Detection', 2*fftsize, Bandwidth*1.e-6) self.radio_astro_ra_ascii_sink_0 = radio_astro.ra_ascii_sink(ObsName+".not", observer, fftsize, Frequency, Bandwidth, Azimuth, Elevation, Record, 0, 4**5, nAve, telescope_save, device_save, float(Gain1), float(Gain2), float(Gain3)) self.radio_astro_detect_0 = radio_astro.detect(2*fftsize, nsigma, Frequency, Bandwidth, fftsize*1.e-6/Bandwidth, 2) self.fft_vxx_0 = fft.fft_vcc(fftsize, True, (window.hamming(fftsize)), True, 1) self.blocks_stream_to_vector_0_0_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 2*fftsize) self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fftsize) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(fftsize) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.radio_astro_vmedian_0_0_1, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_stream_to_vector_0_0_0, 0), (self.radio_astro_detect_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.radio_astro_ra_event_log_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.radio_astro_ra_event_sink_0, 0)) self.connect((self.radio_astro_ra_ascii_sink_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.radio_astro_vmedian_0, 0), (self.radio_astro_ra_ascii_sink_0, 0)) self.connect((self.radio_astro_vmedian_0_0, 0), (self.radio_astro_vmedian_0, 0)) self.connect((self.radio_astro_vmedian_0_0_0, 0), (self.radio_astro_vmedian_0_0, 0)) self.connect((self.radio_astro_vmedian_0_0_1, 0), (self.radio_astro_vmedian_0_0_1_0, 0)) self.connect((self.radio_astro_vmedian_0_0_1_0, 0), (self.radio_astro_vmedian_0_0_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Test Signal. Adds a tone in 1 MHz band") Qt.QWidget.__init__(self) self.setWindowTitle("Test Signal. Adds a tone in 1 MHz band") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "NsfTest") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.OffsetMHz = OffsetMHz = 0.111 self.FreqMHz = FreqMHz = 1437 self.Bandwidth = Bandwidth = 1.e6 self.samp_rate = samp_rate = int(Bandwidth) self.fftsize = fftsize = 1024 self.Offset = Offset = OffsetMHz * 1.E6 self.H1 = H1 = 1420.406E6 self.Gain1 = Gain1 = 75 self.Frequency = Frequency = FreqMHz * 1.E6 self.Attn1 = Attn1 = 80 ################################################## # Blocks ################################################## self._Gain1_tool_bar = Qt.QToolBar(self) self._Gain1_tool_bar.addWidget(Qt.QLabel('Gain1' + ": ")) self._Gain1_line_edit = Qt.QLineEdit(str(self.Gain1)) self._Gain1_tool_bar.addWidget(self._Gain1_line_edit) self._Gain1_line_edit.returnPressed.connect(lambda: self.set_Gain1( eng_notation.str_to_num(str(self._Gain1_line_edit.text().toAscii()) ))) self.top_grid_layout.addWidget(self._Gain1_tool_bar, 0, 0, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Attn1_tool_bar = Qt.QToolBar(self) self._Attn1_tool_bar.addWidget(Qt.QLabel('Attn1' + ": ")) self._Attn1_line_edit = Qt.QLineEdit(str(self.Attn1)) self._Attn1_tool_bar.addWidget(self._Attn1_line_edit) self._Attn1_line_edit.returnPressed.connect(lambda: self.set_Attn1( eng_notation.str_to_num(str(self._Attn1_line_edit.text().toAscii()) ))) self.top_grid_layout.addWidget(self._Attn1_tool_bar, 1, 0, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.radio_astro_vmedian_0_2_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_2 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0 = radio_astro.vmedian(fftsize, 4) self.qtgui_vector_sink_f_0_0 = qtgui.vector_sink_f( fftsize, float(Frequency - (Bandwidth / 2.)) * 1.e-6, float(Bandwidth * 1.e-6 / fftsize), "Frequency (MHz)", 'Intensity', "", 1 # Number of inputs ) self.qtgui_vector_sink_f_0_0.set_update_time(.5) self.qtgui_vector_sink_f_0_0.set_y_axis(0, 1.) self.qtgui_vector_sink_f_0_0.enable_autoscale(False) self.qtgui_vector_sink_f_0_0.enable_grid(False) self.qtgui_vector_sink_f_0_0.set_x_axis_units("") self.qtgui_vector_sink_f_0_0.set_y_axis_units("") self.qtgui_vector_sink_f_0_0.set_ref_level(0) labels = ['Latest', 'Median', 'Hot', 'Cold', 'Ref', '', '', '', '', ''] widths = [1, 3, 2, 2, 3, 1, 1, 1, 1, 1] colors = [ "black", "dark green", "red", "blue", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [2., 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_vector_sink_f_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_vector_sink_f_0_0.set_line_label(i, labels[i]) self.qtgui_vector_sink_f_0_0.set_line_width(i, widths[i]) self.qtgui_vector_sink_f_0_0.set_line_color(i, colors[i]) self.qtgui_vector_sink_f_0_0.set_line_alpha(i, alphas[i]) self._qtgui_vector_sink_f_0_0_win = sip.wrapinstance( self.qtgui_vector_sink_f_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_vector_sink_f_0_0_win, 2, 2, 4, 3) for r in range(2, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 5): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_histogram_sink_x_0 = qtgui.histogram_sink_f( fftsize, 100, -.4, .4, "", 2) self.qtgui_histogram_sink_x_0.set_update_time(1.) self.qtgui_histogram_sink_x_0.enable_autoscale(True) self.qtgui_histogram_sink_x_0.enable_accumulate(False) self.qtgui_histogram_sink_x_0.enable_grid(False) self.qtgui_histogram_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_histogram_sink_x_0.disable_legend() labels = ['I', 'Q', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_histogram_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_histogram_sink_x_0.set_line_label(i, labels[i]) self.qtgui_histogram_sink_x_0.set_line_width(i, widths[i]) self.qtgui_histogram_sink_x_0.set_line_color(i, colors[i]) self.qtgui_histogram_sink_x_0.set_line_style(i, styles[i]) self.qtgui_histogram_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_histogram_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_histogram_sink_x_0_win = sip.wrapinstance( self.qtgui_histogram_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_histogram_sink_x_0_win, 2, 0, 3, 2) for r in range(2, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.pluto_source_0 = iio.pluto_source('192.168.2.1', int(int(Frequency)), int(int(Bandwidth)), int(20000000), 0x8000, False, False, True, "manual", float(Gain1), '', True) self.pluto_sink_0 = iio.pluto_sink('', int(float(Frequency + Offset)), int(float(Bandwidth)), int(20000000), 0x8000, False, float(Attn1), '', True) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, Bandwidth, .1E6, .025E6, firdes.WIN_HAMMING, 6.76)) self.fft_vxx_0 = fft.fft_vcc(fftsize, True, (window.hamming(fftsize)), True, 1) self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, fftsize) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(fftsize) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.blocks_add_const_vxx_0 = blocks.add_const_vcc((1, )) self.analog_noise_source_x_0 = analog.noise_source_c( analog.GR_GAUSSIAN, 30, 0) self._OffsetMHz_tool_bar = Qt.QToolBar(self) self._OffsetMHz_tool_bar.addWidget(Qt.QLabel('OffsetMHz)' + ": ")) self._OffsetMHz_line_edit = Qt.QLineEdit(str(self.OffsetMHz)) self._OffsetMHz_tool_bar.addWidget(self._OffsetMHz_line_edit) self._OffsetMHz_line_edit.returnPressed.connect( lambda: self.set_OffsetMHz( eng_notation.str_to_num( str(self._OffsetMHz_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._OffsetMHz_tool_bar, 1, 2, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._FreqMHz_tool_bar = Qt.QToolBar(self) self._FreqMHz_tool_bar.addWidget(Qt.QLabel('Freq (MHz)' + ": ")) self._FreqMHz_line_edit = Qt.QLineEdit(str(self.FreqMHz)) self._FreqMHz_tool_bar.addWidget(self._FreqMHz_line_edit) self._FreqMHz_line_edit.returnPressed.connect(lambda: self.set_FreqMHz( eng_notation.str_to_num( str(self._FreqMHz_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._FreqMHz_tool_bar, 0, 2, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.pluto_sink_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.qtgui_histogram_sink_x_0, 1)) self.connect((self.blocks_complex_to_float_0, 0), (self.qtgui_histogram_sink_x_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.radio_astro_vmedian_0_2, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.pluto_source_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.pluto_source_0, 0), (self.blocks_stream_to_vector_0_0, 0)) self.connect((self.radio_astro_vmedian_0, 0), (self.qtgui_vector_sink_f_0_0, 0)) self.connect((self.radio_astro_vmedian_0_0, 0), (self.radio_astro_vmedian_0, 0)) self.connect((self.radio_astro_vmedian_0_2, 0), (self.radio_astro_vmedian_0_2_0, 0)) self.connect((self.radio_astro_vmedian_0_2_0, 0), (self.radio_astro_vmedian_0_0, 0))