06 October 2012

Best Software Practices for Science / Scientific Computing

I highly recommend this:

http://software-carpentry.org/2012/10/best-practices-for-scientific-computing/

The most important tips that I would like to see my own group use more of are (abridged from link):

  1. version control (with modern DVCS, there's no reason not to have even your little scripts under version control)
  2. automate repetitive tasks and use the computer to record (command) history (I think these two really go hand in hand with each other and with #1)
  3. Don’t repeat yourself (or others).
    1. Every piece of data must have a single authoritative representation in the system. 
    2. Code should be modularized rather than copied and pasted.
    3. Re-use code instead of rewriting it
Copy and pasting leads to the code blocs getting out of sync, i.e., inconsistent analyses. And I can't tell you the number of times I've found a mess of  inconsistent scripts and literally hundreds of gigabytes of duplicated data, with no single copy "authoritative". (Luckily, in the last case, SHA1 revealed that the individual data files were identical; however, each set had a slightly different collection of files...). And if you do right from the beginning, it doesn't even take that much time!

I think all of this can be summarized into two points:
  1. Use version control 
  2. Use good coding/documentation practices, including modularity

04 October 2012

Compiling libeep on OS X (for importing data into EEGLAB)

For OS X, there are a few important tips: 

  1. You need a compiler installed -> you need XCode installed. You can get these via the App Store for free or, pre-Lion releases, from your install disc.  
  2. Most important tip** Before running ./configure --enable-matlab, you need to set the $MATLAB environment variable, which isn't set by default on OS X. Do this via export MATLAB=/Applications/MATLAB_R2012a.app (with 'R2012a‘ changed to whatever your MATLAB version is.) 
  3.  You don't need to 'make install' for using EEGLAB. Instead just copy the .mexmaci64 files from the mex/matlab folder to the anteepimport1.08 (version number may differ, but that was the latest based on a SVN checkout from a few days ago) subfolder in the eeglab plugins folder. If you there is no anteepimport plugin folder, then you need to create one and copy the contents of both mex/matlab and mex/eeglab to it. 
  4.  If you need to make install for other reasons, you have to sudo

rEFIt, broken GRUB repair following updates

If you mess up your GRUB configuration on an Intel Mac dual booting via rEFIt (or rEFInd), there are several things you can do.

There's all sorts hints and tips that may or may not work on your setup and are all very particular to your partitioning scheme, but I found a few to be quite informative, especially in understanding  the underlying technical problem (ie why GRUB is such a pain to get working right in these setups).

https://bbs.archlinux.org/viewtopic.php?id=99097
http://mac.linux.be/content/problems-refit-and-grub-after-installation
http://ubuntuforums.org/showthread.php?t=1704357

In the last one, the author of an important EFI / GPT-MBR hybrid utility chips in some advice and information. I would try to avoid doing a hard recreation of your hybrid MBR though. One thing you will definitely need is some type of live boot disk.

After trying several bits and pieces of the above advice, and apparently failing to properly reinstall GRUB, I went from a working GRUB that just couldn't find my OSes after selecting to them to a GRUB that never got past displaying "loading".  If you get that far, then you may have to force an install.

Based on this post, I wrote this script for my set up. And that fixed things.

02 October 2012

sudo fu

So apparently, you have to use
sudo su someuser

to do something as another user on Linux Mint Debian Edition. Oh, and the wheel group is actually the sudo group.  

Searching for R

So, it seems I'm not the only person who finds searching for things related to the statistical language R to be relatively difficult and full of garbage:

http://stackoverflow.com/questions/102056/how-to-search-for-r-materials

That's somehow comforting…

01 October 2012

Documenting progress

I spend a lot of time working on automating various little tasks in my life. Research workflows and various parts thereof, administration of personal and work computers, generation of examples for my students, ... the list goes on. In doing so, I've learned a thing or two (especially about odd gotchas and corner cases in the world of software [development]) and written some code to help with the more tedious, error-prone parts of the job. And that's what I'd like to share here: the work, the thoughts and the experience.