Scientific Computing

Making a 2D pyramid in MATLAB

Make a square-base 2D data pyramid in Matlab, where:

N
number of pixels per side (e.g. 512)
MinVal
minimum data value (e.g. 0)
MaxVal
maximum data value (e.g. 65535)
N = 256;
MinVal = 0;
MaxVal = 2^16 - 1;

data = nan(N);
temp = uint16(MinVal:round((MaxVal-MinVal)/(N/2)):MaxVal);

for i = 1:N/2
  data(i,i:end-i+1) = temp(i);
  data(i:end-i+1,i) = temp(i);
  data(end-i+1,i:end-i+1) = temp(i);
  data(i:end-i+1,end-i+1) = temp(i);
end

figure, mesh(data)

The values at the “base” of the pyramid are zero, and increase linearly on each side to 65,535. This sort of figure might be useful when testing an optical flow algorithm.

Making hdparm setting permanent in Ubuntu

Some Linux distros in the past set the APM default very aggressively, leading your hard drive to hundreds and thousands of load/unload cycles in too short period of time. Typically HDD are only rated for 600,000 load/unload cycles, so it might be beneficial to reduce this cycling, at the expense of some additional power consumption.

The procedure below is informational, and may or may not provide benefit.

You can slow down the cycling manually, but the system will FORGET this setting upon reboot.

Make HDParm setting semi-permanent:

make line hdparm -B 250 /dev/sda, where /dev/sda is the HDD you’re wanting to stop cycling.

geany /etc/pm/power.d/90_hdparm

type

chmod +x /etc/pm/power.d/90_hdparm

cp /etc/pm/power.d/90_hdparm /etc/pm/sleep.d

Reboot, and check that your setting “stayed”

hdparm -B /dev/sda

This setting allows the drive to unload after an extended period without use, perhaps helping the HDD run a bit cooler without excessive wear. Instead of 250 you could use 254, which is thought to disallow unloading altogether. Try 254 and monitor HDD temperature–100 degrees Fahrenheit is possible.

To check how many load/unload cycles you’re using, go into Disk Utility, SMART data, and scroll down to Load/Unload cycle count.

similar procedure

Fix WINE reading JPEG

WINE users may experience:

Failed reading JPEG because unable to find libjpeg.so.62

Fix by installing the Windows codecs:

winetricks windowscodecs

Benchmark Seagate Momentus XT 500GB hybrid HDD

The Seagate Momentus XT 500GB hybrid hard drive (4GB SSD, 500GB HDD) is a useful way to speedup system boot and execution. However, on brand new files the speed is the same as a typical hard drive. A USB 3.0 drive adapter shows what the drive could do over a USB 3.0 link, using Disk Utility on Ubuntu.

Average read speed: 90MB/sec. Average write speed: 97MB/sec.

HDD speed test

Narrow auroral arc notes

magnetic bottle: pitch angle distribution vs. mirror height equipotential lines -> parallel E-field (Stephen Knight 1970) -> Large scale, dull auroral arc

  • inertial alfven wave connection to parallel E-field

fine scale arcs assosciated with Farley-Buneman instabilities, GPS scintillation

energy to produce electron-ion pair ionization potential ~ 18 eV takes on average ~ 35 eV

energy deposition physics

single particle motion, 3 adiabatic invariants, Debye length, two fluid vector potential

Alfven wave can couple to whistler mode

Auroral emissions: Bohr model of atom. have to release energy gap between orbitals (work function). Vibrational modes

Ions: closure current electrons: field aligned current

Inertial alfven wave: electron mass matters due to phase speed > speed of light F=ma inertial limit inerital lag – prevents group velocity from exceeding speed of light

λe = c / ωpe electron skin depth confines wave

Auroral emissions:

Björn Gustavsson Ph.D. thesis discusses briefly specifics of four major auroral emission lines.

Thesis on kinetic reactions resulting in auroral emissions.

Auroral width:

  • Borovsky 1993 “Auroral arc thicknesses as predicted by various theories”, JGR: Space Physics.
  • Chaston 2003 “Width and brightness of auroral arcs driven by inertial Alfven waves”, JGR: Space Physics.

Books:

  • Chen
  • Kivelson and Russell
  • Cravens
  • Nagey

Positive train control in dark territory

With the spectre of the Positive Train Control mandate looming over small railroads, it’s not only the short-line railroads impacted. Long-distance rural lines can have considerable dark territory. Such railroads may have substantial cost added to their capital budget by PTC. Without radio contact, such railroads have been limited in dark territory to restricted speed 10-25 mph instead of the 49 mph they might otherwise run in dark territory.

Possible solutions for radio contact in rural areas

  • microwave links - much too expensive for distance, terrain vs. low train count
  • leased (dedicated) phone line - same as microwave–too expensive
  • PSTN/POTS - use a typical “interconnect” for two-way radio.

The latter option may be much more economically feasible for many rural railroads. This option has not been evaluated for compliance with federal railroad regulations. Railroads in the Rocky Mountains, with vast individual tower coverage areas, have long used DTMF selective calling of dispatch to avoid dispatchers being overwhelmed with constant train chatter.

CONOPS of POTS-linked rural dark territory railroad radio: dispatch has multiple phone lines, all ringing for the same number dedicated to inbound radio calls. Different branches dispatched by distinct dispatchers could obviously have separate phone numbers. The caller ID of the individual interconnect into dispatch identifies the approximate subdivision the train is on (not for legal purposes but for convenience). Cell phones could be used in place of POTS if more economical.

Train to dispatch: train keys up mic, dials dispatch phone number like a standard two-way radio interconnect call. Train engineer uses standard radio message protocol to talk to dispatch, then train hangs up via DTMF. Can use single frequency for network to keep any other trains advised, although dark territory and long distances imply long blocks.

Dispatch to train: dispatch calls phone number of interconnect they believe train is in range of. Train engineer answers via DTMF, uses standard radio protocol to talk. Dispatch hangs up phone, train engineer sends DTMF to close link if phone line hangup not detected.

Besides the typical radio base station tower and antenna, selected with sufficient overlap in 49 mph-desired territory, the Zetron Model 30 is about $600. Cost of power and phone connection trenching might be mitigated by sharing with cellular towers or power utility company where feasible. Naturally, a more advanced interconnect could be used to control and monitor railroad switches and the like, also enhancing railway safety. In regions hauling relatively benign cargo with a single train per day, some in the industry have felt PTC requirements were two stringent. If it’s not too late, some waivers might be obtained for a time at least by using ideas as above, pending compliance with all applicable regulations.