Scientific Computing

NEXTEL is back?

Retrobrands USA makes a business from “disused” trademarks and licensing them to those who hope to find new audiences for their products from the brand’s afterglow. USPTO trademark filings were brought and a lawsuit over use of the NEXTEL name. The product brochures shows the NEXTEL logo “photoshopped” onto 3G radios. As the lawsuit notes, the “Direct Connect” and “Group Connect” of this product are in effect an app using data to relay voice, with what is claimed to be considerably more latency than the lower layer iDEN dispatch protocol.

Although I long to see a service of the quality of Nextel iDEN dispatch return, this creative use of a trademark that saw $750 million spent on NASCAR sponsorship alone is quite something to ride the laurels of. iDEN still exists overseas and Motorola Harmony in limited regions. Zello uses the Nextel chirp sound without public complaint so far.

Anysecu 3G-HD6500 from various angles.

Anysecu 3G-HD6500

NEXTEL 2018 walkie talkie in box with charger.

One model of NEXTEL 2018 walkie talkie.

Install ImageJ for Linux

In general for Linux it’s better to install ImageJ directly instead of apt install imagej. This method also works for Raspberry Pi and other ARM systems.

Install Java Runtime Environment (also works with openjdk-jre)

apt install default-jre

Download latest platform independent ImageJ Unzip to ~/ImageJ recursively

unzip ij*.zip -d ~

Add to ~/.bash_aliases

alias imagej="$HOME/ImageJ/ImageJ"

Close and reopen Terminal, then start ImageJ by:

imagej

Create Imagej icon by creating file ~/.local/share/applications/imagej.desktop with contents:

[Desktop Entry]
Type=Application
Exec=~/ImageJ/ImageJ
Name=ImageJ
Icon=~/ImageJ/images/icon.png
Categories=AudioVideo;Video;Science;

If can’t open ImageJ via the menu/icon,

~/ImageJ/ImageJ

should open ImageJ properly.

Stop Ubuntu printer added messages

If Ubuntu gives popup messages about auto-adding “new” printers upon connecting to a wired or WiFi network, try the configuration below.

Stop auto-add printer on network connect by editing /etc/cups/cups-browsed.conf:

BrowseRemoteProtocols none

Then restart CUPS from Terminal:

service cups restart

Test: reboot PC with network disconnected, check that the offending printers are not in Settings → Printers, and then connect to the network and verify that the printers don’t auto-add again.

Reference

IEEEtran.cls prerequisites

IEEE LaTeX submissions require IEEEtran.cls, which itself requires:

apt install texlive-publishers texlive-science texlive-fonts-recommended texlive-bibtex-extra texlive-latex-recommended texlive-latex-extra texlive-humanities

IEEE LaTeX article style is invoked by starting the .tex file with:

\documentclass[]{IEEEtran}

Thereby avoiding errors:

IEEEtran.cls, cite.sty, or subfigure.sty not found

Font OT1/ptm/m/n/10=ptmr7t at 10.0pt not loadable error

Brother HL-3170CDW Linux

Like other Brother printers we’ve used, the HL-3170CDW works great from Linux. With Ubuntu, the Gutenprint USB driver automatically came up and worked fine. The OEM driver below is optional.

Download linux-brprinter-installer script from “Driver Install Tool”. Plug in HL-3170 via USB. Don’t skip the mkdir step or the installer will hang!

mkdir -p /var/spool/lpd/hl3170cdw

chmod +x linux-brprinter-installer*
./linux-brprinter-installer*

“Input model name ->” HL-3170CDW “Will you specify the Device URI? [Y/n]”

  • USB: no
  • network: yes

Linux WiFi indicator low signal strength

You may wonder why Linux shows less than full “signal bars” for Wifi, even for a device relatively close to the Wifi AP (Access Point, the “router”). The answer is that the Linux desktop GUI is being honest about the quality of the connection, which is immediately relevant to the data throughput and connection latency. The end user shouldn’t care as much about raw RF signal strength (e.g. -70 dBm) as they should about the quality (SNR) of that connection. Of course, low signal strength < -80 dBm also causes low SNR and hence decreased link quality, even in relatively clear Wifi signal environments.

Unfortunately, many OEMs (and tech websites on click-commission) have duped people into buying expensive individual APs instead of quality APs such as from Ubiquiti that can be distributed evenly throughout the home or office. You actually typically want to lower transmit power from the default level to around +18..+21 dBm to help the user devices roam between APs for best performance, and to disconnect promptly as a user moves off-premises.

In a particular client site with suboptimally configured Wifi network, the GNOME desktop environment (and also in Unity desktop) 2 out of 3 signal bars for WiFi, despite being connected at MCS index 15 to an 802.11n AP on 5 GHz with a signal strength approaching -50 dBm. MCS 15 is the fastest possible connection for 802.11n, so why does GNOME/Unity show only moderate “signal bars”? This is because there are very many other high utilization APs on the same channel so that SNR (“link quality” for many Wifi cards in iwconfig) is low (less than say 0.7 normalized).

Summary

Home and business Wifi users will virtually always get better performance from:

  • multiple low-power APs instead of single high-power AP
  • 5 GHz instead of 2.4 GHz
  • APs set to the clearest possible Wifi channels (such as DFS)
  • APs placed as much as possible to interior of environment, high on wall or ceiling
  • iterative tuning of the system to minimize co-channel high utilization APs

The goal is for the AP to not “hear” other off-premises Wifi or other on-channel wireless activity, since generally the AP due to siting and high performance chipset “hears” significantly better than the end user devices.

Related: Wifi performance at low signal strength

Make Linux lock on lid close

Some Windows-oriented computers like Microsoft Surface with “Connected Standby” or “Modern Standby” may not be well supported in Suspend / Sleep with Linux yet. Consider having such a system lock on lid close until the Linux kernel is updated to support these newer power states. For better security in general, shut the laptop down while in transit in case of loss or theft. Locking screen with screen turned off gives sufficient power savings for short walks.

Force Linux lock on lid close with a systemd-based Linux distro such as Ubuntu by editing “/etc/systemd/logind.conf”, uncommenting line:

HandleLidSwitch=lock

Reboot the computer and verify lock behavior on lid close.

Reference:

  • Microsoft description of traditional S3 standby vs. connected standby vs. modern standby
  • Lock on lid close may not work when the laptop is physically docked, but does generally work when the laptop is out of dock. Do the manual lock if this doesn’t work when physically docked.

Install Intel Python

Intel Distribution for Python utilizes the conda package manager, set to the “intel” channel.

Pros: Intel Python uses highly accelerated math library versions of popular packages like Numpy, Scikit-learn, etc. reside.

Cons: Intel Python is slow to update to new library versions. Anaconda updates within a couple days, but Intel might take weeks or months to update the libraries.

Note that standard Anaconda Python already gives MKL performance in some libraries like Numpy and Scipy. We generally use the regular Anaconda instead of Intel Python to get updated libraries with most of them having MKL.

Find boundary indices of region edges in Python

The convex hull is frequently used to process a pixel region. To find the indices of the outer edge of the convex hull may be accomplished using the distance transform. I do not claim this to be the most efficient method. This algorithm gives similar results to Matlab boundarymask().

Algorithm

By definition, the distance transform of all region edge pixels to the background is identically one. The chamfer distance transform is suitable for smooth regional boundaries, and has significant speed advantages over more brute force approaches that may be more generally applicable for non-smooth boundaries. Use either masked image arrays or use NaN as a sentinel value in 2-D array mask. SciPy ≥ 0.17 is assumed.

import scipy.ndimage as ndi

boundary_mask = ndi.distance_transform_cdt(~np.isnan(az), 'taxicab') == 1
coin with red boundary outline

Red boundary represents boundary_mask pixels.

For the smooth boundary cases I tried, distance_transform_cdt() was six times faster and gave equivalent results to the more general distance_transform_edt().

Notes

Reference

CMake project directory structure

It’s a good idea to breakup project code into distinct subdirectories. It can be useful to have a CMakeLists.txt for each of these directories that are included from the top-level CMakeLists.txt.

Assume a C project with subdirectory io/ and top-level CMakeLists.txt:

project(benchmarks LANGUAGES C)
enable_testing()

add_subdirectory(io)

add_executable(benchIO bench.c)
target_link_libraries(benchIO PRIVATE iohdf)

and in io/CMakeLists.txt:

add_library(iohdf ...)

add_executable(testh5 testh5.c)
target_link_libraries(testh5 PRIVATE iohdf)

add_test(NAME h5io COMMAND testh5)

Build a little test script in io/ directory to test just HDF5 I/O, and compile the whole program from the top level directory, then test the main program and subdirectory libraries:

ctest --test-dir build -V

CMake Directory variables: to refer to the parent project directory use ${PROJECT_SOURCE_DIR}. If using nested projects, ${CMAKE_SOURCE_DIR} refers to the highest level CMakeLists.txt directory

Edit all CMakeLists.txt recursively: on Linux / Unix systems, edit all CMakeLists.txt in a project with a command like

gedit $(find -name CMakeLists.txt)

Related: