Starting from this post, once a month we will blog about one of the popular

**Madagascar** programs.

The 30

highest ranking programs, according to

admin/rank.py, are

grey window math dd spike put graph add cat transp scale pad spray

smooth stack noise grey3 real dip ricker1 bandpass dots wiggle mask

fft1 segyread contour pick mutter fft3

This month's randomly selected feature is

sfnoise.

As stated in the self-documentation,

**sfnoise** is used for generating random noise and adding it to the data. This is useful for generating synthetic datasets or for multiple realizations in inversion.

Computer-generated random numbers are often called pseudorandom, because algorithmically generated sequences of numbers are not truly random. This is actually a useful feature if you want to reproduce previous calculations. For reproducibility, it is imperative to use

**seed= ** parameter to set the initial "seed" for the random-number generator. If

**seed=** is not used, it is set by the computer clock. Therefore, different runs of

**sfnoise** will produce different sets of numbers.

Try the following on the command line:

bash$ sfspike n1=5 mag=0 | sfnoise | sfdisfil

0: -2.455 1.197 -0.145 0.2394 0.7676

bash$ sfspike n1=5 mag=0 | sfnoise | sfdisfil

0: 2.203 -0.1106 -0.07494 -0.4916 0.2163

Your sets of numbers will be (most likely) different from the ones above and between the two runs. However, if you run

$ sfspike n1=5 mag=0 | sfnoise seed=2011 | sfdisfil

0: 0.1917 0.3379 -0.9459 0.5841 -0.02078

you should see exactly the same set of number as above.

You should also get the same numbers if using

$ sfspike n1=5 | sfnoise seed=2011 rep=y | sfdisfil

0: 0.1917 0.3379 -0.9459 0.5841 -0.02078

The

**rep=** parameter controls if the noise is replacing the data or being added to the data. The default operation is addition.

$ sfspike n1=5 | sfnoise seed=2011 | sfdisfil

0: 1.192 1.338 0.05412 1.584 0.9792

The algorithm for pseudorandom number generation that

**sfnoise** uses is known as

Mersenne twister. It is a powerful algorithm that generates a nearly uniformly distributed sequence that does not repeat for a very large period of

**2**^{19937}-1.

Matsumoto, M.; Nishimura, T. (1998). "Mersenne twister: a 623-dimensionally equidistributed uniform pseudo-random number generator". ACM Transactions on Modeling and Computer Simulation 8 (1): 3–30.

Uniformly-distributed numbers can be used to generate random numbers with other distributions. By default,

**sfnoise** is using

normal distribution. It can be changed to uniform distribution by setting

**type=n**.

- See rsf/rsf/sfnoise for simple examples of setting the noise distribution parameters (
**type=**, **mean=**, **var=**, **range=**).

- See geostats/simulate/rfield and Jim Jenning's presentation at Houston-2010 school for more sophisticated examples of using
**sfnoise**, together with FFT-based variogram computation, in geostatistical simulations.

sfsmooth, one of the most useful Madagascar programs, implements smoothing by triangle filtering. The idea of triangle filtering is explained in Jon Claerbout's books Processing versus Inversion and Image Estimation by Example. You can find the explan

Weblog:Madagascar development blogTracked:Jan 12, 12:33sfspectra computes spectrum, the absolute value of the 1-D Fourier transform along the fast axis. The following example from rsf/su/rsfkasper shows a seismic shot gather before and after high-pass filtering and the corresponding spectra computed with

Weblog:Madagascar development blogTracked:Mar 18, 17:16sfgrey3 generates "cube" plots from 3-D data. A cube plot displays sections from a 3-D cube as faces of the cube. Some of the options specific to this kind of display are: flat= The flat parameter tells sfgrey3 whether to display the cube as a

Weblog:Madagascar development blogTracked:Apr 09, 12:42sfderiv applies the first derivative filter. The algorithm implemented in this program is described in the paper Pei, S.-C., and P.-H. Wang, 2001, Closed-form design of maximally flat FIR Hilbert transformers, differentiators, and fractional delaye

Weblog:Madagascar development blogTracked:May 06, 08:10sfderiv applies the first derivative filter. The algorithm implemented in this program is described in the paper Pei, S.-C., and P.-H. Wang, 2001, Closed-form design of maximally flat FIR Hilbert transformers, differentiators, and fractional delaye

Weblog:Madagascar development blogTracked:May 06, 08:11sfderiv applies the first derivative filter. The algorithm implemented in this program is described in the paper Pei, S.-C., and P.-H. Wang, 2001, Closed-form design of maximally flat FIR Hilbert transformers, differentiators, and fractional delaye

Weblog:Madagascar development blogTracked:Jun 02, 06:46sfdip estimates a local slope (dip) using the plane-wave destruction algorithm. The dip is measured in time samples. If α is the dip angle, then the output of sfdip corresponds to the dimensionless quantity p=tanα. The following example

Weblog:Madagascar development blogTracked:Jun 04, 05:46sffft3 implements a complex-to-complex Fast Fourier Transform (FFT) along an arbitrary axis. The FFT library that Madagascar uses is KISS FFT, created by Mark Borgerding. KISS stands for Keep it simple, Stupid! KISS FFT may not be as fast as FFTW but i

Weblog:Madagascar development blogTracked:Jul 08, 12:34Previous programs of the month:sffft3sfdipsfderivsfgrey3sfspectrasfnoisesfgraphsfclipsfagcsfenvelopesfcontoursfsmooth

Weblog:Madagascar development blogTracked:Sep 03, 14:02sfpick performs automatic picking from semblance-like panels. The underlying algorithm is described in Appendix B of the paper Velocity analysis using AB semblance and is inspired by the method of virtual endoscopy in medical imaging. The following

Weblog:Madagascar development blogTracked:Sep 08, 16:07sfiwarp performs mapping between different coordinates. If you have sampled functions f(x) and y(x), sfiwarp with inv=y (the default) finds sampled f(y). If inv=n, sfiwarp takes f(y) and y(x) and finds f(x). In both cases, the sampled y(x) function is sup

Weblog:Madagascar development blogTracked:Sep 09, 12:52sfpick performs automatic picking from semblance-like panels. The underlying algorithm is described in Appendix B of the paper Velocity analysis using AB semblance and is inspired by the method of virtual endoscopy in medical imaging. The following

Weblog:Madagascar development blogTracked:Sep 09, 12:52sfkirmod is a program for modeling seismic reflection data using the Kirchhoff method. According to this method, the reflection response is computed by integrating over the reflector surface. For a theoretical derivation, see, for example, Haddon, R. A

Weblog:Madagascar development blogTracked:Oct 13, 19:46sfbandpass implements bandpass filtering using the Butterworth algorithm. The desired bandwidth is specified by low and high frequencies (in Hertz) flo= and fhi=. A continuous low-pass Butterworth filter is given by The actual filtering is imp

Weblog:Madagascar development blogTracked:Nov 18, 13:45sfhalfint implements half-order integration or differentiation, a filtering operation common in 2-D imaging operators such as as slant stacking or Kirchhoff migration. By default, sfhalfint performs half-order integration. To apply half-order different

Weblog:Madagascar development blogTracked:Jan 06, 16:58