Scientific Computing

Global license-free bands in 25-60 MHz range

Global ITU license-free frequencies

Individual countries may choose the details for their lands, or may open up additional frequencies. Generally this is a place to start.

  • 26.957-27.283 MHz ISM band (ITU RR 5.150)
  • 40.66-40.7 MHz ISM band (ITU RR 5.150)

Country-specific license-free

I don’t list every allocation because they are so numerous–just a few countries I ran across. This is a conceptual table–confirm yourself.

Country Regulation Frequencies [MHz] EIRP [dBm]
Australia 40.66–41 30
New Zealand 26.96-27.28; 29.7-30.0; 40.665-40.695 20
China/HK 26.96-27.28; 29.7-30.0; 40.665-40.695 20
Vietnam 26.96-27.28; 29.7-30.0; 40.665-40.695 20
Japan 0-322 -41.3
Korea 0-322 -41.3
Singapore 43.5 – 50.0
Malaysia 46.6 - 47
India (NFAP-2011) IND 04
UK Ofcom 27-27.3; 31-31.2; 40.66-41; 49.8-50
EU ECC Rec. 70-03 40.66-40.7 10
EU Ground pen / Wall pen radar 30-230 -44.5dBm/120kHz
Russia 26.957-27.283; 40.66-40.7; 40.025-48.5 10
Russia 40.66-40.7 30
Brazil 40.66-40.7 -35.2
Brazil 54-70 -55.2
UAE 29.7 - 47.0 10
USA P15.209 30-88 -55.2
USA 40.66-40.7 -35.2

Global ISM bands (from ITU), detailed


Related:

Get terminal window size from Fortran

The Bash shell has environment variables LINES and COLUMNS representing the current terminal window width. One might therefore incorrectly assume that Fortran 2003 standard get_environment_variable() subroutine would trivially get the current Terminal window dimensions. This is not so, since Bash passes along only the “POSIX” set of environment variables, and those that have been exported to the executable.

A working example of getting current Fortran terminal size using Ncurses is in the BlockTran program, where the variables LINES and COLS are set using the getmaxyx Ncurses macro.


Use the method above, as the method below naïvely fails.

Thus, the following will result in status code 1, indicating the environment variable was not found.

If the user runs this program as

LINES=24 ./myprog

that “works”, but we want an automatically determined value.

program noenv

use, intrinsic:: iso_fortran_env, only: error_unit

implicit none (type, external)

character(4) :: buf
integer :: h,ios

call get_environment_variable('LINES',buf,status=ios)

if (ios/=0) then
  write(error_unit,*) 'got error code',ios,'on trying to get LINES'
  stop
endif

read(buf,*) h

end program

Obsolete Fortran statement functions

Fortran 77 statement functions were thankfully made obsolete by Fortran 95 standard. Statement functions are not anonymous functions. In most cases, one should simple use standard functions instead of confusing statement functions. Other use cases are addressed by the polymorphism enabled from Fortran 2003 forward and/or pointers.

Example: Replace Fortran statement function with a standard function.

program st

integer :: f,i,j,k,n
! obsolete statement function (don't use)
f(n) = n+(i*j)**k

i=2
j=3
k=4

print *,f

print *,g(i,j,k)

contains

integer function g(n,i,j,k) ! use this instead of statement function
  integer, intent(in) :: n,i,j,k
  g = n+(i*j)**k
end function g

end program

Use VirtualBox over VNC

While for regular use one might setup a headless VM with RDP and/or SSH running on the VM itself, this procedure is for connecting to a virtual machine on a remote PC.

Prerequisites:

  • Remote: VirtualBox install of guest operating system
  • local: apt install xfreerdp-x11

on your local laptop, create a script vmrdp.sh containing:

#!/usr/bin/env bash

set -o errexit

ssh -f -L 5930:localhost:5930 sshusername@1.2.3.4 sleep 1;

xfreerdp /u:VMusername /v:localhost:5930

Optionally, add a few simple FreeRDP options to enhance performance, especially on limited data bandwidth connections

Most people can use the VirtualBox GUI, and don’t need the alternative command line option. Establish a VNC connection over SSH The very basic OpenBox desktop environment can open a Terminal on the remote PC by right clicking anywhere on the remote desktop and type

virtualbox

The usual VirtualBox program should open

From the right dropdown menu of the right arrow “start” button on the main VirtualBox window on the remote VNC PC, click headless. The status of the VM will show “Running”. Connect from laptop with a script vmrdp.sh as above. When done, shutdown your VM as usual if desired.

Most can use the GUI method above, but VirtualBox can also be managed well via shell commands.

virtualbox vmstart MyVMName --headless

starts up the VM named “MyVMName” for example. Numerous headless options exist for low server resource utilization via VBoxManage CLI.

Game on Fortran using Ncurses

Fortran game

The BlockTran tetromino falling block Fortran game exhibits several types of best practices for modern Fortran design with user keyboard input and animated text output. Ncurses is used to handle the screen drawing via iso_c_binding from Fortran.

Inspired by the demo Fortran program use of Ncurses, we created the game in object-oriented modern Fortran.

Ncurses redraws the screen on each necessary update (pseudo-interrupt driven). CPU load is very low.

It would be straightforward to add color, sound and more.

Fortran writing to `/dev/null` or `NUL`

Writing to /dev/null can save significant time on legacy Fortran programs that dump unneeded data to disk. This is lower risk than making modifications to non-standard compliant code, and certainly less programmer time consuming. We have seen 10x speedup from programs that had unneeded intensive file writing. It’s also particularly useful for Fortran code called from Python via f2py.

The null filename per OS is:

  • non-Windows: /dev/null
  • native Windows: NUL

Example: null-writing Fortran: devnull.f90

/dev/null is 3..5x faster than scratch file, even with fast SSD.

Analog Devices ADALM-PLUTO SDR quick start

[DRAFT post]

The ADALM-PLUTO is a UHF-microwave (software hackable to cover VHF) SDR with rapidly growing software support, particularly from GNU Radio and Matlab. Don’t freak out about the unshielded case. Like Red Pitaya, PLUTO is an FCC-verified educational tool. An amateur radio license is very useful in general for software defined radio work to avoid falling foul of federal regulations.

Frequency, bandwidth, and bit depth are among the most fundamental specifications of a typical SDR. While the AD9363 is rated for 325-3800 MHz, functionality has been observed to 70-6000 MHz akin to the AD9364. The tunable frequency range is rated as 325 - 3800 MHz. A software hack enables 70 - 6000 MHz coverage.

Notes

LaTeX with GitLab/GitHub and Dropbox backup

The examples show GitLab but of course work equally well with GitHub/Bitbucket/etc. Do not simply drag and drop the LaTeX directory into Dropbox–syncing errors will result.

Git is designed to make simultaneous pushes to multiple remotes. Backup to several sources at once such as LaTeX with Dropbox as backup to GitHub / GitLab, OneDrive or Google Drive with the syncing clients installed.

Given a LaTeX document connected to a GitLab repo, cloned to the computer, backup the LaTeX document folder somewhere else now as a precaution.

git LaTeX repo ↔ Dropbox: git push will go to both simultaneously.

Check current LaTeX repo

cd ~/Dissertation
git remote -v
origin  https://gitlab.com/username/MyDiss (fetch)
origin  https://gitlab.com/username/MyDiss (push)

To create a directory in the Dropbox folder specifically for LaTeX Git repositories, multiple LaTeX projects can be kept in one Dropbox directory. This directory will be referred to as Git.

mkdir ~/Dropbox/Git

Next, set up the Dropbox/Git directory as a second push-only remote. The files will not be visible in this directory because it is a “bare” Git repository, but the history of all files will be recoverable from it in case the LaTeX Git history becomes corrupted.

cd ~/Dropbox/Git
git clone --bare https://gitlab.com/username/MyDiss

cd ~/Dissertation
git remote set-url origin --push --add ~/Dropbox/Git/Dissertation.git
git remote set-url origin --push --add https://gitlab.com/username/MyDiss.git

The --push option indicates that this remote is only for pushing, not for fetching. Normally, fetching (pulling) will be done from GitLab since Dropbox serves as a rolling backup.

Verify the setup with the following command:

git remote -v

The expected output should be:

origin  https://gitlab.com/username/MyDiss (fetch)
origin  https://gitlab.com/username/MyDiss (push)
origin  /home/computerusername/Dropbox/Git (push)

If any issues arise, edit the repository’s Git configuration directly to remove any incorrect pushurl entries:

git -C <repo_dir> config --edit

Since Windows Command Prompt does not recognize ~, ensure that each Terminal used has softlinks created with the same link name. The absolute pathnames differ for WSL, but the softlinks can appear identical.

Windows Subsystem for Linux:

cd ~
ln -s /mnt/c/users/joe/Dropbox