Thanksgiving Science!

I’ve got a little formula that predicts how long it will take for our Thanksgiving turkey to cook. It works really well for our temperatures and preparation, but I’d like to make it a little more general so everyone else can use it, regardless of temperature. As a wise man once said, if it’s worth doing, it’s worth overdoing, unless you’re overcooking turkey.

Towards that end, and because this is a science blog, I would like to perform a hypothesis-generating experiment. If you’re willing to further science, please share some details about how you prepared your turkey, and how it turned out. Humanity will thank you. Turkeys will not. I will post the results when I can, and maybe we can try again next year for a full prediction.

Click here to share your turkey data.

Firetruck: In which I write and record my first song…

Ian asked me for a firetruck song tonight for bedtime songs. I thought maybe there might be some kind of melody hiding in the fire truck siren sound, so I started there and half-assed my way through a melody. After he went down, I thought I might have enough to make a “real” song. It only has one chord progression and melody, due to it being a kid’s song and the first song I’ve ever written, but I found a surprisingly good loop to match against, and it kind of came out as a ballad for firefighters from a kid’s perspective.

Like I said, be gentle, it’s supposed to be a little lame. And I’ve never recorded a song before either.

https://dl.dropbox.com/u/9752413/songs/Firetruck.m4a

Here are the lyrics:
https://dl.dropbox.com/u/9752413/songs/firetruck.txtI’m releasing the recording and the lyrics as creative commons share-alike (http://creativecommons.org/licenses/by-sa/3.0/).

Data Processing with Python: Part 2

As I’ve said, I’ve been doing tons and tons of tabular data manipulation using Python in the past few years, and I’m sharing some of the patterns I’ve developed. Please look at Part 1 to see some of the more basic stuff, and review the rules of the road. Below the fold, we will be talking about filtering data by column and row and doing processing without loading the whole file into memory.

Continue reading

Data Processing with Python: Part 1

I’ve been doing tons and tons of tabular data manipulation using Python in the past few years, and it’s high time I shared some of the interesting patterns I’ve developed. I’m sure others have managed similar things, but I’m not about to do a literature search right now.

First, some rules of the road for dealing with data easily in Python:

  1. Read and write data using character-delimited text, like CSV or TSV. You can use Excel or others, but these tricks work best with text data. It also has the advantage of not having to load the entire file into memory at once. Very large files can be analyzed quickly line by line, if you can.
  2. Use the csv library from python:
    import csv
  3. Name your columns. Take a chance to save your sanity and use a line to give a name to each column. You’ll thank yourself later. Also, nearly all of these tricks rely on it.

Continue reading

How to fix the economy

  1. I’m not an economist, so this probably has errors in it.
  2. None of these ideas are mine. I’ll hunt down where I got them from as soon as I can. See citations where I put them in.

Businesses aren’t investing in jobs because they have no reason to. They sit on huge piles of cash and continue to make acceptable profits without adding any jobs. Astonishingly, we manage to be in a period when inflation is nil, but prices are still going up. You know what gets people investing in new things? Inflation. Mild-to-moderate inflation drives capital into investments because otherwise the value of that money decreases over time.[1]

How would someone in charge of, say, the Fed, manage to increase inflation? They start by buying debt from banks, which frees up cash in existing banks to make other loans. Home mortgages would be a great start. The Fed can easily start buying up underwater mortgages and forgive the principal above and beyond the current market value. This puts a floor on the housing market and stops the glut of foreclosures, which gives the construction industry something to do again.

I would also start buying up and forgiving student loans of unemployed college grads. This would put them in a position to take greater risks with their careers, either taking jobs that aren’t directly in their fields or giving them room to start up businesses of their own.

This would be hugely controversial, of course, but the Fed chairman is appointed so that he can make these calls. We need something decisive either way, so someone needs to bite the bullet.

But what about everyday prices? Increasing inflation means, in the short term, increases in prices of stuff in general. True, but with the hardest hit people getting loan forgiveness, their overall costs will decrease. Also, investment in new technologies generally decreases real prices even as apparent prices go up. Finally, inflation doesn’t actually impact the poor significantly because they have little savings. In an economy with inflation, wages tend to increase with inflation.

On the fiscal side, there needs to be a resolution to the structural deficit spending. Most of this comes from the Bush tax cuts. Letting them expire takes care of 1/3 of the problem. Another portion of the problem comes from health care costs in medicare and medicaid. These costs can be amortized over a larger population by combining medicare and medicaid into one pool and opening up that pool to everyone. Medicare and Medicaid take care of the most expensive patients in the country, so opening it up to the rest of us would only decrease the overall risk. [2]

Finally, social security can easily be addressed by increasing the witholding limit above 90k. This will put it on sound footing for the next 100 years, based on figures I’ve heard. [2]

  1. Krugman, Paul. Why Is Deflation Bad? http://krugman.blogs.nytimes.com/2010/08/02/why-is-deflation-bad/
  2. Reich, Robert. What If Everyone Saw This Clip Of Robert Reich Exposing 7 GOP Lies? http://front.moveon.org/what-if-everyone-saw-this-clip-of-robert-reich-exposing-7-gop-lies

Why Java’s Date isn’t deprecated, even though it might look like it

This shouldn’t be news at this point (JDK 1.5 was released 5 years ago), but in Java 5 Sun decided to deprecate large swaths of java.util.Date’s methods and constructors and introduce the Calendar class, which can handle locale-specific conversions and manipulations of the units of time we humans are used to seeing. This has created some confusion here and there about whether to represent datetimes as Dates or as Calendars, as it looks at a casual glance like Date has been more or less completely deprecated. It remains, however, as the preferred way of representing datetimes in Java. An explanation is after the jump.

Continue reading

Obama is for Science, We’re for Obama

[Edited to add Obama's positions on NASA and Space Exploration]

Those of you who know me already know that I support Barack Obama for president. I’ve hesitated to post this here, due to the non-political nature of this blog. However, it is long past time for me to make the case for Obama and his policies on science and research. More after the cut on his key positions and why they are important.

Continue reading

Zen Neuroscience: Observing Mindfulness

There are specific neural processes that take place when people meditate, which is demonstrated in the PLoS ONE paper “Thinking about Not-Thinking”: Neural Correlates of Conceptual Processing during Zen Meditation:

Recent neuroimaging studies have identified a set of brain regions that are metabolically active during wakeful rest and consistently deactivate in a variety the performance of demanding tasks. This “default network” has been functionally linked to the stream of thoughts occurring automatically in the absence of goal-directed activity and which constitutes an aspect of mental behavior specifically addressed by many meditative practices. Zen meditation, in particular, is traditionally associated with a mental state of full awareness but reduced conceptual content, to be attained via a disciplined regulation of attention and bodily posture. Using fMRI and a simplified meditative condition interspersed with a lexical decision task, we investigated the neural correlates of conceptual processing during meditation in regular Zen practitioners and matched control subjects. While behavioral performance did not differ between groups, Zen practitioners displayed a reduced duration of the neural response linked to conceptual processing in regions of the default network, suggesting that meditative training may foster the ability to control the automatic cascade of semantic associations triggered by a stimulus and, by extension, to voluntarily regulate the flow of spontaneous mentation.

Cross-Reference Visualizations

The bar graph that runs along the bottom represents all of the chapters in the Bible. Books alternate in color between white and light gray. The length of each bar denotes the number of verses in the chapter. Each of the 63,779 cross references found in the Bible is depicted by a single arc - the color corresponds to the distance between the two chapters, creating a rainbow-like effect.

Bible Cross-References: The bar graph that runs along the bottom represents all of the chapters in the Bible. Books alternate in color between white and light gray. The length of each bar denotes the number of verses in the chapter. Each of the 63,779 cross references found in the Bible is depicted by a single arc - the color corresponds to the distance between the two chapters, creating a rainbow-like effect.

This is a pretty cool visualization of bible cross-references that was developed by Chris Harrison to show bible cross references throughout the length of the bible. I can’t help but think of how interesting this could be for genome visualization: the cross references could be based on genes that are transcription factors for other genes. (activate or deactivate those genes). Chris has lots of other fascinating visualization projects to look at, and is very stimulating to browse it.