Brownian thought space

Cognitive science, mostly, but more a sometimes structured random walk about things.

My Photo
Location: Rochester, United States

Chronically curious モ..

Tuesday, January 30, 2007

Python for MATLAB users on the Mac

I've been pretty much wanting to go and learn stuff like Perl or Python, and after a careful scouring of the net, decided upon Python, mainly for the ease with which you can use it.

But then, being such a MATLAB fan, I didn't seem right to not be able to pop a graphics window and visualize the data. So, more netsurfing later, I came up with the following way to get Python running on a Mac so it feels a bit like MATLAB.

If you do get around to trying this, make sure you're all up for taking responsibility for using sudo and the rest. Also, I've tried this on machines running Tiger; both PowerPCs and Intels, and it looked pretty ok, but ymmv. I'm certain there is a way simpler way of doing this, and if you know of one, let me know as well!
nb. Install in this order, as some things depend on others...

  • Get and install Python 2.5 for the Mac (dmg), from from this excellent repository by Bob.
  • Get and install freetype2, libpng3 (Use Fink/FinkCommander).
  • Get and compile+install zlib. To compile+install, navigate to the directory in Terminal and (the $ is the bash prompt):
$ ./configure --shared
$ make
$ sudo make install

  • Get and install this patch for Tiger.
  • Get and install wxPython (dmg) from Bob's repository.
  • Get the source for IPython from the SciPy site. To make and install, navigate to the folder from the Terminal and:
$ sudo python build
$ sudo python install
$ sudo pythonw install_scripts --install-dir=/usr/local/bin

To see if everything is OK: fire up Terminal and:
$ ipython -pylab
(On the first run you should see lots of stuff happening). The prompt changes:
In [1]: plot(sin(arange(0, 10, 0.01)))
...and you should have a nice sinewave as in this screengrab!

Next step: writing the Python-Programmer version of the Lumberjack song.

Labels: , , , , ,

Sunday, January 28, 2007

At Bogart's

If you are ever in the vicinity of Padova, you absolutely must stop by Bogart's, a restaurant run by a friend of a very close friend.

So, anyhow, it was the first time inside a restaurant for lunch, with absolutely no one else except me, Stefano (owner/chef), Giovanni and Debora.

The restaurant itself is pretty large (150+ seating), with a very upscale look and feel, which is matched by a very fancy menu, excellent food, so the low prices are shocking enough so you feel something is wrong. But there isn't!

The food: me and Stefano threw together some chicken with the standard tandoori mix, with some lime juice and cream. They keep onion and garlic as a paste under oil, so it's throw, throw, throw and cook. The cooking range is just massive... and the smallest pot makes enough for 5 or so at least. (I won't talk about the rice as it was a disaster).

Then Stefano puts together homemade gnocchi that he makes himself every two days, and a sauce with capasanta (Mediterranean scallop) and calamari (squid), with onion-garlic, olive oil, tomato paste, zucchine and flambéd with brandy. Although I'm not much of a sea-food person, it was just VERY tasty!!

Then there was a cake topped with fresh strawberries in cream. And then, extremely good coffee (Lavazza); another thing I'm not, in general, terribly fond of.
*Sigh*. I need more days like these...

ps: here are the coordinates of Bogart's (take note, Cristian.G-M!):

Friday, January 26, 2007

Bill Bryson's Brush with Science

I recently finished reading Bill Bryson's A Short History of Nearly Everything, and here is a 'review' (Gamespot style) The Good: A very good introduction to the nature of nature, specially the nature of our little planet. Bryson-style writing, occasionally guffawable. The Bad: Waaaay too many facts, and very little to actually understand the science behind it. Very little about how problem-solving gets done in science. Few scientists and far too many boffins and nerds dot the landscape.
I loved the older B.B. Books like Neither Here nor There: Travels in Europe. So, when I saw a book that looked like he was taking on all of Science, naturally I went and bought it. aSHoNE starts off with the kind of stuff I was expecting: BB creates a childhood image of himself as a child peering into a scientific textbook, captivated by the image of the earth with its innards exposed, and trying to understand how on earth (sic) anyone could know that. "Here", I thought, "is a book that will tell me answers to questions like, 'How do they know what goes on inside an atom?', and will be funny!". Well, at least there is some of both. There are some funny stories and there is some of how science is done. But what you really walk away with is a collection of semi-isolated facts and any number of doomsday scenarios. Based on hard fact, to be sure, and many of these stories are chilling in their telling. But this book doesn't really tell you how things get done, and there is too much of "... and then Stevenson used the well known principle of Blatchard Von Prissley, invented to understand the eyestalks of juvenile snails, and applied it brilliantly to the Neanderthal molar to show that ..." kind of stuff that is not really fun. Then there is the matter of the scientists. Most scientists are not people you could write funny stories about. Rather, they are no more or less interesting (in my opinion) than are gaffers, exotic dancers, bricklayers or airline crew members. So, of course, BB zeroes in mostly on the oddballs. But, another way of looking at it is that it is BB who is the interesting person, who, upon meeting the dullest of scientists, has an eye for those quirks that make fantastic storytelling. I'm not sure. All in all, it's a book to read mainly cos it's written by BB.

Wednesday, January 24, 2007

Monkey knows

No, the article is not about the dude; but looks a lot like the author Webb Phillips who with Laurie Santos , both from, wrote the piece. Basically, the idea is to show that monkeys can hold representations of kinds of stuff . For example, if you see a white cuboidal piece of fruit, it could be cut out of an apple or out of a coconut. But if you liked coconuts and not apple, you would feel differently about these two pieces that look (but not smell/taste etc.) pretty much the same. In their experiment, P&S show monkeys sequences like the above, where a white cuboid is extracted either from a coconut or from an apple, and 'placed' into a box (which already contains a piece of apple/coconut), but is actually slipped into Webb's pocket. Essentially, monkeys scour the boxes longer if they saw a piece of apple placed inside but found a piece of coconut (and vice versa), implying that they expected not just a bit of fruit, but a specific piece of fruit, independent of what they saw (the same thing, each time). It would have been SO cool if they had gone a step further and showed that the same thing happened with a fake fruit. As they discuss, their monkeys might have learnt: "coconut shape" => "coconut taste", and so might continue looking for a coconut even if they found a piece of apple. But, if the piece came from some unknown (to the monkey) fruit, and if it still searched longer, the monkey would have had to have made the inference: unknown fruit -> unknown flavour; known flavour -> known fruit, != unknown fruit. Essentially, it might be better evidence against the associationist accounts, although I suspect nothing short of a 16-ton, Monty Pythonesque weight will convince them... Webb Phillips and Laurie R. Santos, Evidence for kind representations in the absence of language: Experiments with rhesus monkeys (Macaca mulatta), Cognition, Volume 102, Issue 3, March 2007, Pages 455-463.

Friday, January 19, 2007

Advait meets the Prez!

The Indian President Dr. APJ Abdul was at the Dinanath Mangeshkar, and little Advait, a very cute (somewhat distant) cousin of mine was there to give him a bunch of flowers :)

Thursday, January 18, 2007

Why eyelids?

One of those early morning, just-awake question: why eyelids? Thoughts:
  • to block especially harsh visual input (so why not for sound or smell?)
  • as windshield wipers, with the tear ducts as the things that squirt soapy water from the nozzles onto the windshields
  • to "see" dreams better? If dreams are somehow important, and if they need access to primary visual cortices, then it might be a good idea to shut down V1 requirements through the thalamus?
Here's another thing: if you flash a bright white light onto closed eyes, you see red (not literally, unless you weren't expecting it), which means that eyelids let red frequencies through, which in turn means that they don't let blue through. Now isn't that just neat: moonlight or nighttime light sources in general - the natural ones, not flashlights - tend to be blue, so our eyelids are actually not just filtering out light in toto, but specifically those bits that are most prominent during the night time. Neat! Question: is there a relationship between the size of the visual cortex and the kind of eyelids and what they can do?

Sunday, January 07, 2007


Finally finally got around to seeing Casablanca. It's so darn hard to say what it is exactly that's so brilliant about the film, but the film is absolutely fantastic.