IPP_Description: ex_cmd.dsc

File ex_cmd.dsc, 1.5 KB (added by pitts, 8 years ago)

Example DVO script for making a color-magnitude diagram

Line 
1# This is an example DVO script that shows how to make a simple color-magnitude
2#  diagram in DVO. This macro is designed to accept 5 arguements (color, magnitude,
3#  errors, and an output file name) and outputs a CMD plot.
4
5macro ex_cmd
6
7 # Display how the script is used when the macro is run without arguements
8 #  (or with an incorrect number of arguements). The macro call itself always
9 #  counts as the first arguement.
10 if ($0 != 6)
11  echo "USAGE: ex_cmd (color vector) (magnitude vector) (color error) (magnitude error) (output file)"
12  break
13 end
14 # The names of the vector arguments are stored as variable values: $1 - $4
15
16 # New vectors are created using the arguments to avoid confusion with variables
17 set col = $1
18 set mag = $2
19 set colerr = $3
20 set magerr = $4
21
22 # Check to make sure the vectors are of similar size
23 $len_check = (col[] != mag[]) || (col[] != colerr[]) || (col[] != magerr[])
24 if ($len_check)
25  echo "ERROR!: vectors not of same length"
26  break
27 end
28
29 # Create plot window
30 device -n cmd
31 # Size the window
32 resize 800 800
33 # Create plot labels with the font set to 14-point helvetica
34 labels -fn helvetica 14 -x "$1" -y "$2" +x "Color-Magnitude Diagram"
35 # Draw the plot box with line thinckness 2
36 box -lw 2
37 # Plot the data with error bars as blue points (with cross shapes) of size 1
38 plot -x 2 -c blue -pt 2 -sz 1 col mag -dx colerr -dy magerr
39
40 # Save plot to a postscript file
41 ps -name $5
42 echo "Plot output to file: $5"
43 echo "END EX_CMD"
44
45end