Guest User

Untitled

a guest
Jun 24th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. from rtlsdr import RtlSdr
  2. from matplotlib import mlab
  3.  
  4. sdr = RtlSdr()
  5.  
  6. # configure device and settings
  7. sdr.sample_rate = 2.048e6 # Hz
  8. sdr.center_freq = 151e6 # Hz
  9. sdr.gain = 'auto'
  10. num_samples = 1024
  11. threshold = -0.10 # empirically derived
  12.  
  13. my_samples = sdr.read_samples(num_samples)
  14. magnitude_values, freqs = mlab.magnitude_spectrum(my_samples)
  15.  
  16. above_threshold = []
  17. for index, magnitude in enumerate(magnitude_values):
  18. if magnitude > threshold:
  19. above_threshold.append([magnitude, freqs[index]])
Add Comment
Please, Sign In to add comment