📄 prog.tex
字号:
bash$ < one.rsf sfpad beg2=2 | sfdisfil 0: 0 0 0 0 0 5: 0 0 0 0 0 10: 1 1 1 1 1 15: 1 1 1 1 1 20: 1 1 1 1 1bash$ < one.rsf sfpad beg2=1 end2=1 | sfdisfil 0: 0 0 0 0 0 5: 0 0 0 0 0 10: 1 1 1 1 1 15: 1 1 1 1 1 20: 1 1 1 1 1bash$ < one.rsf sfwindow n1=3 | sfpad n1=5 n2=5 beg1=1 beg2=1 | sfdisfil 0: 0 0 0 0 0 5: 0 1 1 1 0 10: 0 1 1 1 0 15: 0 1 1 1 0 20: 0 0 0 0 0\end{verbatim}You can use \texttt{sfcat} to pad data with values other than zeroes.\noindent\doublebox{\parbox{\textwidth}{ \input{sfput} }}\texttt{sfput} is a very simple program. It simply appends parametersfrom the command line to the output RSF file. One can achieve similarresults with editing by hand or with standard Unix utilities like\texttt{sed} and \texttt{echo}. \texttt{sfput} is sometimes moreconvenient because it handles input/output operations similarly toother regular RSF programs.\begin{verbatim}bash$ sfspike n1=10 > spike.rsfbash$ sfin spike.rsfspike.rsf: in="/tmp/spike.rsf@" esize=4 type=float form=native n1=10 d1=0.004 o1=0 label1="Time" unit1="s" 10 elements 40 bytesbash$ sfput < spike.rsf d1=25 label1=Depth unit1=m > spike2.rsfbash$ sfin spike2.rsfspike2.rsf: in="/tmp/spike2.rsf@" esize=4 type=float form=native n1=10 d1=25 o1=0 label1="Depth" unit1="m" 10 elements 40 bytes\end{verbatim}\noindent\doublebox{\parbox{\textwidth}{ \input{sfreal} }}\texttt{sfreal} extracts the real part of a complex type dataset. Theimaginary part can be extracted with \texttt{sfimag}, an the realand imaginary part can be combined together with \texttt{sfcmplx}.Here is a simple example. Let us first create a complex dataset with \texttt{sfmath}\begin{verbatim}bash$ sfmath n1=10 type=complex output="(2+I)*x1" > cmplx.rsfbash$ fdisfil < cmplx.rsf 0: 0, 0i 2, 1i 4, 2i 3: 6, 3i 8, 4i 10, 5i 6: 12, 6i 14, 7i 16, 8i 9: 18, 9i\end{verbatim}Extracting the real part with \texttt{sfreal}:\begin{verbatim}bash$ sfreal < cmplx.rsf | sfdisfil 0: 0 2 4 6 8 5: 10 12 14 16 18\end{verbatim}Extracting the imaginary part with \texttt{sfimag}:\begin{verbatim}bash$ sfimag < cmplx.rsf | sfdisfil 0: 0 1 2 3 4 5: 5 6 7 8 9\end{verbatim}\noindent\doublebox{\parbox{\textwidth}{ \input{sfreverse} }}Here is an example of using \texttt{sfreverse}. First, let us create a2-D dataset.\begin{verbatim}bash$ sfmath n1=5 d1=1 n2=3 d2=1 output=x1+x2 > test.rsfbash$ < test.rsf sfdisfil 0: 0 1 2 3 4 5: 1 2 3 4 5 10: 2 3 4 5 6\end{verbatim}Reversing the first axis:\begin{verbatim}bash$ < test.rsf sfreverse which=1 | sfdisfil 0: 4 3 2 1 0 5: 5 4 3 2 1 10: 6 5 4 3 2\end{verbatim}Reversing the second axis:\begin{verbatim}bash$ < test.rsf sfreverse which=2 | sfdisfil 0: 2 3 4 5 6 5: 1 2 3 4 5 10: 0 1 2 3 4\end{verbatim}Reversing both the first and the second axis:\begin{verbatim}bash$ < test.rsf sfreverse which=3 | sfdisfil 0: 2 3 4 5 6 5: 1 2 3 4 5 10: 0 1 2 3 4\end{verbatim}As you can see, the \texttt{which=} parameter controls the axes that arebeing reversed by encoding them into one number.When an axis is reversed, what happens with its axis origin andsampling parameters? This behavior is controlled by \texttt{opt=}. Inour example,\begin{verbatim}bash$ < test.rsf sfget n1 o1 d1n1=5o1=0d1=1bash$ < test.rsf sfreverse which=1 | sfget o1 d1o1=4d1=-1\end{verbatim}The default behavior (equivalent to \texttt{opt=y}) puts the origin\texttt{o1} at the end of the axis and reverses the sampling parameter\texttt{d1}. Using \texttt{opt=n} preserves the sampling but reversesthe origin.\begin{verbatim}bash$ < test.rsf sfreverse which=1 opt=n | sfget o1 d1o1=-4d1=1\end{verbatim}Using \texttt{opt=i} preserves both the sampling and the origin whilereversing the axis.\begin{verbatim}bash$ < test.rsf sfreverse which=1 opt=i | sfget o1 d1o1=0d1=1\end{verbatim}One of the three possible behaviors may be desirable depending on theapplication.\noindent\doublebox{\parbox{\textwidth}{ \input{sfrm} }}\texttt{sfrm} is a program for removing RSF files. Its arguments mimicthe arguments of the standard Unix \texttt{rm} utility: \texttt{-v}for verbosity, \texttt{-i} for interactive inquiry, \texttt{-f} forforce removal of suspicious files. Unlike the Unix \texttt{rm},\texttt{sfrm} removes both the RSF header files and the binary filesthat the headers point to. Example:\begin{verbatim}bash$ sfspike n1=10 > spike.rsf datapath=./bash$ sfget in < spike.rsfin=./spike.rsf@bash$ ls spike*spike.rsf spike.rsf@bash$ sfrm -v spike.rsfsfrm: sf_rm: Removing header spike.rsfsfrm: sf_rm: Removing data ./spike.rsf@bash$ ls spike*ls: No match.\end{verbatim}\noindent\doublebox{\parbox{\textwidth}{ \input{sfrotate} }}\inputdir{XFig}\texttt{sfrotate} modifies the input dataset by splitting it intoparts and putting the parts back in a different order. Here is a quick example.\begin{verbatim}bash$ sfmath n1=5 d1=1 n2=3 d2=1 output=x1+x2 > test.rsfbash$ < test.rsf sfdisfil 0: 0 1 2 3 4 5: 1 2 3 4 5 10: 2 3 4 5 6\end{verbatim}Rotating the first axis by putting the last two columns in front:\begin{verbatim}bash$ < test.rsf sfrotate rot1=2 | sfdisfil 0: 3 4 0 1 2 5: 4 5 1 2 3 10: 5 6 2 3 4\end{verbatim}Rotating the second axis by putting the last row in front:\begin{verbatim}bash$ < test.rsf sfrotate rot2=1 | sfdisfil 0: 2 3 4 5 6 5: 0 1 2 3 4 10: 1 2 3 4 5\end{verbatim}Rotating both the first and the second axis:\begin{verbatim}bash$ < test.rsf sfrotate rot1=3 rot2=1 | sfdisfil 0: 4 5 6 2 3 5: 2 3 4 0 1 10: 3 4 5 1 2\end{verbatim}The transformation is shown schematically in Figure~\ref{fig:rotate}.\plot{rotate}{width=\textwidth}{Schematic transformation of data with \texttt{sfrotate}.}\noindent\doublebox{\parbox{\textwidth}{ \input{sfrtoc} }}The input to \texttt{sfrtoc} can be any \texttt{type=float} dataset:\begin{verbatim}bash$ sfspike n1=10 n2=20 n3=30 >real.rsfbash$ sfin real.rsfreal.rsf: in="/var/tmp/real.rsf@" esize=4 type=float form=native n1=10 d1=0.004 o1=0 label1="Time" unit1="s" n2=20 d2=0.1 o2=0 label2="Distance" unit2="km" n3=30 d3=0.1 o3=0 label3="Distance" unit3="km" 6000 elements 24000 bytes\end{verbatim}The output dataset will have \texttt{type=complex}, and its binary will betwice the size of the input:\begin{verbatim}bash$ <real.rsf sfrtoc >complex.rsfbash$ sfin complex.rsf complex.rsf: in="/var/tmp/complex.rsf@" esize=8 type=complex form=native n1=10 d1=0.004 o1=0 label1="Time" unit1="s" n2=20 d2=0.1 o2=0 label2="Distance" unit2="km" n3=30 d3=0.1 o3=0 label3="Distance" unit3="km" 6000 elements 48000 bytes\end{verbatim}\noindent\doublebox{\parbox{\textwidth}{ \input{sfscale} }}\texttt{sfscale} scales the input dataset by a factor. Hereare some simple examples. First, let us create a test dataset.\begin{verbatim}bash$ sfmath n1=5 n2=3 o1=1 o2=1 output="x1*x2" > test.rsfbash$ < test.rsf sfdisfil 0: 1 2 3 4 5 5: 2 4 6 8 10 10: 3 6 9 12 15\end{verbatim}Scale every data point by 2:\begin{verbatim}bash$ < test.rsf sfscale dscale=2 | sfdisfil 0: 2 4 6 8 10 5: 4 8 12 16 20 10: 6 12 18 24 30\end{verbatim}Divide every trace by its maximum value:\begin{verbatim}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 1\end{verbatim}Divide by the maximum value in the whole 2-D dataset:\begin{verbatim}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 1\end{verbatim}The \texttt{rscale=} parameter is synonymous to \texttt{dscale=} exceptwhen it is equal to zero. With \texttt{sfscale dscale=0}, the dataset getsmultiplied by zero. If using \texttt{rscale=0}, the other parameters areused to define scaling. Thus, \texttt{sfscale rscale=0 axis=1} isequivalent to \texttt{sfscale axis=1}, and \texttt{sfscale rscale=0}is equivalent to \texttt{sfscale dscale=1}.\bibliographystyle{seg}\bibliography{SEG}%%% Local Variables: %%% mode: latex%%% TeX-master: t%%% End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -