2014 01 29 technology python vision

Background: Text editing in the IPython Notebook is provided by an excellent JavaScript-based CodeMirror text editor. This might be more detail than you want, but I'm a vision scientist so I hope you'll indulge me.

The cursor is meant to tell the user the current location.

The human visual system has a pre-cortical lag of roughly 50-90 ms (read more about P1).

That's how long it takes from something changing on the screen to cause an avalanche of photons to barrel towards your eyeball, be phototransduced and processed by several stages of cells in the retina, finally causing retinal ganglion cells to fire an action potential down their axons through the optic nerve, make its way to a processing relay station called the LGN, with those cells firing action potential down their axons, with those spikes finally ending up in the primary visual cortex.

By ~150 ms, our brains have processed the visual input enough to perform a non- trivial ammount of object recognition.

The default blink rate for CodeMirror is 530ms.

That's as slow as molasses in January!

Say that I've been distracted and looked away from the screen. When I look back at the scree, half of the time it will take 3 times longer for me to get the information that I want ("where's my cursor") than if that cursor was clearly visible at all times. Now it's not always that bad, because sometimes my gaze will land on the screen and even though the cursor isn't visible, it appears in a few milliseconds, and so it takes just as long as if the cursor was there the whole time. But if I happen to be particularly unlucky (there's a reason I don't gamble), it can take 6 times longer.

Try it out

Here's the bit of JavaScript code you need to disable blinking in CodeMirror.

CodeMirror.defaults.cursorBlinkRate=0

If you type that into the JavaScript console of your webbrowser, that setting will apply to all cells created in the current IPython Notebook. If you don't know how to open your browser's Javascript console, don't frett, just make a new cell with just the following lines in there, execute it, and make a new cell to see how you like it.

%%javascript CodeMirror . defaults . cursorBlinkRate = 0

Make the change stick

IPython has a notion of profiles to allow for different kinds of configurations. If this is news to you, you've probably just been using the default profile and not known it. In the shell, run the ipython profile create command to be sure (don't worry, if you alreay have a profile, this won't overwrite it). Now ipython locate profile will tell you the directory which contains all of the configuration for the default profile.

In [1]: ! ipython profile create

In [2]: ! ipython locate profile /home/pi/.ipython/profile_default

In [3]: x = ! ipython locate profile

In [4]: cd $ x . s /home/pi/.ipython/profile_default