@sp 1 @center file @file{cover} in directory @file{macro} @example @findex cover, draw the cover cover # draw the cover @end example @sp 1 @center file @file{default} in directory @file{macro} @example @findex batch, run the history buffer batch ## run the history buffer, but don't delete from history list @findex bell, ring bell bell ## ring terminal bell @findex calc, evaluate an expression calc ## evaluate an expression @findex cd, change directories cd ## change directories @findex compatible, macros compatible with Mongo compatible ## define macros to be compatible with Mongo @findex declare, declare a vector $1 declare ## declare a vector $1: declare name size @findex del, delete last command del ## delete last command from history list @findex del1, don't save on history del1 ## don't put command on history list @findex echo, write to terminal echo ## write to terminal @findex ed, edit a macro ed ## edit a macro, or the previous one if no argument @findex edit_all, edit history buffer edit_all ## edit history buffer @findex emacs_all, edit history w. system editor. emacs_all ## edit the history list using an external editor. emacs_hist ## edit the history list using an external editor. @findex error_handler, Handle interrupts error_handler ## Handle @ctrl{C} interrupts @findex execute, read and execute commands execute # read and execute an SM file of commands (1 per line) @findex extend_history, Extend history buffer extend_history # Extend history buffer to be of size $1 @findex for, C's for(;;) (see also while) for ## Repeat a macro while a condition is true, like C's for(;;). See also while @findex gripe, complain to Robert gripe ## complain to Robert (Unix only) h ## get help @findex head, print the top of a file head ## print the top of the current data (or other) file @findex hm, help with edited macro hm ## help with the last macro edited @findex hv, help with variable hv ## help with variable @findex insert, insert text after line insert ## insert text after line $1 @findex load, load macros load ## load macros in default directory @findex load2, load user macros load2 ## load macros in (second) default directory @findex ls, list macros ls ## list macros @findex lsm, list macros in a default file lsm ## list macros in a file in default macro directory @findex lsv, list variables lsv ## list variables @findex q, check, then quit q ## check, then quit re ## macro read @findex reset_ctype, Reset the default ctypes reset_ctype # Reset the default ctypes (except "default") @findex sav, save to a file $1 sav ## save to a file $1, don't save from files `$mfiles' @findex show, show current values show ## show current values of various things @findex startup, startup macro startup ## macro invoked upon startup @findex undef, undefine a variable undef ## undefine a variable @findex undo, erase lines undo ## undo [macro] : undo (i.e. erase lines drawn by) macro $1 @findex unload, forget macros unload ## forget macros from a file @findex unset, delete a vector unset # delete a vector v ## set verbosity wr ## macro write @end example @sp 1 @center file @file{demos} in directory @file{macro} @example square # sum the Fourier series for a square wave, using $1 terms colours # draw a circle in a number of colours until ^C stops it crings # draw a set of coloured circles @findex ctype, example of setting 256 colours crings2 # draw a set of coloured circles using 256 shades of yellow @findex gauss_convolve, convolve 2 Gaussians gauss_convolve # convolve 2 Gaussians with sigmas $1 and $2 @findex grey_sincos, draw a grey scale image grey_sincos # draw a grey scale image of a sin(x)cos(y) surface scribble # use cursor to draw a line, and then shade the interior shading # draw an ammonite @findex sundial, draw a sundial sundial # draw a sundial, allowing for the analemma @end example @sp 1 @center file @file{fonts} in directory @file{macro} @example @findex fonts, draw the font table fonts # draw the font table @findex TeX_defs, draw ``TeX'' defs TeX_defs # draw the ``TeX'' definitions @findex make_char, help create new char make_char # help create a new character @end example @sp 1 @center file @file{fourier} in directory @file{macro} @example # # Macros to make dealing with complex numbers for FFT's easier # Assumes that complex vector `name' is represented by two vectors # called name_r and name_i # @findex fft, see macro file fourier fft # Direct FFT: fft name name ifft # Inverse FFT: ifft name name cadd # Add complex numbers: $1 = $2 + $3 cdiv # Divide complex numbers: $1 = $2/$3 cmod # Modulus: $1 = |$2| cmult # Multiply complex numbers: $1 = $2*$3 csub # Subtract complex numbers: $1 = $2 - $3 imag # Imaginary part: $1 = Im($2) real # Real part: $1 = Re($2) vcentre # shift a vector so that its 0th element appears in the middle vcenter # an alias for vcentre @end example @sp 1 @center file @file{images} in directory @file{macro} @example @findex entropy, find entropy of an image entropy # Find entropy of an image @findex hist_equalise, histogram equalise an image hist_equalise # Histogram equalise an image @findex gamma, gamma correct an image gamma # Gamma correct an image @end example @sp 1 @center file @file{irregular} in directory @file{macro} These macros were written by Gabor Toth, to whom many thanks. They enable you to define an SM IMAGE from 3 vectors, (x,y) and the value z @example @findex irregular_image, Set IMAGE from x,y and z irregular_image # Set IMAGE from 3 vectors (x,y) and z @findex trigrid, Interpolate to the regular grid trigrid # Interpolate to the regular grid @findex trigridtry, Demonstrate the use of trigrid trigridtry # Demonstrate the use of trigrid @end example @sp 1 @center file @file{math} in directory @file{macro} @example # # Written by Daniel Pfenniger (PFENNIGER@@obs.unige.ch) # `A&S' is Abramowitz & Stegun # @findex J0, Bessel function J0 # Bessel func. J0(|x|), A&S, 9.4.1,.3 @findex Y0, Bessel function Y0 # Bessel func. Y0(|x|), |x|>0, A&S, 9.4.2-3 @findex J1, Bessel function J1 # Bessel func. J1(|x|), A&S, 9.4.4,.6 @findex Y1, Bessel function Y1 # Bessel func. Y1(|x|), |x|>0, A&S, 9.4.5-6 @findex I0, Modified Bessel function I0 # Modified Bessel func. I0(|x|), A&S, 9.8.1-2 @findex I1, Modified Bessel function I1 # Modified Bessel func. I1(|x|), A&S, 9.8.3-4 @findex K0, Modified Bessel function K0 # Modified Bessel func. K0(|x|), |x|>0, A&S, 9.8.5-6 @findex K1, Modified Bessel function K1 # Modified Bessel func. K1(|x|), |x|>0, A&S, 9.8.7-8 @findex K, Complete elliptic integral K # Complete elliptic integral K(m), 0<=m<1, A&S 17.3.34 @findex E, Complete elliptic integral E # Complete elliptic integral E(m), 0<=m<=1, A&S 17.3.36 @findex fresnel, Fresnel integrals fresnel # Calculate the Fresnel integrals C, S, and F @end example @sp 1 @center file @file{matrix} in directory @file{macro} @example @findex matrix, Introduction to matrix utilities matrix # Introduction to matrix utilities @findex mdeclare, declare a square matrix mdeclare # declare $1 to be a $2x$2 square matrix @findex mdimen, print a matrix's dimension mdimen # print matrix $1's dimension @findex mprint, print a matrix mprint # print the matrix $1 (given as $1_0 $1_1 etc -- see minv) @findex madd, add matrices madd # set matrix $1 equal to $2+$3 @findex minv, invert a matrix minv # Quick matrix inversion, done in place. @findex mset, set a matrix equal to another mset # set matrix $1 equal to $2 @findex mmult, multiply a matrix by a matrix mmult # set matrix $1 equal to $2*$3 @findex mmult_c, multiply a matrix by a constant mmult_c # set matrix $1 equal to $2*$3 where $3 is a scalar @findex mmult_v, multiply a matrix by a vector mmult_v # set vector $1 equal to $2*$3 where $3 is a vector @findex mmult_vT, multiply vector^T by a matrix mmult_vT # set vector $1 equal to $2^T*$3 where $2 is a vector @findex mtrans, transpose a matrix mtrans # set matrix $1 equal to $2^T @findex vprint, print a vector (like mprint) mprint # print the vector $1 @end example @sp 1 @center file @file{mongo} in directory @file{macro} (omitting those that are simply abbreviations, like @code{ang}) @example @findex da, set data file da ## set data file @findex dev, set device dev ## set device dra ## draw, accepting expressions @findex ecolumn, make error_col error vector ecolumn ## define vector error_col as error vector @findex end, quit end ## quit, not on history @findex era, erase screen era ## erase screen, not on history @findex lis, list history lis ## list history, not on history hard ## make a hardcopy of what you type (or get by history) @findex hardcopy, close old device hardcopy ## close the old device and set dev type to 0 @findex hcopy, hardcopy of playback buffer hcopy ## hcopy [printer] [l1] [l2]: Make hardcopy of playback buffer @findex hmacro, hardcopy of macro hmacro ## hmacro [macro] [printer]: make hardcopy of `macro' on `printer' @findex identification, write id to plot identification ## write an id to the top right hand corner of screen @findex input, execute an Mongo file input ## execute an Mongo file @findex mongo, make SM resemble Mongo mongo # make SM resemble Mongo as closely as possible pcolumn ## set point column (Mongo) playback ## define "all" from buffer, and run it @findex read_all, read file including history read_all ## read a macro file, putting `all' onto the history buffer @findex read_hist, read history from file read_hist ## read history from a file @findex read_old, read an Mongo file read_old ## read an Mongo file onto the history buffer rel ## relocate, accepting expressions @findex save_all, write history to file save_all ## write the playback list to a file (use sav instead) terminal ## device @findex toplabel, put label at top of plot toplabel ## put label at top of plot @findex xcolumn, read a column into x xcolumn ## read a column into vector x (Mongo) @findex xlogarithm, take log of x xlogarithm ## take log of vector x (Mongo) @findex ycolumn, read a column into y ycolumn ## read a column into y @findex ylogarithm, take log of vector y ylogarithm ## take log of y @end example @sp 1 @center file @file{project} in directory @file{macro} Miscellaneous projections (e.g. equal area). Contributed by Michael Strauss. @example @findex aitoff, convert l,b to Aitoff x,y aitoff #convert l and b to x y in Aitoff coordinates @findex aitoff1, convert l,b to reverse Aitoff x,y aitoff1 # Convert l and b to x y in reverse Aitoff coordinates @findex aitoffdec, Draw line of constant dec aitoffdec # Draw a line of constant declination in an Aitoff plot @findex aitoffdec1, draw line of constant dec aitoffdec1 # Draw a line of constant declination in a reverse Aitoff plot @findex aitoffgrid, Aitoff equal area grid aitoffgrid # Put up equal area grid in Aitoff @findex aitoffgrid1, rev. Aitoff equal area grid aitoffgrid1 # Puts up equal area grid in Aitoff. Reverse sense @findex calc_lb, find r, l, b given x, y, z calc_lb # Calculates r, l and b given x, y, and z @findex circle_exclude, draw excluded regions circle_exclude # After circleplot, draws regions excluded in latitude @findex circlelabel, Draw axes for a circleplot circlelabel # Draw axes for a redshift circleplot @findex circleplot, redshift points in circleplot circleplot # Plot redshift points; requires circlelabel @findex eqgal, convert (ra, dec) to (l,b). eqgal # Usage: ra dec l b; Convert (ra, dec) to (l,b). @findex galeq, Convert (l,b) to (ra, dec) galeq # Usage: galeq l b ra dec. Convert (l,b) to (ra, dec) @findex galgrid, Puts up equal area grid galgrid # Puts up equal area grid @findex galplot, Usage: galplot ra dec l b galplot # Usage: galplot ra dec l b @findex galpoints, points on an equal area grid galpoints # Plot points on an equal area grid; galpoints l b @findex gstrans, supergalactic to galactic coords gstrans # Convert supergalactic to galactic coordinates @findex hemiconvert, l b to x y for hemisphere hemiconvert # Convert from l b to x y for hemisphere plotting @findex hemidec, line of dec on hemispheres hemidec # Draw a line of constant declination on a pair of @findex hemiplot, equal area plot, two hemispheres hemiplot # Sky plot in two hemispheres, equal area @findex invaitoff, convert Aitoff x, y to l, b invaitoff # Convert x y in Aitoff coordinates to l, b @findex pielabel, Draw axes for a redshift pieplot pielabel # Draw axes for a redshift pieplot @findex pieplot, Plot redshifts in pieplot pieplot # Plot redshift points; requires pielabel @findex radtick, put tick marks on a radial axis radtick # Put tick marks on a radial axis @findex sgtrans, galactic to supergalactic coords sgtrans # Convert galactic to supergalactic coordinates @end example @sp 1 @center file @file{stats} in directory @file{macro} @example @findex cgauss, cumulated Gaussian cgauss # evaluate a cumulated Gaussian distribution : N($mean,$sig) @findex cuniform, cumulated uniform distribution cuniform # evaluate a cumulated uniform distribution, $mean,$sig @findex chisq, return chi^2 distribution of vector chisq # Return chi^2 distribution of vector $1 with $2 dof @findex draw_KS, Draw a cumulated curve draw_KS # Draw a cumulated curve, for looking at KS statistics @findex erfc, calculate erfc erfc # calculate complementary error function erfc($1) @findex factorial, calculate a factorial factorial # Use Stirling's formula to calculate a factorial ($1)! @findex gauss, evaluate Gaussian gauss # evaluate a Gaussian : N($mean,$sig) @findex gaussdev, make N(0,1) variate gaussdev # return a N(0,1) random vector @findex linfit, least squares fit for n parameters linfit # linear least squares fit for any number of parameters @findex log_fac, calculate a log factorial log_fac # Use Stirling's formula to calculate a log factorial. @findex lsq, least squares fit lsq # do a least squares fit to a set of vectors @findex lsq2, least squares fit lsq2 # do a least squares fit to a set of vectors, errors in x and y @findex prob_chisq, probabilities for chi^2 prob_chisq # probability of getting a given value of chi^2 @findex prob_KS, probabilities for K-S prob_KS # probability of getting a given value of the K-S statistic @findex prob_wilc, probability for Wilcoxon prob_wilc # return probability in $$2 that x exceeds $1 from Wilcoxon @findex rxy, Pearson Correlation Coefficient rxy # find Pearson Correlation Coefficient for two vectors @findex smirnov1, 1 sided K-S statistic smirnov1 # calculate 1 sided Kolmogorov-Smirnov statistic for vector @findex smirnov2, 2 sided K-S statistic smirnov2 # calculate 2 sided Kolmogorov-Smirnov statistic for vectors @findex spear, Spearman correlation coefficient spear # calculate Spearman rank correlation coefficient for 2 vectors @findex stats, calculate mean sigma ... stats # stats vector mean sigma kurtosis : calculate $mean $sigma etc @findex find mean sigma ... stats2 # stats vector weights mean sigma kurtosis @findex stats_med, find median SIQR stats_med # stats_med vector median SIQR : calc $median $SIQR from vector @findex wilcoxon, Wilcoxon statistic wilcoxon # calculate Wilcoxon statistic for 2 vectors @findex wlsq, weighted least squares wlsq # do a weighted least squares fit to a set of vectors @end example @sp 1 @center file @file{trigd} in directory @file{macro} Equivalents for all SM trig functions, taking degree arguments. Names add an extra `d' (e.g. sind) @sp 1 @center file @file{utils} in directory @file{macro} @example alpha_poi # alpha_poi x y z. Like poi x y, but use z as labels for points @findex arc, arclength along curve arc # the arclength along the curve ($1,$2), e.g. set v=arc(x,y) @findex arrow, draw arrow with cursor arrow # use the cursor to define an arrow. @findex barhist, draw bar histogram barhist # draw a bar histogram @findex boxit, draw box with cursor boxit # use the cursor to define a box, and draw it @findex circle, draw a circle circle # draw a circle, centre ($1,$2) radius $3 @findex cumulate, find cumulative distribution cumulate # find the cumulative distribution of $1 in $2 @findex draw_arrow, draw an arrow draw_arrow # draw an arrow from ($1,$2) to ($3,$4) @findex draw_box, draw a box draw_box # draw a box, defined by two corners @findex error_x, draw x-error bars error_x # draw x-error bars: error x y size @findex error_y, draw y-error bars error_y # draw y-error bars: error x y size get_hist # get_hist input output-x output-y base top width @findex gauss, evaluate a Gaussian gauss # evaluate a Gaussian : N($mean,$sig) @findex get, Read column from file get # syntax: get i j. Read a column from a file @findex glevels, Set grey levels glevels # Set grey levels. Usage: glevels expr @findex greyscale, Draw grey-scale image. greyscale # Draw a grey-scale image. # Usage: greyscale [npx npy maxweight dmargin] @findex info, help from info info # Get help about a command from SM's info files @findex interp, linearily interpolate interp # Linearily interpolate $3 into ($1,$2), giving $4 @findex interp2, linearily interpolate interp2 # Linearily interpolate $3 into ($1,$2), giving $4 @findex is_file, does file exist? is_file # Return true if file $1 exists @findex is_macro, is a name a macro? is_macro # Return true if $1 is a macro @findex is_set, is a bit set? is_set # define variable $$1 if the $3'rd bit is set in $2 @findex is_vector, is a name a vector? is_vector # Return true if $1 is a vector @findex logerr, logarithmic error bars logerr # syntax: logerr x y error, where y is logged, and error isn't @findex mconcat, Concatenate 2 macros mconcat # Concatenate 2 macros, optionally renaming result @findex number, convert strings to numbers number # convert a string vector to an arithmetic one @findex pairs, connect (x1,y1) to (x2,y2) pairs # pairs x1 y1 x2 y2. connect (x1,y1) to (x2,y2) @findex polar, draw `axis' for polar coords polar # draw a circle as an `axis' for polar coordinates @findex pmatrix, print the matrix $1 pmatrix # print the matrix $1 @findex puts, Draw a line of text puts # Draw a line of text, then move to the start of the next line @findex qminv, Quick matrix inversion qminv # Quick matrix inversion, done in place @findex repeated, find repeated elements repeated # Return an array that is true for repeated elements in $1 @findex reverse, reverse a vector reverse # reverse the order of a vector @findex save_vec, save a vector on history save_vec # put the definition of a vector onto the history list @findex set_window, cycle through all WINDOWs set_window # cycle through all available windows @findex shade_box, shade a box shade_box # shade a box, spacing $1, defined by two corners shed # shade region between x y and x2 y2 with n lines @findex simp, Simpson integration simp # Simpson's rule integration: simp answer x y @findex smooth, boxcar smooth smooth # boxcar smooth a vector @findex smooth2, smooth a vector smooth2 # smooth a vector with a given filter @findex smooth3, smooth a vector (omitting points) smooth3 # smooth a vector with a given filter omitting points @findex 2dhistogram, 2-d histogram from image 2dhistogram # convert the current image to a 2-d histogram @findex thin, make sparse version of a vector thin # create a "thinned" version of a vector for plotting points @findex thin2, "thin" the end of a vector thin2 # "thin" the end of a vector @findex thin3, "thin" central portion of a vector thin3 # "thin" the central portion of a vector @findex uniq, remove duplicates from a vector uniq # Remove duplicate elements of $1, e.g. u = uniq(x) @findex upper, get `upper limit' symbol upper # define a variable giving an `upper limit' symbol @findex vecminmax, min. and max. of vector vecminmax # find the minimum and maximum of a vector @findex vfield, plot a vector field vfield # plot a vector field: vfield x y len angle @findex vfield2, plot a vector field (x-units) vfield2 # plot a vector field, vfield x y len angle (len in x-axis units) @findex vfield3, plot a vector field (y-units) vfield3 # plot a vector field: vfield x y len angle (len in y-axis units) @findex vfield4, Vector field vx vy at x, y vfield4 # Vector field at points x, y; components vx vy @findex vfield5, Scaled Vector field vx vy at x, y vfield5 # Vector field at points x, y; components vx vy scaled by f @end example