Scientific Computing

RTL2832 ADS-B decoder

Decode, log, and display 1090 MHz ADS-B aircraft transponder data with your $20 RTL2832 USB receiver with dump1090. Install:

Add full-access USB privileges:

adduser $(whoami) plugdev

logout then login. Install RTL-SDR drivers and prereqs:

apt install librtlsdr-dev rtl-sdr gcc make

Setup dump1090 ADS-B decoding and logging software

git clone https://github.com/antirez/dump1090

cd dump1090

make

Run:

./dump1090 --interactive

Advanced ADS-B decoding with RTL-SDR

  • This gist explains using dump978 and dump1090 with RTL-SDR
  • COTS $220 978 MHz & 1090 MHz portable receiver is based on Raspberry Pi 3.

PiAware

FlightAware has a fork of dump1090 that uploads to the FlightAware network so you can contribute to the global flight database. This can also run on Raspberry Pi or other Linux computer. They have an optional inexpensive receiver with improved filtering and performance for ADS-B performance.


Related: Quickstart RTL-SDR on Linux

9V battery can not charge modern cell phone

Before the emergency hits, get a $20 10,000 mAh or larger rechargeable USB power bank. It’s possible to get 2-3 phone recharges from this bank for each recharge of the bank.

9V battery cell phone charge from 2014 has been disproved independently by the Daily Mail.

A 9V battery has less than 100 mAh available at the 500-1000 mA charge rate demanded by modern smartphones. This means the 9V battery current output quickly drops to near zero, while the phone still sees the input voltage, kicking the phone CPU into full power mode.

When a smartphone sees a 5V input on its charge connector, it thinks it’s on a source of adequate power, and starts checking email, syncing photos, putting the CPU into full power mode, etc. Phones generally do NOT check if the charging source is actually adequate to have a net positive charge. This means the phone battery will discharge faster by having a 9V battery connected via a cigarette lighter adapter.

SSHFS remote softlinks requires follow_symlinks

Softlinks are useful on any operating system to replace long, complicated directory paths with a simpler one. Options for accessing remote softlinked paths over SSHFS is best done with the sshfs -follow_symlinks option.

Example:

  • Server: joe@1.2.3.4 with external HDD /media/BigHDD
  • Laptop: remote SSHFS ~/X

Setup server:

ln -s /media/BigHDD ~/BigHDD

On laptop create joeBigHDD.sh

#!/bin/sh
sshfs -o follow_symlinks joe@1.2.3.4: ~/X

then

mkdir ~/X
chmod +x joeBigHDD.sh

Connect to remote HDD from laptop via SSHFS

./joeBigHDD.sh

cd ~/X/BigHDD

To disconnect the SSHFS drive, on laptop:

fusermount -uz ~/X

Fix Windows error "missing class msstdfmt.dll"

Microsoft removed 2gb152.exe (1MB) that was formerly at microsoft.com/en-us/download/details.aspx?id=12972. CNet has msstdfmt.dll inside file 2gb152.exe at:

https://download.cnet.com/Exchange-2000-Tool-PST2GB/3000-2094_4-10731662.html.

Extract msstdfmt.dll from 2gb152.exe and copy msstdfmt.dll to:

  • Windows XP: %WINDIR%/system32/
  • Windows 7: %WINDIR%/system/syswow64/

Register this file in Windows from an Administrator command prompt, typing:

  • Windows XP: regsvr32 %WINDIR%/system32/msstdfmt.dll
  • Windows 7: regsvr32 %WINDIR%/syswow64/msstdfmt.dll

Find device open network ports without NMAP

Using the standard Python install (no extra packages), find SSH or other types of servers by Python script.

It uses Python sockets to:

  1. check if a port is open for each address in a subnet
  2. connects to that port, printing server messages
  3. optionally looks for a particular string to verify the server is enabled.

Alternative: find servers with unknown IP address but known ports open is by using Nmap.

Ubuntu glitches on resume with Nvidia GPU

This problem was fixed by Nvidia driver ≥ 384


Ubuntu with Nvidia driver version 375 may experience rainbow banding effects where shadows are cast.

Workaround A:

setsid compiz --replace

This does not require sudo.

Workaround B: I got tired of having to keep doing the workaround above, so I temporarily reverted back to Nvidia driver 340. Alternatively, Nouveau also works OK.

Reference

Zenodo data upload speed

“Free” “unlimited” data storage, even for scientists doing multi-generational data archiving, has its bounds, else tragedy of the commons would result. For Zenodo as of this writing, with a full-gigabit Internet connection, I get Zenodo upload speeds in the 5-20 Mbyte/second range, averaging about 12 Mbyte/second.

That means for the current 50 Gbyte per dataset limit, a 50 Gbyte upload will take me about 1 to 3 hours. Thus it’s useful to use good archival file compression before uploading to Zenodo or elsewhere.

LZIP LZMA benchmarks Tar archives

LZIP is a top choice for reliable, robust long-term archiving of data. With any compression algorithm, the defaults are often not the best choice for very large datasets as encountered in radio science or geoscience in general.

Lzip for large datasets: LZIP options we’ve used for large datasets (here with file extension .bin).

Create a file MANIFEST with a list of files to archive. You can do this manually or with a find command, like:

find . *.bin > MANIFEST

Create a checksum of the files

sha256sum $(< MANIFEST) > SHA256SUM

Zip up the files into filename.tar.lz

tar cvf - $(< MANIFEST) | plzip -0 > filename.tar.lz

Lzip single large file: create my.bin.lz.

plzip -k -0 my.big
-k
do NOT have lzip delete the original file

LZIP options: plzip is the multithreaded version of lzip that uses all the virtual cores of your CPU, to go at least N times faster when N is the number of physical CPU cores.

This compresses the files down to 30-50 % of their original size while being as fast as possible. See the benchmark observations for that greatly increased CPU time doesn’t help compress much more.

tar -I didn’t work for lzip: sometimes the -I 'lzip -0' option of tar doesn’t have any effect–it uses the -9 option of lzip regardless..

LZIP benchmarks: for a 106.9 MByte 16-bit software defined radio dataset (a short test file) I found the table below. It’s immediately evident that for large, high-entropy (noisy natural geoscience data) that very low compression settings are appropriate. Similar results for LZMA compression options for large datasets of geoscience auroral video.

It may be possible to tweak further improvements by using dictionary size and match length options, if someone has an extremely large noisy dataset compression problem (e.g. CERN).

Lzip - Compression ratio time (seconds)
0 0.471 5.6
1 0.448 18.7
2 0.447 30.8
6 0.407 95.2
9 0.400 116.2

Compression of very noisy datasets: why is there often little advantage in noisy geoscience datasets for high compression settings? At the most basic level, lossless compression is about finding redundancies in the files. Self-similarities, autocorrelation, and the like. Nature is an incredibly powerful random number generator–the opposite of what compression algorithms need. In contrast to the high-SNR image and text data used by most of the populace, scientists, and geoscientists in particular have instruments that use a very large dynamic range with high sensitivity. For the radio science and scientific camera domains, this typically means 16-bit high speed ADCs where most of the time, several bits are uniformly zero, and the rest of the bits are highly random, with a slowly changing bias value.

In practical terms, a trivial lossless compression algorithm eliminates those high bits that are so often zero, but even a very advanced lossless algorithm will have trouble getting further compression benefit vs. CPU cycles on typical remote sensing datasets.

Raspberry Pi GNU Radio

This process to install GNU Radio on the Raspberry Pi assumes:

  • Raspberry Pi OS is installed on the headless Raspberry Pi.
  • At least a 16 GB filesystem in the Raspberry Pi.
  • Raspberry Pi 3 or newer, as GNU Radio can tax the CPU and IO of modest ARM processors. GNU Radio requires at least an ARMv7 processor.

Install GNU Radio. This takes more than 10 minutes even with a fast SD card.

apt install gnuradio gnuradio-dev xvfb git
xvfb
headless X-server for software that assumes a display is connected.

For Red Pitaya with Raspberry Pi GNU Radio, also install

apt install gr-hpsdr

Configure the Red Pitaya for six HPSDR receivers

If needed, rename Ethernet interface to eth0

wpa_supplicant reference