Guide to Madagascar programs |
Spike positioning is given in samples and starts with 1.
float | d#=[0.004,0.1,0.1,...] | sampling on #-th axis | |
---|---|---|---|
ints | k#=[0,...] | spike starting position [nsp] | |
ints | l#=[k1,k2,...] | spike ending position [nsp] | |
string | label#=[Time,Distance,Distance,...] | label on #-th axis | |
floats | mag= | spike magnitudes [nsp] | |
int | n#= | size of #-th axis | |
int | nsp=1 | Number of spikes | |
float | o#=[0,0,...] | origin on #-th axis | |
floats | p#=[0,...] | spike inclination (in samples) [nsp] | |
string | title= | title for plots | |
string | unit#=[s,km,km,...] | unit on #-th axis |
sfspike takes no input and generates an output with ``spikes''. It is an easy way to create data. Here is an example:
bash$ sfspike n1=5 n2=3 k1=4 k2=1 | sfdisfil 0: 0 0 0 1 0 5: 0 0 0 0 0 10: 0 0 0 0 0The spike location is specified by parameters k1=4 and k2=1. Note that the locations are numbered starting from 1. If one of the parameters is omitted or given the value of zero, the spike in the corresponding direction becomes a plane:
bash$ sfspike n1=5 n2=3 k1=4 | sfdisfil 0: 0 0 0 1 0 5: 0 0 0 1 0 10: 0 0 0 1 0If no spike parameters are given, the whole dataset is filled with ones:
bash$ sfspike n1=5 n2=3 | sfdisfil 0: 1 1 1 1 1 5: 1 1 1 1 1 10: 1 1 1 1 1
To create several spikes, use the nsp= parameter and give a comma-separated list of values to k#= arguments:
bash$ sfspike n1=5 n2=3 nsp=3 k1=1,3,4 k2=1,2,3 | sfdisfil 0: 1 0 0 0 0 5: 0 0 1 0 0 10: 0 0 0 1 0If the number of values in the list is smaller than nsp, the last value gets repeated, and the spikes add on top of each other, creating larger amplitudes:
bash$ sfspike n1=5 n2=3 nsp=3 k1=1,3 k2=1,2 | sfdisfil 0: 1 0 0 0 0 5: 0 0 2 0 0 10: 0 0 0 0 0The magnitude of the spikes can be controlled explicitly with the mag= parameter:
bash$ sfspike n1=5 n2=3 nsp=3 k1=1,3,4 k2=1,2,3 mag=1,4,2 | sfdisfil 0: 1 0 0 0 0 5: 0 0 4 0 0 10: 0 0 0 2 0
You can create boxes instead of spikes by using l#= parameters:
bash$ sfspike n1=5 n2=3 k1=2 l1=4 k2=2 mag=8 | sfdisfil 0: 0 0 0 0 0 5: 0 8 8 8 0 10: 0 0 0 0 0In this case, k1=2 specifies the box start, and l1=4 specifies the box end.
Finally, multi-dimensional planes can be given an inclination by using p#= parameters:
bash$ sfspike n1=5 n2=3 k1=2 p2=1 | sfdisfil 0: 0 1 0 0 0 5: 0 0 1 0 0 10: 0 0 0 1 0When the inclination value is not integer, simple linear interpolation is used:
bash$ sfspike n1=5 n2=3 k1=2 p2=0.7 | sfdisfil 0: 0 1 0 0 0 5: 0 0.3 0.7 0 0 10: 0 0 0.6 0.4 0
sfspike supplies default dimensions and labels to all axis:
bash$ sfspike n1=5 n2=3 n3=4 > spike.rsf bash$ sfin spike.rsf spike.rsf: in="/var/tmp/spike.rsf@" esize=4 type=float form=native n1=5 d1=0.004 o1=0 label1="Time" unit1="s" n2=3 d2=0.1 o2=0 label2="Distance" unit2="km" n3=4 d3=0.1 o3=0 label3="Distance" unit3="km" 60 elements 240 bytesAs you can see, the first axis is assumed to be time, with sampling of seconds. All other axes are assumed to be distance, with sampling of kilometers. All these parameters can be changed on the command line.
bash$ sfspike n1=5 n2=3 n3=4 label3=Offset unit3=ft d3=20 > spike.rsf bash$ sfin spike.rsf spike.rsf: in="/var/tmp/spike.rsf@" esize=4 type=float form=native n1=5 d1=0.004 o1=0 label1="Time" unit1="s" n2=3 d2=0.1 o2=0 label2="Distance" unit2="km" n3=4 d3=20 o3=0 label3="Offset" unit3="ft" 60 elements 240 bytes
Guide to Madagascar programs |