I am using Scipy to implement bandpass filter but it assumes that positive normalized frequency is passed but I & Q samples range from [Fc-Fs/2,Fc+Fs/2] where Fs is sampling frequency & Fc is centre frequency but desired bandpass filter should filter from [f1,f2] such that they can negative too. How to pass this band information ?

My approach is

  1. Generated a window using Scipy firwin
  2. Convoluted it with signal using Scipy fftconvolve
  • $\begingroup$ Which scipy function are you using (please link to online docs) $\endgroup$ May 31 '17 at 7:31
  • $\begingroup$ @MarcusMüller updated the question. Have a look $\endgroup$ May 31 '17 at 8:12
  • $\begingroup$ Please include a sketch of the operations in your receiver showing how the signal is sampled (and filtered in the analog), as well as any other steps taken prior to the digital signal you are processing: you mention I and Q samples, so are you using a quadrature IQ mixer in the receiver, or is the signal split in quadrature in the analog with 2 A/D converters? Or is the receiver a single A/D converter and then digitally downconverting your received signal to provide I and Q outputs? I think more information is needed on what you are working with. $\endgroup$ May 31 '17 at 10:28
  • $\begingroup$ @DanBoschen My problem is this and to be precise this. Plz have a look. If needed I will edit the question. $\endgroup$ May 31 '17 at 12:20
  • $\begingroup$ I don't want to interrupt Marcus' good answer in progress but thought those details would help. Let's see what he thinks, your links may be sufficient. $\endgroup$ May 31 '17 at 22:03

You can do different things: For example,

  • use the (frequency-symmetric) real-tapped bandpass that firwin gives you, and after applying that, apply a complex high pass (a Hilbert filter, essentially) to kill all negative frequencies. That sadly leaves you with the original problem (finding a complex-tapped filter using scipy)
  • Do the same as above, but already convolve the real-valued band pass filter taps with the Hilbert filter taps, so that you only need to apply one filter
  • Do the "usual" lowpass-to-bandpass transform trick: You design a real-valued low pass filter (e.g. using firwin) with impulse response (==taps) $h_{LP}[n]$ that has the same passband and transition widths as your desired complex band pass. Afterwards, you multiply that $h_{LP}$ with the shift you need to move the 0-centric low pass up to your $f_\text{center}$-centric band pass: $$h_{BP}[n] = h_{LP} \cdot e^{j2\pi \frac{f_\text{center}}{f_\text{sample}}n}\text.$$ The idea is that you shift the low pass in frequency by convolving with a dirac impulse in frequency domain, which is equivalent to multiplying with the complex sinusoid of said frequency in time domain. These answers (1,2) might be of interest to you.
  • $\begingroup$ For example Fc of signal is 105 MHz while Fs is 20 MHz so the spectrum ranges between [95 MHz to 115 MHz]. Now I need a bandpass filter for say 97 MHz to 99 MHz. So according to 3rd point I will design a lowpass filter with passband of width 2 MHz. Now what will be fcenter in exponential function ? $\endgroup$ May 31 '17 at 9:21
  • $\begingroup$ wait, confusing! how is the center frequency larger than the sampling rate? What is your receiver? We might be mixing up things! $\endgroup$ May 31 '17 at 9:42
  • $\begingroup$ Okay, I mentioned that it is an I&Q signal which is recorded from SDR(software defined radio) whose centre frequency was set at 105MHz while sampling rate was 20Mhz. $\endgroup$ May 31 '17 at 9:45
  • $\begingroup$ sorry, was afk for a bit. So, I'd recommend you first translate the RF frequencies from bandpass to their equivalent baseband counterparts: So, RF 105 MHz becomes 0 MHz in baseband, and your 97–99 MHz range becomes -8 – -6 MHz. So you're designing a real-tapped low pass with a 1 MHz cutoff frequency (== 2 MHz bandwidth if considered two-sided), and then move it down by 7 MHz, i.e. multiply it with $e^{-j2\pi \frac7{20}n}$ $\endgroup$ May 31 '17 at 13:50
  • $\begingroup$ I think you missed "n" in the exponent in the answer body. Please update that & I will accept the answer. Works perfectly fine for me. $\endgroup$ Jun 3 '17 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.