Tempel 1 NASA Pass-by

Tempel 1 NASA Pass-by



This is a brief project involving NASA’s STARDUST-NExT spacecraft. In 2006, the craft collected samples from Comet Wild 2 and turned back around on a follow-up mission to visit the comet Tempel 1. On February 15 of this year (2011), a series of images of a Tempel 1 fly-by were posted on the Jet Propulsion Laboratory website. Blown away by such an amazing event captured in stunning clarity, I immediately had to put together an animated version of these images. Below is a short summary of a quick hack to create such an animation as well as the resulting files.

More Information:

For more information on the mission, feel free to peruse the press-kit information or visit the fly-by page.

The hack:

Python Urllib2 and Urllib are used to grab the pages and download the images, respectively [urllib2,urllib]. Images are then processed with ImageMagick. NOTE: Using a parsing library like Beautiful Soup would be much better, but what would a hack be if it were the optimal method? Now to the code…

grabber.py – get the images download

This will dump all the images into the current directory so probably best to make a new directory and launch from within that desired location.

#!/usr/bin/env python

import urllib2,urllib

lines = urllib2.urlopen('http://www.jpl.nasa.gov/news/stardust/').readlines()

files = []
for line in lines:
	if '<a href="/news/stardust/index.php?fileID=' in line:

links = []
for line in files:
	if "<h3>Comet Tempel" in line:

pre = "http://www.jpl.nasa.gov"
linkslist = []
for line in links:
	this_l = line.split('"')[1]

x = 0
for link in linkslist:
	thislink = link
	thispage = urllib2.urlopen(thislink).readlines()
	images = []
	for line in thispage:
		c = []
		if "../../images/stardust/stardust2/" in line and "alt='Comet Tempel 1" in line:
		if c:
	for image in images:
		d = image.split("'")[1]
		g = thislink.rpartition("index.php")[0]+d
		thisimage = g.rpartition('/')[2]
		x += 1
			image = urllib.URLopener()
			print "Grabbed image # ",x," ==> ",thisimage
			print "**** Problem grabbing image # ",x," ==> ",thisimage

Making the animations:

The following will invoke a small ImageMagick GUI instance. Once the images are loaded the animation will play. To tweak/save, right click and the menu will appear where you can manipulate the GIF. Seen here.

animate *.jpg

Making a scaled version:

Use ImageMagick to scale all the images and animate the scaled products.

for i in *.jpg; do convert -scale 20% "$i" $(basename "$i" ".jpg")"_scaled.jpg"; done
animate *_scaled.jpg


Okay, enough for you already? Well here are the results: Large version and Scaled version.


… Then felt I like some watcher of the skies
When a new planet swims into his ken;
Or like stout Cortez when with wond’ring eyes
He stared at the Pacific …

– John Keats, ms of sonnet (1816)