Scientific Computing

Science Magazine on Open Data

Comments on June 2014 AAAS Science article on open data and open code for scientists are given below. The article refers to the E. White paper on nine easy ways to share code.

Maybe you don’t have the time to read those, so let me give you six quick tips to:

  • increase your citation count
  • increase your data usage (more citations)
  • increase your code sharing (more citations and lucrative job opportunities).
  1. Learn a popular science/engineering programming language. It will boost productivity and job opportunities. The language you should be using is Python, as it can run on supercomputers down to the $5 Raspberry Pi Zero. Python can streamline/inline CUDA, Fortran, and C for very fast speed while being easy to code for controlling hardware and doing simulations and image/data analysis of datasets of all sizes.
  2. Learn how to use HDF5. Try to use it right at your data acquisition source if it’s not a very high data rate application. Try to avoid making up your own formats or using text to store data unless completely necessary.
  3. Learn how to use version control. Git is an excellent choice. You will save massive amounts of time when it comes to some typo you made and you didn’t keep an old filename version.
  4. Learn how to use Github and be appropriately prolific about posting your code there. This leads to visibility and opportunity.
  5. Put examples, plots, and documentation of how to install and use your code in a README file.
  6. Publish your data online. Don’t leave it on some RAID drive or USB drive somewhere. The drive will fail eventually or the room will get flooded. Worst of all is CD/DVD, they have a very short lifespan, less that the length of your PhD studies. Keep your data in multiple online places.

Black screen after installing more RAM

After installing more RAM the laptop turned on to a black screen. There was no response to Fn keys, no Fn Lock LED, no mute LED, couldn’t get the keyboard to light up beyond the initial flareup/flaredown. After 45 seconds and the system restarted normally. It seems there’s some kind of self-check the laptop runs once upon RAM size change. Too bad they don’t put a “RAM testing” notice on the screen to avoid panic of the user!

Windows VirtualBox guest Shared Folders

If a VirtualBox virtual machine can’t see Shared Folders in your Windows guest with Linux host, fix by:

In Linux Terminal:

adduser $(whoami) vboxusers

In Virtualbox Windows guest, click Install Guest Additions in the VirtualBox menu Run setup on the virtual drive that appears. Reboot the Windows guest. From Windows guest Command Prompt:

net use x: \\vboxsvr\share

where “share” is the name assigned in the VirtualBox shared folders dialog.

Rescue corrupt IDL .sav files to NetCDF or HDF5

IDL has been buggy in the past for writing .sav` files in the proprietary data format. One should instead save data to NetCDF4 or HDF5.

Read IDL .sav files from Python:

from scipy.io import readsav

data = readsav('mydata.sav')
data
dict() of IDL variables.

Our Scipy contribution: IDL was able to read the .sav file, so I wrote a one-off IDL script to convert from IDL .sav to NetCDF4 .NC: sav2nc.pro format. I also have code there to convert from IDL .sav to HDF5.

I also successfully submitted a patch to SciPy to fix some of these IDL .sav reading issues.

Bluetooth headsets not recognized in Pulseaudio

Fix Bluetooth no audio: force Bluetooth headset/speaker to be recognized in Linux sound control panel with

pactl load-module module-bluetooth-discover

Force A2DP/HSP audio mode by opening Pulseaudio control panel:

pavucontrol

Under “Configuration” select Bluetooth device audio mode:

Profile audio type direction
A2DP high-fidelity 0-24 kHz stereo one way playback
HSP low-fidelity 0-4 kHz monaural two way talk/listen for Skype et al

reference

Read THEMIS all-sky imager ASI data

THEMIS uses the CDF (Common Data Format) for many L1 data products.

CDF is NOT the same as NetCDF, so programs such as ncBrowse and ncview will NOT work with Themis CDF files.

Download THEMIS L1 CDF file by first looking at the L0 64x64 pixel GIF previews.

Matlab and Python functions for THEMIS ASI images make movies and the like.

Disabling middle mouse paste Linux

The “middle mouse button paste” behavior of X11 can lead to posting unwanted text in a document when you’re simply trying to scroll through it. Disable Linux middle-mouse button paste in Terminal:

xmodmap -pp

Telling the active mouse button function indices. The second number is apparently the middle mouse button function, which we will map to an unused index. Example output of xmodmap -pp:

There are 10 pointer buttons defined.
Physical Button      Button Code
1                    1
2                    2
3                    3
4                    4
5                    5
6                    6
7                    7
8                    8
9                    9
10                   10

Edit ~/.Xmodmap - swap the last number with the second number. Keep a backup of your original ~/.Xmodmap file if one existed. For the example above, edit and save:

pointer = 1 10 3 4 5 6 7 8 9 2

Finally, logout / login

the middle-mouse paste should be disabled, while you are still able to use the middle mouse button to scroll.

Reference

RTL2832 receiver overload

In high RF environments, you might notice false spurs in the spectrum. Tuning to a false frequency you might hear very distorted or whining audio.

false image spectrum due to strong signal overloading of the RTL2832. Bandwidth 240kHz. True signal is surrounded by false peaks.

RTL2832 Receiver RF overload fixes:

  • add bandpass RF filtering if you have a narrow frequency range of interest, or use lowpass/highpass filters as appropriate.
  • You might find decreasing RF/LNA gain slightly increases net sensitivity.
  • You can use a directional antenna. Compact log periodic (broadband) antennas made from a PCB are available.

Normal, non-overloaded RTL2382 spectrum display has residual center peak from a noisy power supply.

There is a remnant image on the left, due to IQ imbalance. The central hump is due to noisy onboard/PC power supply and remnant DC offset.

Windows Airplane Mode laptop charging

If Windows is set to Airplane Mode, this can prevent your battery from charging while in Airplane Mode, even after reboot or booting into Linux. The change is persistent even when booting into Linux–perhaps a no-battery-charge flag is set in the UEFI BIOS.

Windows in Airplane Mode prevents battery charging

Windows in Airplane Mode prevents battery charging.

Laptop charge after Airplane Mode: go back into Windows and turn off Airplane Mode to allow charging the battery.

Windows battery setting airplane mode

Re-enable battery charging on Windows and Linux--observe Airplane Mode is not highlighted.

The reason Lenovo gives for disabling battery charging in Airplane Mode is to avoid tripping the airplane seat power outlet circuit breaker. Seems fair, but they should have a popup message reminding you of this fact.