Auroral GLOW model by Stan Solomon in Python


Thanks to Steve Kaeppler who pointed out this model to me, I have trivially wrapped the GLOW auroral VER model in Python, making it very easy to use the GLOW model from Python. I am still working on this so please leave a comment or email if it’s missing something you need (which is likely).

I would like to complement Solomon’s team who generally wrote the Fortran 77 code without excessive legacy techniques and syntax errors, which made the porting much faster. I only had to make minimal modifications to bring the code up to Fortran 77 standards.

f2py: Running Fortran code in Python on Windows

F2PY is a great package allowing you to run a lot of Fortran code from Python. Fortran 77 code naturally has a high chance of success.
Fortran 90 code can also work, but very elaborate Fortran 90 code may not work.

On Linux, all you need to do is

sudo apt-get install python-numpy gfortran

On Windows, the f2py setup is more involved. You need the MinGW compiler and to modify your system path. I assume here that you have Anaconda Python with Numpy 1.9 installed already. This procedure was used on a 64-bit Windows 10 machine.

1) install MinGW-W64 with the setup settings:
Version 4.9.2 (or newer)
Architecture: x86_64
Threads: posix
Exception: seh
Build revision: 2

2) Insert the mingw bin path to your system path. I did this permanently by going into Windows Advanced System Settings, Environment Variables, System variables, Path, and at the end put:

C:\Program Files\mingw-w64\x86_64-4.9.2-posix-seh-rt_v4-rev2\mingw64\bin

check to see if that’s where your gfortran.exe is at.

test your installation by say using the lowtran7 code.
Following the instructions there, you should get a lowtran7.pyd file that is invoked when running
python and you’ll see a plot of atmospheric loss.

Note: If you get the “NotImplementedError: Only MS compiler supported with gfortran on win64″, that is still occurring with Numpy 1.9.2, but has been patched in the master branch (to be released in a future version of Numpy). You can patch this yourself in c:\Anaconda\Lib\site-packages\numpy\distutils\fcompiler\ on line 337. Comment out the
raise NotImplementedError(...)
and simply replace with the word
and you’ll be working.

Lowtran7 example output in the Arctic looking near zenith.
Lowtran7 example output in the Arctic looking near zenith.

Compiling Octave 4.0 on Ubuntu 14.04

sudo apt-get install gawk gfortran gperf flex libbison-dev libqhull-dev libglpk-dev libcurl4-gnutls-dev libfltk1.3-dev librsvg2-dev libqrupdate-dev libgl2ps-dev libosmesa6-dev libarpack2-dev libqscintilla2-dev

Note, I may have missed something since I didn’t do the above from a clean install (I may have something installed that you’re missing).

Checkout the Octave 3.8 compiling page for hints about what packages you might be missing if you get errors, and leave a comment to let others know.


./configure --enable-jit --prefix=/opt/octave4.0

This resulted in:

  Build Octave GUI:                   yes
  JIT compiler for loops:             yes
  Build Java interface:               yes
  Do internal array bounds checking:  no
  Build static libraries:             no
  Build shared libraries:             yes
  Dynamic Linking:                    yes (dlopen)
  Include support for GNU readline:   yes
  64-bit array dims and indexing:     no
  OpenMP SMP multithreading:          yes
  Build cross tools:                  no

With the only Warning being about JAVA_HOME not defined.
Then I typed


Bluetooth on the Intel Edison

Here are some quick notes for using Bluetooth on the Intel Edison. These tips should also prove handy for Bluetooth on the Raspberry Pi and Beaglebone.

Please refer to the Intel Edison Bluetooth manual.

# opkg install bluez5 bluez-hcidump

Of course, on the Raspberry Pi and Beaglebone, most people are using Debian/Ubuntu so type apt-get instead of opkg.

Some people prefer BlueZ4 over Bluez5, in part because some features were moved around or descoped in BlueZ5, but BlueZ5 can be easier to work with otherwise. The Intel Edison Bluetooth manual uses BlueZ5 to play sound from the Edison over Bluetooth headphones, to send text with Android phones, etc. Check out the manual!

List Wireless devices:
$ rfkill list
The listing will include:
 2: bcm43xx Bluetooth: bluetooth
    Soft blocked: yes
    Hard blocked: no
Unblock Bluetooth devices:
$ rfkill unblock bluetooth

We now see another device:

3: hci0: bluetooth
   Soft blocked: no
   Hard blocked: no
List Bluetooth Device UUID
$ hcitool dev
You should see

and your device UUID.

Enable BLuetooth
# hciconfig hci0 up
Use bluez interface

Please refer to the Intel Edison Bluetooth manual.

LCPFCT solver–accessible from Python

LCPFCT from Python
LCPFCT from Python

The venerable NRL Flux-Corrected Transport algorithm for Solving Generalized Continuity Equations has been cited in hundreds of publications and is used by myself in my PhD thesis and general research.

I have updated the syntax of the original Fortran code slightly to fit with the FORTRAN 77 standard (not changing algorithm behavior, only syntactical correctness). As a byproduct, I have made demo plotting code available in Python that uses f2py to make the LCPFCT run from Python at an order 50x speedup overall since you don’t have to write output to disk and then read it back in via a custom parsing algorithm.

Goldwave 5.x on Linux WINE

You will need a 32-bit winearch. Typically your default .wine directory is 64-bit. Let’s leave that alone and create a new 32-bit wineprefix and setup Goldwave 5. (Goldwave 6 is not WINE compatible as of WINE 1.6).

Download Goldwave 5 to your ~/Downloads directory.

Then, from Terminal,

WINEPREFIX=~/.wine32 WINEARCH=win32 winetricks wmp10

WINEPREFIX=~/.wine32 wine ~/Downloads/gwave5*.exe

Once you’ve installed Goldwave 5, press the F11 key to open Control Properties, then select the System tab, and click the “Use DirectSound AP” radio button. You can test your setup by clicking the Device tab, and the Test playback button, you should hear a brief test tone. Click OK to save this setting.

You should be able to create new/save/play sound files (this gives Goldwave 5 a WINE Silver rating I think)


At this time, Goldwave 6 is not compatible with WINE that I know of. I get the following errors from Goldwave 6 after installing and trying to run Goldwave 6 in a 64-bit Windows 7 wineprefix:

err:module:import_dll Library BTHPROPS (which is needed by L"C:\\Program Files\\GoldWave\\GoldWave.exe") not found

err:module:import_dll Library BLUETOOTHAPIS (which is needed by L"C:\\Program Files\\GoldWave\\GoldWave.exe") not found

err:module:LdrInitializeThunk Main exe initialization for L"C:\\Program Files\\GoldWave\\GoldWave.exe" failed, status c0000135