<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
	<title>Case Study:  Visualizing Astronomical Data</title>
	<meta name="generator" content="BBEdit 6.5.3">
</head>
<body>

<h2 align=center>Case Study:  Visualizing Astronomical Data</h2>

<h3>Goals of the case study</h3>

<p>
The visualization goal of this case study is to reproduce an existing visualization by modifying an existing visualization and creating additional parts from scratch.  The content for this case study is astronomical data, specifically the coordinate system of the stars in the celestial sphere.  This case study also provides the student with the opportunity to demonstrate competence and confidence in the use of several software tools.  
</p>

<h3>Background science</h3>

<p>
One of the earliest astronomers was Tycho Brahe (1546-1601), a Danish scientist whose greatest contribution probably lies in his meticulous collection of astronomical data.  Brahe, who lost his nose in a sword fight, was particularly adept at observing Mars. His observations led directly to the creation of the three laws of motion by Issac Newton.  
</p>

<p>
The fundamental science of this case study is based on an understanding of how stars are mapped to the celestial sphere.  Let's look first at how we map geographical locations on our own sphere.  Places on the Earth are placed using latitudes and longitudes.  Latitude lines run north-south, and longitude lines run east-west.  For example, Chapel Hill is located at 37 degrees north latitude, and 78 degrees west longitude.  Latitudes south of the equator are described as "south".  The range for latitudes runs from 90 degrees south (the South Pole) to 90 degrees north (the North Pole).  Longitudes are a little more difficult.  We divide the Earth up by degrees, from 0 to 360 degrees.  We have the somewhat odd notation of 0 to 180 degrees east and 0 to 180 degrees west.  The zero degree point is somewhat arbitrarily set at the Greenwich Observatory in southern England. The important fact to remember about longitudes is that we divide the Earth into 360 degrees.  
</p>

<table>
<tr>
<td valign=top>
In mapping stars, we have a similar system to latitude and longitude.  Latitude is described by the term "declination", and has exactly the same divisions as longitude.  For example, a star might have a declination of +56 degrees, which means it is visible in the Northern Hemisphere. The positive sign means that the star is north of the celestial equator, which is exactly the same as Earth's equator but located in space.  A star with declination of -56 degrees would be visible in the Southern Hemisphere.  Astronomers don't use the north and south descriptors, although that would be pretty accurate.<p>

Longitude is described by a variable known as "right ascension", or "RA".  Instead of dividing the globe up by 360 degrees, we divide the globe into segments of hours based on the amount of time -- 24 hours -- it takes for the Earth to rotate once around its axis.  RA goes from 0 hours to 23 hours, with the zero line being where the Sun crosses the celestial equator on the first day of spring (the "vernal equinox").  <p>

<p>
So, to locate a star, you must know its declination and right ascension.  For example, Polaris, the North Star, has a declination of 89 degrees, 16 minutes and 49 seconds.  Its RA is 2 hours, 35 minutes, and 22 seconds.  The brightest star in the sky, Sirius the Dog star, has a declination of -16 degrees, 43 minutes and 10 seconds, with an RA of 6 hours, 45 minutes and 18 seconds.  These coordinates are the same for any person anywhere on the globe, providing a way for astronomers to talk with each other about the locations of stars.
</p>

<p>
You should study the diagram at the right to ensure you have a good understanding of celestial navigation.  Your understanding of this will be essential in creating this visualization, as you will be working with a lot of dec/RA data.
</p>


</td>
<td valign=top>
<img src="g-RADec.jpg"> 
</td>
</tr>
</table>
<p>
One more bit of scientific knowledge you will need relates to <b>magnitude</b>.  Not all stars have the same brightness in the nighttime sky.  Hipparchus created a system of measuring the brightness of stars using an integer system.  The important thing to know is the brighter the star, the lower the magnitude.  For example, a star of 0 magnitude is about 2.5 times brighter than a star of 1 magnitude.  Stars with a negative magnitude, like Sirius with a magnitude of -1.47, are the brightest stars in the sky. Why do you need to know this?  You may need to <b>filter</b> your starfield datasets by removing those stars that are difficult to see with the naked eye.  In a normal suburban area, it is difficult to see stars with a magnitude higher than 3 or 4.  In remote areas, with young eyes, you might be able to see stars with a magnitude of 6.5 or less.  These stars, by the way, are known as the "bright stars".  There are approximately 9,110 stars of magnitude 6.5 or less.  Information for these stars is located in the "bright star catalog".  The current version is 5, but version 4 is readily accessible via the web.   
</p>

One other piece of background science that you will need to know for this activity.  In astronomy, there are 88 recognized constellations.  We can see approximately 54 of these constellations in the North Hemisphere.  The constellations describe patterns in the nighttime sky.  Some better known constellations include Orion the Hunter, Ursa Major (the Great Bear), and Taurus the Bull.  What about the Big Dipper?  The Big Dipper is not a constellation, it is an <b>asterism</b>.  An asterism is a small cluster of stars that is named. The Big Dipper is an asterism, and is a part of the larger constellation of Ursa Major (the Great Bear).  Many of the commonly recognized patterns in the sky are asterisms.  

<h3>Building the Visualization</h3>
<table>
<tr>
<td valign=top>The ultimate goal of this case study is to create a visualization similar to the one on the right (perhaps without the animation!).   We'll start by building the simpler visualization shown below.  Notice that we have produced a star field mapped over the spherical globe.  We have done this by:<p>
<ol>
	<li>building the globe through the modification of an existing visualization
	<li>locating, downloading, and modifying a large dataset of stars
	<li>plotting those stars mapped to the spherical globe
	<li>creating a dataset containing the asterism known as the "Big Dipper" and plotting that in its correct position on the spherical globe
</ol>

You can click on the image below to see it in its own window.  That's our goal for this visualization!<P>

 <p><a href="sample.jpg"    ><img src="sample.jpg" width=200 height=200></a>
</td>

<td valign=top>

<a href="sphere.gif"><img src="sphere.gif"   width=200 height=200></a><br><center>Click to see larger image</center>

</td>
</tr>
</table>

<h3>Building the Globe</h3>

<p>
The first challenge in building this visualization is in creating the sphere.  We did this by recognizing another visualization created in the "demo" folder in gnuplot.  This file, called <a href="world.html">world.dem</a>, shows three visualizations of a series of points in various locations in the world.  The visualization shows the data ("world.dat") mapped in various ways.  The data set consists of two points: latitude and longitude.  In the visualization, the data is mapped first to a flat coordinate system, then to a spherical coordinate system, and finally to a cylindrical coordinate system.  By looking at the program for the middle visualization, we can learn what gnuplot programming commands are used to create a sphere.  For example, from modifying an existing visualization, we extracted out this set of gnuplot commands to create a spherical visualization.  NOTE TO MATH TEACHERS!  You might be particularly interested in the trignometric calculation used to create the sphere!  Our command set for building the globe looks like this:
</p>


<p>
<blockquote>
<pre>
set title "Star Coordinate Mapping"
set nokey
set ticslevel 0
set nogrid
set noborder
set angles degrees
set mapping spherical
set parametric
set samples 32
set isosamples 9
set urange[-90:90]
set vrange[0:360]
splot cos(u)*cos(v),cos(u)*sin(v), sin(u) with lines 5 2
</pre>
</blockquote>
</p>

<p>
In gnuplot, you should build this visualization in batch mode, so that it will be easy to modify for the later sections of the activity.  Make sure you put apppropriate documentation in your file.  There are also a number of commands in this particular plot file that you have not seen before.  Rather than accepting that these are correct, you should use the "help" command in gnuplot to learn what these commands do.  What happens if you leave one out?
</p>

<h3>Locating star data</h3>

<p>
Locating data is one of the central activities for this case study, and is left primarily as an exercise for the reader.  A strong hint:  make sure you read the last paragraph of the "Background Science" section above!
</p>

Once you find the appropriate dataset of starfield data, you have a fair amount of cleaning up to do!  One suggested procedure is described below:<p>

<ol>
	<li>Open the dataset using Excel.  Experiment with various formats to get the data opened in a neat format.  It is a large dataset, but should open with Excel.
	<li>Save the imported file as a text/tab-delimited file.  You might want to consider saving the file in your gnuplot folder so it is easy to find!
	<li>You now need to identify a variety of columns of data:  the declination, the right ascension, and the magnitude. At the beginning of the dataset, there is some junk data, then you should find your first set of right ascension data, in three columns (hours, minutes, seconds), then the first set of three columns for the declination (degrees, minutes, seconds).  This is the data for the epoch 1900.  We're in Epoch2000, and this represents the RA and declination for the next six columns of data.  You might consider deleting all of the data in the first columns that is not necessary.  Make sure you give your new file a different name before you save!  The next two columns are the galactic latitudes and longitudes, a different mapping system.  We do not need these either and they can be deleted.  The next column is visual magnitude, and we need to keep that data.  You can delete all of the data following the visual magnitude.
	<li>When you save your file, make sure you save it as text/tab-delimited, click on "OK" when it asks you to replace, and click on "Yes" if Excel wants you to accept the formatting changes.  
	<li>What do you have at this point?  In Columns A, B, and C, you should have the coordinates for right ascension.  In Columns D, E, and F, you should have the declination coordinates.  In Column G, you should have the visual magnitude.  If you are behind or confused, you can <a href="bsc4fixed.dat">download the dataset with the good data</a> from the Web.  
	<li>You might now consider inserting a row at the very top for some labels.  In Cell A1, you might put "#RA hours" (without the quotes).  Why the "#"?  That is so when you read the file with gnuplot, it sees the "#" and ignores that line.  In Cell B1, put "RA minutes", and so on.  Your last column should be "Magnitude".
	<li>You might now consider inserting another row after the first row.  In this row, starting with a "#", put "Column 1", etc.  This will help you when it's time to plot the data in gnuplot.  
	<li>Now insert two columns, one after the three RA columns, and one after the three declination columns.  Unfortunately, the RA and dec data needs to be converted to a <b>single number</b>.  How do you do that?  In the new columns, you have to convert minutes and seconds to a fraction.  Take a look at this formula that works for the RA conversion: =(A3+((B3+(C3/60))/60)).  Can you make sense of what is being calculated here?  Make sure you figure this out before you go to the next step!
	<li> You should convert the declination number to a single value just as you did with the RA conversion.  If you are confused about the formula used above, ask a colleague or one of the instructors!
	<li>We have another problem: the RA data is in hours/minutes/seconds as it should be, but since we're going to plot it on a sphere based on longitudes, we need to convert that number to degrees longitude.  Think about the math for a minute:  we have 24 hours that must be converted to 360 degrees.  If you divide 360 by 24, you get 15.  Given that, consider modifying the RA conversion formulat to look like this:  =(A3+((B3+(C3/60))/60))*15.  Again, this is a good time to think about what you are doing and why!
	<li>This next part is <b>OPTIONAL</b>, but recommended!  We're going to do a little computing to allow us to pick stars for plotting that are a specific magnitude.  To do so we need to do a little programming:
			<ol>
				<li>somewhere to the right of the columns of data, set up a cell called "Magnitude".  I put mine in Cell M1.  In Cell M2, I typed the test number, in this case a 4.  I want to plot all stars with a visual magnitude of 4 or less (remember, less is brighter!)
				<li>In the column after Magnitude (Column J if you are following along), I test to see if the magnitude is within the range I desire.  I use a simple IF statement:  =IF(I3<$M$2,1,0).  This says if the magnitude in Cell I3 is less than my test magnitude in Cell M2, then display a 1.  If it is more than the test, print a 0.  Once you create this formula, make sure you do a fill-down!
				<li>In Columns J and K, I'm simply going to multiply the new calculated number in Column I times the number in Columns D and H (respectively).  What does this do?  If the magnitude meets the test (a "1"), then it simply prints the computed RA and declination in Columns J and K (respectively).  If the magnitude doesn't meet the test, a zero gets printed for both RA and declination.  
				<li>Once you have done the fill-downs, test your program by changing the value of the test magnitude in Cell M2.  A high number like 7 should display lots of data, while a low number like 2 should result in a lot of zeroes in Columns J and K.  
				<li>Save your dataset as a text/tab-delimited. 
				<li>If you are behind or confused, you can <a href="bsc4done.xls">download the dataset with the good data</a> from the Web.
			</ol>
	</ol>
			
<h3>Plotting a star field</h3>

<ol>
	<li>You need to ensure that your data file is in the gnuplot folder, along with your gnuplot batch file.  This will make it easier to find and plot.
	<li>Modify your batch file to "splot" both the sphere and the starfield data.  In "splotting" your data, you will need to know which column contains the RA and declination, and then you will need to remember or review the "using" command in gnuplot.
	<li>If you need to look at a sample plot file, <a href="globe.dem">take a look</a>!

</ol>


<h3>Plotting an asterism or a constellation</h3>
	For the final part of this activity, try creating (from scratch) a dataset of some asterism or constellation of your choice.  In the Mars visualization shown at the beginning of this activity, the visualization scientist has plotted all of the constellations of the Zodiac.  These are the 12 constellations that lay along the path of the Sun, the Moon, and the planets (following an imaginary line known as the "ecliptic").
	<ol>
		<li>Find an asterism or constellation of your choice.  
		<li>Determine the right ascension and declination of the stars in that asterism or constellation
		<li>Build your own dataset containing the RA and declination.  Remember to convert the data as you did for the bright star data.
		<li>Visualize the constellation superimposed on the sphere and the starfield by adding to the "splot" command in your gnuplot file.
		<li>Classroom activity:  assign a constellation to a student, have them create a constellation dataset, then plot a star chart.
	
	</ol>

</body>
</html>
