Coder Social home page Coder Social logo

xmikos / soapy_power Goto Github PK

View Code? Open in Web Editor NEW
159.0 14.0 34.0 49 KB

Obtain power spectrum from SoapySDR devices (RTL-SDR, Airspy, SDRplay, HackRF, bladeRF, USRP, LimeSDR, etc.)

License: MIT License

Shell 2.81% Python 97.19%
sdr spectrum-analyzer software-defined-radio radio rtl-sdr hackrf limesdr airspy fft python

soapy_power's Introduction

soapy_power

Obtain power spectrum from SoapySDR devices (RTL-SDR, Airspy, SDRplay, HackRF, bladeRF, USRP, LimeSDR, etc.)

Requirements

You should always install SciPy or pyFFTW, because numpy.fft has horrible memory usage and is also much slower.

Usage

usage: soapy_power [-h] [-f Hz|Hz:Hz] [-O FILE | --output-fd NUM] [-F {rtl_power,rtl_power_fftw,soapy_power_bin}] [-q]
                   [--debug] [--detect] [--info] [--version] [-b BINS | -B Hz] [-n REPEATS | -t SECONDS | -T SECONDS]
                   [-c | -u RUNS | -e SECONDS] [-d DEVICE] [-C CHANNEL] [-A ANTENNA] [-r Hz] [-w Hz] [-p PPM]
                   [-g dB | -G STRING | -a] [--lnb-lo Hz] [--device-settings STRING] [--force-rate] [--force-bandwidth]
                   [--tune-delay SECONDS] [--reset-stream] [-o PERCENT | -k PERCENT] [-s BUFFER_SIZE] [-S MAX_BUFFER_SIZE]
                   [--even | --pow2] [--max-threads NUM] [--max-queue-size NUM] [--no-pyfftw] [-l] [-R]
                   [-D {none,constant}] [--fft-window {boxcar,hann,hamming,blackman,bartlett,kaiser,tukey}]
                   [--fft-window-param FLOAT] [--fft-overlap PERCENT]

Obtain a power spectrum from SoapySDR devices

Main options:
  -h, --help            show this help message and exit
  -f Hz|Hz:Hz, --freq Hz|Hz:Hz
                        center frequency or frequency range to scan, number can be followed by a k, M or G multiplier
                        (default: 1420405752)
  -O FILE, --output FILE
                        output to file (incompatible with --output-fd, default is stdout)
  --output-fd NUM       output to existing file descriptor (incompatible with -O)
  -F {rtl_power,rtl_power_fftw,soapy_power_bin}, --format {rtl_power,rtl_power_fftw,soapy_power_bin}
                        output format (default: rtl_power)
  -q, --quiet           limit verbosity
  --debug               detailed debugging messages
  --detect              detect connected SoapySDR devices and exit
  --info                show info about selected SoapySDR device and exit
  --version             show program's version number and exit

FFT bins:
  -b BINS, --bins BINS  number of FFT bins (incompatible with -B, default: 512)
  -B Hz, --bin-size Hz  bin size in Hz (incompatible with -b)

Averaging:
  -n REPEATS, --repeats REPEATS
                        number of spectra to average (incompatible with -t and -T, default: 1600)
  -t SECONDS, --time SECONDS
                        integration time (incompatible with -T and -n)
  -T SECONDS, --total-time SECONDS
                        total integration time of all hops (incompatible with -t and -n)

Measurements:
  -c, --continue        repeat the measurement endlessly (incompatible with -u and -e)
  -u RUNS, --runs RUNS  number of measurements (incompatible with -c and -e, default: 1)
  -e SECONDS, --elapsed SECONDS
                        scan session duration (time limit in seconds, incompatible with -c and -u)

Device settings:
  -d DEVICE, --device DEVICE
                        SoapySDR device to use
  -C CHANNEL, --channel CHANNEL
                        SoapySDR RX channel (default: 0)
  -A ANTENNA, --antenna ANTENNA
                        SoapySDR selected antenna
  -r Hz, --rate Hz      sample rate (default: 2000000.0)
  -w Hz, --bandwidth Hz
                        filter bandwidth (default: 0)
  -p PPM, --ppm PPM     frequency correction in ppm
  -g dB, --gain dB      total gain (incompatible with -G and -a, default: 37.2)
  -G STRING, --specific-gains STRING
                        specific gains of individual amplification elements (incompatible with -g and -a, example:
                        LNA=28,VGA=12,AMP=0
  -a, --agc             enable Automatic Gain Control (incompatible with -g and -G)
  --lnb-lo Hz           LNB LO frequency, negative for upconverters (default: 0)
  --device-settings STRING
                        SoapySDR device settings (example: biastee=true)
  --force-rate          ignore list of sample rates provided by device and allow any value
  --force-bandwidth     ignore list of filter bandwidths provided by device and allow any value
  --tune-delay SECONDS  time to delay measurement after changing frequency (to avoid artifacts)
  --reset-stream        reset streaming after changing frequency (to avoid artifacts)

Crop:
  -o PERCENT, --overlap PERCENT
                        percent of overlap when frequency hopping (incompatible with -k)
  -k PERCENT, --crop PERCENT
                        percent of crop when frequency hopping (incompatible with -o)

Performance options:
  -s BUFFER_SIZE, --buffer-size BUFFER_SIZE
                        base buffer size (number of samples, 0 = auto, default: 0)
  -S MAX_BUFFER_SIZE, --max-buffer-size MAX_BUFFER_SIZE
                        maximum buffer size (number of samples, -1 = unlimited, 0 = auto, default: 0)
  --even                use only even numbers of FFT bins
  --pow2                use only powers of 2 as number of FFT bins
  --max-threads NUM     maximum number of PSD threads (0 = auto, default: 0)
  --max-queue-size NUM  maximum size of PSD work queue (-1 = unlimited, 0 = auto, default: 0)
  --no-pyfftw           don't use pyfftw library even if it is available (use scipy.fftpack or numpy.fft)

Other options:
  -l, --linear          linear power values instead of logarithmic
  -R, --remove-dc       interpolate central point to cancel DC bias (useful only with boxcar window)
  -D {none,constant}, --detrend {none,constant}
                        remove mean value from data to cancel DC bias (default: none)
  --fft-window {boxcar,hann,hamming,blackman,bartlett,kaiser,tukey}
                        Welch's method window function (default: hann)
  --fft-window-param FLOAT
                        shape parameter of window function (required for kaiser and tukey windows)
  --fft-overlap PERCENT
                        Welch's method overlap between segments (default: 50)

Example

[user@host ~] soapy_power -r 2.56M -f 88M:98M -B 500k -F rtl_power -O output.txt --even -T 1 --debug
DEBUG: pyfftw module found (using 4 threads by default)
DEBUG: Applying fixes for RTLSDR quirks...
INFO: Using device: RTLSDR
DEBUG: SoapySDR stream - buffer size: 8192
DEBUG: SoapySDR stream - read timeout: 0.103200
INFO: repeats: 106667
INFO: samples: 640002 (time: 0.25000 s)
INFO: max_buffer_size (samples): 32768000 (repeats: 5461333.33, time: 12.80000 s)
INFO: buffer_size (samples): 647168 (repeats: 107861.33, time: 0.25280 s)
INFO: buffer_repeats: 1
INFO: overlap: 0.00000
INFO: bin_size: 426666.67 Hz
INFO: bins: 6
INFO: bins (after crop): 6
INFO: sample_rate: 2.560 MHz
INFO: sample_rate (after crop): 2.560 MHz
INFO: freq_range: 10.000 MHz
INFO: hopping: YES
INFO: hop_size: 2.560 MHz
INFO: hops: 4
INFO: min_center_freq: 89.280 MHz
INFO: max_center_freq: 96.960 MHz
INFO: min_freq (after crop): 88.000 MHz
INFO: max_freq (after crop): 98.240 MHz
DEBUG: Frequency hops table:
DEBUG:   Min:          Center:       Max:    
DEBUG:     88.000 MHz    89.280 MHz    90.560 MHz
DEBUG:     90.560 MHz    91.840 MHz    93.120 MHz
DEBUG:     93.120 MHz    94.400 MHz    95.680 MHz
DEBUG:     95.680 MHz    96.960 MHz    98.240 MHz
DEBUG: Run: 1
DEBUG:   Frequency hop: 89280000.00 Hz
DEBUG:     Tune time: 0.017 s
DEBUG:     Repeat: 1
DEBUG:       Acquisition time: 0.251 s
DEBUG:     Total hop time: 0.282 s
DEBUG: FFT time: 0.103 s
DEBUG:   Frequency hop: 91840000.00 Hz
DEBUG:     Tune time: 0.010 s
DEBUG:     Repeat: 1
DEBUG:       Acquisition time: 0.251 s
DEBUG:     Total hop time: 0.272 s
DEBUG: FFT time: 0.006 s
DEBUG:   Frequency hop: 94400000.00 Hz
DEBUG:     Tune time: 0.010 s
DEBUG:     Repeat: 1
DEBUG:       Acquisition time: 0.252 s
DEBUG:     Total hop time: 0.266 s
DEBUG: FFT time: 0.004 s
DEBUG:   Frequency hop: 96960000.00 Hz
DEBUG:     Tune time: 0.010 s
DEBUG:     Repeat: 1
DEBUG:       Acquisition time: 0.253 s
DEBUG:     Total hop time: 0.267 s
DEBUG: FFT time: 0.004 s
DEBUG:   Total run time: 1.095 s
DEBUG: Number of USB buffer overflow errors: 0
DEBUG: PSD worker threads: 4
DEBUG: Max. PSD queue size: 2 / 40
DEBUG: Writer worker threads: 1
DEBUG: Max. Writer queue size: 2 / 100
INFO: Total time: 1.137 s

Output:

2017-03-17, 13:18:25, 88000000.0, 90560000.0, 426666.666667, 647168, -98.6323, -98.7576, -97.3716, -98.3133, -98.8829, -98.9333
2017-03-17, 13:18:25, 90560000.0, 93120000.0, 426666.666667, 647168, -95.7163, -96.2564, -97.01, -98.1281, -90.701, -88.0872
2017-03-17, 13:18:25, 93120000.0, 95680000.0, 426666.666667, 647168, -99.0242, -91.3061, -91.9134, -85.4561, -86.0053, -97.8411
2017-03-17, 13:18:26, 95680000.0, 98240000.0, 426666.666667, 647168, -94.2324, -83.7932, -78.3108, -82.033, -89.1212, -97.4499

soapy_power's People

Contributors

xmikos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

soapy_power's Issues

Run issue "No module named 'SoapySDR'"

After installing soapy_power using python 3 i get this issue, SoapySDR is installed, along with simplesoapy (via pip), along with all other dependencies except for SciPy, i believe my environment path is set up right.

i installed this on a raspberry pi model 3

Traceback (most recent call last): File "/usr/local/bin/soapy_power", line 11, in <module> load_entry_point('soapy-power==1.6.1', 'console_scripts', 'soapy_power')() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 561, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2631, in load_entry_point return ep.load() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2291, in load return self.resolve() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2297, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/usr/local/lib/python3.5/dist-packages/soapy_power-1.6.1-py3.5.egg/soapypower/__main__.py", line 5, in <module> File "/usr/local/lib/python3.5/dist-packages/SimpleSoapy-1.5.1-py3.5.egg/simplesoapy.py", line 5, in <module> ImportError: No module named 'SoapySDR'

my paths

$echo $PYTHONPATH /usr/local/bin/python3 $ python3 -c "import sys; print(sys.path)" ['', '/usr/local/bin/python3', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-arm-linux-gnueabihf', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/local/lib/python3.5/dist-packages/SimpleSpectral-1.0.0-py3.5.egg', '/usr/local/lib/python3.5/dist-packages/SimpleSoapy-1.5.1-py3.5.egg', '/usr/local/lib/python3.5/dist-packages/soapy_power-1.6.1-py3.5.egg', '/usr/lib/python3/dist-packages']

Soapy_power Empty Outputs

System: Raspbian Buster on RPI ver. 4 8GB
soapy_power_ver: 1.6.1
SDR: HackRF

I was able to log outputs using the -O something.csv flag this morning, but now the output file is empty on every run. First I thought maybe my HackRF was fried, but I tried it on my Ubuntu (also soapy_power version 1.6.1) and it populates the output file as expected. I've tried running it with/without sudo and it doesn't make a difference. What is extra strange is the fact it worked earlier, and now it doesn't. I also considered maybe it's a USB issue. I tried running it on the USB 2.0 and 3.0 ports and it doesn't make a difference. I scanned the same bandwidth on the RPI and Ubuntu (90-100 Mhz). I also ran it with the --debug flag, and no scary printouts appeared.

I considered the possibility this is due to a HackRF permissions issue, but I'm able to run hackrf_sweep and it successfully writes the sweep outputs to a file in the same directory that I'm trying to get soapy_power to write to. That would be very strange though- if soapy_power has permission to create the file, I suspect it should have permission to save the outputs to that file it created...

Does soapy_power ensure LimeSDR TX mode is off (if actually needed) ?

In this post here https://discourse.myriadrf.org/t/limesuite-tx-mode-and-fft-viewer-issues/991 you can read that LimeSDR has TX mode enabled by default (not sure if this is due to the default.ini file or actually a default behaviour of the HW).
If spurious emissions by the board itself can be received ... then I could get corresponding RFI in my radioastronomy scans at HF.

Could you please check if the init sequence used by soapy_power ensures the TX is off ? That post mentions the necessary settings.

I still couldn't verify presence of those emissions experimentally (looking at the plotted FFT) but will certainly do this as soon as I can.

soapypower with sdrplay rsp2

I have installed your soapypower and try to use it to get spectrum power from sdrplay. It is as follows:
123456
7890

and my output.txt file is empty. Can you give me some help to fix it?

Correct device string from soapy_power to SoapyRemote

I am able to connect from soapy_power to a local RTL-SDR device, but I cannot find the correct device string for soapy_power that will allow me to connect to a remote box running SoapyRemote. What is the correct string?

UTC Time Stamp Flag Request

It would be nice if there was a flag for setting time stamps to UTC, similar to rtl_433. That facilitates syncronizing soapy_power sweep data to GPS data, which provides times in UTC.

Gains doing some odd things in calibration on LimeSDR

Hey there. I’m using Qspectrumanalyzer, which runs on soapy_power. And I'm using the "--specific gains" command to change my gains and it goes through the usual calibration, but it's doing some odd things. I’ve set the gains using:

–specific-gains LNA=10,PGA=10,TIA=10

But when I read through the terminal, it says the following:

Rx calibration using RSSI INTERNAL ON BOARD loopback Rx ch.A @ 1904.65 MHz, BW: 30 MHz, RF input: LNAH, PGA: 22, LNA: 4, TIA: 2 Rx calibration: using cached values Rx calibration values found in cache:

According to the data sheet, the max gains are: LNA = 30, TIA =12, and PGA = 19. So that shouldn't be an issue.

If I set the gains to their max, I get the following.

Rx ch.A @ 1904.65 MHz, BW: 30 MHz, RF input: LNAH, PGA: 31, LNA: 15, TIA: 3

Not sure if this is relevant, but I commented out 2 lines (111 and 112) in Soapy_power.py that apply a -g option to the command line if the value is not negative. This was just to get the program to accept the specific gains, as it was telling me:

'soapy_power: error: argument -G/–specific-gains: not allowed with argument -g/–gain'

soapypower/writer.py line 78 read self.header_struct struct.error: unpack requires a buffer of x bytes...

Hi, got this error when reading from an open-ended file: sopypower/writer.py line 78 in read self.header_struct struct.error: unpack requires a buffer of 59 bytes [https://github.com/xmikos/soapy_power/blob/master/soapypower/writer.py#L78]
Since io.read(size) rely on the underlying OS that may signal interrupt the syscall before returning exactly that size rather than less, then keep iterating syscall reading up to filling up at least header_struct size buffer before unpacking fixed the above error... "...read syscall(,,count) it is not an error if this number is smaller than the number of bytes requested; this may happen for example because fewer bytes are actually available right now..."

Maintainers Needed

@xmikos, if you are still around, would you be willing to share maintainership of this repository with me?

If anybody else is available to help maintain this project, please pipe up.

Error: Gain out of range

Hi
I'm testing soapy_power on Mac OS X (I'm using the latest version of soapy_power)
When I run it (with or without arguments, with or without any SDRs plugged-in), I get this error:

WARNING: Sample rate 2000000.0 Hz is not supported, setting it to 96000.0 Hz!
Traceback (most recent call last):
File "/usr/local/bin/soapy_power", line 11, in
load_entry_point('soapy-power==1.1.0', 'console_scripts', 'soapy_power')()
File "/usr/local/lib/python3.6/site-packages/soapy_power-1.1.0-py3.6.egg/soapypower/main.py", line 225, in main
File "/usr/local/lib/python3.6/site-packages/soapy_power-1.1.0-py3.6.egg/soapypower/power.py", line 24, in init
File "/usr/local/lib/python3.6/site-packages/SimpleSoapy-1.1.0-py3.6.egg/simplesoapy.py", line 59, in init
File "/usr/local/lib/python3.6/site-packages/SimpleSoapy-1.1.0-py3.6.egg/simplesoapy.py", line 166, in gain
ValueError: Gain out of range (0.0, 0.0)!

My Python version: 3.6.0
OS : OS X 10.12.2
SoapySDR API and ABI version: 0.6.0

Any ideas?

I cannot connect LimeSDR mini with soapy power

Hello,
I am using ubuntu 16. Trying to connect a LimeSDR mini to QSpectrumAnalyzer utilising soapy_power, when searching for devices using soapy_power my limesdr mini doesn't show up.
Please Help!

Crash on macOS

When running qspectrum analyzer on macOS latest version with latest qsa and soapy_power the app crashes due to soapy_power.

Found Rafael Micro R820T tuner
WARNING: Sample rate 2560000.0 Hz is not supported, setting it to 96000.0 Hz!
INFO: Using device: Audio
[INFO] Using format CF32.
INFO: repeats: 439
INFO: samples: 4390 (time: 0.04573 s)
INFO: max_buffer_size (samples): 13107200 (repeats: 1310720.00, time: 136.53333 s)
INFO: buffer_size (samples): 6144 (repeats: 614.40, time: 0.06400 s)
INFO: buffer_repeats: 1
INFO: overlap: 0.00000
INFO: bin_size: 9600.00 Hz
INFO: bins: 10
INFO: bins (after crop): 10
INFO: sample_rate: 0.096 MHz
INFO: sample_rate (after crop): 0.096 MHz
INFO: freq_range: 21.000 MHz
INFO: hopping: YES
INFO: hop_size: 0.096 MHz
INFO: hops: 219
INFO: min_center_freq: 87.048 MHz
INFO: max_center_freq: 107.976 MHz
INFO: min_freq (after crop): 87.000 MHz
INFO: max_freq (after crop): 108.024 MHz
INFO: Total time: 0.625 s
Traceback (most recent call last):
  File "/usr/local/bin/soapy_power", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/soapypower/__main__.py", line 373, in main
    max_threads=args.max_threads, max_queue_size=args.max_queue_size
  File "/usr/local/lib/python3.7/site-packages/soapypower/power.py", line 296, in sweep
    psd_future, acq_time_start, acq_time_stop = self.psd(freq)
  File "/usr/local/lib/python3.7/site-packages/soapypower/power.py", line 256, in psd
    self.device.read_stream_into_buffer(self._buffer)
  File "/usr/local/lib/python3.7/site-packages/simplesoapy.py", line 484, in read_stream_into_buffer
    res.ret, SoapySDR.errToStr(res.ret)
RuntimeError: Unhandled readStream() error: -1 (TIMEOUT)

Could you please check -R option is working as expected ?

Could you please check the -R option to remove the DC spike in the middle of the FFT ?
Plotting the data that I'm collecting during scans I can still see that, despite I have specified the -R option.
These are my command parameters:

-r 15M -f 15M:30M -b 2000 -G "LNA=45,TIA=15,PGA=0" -w 30M -t 0.1 -e 900 -R --reset-stream

See an example scan plotted here:
https://cloud.githubusercontent.com/assets/1177953/25754297/fb553cee-31be-11e7-9dd3-8dbbd4369a01.png

Readstream error when using Airspy with soapy_power

screenshot from 2018-06-08 12-31-42
screenshot from 2018-06-08 12-32-19
Please reference the above screenshots. Other devices work well between my SoapySDR Server and client when using soapy_power, except for Airspy. It appears to connect fine, but I get a readstream error right away.

Support for Decimation

What argument string or device string is used to enable decimation in SDRs like Airspy and Lime? If soapy power does not support this, will it be added. Thank you.

SoapyRTLSDR dependance

I was wondering if you could add more details to the readme... I got to your repo searching for a faster alternative to rtl_power but had difficulty getting everything to work because I had only installed SoapySDR but I needed SoapyRTLSDR ... since rtlsdrs are more common perhaps consider making a note about this addtl req....thanks

threadpool.py init error

Problem1:
soapy_power -r 2.56M -f 88M:98M -B 500k -F rtl_power -O output.txt --even -T 1 --debug
Detached kernel driver
Found Rafael Micro R820T tuner
Reattached kernel driver
DEBUG: pyfftw module found (using 2 threads by default)
DEBUG: scipy.fftpack module found
Detached kernel driver
Found Rafael Micro R820T tuner
DEBUG: Applying fixes for RTLSDR quirks...
INFO: Using device: RTLSDR
DEBUG: SoapySDR stream - args: {'buffers': '100'}
[INFO] Using format CF32.
DEBUG: SoapySDR stream - buffer size: 8192
DEBUG: SoapySDR stream - read timeout: 0.103200
INFO: repeats: 106667
INFO: samples: 640002 (time: 0.25000 s)
INFO: max_buffer_size (samples): 32768000 (repeats: 5461333.33, time: 12.80000 s)
INFO: buffer_size (samples): 647168 (repeats: 107861.33, time: 0.25280 s)
INFO: buffer_repeats: 1
Traceback (most recent call last):
File "/usr/bin/soapy_power", line 9, in
load_entry_point('soapy-power==1.4.0', 'console_scripts', 'soapy_power')()
File "/home/X/.local/lib/python3.5/site-packages/soapypower/main.py", line 310, in main
max_threads=args.max_threads, max_queue_size=args.max_queue_size
File "/home/X/.local/lib/python3.5/site-packages/soapypower/power.py", line 280, in sweep
reset_stream=reset_stream, max_threads=max_threads, max_queue_size=max_queue_size
File "/home/X/.local/lib/python3.5/site-packages/soapypower/power.py", line 192, in setup
lnb_lo=lnb_lo, max_threads=max_threads, max_queue_size=max_queue_size)
File "/home/X/.local/lib/python3.5/site-packages/soapypower/psd.py", line 31, in init
thread_name_prefix='PSD_thread'
File "/home/X/.local/lib/python3.5/site-packages/soapypower/threadpool.py", line 7, in init
super().init(max_workers or os.cpu_count() or 1, thread_name_prefix)
TypeError: init() takes from 1 to 2 positional arguments but 3 were given

code in threadpool.py:
class ThreadPoolExecutor(concurrent.futures.ThreadPoolExecutor):
"""ThreadPoolExecutor which allows setting max. work queue size"""
def init(self, max_workers=0, thread_name_prefix='', max_queue_size=0):
super().init(max_workers or os.cpu_count() or 1, thread_name_prefix)

fix to the problem1
super().init(max_workers or os.cpu_count() or 1)

Then it works. I have even done my first .csv export spectrum analysis with my airspy. I know two others softwares that do the .csv export for the RTLSDR, but none with the airspy.

Problem2:
soapy_power params:
{'bin_size': 100.0,
'crop': 90.0,
'device': 'rtlsdr',
'gain': 20,
'hops': 0,
'interval': 60.0,
'ppm': 0,
'sample_rate': 2160000,
'single_shot': True,
'start_freq': 24.0,
'stop_freq': 1765.0}
Found Rafael Micro R820T tuner
Found Rafael Micro R820T tuner
Exact sample rate is: 2160000.051498 Hz
INFO: Using device: RTLSDR
WARNING: number of overlapping FFT bins should be even, changing overlap/crop factor to 0.90909
[INFO] Using format CF32.
INFO: repeats: 665
INFO: samples: 14630 (time: 0.00677 s)
INFO: max_buffer_size (samples): 32768000 (repeats: 1489454.55, time: 15.17037 s)
INFO: buffer_size (samples): 16384 (repeats: 744.73, time: 0.00759 s)
INFO: buffer_repeats: 1
INFO: overlap: 0.90909
INFO: bin_size: 98181.82 Hz
INFO: bins: 22
INFO: bins (after crop): 2
INFO: sample_rate: 2.160 MHz
INFO: sample_rate (after crop): 0.196 MHz
INFO: freq_range: 1741.000 MHz
INFO: hopping: YES
INFO: hop_size: 0.196 MHz
INFO: hops: 8867
INFO: min_center_freq: 24.098 MHz
INFO: max_center_freq: 1765.058 MHz
INFO: min_freq (after crop): 24.000 MHz
INFO: max_freq (after crop): 1765.156 MHz
ERROR: len(x_axis) != len(y_axis)
It seems that len(y_axis) = hops * bins_after_crop, but that len(x_axis) is slightly bigger. Flooring required?

Problem3:
soapy_power params:
{'bin_size': 1000.0,
'crop': 90.0,
'device': 'rtlsdr',
'gain': 20,
'hops': 0,
'interval': 60.0,
'ppm': 0,
'sample_rate': 2160000,
'single_shot': True,
'start_freq': 24.0,
'stop_freq': 1765.0}
Found Rafael Micro R820T tuner
Found Rafael Micro R820T tuner
Exact sample rate is: 2160000.051498 Hz
INFO: Using device: RTLSDR
WARNING: number of FFT bins should be even, changing to 4
WARNING: number of overlapping FFT bins should be even, changing overlap/crop factor to 1.00000
Traceback (most recent call last):
File "/usr/bin/soapy_power", line 9, in
load_entry_point('soapy-power==1.5.0', 'console_scripts', 'soapy_power')()
File "/usr/lib/python3.5/site-packages/soapy_power-1.5.0-py3.5.egg/soapypower/main.py", line 330, in main
File "/usr/lib/python3.5/site-packages/soapy_power-1.5.0-py3.5.egg/soapypower/power.py", line 105, in freq_plan
ZeroDivisionError: float division by zero
It happen when cropping is set to 100%, which is not a great idea anyway.

code in power.py:
freq_range = max_freq - min_freq
hopping = True if freq_range >= sample_rate_crop else False
hop_size = self.nearest_freq(sample_rate_crop, bin_size)
hops = math.ceil(freq_range / hop_size) if hopping else 1

Problem4:
When I set a 2dB gain in the program, it set a 20dB gain in the device.
So a 0-49.6dB device can be used only with 0, 10, 20, 30, 40dB gains!

Best regards.

Don't run on MacOS 10.15

soapy_power -info
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/soapy_power", line 11, in
load_entry_point('soapy-power==1.6.1', 'console_scripts', 'soapy_power')()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 2852, in load_entry_point
return ep.load()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 2443, in load
return self.resolve()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 2449, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/soapy_power-1.6.1-py3.7.egg/soapypower/main.py", line 5, in
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/SimpleSoapy-1.5.1-py3.7.egg/simplesoapy.py", line 5, in
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/SoapySDR.py", line 28, in
import _SoapySDR
ImportError: dynamic module does not define module export function (PyInit__SoapySDR)

rtl_power format not compatible with Kyle Keen's heatmap.py

Using soapy_power output as the input to Mr. Keen's heatmap.py causes heatmap.py to throw an error. The problem is that the start frequency in soapy_power output is a float and heatmap.py expects an int. I modified heatmap.py. Search for 'line[2]' and make the code read int(float(line[2])). After that, it seems to work.

Just for posterity, this is the line I used to generate the .csv file:

soapy_power -r .5M -f 7.0M:7.4M -b 4096 -F rtl_power -O 40m.csv -t 10 -q -e 600 -s 16380 -g 10

Shows a nice sample of the 40M ham band.

Hope this helps somebody.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.