def __init__(self):
        gr.top_block.__init__(self, "Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_rx = samp_rate_rx = 500e3
        self.samp_rate = samp_rate = 48000
        self.initial_bandwidth = initial_bandwidth = 100e3
        self.first_stage_decimation = first_stage_decimation = 4
        self.audio_decimation = audio_decimation = 2

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_ogg_source_0 = satnogs.ogg_source('/home/mocha/Desktop/satnogs_1389117_2019-12-17T09-31-56.ogg', 1, False)
        self.satnogs_noaa_apt_sink_0_0 = satnogs.noaa_apt_sink('/home/mocha/Desktop/satnogs_1389117_2019-12-17T09-31-56_ogg.png', 2080, 1800, True, True)
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
                interpolation=int(samp_rate_rx/ ( first_stage_decimation  * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation),
                decimation=48000,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
                interpolation=1,
                decimation=4,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=4*4160,
                decimation=int((samp_rate_rx/ ( first_stage_decimation  * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation)/2),
                taps=None,
                fractional_bw=None,
        )
        self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.fir_filter_xxx_1 = filter.fir_filter_fff(2, ([0.5, 0.5]))
        self.fir_filter_xxx_1.declare_sample_delay(0)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	6, samp_rate_rx/ ( first_stage_decimation  * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76))



        ##################################################
        # Connections
        ##################################################
        self.connect((self.band_pass_filter_0, 0), (self.fir_filter_xxx_1, 0))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.satnogs_noaa_apt_sink_0_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0), (self.band_pass_filter_0, 0))
        self.connect((self.satnogs_ogg_source_0, 0), (self.rational_resampler_xxx_1, 0))
Exemple #2
0
    def __init__(self, antenna=satnogs.not_set_antenna, bb_gain=satnogs.not_set_rx_bb_gain, decoded_data_file_path='/home/mocha/.satnogs/data/data', dev_args='rtl=00000002', doppler_correction_per_sec=20, enable_iq_dump=0, file_path='/home/mocha/Desktop/test.ogg', flip_images=0, if_gain=satnogs.not_set_rx_if_gain, iq_file_path='/tmp/iq.dat', lo_offset=100e3, ppm=0, rf_gain=satnogs.not_set_rx_rf_gain, rigctl_port=4532, rx_freq=137812000, rx_sdr_device='rtlsdr', sync=1):
        gr.top_block.__init__(self, "APT Generic Demodulation")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.flip_images = flip_images
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.sync = sync

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[rx_sdr_device]['samp_rate']
        self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(1, samp_rate_rx, 125000, 25000, firdes.WIN_HAMMING, 6.76)

        self.taps = taps = firdes.low_pass(12.0, samp_rate_rx, 100e3, 60000, firdes.WIN_HAMMING, 6.76)

        self.initial_bandwidth = initial_bandwidth = 100e3

        self.first_stage_filter_taps = first_stage_filter_taps = firdes.low_pass(1.0, 1.0, 0.2, 0.1, firdes.WIN_HAMMING, 6.76)

        self.first_stage_decimation = first_stage_decimation = 4
        self.filter_rate = filter_rate = 250000
        self.deviation = deviation = 17000
        self.audio_samp_rate = audio_samp_rate = 48000
        self.audio_decimation = audio_decimation = 2

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_noaa_apt_sink_0 = satnogs.noaa_apt_sink('/tmp/.satnogs/data/test-2.png', 2080, 1800, bool(sync), bool(flip_images))
        self.rational_resampler_xxx_1_0 = filter.rational_resampler_fff(
                interpolation=int(samp_rate_rx/ ( first_stage_decimation  * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation),
                decimation=48000,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=1,
                decimation=2,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_3 = filter.rational_resampler_fff(
                interpolation=1,
                decimation=4,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_2 = filter.rational_resampler_fff(
                interpolation=4*4160,
                decimation=int((samp_rate_rx/ ( first_stage_decimation  * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation)/2),
                taps=None,
                fractional_bw=None,
        )
        self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(int(samp_rate_rx/filter_rate), (xlate_filter_taps), lo_offset, samp_rate_rx)
        self.fir_filter_xxx_1 = filter.fir_filter_fff(2, ([0.5, 0.5]))
        self.fir_filter_xxx_1.declare_sample_delay(0)
        self.blocks_uchar_to_float_1 = blocks.uchar_to_float()
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate_rx,True)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((0.008, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.008, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, '/home/mocha/Desktop/1912_December/iq_NOAA_18_20191016T101359_137812000Hz_IQ.wav', False)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_char*1, 1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_add_const_vxx_1 = blocks.add_const_vff((-127, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((127, ))
        self.blks2_rational_resampler_xxx_1 = filter.rational_resampler_ccc(
                interpolation=48,
                decimation=125,
                taps=None,
                fractional_bw=None,
        )
        self.band_pass_filter_0_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	6, samp_rate_rx/ ( first_stage_decimation  * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76))
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf((2*math.pi*deviation)/96000)



        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.band_pass_filter_0_0, 0), (self.fir_filter_xxx_1, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_add_const_vxx_1, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.rational_resampler_3, 0))
        self.connect((self.blocks_deinterleave_0, 0), (self.blocks_uchar_to_float_0, 0))
        self.connect((self.blocks_deinterleave_0, 1), (self.blocks_uchar_to_float_1, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blocks_deinterleave_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_throttle_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_uchar_to_float_1, 0), (self.blocks_add_const_vxx_1, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.rational_resampler_2, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blks2_rational_resampler_xxx_1, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.rational_resampler_2, 0), (self.hilbert_fc_0, 0))
        self.connect((self.rational_resampler_3, 0), (self.satnogs_noaa_apt_sink_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.rational_resampler_xxx_1_0, 0))
        self.connect((self.rational_resampler_xxx_1_0, 0), (self.band_pass_filter_0_0, 0))
Exemple #3
0
    def __init__(self, doppler_correction_per_sec=1000, lo_offset=100e3, ppm=0, rigctl_port=4532, rx_freq=90.4e6, rx_sdr_device='usrpb200', image_file_path='/tmp/noaa.png'):
        gr.top_block.__init__(self, "NOAA APT Decoder")

        ##################################################
        # Parameters
        ##################################################
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.image_file_path = image_file_path

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[rx_sdr_device]['samp_rate']

        self.noaa_filter_taps = noaa_filter_taps = firdes.low_pass(1.0, 1.0, 0.17, 0.01, firdes.WIN_HAMMING, 6.76)

        self.initial_bandwidth = initial_bandwidth = 100e3
        self.audio_decimation = audio_decimation = 2

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000, 1500)
        self.satnogs_noaa_apt_sink_0 = satnogs.noaa_apt_sink(image_file_path, 2080, 1500, True, False, False)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
                interpolation=4160,
                decimation=9600,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=9600,
                decimation=int(((samp_rate_rx / int(samp_rate_rx / initial_bandwidth)) / audio_decimation) / 2),
                taps=None,
                fractional_bw=None,
        )
        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] )
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 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(satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'], 0)
        self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[rx_sdr_device]['if_gain'], 0)
        self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'], 0)
        self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[rx_sdr_device]['antenna'], 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.fir_filter_xxx_1 = filter.fir_filter_fff(2, ([0.5, 0.5]))
        self.fir_filter_xxx_1.declare_sample_delay(0)
        self.fir_filter_xxx_0 = filter.fir_filter_ccc(int(samp_rate_rx / initial_bandwidth), (noaa_filter_taps))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	6, (samp_rate_rx / int(samp_rate_rx / initial_bandwidth)) / audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76))
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=samp_rate_rx / int(samp_rate_rx / initial_bandwidth),
        	audio_decimation=audio_decimation,
        )

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_wfm_rcv_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.fir_filter_xxx_1, 0))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.fir_filter_xxx_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.satnogs_noaa_apt_sink_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.fir_filter_xxx_0, 0))
Exemple #4
0
    def __init__(self,
                 antenna="RX",
                 bb_freq=0.0,
                 bw=0.0,
                 dc_removal="False",
                 decoded_data_file_path="/tmp/.satnogs/data/data",
                 dev_args="",
                 doppler_correction_per_sec=20,
                 enable_iq_dump=0,
                 file_path="test.wav",
                 flip_images=0,
                 gain=0.0,
                 gain_mode="Overall",
                 iq_file_path="/tmp/iq.dat",
                 lo_offset=100e3,
                 other_settings="",
                 ppm=0,
                 rigctl_port=4532,
                 rx_freq=100e6,
                 samp_rate_rx=2048000,
                 soapy_rx_device="driver=rtlsdr",
                 stream_args="",
                 sync=1,
                 tune_args="",
                 udp_IP="127.0.0.1",
                 udp_dump_host="",
                 udp_dump_port=57356,
                 udp_port=16887,
                 waterfall_file_path="/tmp/waterfall.dat"):
        gr.top_block.__init__(self, "NOAA APT Decoder")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.bb_freq = bb_freq
        self.bw = bw
        self.dc_removal = dc_removal
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.flip_images = flip_images
        self.gain = gain
        self.gain_mode = gain_mode
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.other_settings = other_settings
        self.ppm = ppm
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.samp_rate_rx = samp_rate_rx
        self.soapy_rx_device = soapy_rx_device
        self.stream_args = stream_args
        self.sync = sync
        self.tune_args = tune_args
        self.udp_IP = udp_IP
        self.udp_dump_host = udp_dump_host
        self.udp_dump_port = udp_dump_port
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.audio_samp_rate = audio_samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.soapy_source_0_0 = None
        # Make sure that the gain mode is valid
        if (gain_mode not in ['Overall', 'Specific', 'Settings Field']):
            raise ValueError(
                "Wrong gain mode on channel 0. Allowed gain modes: "
                "['Overall', 'Specific', 'Settings Field']")

        dev = soapy_rx_device

        # Stream arguments for every activated stream
        tune_args = [tune_args]
        settings = [other_settings]

        # Setup the device arguments
        dev_args = dev_args

        self.soapy_source_0_0 = soapy.source(1, dev, dev_args, stream_args,
                                             tune_args, settings, samp_rate_rx,
                                             "fc32")

        self.soapy_source_0_0.set_dc_removal(
            0, bool(distutils.util.strtobool(dc_removal)))

        # Set up DC offset. If set to (0, 0) internally the source block
        # will handle the case if no DC offset correction is supported
        self.soapy_source_0_0.set_dc_offset(0, 0)

        # Setup IQ Balance. If set to (0, 0) internally the source block
        # will handle the case if no IQ balance correction is supported
        self.soapy_source_0_0.set_iq_balance(0, 0)

        self.soapy_source_0_0.set_agc(0, False)

        # generic frequency setting should be specified first
        self.soapy_source_0_0.set_frequency(0, rx_freq - lo_offset)

        self.soapy_source_0_0.set_frequency(0, "BB", bb_freq)

        # Setup Frequency correction. If set to 0 internally the source block
        # will handle the case if no frequency correction is supported
        self.soapy_source_0_0.set_frequency_correction(0, ppm)

        self.soapy_source_0_0.set_antenna(0, antenna)

        self.soapy_source_0_0.set_bandwidth(0, bw)

        if (gain_mode != 'Settings Field'):
            # pass is needed, in case the template does not evaluare anything
            pass
            self.soapy_source_0_0.set_gain(0, gain)
        self.satnogs_waterfall_sink_0_0 = satnogs.waterfall_sink(
            4 * 4160 * 4, rx_freq, 10, 1024, waterfall_file_path, 1)
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(
            file_path, audio_samp_rate, 0.8)
        self.satnogs_noaa_apt_sink_1 = satnogs.noaa_apt_sink(
            decoded_data_file_path, 2080, 1800, True, False)
        self.satnogs_iq_sink_0_0 = satnogs.iq_sink(16768, iq_file_path, False,
                                                   enable_iq_dump)
        self.satnogs_doppler_compensation_0 = satnogs.doppler_compensation(
            samp_rate_rx, rx_freq, lo_offset, 4 * 4160 * 4, 1, 0)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
            interpolation=1, decimation=4, taps=None, fractional_bw=None)
        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_fff(audio_samp_rate /
                                                             (4 * 4160 * 4),
                                                             taps=None,
                                                             flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)
        self.low_pass_filter_0_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, 4 * 4160 * 4, 4 * 4160 * 1.1, 1e3,
                            firdes.WIN_HAMMING, 6.76))
        self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.blocks_udp_sink_0_0 = blocks.udp_sink(gr.sizeof_gr_complex * 1,
                                                   udp_dump_host,
                                                   udp_dump_port, 1472, True)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.band_pass_filter_0 = filter.fir_filter_fff(
            4,
            firdes.band_pass(1, (4 * 4160 * 4), 500, 4.2e3, 200,
                             firdes.WIN_HAMMING, 6.76))
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=4 * 4160 * 4,
            audio_decimation=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.low_pass_filter_0_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.satnogs_noaa_apt_sink_1, 0))
        self.connect((self.satnogs_doppler_compensation_0, 0),
                     (self.blocks_udp_sink_0_0, 0))
        self.connect((self.satnogs_doppler_compensation_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.satnogs_doppler_compensation_0, 0),
                     (self.satnogs_iq_sink_0_0, 0))
        self.connect((self.satnogs_doppler_compensation_0, 0),
                     (self.satnogs_waterfall_sink_0_0, 0))
        self.connect((self.soapy_source_0_0, 0),
                     (self.satnogs_doppler_compensation_0, 0))
    def __init__(self, antenna=satnogs.not_set_antenna, bb_gain=satnogs.not_set_rx_bb_gain, decoded_data_file_path='/tmp/.satnogs/data/noaa', dev_args=satnogs.not_set_dev_args, doppler_correction_per_sec=20, enable_iq_dump=0, file_path='/tmp/test.ogg', flip_images=0, if_gain=satnogs.not_set_rx_if_gain, iq_file_path='/tmp/iq.dat', lo_offset=100e3, ppm=0, rf_gain=satnogs.not_set_rx_rf_gain, rigctl_port=4532, rx_freq=90.4e6, rx_sdr_device='usrpb200', sync=1, waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "NOAA APT Decoder")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.flip_images = flip_images
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.sync = sync
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[rx_sdr_device]['samp_rate']
        self.first_stage_decimation = first_stage_decimation = 4

        self.noaa_filter_taps = noaa_filter_taps = firdes.low_pass(1.0, samp_rate_rx /first_stage_decimation, 16.5e3, 4e3, firdes.WIN_HAMMING, 6.76)

        self.initial_bandwidth = initial_bandwidth = 100e3

        self.first_stage_filter_taps = first_stage_filter_taps = firdes.low_pass(1.0, 1.0, 0.2, 0.1, firdes.WIN_HAMMING, 6.76)

        self.audio_decimation = audio_decimation = 2

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(samp_rate_rx /first_stage_decimation, 0.0, 8, 1024, waterfall_file_path, 0)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000/doppler_correction_per_sec, 1500)
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(file_path, 48000, 0.8)
        self.satnogs_noaa_apt_sink_0 = satnogs.noaa_apt_sink(decoded_data_file_path, 2080, 1800, bool(sync), bool(flip_images))
        self.satnogs_iq_sink_0 = satnogs.iq_sink(32767, iq_file_path, False, enable_iq_dump)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx /first_stage_decimation)
        self.rational_resampler_xxx_2 = filter.rational_resampler_ccc(
                interpolation=48000,
                decimation=int(samp_rate_rx/ ( first_stage_decimation  * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation),
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
                interpolation=48000,
                decimation=int(samp_rate_rx/ ( first_stage_decimation  * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation),
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
                interpolation=1,
                decimation=4,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=4*4160,
                decimation=int((samp_rate_rx/ ( first_stage_decimation  * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation)/2),
                taps=None,
                fractional_bw=None,
        )
        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) )
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 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(satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(first_stage_decimation, (first_stage_filter_taps), lo_offset, samp_rate_rx)
        self.fir_filter_xxx_1 = filter.fir_filter_fff(2, ([0.5, 0.5]))
        self.fir_filter_xxx_1.declare_sample_delay(0)
        self.fft_filter_xxx_0 = filter.fft_filter_ccc(int(samp_rate_rx/ first_stage_decimation / initial_bandwidth), (noaa_filter_taps), 1)
        self.fft_filter_xxx_0.declare_sample_delay(0)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	6, samp_rate_rx/ ( first_stage_decimation  * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76))
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=samp_rate_rx/ ( first_stage_decimation  * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)),
        	audio_decimation=audio_decimation,
        )

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_wfm_rcv_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_1, 0))
        self.connect((self.band_pass_filter_0, 0), (self.fir_filter_xxx_1, 0))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.fft_filter_xxx_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.fft_filter_xxx_0, 0), (self.rational_resampler_xxx_2, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.satnogs_noaa_apt_sink_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0), (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.rational_resampler_xxx_2, 0), (self.satnogs_iq_sink_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.fft_filter_xxx_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.satnogs_waterfall_sink_0, 0))
Exemple #6
0
    def __init__(self,
                 antenna=satnogs.not_set_antenna,
                 bb_gain=satnogs.not_set_rx_bb_gain,
                 decoded_data_file_path='/tmp/.satnogs/data/noaa',
                 dev_args=satnogs.not_set_dev_args,
                 doppler_correction_per_sec=20,
                 enable_iq_dump=0,
                 file_path='/tmp/test.ogg',
                 flip_images=0,
                 if_gain=satnogs.not_set_rx_if_gain,
                 iq_file_path='/tmp/iq.dat',
                 lo_offset=100e3,
                 ppm=0,
                 rf_gain=satnogs.not_set_rx_rf_gain,
                 rigctl_port=4532,
                 rx_freq=90.4e6,
                 rx_sdr_device='usrpb200',
                 sync=1,
                 waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "NOAA APT Decoder")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.flip_images = flip_images
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.sync = sync
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[
            rx_sdr_device]['samp_rate']
        self.first_stage_decimation = first_stage_decimation = 4

        self.noaa_filter_taps = noaa_filter_taps = firdes.low_pass(
            1.0, samp_rate_rx / first_stage_decimation, 16.5e3, 4e3,
            firdes.WIN_HAMMING, 6.76)

        self.initial_bandwidth = initial_bandwidth = 100e3

        self.first_stage_filter_taps = first_stage_filter_taps = firdes.low_pass(
            1.0, 1.0, 0.2, 0.1, firdes.WIN_HAMMING, 6.76)

        self.audio_decimation = audio_decimation = 2

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(
            samp_rate_rx / first_stage_decimation, 0.0, 8, 1024,
            waterfall_file_path, 0)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source(
            "127.0.0.1", rigctl_port, False, 1000 / doppler_correction_per_sec,
            1500)
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(file_path, 48000, 0.8)
        self.satnogs_noaa_apt_sink_0 = satnogs.noaa_apt_sink(
            decoded_data_file_path, 2080, 1800, False, bool(sync),
            bool(flip_images))
        self.satnogs_iq_sink_0 = satnogs.iq_sink(32767, iq_file_path, False,
                                                 enable_iq_dump)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(
            rx_freq, samp_rate_rx / first_stage_decimation)
        self.rational_resampler_xxx_2 = filter.rational_resampler_ccc(
            interpolation=48000,
            decimation=int(samp_rate_rx / (first_stage_decimation * int(
                samp_rate_rx / first_stage_decimation / initial_bandwidth)) /
                           audio_decimation),
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
            interpolation=48000,
            decimation=int(samp_rate_rx / (first_stage_decimation * int(
                samp_rate_rx / first_stage_decimation / initial_bandwidth)) /
                           audio_decimation),
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
            interpolation=1,
            decimation=4,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=4 * 4160,
            decimation=int((samp_rate_rx / (first_stage_decimation * int(
                samp_rate_rx / first_stage_decimation / initial_bandwidth)) /
                            audio_decimation) / 2),
            taps=None,
            fractional_bw=None,
        )
        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            satnogs.handle_rx_dev_args(rx_sdr_device, dev_args))
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 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(
            satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(
            satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(
            satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(
            satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            first_stage_decimation, (first_stage_filter_taps), lo_offset,
            samp_rate_rx)
        self.fir_filter_xxx_1 = filter.fir_filter_fff(2, ([0.5, 0.5]))
        self.fir_filter_xxx_1.declare_sample_delay(0)
        self.fft_filter_xxx_0 = filter.fft_filter_ccc(
            int(samp_rate_rx / first_stage_decimation / initial_bandwidth),
            (noaa_filter_taps), 1)
        self.fft_filter_xxx_0.declare_sample_delay(0)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(
                6, samp_rate_rx / (first_stage_decimation * int(
                    samp_rate_rx / first_stage_decimation / initial_bandwidth))
                / audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76))
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=samp_rate_rx /
            (first_stage_decimation *
             int(samp_rate_rx / first_stage_decimation / initial_bandwidth)),
            audio_decimation=audio_decimation,
        )

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'),
                         (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_wfm_rcv_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.band_pass_filter_0, 0), (self.fir_filter_xxx_1, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.fft_filter_xxx_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.fft_filter_xxx_0, 0),
                     (self.rational_resampler_xxx_2, 0))
        self.connect((self.fir_filter_xxx_1, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.hilbert_fc_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.satnogs_noaa_apt_sink_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.rational_resampler_xxx_2, 0),
                     (self.satnogs_iq_sink_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.fft_filter_xxx_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.satnogs_waterfall_sink_0, 0))
Exemple #7
0
    def __init__(self,
                 antenna=satnogs.not_set_antenna,
                 bb_gain=satnogs.not_set_rx_bb_gain,
                 decoded_data_file_path='/tmp/.satnogs/data/noaa',
                 dev_args='rtl=00000001',
                 doppler_correction_per_sec=20,
                 enable_iq_dump=0,
                 file_path='/tmp/test.ogg',
                 flip_images=0,
                 if_gain=satnogs.not_set_rx_if_gain,
                 iq_file_path='/tmp/iq.dat',
                 lo_offset=100e3,
                 ppm=0,
                 rf_gain=satnogs.not_set_rx_rf_gain,
                 rigctl_port=4532,
                 rx_freq=90.4e6,
                 rx_sdr_device='rtlsdr',
                 sync=1,
                 waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "NOAA APT Decoder")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("NOAA APT Decoder")
        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", "satnogs_noaa_apt_decoder")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.flip_images = flip_images
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.sync = sync
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[
            rx_sdr_device]['samp_rate']
        self.first_stage_decimation = first_stage_decimation = 4

        self.noaa_filter_taps = noaa_filter_taps = firdes.low_pass(
            1.0, samp_rate_rx / first_stage_decimation, 16.5e3, 4e3,
            firdes.WIN_HAMMING, 6.76)

        self.initial_bandwidth = initial_bandwidth = 100e3

        self.first_stage_filter_taps = first_stage_filter_taps = firdes.low_pass(
            1.0, 1.0, 0.2, 0.1, firdes.WIN_HAMMING, 6.76)

        self.audio_decimation = audio_decimation = 2

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source(
            "127.0.0.1", rigctl_port, True, 1000 / doppler_correction_per_sec,
            1500)
        self.satnogs_noaa_apt_sink_0 = satnogs.noaa_apt_sink(
            decoded_data_file_path, 2080, 1800, bool(sync), bool(flip_images))
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(
            rx_freq, samp_rate_rx / first_stage_decimation)
        self.rational_resampler_xxx_2_0 = filter.rational_resampler_ccc(
            interpolation=int(samp_rate_rx / (first_stage_decimation * int(
                samp_rate_rx / first_stage_decimation / initial_bandwidth))),
            decimation=int(samp_rate_rx / first_stage_decimation),
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
            interpolation=1,
            decimation=4,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=4 * 4160,
            decimation=int((samp_rate_rx / (first_stage_decimation * int(
                samp_rate_rx / first_stage_decimation / initial_bandwidth)) /
                            audio_decimation) / 2),
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate_rx,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not True:
            self.qtgui_waterfall_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        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(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(
            self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            satnogs.handle_rx_dev_args(rx_sdr_device, dev_args))
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 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(
            satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(
            satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(
            satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(
            satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            first_stage_decimation, (first_stage_filter_taps), lo_offset,
            samp_rate_rx)
        self.fir_filter_xxx_1 = filter.fir_filter_fff(2, ([0.5, 0.5]))
        self.fir_filter_xxx_1.declare_sample_delay(0)
        self.fft_filter_xxx_0 = filter.fft_filter_ccc(
            int(samp_rate_rx / first_stage_decimation / initial_bandwidth),
            (noaa_filter_taps), 1)
        self.fft_filter_xxx_0.declare_sample_delay(0)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(
                6, samp_rate_rx / (first_stage_decimation * int(
                    samp_rate_rx / first_stage_decimation / initial_bandwidth))
                / audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76))
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=samp_rate_rx /
            (first_stage_decimation *
             int(samp_rate_rx / first_stage_decimation / initial_bandwidth)),
            audio_decimation=audio_decimation,
        )

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'),
                         (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_wfm_rcv_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.fir_filter_xxx_1, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.fft_filter_xxx_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.fir_filter_xxx_1, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.hilbert_fc_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.satnogs_noaa_apt_sink_0, 0))
        self.connect((self.rational_resampler_xxx_2_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.fft_filter_xxx_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.rational_resampler_xxx_2_0, 0))