A blog about exoplanets, scientific computing, and life as I know it.

Category Archives: programming

Two useful tools: git-flow and git-gutter+

This is just a quick post linking to two very useful tools I just started incorporating into my workflow.

The first is git-flow. Git-flow gives a very nice structure to feature development using git: it imposes some discipline on branching and committing features to the “master” branch, while also providing a very helpful branching naming scheme and a clear path from developing a feature to incorporating it into a release. This post gives a clear overview on how to get started with it.

Fringe Git indicators in Emacs.

Fringe Git indicators in Emacs.

The second is an Emacs package called git-gutter+ (in its “fringe” flavor). It lets you view Git changes directly from the current buffer (the graphical symbols in the fringe shown in the screenshot). Install it from the package manager (MELPA) and add to one of your .el initialization scripts.

Link: Why I’m betting on Julia

Evan Miller: Why I’m betting on Julia

Julia looks to me like a very promising programming language.  Its main appeal is bringing C-like speed to a high-level, well-designed language that is tailored to scientific computation. From the article:

I hesitate to make the comparison, but it’s poised to do for technical computing what Node.js is doing for web development — getting disparate groups of programmers to code in the same language. […]

If you work in a technical group that’s in charge of a dizzying mix of Python, C, C++, Fortran, and R code — or if you’re just a performance-obsessed gunslinging cowboy shoot-from-the-hip Lone Ranger like me — I encourage you to download Julia and take it for a spin.

The “dizzying mix” is very much how I would describe a lot of the code I use and write on a daily basis.  R is too slow for intensive computations, so I drop down to C to write most of my algorithms and then wrap the C code in a higher-level R interface (via FFI); a similar state of affairs exists for Python. Getting communication right between the two worlds (the low-level C and the high-level language) can be daunting, and frankly, the mental context switch is exhausting. (Let’s not even bring Fortran into the discussion.)

I really hope Julia will succeed. What it needs right now is a first-class plotting facility and a bit more widespread adoption, but once that is achieved, I think that Julia will be a serious contender for mindshare.

You gotta get a gimmick: BAM

BAM is a new, extremely lightweight templating system that converts files containing a mixture of code, metadata and text and produces a plain text file. We use a fully-featured version of BAM as an “automated paper writer” in my research group at UC Santa Cruz. A short guide to BAM is available here.


BAM was born out of my conversations with Greg Laughlin on how to automate the somewhat repetitive task of writing certain types of scientific papers and reports. Since we already had a planet discovery tool at our disposal, we decided to focus on planet discovery papers. In its full version, BAM is deeply integrated with the Systemic Console to produce first drafts of planet discovery papers from a reusable template, with the aim of automating as much as possible the writing of the abstract, introduction and quantitative analysis. The Console-integrated BAM has some cool NLG features that we used to write Meschiari et al., 2011 (discovery of HD31253b, HD218566b, HD177830c, HD99492c). Since these planets are somewhat unremarkable, this paper lent itself well to automated writing of the majority of the text. Ideally, BAM templates evolve to contain enough logic to be able to “comment” on the data it processes; for instance, it could write a few remarks about the distribution of the newly discovered planets in period-eccentricity and period-mass plots, such as the one to the right (where the dots are automatically downloaded from the Extrasolar planet encyclopaedia and placed on the plot by BAM, as well).

Following the spirit of literate programming, the paper template contained the procedure for the data analysis, fitting, error estimation and all the plots intermingled with the LaTeX layout and fragments of text. I presented this tool at the European Science Foundation conference (presentation in Keynote format), including a somewhat humorous video of the Console discovering, analyzing and publishing four planetary systems in real time based on the directions of the paper template (see video at Greg’s website). It’s become one of my favorite gimmicky (but useful) tools to show off to people.

While we keep the Console-integrated BAM version private for use by our team, I am making a rewritten and simplified version, available to download now. You should consider this a preliminary 0.1 version and expect bugs and limitations to crop up; features will be added back in future revisions.