PHYCS 3730/6720 Lab Exercise

Reading and references: Answer file Mylab04.txt.

Exercise 1. Scatter plots

Exercise and data courtesy Benjamin Bromley.

A file ~p6720/examples/lcrs/lcrs.e_gax contains a list of galaxy data (v_r [km/s], theta [radians], phi [radians], Mag [absolute magnitude in broad-band red light]) from the Las Campanas Redshift Survey. As in Assignment 1, Ex. 3, treat the recession velocity v_r as a radial coordinate, so that (v_r, theta, phi) are standard spherical polar coordinates.

Use gnuplot to make a 2-D map of the galaxies in space, with each galaxy represented by a single dot. Tip: in the file name gnuplot doesn't understand the tilde abbreviation ~, so to read the file, you'll need to spell it out like this: /u/course/p6720/examples/lcrs/lcrs.e_gax. The galaxies all lie in a "survey volume" that is roughly shaped like two curved pizza slices with their pointed-ends touching at the origin. Make a plot with the x and y values as follows:

x = v_r*cos(phi)*sin(theta) and y = v_r*sin(phi)*sin(theta);
This transformation converts the data from spherical polar coordinates to rectangular coordinates and projects onto the x-y plane. Label both the axes of the map in these new coordinates to say "km/s". [Hint: see the "set xlabel" command.] Choose the point size to be 0.05 so you can see the detail in the scatter plot. Then set up gnuplot so that it writes your plot to a postscript file called gax.ps. Finally, put all the relevant gnuplot commands into a text file called gax.gpl (you can use emacs or gnuplot's save utility). The objective is to be able to create the postscript file with the single command gnuplot gax.gpl. There is no need to copy the data file to your accounts; use the absolute path given above to reference the file.

In your answer file, give a copy of only your gpl source file, gax.gpl.


Exercise 2. Histograms

Generate a histogram for a Gaussian normal distribution using the course random deviate utility normdist and the histogramming course utility hist. Generate a distribution with mean 5 and standard deviation 1. Do this with 1000 random points using random number seed 373.

To generate the random numbers, just type normdist. You will be prompted for the mean, st dev, number of values, and seed. To generate the histogram with hist, you should pipe the output from normdist into hist. Use the -g option to generate a file suitable for input to gnuplot.

In your answer file, give the Unix command and any gnuplot commands for generating the file to be plotted.

Then plot the file. Generate a Postscript output file and display it with gv. (Don't hand in this file.)