Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from rtlsdr import RtlSdr
- from matplotlib import mlab
- sdr = RtlSdr()
- # configure device and settings
- sdr.sample_rate = 2.048e6 # Hz
- sdr.center_freq = 151e6 # Hz
- sdr.gain = 'auto'
- num_samples = 1024
- threshold = -0.10 # empirically derived
- my_samples = sdr.read_samples(num_samples)
- magnitude_values, freqs = mlab.magnitude_spectrum(my_samples)
- above_threshold = []
- for index, magnitude in enumerate(magnitude_values):
- if magnitude > threshold:
- above_threshold.append([magnitude, freqs[index]])
Add Comment
Please, Sign In to add comment