Monday, March 09, 2009

supermongo script.

http://www.dur.ac.uk/physics.astrolab/sm.html
-----------------------------------------------------------------------------------------
crontab example:

33 16 9 3 * /data/lgou/LMCX-1/rxte/DataAnalysis/exampl_sm/script 0 gou.ps examp /data/lgou/LMCX-1/rxte/DataAnalysis/exampl_sm >& /dev/null
-------------------------------------------------------------------------------------------
csh script file which call for supermongo:

#! /bin/csh
#
# specify time on screen, select models, the script filename, and the working directory.
set wait = $1
set psfile = $2
set script_name=$3
set work_dir=$4


########################################################################
# Start SM
#

cd $work_dir
echo $work_dir
sm -S << FIN
define wait $wait

# do not alter the code above this line

# The following line outputs checks if the user has enetered a 'wait' time >1
# if the 'wait' time from the command line is 0, then the output is sent to a file
#
# to output to gif rather than postscript, uncomment the second line and
# comment out the first line
if (\$wait) {device x11} else {device postencap $psfile} # output to .ps
# if (\$wait) {device x11} else {device gif $psfile} # output to .gif
echo $psfile

# Type your sm commands here. An example is provided

inp $script_name

# do not alter below this line

!sleep \$wait
FIN

exit
---------------------------------------------------------------------------------------------------
sm script file:


#device postencap myfile.ps
set x = 1, 1000, 1
set y = (x**2.5 * lg(x)) + 1.

window 2 1 1 1 # define a window which is 2 in x, 1 in y
# and plot current data into bottom left window
ticksize 0 0 0 0

ctype black
expand 1.0
ptype 10 3 # use an open polygon with 10 sides
lweight 1.
limits x y
box 1 1 1 0 # label all of the axis except the RHS y-axis

expand 0.5 # make the points half the size
points x y # draw the points in x and y
expand 1.0 # set the rest of the plot back to normal size

relocate 50 8.5e7
label This is a more complex plot
ltype 4
relocate 50 8.2e7
draw 800 8.2e7

expand 1.3 # label the x and y axis
xlabel x-axis
ylabel y-axis
expand 1.0

# now make same plot, but in log scale in y
window 2 1 2 1 # now change windows and make a different plot
ticksize 0 0 -1 0 # plot the y-axis in log scale

set z = lg(y) # take the log of y
limits x z # reset the limits for the new data
box 1 0 1 1
ptype 4 3
ctype blue
points x z

ctype black
expand 0.8
xlabel x-axis

No comments: