# Rendering the Structure of the Universe in Your Spare Time

October 6, 2009 — Jeffrey Bryant, Scientific Information Group

The Sloan Digital Sky Survey (SDSS) is an ongoing endeavor to map the sky in great detail, with many different goals. One of the larger objectives is to map the structure of the cosmos by determining the positions of galaxies and their relativistic redshift (basically their distance). Using this data and Mathematica, you can plot the information and reveal the structure of the cosmos.

In my spare time, I queried the SDSS website, which is database driven, and in eight separate queries I was able to get all galaxies in the survey out to a redshift of 0.5. According to Wolfram|Alpha, this corresponds to looking back in time 5.02 billion years ago, or a distance of 6.14 billion light years, when the light we’re now seeing from the most distant galaxies started its journey here. That’s a billion years before our solar system formed. It’s taken this long for the light to reach us.

This animation is of only a tiny fraction of the visible universe, but still more than enough to give you a glimpse of the size and scale of the universe.

Each point represents a galaxy. Our galaxy would be at the very center (no, we aren’t the center of the universe—just the center of this animation). As you can see, galaxies tend to cluster along a web-like structure with “voids” interspersed. The survey images the sky in slices, which form the wedge-like pieces in the animation. These are the areas of the sky imaged so far.

The well-known Hubble Ultra Deep Field, while imaging galaxies to a much greater distance (about 13 billion years ago and redshifts between 7 and 12), covers only a tiny pinprick of the sky (11 arcminutes) and so doesn’t show the structure that this animation does.

This was achieved in Mathematica with a very tiny amount of code:

Here proj is just the collection of triples {x, y, z} obtained from the SDSS data. I then just varied the ViewPoint and exported each frame. Find out more about using Mathematica in the field of astronomy on our Astronomy Solution page.

Posted in: Astronomy

 Unfortunately youtube seems to have some problems because i can’t load the video. From your description it seems a very interesting animation. Posted by Shears    October 6, 2009 at 2:51 pm
 Good post, but it could have been much better. What were the MMA commands used to query the SDSS databases? What processing was required for the data? Did you try other view points? Answers to all these might have made a much much better post. Posted by David    October 6, 2009 at 9:53 pm
 Really cool. The Mathematica code really is short too, impressive. I think I’ve seen this rendered somewhere else too, oh yeah, the Millenium Simulation: http://www.mpa-garching.mpg.de/galform/millennium/ Awesome stuff Posted by Paul Eipper    October 6, 2009 at 11:36 pm
 this is amazing! thank you! Posted by jason    October 7, 2009 at 1:32 am
 It’s so lucky for me to find your blog! So shocking and great! Just one suggestion: It will be better and easier to follow if your blog can offer rrs subscription service. Posted by Christian louboutin online    March 15, 2010 at 10:18 pm
 great stuff, but trying to replicate all I got was a sphrical distribution of the points with a bright line in the middle. Could you please post the SQL code you used to obtain the data and also what distance scale did you use and how you converted from z to distance, here is what I used in the SQL: select ra,dec,z from specObj WHERE z BETWEEN 0.001 AND 0.5 Thanks. Posted by Mark    April 17, 2011 at 5:36 pm
 Its been quite a while and I’m not usually a database guy. I didn’t make the database calls from Mathematica since their website didn’t make it obvious how to do that, but I was able to get the data using the following SQL commands: SELECT sp.bestObjID as oid, sp.z as z, sp.specClass as specClass, sp.ra as ra, sp.dec as dec, sp.mag_0 as mag_g, sp.mag_1 as mag_r, sp.mag_2 as mag_i, gal.expMag_r as emag_r, gal.expAB_r as AB, gal.expPhi_r as phi, gal.expRad_r as rad_r, gal.expRad_i as rad_i, gal.petroR90_r / gal.petroR50_r as conc90_50 FROM SpecObj as sp, Galaxy as gal WHERE sp.bestObjID = gal.objID and sp.z = 16000 The last line needs to be tweaked to get a specific batch. Their site times out if the batch is too large. I downloaded each batch to a CSV file and then imported them. Each row had the form: {“oid”, “z”, “specClass”, “ra”, “dec”, “mag_g”, “mag_r”, “mag_i”, “emag_r”, “AB”, “phi”, “rad_r”, “rad_i”, “conc90_50″} To transform this data into something ready to be plotted in 3D, I used: proj = reduceddata /. {z_, ra_, dec_} :> {z Cos[ra Degree] Sin[dec Degree + Pi/2], z Sin[ra Degree] Sin[dec Degree + Pi/2], z Cos[dec Degree + Pi/2]} DIstance was not computed. Only redshift is plotted directly. Posted by Jeff Bryant    April 18, 2011 at 11:01 am