At the suggestion of Gilles Hennenfent, certain RSF programs now recognize unit1=, unit2=, etc keywords in addition to label1=, label2=, etc. This allows for more control on physical dimensionality.
Here is an example of having some fun with physical units:
- Create some data.
bash$ sfspike n1=100 n2=100 > spike.rsf
bash$ sfin spike.rsf
spike.rsf:
in="/var/scratch/spike.rsf@"
esize=4 type=float form=native
n1=100 d1=0.004 o1=0 label1="Time" unit1="s"
n2=100 d2=0.1 o2=0 label2="Distance" unit2="km"
10000 elements 40000 bytes
- Convert kilometers to feet:
bash$ sfunits unit2=ft spike.rsf >> spike.rsf
Converting "km" to "ft" on axis 2
bash$ sfin spike.rsf
spike.rsf:
in="/var/scratch/spike.rsf@"
esize=4 type=float form=native
n1=100 d1=0.004 o1=0 label1="Time" unit1="s"
n2=100 d2=328.084 o2=0 label2="Distance" unit2="ft"
10000 elements 40000 bytes
sfunits is a new script for unit conversion. It relies on the Unix units utility.
- Apply 2-D FFT transform.
bash$ < spike.rsf sffft1 | sffft3 axis=2 > fft.rsf
sffft3: padded to 200
bash$ sfin fft.rsf
fft.rsf:
in="/var/scratch/fft.rsf@"
esize=8 type=complex form=native
n1=55 d1=2.31481 o1=0 label1="Frequency" unit1="1/s"
n2=200 d2=1.524e-05 o2=-0.001524 label2="Wavenumber" unit2="1/ft"
11000 elements 88000 bytes
- Transform back.
bash$ < fft.rsf sffft3 axis=2 inv=y | sffft1 inv=y > back.rsf
bash$ sfin back.rsf
back.rsf:
in="/var/scratch/back.rsf@"
esize=4 type=float form=native
n1=100 d1=0.00400001 o1=0 label1="Time" unit1="s"
n2=100 d2=328.084 o2=0 label2="Distance" unit2="ft"
10000 elements 40000 bytes
Warning: this is a substantial change that affects many programs and examples. Please report any problems.