Guide to Madagascar programs |
To scale by a constant factor, you can also use sfmath.
int | axis=0 | Scale by maximum in the dimensions up to this axis. | |
---|---|---|---|
float | dscale=1. | Scale by this factor (works if rscale=0) | |
float | rscale=0. | Scale by this factor. |
sfscale scales the input dataset by a factor. Here are some simple examples. First, let us create a test dataset.
bash$ sfmath n1=5 n2=3 o1=1 o2=1 output="x1*x2" > test.rsf bash$ < test.rsf sfdisfil 0: 1 2 3 4 5 5: 2 4 6 8 10 10: 3 6 9 12 15Scale every data point by 2:
bash$ < test.rsf sfscale dscale=2 | sfdisfil 0: 2 4 6 8 10 5: 4 8 12 16 20 10: 6 12 18 24 30Divide every trace by its maximum value:
bash$ < test.rsf sfscale axis=1 | sfdisfil 0: 0.2 0.4 0.6 0.8 1 5: 0.2 0.4 0.6 0.8 1 10: 0.2 0.4 0.6 0.8 1Divide by the maximum value in the whole 2-D dataset:
bash$ < test.rsf sfscale axis=2 | sfdisfil 0: 0.06667 0.1333 0.2 0.2667 0.3333 5: 0.1333 0.2667 0.4 0.5333 0.6667 10: 0.2 0.4 0.6 0.8 1The rscale= parameter is synonymous to dscale= except when it is equal to zero. With sfscale dscale=0, the dataset gets multiplied by zero. If using rscale=0, the other parameters are used to define scaling. Thus, sfscale rscale=0 axis=1 is equivalent to sfscale axis=1, and sfscale rscale=0 is equivalent to sfscale dscale=1.
Guide to Madagascar programs |