Computer Basics for BGSU Image Analysis: SuperMongo

Contents: Basics || Example || Files & Printing ||

I. Basic Operations:

Here is how to operate the plotting program SuperMongo (aka SM):

The file "sm.sample" (in your home directory) is an example of a SM macro -- a file with a list of SM commands that together produce your plot. You would load any macro by typing its filename in at the ":" prompt -- for example:

: macro read sm.sample

The first line of the macro contains a word (in this case, plt), which macro uses like a verb. If you type that word at the : plot, it runs that macro. For example:

: plt

SM responds by drawing the plot in the large window.

You can enter other macros and make other plots (you may need to type the command "erase" between plots to clear the plotting window). When you are done, type "quit" and the two SM windows will disappear.


II. Understanding the Innerds:

For a quick discussion of the the contents of a simple plotting macro called "sm.sample", page the file from Unix:

% more sm.sample

plt erase [this line defines the command to run the macro, "plt", and erases any pre-existing plot]

# read in data from file "rrl_xy.m5", lines 5 through 1000, format. [example of a comment line]
data rrl_xy.m5 [we will read data from a file named "rrl_xy.m5", which looks like this]
lines 5 1000
[we will read data from lines 5 through 1000 (ie, the end) of that file]
read {id 1 x 2 y 3 sm1 4 sm2 5 }
[the contents of column #1 will be read into a variable named "id", col#2 = "x", col#3 = "y", etc.]

# create a plotting window on the 32,000 x 32,000 field
location 4000 31000 4000 31000
[our "box" will go from X=4000 to X=31000 and same forY, in "screen units", which range from 0 at left/bottom to 32,000 at right/top ]
limits -450 450 -450 450
[the box will have "user units" going from X=-450 to 450 (and same for Y) -- these are positions in arcsec]
ticksize 50 200 50 200
[small ticks every 50 arcsec, large tick w/ number every 200 arcsec; note the pattern: Xlo Xhi Ylo Yhi]]
expand 1.6
[expand numbers, symbols, legends, etc. to be 1.6 times larger than default size]
box 1 1
[draw the box on the graph, "1 1" means put numbers on X and Y axis, "0 1" would be numbers on Y axis but not X]
ptype sm1
[ptype defines the symbol used when plotting points -- here we take it from the variable "sm1" so the symbol is defined in the data file]
points x y
[plot the points using values from the variable "x" for the X-axis, and from the variable "y" for the Y-axis]

# put axis labels etc on plot
angle 90
[rotate the cursor by 90 degrees, so the following is tilted along the Y-axis]
relocate (2000 18000)
[move the cursor to screen units X=2000, Y=18000, mid-way along the Y-axis]
putlabel 5 "Y [arcsec]"
[write "Y [arcsec]" at that cursor location]
angle 0
[rotate the cursor back to 0 degrees = vertical]
xlabel "X [arcsec]"
[use the xlabel command to write "X [arcsec]" along the X-axis ("ylabel" exists but doesn't always work right)]
relocate (18000 32000)
[move the cursor to screen units mid-way along the top of the plot, for a title]
putlabel 4 "M5 Variable Stars (SH73)"
[write a title at that cursor location]


SM gives you lots of control over the appearance of your plot.:

Different point symbols are defined by "ptype", which can be a variable read from a data file as in the example above (in which case it takes the form of a two-digit integer like "41" or "90"), or it can be defined in the macro (in which case the two digits are separated by a space):

ptype 4 1

The first digit of this code refers to the number of "vertices" on the symbol, and secdond digit refers to the "style." Popular compinations are:

style 3 vertices 4 vertices 5 vertices 6 vertices 19 vertices
0 = open 30 = open triangle 40 = open square 50 = open pentagon 60 = open hexagon 190 = open circle

1 = stick

31 = 3-cross 41 = X (cross) 51 = 5-cross 61 = * (asterisk) 191 = blob
2 = skeletal 32 = triskelion 42 = 4-pt star 52 = 5-pt star 62 = 6-pt star 192 = blob**2
3 = solid 33 = solid triangle 43 = solid square 53 = solid pentagon 63 = solid hexagon 193 = solid circle

You can connect (X,Y) points (rather than placing symbols at them) using "connect" rather than "points":

connect x y

Change the type of line (solid, dashed, dotted, etc.) by changing "ltype" (default = 0 = solid line):

ltype 2 [experiment to see options]

You can add colors to the box/text/symbols/lines using "ctype":

ctype green [options: black, white, yellow, blue, red, cyan, magenta]

You can do math on the variables you have read in. For example, in sm.sample, you read in the variables x and y. We can create new variables via mathematical combinations using the "set" command, such as:

set newx = x + 50 [create a new variable named "newx"; each value in the list is 50 larger than its original value]
set xy = x * y [use / to divide]
set rad = sqrt( (x-512)**2 + (y-512)**2 )
[sqrt(a) takes the square root of a]

There are MANY other commands and macros to help you control the look of your plot -- explore and learn. The official SM website has the manual and a tutorial, and there are other sites on the web (search away).


III. Files and Printing:

Plotting the graph on your computer screen is dandy (I'll often keep an emacs file of the SM macro open and iteratively edit & plot till I achieve the look I seek), but when the file is perfect, you will want to export it so others can share the beauty. Two options exist: create a file (generally an encapsulated postscript file, .eps) or send it to the printer.

1) To make a file named "myplot.eps", do the following in the SM command window:

: dev postencap myplot.eps [change the plotting device to be an encapsulated postscript file]
: plt [run the macro, in this case "plt"]
: dev x11 [return the plotting device to the screen and create the file in your current directory]

You can view an .eps plot with ghostview, or send it to a printer from Unix:

% ghostview myplot.eps
% lpr -Ppr3 myplot.eps [send it to the printer named "pr3"]

2) To print the plot on the default printer :

: dev postscript [change the plotting device to be the default printer]
: plt [run the macro, in this case "plt"]
: dev x11 [return the plotting device to the screen and flush the plot to the printer]

Andy Layden, 2007 May 31

PS. Contents of the data file "rrl_xy.m5":

NGC 5904 (Messier 5) 
   R.A. 15 16.0, Dec +02 16' 
   No. x" y" SM SM <Mag> Ampl Epoch Period Remarks
   1 27.7 161.1 93 90 15.18 1.03 13715.588 0.521786500 + 
   2 -343.5 -31.5 93 90 14.87 1.40 39256.416 0.526267900 Bl 
   3 160.1 113.7 93 90 15.04 0.85 36762.676 0.600188800 + 
   4 -12.3 73.8 93 90 15.27 1.24 27627.708 0.449640200 
   5 -7.8 51.6 93 90 15.45 1.23 27567.929 0.545903000 

... etc, many more lines, ending with ...

 128 0.0 0.0 90 90 0.00 0.00 0.000 0.304400000RRc 
 129 0.0 0.0 90 90 0.00 0.00 0.000 0.306000000RRc