Scientific Computing

Put external USB drives into standby

Manually put a USB HDD that doesn’t automatically spin-down after inactivity to sleep with sg_start

apt install sg3-utils

Determine which device ID by:

lsblk

Assuming the HDD to spin down was at /dev/sdc:

sg_start 0 --pc=3 /dev/sdc

The HDD wakes up automatically when writing/reading a file on it.

We spin down hard drives because HDDs put out substantial heat when spinning, but don’t spin up/down too frequently to avoid excessive wear.

Using Phoronix Test Suite

Phoronix Test Suite is a well regarded benchmarking suite that supports most operating systems. This gives the ability to accurately benchmark operating system performance errors, and has been used to find Linux kernel performance regressions.

  1. Download and install

  2. run tests

    phoronix-test-suite benchmark c-ray
    phoronix-test-suite benchmark hpcc
    phoronix-test-suite benchmark scimark2
    phoronix-test-suite benchmark xonotic
  3. List results

    phoronix-test-suite list-saved-results
  4. Convert results to PDF

    phoronix-test-suite result-file-to-pdf  myTest

Matlab - fixing exponential tick labels

Sometimes for large number > 10000, Matlab/Octave axes ticks will appear as exponentials. Fix this to the desired number of digits by:

set(gca,'YTickLabel',sprintf('%7d|',get(gca,'YTick')))

This example is for 7 digits.

HiST 2014 aurora season start

This was the first night of operations. No GPS 1 PPS timing on either station.

The data will be put in Zenodo, but is available via Google Drive, email me to access.

Asus P8Z77-M boot device choice

I found that there was no known special hotkey that will allow one to choose which device to boot when powering-up the PC.

What I found was to keep pressing Delete key upon booting, which brings you into BIOS setup. Under the Boot tab, scroll to the bottom, where you will see “force boot” choices. Click the one you want and the PC will do a one-time boot from that device.

Safely eject USB drives

Data drive write caching can lead to data loss upon unplugging an external flash drive or hard drive. Inexpensive USB flash drives may write data slowly. Operating systems use RAM to cache write data, making the copy/write operation appear done while the final data writing is actually still underway. If the drive is removed before the writing is done, that file or even the whole disk can become corrupted and unreadable.

For example, a drive writing at 10 MByte / second for a 1 GByte file could take 1000 / 10 = 100 seconds, despite the file copy operation appearing done in less than 10 seconds.

On macOS or Linux, verify writing to a flash drive is completed with sync and then click the Eject icon next to the drive’s name in Finder or File Manager.

Monitor macOS or Linux file write progress with iotop.

For Windows, use the Safely Remove Hardware icon in the system tray. Monitor Windows file write progress with Task Manager or Process Explorer.

Convert AVI to grayscale PNG

Large pixel-count or frame-count AVIs can be converted frame-by-frame to PNG. One can then use Irfanview or other common image browser to flick back and forth between movie frames.

The conversion uses ImageMagick, which calls FFmpeg.

magick -verbose CMOSvideoshorter_halfspeed.avi -type Grayscale CMOSvideo_%03d.png