Linguistics and Amateur Radio

Screenshot of title slide

In noisy conditions on the airwaves, it can be hard to exchange information effectively. Rather than throwing more power or another $1000 of equipment at the problem, radio operators can often improve reception by adjusting the signal at its source: their articulatory organs. By enunciating, focusing on vowels, using recognized phonetic alphabets, and matching listeners’ expectations about pitch, amateur radio operators can effectively boost the quality of their signal.

To download the presentation in .pdf format, click on the image at right or the preceding link.

Context for Non-Hams

Relevance of Amateur Radio

Since the 1960s and 1970s, public interest in amateur radio has waned as reliable mobile communication has become available for minimal cost. Our dependence on such systems, however, has left us increasingly vulnerable to natural and man-made disasters. When the communication infrastructure is destroyed or severely overloaded (such as the 2011 Japanese earthquake and tsunami, Hurricane Katrina, the Marine Corps Marathon, and presidential inaugurations), hams continue to provide robust, decentralized communication.

Beyond practical uses, ham radio is also a hobby like any other, worthwhile for the enjoyment it brings.

“Noise” on the Air

The amateur radio bands do not always provide a perfect channel for communication. In especially bad conditions, trying to understand a message can be akin to listening to shouting from half a block away, on a windy day with city traffic. Although some atmospheric and noise conditions are uncontrollable, amateur radio operators do our best to produce cleanly intelligible signals, and we hone the skills required to understand content despite bad conditions.

Calculating and visualizing standard deviations in two dimensions

The spread of points in one dimension is easy to calculate and to visualize, but the spread of points in two (or more) dimensions is less simple. Instead of familiar error bars, standard deviational ellipses (SDEs) represent the standard deviation along both axes simultaneously. The result is similar to a contour line that traces the edge of one standard deviation, as on a topographic map or an isochore map. The calculation of a standard deviational ellipse can be tricky, because the axes along which the ellipse falls may be rotated from the original source axes.

Figure 4.14 from CrimeStat III -- points representing locations of car thefts in Baltimore, with an ellipse indicating the highest density of thefts.
The standard deviational ellipse algorithm is described here and here, and it was implemented in aspace, an R library for geographic visualization work developed by Randy Bui, Ron N. Buliung, and Tarmo K. Remmel. The SDEs are calculated by calc_sde and are visualized by plot_sde. (The people who are most interested in multi-dimensional standard deviations seem to be geographers visualizing point data; an example of visualizing auto theft in Baltimore appears at right.)

The aspace SDE implementation is a very useful implementation.  I’m going to talk about implementing three extensions to it:

  • Giving better example code for how to use the package.
  • Fixing a bug in which the ellipse is often incorrectly rotated by 90 degrees. [This has been fixed by the authors in aspace 3.2, following contact from me.]
  • Adding a feature that shows more than one standard deviations.

This post addresses each in turn.

More Thorough Example Usage Code for aspace::plot_sde

plot_sde doesn’t take the result of calc_sde as a parameter, and its documentation doesn’t indicate how R knows which SDE to draw. To draw an SDE, run plot_sde immediately after calc_sde. R uses an implicit object hidden from the user to pass data. A better usage example is:

# Example aspace::calc_sde and aspace::plot_sde Code
library(aspace)
# Create the data and rotate it
x = rnorm(100, mean = 10, sd=2)
y = rnorm(100, mean = 10, sd=4)
t = -pi/4 # Illustrates normal case (rotated to right from vertical)
#t = pi/4 # Illustrates the bug described below (rotated to left from vertical)
transmat = matrix(c(cos(t),-sin(t),sin(t),cos(t)),nrow=2,byrow=TRUE)
pts = t(transmat %*% t(cbind(x,y)))
# Create the plot but don't show the markers
plot(pts, xlab="", ylab="", asp=1, axes=FALSE, main="Sample Data", type="n")
# Calculate and plot the first standard deviational ellipse on the existing plot
calc_sde(id=1,points=pts);
plot_sde(plotnew=FALSE, plotcentre=FALSE, centre.col="red",
         centre.pch="1", sde.col="red",sde.lwd=1,titletxt="",
		 plotpoints=TRUE,points.col="black")
# Label the centroid, explicitly using the hidden r.SDE object that was used in plot_sde
text(r.SDE$CENTRE.x, r.SDE$CENTRE.y, "+", col="red")

The above code will plot the data without axes, layering the SDE ellipse on top of a plot that does not display data markers (as illustrated at below right).

Correct Visualization Regardless of Major Axis
Original ellipse is off by 90 degrees from the scattered points; improved ellipse is not.

14 August 2012: This has been fixed by the authors in aspace 3.2 following contact from me.

The aspace 3.0 calc_sde code (accessible by typing the function name without parentheses at the R prompt) includes the lines:

if (tantheta < 0) {
	theta <- 90 - atan_d(abs(tantheta))
} else {
	theta <- atan_d(tantheta)
}

This code seems to aim to ensure that theta is a positive number — but the first line doesn’t ensure that. Instead it causes negative rotations to end up at 90 degrees to where they should be (as in the illustration at right). Instead that first if-clause could be:

if (tantheta < 0) {
	theta <- 180 - atan_d(abs(tantheta))
} else {
	theta <- atan_d(tantheta)
}

This code is one of multiple options that fixes the off-by-90-degrees issue.

Display of Multiple Standard Deviations

The aspace 3.0 calc_sde code only will only trace an ellipse of one standard deviation in each direction. To change this, add a multiplicative factor to sigmax and sigmay immediately before (or immediately after) the following lines:

if (sigmax > sigmay) {
	Major <- "SigmaX"
	Minor <- "SigmaY"
}
else {
	Major <- "SigmaY"
	Minor <- "SigmaX"
}

For instance, to calculate (and therefore plot) two standard deviations around the centroid, add in the lines:

sigmax=sigmax*2
sigmay=sigmay*2

These lines double the length of the single-standard-deviation major and minor axes.


Updated 2012-08-14.

Exporting standalone batch runs in Repast Simphony: start_model.sh

As discussed in Exporting standalone batch runs, Christof Zellweger developed a .sh file for Repast that will run in “batch mode” on non-development Mac and *nix machines. That file and his comments appear below. (I’ve also posted a sample .bat file and a sample .command file, both contributed by others. You may get some benefit from looking at those as well.)

start_model.command, modified by Christof Zellweger in 2012 to use BatchMain

#!/bin/bash
# The version of Repast Simphony being used.
export VERSION=2.0.0
# The installed path of Repast. Quotes may be necessary if there is a space character in the path.
export REPAST="/path/to/your/repast/home/folder"
# The installed path of Eclipse. Quotes may be necessary if there is a space character in the path.
export ECLIPSE=$REPAST/eclipse
# The plugins path of Eclipse.
export PLUGINS=$ECLIPSE/plugins
export REPAST_SIMPHONY_LIB=$PLUGINS/repast.simphony.runtime_$VERSION/lib
# The Eclipse workspace containing the Repast model.
export WORKSPACE=/path/to/your/workspace/
# The name of the model. This might be case-sensitive. This is the name of your package. It should 
# be the package at the top of all your .java files and match the "package" listed in your 
# model.score file (when viewed as a text file).
export MODELNAME=
# The folder of the model. This might be case-sensitive. This is the base folder of your 
# project in the file system.
export MODELFOLDER=$WORKSPACE/
# The file containing the batch parameters. For some additional information, see Repast 
# documentation of batch parameters at http://repast.sourceforge.net/docs/reference/SIM/Batch%20Parameters.html
# and/or an example batch_params.xml file at 
# http://www.pamelatoman.net/blog/2010/08/sample-batchparamsxml/.
# The following is the usual location within your Repast workspace - change according to your location / system
export BATCHPARAMS=$MODELFOLDER/batch/batch_params.xml
# Change to the root folder of your project so that the relative paths are handled correctly
cd $MODELFOLDER
# Execute in batch mode.
java -classpath $MODELFOLDER/lib/*:$MODELFOLDER/bin:$PLUGINS/repast.simphony.scenario_$VERSION/bin:
$PLUGINS/repast.simphony.batch_$VERSION/bin:$PLUGINS/repast.simphony.runtime_$VERSION/lib/*:
$PLUGINS/repast.simphony.runtime_$VERSION/bin:$PLUGINS/repast.simphony.core_$VERSION/lib/*:
$PLUGINS/repast.simphony.core_$VERSION/bin:$PLUGINS/repast.simphony.data_$VERSION/lib/*:
$PLUGINS/repast.simphony.score.runtime_$VERSION/lib/*:$PLUGINS/repast.simphony.score.runtime_$VERSION/bin:
$PLUGINS/repast.simphony.dataLoader_$VERSION/bin:$PLUGINS/repast.simphony.data_$VERSION/bin:
$PLUGINS/repast.simphony.score_$VERSION/bin:$REPAST_SIMPHONY_LIB/saf.core.runtime.jar:
$REPAST_SIMPHONY_LIB/commons-logging-1.0.4.jar:$REPAST_SIMPHONY_LIB/groovy-all-1.5.7.jar:
$REPAST_SIMPHONY_LIB/javassist-3.7.0.GA.jar:$REPAST_SIMPHONY_LIB/jpf.jar:$REPAST_SIMPHONY_LIB/jpf-boot.jar:
$REPAST_SIMPHONY_LIB/log4j-1.2.13.jar:$REPAST_SIMPHONY_LIB/xpp3_min-1.1.4c.jar:
$REPAST_SIMPHONY_LIB/xstream-1.3.jar repast.simphony.batch.BatchMain -params $BATCHPARAMS $MODELFOLDER/$MODELNAME.rs

Christof Zellweger writes:

I’ve tested this on Mac OS X Snow Leopard 10.6.8. I didn’t have a Linux box available but seeing that OS X uses a XNU (Unix Mach/BSD hybrid) kernel, I would assume that this script runs on many *NIX platforms unchanged and if not, only small changes would be necessary.

The main difference in this script (apart from usage of the *NIX ‘export’ equivalent to Window’s ‘set’ command) was that I’ve added 2-3 search locations/directories in the classpath argument. Plus I’ve added a few comments.

Exporting standalone batch runs in Repast Simphony: start_model.command

As discussed in Exporting standalone batch runs, Stefan König and Axel Pürkhauer developed a .command file for Repast that will run in “batch mode” on non-development Mac and *nix machines. That file appears below. (I’ve also posted a sample .bat file and a sample .sh file, both contributed by others. You may get some benefit from looking at those as well.)

start_model.command, modified by Stefan König and Axel Pürkhauer in 2010 to use BatchMain

#!/bin/bash
# Repast Simphony Model Starter
# By Michael J. North and Jonathan Ozik
# 11/12/2007
# Edited by Stefan König for use with batch files
# Note the Repast Simphony Directories.

PWD="${0%/*}"
cd $PWD

REPAST_VERSION=1.2.0
REPAST_BASE=$PWD/repast.simphony
REPAST_SIMPHONY_ROOT=$REPAST_BASE/repast.simphony.runtime_$REPAST_VERSION
REPAST_SIMPHONY_LIB=$REPAST_SIMPHONY_ROOT/lib

# Define the Core Repast Simphony Directories and JARs
CP=$CP:$REPAST_BASE/repast.simphony.batch_$REPAST_VERSION/bin
CP=$CP:$REPAST_BASE/repast.simphony.runtime_$REPAST_VERSION/lib/*
CP=$CP:$REPAST_BASE/repast.simphony.core_$REPAST_VERSION/lib/*
CP=$CP:$REPAST_BASE/repast.simphony.core_$REPAST_VERSION/bin
CP=$CP:$REPAST_SIMPHONY_ROOT/bin
CP=$CP:$REPAST_SIMPHONY_ROOT/bin-groovy
CP=$CP:$REPAST_BASE/repast.simphony.score.runtime_$REPAST_VERSION/lib/*
CP=$CP:$REPAST_BASE/repast.simphony.score.runtime_$REPAST_VERSION/bin
CP=$CP:$REPAST_BASE/repast.simphony.dataLoader_$REPAST_VERSION/bin
CP=$CP:$REPAST_BASE/repast.simphony.data_$REPAST_VERSION/bin
CP=$CP:$REPAST_BASE/repast.simphony.score_$REPAST_VERSION/bin
CP=$CP:$PWD/yourModelDirectory/bin #### NOTE: yourModelDirectory
CP=$CP:$REPAST_SIMPHONY_LIB/saf.core.runtime.jar
CP=$CP:$REPAST_SIMPHONY_LIB/commons-logging-1.0.4.jar
CP=$CP:$REPAST_SIMPHONY_LIB/groovy-all-1.5.7.jar
CP=$CP:$REPAST_SIMPHONY_LIB/javassist-3.7.0.GA.jar
CP=$CP:$REPAST_SIMPHONY_LIB/jpf.jar
CP=$CP:$REPAST_SIMPHONY_LIB/jpf-boot.jar
CP=$CP:$REPAST_SIMPHONY_LIB/log4j-1.2.13.jar
CP=$CP:$REPAST_SIMPHONY_LIB/xpp3_min-1.1.4c.jar
CP=$CP:$REPAST_SIMPHONY_LIB/xstream-1.3.jar
CP=$CP:$REPAST_BASE/repast.simphony.data_$REPAST_VERSION/lib/*

# Change to the Default Repast Simphony Directory
cd yourModelDirectory #### NOTE: yourModelDirectory

# Start the Model
/path/to/bin/java -Xss10M -Xmx400M -cp $CP repast.simphony.batch.BatchMain -params $PWD/batch/params.xml yourModel .rs

Exporting standalone batch runs in Repast Simphony: start_model.bat

As discussed in Exporting standalone batch runs, I developed a .bat file for Repast that will run in “batch mode” on non-development Windows machines. That file appears below. (I’ve also posted a sample .sh file and a sample .command file, both contributed by others. You may get some benefit from looking at those as well.)

start_model.bat, modified by Pamela Toman in 2010 to use BatchMain

@ECHO OFF
TITLE yourModelNameHere
REM Repast Simphony Batch Run Model Starter
REM By Michael J. North and Jonathan Ozik,
REM edited for batch runs by Pamela Toman,
REM on basis of .command file from Stefan König
REM
REM Please note that the paths given below use
REM a unusual Linux-like notation. This is a
REM unfortunate requirement of the Java Plugin
REM framework application loader.

REM fill out the below information so it is true for your installation
set REPAST_VERSION=1.2.0
set REPAST_SIMPHONY=../repast.simphony
set REPAST_SIMPHONY_ROOT=%REPAST_SIMPHONY%/repast.simphony.runtime_1.2.0
set REPAST_SIMPHONY_LIB=%REPAST_SIMPHONY_ROOT%/lib

REM Define the Core Repast Simphony Directories and JARs
REM You may not need the line below. I had to reset the classpath (as in the next line)
REM to avoid the character length limit on classpaths (I was getting an "input line is too
REM long" error upon running this file).
set CP=
SET CP=%CP%;%REPAST_SIMPHONY%/repast.simphony.batch_%REPAST_VERSION%/bin
SET CP=%CP%;%REPAST_SIMPHONY%/repast.simphony.runtime_%REPAST_VERSION%/lib/*
SET CP=%CP%;%REPAST_SIMPHONY%/repast.simphony.core_%REPAST_VERSION%/lib/*
SET CP=%CP%;%REPAST_SIMPHONY%/repast.simphony.core_%REPAST_VERSION%/bin
SET CP=%CP%;%REPAST_SIMPHONY_ROOT%/bin/
SET CP=%CP%;%REPAST_SIMPHONY_ROOT%/bin-groovy
SET CP=%CP%;%REPAST_SIMPHONY%/repast.simphony.score.runtime_%REPAST_VERSION%/lib/*
SET CP=%CP%;%REPAST_SIMPHONY%/repast.simphony.score.runtime_%REPAST_VERSION%/bin
SET CP=%CP%;%REPAST_SIMPHONY%/repast.simphony.dataLoader_%REPAST_VERSION%/bin
SET CP=%CP%;%REPAST_SIMPHONY%/repast.simphony.data_%REPAST_VERSION%/bin
SET CP=%CP%;%REPAST_SIMPHONY%/repast.simphony.score_%REPAST_VERSION%/bin
SET CP=%CP%;%REPAST_SIMPHONY_LIB%/saf.core.runtime.jar
SET CP=%CP%;%REPAST_SIMPHONY_LIB%/commons-logging-1.0.4.jar
SET CP=%CP%;%REPAST_SIMPHONY_LIB%/groovy-all-1.5.7.jar
SET CP=%CP%;%REPAST_SIMPHONY_LIB%/javassist-3.7.0.GA.jar
SET CP=%CP%;%REPAST_SIMPHONY_LIB%/jpf.jar
SET CP=%CP%;%REPAST_SIMPHONY_LIB%/jpf-boot.jar
SET CP=%CP%;%REPAST_SIMPHONY_LIB%/log4j-1.2.13.jar
SET CP=%CP%;%REPAST_SIMPHONY_LIB%/xpp3_min-1.1.4c.jar
SET CP=%CP%;%REPAST_SIMPHONY_LIB%/xstream-1.3.jar
SET CP=%CP%;%REPAST_SIMPHONY%/repast.simphony.data_%REPAST_VERSION%/lib/*
SET CP=%CP%;./bin
REM adding the bin to the classpath (above) is important!

REM Change to the Default Repast Simphony Directory
cd yourModelDirectory
REM directory change is needed so that local links don't break when running the
REM program -- e.g. when pulling in data from a folder

REM Start the Model. In the batch version you must include the path to
REM the batch file parameters in addition to the XXX.rs folder containing the model.score file.
java -Xss10M -Xmx400M -cp %CP% repast.simphony.batch.BatchMain -params batch/batch_params.xml yourModel.rs

REM move back up a level, to where you started
cd ..