コード例 #1
0
ファイル: vna_probe.py プロジェクト: edy555/dds-ctrl
    def __init__(self):
        gr.top_block.__init__(self)

        ##################################################
        # Variables
        ##################################################
        self.signal_freq = signal_freq = 5000
        self.samp_rate = samp_rate = 48000
        self.bw = bw = 200

        ##################################################
        # Blocks
        ##################################################
        self.gr_probe_ref = gr.probe_signal_f()
        self.gr_probe_mag = gr.probe_signal_f()
        self.gr_probe_arg = gr.probe_signal_f()
        self.gr_nlog10_ff_ref = gr.nlog10_ff(1, 1, 0)
        self.gr_nlog10_ff_0 = gr.nlog10_ff(1, 1, 0)
        self.gr_divide_xx_0 = gr.divide_cc(1)
        self.gr_complex_to_mag_ref = gr.complex_to_mag(1)
        self.gr_complex_to_mag_0 = gr.complex_to_mag(1)
        self.gr_complex_to_arg_0 = gr.complex_to_arg(1)
        self.band_pass_filter_0_0 = gr.fir_filter_fcc(
            1,
            firdes.complex_band_pass(
                1, samp_rate, signal_freq - bw / 2, signal_freq + bw / 2, 100, firdes.WIN_BLACKMAN, 6.76
            ),
        )
        self.band_pass_filter_0 = gr.fir_filter_fcc(
            1,
            firdes.complex_band_pass(
                1, samp_rate, signal_freq - bw / 2, signal_freq + bw / 2, 100, firdes.WIN_BLACKMAN, 6.76
            ),
        )
        self.audio_source_0 = audio.source(samp_rate, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.band_pass_filter_0_0, 0), (self.gr_complex_to_mag_0, 0))
        self.connect((self.gr_complex_to_mag_0, 0), (self.gr_nlog10_ff_0, 0))
        self.connect((self.gr_divide_xx_0, 0), (self.gr_complex_to_arg_0, 0))
        self.connect((self.band_pass_filter_0_0, 0), (self.gr_divide_xx_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.gr_divide_xx_0, 1))
        self.connect((self.audio_source_0, 1), (self.band_pass_filter_0_0, 0))
        self.connect((self.audio_source_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.gr_nlog10_ff_0, 0), (self.gr_probe_mag, 0))
        self.connect((self.gr_complex_to_arg_0, 0), (self.gr_probe_arg, 0))

        self.connect((self.band_pass_filter_0, 0), (self.gr_complex_to_mag_ref, 0))
        self.connect((self.gr_complex_to_mag_ref, 0), (self.gr_nlog10_ff_ref, 0))
        self.connect((self.gr_nlog10_ff_ref, 0), (self.gr_probe_ref, 0))
コード例 #2
0
ファイル: vna_probe.py プロジェクト: edy555/dds-ctrl
 def set_signal_freq(self, signal_freq):
     self.signal_freq = signal_freq
     self.band_pass_filter_0.set_taps(
         firdes.complex_band_pass(
             1,
             self.samp_rate,
             self.signal_freq - self.bw / 2,
             self.signal_freq + self.bw / 2,
             100,
             firdes.WIN_BLACKMAN,
             6.76,
         )
     )
     self.band_pass_filter_0_0.set_taps(
         firdes.complex_band_pass(
             1,
             self.samp_rate,
             self.signal_freq - self.bw / 2,
             self.signal_freq + self.bw / 2,
             100,
             firdes.WIN_BLACKMAN,
             6.76,
         )
     )
コード例 #3
0
ファイル: vna_fft.py プロジェクト: edy555/dds-ctrl
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Audio Fft 2")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 48000

		##################################################
		# Blocks
		##################################################
		self.wxgui_numbersink2_0_0 = numbersink2.number_sink_f(
			self.GetWin(),
			unit="deg",
			minval=-90,
			maxval=90,
			factor=90/3.14159,
			decimal_places=10,
			ref_level=0,
			sample_rate=samp_rate,
			number_rate=15,
			average=False,
			avg_alpha=None,
			label="Angle",
			peak_hold=False,
			show_gauge=True,
		)
		self.Add(self.wxgui_numbersink2_0_0.win)
		self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
			self.GetWin(),
			unit="mag",
			minval=-100,
			maxval=0,
			factor=20,
			decimal_places=10,
			ref_level=0,
			sample_rate=samp_rate,
			number_rate=15,
			average=False,
			avg_alpha=None,
			label="Magnitude",
			peak_hold=False,
			show_gauge=True,
		)
		self.Add(self.wxgui_numbersink2_0.win)
		self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=1024,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="Reflect",
			peak_hold=False,
			win=window.hamming,
		)
		self.Add(self.wxgui_fftsink2_0_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=1024,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="Reference",
			peak_hold=False,
			win=window.hamming,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self.gr_nlog10_ff_0 = gr.nlog10_ff(1, 1, 0)
		self.gr_divide_xx_0 = gr.divide_cc(1)
		self.gr_complex_to_mag_0 = gr.complex_to_mag(1)
		self.gr_complex_to_arg_0 = gr.complex_to_arg(1)
		self.band_pass_filter_0_0 = gr.fir_filter_fcc(1, firdes.complex_band_pass(
			1, samp_rate, 4.8e3, 5.2e3, 100, firdes.WIN_HAMMING, 6.76))
		self.band_pass_filter_0 = gr.fir_filter_fcc(1, firdes.complex_band_pass(
			1, samp_rate, 4.8e3, 5.2e3, 100, firdes.WIN_HAMMING, 6.76))
		self.audio_source_0 = audio.source(samp_rate, "", True)

		##################################################
		# Connections
		##################################################
		self.connect((self.audio_source_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.audio_source_0, 1), (self.band_pass_filter_0_0, 0))
		self.connect((self.band_pass_filter_0_0, 0), (self.wxgui_fftsink2_0_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.gr_divide_xx_0, 0))
		self.connect((self.band_pass_filter_0_0, 0), (self.gr_divide_xx_0, 1))
		self.connect((self.gr_divide_xx_0, 0), (self.gr_complex_to_arg_0, 0))
		self.connect((self.gr_complex_to_arg_0, 0), (self.wxgui_numbersink2_0_0, 0))
		self.connect((self.gr_complex_to_mag_0, 0), (self.gr_nlog10_ff_0, 0))
		self.connect((self.gr_nlog10_ff_0, 0), (self.wxgui_numbersink2_0, 0))
		self.connect((self.band_pass_filter_0_0, 0), (self.gr_complex_to_mag_0, 0))
コード例 #4
0
ファイル: vna_fft.py プロジェクト: edy555/dds-ctrl
	def set_samp_rate(self, samp_rate):
		self.samp_rate = samp_rate
		self.band_pass_filter_0.set_taps(firdes.complex_band_pass(1, self.samp_rate, 4.8e3, 5.2e3, 100, firdes.WIN_HAMMING, 6.76))
		self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
		self.wxgui_fftsink2_0_0.set_sample_rate(self.samp_rate)
		self.band_pass_filter_0_0.set_taps(firdes.complex_band_pass(1, self.samp_rate, 4.8e3, 5.2e3, 100, firdes.WIN_HAMMING, 6.76))