20110223

ZSH Colored prompt

Just a quick post because this was driving me crazy : how do you get a colored prompt on ZSH on ubuntu ?

Various suggestions online seemed to fail. It seemed like the escape sequences for getting colored varied wildly, and none worked for me.

I followed the instructions here for loading one of the default prompts. eg :
autoload -U promptinit
promptinit
prompt -l
prompt bigfade
Then, I typed
echo $PROMPT
to see what the proper escape sequences were ( they didn't look like anything provided online ). e.g.:
%B%F{blue}█▓▒░%B%F{white}%K{blue}%n@%m%b%k%f%F{blue}%K{black}░▒▓█%b%f%k%F{blue}%K{black}█▓▒░%B%F{white}%K{black} %D{%a %b %d} %D{%I:%M:%S%P}
%}%B%F{yellow}%K{black}/home/mrule>%b%f%k
So, apparantly %B gives you bold, %F{colorname} sets the foreground color, and %b and %f return these to defaults ? Anyway, I finally got my simple blue prompt:
%B%F{blue}%~$ %b%f

20110217

Willmore et al. — Neural Representation of Natural Images in Visual Area V2 (2010)

Ben D. B. Willmore, Ryan J. Prenger, and Jack L. Gallant — Neural Representation of Natural Images in Visual Area V2 doi:10.1523/JNEUROSCI.4099-09.2010

The authors explore response properties in area V2 using natural images. The spatial but not the temporal statistics of natural images are present in their stimuli. They use the Berkeley Wavelet Transform as a non-linear preprocessing step to generate components to relate to V2 responses by reverse correlation. Phases are quadrature encoded. The authors find that the BWT fits V1 and some V2 cells well with only a few excitatory components. Other cells in V2 are a mixture of several wavelet components as well as suppression from other components. Qualitatively, it appears that components are summed to create robust, broad-band edge detectors in V2. The authors note that inhibition plays a large role in the receptive field properties and that natural input statistics are important for recruiting realistic inhibition.

20110205

3D Printed Polyhedral Lamp

These are instructions for building a very bright lamp with 20 bulbs and a truncated icosahedral core. [Thingiverse entry].


Parts :
Materials:
  • electrical tape
  • super-glue ( I used Gorilla brand )
Tools:
  • Pliers
  • 3D printer
  • razor knife
  • wire cutters
  • wire strippers
  • Phillip's head screwdriver
Assembly:

First print out the indicated quantity of all printed parts.

More detailed assembly instructions for the lamp socket brackets can be found on the thingiverse page. Trim the bracket until the black socket rests flush inside. This is important, since we need the hexagonal cover plate to bond to both the bracket and the socket for a good fit.
The orientation of the socket within the bracket will matter later. The socket has a wide ridge. Align this ridge with a side of the bracket for 10 pieces. Align the ridge with a corner of the bracket for the other 10. Aligning randomly also works, as long as you don't align all sockets so that the wide parts face a side.

Print out 12 pentagonal pieces. All pieces have extra plastic to stabilize the hinge while printing. This can be removed easily with a razor knife.

Perform a test assembly with just the hexagonal pieces. Leave out the pentagons for now since they are hard to remove once assembled. Ensure that all light sockets fit properly and don't collide. You may have to experiment, rotating and swapping between pieces, to get everything to fit well. If all else fails you can tap apart one of the brackets and re-orient it.

Carefully unfold your test assembly into an as-linear-as-possible planar arrangement like below. The exact arrangement doesn't really matter, just so long as there isn't too much branching.

The lamp sockets clip onto 12 to 14 gauge electrical wire. The only 12 gauge wire I could find had too thick of insulation to work with these sockets. I used 16 gauge wire instead, which just barely works. Using scissors or a knife, separate one end of the lamp cord. Protect the ends with electrical tape. Starting at the far end, clamp the sockets to the cable in turn. The sockets are difficult to close, so I had to use pliers to get enough force.

Before you get excited and attach the plug to test everything, slide on the pentagonal hook piece over the cable. The top of the printed piece should be facing away from the assembly, toward the plug. I neglected to do this, and had to dis-assemble my plug to add this piece.

To assemble the plug, use needle-nose pliers to remove the orange stopper from the front of the plug. Remove the prongs. Thread the lamp cord through. Split and strip about 13mm from the end of each wire. Wrap the exposed wire around the bolts attached to the prongs, and tighten the bolts well. Replace the prongs and stopper.

Test each of your sockets. Turn everything over and plug in some lightbulbs. I did it the dangerous way by adding and removing bulbs ( I only had 2 at the time ) while the thing was plugged in. People that don't want to die should un-plug the setup while moving the bulbs. Better yet, order the bulbs with the rest of your parts and put them all in at once to test.

The next step is tricky. Unplug the setup and remove the bulbs. Turn over the setup. You are going to need to fold the pieces back into the polyhedral shape. The lamp cord is inflexible and resists folding, but bending each joint beforehand helps. Adding in the pentagons while folding provides more stability. As the polyhedron becomes more complete, it becomes more difficult to add pieces. If you're having trouble getting a hinge to mate, pry up slightly the side that is already in the polyhedron. The hinges come together more easily if pushed together from the side, rather than if pushed down from above.

When it was all done, the compressed cable overpowered the super-glue on a couple brackets, thankfully this mistake is easily fixed with more super-glue and some patience. You should end up with an object that looks more than a little bit like the detonation mechanism for an atomic bomb. The final assembly is very strong and the hinges will hold together without additional glue.

The last piece you'll insert is the one that contains the power cord and the rope or chain for hanging the lamp. I would attach rope or chain before you add this piece. Don't use polypropylene rope like I did, it doesn't hold knots. A chain would look nicer anyway.
Thats it. You're done. Hang the lamp somewhere, insert bulbs, and power up your own miniature sun.

20110203

Lighting Element



I plan on assembling 20 of these in a soccer ball shape, to create a ridiculously luminous lamp, which I'm going to call "modern sun" (even though that has been done). It will wake me up naturally in the morning to combat this grey New England sky.

20110202

A few questions

Every now and then, I get confused by the conversion of spike trains to continuous signals. A lot of existing signal processing algorithms have assumptions that make them unsuitable for spike-like data. To circumvent this, we usually smooth or bin the spike trains in some way. This conversion is always arbitrary, and I still haven't wrapped my head around what it means when we do it.

In effort to learn more about this, I asked myself ( and some friends ) three questions :

Given a continuous signal and a spike source encoding part of said input, how do you optimally reconstruct the continuous signal from the spikes ?
Given the same as above, how might you optimally reconstruct the spikes from the signal ?
Given a single-channel analog data stream, how might you best encode it in a neural spike train ?

While its possible to write down mathematical expressions for all of the above, we don't really have algorithms to optimize or solve for the raw expressions.

We can do a couple of things instead :

Given a continuous signal and a spike source encoding part of said input, how do you optimally reconstruct the continuous signal from the spikes ?
- Reverse correlation can give you a reconstruction of a continuous stimulus or response based on spikes. Similar but more advanced algorithms also exist to perform this conversion. Of the three questions, I believe this one is most nearly solved.

Given the same as above, how might you optimally reconstruct the spikes from the signal ?
- Rather than model spikes, model the conditional intensity function ( variable rate in a poisson process ). This has the benefit of capturing the variability of spiking response. Inidivual spike trains can be drawn from this conditional intensity function. If your spike trains are highly reliable, the conditional intensity function will become obviously spike-like and this will effectively reconstruct spike times. If your spike trains are unreliable, the conditional intensity will look more like a smoothly fluctuating rate. There is a lot of flexibility in how you fit this model, and algorithms in "point process modeling" are subject of current research.

Given a single-channel analog data stream, how might you best encode it in a neural spike train ?
- Perform a decomposition with a sparseness constraint in both space and time. This will give you a basis where functions are sparsely and briefly activated. Conceivably, you could convert a time course in the new basis to spikes with less error than say, asuming rate coding. This research is more machine learning. Specifically, Olhousen has done work in this area.

20110201

Improved Polyhedron Kit



This kit uses the same type of snap at all locations so theres no puzzle of figuring out where to put snaps to assemble the polyhedron.