Go to the U of M home page
School of Physics & Astronomy
School of Physics and Astronomy Wiki

User Tools


classes:2008:fall:astro4001.001:graphics

Graphics Tools

This page is to be filled with graphical tools.

I still have to find out how to upload files (programs).

I usually use IDL - Interactive Data Language - to make plots and analyze data. This should be available on the physics computers. You can buy your own student version to use on your private computers, but I think it might be a rather big investment.

ITT send me a link to their online resources with tutorials at http://www.ittvis.com/ProductServices/IDL/IDLTutorials.aspx.

There is only a very limited number of IDL licenses at SDVL/MSI computers. Better use the physics computers.

Getting Started

Edit the output file (we assume a file name output.txt)from EZ so it contains six header lines, followed by the data lines. Make sure that you used ez_example.f as starting point for your program modifications.

To read the data file, use the IDL program readmatrix.pro.

The first parameter gives the name of the matrix, the second the name of the file to load. We use an optional parameter ``o=6`` to skip the first six lines.

IDL> readmatrix,a,'output.txt',o=6

You can now assign the different columns of the array to vectors:

IDL> rho=a[*,1]
IDL> Tc=a[*,2]

We can make a first plot:

lDL> plot,rho,Tc

A Convenient Utility - Demo

At http://webusers.physics.umn.edu/~alex/stellarevolution/AST-4001/EZ you can find a demo IDL program readez.pro that reads in the EZ output without editing (explained on 2008/10/23 in class).

It uses the two demo files form homework problem set 1, 25_02.txt and 25_0001.txt, which are also in this directory. Save all files in a directory, e.g., EZ.

There are several subroutines in readez.pro:

PRO readez,name, $
         rhoc =rhoc , $
         tc   =tc   , $
         pc   =pc   , $
         lum  =lum  , $
         teff =teff , $
         time =time , $
         dt   =dt   , $
         l_he =l_he , $
         reff =reff , $
         mass =mass , $
         m_he =m_he , $
         m_env=m_env, $
         xh1  =xh1  , $
         xhe4 =xhe4 , $
         xc12 =xc12 , $
         xn14 =xn14 , $
         xo16 =xo16 , $
         psic =psic , $
         gamc =gamc

is used to lead the data file. The first parameter gives the name of the file to load, then comes a list of optional keyword parameters that allows to extract the desired values. For example, to load central density and central temperature form the file 25_02.txt and store in variables x and y, use

readez,'25_02.txt',RHOC=x,TC=y

The file readez.pro also contains a routine to make an Hertzprung-Russel-Diagram (HRD)

 PRO hrd,teff,lum, $
      XRANGE=xr, $
      YRANGE=yr, $
      OVERPLOT=over, $
      LINE=line

that takes a parameters effective temperature (in K) and luminosity (in solar luminosities), and optional parameters for the x- and y-ranges to plot, whether to overplot, and what line style to use.

The subroutine

PRO rhoctc,tc,rhoc, $
      XRANGE=xr, $
      YRANGE=yr, $
      OVERPLOT=over, $
      LINE=line

plots central temperature and density (first two parameters, in cgs units), and the same optional parameters.

There are also two subroutines,

PRO plot2hrd

and

PRO plot2rhoctc

that demonstrate how to plot multiple tracks in one figure. Inside these programs, the path (dir0) and file list (files) needs to be adjusted accordingly. For example, to load files from the local directory, just set the path to an empty string

dir0=''

Enjoy!

classes/2008/fall/astro4001.001/graphics.txt · Last modified: 2008/10/23 11:48 by heger