<- Back to Main
Assignment 07 - DUE Friday, May 9th
Reading Assignment:
Stellar Magnitudes
Wikipedia: HR Diagram
Introduction
The following assignment was given in a previous IDL DeCal class taught by James McBride,
In this assignment, we'll be plotting a Hertzsprung-Russel (HR) Diagram. HR diagrams show the stellar main-sequence, in which brighter stars appear bluer and dimmer stars appear redder. Read the reading assigment if you would like more background information. The "main-sequence" stars appear as a wavy diagnal line with a blob of red giants above and white dwarfs below.
The first part is fairly straight forward, Optionally you can also plot the points using different colors as shown in the figure below. Using colors for your diagram is optional, but if you want some idea of how color tables work, try it out!
The Assignment:
1) Downloading a Stellar Catalogue
-Go to this website: http://webviz.u-strasbg.fr/viz-bin/VizieR
-Type "hipparcos" into the first box and click "find catalogue".
-On the next page, click the first option, "The Hipparcos Main Catalogue".
-For "Max Entries per Table", select "9999", and for "Output Layout", select "|-separated-Values". (| is a pipe.)
-Then scroll down and uncheck all of the "Show" boxes under "Query by Constraints applied on Columns", EXCEPT for "Vmag", "Plx", and "B-V".
-Now click "submit query", and save to disk. (the file will down load to your desktop. move it to where you will be running IDL for this problem.)
2) Sort the Data
-Now open an idl session or Emacs file to begin typing code,
-type "template=ascii_template('asu3.tsv')" to open a widget progam.
(asu.tsv is the file you saved in the beginning.)
-For "Data starts at line:" type 30. Scroll down in the lower box and keep note of what it says in Line 24. This tells us which column is which. Then click next.
-For "Delimeter Between Elements:" click "Other" and type "|", which is a Pipe, not an L or a 1. Then click Next.
-Now, in the first box, change "Field1", "Field2" ... etc to descriptive column names which you made note of from Line 24.
-Now click finish!
3) Extract the Data
-Back in IDL type, "star_struc=read_ascii('asu.tsv',template=template)". This gives you a structure with each field being the data column you named in the last step.
-do a help with a "/str" on the structure to see what the field names are.
-extract each of the fields into separate variables, just like we did in the Galaxy catalog assignment.
-The PLX column gives you a measure of each star's parallax in mili-arcseconds. Convert it to arcseconds.
-use the equation "distance equals 1 over parallax" to get distances for each star in parsecs.
-Now convert the V column, (which is each star's visual magnitude), to Absolute magnitude, using the equation, V = v - 5 * log(distance) + 5
-Now plot the Absolute Visual magnitude versus the color (B-V) column. This should look somthing like the figure above.
You may need to flip the graph. So that larger magnitudes appear on the bottom of the graph. To do this, multiply your V array by -1, and then plot your graph with the following keyword: "ytick_get=ytick". This extracts the tick values.
Now re-plot your graph using the keyword, "ytickname=(-1)*strcompress(fix(ytick),/remo)". This makes the ticknames negative, and thus, flips your graph.
4) To Turn In
-Make a PostScript file of your plot with proper axes, and upload it to your home page.
5) Colors!
-First plot the graph in white so we have something to over plot the color onto.
-Now initialize 256 element color tables in the IDL session by typing, "device,decomp=0". Then load a colortable using "loadct,6". I used 6 because it runs from red to blue, but there are 40 colortables to choose from.
-Now create an array of numbers that will correspond to the color number we're plotting in. I used "colorarr=findgen(255)/255.*200.".
-We also need to scale the colortable to the B-V values we will be plotting:
colormm=minmax(color)
range=colormm[1]-colormm[0]
slope=(range/255.)
-Now write a FOR loop to oplot the star points which fall onto each of the 255 sections of the plot. In other words, we're dividing up our B-V graph into 255 sections, and using OPLOT to display each section in a different color using the "color=number" keyword, where number ranges from 0 to 255.
-If you can't figure out how to write this loop, scroll down to the bottom of this page for the code I used.
-I couldn't get PSOPEN to work with the LOADCT color table, so instead of using a Postscript file, make a PNG file instead. Just plot your image to the screen as usual, then call a program I wrote called WINDOW_CAPTURE.
IDL> window_capture,/png,file='hr_diagram'
This will save a PNG image of what ever was in your plot window. Upload the PNG to your BIO page.
You can get the program here: WINDOW_CAPTURE
HINTS:
1) If you need help, come ask me questions in 705 Campbell!
2) The Color Plotting Code: colorloop.txt
Update: Paul Higgins - April 9, 2008 - UG Astro, Department of Astronomy, University of California at Berkeley