From 3488707ef59e8e8976b611ccbb5c61d564fd8123 Mon Sep 17 00:00:00 2001 From: sfomel Date: Tue, 14 Jan 2025 14:05:45 -0600 Subject: [PATCH] 4.2 release --- book/Grave/README.txt | 5 - .../Grave/gpr2007RWEHighOrderKernels/MISC.bib | 1 - book/Grave/gpr2007RWEHighOrderKernels/PCS.bib | 1 - .../gpr2007RWEHighOrderKernels/REPRO_FAIL.txt | 14 - .../gpr2007RWEHighOrderKernels/SConstruct | 3 - .../gpr2007RWEHighOrderKernels/abstract.tex | 24 - .../acknowledgment.tex | 2 - .../conclusions.tex | 13 - .../gpr2007RWEHighOrderKernels/discussion.tex | 21 - .../gpr2007RWEHighOrderKernels/dispersion.tex | 159 - .../diving/SConstruct | 126 - .../gpr2007RWEHighOrderKernels/examples.tex | 167 - .../extrapolators.tex | 138 - .../introduction.tex | 77 - .../gpr2007RWEHighOrderKernels/macro.tex | 295 -- .../marm/SConstruct | 95 - .../gpr2007RWEHighOrderKernels/paper.tex | 29 - .../gpr2007RWEHighOrderKernels/pcsmacros.tex | 1 - .../gpr2007RWEHighOrderKernels/theory.tex | 159 - book/Grave/pwc/REPRO_FAIL.txt | 1 - book/Grave/pwc/SConstruct | 9 - book/Grave/pwc/beic/SConstruct | 26 - book/Grave/pwc/cmp/SConstruct | 132 - book/Grave/pwc/flat.bib | 165 - book/Grave/pwc/paper.tex | 427 --- book/Grave/seg2006ConvertedWavesTSIC/MISC.bib | 1 - book/Grave/seg2006ConvertedWavesTSIC/PCS.bib | 1 - .../seg2006ConvertedWavesTSIC/REPRO_FAIL.txt | 1 - .../seg2006ConvertedWavesTSIC/SConstruct | 3 - .../XFig/Fig/experimentC.pdf | Bin 5829 -> 0 bytes .../XFig/Fig/vecC.pdf | Bin 6940 -> 0 bytes .../XFig/experimentC.fig | 48 - .../seg2006ConvertedWavesTSIC/XFig/vecC.fig | 43 - .../cwtsic3/SConstruct | 302 -- .../Grave/seg2006ConvertedWavesTSIC/macro.tex | 101 - .../Grave/seg2006ConvertedWavesTSIC/paper.tex | 573 ---- user/nobody/Maborn.c | 549 ---- user/nobody/Mabsoffdip.c | 102 - user/nobody/Mafdm2d.c | 432 --- user/nobody/Mafmod.c | 515 --- user/nobody/Mangdip.c | 140 - user/nobody/Manifd2d.c | 617 ---- user/nobody/Mawe.c | 522 --- user/nobody/Mawefd.c | 378 --- user/nobody/Mawefd1.c | 331 -- user/nobody/Mbessel.c | 76 - user/nobody/Mblindpick.c | 133 - user/nobody/Mblindpick2.c | 133 - user/nobody/Mborn2d.c | 511 --- user/nobody/Mboxsmooth2.c | 68 - user/nobody/Mbyte2rsf.c | 63 - user/nobody/Mcameron.c | 154 - user/nobody/Mcamig.c | 233 -- user/nobody/Mcircle.py | 65 - user/nobody/Mcoh.c | 104 - user/nobody/Mctmf.c | 55 - user/nobody/Mcube2list.c | 157 - user/nobody/Mdealias.c | 179 -- user/nobody/Mdip2.c | 129 - user/nobody/Mdipspray.c | 47 - user/nobody/Mdsr2.c | 150 - user/nobody/Mdsrstep1.c | 220 -- user/nobody/Menoder1.c | 50 - user/nobody/Menoint2.c | 109 - user/nobody/Menvcorr.c | 64 - user/nobody/Merfdm.c | 195 -- user/nobody/Mfft2.c | 216 -- user/nobody/Mfint1.c | 88 - user/nobody/Mfkamopaco.c | 103 - user/nobody/Mflat.c | 69 - user/nobody/Mflat3.c | 115 - user/nobody/Mfourvcd.c | 195 -- user/nobody/Mfreqintpef.c | 133 - user/nobody/Mfreqlet97.c | 109 - user/nobody/Mgauss.c | 71 - user/nobody/Mgazdagz.c | 178 -- user/nobody/Mgreen.c | 126 - user/nobody/Mhale.c | 84 - user/nobody/Mhdtrace.c | 119 - user/nobody/Mhmiss.c | 132 - user/nobody/Mhshape.c | 106 - user/nobody/Mhslice.c | 68 - user/nobody/Minvwarp.c | 70 - user/nobody/Misomod.c | 386 --- user/nobody/Mkgdmo.c | 145 - user/nobody/Mkirmodcmp.c | 487 --- user/nobody/Mlayer.c | 140 - user/nobody/Mlevint2.c | 128 - user/nobody/Mlinsincos.c | 157 - user/nobody/Mlwefd1.c | 412 --- user/nobody/Mmap2list.c | 112 - user/nobody/Mmig2.c | 141 - user/nobody/Mmig45.c | 309 -- user/nobody/Mnfill.c | 107 - user/nobody/Mnmova2.c | 97 - user/nobody/Modip2.c | 139 - user/nobody/Moff2abs2.c | 135 - user/nobody/Mopwd2.c | 88 - user/nobody/Mpgen.c | 125 - user/nobody/Mphmig.c | 111 - user/nobody/Mpick0.c | 71 - user/nobody/Mpick2.c | 168 - user/nobody/Mpickd.c | 49 - user/nobody/Mpradon.c | 136 - user/nobody/Mrcat.py | 58 - user/nobody/Mrwemete2d.c | 109 - user/nobody/Ms2plane.c | 100 - user/nobody/Msag.c | 99 - user/nobody/Msegy2rsf.c | 149 - user/nobody/Mseislet97.c | 109 - user/nobody/Mshot2cmp3.c | 194 -- user/nobody/Mslowft.c | 146 - user/nobody/Msmooth2.c | 61 - user/nobody/Msmoothdiv.c | 65 - user/nobody/Mspectra.c | 125 - user/nobody/Msphere.c | 55 - user/nobody/Mspicks.c | 133 - user/nobody/Msrmig.c | 216 -- user/nobody/Msrmig2.c | 303 -- user/nobody/Msrmod.c | 135 - user/nobody/Msstep1.c | 185 -- user/nobody/Msstep3.c | 196 -- user/nobody/Mstretch2.c | 60 - user/nobody/Msu2rsf.c | 84 - user/nobody/Msymes.c | 69 - user/nobody/Mtpow.c | 95 - user/nobody/Mtshiftcos.c | 103 - user/nobody/Mttimod.c | 503 --- user/nobody/Mvtimod.c | 431 --- user/nobody/Mwarp2gamma.c | 81 - user/nobody/Mwefic.c | 87 - user/nobody/Mweimc.c | 120 - user/nobody/Mwindow1.c | 88 - user/nobody/Mwindow2.c | 79 - user/nobody/Mwindow3.c | 87 - user/nobody/Mxcorr1.c | 96 - user/nobody/Mzoimg3.c | 303 -- user/nobody/Mztrace2.c | 117 - user/nobody/Testboxsl.c | 36 - user/nobody/Testntriangle1.c | 32 - user/nobody/Testtomo.c | 19 - user/nobody/_fftsize.h | 582 ---- user/nobody/allp.c | 45 - user/nobody/bandpass.c | 77 - user/nobody/bessel.c | 214 -- user/nobody/boxsl.c | 210 -- user/nobody/cam.c | 310 -- user/nobody/camig.c | 333 -- user/nobody/chebder.c | 49 - user/nobody/coh.c | 139 - user/nobody/comaz.c | 414 --- user/nobody/cpredict.c | 78 - user/nobody/ctmf.c | 444 --- user/nobody/ctmf.h | 44 - user/nobody/device.c | 2824 ----------------- user/nobody/dip2.c | 128 - user/nobody/div1.c | 71 - user/nobody/divide1.c | 102 - user/nobody/divide2.c | 100 - user/nobody/divlap1.c | 137 - user/nobody/dsr1.c | 241 -- user/nobody/dsr2.c | 382 --- user/nobody/dynprog2.c | 139 - user/nobody/enogrid.c | 108 - user/nobody/envcorr.c | 129 - user/nobody/fdm.py | 99 - user/nobody/fft.py | 35 - user/nobody/fft1.c | 221 -- user/nobody/fft2.c | 199 -- user/nobody/fft3.c | 243 -- user/nobody/fftsize.c | 105 - user/nobody/find_file_leaks.py | 128 - user/nobody/foldplot.c | 154 - user/nobody/freqintpef.c | 60 - user/nobody/freqlet97.c | 472 --- user/nobody/gazdagz.c | 151 - user/nobody/hdtrace.c | 303 -- user/nobody/hshape.c | 101 - user/nobody/img.c | 311 -- user/nobody/layer.c | 161 - user/nobody/levint2.c | 72 - user/nobody/log.c | 77 - user/nobody/nos.c | 164 - user/nobody/ntriangle1.c | 89 - user/nobody/off2ang.c | 155 - user/nobody/omputil.c | 37 - user/nobody/opwd.c | 100 - user/nobody/phs.c | 102 - user/nobody/prf.c | 63 - user/nobody/scale.c | 29 - user/nobody/seislet97.c | 665 ---- user/nobody/seisletoper.c | 906 ------ user/nobody/sinsl.c | 97 - user/nobody/slinint.c | 54 - user/nobody/slow3.c | 150 - user/nobody/split1.c | 170 - user/nobody/split3.c | 281 -- user/nobody/srmig.c | 310 -- user/nobody/srmig2.c | 308 -- user/nobody/srmod.c | 446 --- user/nobody/stretch2.c | 134 - user/nobody/su_or_segy_to_rsf.c | 228 -- user/nobody/svdutil.c | 411 --- user/nobody/sweeping.c | 47 - user/nobody/symes.c | 25 - user/nobody/taper3.c | 204 -- user/nobody/tent2.c | 42 - user/nobody/tomo2.c | 116 - user/nobody/wefic.c | 157 - user/nobody/weimc.c | 187 -- user/nobody/weutil.c | 207 -- user/nobody/window1.c | 64 - user/nobody/window2.c | 84 - user/nobody/window3.c | 95 - user/nobody/xcorr.c | 57 - user/nobody/zomig3.c | 483 --- user/nobody/ztrace2.c | 218 -- 217 files changed, 37274 deletions(-) delete mode 100644 book/Grave/README.txt delete mode 120000 book/Grave/gpr2007RWEHighOrderKernels/MISC.bib delete mode 120000 book/Grave/gpr2007RWEHighOrderKernels/PCS.bib delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/REPRO_FAIL.txt delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/SConstruct delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/abstract.tex delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/acknowledgment.tex delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/conclusions.tex delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/discussion.tex delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/dispersion.tex delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/diving/SConstruct delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/examples.tex delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/extrapolators.tex delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/introduction.tex delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/macro.tex delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/marm/SConstruct delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/paper.tex delete mode 120000 book/Grave/gpr2007RWEHighOrderKernels/pcsmacros.tex delete mode 100644 book/Grave/gpr2007RWEHighOrderKernels/theory.tex delete mode 100644 book/Grave/pwc/REPRO_FAIL.txt delete mode 100644 book/Grave/pwc/SConstruct delete mode 100644 book/Grave/pwc/beic/SConstruct delete mode 100644 book/Grave/pwc/cmp/SConstruct delete mode 100644 book/Grave/pwc/flat.bib delete mode 100644 book/Grave/pwc/paper.tex delete mode 120000 book/Grave/seg2006ConvertedWavesTSIC/MISC.bib delete mode 120000 book/Grave/seg2006ConvertedWavesTSIC/PCS.bib delete mode 100644 book/Grave/seg2006ConvertedWavesTSIC/REPRO_FAIL.txt delete mode 100644 book/Grave/seg2006ConvertedWavesTSIC/SConstruct delete mode 100644 book/Grave/seg2006ConvertedWavesTSIC/XFig/Fig/experimentC.pdf delete mode 100644 book/Grave/seg2006ConvertedWavesTSIC/XFig/Fig/vecC.pdf delete mode 100644 book/Grave/seg2006ConvertedWavesTSIC/XFig/experimentC.fig delete mode 100644 book/Grave/seg2006ConvertedWavesTSIC/XFig/vecC.fig delete mode 100644 book/Grave/seg2006ConvertedWavesTSIC/cwtsic3/SConstruct delete mode 100644 book/Grave/seg2006ConvertedWavesTSIC/macro.tex delete mode 100644 book/Grave/seg2006ConvertedWavesTSIC/paper.tex delete mode 100644 user/nobody/Maborn.c delete mode 100644 user/nobody/Mabsoffdip.c delete mode 100644 user/nobody/Mafdm2d.c delete mode 100644 user/nobody/Mafmod.c delete mode 100644 user/nobody/Mangdip.c delete mode 100644 user/nobody/Manifd2d.c delete mode 100644 user/nobody/Mawe.c delete mode 100644 user/nobody/Mawefd.c delete mode 100644 user/nobody/Mawefd1.c delete mode 100644 user/nobody/Mbessel.c delete mode 100644 user/nobody/Mblindpick.c delete mode 100644 user/nobody/Mblindpick2.c delete mode 100644 user/nobody/Mborn2d.c delete mode 100644 user/nobody/Mboxsmooth2.c delete mode 100644 user/nobody/Mbyte2rsf.c delete mode 100644 user/nobody/Mcameron.c delete mode 100644 user/nobody/Mcamig.c delete mode 100755 user/nobody/Mcircle.py delete mode 100644 user/nobody/Mcoh.c delete mode 100644 user/nobody/Mctmf.c delete mode 100644 user/nobody/Mcube2list.c delete mode 100644 user/nobody/Mdealias.c delete mode 100644 user/nobody/Mdip2.c delete mode 100644 user/nobody/Mdipspray.c delete mode 100644 user/nobody/Mdsr2.c delete mode 100644 user/nobody/Mdsrstep1.c delete mode 100644 user/nobody/Menoder1.c delete mode 100644 user/nobody/Menoint2.c delete mode 100644 user/nobody/Menvcorr.c delete mode 100644 user/nobody/Merfdm.c delete mode 100644 user/nobody/Mfft2.c delete mode 100644 user/nobody/Mfint1.c delete mode 100644 user/nobody/Mfkamopaco.c delete mode 100644 user/nobody/Mflat.c delete mode 100644 user/nobody/Mflat3.c delete mode 100644 user/nobody/Mfourvcd.c delete mode 100644 user/nobody/Mfreqintpef.c delete mode 100644 user/nobody/Mfreqlet97.c delete mode 100644 user/nobody/Mgauss.c delete mode 100644 user/nobody/Mgazdagz.c delete mode 100644 user/nobody/Mgreen.c delete mode 100644 user/nobody/Mhale.c delete mode 100644 user/nobody/Mhdtrace.c delete mode 100644 user/nobody/Mhmiss.c delete mode 100644 user/nobody/Mhshape.c delete mode 100644 user/nobody/Mhslice.c delete mode 100644 user/nobody/Minvwarp.c delete mode 100644 user/nobody/Misomod.c delete mode 100644 user/nobody/Mkgdmo.c delete mode 100644 user/nobody/Mkirmodcmp.c delete mode 100644 user/nobody/Mlayer.c delete mode 100644 user/nobody/Mlevint2.c delete mode 100644 user/nobody/Mlinsincos.c delete mode 100644 user/nobody/Mlwefd1.c delete mode 100644 user/nobody/Mmap2list.c delete mode 100644 user/nobody/Mmig2.c delete mode 100644 user/nobody/Mmig45.c delete mode 100644 user/nobody/Mnfill.c delete mode 100644 user/nobody/Mnmova2.c delete mode 100644 user/nobody/Modip2.c delete mode 100644 user/nobody/Moff2abs2.c delete mode 100644 user/nobody/Mopwd2.c delete mode 100644 user/nobody/Mpgen.c delete mode 100644 user/nobody/Mphmig.c delete mode 100644 user/nobody/Mpick0.c delete mode 100644 user/nobody/Mpick2.c delete mode 100644 user/nobody/Mpickd.c delete mode 100644 user/nobody/Mpradon.c delete mode 100755 user/nobody/Mrcat.py delete mode 100644 user/nobody/Mrwemete2d.c delete mode 100644 user/nobody/Ms2plane.c delete mode 100644 user/nobody/Msag.c delete mode 100644 user/nobody/Msegy2rsf.c delete mode 100644 user/nobody/Mseislet97.c delete mode 100644 user/nobody/Mshot2cmp3.c delete mode 100644 user/nobody/Mslowft.c delete mode 100644 user/nobody/Msmooth2.c delete mode 100644 user/nobody/Msmoothdiv.c delete mode 100644 user/nobody/Mspectra.c delete mode 100644 user/nobody/Msphere.c delete mode 100644 user/nobody/Mspicks.c delete mode 100644 user/nobody/Msrmig.c delete mode 100644 user/nobody/Msrmig2.c delete mode 100644 user/nobody/Msrmod.c delete mode 100644 user/nobody/Msstep1.c delete mode 100644 user/nobody/Msstep3.c delete mode 100644 user/nobody/Mstretch2.c delete mode 100644 user/nobody/Msu2rsf.c delete mode 100644 user/nobody/Msymes.c delete mode 100644 user/nobody/Mtpow.c delete mode 100644 user/nobody/Mtshiftcos.c delete mode 100644 user/nobody/Mttimod.c delete mode 100644 user/nobody/Mvtimod.c delete mode 100644 user/nobody/Mwarp2gamma.c delete mode 100644 user/nobody/Mwefic.c delete mode 100644 user/nobody/Mweimc.c delete mode 100644 user/nobody/Mwindow1.c delete mode 100644 user/nobody/Mwindow2.c delete mode 100644 user/nobody/Mwindow3.c delete mode 100644 user/nobody/Mxcorr1.c delete mode 100644 user/nobody/Mzoimg3.c delete mode 100644 user/nobody/Mztrace2.c delete mode 100644 user/nobody/Testboxsl.c delete mode 100644 user/nobody/Testntriangle1.c delete mode 100644 user/nobody/Testtomo.c delete mode 100644 user/nobody/_fftsize.h delete mode 100644 user/nobody/allp.c delete mode 100644 user/nobody/bandpass.c delete mode 100644 user/nobody/bessel.c delete mode 100644 user/nobody/boxsl.c delete mode 100644 user/nobody/cam.c delete mode 100644 user/nobody/camig.c delete mode 100644 user/nobody/chebder.c delete mode 100644 user/nobody/coh.c delete mode 100644 user/nobody/comaz.c delete mode 100644 user/nobody/cpredict.c delete mode 100644 user/nobody/ctmf.c delete mode 100644 user/nobody/ctmf.h delete mode 100644 user/nobody/device.c delete mode 100644 user/nobody/dip2.c delete mode 100644 user/nobody/div1.c delete mode 100644 user/nobody/divide1.c delete mode 100644 user/nobody/divide2.c delete mode 100644 user/nobody/divlap1.c delete mode 100644 user/nobody/dsr1.c delete mode 100644 user/nobody/dsr2.c delete mode 100644 user/nobody/dynprog2.c delete mode 100644 user/nobody/enogrid.c delete mode 100644 user/nobody/envcorr.c delete mode 100644 user/nobody/fdm.py delete mode 100755 user/nobody/fft.py delete mode 100644 user/nobody/fft1.c delete mode 100644 user/nobody/fft2.c delete mode 100644 user/nobody/fft3.c delete mode 100644 user/nobody/fftsize.c delete mode 100755 user/nobody/find_file_leaks.py delete mode 100644 user/nobody/foldplot.c delete mode 100644 user/nobody/freqintpef.c delete mode 100644 user/nobody/freqlet97.c delete mode 100644 user/nobody/gazdagz.c delete mode 100644 user/nobody/hdtrace.c delete mode 100644 user/nobody/hshape.c delete mode 100644 user/nobody/img.c delete mode 100644 user/nobody/layer.c delete mode 100644 user/nobody/levint2.c delete mode 100644 user/nobody/log.c delete mode 100644 user/nobody/nos.c delete mode 100644 user/nobody/ntriangle1.c delete mode 100644 user/nobody/off2ang.c delete mode 100644 user/nobody/omputil.c delete mode 100644 user/nobody/opwd.c delete mode 100644 user/nobody/phs.c delete mode 100644 user/nobody/prf.c delete mode 100644 user/nobody/scale.c delete mode 100644 user/nobody/seislet97.c delete mode 100644 user/nobody/seisletoper.c delete mode 100644 user/nobody/sinsl.c delete mode 100644 user/nobody/slinint.c delete mode 100644 user/nobody/slow3.c delete mode 100644 user/nobody/split1.c delete mode 100644 user/nobody/split3.c delete mode 100644 user/nobody/srmig.c delete mode 100644 user/nobody/srmig2.c delete mode 100644 user/nobody/srmod.c delete mode 100644 user/nobody/stretch2.c delete mode 100644 user/nobody/su_or_segy_to_rsf.c delete mode 100644 user/nobody/svdutil.c delete mode 100644 user/nobody/sweeping.c delete mode 100644 user/nobody/symes.c delete mode 100644 user/nobody/taper3.c delete mode 100644 user/nobody/tent2.c delete mode 100644 user/nobody/tomo2.c delete mode 100644 user/nobody/wefic.c delete mode 100644 user/nobody/weimc.c delete mode 100644 user/nobody/weutil.c delete mode 100644 user/nobody/window1.c delete mode 100644 user/nobody/window2.c delete mode 100644 user/nobody/window3.c delete mode 100644 user/nobody/xcorr.c delete mode 100644 user/nobody/zomig3.c delete mode 100644 user/nobody/ztrace2.c diff --git a/book/Grave/README.txt b/book/Grave/README.txt deleted file mode 100644 index 627be493dc..0000000000 --- a/book/Grave/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -Directory with papers that are no longer reproducible. Papers may be taken out -of the grave and resurrected if their reproducibility problems are fixed. The -testing procedure is described at http://www.ahay.org/wiki/Automatic_Testing . -The initial cause of failure (when known) should be described in a -REPRO_FAIL.txt file in each main paper directory. diff --git a/book/Grave/gpr2007RWEHighOrderKernels/MISC.bib b/book/Grave/gpr2007RWEHighOrderKernels/MISC.bib deleted file mode 120000 index 9d74c259aa..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/MISC.bib +++ /dev/null @@ -1 +0,0 @@ -../../cwp/MISC.bib \ No newline at end of file diff --git a/book/Grave/gpr2007RWEHighOrderKernels/PCS.bib b/book/Grave/gpr2007RWEHighOrderKernels/PCS.bib deleted file mode 120000 index b3eec770c4..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/PCS.bib +++ /dev/null @@ -1 +0,0 @@ -../../cwp/PCS.bib \ No newline at end of file diff --git a/book/Grave/gpr2007RWEHighOrderKernels/REPRO_FAIL.txt b/book/Grave/gpr2007RWEHighOrderKernels/REPRO_FAIL.txt deleted file mode 100644 index 6ac0f6dfad..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/REPRO_FAIL.txt +++ /dev/null @@ -1,14 +0,0 @@ -The FFD method in diving/ directory gives NaNs (Jan 2011): - -< migRC-FFD.rsf sfattr -******************************************* - rms = nan - mean = nan -2-norm = nan -variance = nan -std dev = nan - max = 6.0573e+37 at 135 48 - min = -6.09455e+37 at 137 48 -nonzero samples = 405000 -total samples = 405000 -******************************************* diff --git a/book/Grave/gpr2007RWEHighOrderKernels/SConstruct b/book/Grave/gpr2007RWEHighOrderKernels/SConstruct deleted file mode 100644 index 7ee8e34995..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/SConstruct +++ /dev/null @@ -1,3 +0,0 @@ -from rsf.tex import * - -End(use='ulem,color') diff --git a/book/Grave/gpr2007RWEHighOrderKernels/abstract.tex b/book/Grave/gpr2007RWEHighOrderKernels/abstract.tex deleted file mode 100644 index 2f7610a65a..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/abstract.tex +++ /dev/null @@ -1,24 +0,0 @@ -\begin{abstract} -Riemannian wavefield extrapolation (RWE) is a technique for one-way -extrapolation of acoustic waves. RWE generalizes wavefield -extrapolation by downward continuation by considering coordinate -systems different from conventional Cartesian. Coordinate systems can -conform with the extrapolated wavefield, with the velocity model or -with the acquisition geometry. -% -\par When coordinate systems conform with the propagated wavefield, -extrapolation can be done accurately using low-order kernels. However, -in complex media or in cases the coordinate systems do not conform -with the propagating wavefields, low order kernels are not accurate -enough and need to be replaced by more accurate, higher order -kernels. Since RWE is based on factorization of an acoustic -wave-equation, higher order kernels can be constructed using methods -analogous with the one employed for factorization of the acoustic -wave-equation in Cartesian coordinates. Thus, we can construct -space-domain finite-differences as well as mixed-domain techniques for -extrapolation. -% -\par High-order RWE kernels improve the accuracy of extrapolation, -particularly when the Riemannian coordinate systems does not match -closely the general direction of wave propagation. -\end{abstract} diff --git a/book/Grave/gpr2007RWEHighOrderKernels/acknowledgment.tex b/book/Grave/gpr2007RWEHighOrderKernels/acknowledgment.tex deleted file mode 100644 index 4ec8ed17a1..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/acknowledgment.tex +++ /dev/null @@ -1,2 +0,0 @@ -\section{Acknowledgment} -ExxonMobil provided partial financial support of this research. diff --git a/book/Grave/gpr2007RWEHighOrderKernels/conclusions.tex b/book/Grave/gpr2007RWEHighOrderKernels/conclusions.tex deleted file mode 100644 index 5b9503c840..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/conclusions.tex +++ /dev/null @@ -1,13 +0,0 @@ -\section{Conclusions} -Higher-order Riemannian wavefield extrapolation is needed when the -coordinate system does not closely conform with the general direction -of wavefield propagation. This situation occurs, for example, when the -coordinate system is created by ray tracing in a medium that is -different from the one used for extrapolation, or when the coordinate -system is constructed based on geometrical properties of the -acquisition geometry (e.g. migration from topography). Space-domain -and mixed-domain finite-difference solutions to Riemannian wavefield -extrapolation improve the angular accuracy. 3D solutions can be -addressed with explicit finite-differences or by using splitting and -implicit methods, similarly with the techniques used for Cartesian -extrapolation. diff --git a/book/Grave/gpr2007RWEHighOrderKernels/discussion.tex b/book/Grave/gpr2007RWEHighOrderKernels/discussion.tex deleted file mode 100644 index f75c1431ad..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/discussion.tex +++ /dev/null @@ -1,21 +0,0 @@ -\section{Discussion} -\uline{ Accurate wave-equation migration using Riemannian wavefield -extrapolation requires a choice of coordinate system that exploits its -higher extrapolation accuracy. An effective choice of coordinate -system would be one that minimizes the difference between the -extrapolation direction and the direction of wave propagation. If this -condition is fulfilled, we can achieve high-angle accuracy using -low-order extrapolation kernels. Otherwise, we need to extrapolate -seismic wavefields with high-order kernels, like the ones described in -this paper.} \par \uline{ Shot-record migration requires selection of -coordinate systems for the source and receiver wavefields. Optimal -selection of coordinate systems in this situation is not a trivial -task, since the source and receiver wavefields are optimally described -by different coordinate systems which also vary with -location. However, if we employ high-order extrapolation kernels, -different seismic experiments may share the same approximately optimal -coordinate system. An easy way to illustrate this idea is represented -by imaging in (tilted) Cartesian coordinate systems, which are just -special cases of Riemannian coordinates} -\cite[]{SavaFomel.jse.rwesalt}. \uline{A complete treatment of this -topic remains subject for future research.} diff --git a/book/Grave/gpr2007RWEHighOrderKernels/dispersion.tex b/book/Grave/gpr2007RWEHighOrderKernels/dispersion.tex deleted file mode 100644 index 7da0128036..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/dispersion.tex +++ /dev/null @@ -1,159 +0,0 @@ -\section{Riemannian wavefield extrapolation} -Riemannian wavefield extrapolation \cite[]{SavaFomel.geo.rwe} -generalizes solutions to the Helmholtz equation of the acoustic -wave-equation -% -\beq \label{eqn:helmholtz} -\DEL \UU=-\ww^2 s^2 \UU \;, -\eeq -% -to coordinate systems that are different from simple Cartesian, where -extrapolation is performed strictly in the downward direction. In -\req{helmholtz}, $s$ is slowness, $\ww$ is temporal frequency, and -$\UU$ is a monochromatic acoustic wave. The Laplacian operator -$\Delta$ takes different forms according to the coordinate system used -for discretization. -% -\par Assume that we describe the physical space in Cartesian -coordinates $x$, $y$ and $z$, and that we describe a Riemannian -coordinate system using coordinates $\qx$, $\qy$ and $\qz$. The two -coordinate systems are related through a mapping -% -\beqa \label{eqn:mapx} -x&=&x\lp \qx,\qy,\qz \rp -\\ \label{eqn:mapy} -y&=&y\lp \qx,\qy,\qz \rp -\\ \label{eqn:mapz} -z&=&z\lp \qx,\qy,\qz \rp -\eeqa -% -which allows us to compute derivatives of the Cartesian coordinates -relative to the Riemannian coordinates. -% -\par A special case of the mapping \ren{mapx}-\ren{mapz} is defined -when the Riemannian coordinate system is constructed by ray -tracing. The coordinate system is defined by traveltime $\qt$ and -shooting angles, for example. Such coordinate systems have the -property that they are semi-orthogonal, i.e. one axis is orthogonal on -the other two, although the later axes are not necessarily orthogonal -on one-another. -% -\par Following the derivation in \cite{SavaFomel.geo.rwe}, the -acoustic wave-equation in Riemannian coordinates can be written as: -% -\beq \label{eqn:rweacoustic} -\czz \dtwo{\UU}{\qz} + -\cxx \dtwo{\UU}{\qx} + -\cyy \dtwo{\UU}{\qy} + -\cz \done{\UU}{\qz} + -\cx \done{\UU}{\qx} + -\cy \done{\UU}{\qy} + -\cxy \mtwo{\UU}{\qx}{\qy} = - \lp \ww s \rp^2 \UU \;, -\eeq -% -where coefficients $c_{ij}$ are functions of the coordinate system and -can be computed numerically for any given coordinate system mapping -\ren{mapx}-\ren{mapz}. -% -\par The acoustic wave-equation in Riemannian coordinates -\ren{rweacoustic} contains both first and second order terms, in -contrast with the normal Cartesian acoustic wave-equation which -contains only second order terms. We can construct an approximate -Riemannian wavefield extrapolation method by dropping the first-order -terms in \req{rweacoustic}. This approximation is justified by the -fact that, according to the theory of characteristics for second-order -hyperbolic equations \cite[]{courant}, the first-order terms affect -only the amplitude of the propagating waves. To preserve the -kinematics, it is sufficient to retain only the second order terms of -\req{rweacoustic}: -% -\beq \label{eqn:rwekinematic} -\czz \dtwo{\UU}{\qz} + -\cxx \dtwo{\UU}{\qx} + -\cyy \dtwo{\UU}{\qy} + -\cxy \mtwo{\UU}{\qx}{\qy} = - \lp \ww s \rp^2 \UU \;. -\eeq -% -\par From \req{rwekinematic} we can derive the following dispersion -relation of the acoustic wave-equation in Riemannian coordinates -% -\beq \label{eqn:rwedispersion} -- \czz \kqz^2 -- \cxx \kqx^2 -- \cyy \kqy^2 -- \cxy \kqx\kqy = - \lp \ww s \rp^2 \;, -\eeq -% -where $\kqz$, $\kqx$ and $\kqy$ are wavenumbers associated with the -Riemannian coordinates $\qz$, $\qx$ and $\qy$. Coefficients $\cxx$, -$\cyy$ and $\czz$ are known quantities defined using the coordinate -system mapping \ren{mapx}-\ren{mapz}. For one-way wavefield -extrapolation, we need to solve the quadratic \req{rwedispersion} for -the wavenumber of the extrapolation direction $\kqz$, and select the -solution with the appropriate sign for the desired extrapolation -direction: -% -\beq \label{eqn:rweoneway3d} -\kqz = -\sqrt{ -\frac{\lp\ww s\rp^2}{\czz} -- \frac{\cxx}{\czz}\kqx^2 -- \frac{\cyy}{\czz}\kqy^2 -- \frac{\cxy}{\czz}\kqx\kqy -}\;. -\eeq -% -The 2D equivalent of \req{rweoneway3d} takes the form: -% -\beq \label{eqn:rweoneway2d} -\kqz = -\sqrt{ -\frac{\lp\ww s\rp^2}{\czz} -- \frac{\cxx}{\czz}\kqx^2 -}\;. -\eeq -% -In ray coordinates, defined by $\qz \equiv \qt$ (propagation -time) and $\qx \equiv \qg$ (shooting angle), we can re-write -\req{rweoneway2d} as -% -\beq \label{eqn:rweoneway2d.t} -\kt = -\sqrt{ - \lp\ww s \aa\rp^2 -- \lp \frac{\aa}{\jj} \kk \rp^2 -}\;, -\eeq -% -where $\aa$ represents velocity and $\jj$ represents geometrical -spreading. The quantities $\aa$ and $\jj$ characterize the -extrapolation coordinate system: $\aa$ describes the velocity used for -construction of ray coordinate system; $\jj$ describes the spreading -or focusing of the coordinate system. In general, the velocity used -for construction of the coordinate system is different from the -velocity used for extrapolation, as suggested by -\cite{SavaFomel.geo.rwe} and illustrated later in this paper. -% -\par -We can further simplify the computations by introducing the notation -% -\beqa \label{eqn:rwea} -a &=& s \aa \;, -\\ \label{eqn:rweb} -b &=& \frac{\aa}{\jj} \;, -\eeqa -% -thus \req{rweoneway2d.t} taking the form -% -\beq \label{eqn:rwemain} -\kt = \sqrt{ \lp \ww a \rp^2 - \lp b\kk \rp^2} \;. -\eeq -% -For Cartesian coordinate systems, $\aa=1$ and $\jj=1$, \req{rwemain} -reduces to the known dispersion relation -% -\beq -k_z = \sqrt{\ww^2 s^2 - k_x^2} \;, -\eeq -% -where $k_z$ and $k_x$ are depth and position extrapolation wavenumbers. diff --git a/book/Grave/gpr2007RWEHighOrderKernels/diving/SConstruct b/book/Grave/gpr2007RWEHighOrderKernels/diving/SConstruct deleted file mode 100644 index 08fa05bea4..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/diving/SConstruct +++ /dev/null @@ -1,126 +0,0 @@ -from rsf.proj import * -import zomig,rwezo - -par = { - 'nz':250, 'dz':0.04, 'oz':0, 'lz':'z', 'uz':'km', # CC axis 1 - 'nx':400, 'dx':0.04, 'ox':0, 'lx':'x', 'ux':'km', # CC axis 2 - 'nt':1800, 'dt':0.004, 'ot':0, 'lt':'"\F10 t\F3 "', 'ut':'s', # RC axis 1 - 'ng':225, 'dg':0.04, 'og':0.5, 'lg':'x', 'ug':'km', # RC axis 2 - 'nT':2400, 'dT':0.008, 'oT':0, # time - 'tmx':10,'eps':0.0000001, 'verb':'y','nrmax':3, - 'ow':1, 'nw': 894, 'incore':'y', - 'prefix':'D-' - } - -# compute parameters -rwezo.param(par) - -# velocity -Flow('vv',None, - ''' - spike - n1=%(nz)d o1=%(oz)g d1=%(dz)g - n2=%(nx)d o2=%(ox)g d2=%(dx)g | - math output="2.5+0.15*x1-0.20*x2" | - scale rscale=-1 | - add add=10 | - clip clip=9.5 | - add add=-10 | - scale rscale=-1 - ''' % par) - -Flow('va',None, - ''' - spike nsp=2 mag=0,0 - n1=%(nz)d o1=%(oz)g d1=%(dz)g k1=100,200 l1=150,250 - n2=%(nx)d o2=%(ox)g d2=%(dx)g k2=100,100 l2=150,150 | - smooth rect1=126 rect2=126 | - smooth rect1=126 rect2=126 | - scale axis=123 - ''' % par) -Flow('vb',None, - ''' - spike nsp=1 mag=-0.25 - n1=%(nz)d o1=%(oz)g d1=%(dz)g k1=125 l1=150 - n2=%(nx)d o2=%(ox)g d2=%(dx)g k2=160 l2=170 | - smooth rect1=41 rect2=41 | - scale axis=123 - ''' % par) -Flow('vel','vv vb', - ''' - math - a=${SOURCES[0]} - b=${SOURCES[1]} - output="a+b" - ''') -Plot('vel',rwezo.cgrey('allpos=y bias=1',par)) - -# smooth velocity for HWT -Flow('vsm','vv','smooth') - -# ------------------------------------------------------------ -# wavefronts by HWT - -Flow('mzs',None,'spike nsp=1 mag=0 n1=%(ng)d d1=%(dg)g o1=%(og)g | math output="0"' % par) -Flow('mxs',None,'spike nsp=1 mag=0 n1=%(ng)d d1=%(dg)g o1=%(og)g | math output="x1"' % par) -Flow('mrs',None,'spike nsp=1 mag=0 n1=%(ng)d d1=%(dg)g o1=%(og)g | math output="1"' % par) -Flow('sou','mxs mzs','cat axis=2 space=n ${SOURCES[1]} | transp | dd type=complex | window') - -Flow('hwt','vsm sou', - ''' - hwtex verb=n sou=${SOURCES[1]} - nt=%(nt)d ot=%(ot)g dt=%(dt)g - ''' % par) - -# coordinate system: rays(g,t) -Flow('cos','hwt','window min2=%(ot)g n2=%(nt)d' % par) - -# coordinate system plot -rwezo.cos('cos',40,100,'plotcol=0',par) -Result(par['prefix']+'cos' % par,'vel cos','Overlay') - -# slowness -rwezo.slow('sloCC','sloRC','vel','cos',par) -Result(par['prefix']+'sloRC','sloRC','transp |' % par - + rwezo.rgrey('pclip=100 allpos=y bias=0.12',par)) - -# ------------------------------------------------------------ -# coordinate system coefficients (A,B,M=mask) and references (A,B) -rwezo.abm('abmRC','abrRC','sloRC','cos',par) -rwezo.abmplot('abmRC',par) - -# ------------------------------------------------------------ -# time data CC: (t,x) -Flow('datCC',None, - ''' - spike nsp=3 mag=1,1,1 - n1=%(nT)d o1=%(oT)g d1=%(dT)g k1=500,1000,1500 - n2=%(nx)d o2=%(ox)g d2=%(dx)g k2=75 l2=225 | - ricker1 frequency=5 | - smooth rect2=51 | - put label1=t label2=x - ''' % par ) -Result(par['prefix']+'datCC' % par,'datCC','grey pclip=100 wanttitle=n') - -# ------------------------------------------------------------ -# frequency data RC: (g,w) -rwezo.frq('frqRC','frqCC','datCC','cos',par) - -# ------------------------------------------------------------ -# WEM image CC: (z,x) -zomig.image('imgCC','sloCC','frqCC',par) - -# ------------------------------------------------------------ -# RWE image -rwezo.mig('migCC','migRC','frqRC','abmRC','abrRC','cos',par) -# rwezo.mod('modCC','modRC','migRC','abmRC','abrRC','cos',par) - -# ------------------------------------------------------------ -# PLOTS -rwezo.plots(par) - -Plot('imgCC-bp','imgCC','window | transp | bandpass fhi=3|' - + rwezo.cgrey('pclip=100',par)) -Result(par['prefix']+'imgCC-bp',['imgCC-bp','cos'],'Overlay') - -End() diff --git a/book/Grave/gpr2007RWEHighOrderKernels/examples.tex b/book/Grave/gpr2007RWEHighOrderKernels/examples.tex deleted file mode 100644 index a08cac049c..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/examples.tex +++ /dev/null @@ -1,167 +0,0 @@ -\def\COSlabel{Velocity map and Riemannian coordinate system} -\def\RWElabel{ -Migration impulse responses in Riemannian coordinates. -(a) Extrapolation with the $15^\circ$ finite-differences equation. -(c) Extrapolation with the $60^\circ$ finite-differences equation. -(b) Extrapolation with the pseudo-screen (PSC) equation. -(d) Extrapolation with the Fourier finite-differences (FFD) equation. -} -\def\CARlabel{ -Migration impulse responses in Riemannian coordinates after mapping to Cartesian coordinates. -(a) Extrapolation with the $15^\circ$ finite-differences equation. -(c) Extrapolation with the $60^\circ$ finite-differences equation. -(b) Extrapolation with the pseudo-screen (PSC) equation. -(d) Extrapolation with the Fourier finite-differences (FFD) equation. -} - -\def\ABlabel{ -Coordinate system coefficients defined in \reqs{rwea} and \ren{rweb}. -(a) Parameter $a=s \aa$ in ray coordinates. -(b) Parameter $b=\aa/\jj$ in ray coordinates. -} - -\def\COMPlabel{ -Comparison of extrapolation in Cartesian and Riemannian coordinates. -(a) Split-step Fourier extrapolation in Cartesian coordinates. -(b) Split-step Fourier extrapolation in Riemannian coordinates. -} - -% ------------------------------------------------------------ - -\section{Examples} -We illustrate the higher-order RWE extrapolators with impulse -responses for two synthetic models. -\par -The first example is based on the Marmousi model -\cite[]{TLE13-09-09270936}. We construct the coordinate system by ray -tracing from a point source at the surface in a smooth version of the -real velocity model. \rFg{M-cos} shows the velocity model with the -coordinate system overlaid, and \rFgs{M-abmRCa}-\rfn{M-abmRCb} show -the coordinate system coefficients $a$ and $b$ defined in \reqs{rwea} -and \ren{rweb}. -%% -\inputdir{marm} -\plot*{M-cos}{width=0.80\textwidth} -{\COSlabel~for the Marmousi example.} -%% -\multiplot{2}{M-abmRCa,M-abmRCb} -{angle=0,width=0.45\textwidth} -{\ABlabel} -%% -\par -The goal of this test model is to illustrate the higher-order -extrapolation kernels in a fairly complex model using a simple -coordinate system. In this way, the coordinate system and the real -direction of wave propagation depart from one-another, thus accurate -extrapolation requires higher order kernels. The coordinate system is -constructed from a point at the location of the wave source. This -setting is similar to the case of extrapolation from a point source in -Cartesian coordinates, where high-angle -\footnote{ -If the extrapolation axis is time, the meaning of higher angle -accuracy is not well defined. We can use this terminology to associate -the mathematical meaning of the approximation for the square-root by -analogy with the Cartesian equivalents. } propagation requires -high-order kernels. -\par -\rFgs{M-migRC-F15}-\rfn{M-migRC-FFD} show impulse responses for a -point source computed with various extrapolators in ray coordinates -($\qt$ and $\qg$). Panels (a) and (c) show extrapolation with the -$15^\circ$ and $60^\circ$, respectively. Panels (b) and (d) show -extrapolation with the pseudo-screen (PSC) equation, and the Fourier -finite-differences (FFD) equation, respectively. All plots are -displayed in ray coordinates. We can observe that the angular accuracy -of the extrapolator improves for the more accurate extrapolators. The -finite-differences solutions (panels a and c) show the typical -behavior of such solutions for the $15^\circ$ and $60^\circ$ equations -(e.g. the cardioid for $60^\circ$), but in the more general setting -of Riemannian extrapolation. The mixed-domain extrapolators (panels b -and d) are more accurate the finite-differences extrapolators. The -main differences occur at the highest propagation angles. As for the -case of Cartesian extrapolation, the most accurate kernel of those -compared is the equivalent of Fourier finite-differences. -\par -\rFgs{M-migCC-F15}-\rfn{M-migCC-FFD} show the corresponding plots -in \rFgs{M-migRC-F15}-\rfn{M-migRC-FFD} mapped in the physical -coordinates. The overlay is an outline of the extrapolation coordinate -system. After re-mapping to the physical space, the comparison of -high-angle accuracy for the various extrapolators is more apparent, -since it now has physical meaning. -\par -\rFgs{M-imgCC}-\rfn{M-migCC-SSF} show a side-by-side comparison of -equivalent extrapolators in Riemannian and Cartesian coordinates. The -impulse response in \rFg{M-imgCC} shows the limits of Cartesian -extrapolation in propagating waves correctly up to $90^\circ$. The -Riemannian extrapolator in \rFg{M-migCC-SSF} handles much better waves -propagating at high angles, including energy that is propagating -upward relative to the physical coordinates. -%% -\multiplot{4}{M-migRC-F15,M-migRC-PSC,M-migRC-F60,M-migRC-FFD} -{angle=0,width=0.45\textwidth}{\RWElabel} -%% -\multiplot{4}{M-migCC-F15,M-migCC-SSF,M-migCC-F60,M-migCC-FFD} -{angle=0,width=0.45\textwidth}{\CARlabel} -%% -\multiplot{2}{M-imgCC,M-migCC-SSF} -{angle=0,width=0.80\textwidth}{\COMPlabel} -% ------------------------------------------------------------ - -% ------------------------------------------------------------ -The second example is based on a model with a large lateral gradient -which makes an incident plane wave overturn. A small Gaussian anomaly, -not used in the construction of the coordinate system, forces the -propagating wave to triplicate and move at high angles relative to the -extrapolation direction. \rFg{D-cos} shows the velocity model with the -coordinate system overlaid. \rFgs{D-abmRCa}-\rfn{D-abmRCb} show the -coordinate system coefficients, $a$ and $b$ defined in \reqs{rwea} and -\ren{rweb}. -%% -\inputdir{diving} -\plot{D-cos}{width=0.80\textwidth} -{\COSlabel~for the large-gradient model experiment.} -%% -\multiplot{2}{D-abmRCa,D-abmRCb} -{angle=0,width=0.45\textwidth}{\ABlabel} -%% -\par -The goal of this model is to illustrate Riemannian wavefield -extrapolation in a situation which cannot be handled correctly by -Cartesian extrapolation, no matter how accurate an extrapolator we -use. In this example, an incident plane wave is overturning, thus -becoming evanescent for the solution constructed in Cartesian -coordinates. Furthermore, the Gaussian anomaly shown in \rFg{D-abmRCa} -causes wavefield triplication, thus requiring high-order kernels for -the Riemannian extrapolator. -\par -\rFgs{D-migRC-F15}-\rfn{D-migRC-FFD} show impulse responses for an -incident plane wave computed with various extrapolators in ray -coordinates ($\qt$ and $\qg$). Panels (a) and (c) show extrapolation -with the $15^\circ$ and $60^\circ$ finite-differences equations, -respectively. Panel (b) and (d) show extrapolation with the -pseudo-screen (PSC) equation and the Fourier finite-differences (FFD) -equation, respectively. All plots are displayed in ray coordinates. As -for the preceding example, we observe higher angular accuracy as we -increase the order of the extrapolator. The equivalent FFD -extrapolator shows the highest accuracy of all tested extrapolators. -\par -As in the preceding example, \rFgs{D-migCC-F15}-\rfn{D-migCC-FFD} show -the corresponding plots in \rFgs{D-migRC-F15}-\rfn{D-migRC-FFD} mapped -in the physical coordinates. The overlay is an outline of the -extrapolation coordinate system. -\par -Finally, \rfgs{D-imgCC-bp} and \rfn{D-migCC-SSF} show a side-by-side -comparison of equivalent extrapolators in Riemannian and Cartesian -coordinates. The impulse response in \rFg{D-imgCC-bp} clearly shows -the failure of the Cartesian extrapolator in propagating waves -correctly even up to $90^\circ$. The Riemannian extrapolator in -\rFg{D-migCC-SSF} handles much better overturning waves, including -energy that is propagating upward relative to the vertical direction. -%% -\multiplot{4}{D-migRC-F15,D-migRC-PSC,D-migRC-F60,D-migRC-FFD} -{angle=0,width=0.45\textwidth}{\RWElabel} -%% -\multiplot{4}{D-migCC-F15,D-migCC-PSC,D-migCC-F60,D-migCC-FFD} -{angle=0,width=0.45\textwidth}{\CARlabel} -%% -\multiplot{2}{D-imgCC-bp,D-migCC-SSF} -{angle=0,width=0.80\textwidth}{\COMPlabel} diff --git a/book/Grave/gpr2007RWEHighOrderKernels/extrapolators.tex b/book/Grave/gpr2007RWEHighOrderKernels/extrapolators.tex deleted file mode 100644 index bda9fde7a4..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/extrapolators.tex +++ /dev/null @@ -1,138 +0,0 @@ -% ------------------------------------------------------------ -\section{Space-domain finite-differences} -Starting from \req{rwemain}, -based on the Muir expansion for the square-root -\cite[]{Claerbout.iei}, -we can write successively: -\beqa -\kt &=& \ww a \sqrt{1- \xxs} -\\ - &\approx& \ww a \lb 1- \frac{ \co\xxs} - {1-\ct\xxs} \rb -\\ - &\approx& \ww a - \ww \frac{ \co a \bas \yys } - {1-\ct \bas \yys } \;. -\eeqa -If we make the notations -\beqa -\nu &=& - \co a \bas \;, -\\ -\mu &=& 1 \;, -\\ -\ro &=& \ct \bas \;. -\eeqa -we obtain the finite-differences solution to the -one-way wave equation in Riemannian coordinates: -\beq -\kt \approx \ww a + \ww \frac{ \nu \yys } - {\mu-\ro \yys } \;. -\eeq - -% ------------------------------------------------------------ -\section{Mixed domain --- pseudo-screen} -The pseudo-screen solution to \req{rwemain} -derives from a first-order expansion of the square-root -around $\ao$ and $\bo$ which are reference values for the -medium characterized by the parameters $a$ and $b$: -\beq -\kt \approx \kto + \left. \done{\kt}{a} \right|_{\ao,\bo} \lp a-\ao \rp - + \left. \done{\kt}{b} \right|_{\ao,\bo} \lp b-\bo \rp \;. -\eeq -The partial derivatives relative to $a$ and $b$, respectively, are: -\beqa -\left. \done{\kt}{a} \right|_{\ao,\bo} - &=& \ww \frac{1}{\sqrt{1-\xos}} - \approx \ww \lb 1+ \frac{ \co\xos} - {1-3\ct\xos}\rb \;, -\\ -\left. \done{\kt}{b} \right|_{\ao,\bo} - &=& -\ww\bao \yys \frac{1}{\sqrt{1-\xos}} - \approx -\ww\frac{\ao}{\bo} \xos \;. -\eeqa -Therefore, the pseudo-screen equation becomes -\beq -\kt \approx \kto + \ww \lp a-\ao \rp + - \ww \frac{\ao \lb \co \lp \frac{a}{\ao}-1 \rp - \lp \frac{b}{\bo}-1 \rp\rb \baos \yys} - {1-3\ct\baos \yys} \;. -\eeq -If we make the notations -\beqa -\nu &=& \ao \lb \co \lp \frac{a}{\ao}-1 \rp - \lp \frac{b}{\bo}-1 \rp\rb \baos -\\ -\mu &=& 1 -\\ -\ro &=& 3\ct\baos -\eeqa -we obtain the mixed-domain pseudo-screen solution to the -one-way wave equation in Riemannian coordinates: -\beq -\kt \approx \kto + \ww \lp a-\ao \rp + - \ww \frac{ \nu \yys } - {\mu-\ro \yys } \;. -\eeq - -% ------------------------------------------------------------ -\section{Mixed domain --- Fourier finite-differences} -The pseudo-screen solution to \req{rwemain} -derives from a fourth-order expansion of the square-root -around $(\ao,\bo)$ and $(a,b)$: -\beqa \label{eqn:rweffdexpansion} -\kt &\approx& \ww a \lb 1+\hf \xxs + \ei \xxf \rb \;, -\\ \label{eqn:rweffdexpansionbak} -\kto &\approx& \ww \ao \lb 1+\hf \xos + \ei \xof \rb \;. -\eeqa -% -If we subtract \reqs{rweffdexpansion} and \ren{rweffdexpansionbak}, we -obtain the following expression for the wavenumber along the -extrapolation direction $\kt$: -% -\beqa \label{eqn:rweffddiff} -\kt \approx \kto + \ww \lp a-\ao \rp - &+&\hf\ww \lb a\bas - \ao \baos \rb \yys \nonumber \\ - &+&\ei\ww \lb a\baf - \ao \baof \rb \yyf \;. -\eeqa -We can make the notations -\beqa -\delta_1 &=& a\bas - \ao \baos \;, -\\ -\delta_2 &=& a\baf - \ao \baof \;, -\eeqa -therefore \req{rweffddiff} can be written as -\beq -\kt = \kto + \ww \lp a-\ao \rp -+ \hf\ww \delta_1 \yys -+ \ei\ww \delta_2 \yyf \;. -\eeq -\par -Using the approximation -\beq -\hf \delta_1 u^2 + \ei \delta_2 u^4 \approx -\frac{ \hf\delta_1^2 u^2} - {\delta_1-\qu\delta_2 u^2} \;, -\eeq -we can write -\beq -\kt = \kto + \ww \lp a-\ao \rp -+\ww \frac{ \hf\delta_1^2 \yys} - {\delta_1-\qu\delta_2 \yys} \;. -\eeq - -If we make the notations -\beqa -\nu &=& \hf\delta_1^2 \;, -\\ -\mu &=& \delta_1 \;, -\\ -\ro &=& \qu\delta_2 \;, -\eeqa -% -we obtain the mixed-domain Fourier finite-differences solution to the -one-way wave equation in Riemannian coordinates: -% -\beq -\kt \approx \kto + \ww \lp a-\ao \rp + - \ww \frac{ \nu \yys } - {\mu-\ro \yys } \;. -\eeq - - diff --git a/book/Grave/gpr2007RWEHighOrderKernels/introduction.tex b/book/Grave/gpr2007RWEHighOrderKernels/introduction.tex deleted file mode 100644 index bcac67b583..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/introduction.tex +++ /dev/null @@ -1,77 +0,0 @@ -\section{Introduction} -Riemannian wavefield extrapolation \cite[]{SavaFomel.geo.rwe} -generalizes solutions to the Helmholtz equation in general Riemannian -coordinate systems. Conventionally, the Helmholtz equation is solved -in Cartesian coordinates which represent special cases of Riemannian -coordinates. The main requirements imposed on the Riemannian -coordinate systems are that they maintain orthogonality between the -extrapolation coordinate and the other coordinates (2 in 3D, 1 in -2D). This requirement can be relaxed when using an even more general -form of RWE in non-orthogonal coordinates -\cite[]{Shragge.geo.nonlinear}. In addition, it is desirable that the -coordinate system does not triplicate, although numerical methods can -stabilize extrapolation even in such situations -\cite[]{SavaFomel.geo.rwe}. Thus, wavefield extrapolation in -Riemannian coordinates has the flexibility to be used in many -applications where those basic conditions are fulfilled. Cartesian -coordinate systems, including tilted coordinates, are special cases of -Riemannian coordinate systems. -% -\par Two straightforward applications of wave propagation in -Riemannian coordinates are extrapolation in a coordinate system -created by ray tracing in a smooth background velocity -\cite[]{SavaFomel.geo.rwe}, and extrapolation with a coordinate system -created by conformal mapping of a given geometry to a regular space, -for example migration from topography \cite[]{ShraggeSava.segab.2005}. -% -\par Coordinate systems created by ray tracing in a background medium -often well represent wavefield propagation. In this context, we -effectively split wave propagation effects into two parts: one part -accounting for the general trend of wave propagation, which is -incorporated in the coordinate system, and the other part accounting -for the details of wavefield scattering due to rapid velocity -variations. If the background medium is close to the real one, the -wave-propagation can be properly described with low-order -operators. However, if the background medium is far from the true one, -the wavefield departs from the general direction of the coordinate -system and the low-order extrapolators are not enough for accurate -description of wave propagation. -% -\par For coordinate system describing a geometrical property of the -medium (e.g. migration from topography), there is no guarantee that -waves propagate in the direction of extrapolation. This situation is -similar to that of Cartesian coordinates when waves propagate away -from the vertical direction, except that conformal mapping gives us -the flexibility to define any coordinates, as required by -acquisition. In this case, too, low-order extrapolators are not enough -for accurate description of wave propagation. -% -\par Therefore, there is need for higher-order Riemannian wavefield -extrapolators in order to handle correctly waves propagating obliquely -relative to the coordinate system. Usually, the high-order -extrapolators are implemented as mixed operators, part in the Fourier -domain using a reference medium, part in the space domain as a -correction from the reference medium. Many methods have been developed -for high-order extrapolation in Cartesian coordinates. In this paper, -we explore some of those extrapolators in Riemannian coordinates, in -particular high-order finite-differences solutions -\cite[]{Claerbout.iei}, and methods from the pseudo-screen family -\cite[]{GEO64-05-15241534} and Fourier finite-differences family -\cite[]{GEO59-12-18821893,GEO67-03-08720882}. In theory, any other -high-order extrapolator developed in Cartesian coordinates can have a -correspondent in Riemannian coordinates. -% -\par In this paper, we implement the finite-differences portion of the -high-order extrapolators with implicit methods. Such solutions are -accurate and robust, but they face difficulties for 3D implementations -because the finite-differences part cannot be solved by fast -tridiagonal solvers anymore and require more complex and costlier -approaches \cite[]{GEO63-05-15321541,SEG-1998-1124}. The problem of 3D -wavefield extrapolation is addressed in Cartesian coordinates either -by splitting the one-way wave-equation along orthogonal directions -\cite[]{GEO62-02-05540567}, or by explicit numerical solutions -\cite[]{GEO56-11-17701777}. Similar approaches can be employed for 3D -Riemannian extrapolation. The explicit solution seems more -appropriate, since splitting is difficult due to the mixed terms of -the Riemannian equations. In this paper, we concentrate our attention -to higher-order kernels implemented with implicit methods. diff --git a/book/Grave/gpr2007RWEHighOrderKernels/macro.tex b/book/Grave/gpr2007RWEHighOrderKernels/macro.tex deleted file mode 100644 index bfb5846bb2..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/macro.tex +++ /dev/null @@ -1,295 +0,0 @@ -\def\K#1{\overline{#1}} - -% greek letters (angles,frequency, vp/vs) -\def\w{\omega} -\def\g{\gamma} -\def\t{\theta} -\def\d{\delta} -\def\p{\phi} - -% image, wavefield -\def\RR{{ \bf R}} -\def\US{{ \bf U}_s} -\def\UR{{ \bf U}_r} -\def\UU{{ \bf U}} - -\def\UO{{ \widehat{\bf U}}} - -\def\us{{ \bf u}_s} -\def\ur{{ \bf u}_r} -\def\uu{{ \bf u}} - -\def\uo{{ \widehat{\bf u}}} - -% coordinates -\def\ss{{ \bf s}} -\def\rr{{ \bf r}} -\def\mm{{ \bf m}} -\def\hh{{ \bf h}} - -\def\mo{{ \widehat{\bf m}}} -\def\ho{{ \widehat{\bf h}}} - -% vectors -\def\vv{{ \bf v}} % arbitrary vector (e.g. magnetic North) -\def\nn{{ \bf n}} % normal to reflector - -% wavenumbers -\def\ksv{{ \bf k}_\ss} -\def\krv{{ \bf k}_\rr} -\def\kmv{{ \bf k}_\mm} -\def\khv{{ \bf k}_\hh} - -% ray parameters -\def\psv{{ \bf p}_\ss} -\def\prv{{ \bf p}_\rr} -\def\pmv{{ \bf p}_\mm} -\def\phv{{ \bf p}_\hh} - -% vector magnitude -\def\mps{|\psv|} -\def\mpr{|\prv|} -\def\mpm{|\pmv|} -\def\mph{|\phv|} - -\def\mks{|\ksv|} -\def\mkr{|\krv|} -\def\mkm{|\kmv|} -\def\mkh{|\khv|} - -% components -\def\mv{ \left[ m_x,m_y,m_z \right]} -\def\hv{ \left[ h_x,h_y,h_z \right]} -\def\sv{ \left[ s_x,s_y,s_z \right]} -\def\rv{ \left[ r_x,r_y,r_z \right]} - -\def\kmx{ k_{m_x}} -\def\kmy{ k_{m_y}} -\def\kmz{ k_{m_z}} - -\def\khx{ k_{h_x}} -\def\khy{ k_{h_y}} -\def\khz{ k_{h_z}} - -\def\tt{{ \tau}} - -\def\mvv{|\vv|} - -% METRIC TENSOR -\def\gvec{\boldsymbol g} - -% DATA, WAVEFIELD, IMAGE -\def\UU{\mathcal{U}} -\def\WW{\mathcal{W}} -\def\VV{\mathcal{V}} -\def\DD{\mathcal{D}} % data -\def\RR{\mathcal{R}} % image -\def\PP{\mathcal{P}} % angle gather -\def\HH{\mathcal{H}} % offset gather -\def\TT{\mathcal{T}} - -\def\DELTA{\Delta} -\def\DEL{\Delta} -\def\dU{\DEL\UU} -\def\dV{\DEL\VV} -% COORDINATES -\def\xx{x} % Cartesian x -\def\yy{y} % Cartesian y -\def\zz{z} % Cartesian z -\def\xvec{\boldsymbol \xx } % Cartesian generic -\def\xone{ \xx_1} -\def\xtwo{ \xx_2} -\def\xthr{ \xx_3} -\def\ofx {\lp \zz,\xx,\yy \rp} - -\def\atzo{_{\zz}} -\def\atzz{_{\zz+\DEL \zz}} - -\def\qx{\xi} % Riemannian x -\def\qy{\eta} % Riemannian y -\def\qz{\zeta} % Riemannian z -\def\qt{\tau} % -\def\qg{\gamma} % -\def\qf{\phi} % -\def\qvec{\boldsymbol \qx } % Riemannian generic -\def\qone{ \qx_1} -\def\qtwo{ \qx_2} -\def\qthr{ \qx_3} -\def\ofq {\lp \qz,\qx,\qy \rp} -\def\oft {\lp \qt,\qg \rp} - -\def\hh{h} -\def\hvec{\boldsymbol \hh} -\def\mm{m} -\def\mvec{\boldsymbol \mm} - - -% infinitesimal steps -\def\dz{\DEL\zz} - -% Riemannian coefficients -\def\cxx{c_{\qx\qx}} -\def\cx {c_{\qx }} -\def\cyy{c_{\qy\qy}} -\def\cy {c_{\qy }} -\def\czz{c_{\qz\qz}} -\def\cz {c_{\qz }} -\def\cxy{c_{\qx\qy}} - -%%\def\ctt{c_{\qt\qt}} -%%\def\ct {c_{\qt }} -%%\def\cgg{c_{\qg\qg}} -%%\def\cg {c_{\qg }} - -\def\ctt{a} -\def\ct {b} -\def\cgg{d} -\def\cg {c} - -% FOURIER COORDINATES -\def\kzz{k_\zz} -\def\kxx{k_\xx} -\def\kyy{k_\yy} -\def\kqz{k_\qz} -\def\kqx{k_\qx} -\def\kqy{k_\qy} -\def\kqt{k_\qt} -\def\kqg{k_\qg} -\def\khh{k_\hh} - -\def\nqt{n_\qt} -\def\nqg{n_\qg} - -% -\def\ww{\omega} % frequency - -% DATA, WAVEFIELD, IMAGE -\def\UU{\mathcal{U}} -\def\WW{\mathcal{W}} -\def\VV{\mathcal{V}} -\def\DD{\mathcal{D}} % data -\def\RR{\mathcal{R}} % image -\def\PP{\mathcal{P}} % angle gather -\def\HH{\mathcal{H}} % offset gather -\def\TT{\mathcal{T}} - -\def\dU{\DEL\UU} -\def\dV{\DEL\VV} - -\def\kt{k_\tau} -\def\kk{k_\gamma} -\def\kto{{\kt}_0} -\def\ao{a_0} -\def\bo{b_0} - -\def\aa{\alpha} -\def\jj{J} - -\def\hf{\frac{1}{2}} -\def\ih{\frac{i}{2}} -\def\qu{\frac{1}{4}} -\def\ei{\frac{1}{8}} -\def\iq{\frac{i}{4}} - -\def\ro{\rho} - -\def\xx{ \frac{b \kk}{a \ww} } -\def\xo{ \frac{b_0\kk}{a_0 \ww} } -\def\yy{ \frac{ \kk}{ \ww} } - -\def\xxs{\lp\xx\rp^2} -\def\xxf{\lp\xx\rp^4} -\def\xos{\lp\xo\rp^2} -\def\xof{\lp\xo\rp^4} -\def\yys{\lp\yy\rp^2} -\def\yyf{\lp\yy\rp^4} - -\def\ba {\frac{b }{a }} -\def\bas {\lp\ba\rp^2} -\def\baf {\lp\ba\rp^4} -\def\bao {\frac{b_0}{a_0}} -\def\baos{\lp\bao\rp^2} -\def\baof{\lp\bao\rp^4} - -\def\co{c_1} -\def\ct{c_2} - -\def\nz{\nu_0} -\def\mz{\mu_0} -\def\rz{\rho_0} - -\def\nh{\hat{\nu }} -\def\mh{\hat{\mu }} -\def\rh{\hat{\rho}} - -\def\rx{\lp \rs+\beta\ms \rp} - -% WAVEFIELD DISCRETIZATION -\def\Upo{\UU^{\qg+1}_{\qt}} -\def\Uoo{\UU^{\qg} _{\qt}} -\def\Umo{\UU^{\qg-1}_{\qt}} - -\def\Up {\UU^{\qg+1}_{\qt+1}} -\def\Uo {\UU^{\qg} _{\qt+1}} -\def\Um {\UU^{\qg-1}_{\qt+1}} - -% FD stars -\def\star__z{ -\begin{tabular}{|c|} \hline -$+1$ \\ \hline -$-1$ \\ \hline -\end{tabular} -} -\def\starxx_{ -\begin{tabular}{|c|c|c|} \hline - $+1$ & $-2$ & $+1$ \\ \hline - $+1$ & $-2$ & $+1$ \\ \hline -\end{tabular} -} -\def\starxxz{ -\begin{tabular}{|c|c|c|} \hline -$+1$ & $-2$ & $+1$ \\ \hline -$-1$ & $+2$ & $-1$ \\ \hline -\end{tabular} -} - - -\def\starA{ -\begin{tabular}{|c|} \hline - $+\mh$ \\ \hline - $-\mh$ \\ \hline -\end{tabular} -} -\def\starB{ -\begin{tabular}{|c|c|c|} \hline - $-\rh-i\nh$ & $ 2\lb+\rh+i\nh\rb$ & $-\rh-i\nh$ \\ \hline - $+\rh-i\nh$ & $ 2\lb-\rh+i\nh\rb$ & $+\rh-i\nh$ \\ \hline -\end{tabular} -} -%%\def\starC{ -%%\begin{tabular}{|c|c|c|} \hline -%% $\nu- o -\ro$ & $-2(\nu- o -\ro$) & $\nu- o -\ro$ \\ \hline -%% $\nu+ o +\ro$ & $-2(\nu+ o +\ro$) & $\nu+ o +\ro$ \\ \hline -%%\end{tabular} -%%} - -\def\Ltwo{ -\begin{tabular}{|c|c|c|} \hline -$+\rh+i\nh$ & $\mh+2\lb-\rh-i\nh\rb$ & $+\rh+i\nh$ \\ \hline -\end{tabular} -} -\def\Rtwo{ -\begin{tabular}{|c|c|c|} \hline -$+\rh-i\nh$ & $\mh-2\lb+\rh-i\nh\rb$ & $+\rh-i\nh$ \\ \hline -\end{tabular} -} -%%\def\Lthr{ -%%\begin{tabular}{|c|c|c|} \hline -%%$-\nu+ o +\ro$ & $\mu+2(\nu- o -\ro)$ & $-\nu+ o +\ro$ \\ \hline -%%\end{tabular} -%%} -%%\def\Rthr{ -%%\begin{tabular}{|c|c|c|} \hline -%%$+\nu+ o +\ro$ & $\mu-2(\nu+ o +\ro)$ & $+\nu+ o +\ro$ \\ \hline -%%\end{tabular} -%%} diff --git a/book/Grave/gpr2007RWEHighOrderKernels/marm/SConstruct b/book/Grave/gpr2007RWEHighOrderKernels/marm/SConstruct deleted file mode 100644 index 694f8d6b3a..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/marm/SConstruct +++ /dev/null @@ -1,95 +0,0 @@ -from rsf.proj import * -import zomig,rwezo - -par = { - 'nz':751, 'dz':0.004,'oz':0, 'lz':'z', 'uz':'km', # CC axis 1 - 'nx':1500, 'dx':0.004,'ox':2, 'lx':'x', 'ux':'km', # CC axis 2 - 'nt':550, 'dt':0.002,'ot':0, 'lt':'"\F10 t\F3 "','ut':'s', # RC axis 1 - 'ng':512, 'dg':0.350,'og':-89.6, 'lg':'"\F10 g\F3 "','ug':'"\^o\_"', # RC axis 2 - 'nT':1250, 'dT':0.002,'oT':0, 'kT':1000, # time - 'tmx':10,'eps':0.0000001, 'verb':'y','nrmax':1, - 'ow':1, 'nw': 275, 'incore':'y', - 'spx':750, - 'prefix':'M-' - } - -# compute parameters -rwezo.param(par) - -Fetch('marmvel.hh','marm') - -# true velocity -Flow('vel','marmvel.hh', - ''' - dd form=native | - window min2=2000 n2=1500 | - smooth rect1=5 rect2=5 | - scale rscale=0.001 | - put label1=z label2=x - o1=%(oz)g d1=%(dz)g - o2=%(ox)g d2=%(dx)g - ''' % par) -Plot('vel',rwezo.cgrey('allpos=y',par)) - -# smooth velocity for HWT -Flow('vsm','vel','smooth rect1=201 rect2=201') - -# ------------------------------------------------------------ -# wavefronts (by HWT) -Flow('hwt','vsm', - ''' - hwt2d verb=n xsou=5 zsou=0 - nt=%(nt)d ot=%(ot)g dt=%(dt)g - ng=%(ng)d og=%(og)g dg=%(dg)g - ''' % par) - -# coordinate system: rays(g,t) -Flow('cos','hwt','window min2=%(ot)g n2=%(nt)d' % par) - -# coordinate system plot -rwezo.cos('cos',40,40,'plotcol=0',par) -Result(par['prefix']+'cos' % par,'vel cos','Overlay') - -# slowness -rwezo.slow('sloCC','sloRC','vel','cos',par) -Result(par['prefix']+'sloRC','sloRC','transp |' % par - + rwezo.rgrey('pclip=100 allpos=y bias=0.18',par)) - -# ------------------------------------------------------------ -# coordinate system coefficients (A,B,M=mask) and references (A,B) -rwezo.abm('abmRC','abrRC','sloRC','cos',par) -rwezo.abmplot('abmRC',par) - -# ------------------------------------------------------------ -# time data CC: (t,x) -Flow('datCC',None, - ''' - spike nsp=1 mag=1 - n1=%(nT)d o1=%(oT)g d1=%(dT)g k1=%(kT)d - n2=%(nx)d o2=%(ox)g d2=%(dx)g k2=%(spx)d l2=%(spx)d | - ricker1 frequency=15 | - smooth rect2=3 | - put label1=t label2=x - ''' % par ) -Result(par['prefix']+'datCC' % par,'datCC','grey pclip=100 wanttitle=n') - -# ------------------------------------------------------------ -# frequency data RC: (g,w) -rwezo.frq('frqRC','frqCC','datCC','cos',par) - -# ------------------------------------------------------------ -# WEM image CC: (z,x) -zomig.image('imgCC','sloCC','frqCC',par) -Plot ('imgCC','window | transp |' + rwezo.cgrey('pclip=99',par)) -Result(par['prefix']+'imgCC',['imgCC','cos'],'Overlay') - -# ------------------------------------------------------------ -# RWE image -rwezo.mig('migCC','migRC','frqRC','abmRC','abrRC','cos',par) -rwezo.mod('modCC','modRC','migRC','abmRC','abrRC','cos',par) - -# ------------------------------------------------------------ -# PLOTS -rwezo.plots(par) - -End() diff --git a/book/Grave/gpr2007RWEHighOrderKernels/paper.tex b/book/Grave/gpr2007RWEHighOrderKernels/paper.tex deleted file mode 100644 index d4cd1202d4..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/paper.tex +++ /dev/null @@ -1,29 +0,0 @@ -\published{Geophysical Prospecting, 56, no 1, 49-60 (2008)} -\title{High-order kernels for Riemannian Wavefield Extrapolation} -\author{Paul Sava (Colorado School of Mines) \\ - Sergey Fomel (University of Texas at Austin)} -\email{psava@mines.edu, sergey.fomel@beg.utexas.edu} -\righthead{Riemannian wavefield extrapolation} -\lefthead{Sava and Fomel} -%\ms{GP-2006-0288} - -\maketitle - -\input{pcsmacros} -\input{macro} - -\input{abstract} -\input{introduction} -\input{dispersion} -\input{theory} -\input{examples} -\input{discussion} -\input{conclusions} -\input{acknowledgment} - -\appendix -\section{Appendix A} -\input{extrapolators} - -\bibliographystyle{seg} -\bibliography{SEG,PCS,MISC} diff --git a/book/Grave/gpr2007RWEHighOrderKernels/pcsmacros.tex b/book/Grave/gpr2007RWEHighOrderKernels/pcsmacros.tex deleted file mode 120000 index c6852e3952..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/pcsmacros.tex +++ /dev/null @@ -1 +0,0 @@ -../../cwp/pcsmacros.tex \ No newline at end of file diff --git a/book/Grave/gpr2007RWEHighOrderKernels/theory.tex b/book/Grave/gpr2007RWEHighOrderKernels/theory.tex deleted file mode 100644 index 1c8488716f..0000000000 --- a/book/Grave/gpr2007RWEHighOrderKernels/theory.tex +++ /dev/null @@ -1,159 +0,0 @@ -\section{Extrapolation kernels} -Extrapolation using \req{rwemain} implies that the coefficients -defining the problem, $a$ and $b$, are not changing spatially. In this -case, we can perform extrapolation using a simple phase-shift -operation -% -\beq -\UU_{\tt+\Delta\tt} = \UU_{\tt} e^{i \kt \Delta\tt} \;, -\eeq -% -where $\UU_{\qt+\Delta\qt}$ and $\UU_{\qt}$ represent the acoustic -wavefield at two successive extrapolation steps, and $\kt$ is the -extrapolation wavenumber defined by \req{rwemain}. \par For media -with lateral variability of the coefficients $a$ and $b$, due to -either velocity variation or focusing/defocusing of the coordinate -system, we cannot use in extrapolation the wavenumber computed -directly using \req{rwemain}. Like for the case of extrapolation in -Cartesian coordinates, we need to approximate the wavenumber $\kt$ -using expansions relative to $a$ and $b$. Such approximations can be -implemented in the space-domain, in the Fourier domain or in mixed -space-Fourier domains. - -\subsection{Space-domain extrapolation} -The space-domain finite-differences solution to \req{rwemain} is -derived based on a square-root expansion as suggested by Francis Muir -\cite[]{Claerbout.iei}: -% -\beq \label{eqn:rwexfd} -\kt \approx \ww a + \ww \frac{ \nu \yys } - {\mu-\ro \yys } \;, -\eeq -% -where the coefficients $\mu$, $\nu$ and $\ro$ take the form derived in Appendix A: -% -\beqa -\nu &=& - \co a \bas \;, -\\ -\mu &=& 1 \;, -\\ -\ro &=& \ct \bas \;. -\eeqa -% -In the special case of Cartesian coordinates, $a=s$ and $b=1$, -\req{rwexfd} takes the familiar form -% -\beq -\kt \approx \ww s - \ww \frac{ \frac{\co}{s} \yys } - {1 -\frac{\ct}{s^2} \yys } \;, -\eeq -% -where the coefficients $\co$ and $\ct$ take different values for -different orders of Muir's expansion: $(\co,\ct)=(0.50,0.00)$ for the -$15^\circ$ equation, and $(\co,\ct)=(0.50,0.25)$ for the $45^\circ$ -equation, etc. For extrapolation in Riemannian coordinates, the -meaning of $15^\circ$, $45^\circ$ etc is not defined. We use this -terminology here to indicate orders of accuracy comparable to the ones -defined in Cartesian coordinates. - -\subsection{Mixed-domain extrapolation} -Mixed-domain solutions to the one-way wave equation consist of -decompositions of the extrapolation wavenumber defined in -\req{rwemain} in terms computed in the Fourier domain for a reference -of the extrapolation medium, followed by a finite-differences -correction applied in the space-domain. For \req{rwemain}, a generic -mixed-domain solution has the form: -% -\beq \label{eqn:rwemixed} -\kt \approx \kto + \ww \lp a-\ao \rp + - \ww \frac{ \nu \yys } - {\mu-\ro \yys } \;, -\eeq -% -where $\ao$ and $\bo$ are reference values for the medium -characterized by the parameters $a$ and $b$, and the coefficients -$\mu$, $\nu$ and $\ro$ take different forms according to the type of -approximation. As for usual Cartesian coordinates, $\kto$ is applied -in the Fourier domain, and the other two terms are applied in the -space domain. If we limit the space-domain correction to the thin lens -term, $\ww \lp a-\ao \rp$, we obtain the equivalent of the split-step -Fourier (SSF) method \cite[]{GEO55-04-04100421} in Riemannian -coordinates. -% -\par -% -Appendix A details the derivations for two types of expansions known -by the names of pseudo-screen \cite[]{GEO64-05-15241534}, and Fourier -finite-differences \cite[]{GEO59-12-18821893,GEO67-03-08720882}. Other -extrapolation approximations are possible, but are not described here, -for simplicity. - -\begin{itemize} -\item {\bf Pseudo-screen method:} -\par -The coefficients for the pseudo-screen approximation to \req{rwemixed} are -\beqa \label{eqn:rwepsc} -\nu &=& \ao \lb \co \lp \frac{a}{\ao}-1 \rp - \lp \frac{b}{\bo}-1 \rp\rb \baos \;, -\\ -\mu &=& 1 \;, -\\ -\ro &=&3\ct\baos \;, -\eeqa -% -where $\ao$ and $\bo$ are reference values for the medium -characterized by parameters $a$ and $b$. In the special case of -Cartesian coordinates, $a=s$ and $b=1$, \req{rwemixed} with -coefficients \req{rwepsc} takes the familiar form -% -\beq -\kt \approx \kto + \ww -\lb 1+ \frac{ \frac{ \co}{s_0^2} \yys } - {1 -\frac{3\ct}{s_0^2} \yys } -\rb \lp s-s_0 \rp \;, -\eeq -% -where the coefficients $\co$ and $\ct$ take different values for -different orders of the finite-differences term: -$(\co,\ct)=(0.50,0.00)$, $(\co,\ct)=(0.50,0.25)$, etc. When -$(\co,\ct)=(0.00,0.00)$ we obtain the usual split-step Fourier -equation \cite[]{GEO55-04-04100421}. - -\item {\bf Fourier finite-differences method:} -\par -% -The coefficients for the Fourier finite-differences solution to \req{rwemixed} are -% -\beqa \label{eqn:rweffd} -\nu &=& \hf\delta_1^2 \;, -\\ -\mu &=& \delta_1 \;, -\\ -\ro &=& \qu\delta_2 \;, -\eeqa -where, by definition, -\beqa -\delta_1 &=& a\bas - \ao \baos \;, -\\ -\delta_2 &=& a\baf - \ao \baof \;. -\eeqa -% -$\ao$ and $\bo$ are reference values for the medium characterized by -the parameters $a$ and $b$. In the special case of Cartesian -coordinates, $a=s$ and $b=1$, \req{rwemixed} with coefficients -\req{rweffd} takes the familiar form: -% -\beq -\kt \approx \kto + \ww -\lb 1+ \frac{ \frac{\co}{s s_0} \yys } - {1-\ct \lp \frac{1}{s^2} + - \frac{1}{s s_0} + - \frac{1}{s_0^2} \rp \yys } -\rb \lp s-s_0 \rp \;, -\eeq -% -where the coefficients $\co$ and $\ct$ take different values for -different orders of the finite-differences term: -$(\co,\ct)=(0.50,0.00)$ for $15^\circ$, $(\co,\ct)=(0.50,0.25)$ for -$45^\circ$, etc. When $\co=\ct=0.0$ we obtain the usual split-step -Fourier equation \cite[]{GEO55-04-04100421}. -\end{itemize} \ No newline at end of file diff --git a/book/Grave/pwc/REPRO_FAIL.txt b/book/Grave/pwc/REPRO_FAIL.txt deleted file mode 100644 index 09ee32ac37..0000000000 --- a/book/Grave/pwc/REPRO_FAIL.txt +++ /dev/null @@ -1 +0,0 @@ -Testing failed for unknown reasons before May 2010. diff --git a/book/Grave/pwc/SConstruct b/book/Grave/pwc/SConstruct deleted file mode 100644 index 62e57af8a0..0000000000 --- a/book/Grave/pwc/SConstruct +++ /dev/null @@ -1,9 +0,0 @@ -from rsftex import * - -#Paper('seg2005',lclass='segabs') - -#Paper('summary',include=r'\thispagestyle{empty}',options='manuscript') - -End(color='bei-slp bei-pdxw bei-pdx cmp super') # options='twocolumn,twoside') - - diff --git a/book/Grave/pwc/beic/SConstruct b/book/Grave/pwc/beic/SConstruct deleted file mode 100644 index c104000def..0000000000 --- a/book/Grave/pwc/beic/SConstruct +++ /dev/null @@ -1,26 +0,0 @@ -from rsf.proj import * -import dix - -for case in ('agc','npk','agc2'): - rsf = 'bei-%s.rsf' % case - Fetch(rsf,'midpts') - Flow(case,rsf,'dd form=native') - -dv=0.0125 # velocity step -nv=96 # continuation steps -v0=1.3 # minimum velocity - -dix.dix('bei', # data name - 'agc', # migrated image - 'npk', # migration velocity - 'agc2', # semlance slice - v0=1.3, # minimum velocity - vm=v0+0.5*nv*dv, # median velocity - nx=250, # lateral dimension - dx=0.0335, # midpoint sampling - x0=7.705, # lateral origin - units='km', # lateral units - rect1=15, # vertical smoothing - rect2=15) # lateral smoothing - -End() diff --git a/book/Grave/pwc/cmp/SConstruct b/book/Grave/pwc/cmp/SConstruct deleted file mode 100644 index db9e2a4b3c..0000000000 --- a/book/Grave/pwc/cmp/SConstruct +++ /dev/null @@ -1,132 +0,0 @@ -from rsf.proj import * - -import os -private = {'login':os.environ.get('BEG_LOGIN'), - 'password':os.environ.get('BEG_PASSWORD'), - 'server':os.environ.get('BEG_SERVER')} - -Fetch('cmp.HH','acig',private) -Flow('cmp','cmp.HH','dd form=native | tpow tpow=2 | mutter v0=1.4 half=n') - - -def grey(title,other=''): - return ''' - grey title="%s" labelsz=10 titlesz=12 - label1="Time (s)" label2="Offset (km)" %s - ''' % (title,other) - -Plot('cmp',grey('(a) Data','clip=228')) - -# Playing with amplitude gains -############################## -Flow('env','cmp','envelope | scale axis=2') -Flow('amp','env', - ''' - math output="atan(input)" | - math output="input-sin(input)" | - add mode=d $SOURCE - ''') - -Flow('acmp','cmp amp','add mode=p ${SOURCES[1]}') -Flow('ncmp','cmp', - ''' - scale axis=2 | - math output="atan(input)" | - math output="input-sin(input)" - ''') - -# Interpolate near offsets -Flow('cmp0','cmp','window max2=1 | pad beg2=5') -Flow('cmp1','cmp0','reverse which=2 opt=n | cat axis=2 $SOURCE') -Flow('mask0','cmp','math output=1 | window max2=1 | pad beg2=5') -Flow('mask1','mask0','reverse which=2 opt=n | cat axis=2 $SOURCE') -Flow('dip1','cmp1','math output="x2*%g/(x1+0.001)" ' % (0.05/(0.004*1.5*1.5))) -Flow('dip2','cmp1 dip1 mask1', - 'twodip2 eps=100 lam=10 dip1=${SOURCES[1]} mask=${SOURCES[2]} q0=0') -Flow('mis','cmp1 dip2 mask1', - ''' - planemis2 dip=${SOURCES[1]} mask=${SOURCES[2]} verb=y prec=0 niter=10000 - ''') -Flow('mis2','mis cmp','window min2=0 n2=6 | cat axis=2 ${SOURCES[1]}') -Flow('mis3','mis2','window f2=1 | reverse which=2 opt=n | cat axis=2 $SOURCE') - -Plot('mis2','grey title="Near Offsets Interpolated" ') - -# Predict multiples -################### -Flow('ccmp','mis2','pad n1=2048 | fft1 | fft3') -Flow('mult','ccmp', - 'add mode=p $SOURCE | fft3 inv=y | fft1 inv=y | window n1=1000') -Plot('mult','window f2=6 | ' + grey('(b) SRME-predicted Multiples')) - -# Mask the important part -######################### -Flow('mask','mult', - 'math output=1 | mutter hyper=y t0=0.7 v0=2 half=n | smooth rect1=5 rect2=5') -Flow('cmp2','mask mis2','add mode=p ${SOURCES[1]}') -Flow('mult2','mask mult','add mode=p ${SOURCES[1]}') - -# Estimate dips -############### -Flow('mdip','mult2','dip rect1=20 rect2=10 liter=40 pmin=0') -Flow('vdip','cmp2', - 'math output="%g*x2/(x1+0.004)" ' % (0.05/(2.5*2.5*0.004))) -Flow('mask2','mdip','mask max=5 | dd type=float | smooth rect1=5 rect2=5') - -Flow('mdip2','cmp2 mdip mask2 vdip', - ''' - twodip2 eps=15 lam=5 dip2=${SOURCES[1]} dip1=${SOURCES[3]} mask=${SOURCES[2]} verb=y - ''') - -Flow('mdip0','mdip2','window n3=1 f2=6') -Flow('mdip1','mdip2','window f3=1 f2=6') - -Plot('mdip0', - grey('(c) Signal Slope', - 'color=j scalebar=y allpos=y clip=5 minval=0 maxval=6 barlabel="Slope (samples)" ')) -Plot('mdip1', - grey('(d) Noise Slope', - 'color=j scalebar=y allpos=y clip=5 minval=0 maxval=6 barlabel="Slope (samples)" ')) - -Result('cmp','cmp mult mdip0 mdip1','SideBySideAniso') - -Flow('pvel0','cmp mdip0','pveltran half=n v0=1 dv=0.02 nv=100 dip=${SOURCES[1]}') -Flow('pvel1','cmp mdip1','pveltran half=n v0=1 dv=0.02 nv=100 dip=${SOURCES[1]}') -Flow('pvel','pvel0 pvel1','stack | envelope') - -# Separate signal/noise -####################### -Flow('comp','cmp2 mdip2','pwdsigk dips=${SOURCES[1]} verb=y niter=10000 eps=0.01') - -Flow('nois','comp mask','window f3=1 | add mode=p ${SOURCES[1]}') -Plot('nois','window f2=6 | ' + grey('(b) Estimated Noise','clip=228')) - -Flow('sign','mis2 nois','add scale=1,-1 ${SOURCES[1]}') -Plot('sign','window f2=6 | ' + grey('(a) Estimated Signal','clip=228')) - -Flow('cmp2s','cmp2','window n2=64') -Flow('mdip2s','mdip2','window n2=64') -Flow('masks','mask','window n2=64') - -Flow('comps','cmp2s mdip2s','seisigk dips=${SOURCES[1]} verb=y niter=1000') - -Flow('noiss','comps masks','window f3=1 | add mode=p ${SOURCES[1]}') -Plot('noiss','window f2=6 | ' + grey('(b) Estimated Noise','clip=228')) - -Flow('signs','mis2 noiss','window n2=64 | add scale=1,-1 ${SOURCES[1]}') -Plot('signs','window f2=6 | ' + grey('(a) Estimated Signal','clip=228')) - -# Velocity scans before and after -################################# -for dat in ('cmp','sign'): - Flow('v'+dat,dat,'vscan semblance=y v0=1 nv=100 dv=0.02 half=n') - Plot('v'+dat,grey('(%s) Velocity Scan (%s)' % (('c','Data'),('d','Estimated Signal'))[dat=='sign'], - 'label2="Velocity (km/s)" color=j allpos=y')) - -# Final result -############## -Result('super','sign nois vcmp vsign','SideBySideAniso') - -Result('supers','signs noiss','SideBySideAniso') - -End() diff --git a/book/Grave/pwc/flat.bib b/book/Grave/pwc/flat.bib deleted file mode 100644 index c7fccdd427..0000000000 --- a/book/Grave/pwc/flat.bib +++ /dev/null @@ -1,165 +0,0 @@ -@Article{stark, - author = {T[] Stark}, - title = {TBD}, - journal = {TLE}, - year = 2004 -} - -@Article{bienati, - author = {N[] Bienati and U[] Spagnolini}, - title = {Multidimensional wavefront estimation from -differential delays}, - journal = {IEEE Trans. on Geoscience and Remote Sensing}, - year = 2001, - volume = 39, - number = 3, - pages = {655-664} -} - -@incollection{exxon, - author= {D[] Hinkley and G[] W[] Bear and C[] Dawson}, - year= 2004, - title= {Prestack gather flattening for {AVO}}, - publisher= {Soc. of Expl. Geophys.}, - booktitle= {74th Ann. Internat. Mtg.}, - pages= {2329-2329}, - } - -@Book{dmo, - editor = {D[] Hale}, - title = {{DMO} processing}, - publisher = {Soc. of Expl. Geophys.}, - year = 1995 -} - -@Article{dso, - author = {W[] A[] Mulder and A[] P[] E[] ten~Kroode}, - title = {Automatic velocity analysis by differential semblance optimization}, - journal = {Geophysics}, - year = 2002, - volume = 67, - number = 04, - pages = {1184-1191} -} - -@Article{kim, - author = {S[] Kim and W[] W[] Symes}, - title = {Smooth detectors of linear phase}, - journal = {Inverse Problems}, - year = 1998, - volume = 14, - pages = {101-112} -} - -@Article{pwd, - author = {S[ergey] Fomel}, - title = {Applications of plane-wave destruction filters}, - journal = {Geophysics, accepted for publication}, - year = 2002, -} - -@Article{symes, - author = {W[] W[] Symes}, - title = {The plane wave detection problem}, - journal = {Inverse Problems}, - year = 1994, - volume = 10, - pages = {1361-1391} -} - -@book{pvi, - author = {J[on] F[] Claerbout}, - publisher = {Blackwell Scientific Publications}, - title = {{Earth Soundings Analysis: Processing Versus Inversion}}, - year = {1992} -} - -@incollection{pmig, - author= {S[] Fomel}, - year= 2005, - title= {Velocity-independent time-domain seismic imaging using -local event slopes}, - publisher= {Soc. of Expl. Geophys.}, - pages = {2269-2272}, - booktitle= {75th Ann. Internat. Mtg} - } - -@incollection{alejandro, - author= {A[lejandro] A[] Valenciano and M[organ] Brown and A[ntoine] Guitton and M[auricio] D[] Sacchi}, - year= 2004, - title= {Interval velocity estimation using edge-preserving -regularization}, - publisher= {Soc. of Expl. Geophys.}, - pages = {2431-2434}, - booktitle= {74th Ann. Internat. Mtg} - } - -@Article{clapp, - author = {R[obert] G[] Clapp and B[iondo] Biondi and J[on] F[] -Claerbout}, - title = {Incorporating geologic information into reflection tomography}, - journal = {Geophysics}, - year = 2004, - volume = 69, - pages = {533-546} -} - -@Article{antoine, - author = {A[] Guitton}, - title = {Multiple attenuation in complex geology with a pattern-based approach}, - journal = {Geophysics}, - year = 2005, - volume = 70, - pages = {V97-V107} -} - -@incollection{us, - author= {S[] Fomel and A[] Guitton}, - year= 2005, - title= {Model preconditioning by plane-wave construction in geophysical -estimation problems}, - publisher= {Soc. of Expl. Geophys.}, - pages = {2601-2604}, - booktitle= {75th Ann. Internat. Mtg} - } - -@incollection{shape, - author= {S[] Fomel}, - year= 2005, - title= {Shaping regularization in geophysical estimation problems}, - publisher= {Soc. of Expl. Geophys.}, - pages = {1673-1676}, - booktitle= {75th Ann. Internat. Mtg} - } - -@Article{dijkstra, - author = {Dijkstra, E.W.}, - title = {A Note on Two Problems in Connection with Graphs}, - journal = {Numerische Mathematik}, - year = 1959, - volume = 1, - pages = {269-271} -} - -@Book{bei, - author = {J[on] F[] Claerbout}, - title = {Basic {Earth} Imaging}, - publisher = {Stanford Exploration Project, -\texttt{http://sepwww.stanford.edu/sep/prof/}}, - year = 2005 -} - -@Book{tarantola, - author = {A[] Tarantola}, - title = {Inverse Problem Theory and Methods for Model Parameter Estimation}, - publisher = {SIAM}, - year = 2004 -} - -@ARTICLE {harlan, - author = {W[illiam] S[] Harlan}, - journal = - {\newline http://billharlan.com/pub/papers/regularization.pdf}, - title = {Regularization by Model Redefinition}, - year = {1995} -} diff --git a/book/Grave/pwc/paper.tex b/book/Grave/pwc/paper.tex deleted file mode 100644 index 97bb44bcee..0000000000 --- a/book/Grave/pwc/paper.tex +++ /dev/null @@ -1,427 +0,0 @@ -\title{Regularizing seismic inverse -problems by model re-parameterization using plane-wave construction} - -\renewcommand{\thefootnote}{\fnsymbol{footnote}} - -\lefthead{Fomel \& Guitton} -\righthead{Plane-wave construction} - -\author{Sergey Fomel\footnotemark[1] and - Antoine Guitton\footnotemark[2]} - -\address{ -\footnotemark[1]Bureau of Economic Geology, \\ -John A. and Katherine G. Jackson School of Geosciences \\ -The University of Texas at Austin \\ -University Station, Box X \\ -Austin, TX 78713-8972 \\ -\footnotemark[2]3DGeo Development Inc. \\ -4633 Old Ironsides Drive, Suite 401 \\ -Santa Clara, CA 95054} - -\maketitle - -\begin{abstract} - We define plane-wave construction (PWC), an operator for generating - data aligned along predefined locally variable slopes, as the - inverse of plane-wave destruction, an operator used for measuring - the slopes. PWC can be applied for efficient \old{preconditioning} - \new{regularization} of \old{geophysical} \new{seismic} estimation - problems. Using simple examples, we demonstrate the applicability of - PWC for enhancing the coherency of seismic images, improving - velocity estimation methods, and separating primaries and multiples - with a pattern-based approach. -\end{abstract} - -\section{Introduction} - -\cite{GEO67-06-19461960} describes applications of plane-wave -destruction filters, a concept originally introduced by \cite{pvi}. -High-order accurate destruction filters are used for estimating local -slopes of seismic events and can be applied for such problems as fault -detection, data regularization, and noise attenuation. Estimating -local slopes can also replace traditional velocity analysis and enable -velocity-independent time-domain seismic imaging \cite[]{pmig}. - -In this paper, we introduce \emph{plane-wave construction} (PWC), a -formal inverse of the plane-wave destruction operator. We show that -PWC can be used as an efficient \old{preconditioner} \new{regularizer} -for speeding up iterative optimization that involves models with local -plane-wave structure. In that sense, one can view PWC as a -higher-order generalization of \emph{steering filters} -\cite[]{SEG-1998-1851,clapp}. We illustrate its applications with -field data examples. - -The immediate effect of PWC is smoothing the data along dominant event -slopes. In application to coherency enhancement in seismic images, -iterative least-squares inversion with PWC \old{preconditioning} -\new{parameterization} extracts portions of the image aligned with the -dominant slopes. Using PWC in combination with iterative reweighting -allows us to preserve fault geometry in the coherency enhancing -process. When applied to the classic velocity estimation problem, PWC -enforces consistency between the velocity structure and reflector -geometry. In the multiple elimination problem, PWC -\old{preconditioning} \new{parameterization} enables separating -primary and multiple events on the basis of differences in their local -slopes. - -\new{PWC requires seismic traces to be sequentially -ordered. Therefore, it may not be immediately applicable to 3-D -problems. Transformation from plane-wave construction to plane-wave -shaping \cite[]{shape} addresses this problem \cite[]{us}.} - -\begin{comment} -A more powerful approach to regularization involves shaping operators -that project the estimated model into the space of acceptable models -\cite[]{shape}. In the last section of this paper, we show how to -transform plane-wave construction into plane-wave shaping by following -an analogy with triangle filtering. -\end{comment} - -\section{Plane-wave construction defined} - -Let us represent a seismic section $\mathbf{s}$ as a collection of -traces: $\mathbf{s} = \left[\mathbf{s}_1 \; \mathbf{s}_2 \; \ldots \; -\mathbf{s}_N\right]^T$. A plane-wave destruction operator -\cite[]{GEO67-06-19461960} effectively predicts each trace from its -neighbor and subtracts the prediction from the original trace. In the -linear operator notation, we can write the plane-wave destruction -operation as -\begin{equation} - \label{eq:pwd} - \mathbf{r} = \mathbf{D\,s}\;, -\end{equation} -where $\mathbf{r}$ is the destruction residual, and $\mathbf{D}$ is the -destruction operator defined as -\begin{equation} - \label{eq:d} - \mathbf{D} = \mathbf{I}_N - \mathbf{P} = - \left[\begin{array}{ccccc} - \mathbf{I} & 0 & 0 & \cdots & 0 \\ - - \mathbf{P}_{1,2} & \mathbf{I} & 0 & \cdots & 0 \\ - 0 & - \mathbf{P}_{2,3} & \mathbf{I} & \cdots & 0 \\ - \cdots & \cdots & \cdots & \cdots & \cdots \\ - 0 & 0 & \cdots & - \mathbf{P}_{N-1,N} & \mathbf{I} \\ - \end{array}\right]\;, -\end{equation} -where $\mathbf{I}$ stands for the identity operator, $\mathbf{P}$ is -the prediction operator defined by \cite{GEO67-06-19461960}, and -$\mathbf{P}_{i,j}$ describes prediction of trace $j$ from trace -$i$. \new{Prediction of a trace consists of shifting the original -trace along the dominant event slope. The dominant slope is estimated -by minimizing the prediction error (the output of $\mathbf{D}$) by -regularized least-squares optimization. Regularization constraints the -estimated slopes to vary smoothly inside the data space.} - -The plane-wave construction (PWC) operator $\mathbf{C}$ is simply the inverse of -$\mathbf{D}$: -\begin{eqnarray} - \nonumber - \mathbf{C} & = & - \left[\begin{array}{ccccc} - \mathbf{I} & 0 & 0 & \cdots & 0 \\ - - \mathbf{P}_{1,2} & \mathbf{I} & 0 & \cdots & 0 \\ - 0 & - \mathbf{P}_{2,3} & \mathbf{I} & \cdots & 0 \\ - \cdots & \cdots & \cdots & \cdots & \cdots \\ - 0 & 0 & \cdots & - \mathbf{P}_{N-1,N} & \mathbf{I} \\ - \end{array}\right]^{-1} \\ - \nonumber - & = & - \left[\begin{array}{ccccc} - \mathbf{I} & 0 & 0 & \cdots & 0 \\ - \mathbf{P}_{1,2} & \mathbf{I} & 0 & \cdots & 0 \\ - \mathbf{P}_{1,2}\,\mathbf{P}_{2,3} & \mathbf{P}_{2,3} & \mathbf{I} & \cdots & 0 \\ - \cdots & \cdots & \cdots & \cdots & \cdots \\ - \mathbf{P}_{1,2} \cdots \mathbf{P}_{N-1,N} & - \mathbf{P}_{2,3} \cdots \mathbf{P}_{N-1,N} & \cdots & - \mathbf{P}_{N-1,N} & \mathbf{I} \\ - \end{array}\right] \\ - & = & - \left[\begin{array}{ccccc} - \mathbf{I} & 0 & 0 & \cdots & 0 \\ - \mathbf{P}_{1,2} & \mathbf{I} & 0 & \cdots & 0 \\ - \mathbf{P}_{1,3} & \mathbf{P}_{2,3} & \mathbf{I} & \cdots & 0 \\ - \cdots & \cdots & \cdots & \cdots & \cdots \\ - \mathbf{P}_{1,N} & - \mathbf{P}_{2,N} & \cdots & - \mathbf{P}_{N-1,N} & \mathbf{I} \\ - \end{array}\right] - \;, - \label{eq:c} -\end{eqnarray} - -For efficiency, it is convenient to apply PWC as a recursive triangular inversion. The output -of -\begin{equation} - \label{eq:pwc} - \mathbf{c} = \mathbf{C\,s} = \left[\mathbf{c}_1 \; \mathbf{c}_2 \; \ldots \; - \mathbf{c}_N\right]^T -\end{equation} -is computed recursively as follows: -\begin{equation} - \label{eq:rec} - \mathbf{c}_1 = \mathbf{s}_1\;,\quad - \mathbf{c}_k = \mathbf{s}_k + \mathbf{P}_{k-1,k}\,\mathbf{c}_{k-1}\;\quad - k=2,3,\ldots,N -\end{equation} -$\mathbf{C}$ is a smoothing operator along local -plane-waves. \new{Re-parameterization by $\mathbf{C}$ provides -effective regularization and} can help \old{accelerating} -\new{accelerate the} convergence of iterative optimization in inverse -problems \cite[]{harlan,GEO68-02-05770588}. When applied for model -\old{preconditioning} \new{re-parameterization} in least-squares -inversion of the forward modeling operator -\begin{equation} - \label{eq:for} - \mathbf{d} = \mathbf{L\,m} = \mathbf{L\,C\,p}\;, -\end{equation} -plane-wave construction leads to the formal inversion -\begin{equation} - \label{eq:inv} - \widehat{\mathbf{m}} = \mathbf{C}\,\widehat{\mathbf{p}} = -\mathbf{C\,C}^T\,\left(\mathbf{L\,C\,C}^T\,\mathbf{L}^T + \epsilon^2\,\mathbf{I}_N\right)^{-1}\,\mathbf{d}\;. -\end{equation} -Here $\mathbf{m}$ is the model, $\mathbf{p}$ is the \old{preconditioned} \new{re-parameterized} -model, $\mathbf{d}$ is the observed data, $\epsilon$ is the -regularization parameter, and $\widehat{\mathbf{m}}$ is the -regularized model estimate. The $\mathbf{C}\,\mathbf{C}^T$ operator -plays the role of the model covariance operator. % \cite[]{tarantola}. -In large-scale -problems, the inversion in equation~(\ref{eq:inv}) is computed efficiently by -an iterative conjugate-gradient algorithm. A different approach to recursive -filter preconditioning, based on the helix transformation -\cite[]{GEO63-05-15321541}, was suggested by \cite{GEO68-02-05770588}. - -The total cost of plane-wave construction is simply proportional to the data -size and to the cost of an elementary prediction $\mathbf{P}_{k-1,k}$, which -operates at the speed of tridiagonal inversion for a matrix of the -trace-length size \cite[]{GEO67-06-19461960}. This operation is comfortably -efficient in practical applications. - -\section{Applications} - -\inputdir{beic} - -In this section, we describe three practical applications of -plane-wave construction in solving inverse problems with - model \old{preconditioning} \new{re-parameterization}. - -\subsection{Coherency enhancement} - -\plot{bei-slp}{width=0.9\columnwidth}{Left: seismic image after prestack time - migration. Right: local dips estimated with plane-wave destruction.} -\plot{bei-vg}{width=0.9\columnwidth}{Left: seismic image after coherency - enhancing. Right: difference between the coherency-enhanced image and the - original image.} - -The simplest kind of regularized inversion involves $\mathbf{L}$ as -the identity operator $\mathbf{I}_N$. The corresponding application of -PWC \old{preconditioning} \new{parameterization} results in an -effective deconvolution that enhances structural consistency and -continuity of seismic images. - -A coherency enhancement operator is -\begin{equation} - \label{eq:vg} - \mathbf{h = H\,s} = \mathbf{C\,W\,C}^T\,\left(\mathbf{C\,W\,C}^T + \epsilon^2\,\mathbf{I}_N\right)^{-1}\,\mathbf{s}\;, -\end{equation} -where a diagonal weighting operator $\mathbf{W}$ is added to prevent -plane-wave smoothing across structural discontinuities. We define -$\mathbf{W}$ as a diagonalized magnitude of $\mathbf{p}$ from an -unweighted inversion in equation~(\ref{eq:inv}). When repeated -iteratively, this method corresponds to iteratively reweighted -least-squares with a simulated $L_1$ norm for vector $\mathbf{p}$ -\cite[]{GEO68-01-03860399}. - -We apply coherency enhancement to a time-migrated seismic image from a -historic Gulf of Mexico dataset \cite[]{bei}, shown in -Figure~\ref{fig:bei-slp}. Estimating local event slopes (right plot -in Figure~\ref{fig:bei-slp}) defines the PWC operator. The output of -coherency enhancement using equation~(\ref{eq:vg}) and the -corresponding noise component removed from the data are shown in -Figure~\ref{fig:bei-vg}. Coherency enhancement highlights locally -continuous reflectors while preserving the geometry of faults. A -similar effect was described by \cite{TLE21-03-02380243}, who called -it ``Van Gogh'' filtering. - -\subsection{Velocity estimation} - -\plot{bei-pdxw}{width=0.88\textwidth}{Seismic image from -Figure~\ref{fig:bei-vg} overlaid on top of the interval velocity model -estimated by PWC-parameterized Dix inversion.} -\plot{bei-pdx}{width=0.9\columnwidth}{Left: migration velocity used for - prestack time migration. Right: migration velocity predicted by regularized - Dix inversion.} - - -%Plane-wave construction can be used as a model preconditioning -%operator \cite[]{GEO59-05-08180829,GEO68-02-05770588} for regularizing -%inverse problems in the cases, where estimated models have certain -%structure. In these applictions, plane-wave construction acts as an -%accurate steering filter in terminology of \cite{clapp}. - -To demonstrate an application of PWC to the seismic velocity -estimation problem, we chose a simple Dix inversion formulation -\cite[]{GEO20-01-00680086} applied for interval velocity estimation -using the Gulf of Mexico dataset from Figure~\ref{fig:bei-slp}. When -Dix inversion is formulated as a regularized estimation problem, the -forward operator $\mathbf{L}$ \new{in equations~(\ref{eq:for}) -and~(\ref{eq:inv})} turns into simple integration -\cite[]{Clapp.sep.97.bob1,alejandro}. \old{Preconditioning} -\new{Parameterization} by plane-wave construction using the dip field -estimated from the image forces the estimated velocity to follow the -geological structure. - -Figure~\ref{fig:bei-pdxw} shows the resultant interval velocity model. -Figure~\ref{fig:bei-pdx} shows a comparison between the input and -predicted RMS (root-mean-square) migration velocity. We can see that -both goals of model estimation are achieved: the estimated model -explains the observed data while following a geological structure -consistent with the seismic image. - -\subsection{Multiple suppression} - -Separation of primary and multiple reflections is one of the most -important tasks in seismic data processing. A distinguishable -characteristic of surface-related multiple events is different slopes -because of different apparent velocities. The advantage of using -slope-based prediction is that, for estimating dominant slopes of -multiple events, we can utilize models of the multiples that may have -incorrect amplitudes and wavelets as long as they correctly predict -event geometry \cite[]{antoine}. An example is shown in -Figure~\ref{fig:cmp}, which contains a multiple-infested CMP gather -from the Mobil AVO dataset \cite[]{CSI00-00-00010213}, its prediction -with the SRME (surface-related multiple elimination) method -\cite[]{GEO57-09-11661177} and two dominant slopes estimated from the -data and corresponding to primary and multiple reflections. Even -though SRME does not provide correct amplitudes and wavelets in -prediction of the multiple events, it can guide the slope estimation -method toward extracting the dominant slopes of multiple events. - -\inputdir{cmp} - -\plot{cmp}{width=\columnwidth}{a: CMP gather from the -Mobil AVO dataset, b: multiple model from SRME prediction, c: estimated -dominant slope of the primary reflection events, d: estimated dominant -slope of the multiple reflection events.} - -The model of the data is now \cite[]{GEO65-02-05740583,FBR20-03-01610167} -\begin{equation} -\label{eq:splusn} - \mathbf{d} = \mathbf{C}_p\,\mathbf{p}+\mathbf{C}_n\,\mathbf{n} = - \left[\begin{array}{cc} \mathbf{C}_p & \mathbf{C}_n \end{array}\right]\, - \left[\begin{array}{c} \mathbf{p} \\ \mathbf{n} \end{array}\right]\;, -\end{equation} -where $\mathbf{C}_p$ is plane-wave construction along primary slopes -and \old{$\mathbf{C}_p$} \new{$\mathbf{C}_n$} is plane-wave -construction along multiple slopes. In accordance with -equation~(\ref{eq:inv}), the least-squares estimates of the multiples -is -\begin{equation} -\label{eq:mult} - \widehat{\mathbf{m}} = \mathbf{C}_n\,\widehat{\mathbf{n}} = - \mathbf{C}_n\,\mathbf{C}_n^T\, - \left(\mathbf{C}_p\,\mathbf{C}_p^T + \mathbf{C}_n\,\mathbf{C}_n^T + \epsilon^2\,\mathbf{I}_N\right)^{-1}\,\mathbf{d}\;. -\end{equation} - -Figure~\ref{fig:super} shows the estimated primary and multiple events -and comparison of velocity semblance scans before and after multiple -suppression. A large portion of the multiple energy is successfully -removed from the data. - -\plot{super}{width=\columnwidth}{a: estimated primary -reflections (data with multiples removed), b: estimated multiple -reflections, c: velocity scan of the original gather, d: velocity scan of -the gather after multiple suppression.} - -\begin{comment} - -\section{From plane-wave construction to shaping} - -Shaping \cite[]{shape} is a powerful approach to -regularization. Shaping acts as a smoothing operator that projects the -estimated model into the space of acceptable models. - -To transform plane-wave construction to shaping, we can use the -prediction operator~$\mathbf{P}$ from equation~(\ref{eq:d}) and define -a box smoother of length $k$ as -\begin{equation} - \label{eq:bk} - \mathbf{B}_k = \frac{1}{k}\,\left(\mathbf{I}_N + \mathbf{P} + - \mathbf{P}^2 + \cdots + \mathbf{P}^k\right)\;. -\end{equation} -Implementing equation~(\ref{eq:bk}) directly requires many computational -operations. Noting that -\begin{equation} - \label{eq:rec} - \left(\mathbf{I}_N - \mathbf{P}\right)\,\mathbf{B}_k = - \frac{1}{k}\,\left(\mathbf{I}_N - \mathbf{P}^{k+1}\right)\;, -\end{equation} -we can rewrite equation~(\ref{eq:bk}) in the compact form -\begin{equation} - \label{eq:bcomp} - \mathbf{B}_k = - \frac{1}{k}\,\left(\mathbf{I}_N - \mathbf{P}\right)^{-1}\, - \left(\mathbf{I}_N - \mathbf{P}^{k+1}\right) = \frac{1}{k}\,\mathbf{C}\,\left(\mathbf{I}_N - \mathbf{P}^{k+1}\right)\;, -\end{equation} -which can be implemented economically. Finally, combining two -generalized box smoothers creates a symmetric generalized triangle smoothing operator suitable for shaping regularization -\begin{equation} - \label{eq:tk} - \mathbf{T}_k = \mathbf{B}_k^T\,\mathbf{B}_k\;. -\end{equation} -A triangle shaper uses local predictions from both the left and the -right neighbors of a record and averages with triangle weights. - -The least-squares inversion regularized by shaping takes the form -\cite[]{shape} -\begin{equation} - \label{eq:shape} - \widehat{\mathbf{m}} = - \mathbf{B}_k\,\left[\epsilon^2\,\mathbf{I}_N + - \mathbf{B}_k^T\,\left(\mathbf{L}^T\,\mathbf{L} - - \epsilon^2\,\mathbf{I}_N\right)\, - \mathbf{B}_k\right]^{-1}\, - \mathbf{B}_k^T\,\mathbf{L}^T\,\,\mathbf{d}\;. -\end{equation} - -Figure~\ref{fig:bei-smo} shows several impulse responses for shaping with -$k=20$ for the seismic image used in this study. - -%\plot{bei-smo}{width=\columnwidth}{Impulse responses of PWC shaping -% for different points inside the image space.} - -\end{comment} - -\section{Conclusions} - -We have introduced plane-wave construction (PWC), an operator that -generates models aligned with predefined locally variable dips. PWC is -defined as the inverse of plane-wave destruction, an operator used for -measuring local dips. It is applicable as a model -\old{preconditioner} \new{regularizer} in \old{geophysical} -\new{seismic} estimation problems such as coherency enhancement, -\old{seismic} velocity estimation, and multiple suppression. As an -efficient operator for characterizing data elongated over dominant -smoothly variable slopes, PWC can be incorporated for regularization -of any inversion problems that operate with locally planar data. We -anticipate more applications of the proposed method. - -\old{An important limitation of the PWC method is that it is only applicable to -2-D problems, where seismic traces can be simply ordered. A possible -extension to 3-D problems is in transformation from plane-wave -construction to plane-wave shaping and in -application of shaping regularization}. - -\section{Acknowledgments} - -The first author thanks Norsk Hydro for partially supporting this -research. - -\bibliographystyle{seg} -\bibliography{SEG,SEP2,flat} - -%%% Local Variables: -%%% mode: latex -%%% TeX-master: t -%%% End: diff --git a/book/Grave/seg2006ConvertedWavesTSIC/MISC.bib b/book/Grave/seg2006ConvertedWavesTSIC/MISC.bib deleted file mode 120000 index 9d74c259aa..0000000000 --- a/book/Grave/seg2006ConvertedWavesTSIC/MISC.bib +++ /dev/null @@ -1 +0,0 @@ -../../cwp/MISC.bib \ No newline at end of file diff --git a/book/Grave/seg2006ConvertedWavesTSIC/PCS.bib b/book/Grave/seg2006ConvertedWavesTSIC/PCS.bib deleted file mode 120000 index b3eec770c4..0000000000 --- a/book/Grave/seg2006ConvertedWavesTSIC/PCS.bib +++ /dev/null @@ -1 +0,0 @@ -../../cwp/PCS.bib \ No newline at end of file diff --git a/book/Grave/seg2006ConvertedWavesTSIC/REPRO_FAIL.txt b/book/Grave/seg2006ConvertedWavesTSIC/REPRO_FAIL.txt deleted file mode 100644 index 7cb083a689..0000000000 --- a/book/Grave/seg2006ConvertedWavesTSIC/REPRO_FAIL.txt +++ /dev/null @@ -1 +0,0 @@ -cwtsic3/ppoff-h.rsf is all zeroes (Jan 2011) diff --git a/book/Grave/seg2006ConvertedWavesTSIC/SConstruct b/book/Grave/seg2006ConvertedWavesTSIC/SConstruct deleted file mode 100644 index 1c445c54a3..0000000000 --- a/book/Grave/seg2006ConvertedWavesTSIC/SConstruct +++ /dev/null @@ -1,3 +0,0 @@ -from rsf.tex import * - -End() diff --git a/book/Grave/seg2006ConvertedWavesTSIC/XFig/Fig/experimentC.pdf b/book/Grave/seg2006ConvertedWavesTSIC/XFig/Fig/experimentC.pdf deleted file mode 100644 index e23431d1f695d4b6b2a98f0f41c6351fdb0bd896..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5829 zcmb_Ad0diN*VEgMrCFx!J(h-+@PHr!DW)Q(X*ozrnkB*mk_Zeu?%7Ogi0Y zqfM4sjV)$oS(!H3XzJKz*_4)9u8o!U-UqdHzHiKGt(;zIhqcTzG}?y*F=JWz-JYGsBE|iwqAuO=@JQQp$If z;GDFVq$YY2?TmWPzd1T<-Cp}Py@(A~Tf9xmn6&|I`*nZ4T2K%-&ww2`oj}l9T$r)N zsO-Usng^5zm+8lv?#Izww!4e%y7Ris>}KO)H@{G?o~Wy}Y}$zlb)y1m`;Woi_B}?G zIQ8^f9r877t;WeTy`vrDKG<$`U!D)=WjcR%VeW`*n(paX^H)LCZb@D8q*Hn9aGR&W z-{FPzj@BK7-p<+`7dQhxmoHYf)jp^5_5b+2DsG+hT3;h2b4&2HGscy>ck=N%zPzSg zdbuLoc&AtP<7)-GTQgtV%-kgC_HeIW<5HTO*h`<3u;w6l1`;rC(Ouq|Lwr5*pKaHU zaxJ5Vk zgJ2#KiUM?pP}I>K1u+DXF+PBVqX6V&vStE83bqGxz)=lhp~%I7r6IAfEe1mqa07Bd z8o|^Myi6)mL*6({Y%b0R0vv)cmY!}qcAq27OJF5RH1?x7!!>`G!URrsY;F7`wLVMl@7ZIhQ?&FCG05` zq5f)boCOK9;Gi7`N1s-()z7}T!7+`7odo+@nwx`P3I)^9$L|o<$N4A7;AjX=rD8T3 z{QVjiNT9*OI8*4@p}-2}FmiC$O63wDyxdlBqi9eWH z(r_?l6$}Qbaj+BcFsaa1E|DP+2?x8QNT3IBdVuCCRja{?G}gdQiG%q=T&OfK!Au9@ z#ss#99bqR}2qUmq8Vr6wWWfqpAxB^ptcKOnP#E=BAqX4y$+>+YRqx+bAb{vs#z zlGap@yX8@CqfN&+$7YW(irEvxwksoyD06Mnt5)hHDiayJEkhV4pq%t z91xIG^GC2a(&lORwK0<5-fIJluFS4X^@C@Tna^e=C{bu>0*Xsql#@1c-d=O&50UM^ zwLz&F+Eqk-^P{o#?;Fl<-9M&|^W=)%@*S>=^G*_d@BU}%J}888Xv(CR8_>e!Vx3^dS>Y;wi`Q3@@o)oel$s_hBF66Dtp_2Pzs_RR<5A0g2 zdqYq9JT#ufq2sgTB5y<=Nd)j~rtrDJBiDO>{YJ#$~ZZ zTM02*C-ye!-W})ZcQRvk+3u}IOedBUN}feE8=JKG&Wke@9Z}6T4eNs^Zt=rqq)uwK zy4-GbSD#;%RT>@Aamr=B-6_YWH%t0^|GdXt>l(Z|r)l%AtMBZpi@DdhZ>D#9)*R~% zhVvZs=TBP38_{AEUqqNQs;(fvT|D<;W267ewCs#jJKq|Y=TE#1OINR)#63HmV(~jLaJSCS^nc|@Cj=P=8DCuf6 zygaFEUwqqlX{R})N5!+MPXwi}_u+WpZrHx%_Qz`lJ?>okB)(YhS=sWe#5wGS5wqJm zXBk8W^*Xk~;~H9$ceffd^B?VbI6cQerDb;@DR*N*#5Tz|J~cf|duG$k*juQl?0x&F zlSewtF8o$Ce`(v8BRfUC(FU&`uRS<<$VB8-z9UGrY9SuIJ_{tR&bjP#Vbw04rR3_(hIB-r?Pb2t=c=SMqHgc`xg{I7 z6bBR}X52Jgc%xzwv1IeT&fO=B-Z5|H!}aSbkG0cHx4oYDvZS*++qbj%!JhDm+%ry- zdAceGSM|cR^+`1e3|oos&KW!M3Xfjdkvx;Pab28O=SzbpA^hVOZTwIYWAWkEzWpnH ziXD4|89B4?+#mAb?Jj7=&QlFJ+bInx$+W_m^zE-Db!pSqbSlGUND2zh6)@}5)$^x2 z-2N+Yp&|ce+|E}cv`2lY?YLZRJy3mN`U}ez*16`#4~=J@6@>m&RDnBx(H6|#!Ay23|DTvv@5@EVd0*w zJ6zB7J&a?!=77 z`qhmUbt`jMAseMP;|w-u*EB!AwZ)md>GhbHiaEss>Z!Hn$5PqN{skq+Lpm!*?AMhY zGHe_<7Z1~~Y_z9CPZomT5lezM4HTA@MdtB8V$ zyq=yTg@p-Y+#^>RXYX6sJwEDTx!zm4C1bv0me6E7@z-~!YFskj8y%c{KPNRSFX(7w zmCo9;rSG%R2YcU*(=L4&=AN6AYa!u8c*neNZO%UVbFJy&I(kW=;r%^3T0|FY4Qz5V zeE719l!enS)UaabWOr=8ePy5N&AdAaoV0h{xBb087~D<%&#SqUm;F9Pv_8k{$Cd9k z_BFl;nWOXO{lwdAb(Tem!dGz#X;*`Napvb8%ylF^5#D#SM16ieX*|FxmEk>4>83(vuw_#=B4U$)qmz9UY<^ z^&jn`8v2-rPxH6;Jtj05(*Ekct@C4)ee<8Q^-u24YZp7f*%|I;E@wuUnWZ1A&m1`L z%e{(LX><)I>Mxy5Hx!q!Y~#y3T9YzE!zN^c}roB28m>az!O12yer}S=k6c0*??v1xkWg zQ=O_IkbhXuv*)^S=3xk-%+Nq(AjoN<&_J17%?!21Ye<-2j4i`>NP~g~SmXJwZV;+a z$O5D&WKLud$pkXR3=*qAsuZG71wdpX4G&nVL}Dfvr1OIe!OR-(kD^K@42Oh-5JM^qj4wIvTP=Z`NAMB?QM9Tk2CRYF$$wU%7ywPxy zD^-rB;vZ01Rv&Q{DjqO2 z3l37NU_YrGB$pC%5fTh}ASyMcY6{UDauc9Je;E>t$RGF_Ko07Rvz3}I>F%2tLB4rEd+PM9)*Tw;w6C5RBQAV`Md zS$vLE0wbYHL`MLSQva-M8onY-{_ch_1yviSW?)(@5KY)jENDq|GK0h*S!m)F58@S| zfx!L;3?AkYCVyw^;awCelm9t*0gY`C>JLc%(cGpVn;4-gL=1{?P{m>w>);2XSy)gk zATcz&#$bS!0QQ08!)q2~Dk#6dTq7|kps(@OnkD@kS`vv28a`j+(Y~Pt6*REQmw03{ z4YVV^TBFjxr6rTT#Uo>_jIU@dY2U~~p;>@d*)Sfe5`aQm1=_?A>@E!l-7G2ua}^5E zcET!e2zHW-6_BP12b};m2z diff --git a/book/Grave/seg2006ConvertedWavesTSIC/XFig/Fig/vecC.pdf b/book/Grave/seg2006ConvertedWavesTSIC/XFig/Fig/vecC.pdf deleted file mode 100644 index 369df68b59e0008bcb703609a8f0ef01bdd38615..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6940 zcmb_hd0Z3c)3+Wd5fLqT)LK>)0z%l`oCG=KJ_LmX1VPj#*@Qq2NEQK65!6am#G*w- zP&}|6Sd~Mu2vk8TBH}@zUSP$eRZ%&r;!)mb!(jmZwV(H6{KIGGnVDyvneWW=JcF^1 zvnvg?WKxWOeVV$L!h#S;5gJahv4OpCxtIup*nq-=T_sWiS36eDnFT%Zu*c6JmM zp~Nv6B{nn1-&^q|s#o$h;8F@tySeqXV7ZIq!lDA_d#kK+!i~1N?6-aKYDcT}+%sl= z+Uxb>msUQvEt`7m)m@9E>x-u}Y>7+QjkQZ3zW#^5(?)iwaS3fLJD2+Uc$!ixm3{W{ zi64xzM^=Ol%QaE8KWTZq&acYIt3F~uV$6v7V;??Tz&8wdc)4iU&f+AR@WobXT#7t{ z@3zL2V*ezKld#~#)ZzCWphc#L%ZW9MC%&%xi}G&1Np<7*MGKDZ(L1WraoMB%wo0#h z<9(0WbM8;`Ilk5Xo^;EW?IF95d8Y;NkPhmC7oN$#oDX&$dLVT4$O~&97qJ&#;$#nR zTHAGY_!O~ke#X=M^E^nL+r0nHs-j=!)=$l=%2Vwy4i><8>6*h z){eTm%hHr*+97T86T?@vonqW?N3!OmCtgTvSgH}kbKXGTdDy(}-N;~<%>yXouqW&OEq>xMIR z!^Y3#;n+__`eWtcTRjDMbb9RNlySfMMGdWaWBvGaYKd{g^itvdhh7cIc8{$dgzH{5 zd~1$cK5;RMYW$KrIh>=F*zrZklY=vE%q}gV{y6e1zoVuQw-BG>|8erAetbvN)o;%= zq;~AsJ5E()rA$uf8kzl&X8+RZUFt2@w(2J)k4Fx>C2M~5e(q^T!jQ(iO;2#Sum@RS zM52+zAo)LwOQ-aZm>+=Z7Z-`cKA0GXy>X!gb5z7a!3dZ}xd=pOAt4knsl??3#2}$e zfqA$}5v>&9DgbgHr9!~RiC`F{0R;Quu>@dui6z|l1OPgOlFI-QR|OD9$>iWs0PbNY z@C`JopgvNMS>zJk`2(~8yCAh;DhQq<5vrhIO1Hic2xy2VRg&6zMA1Ic9!V#Rz@!Rs zuZkY)y>S8)f*FWT?on+{j{;7A1s}FSf#>;nL#Uly?@AiZ<8dgY98bdzjT*p1=@gVs z&ci$_idFXjMJT9xZ4DWcr>AZ>Vk(^U7wqEX;6C5qoF69(RY=t?bjDQzr6iJ2C?Qn6 z9raGtQ^3a(rHXJ0!;}yUfxWPvF^V$a0Ev(YQw0M$x$GzYQ9eQM<^K%xEILY}Lk_B+ zL@oyS0=juHKRT2k5lDs`__!~ei)CldBgGmSVeFRA44sw;G@7q}-65#-?0G`1V za`QwO2zbZ`y<`vudfH=NkY|9mxt~Oat7wi2sn7!;MkM$q2_=7DUu&cIuE+)f2f^bJreL(S{0eCa5SP<8u(xNJVep;KUQiAn{~ zr_Kqoya6>JXFv@z?S=|W#3;0RMm=^>{+q;f3bX?cBjmr+ss(yLpPRPY?noBd|OWRj8bxxbp zNbyL2Ks!Ou<&)1NPwT7XE7k@-$M(sso1R8&zG-+#s+uy>c>Z754~nqOO zSy8a>lHvD?YWRMDZO9`?^cUeC^jXJxv_DkIU|<5bZPHJx{NA2PVbzGnQB|KT@JQq3H`{brNz`MNdZx7NC6uTXV% zMd?rTFz`s5xk=ZPm$H0L+l9P+#akKXx=dNa~_BHLKpaD&AD0 z6HJM>afW3@l`A%m9A=-v*3EoAWqor={SRpKGB>EXY-d(x>9!s5d6{vQLl@hh+@({f zfB5{78!>P6rX zZeO~1ZCi}F{p4eUGuYkuNAa@GYvt7zzpO4xDr_Fn_4|T+j!egA-I%<@)8D(a*Zlrt z)U&a<%cw;*f5-h1Ekb8;Y9B607p9GVbl|25MVUP_VR?ORlJv-o_gWP-XdGE)`(F|U z)?2c~eJpAJSFu#5FAW7pD~*n@ASROyG1>Iq6h;{+im>`}7|dwqu==wvhk^Jfl9&xL z-(hJ_0)z4jQW}fxPUr3~%>-9d0(+`N_kz9I9@#I;2Oi=Ymx2GDvv65-fCy zP^hm{b;+AnAAPabqt(LWQk9pM_TzV(MenAScQ~bYa%!Jf7&_Re1>%#JKUB6aZAW6- zk6(JfhuX2?@ZDD)@0#9@n6!QJWOGrj@-lqT;-Xirsqd9hV<-)E_4N+PlY)YRX3p?G zC)8ia+rYTqu3xumV_se6yQJH7XU0d25NALBI(wM@HPy_~^z{bg`8*zf_RVwSRlIzI z+jJFuG^MRtpP9)r*r=nU6P>u`&|;CCCpqEhvr-ad{Z}B0s)0Up^Q`a~b zE?yDB9dypq? z+wgpDh+TYZns-FHMa%uW=DWM56aT#0-YKmvDs7L1cU~wj|7FOKQ;NO64u-w@%+$PR zd`IEQ6J> zsvoe`mrjl2OXL3Y-+|5Hax{RA&kJ$qW0U^b#4mF?>c75%e#&X$oNxCFwO>F)1lrSd&4>X1(_<-F$Z}-s)m>zj0Ti-ERKyt-e>k znK5Bn)XVagzin(v4aYt^zvAtxWa#Il)|vIUWqZa{>K+a}QtHbK3VNyF9r7_fc;H#t zl*dVpo>OifobGt_kT@{kqp3bBZ`KL(c?ksnx7;KiFTCVz<)0Q^iXlU8OgM6N_$sZsRp!}W z-5=HHzz);0*H%q9Ki2a_Kt-!qQ1Ph1^n#&9tlp^9+ipS|sbZ^msNS89WyfBo={|jM z_rWi=x;gIB)uYWLzH5yvi|4WLF#g)gu%JpMMwpG8F_3q@7A%+*D9_WtwJ8s>&k(=w*-Co%+X@{Zq4e7p? zwc@&H|BST{k7{*3%*rVqXCAsg<*0OOjaSXmD(mJIs>}M4T0gG`T2$BfNsY_#Nw$+R z+O`=i~n2Uk%GKu`dL@@x>mf*^h?{F-LSa9r8xX+Ue%pRi>H*cPTao#)6qLs zn*+}n7(D;tE+-&p(WJrkMg7dwtS`L}&<|I|KyRud2_kR;3dO|| zxh?g1aTyho2yLkWEN{d+(g_cfxGz)U{AF|f1j`}>Tp`uoj$&hvfk!`1i^U>oB6ZtI z1%aEft&tPY%hiZvh_#NDMasal2#S?Sb8jMLYOoh}eM1(Ch(Ax(h6bfmC zgn;OlTuT((t}P&u5?tS76v_w)wPaI)N~KU_%>ylfZiV2>mKsJ7k=8IA6BA<@!?08+ z#W2d{a$$rH)9Ez8K~u%a2`rW-S4{`&sSS|?_KC?=mTH?U1qvA~34~Eg1nym^_f{fN z$RToJEL0Iq*ir?d7|Ou8A{x#J712->$7l%n(Ktf3AQZ(|oKOLyccn-T3;QhvCcs(@ z-~uqR2JH=Dv;bGyQr&#KAh$4uis*iULsph-Iu-8O`DZW)MC;>w2NT_!hrr0%8$6vw zan7K(VoRkXC_+Q5XeieY;aVdsYbJ+=u&ogUY!a|Kf!-qMHU0~$olPIFLg@zrZ3joI zlyIm-4vQpWx)5Iq&Bv80($x%0I^=^9f-ot*6qiCQ8+f3o4NQhZ!yBK~Ki=N|+e0!L z30y4F+uPb%A&8cNx1fjfe}u(njHFP|XJ%xyQmRJ2PypjnoU}*=f*mV!o!te)$U?d=cp-^_~>s`cQ4b)5w+@L)Owk zk0gygU2knL{a9%*16MuL%^;>^2AVosli7+`fu1TCVW|_93KA8tfsFna4nGnKru~B4 zt6rfr{miaD6Z<_?lY5VBJ|K$guJEX(D9epi1!l*t;zN9V9X*aq;i>4Rtt(4QQ{ zhj2l&cYv%F+0q?ALq0}h4&tLDpsO}OmVqz^t;^uBK_70w8VojgqxYvV*-Q;tLWzN% zl@k2*34-~OWjKf%1oIRM&?qMxgAnW?7bzfM6xoyaaE5|yoE=ykI_k`3)49$LY^IYH qg0QVzUAd?;gUfJ25xalq2qAm$DgsjyYOt^wY!1cP*kzt8<^KTJ-_HI3 diff --git a/book/Grave/seg2006ConvertedWavesTSIC/XFig/experimentC.fig b/book/Grave/seg2006ConvertedWavesTSIC/XFig/experimentC.fig deleted file mode 100644 index dac1a8fd24..0000000000 --- a/book/Grave/seg2006ConvertedWavesTSIC/XFig/experimentC.fig +++ /dev/null @@ -1,48 +0,0 @@ -#FIG 3.2 -Landscape -Center -Inches -Letter -100.00 -Single --2 -1200 2 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 1200 2400 9600 2400 9600 7200 1200 7200 1200 2400 -2 1 0 3 6 7 50 -1 -1 0.000 0 0 -1 0 1 2 - 1 1 2.00 60.00 120.00 - 2400 2400 2400 3600 -2 1 0 3 2 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 60.00 120.00 - 2400 4275 4275 2400 -2 1 0 3 5 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 60.00 120.00 - 2400 4800 6525 2400 -2 1 1 1 0 7 50 -1 -1 4.000 0 0 -1 0 0 2 - 2400 2400 2400 7200 -2 1 0 1 3 7 55 -1 -1 0.000 0 0 -1 0 0 2 - 1200 3600 9600 5850 -2 1 0 1 2 7 55 -1 -1 0.000 0 0 -1 0 0 2 - 1200 3600 7425 7200 -2 1 0 1 6 7 55 -1 -1 0.000 0 0 -1 0 0 2 - 1200 3600 9600 3600 -2 1 0 1 5 7 55 -1 -1 0.000 0 0 -1 0 0 2 - 1200 3600 4800 7200 -2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 1 2 - 1 1 1.00 60.00 120.00 - 2400 7275 2400 8175 -2 1 0 1 4 7 55 -1 -1 0.000 0 0 -1 0 0 2 - 1200 3600 3300 7200 -2 1 0 3 4 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 60.00 120.00 - 2400 5625 9600 2400 -2 1 0 3 3 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 60.00 120.00 - 2400 3900 2850 2400 -4 0 0 50 -1 0 18 0.0000 4 195 480 2175 8475 CIG\001 -4 0 0 50 -1 0 18 0.0000 4 135 720 2100 2325 source\001 -4 0 0 50 -1 0 24 0.0000 4 255 360 6450 7125 30\001 -4 0 0 50 -1 0 24 0.0000 4 255 360 2700 7125 60\001 -4 0 0 50 -1 0 24 0.0000 4 255 360 4050 7125 45\001 -4 0 0 50 -1 0 24 0.0000 4 255 360 9150 6150 15\001 -4 0 0 50 -1 0 24 0.0000 4 255 180 9375 3975 0\001 diff --git a/book/Grave/seg2006ConvertedWavesTSIC/XFig/vecC.fig b/book/Grave/seg2006ConvertedWavesTSIC/XFig/vecC.fig deleted file mode 100644 index d66f8d64e0..0000000000 --- a/book/Grave/seg2006ConvertedWavesTSIC/XFig/vecC.fig +++ /dev/null @@ -1,43 +0,0 @@ -#FIG 3.2 -Landscape -Center -Inches -Letter -100.00 -Single --2 -1200 2 -5 1 0 2 14 7 50 -1 -1 0.000 0 0 0 0 6900.000 6500.000 6675 5700 7125 5700 7500 5925 -6 6300 5100 6600 5475 -4 0 4 50 -1 3 24 0.0000 4 240 195 6300 5325 p\001 -4 0 4 50 -1 0 18 0.0000 4 135 105 6450 5475 s\001 --6 -6 8550 3075 8925 3450 -4 0 0 50 -1 3 24 0.0000 4 240 195 8550 3300 p\001 -4 0 0 50 -1 0 18 0.0000 4 135 225 8700 3450 m\001 --6 -6 8700 4125 9000 4500 -4 0 0 50 -1 3 24 0.0000 4 240 195 8700 4350 p\001 -4 0 0 50 -1 0 18 0.0000 4 195 150 8850 4500 h\001 --6 -6 8850 4875 9150 5250 -4 0 1 50 -1 3 24 0.0000 4 240 195 8850 5100 p\001 -4 0 1 50 -1 0 18 0.0000 4 135 105 9000 5250 r\001 --6 -2 1 1 1 0 7 50 -1 -1 4.000 0 0 -1 0 0 2 - 7312 5963 6675 6600 -2 1 1 1 0 7 50 -1 -1 4.000 0 0 -1 0 0 2 - 7312 7237 6112 6037 -2 1 0 3 4 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 60.00 120.00 - 6675 6600 6675 5325 -2 1 0 3 1 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 60.00 120.00 - 6675 6600 9225 4500 -2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 60.00 120.00 - 6675 5325 9225 4500 -2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 60.00 120.00 - 6675 6600 9225 3225 -4 0 14 50 -1 32 24 0.0000 4 255 360 7050 5550 2q\001 diff --git a/book/Grave/seg2006ConvertedWavesTSIC/cwtsic3/SConstruct b/book/Grave/seg2006ConvertedWavesTSIC/cwtsic3/SConstruct deleted file mode 100644 index c3dc2e32d1..0000000000 --- a/book/Grave/seg2006ConvertedWavesTSIC/cwtsic3/SConstruct +++ /dev/null @@ -1,302 +0,0 @@ -from rsf.proj import * -from math import * -import sys -import string, spmig, adcig - -# ------------------------------------------------------------ -par = { - 'nx':800, 'dx':10, 'ox':0, - 'nz':500, 'dz':5, 'oz':0, - 'nt':4000,'dt':0.004, 'ot':0, - 'nh':800, 'dh':10, 'oh':-1000, - 'ns':1, 'ds':20, 'os':1000, 'fs':0, 'js':1, - 'nw':600, 'jw':1, - 'velp':3200, - 'vels':800, - 'nhx':100, - 'nht':200, 'oht':-0.125, 'dht':0.00125, - 'na':200, 'oa':-10, 'da':0.5 - } -par['ow']=0. -par['dw']=1./(par['nt']*par['dt']) -par['vpvs']= par['velp'] / par['vels'] - -par['amin'] = par['oa'] -par['amax'] = par['oa'] + (par['na']-1)*par['da'] -# ------------------------------------------------------------ -def igrey(custom): - return ''' - grey labelrot=n title="" pclip=100 wantaxis=y - grid=n gridcol=0 - labelsz=6 - %s - ''' % custom -def igraph(custom): - return ''' - graph labelrot=n title="" transp=y yreverse=y - wantaxis=n wantlabels=n - min2=%g max2=%g min1=0 max1=2500 - %s - ''' % (par['amin'],par['amax'],custom) -# ------------------------------------------------------------ -# CIG to slant-stack -def tcig2ssk(): - return ''' - slant adj=y p0=1000 np=600 dp=10 | - put label2=v - ''' -def hcig2ssk(): - return ''' - slant adj=y p0=-0.5 np=300 dp=0.01 | - put label2=tan - ''' -# slant-stack to angle -def tssk2ang(): - return ''' - pp2pstsic a0=%(oa)g na=%(na)d da=%(da)g - velocity=${SOURCES[1]} - vpvs=${SOURCES[2]} - dip=${SOURCES[3]} | - put label2=ang - ''' % par -def hssk2ang(): - return ''' - pp2psang2 - vpvs=${SOURCES[1]} - dip=${SOURCES[2]} | - tan2ang a0=%(oa)g na=%(na)d da=%(da)g | - put label2=ang - ''' % par -# ------------------------------------------------------------ - -ISCR = ' screenratio=0.5 screenht=7' -OSCR = ' screenratio=1.5 screenht=10' - -ilabel = 'label1="z" label2="x" unit1=m unit2=m' - -olabelx = 'label1="z" label2="h" unit1=m unit2=m' -olabelt = 'label1=z unit1=m label2="\F10 t\F3" unit2=s' - -slabelx = 'label1=z unit1=m label2="tan \F10 q\F3" unit2="."' -slabelt = 'label1=z unit1=m label2="\F10 n\F3" unit2=m/s' - -alabel = 'label1=z unit1=m label2="\F10 q\F3" unit2="\^o\_"' - -# ------------------------------------------------------------ - -deg = (0,15,30,45,60) -ndeg = len(deg) - -# ------------------------------------------------------------ -ppan = string.join(map(lambda a: str(a),deg),',') -psan = string.join(map(lambda a: str( - atan(tan( ( asin(sin(a*pi/180)/par['vpvs']) + a*pi/180 )/2 ))/pi*180 - ),deg),',') - -tppan = string.join(map(lambda a: str( - tan(a*pi/180) - ),deg),',') -tpsan = string.join(map(lambda a: str( - tan( ( asin(sin(a*pi/180)/par['vpvs']) + a*pi/180 )/2 ) - ),deg),',') - -dpth = string.join(map(lambda a: str( - ( 300+1000*tan(a*pi/180) ) / 5 - ),deg),',') - -# ------------------------------------------------------------ - -Flow('dip',None, - 'spike n1=%d d1=%g o1=%g n2=%d nsp=%d k2=%s mag=%s' % - (par['nx'], - par['dx'], - par['ox'], - ndeg, - ndeg, - string.join(map(str,range(1,1+ndeg)),','), - string.join(map(lambda a: str(tan(a*pi/180)),deg),',') - ) - ) -Flow('ref','dip','math output="300+input*x1" ') -Plot('ref', - ''' - graph yreverse=y min2=0 max2=2500 min1=0 max1=5000 - title="" wantaxis=n - ''' + ISCR) - -# wavelet -Flow('wav',None, - ''' - spike nsp=1 mag=1 k1=1 - n1=%(nt)d d1=%(dt)g o1=0 - ''' % par) - -# velocity/slowness -Flow('vel',None, - ''' - spike nsp=1 mag=1 - n1=%(nz)d d1=%(dz)g o1=%(oz)g - n2=%(nx)d d2=%(dx)g o2=%(ox)g | - transp | - spray axis=2 n=1 o=0 d=1 | - put label1=x label2=y label3=z - ''' % par) -Flow('slop','vel','math output=input/%(velp)d' % par) -Flow('slos','vel','math output=input/%(vels)d' % par) - -Flow('vp','slop','window n1=1 min1=1000 | math output=%(velp)d' % par) -Flow('vs','slos','window n1=1 min1=1000 | math output=%(vels)d' % par) - -# vpvs ratio -Flow('vpvs',None, 'spike nsp=1 mag=%(vpvs)g n1=%(nz)d o1=%(oz)g d1=%(dz)g' % par) -Flow('vpvp',None, 'spike nsp=1 mag=1 n1=%(nz)d o1=%(oz)g d1=%(dz)g' % par) - -# dip angle -Flow('dipa',None, - ''' - spike nsp=5 mag=%s - n1=%d o1=%g d1=%g - k1=0,76,141,221,351 l1=75,140,220,350,500 - ''' % (tppan,par['nz'],par['oz'],par['dz'])) - -# PP reflection angles -Flow('ppovl',None, - ''' - spike nsp=5 mag=%s n1=5 k1=1,2,3,4,5 | - spray axis=2 n=%d o=%g d=%g | - transp - ''' % (ppan,par['nz'],par['oz'],par['dz'])) -Plot('ppovl',igraph(''+OSCR)) - -# PS reflection angles -Flow('psovl',None, - ''' - spike nsp=5 mag=%s n1=5 k1=1,2,3,4,5 | - spray axis=2 n=%d o=%g d=%g | - transp - ''' % (psan,par['nz'],par['oz'],par['dz'])) -Plot('psovl',igraph(''+OSCR)) -# ------------------------------------------------------------ - -for case in ('pp','ps'): - - # data - Flow(case,'ref dip', - ''' - kirmod vel=%d vel2=%d dip=${SOURCES[1]} - nt=%d dt=%g t0=%g freq=15 - nh=%d dh=%g h0=%g - ns=%d ds=%g s0=%g | - pow pow1=1 | - window f2=100 | pad beg2=100 | - put label1=t label2=h - ''' % - ( par['velp'], - (par['velp'],par['vels'])[case=='ps'], - par['nt'],par['dt'],par['ot'], - par['nh'],par['dh'],par['oh'], - par['ns'],par['ds'],par['os']) - ) - Result(case,'window max1=8 |' - + igrey('label1="t" label2="h" unit1=s unit2=m screenratio=0.5 screenht=7')) - - # migration - sou = case + 'sou' - rec = case + 'rec' - spmig.wflds(sou,rec,'wav',case,par) -# Result(rec,'window | real |' + igrey('')) - - for TYP in ('h','t'): # imaging condition - # imaging condition parameters - if(TYP=='h'): - par['misc']='itype=x jcx=50 nhx=%(nhx)d nhz=1 hsym=y' % par - else: - par['misc']='itype=t jcx=50 nht=%(nht)d oht=%(oht)g dht=%(dht)g' % par - - # migration - img = case + 'img' + '-'+TYP - cig = case + 'cig' + '-'+TYP - if(case=='pp'): - spmig.imagePW3(img,cig,'slop', sou,rec,par) - else: - spmig.imageCW3(img,cig,'slop','slos',sou,rec,par) - Plot(img,'window max1=5000 | transp |'+ igrey(ilabel+ISCR)) - Result(img,[img,'ref'],'Overlay') - - # offset CIGs - off = case + 'off' + '-'+TYP - Flow(off,cig,'window n1=1 min1=%(os)g' % par) - if(TYP=='h'): - Result(off,igrey(olabelx + OSCR)) - else: - Result(off,igrey(olabelt + OSCR)) - - # angle CIGs - ang = case + 'ang' + '-'+TYP - ssk = case + 'ssk' + '-'+TYP - ovl = case + 'ovl' - - if(TYP=='h'): - Flow (ssk,off,hcig2ssk()) - Result(ssk,igrey(slabelx+OSCR)) - - if(case=='pp'): - Flow(ang,[ssk,'vpvp','dipa'],hssk2ang()) - if(case=='ps'): - Flow(ang,[ssk,'vpvs','dipa'],hssk2ang()) - - Plot( ang,igrey(alabel+OSCR)) - Result(ang,[ang,ovl],'Overlay') - - if(TYP=='t'): - Flow (ssk,off,tcig2ssk()) - Result(ssk,igrey(slabelt+OSCR)) - - if(case=='pp'): - Flow(ang,[ssk,'vp','vpvp','dipa'],tssk2ang()) - if(case=='ps'): - Flow(ang,[ssk,'vp','vpvs','dipa'],tssk2ang()) - - Plot( ang, igrey(alabel+OSCR)) - Result(ang,[ang,ovl],'Overlay') - -# ------------------------------------------------------------ -## - # NEW RULES - ## -# ------------------------------------------------------------ -Flow( 'psang-x','psoff-h dipa vpvs', - adcig.cig2ssk(300,-0.5,0.01) + '|' + - adcig.xsk2ang(200,-10,0.5)) -Plot( 'psang-x', igrey(alabel+OSCR)) -Result('psang-x',['psang-x','psovl'],'Overlay') -# ------------------------------------------------------------ -Flow( 'psang-u','psoff-t dipa vpvs vp', - adcig.cig2ssk(600,1000,10) + '|' + - adcig.tsk2ang(200,-10,0.5)) -Plot( 'psang-u', igrey(alabel+OSCR)) -Result('psang-u',['psang-u','psovl'],'Overlay') -# ------------------------------------------------------------ - -Flow('ssk',None, - ''' - spike nsp=5 mag=1,1,1,1,1 - n1=%(nz)d d1=%(dz)g o1=%(oz)g - n2=400 d2=10 o2=1000 - k1=60,113,175,260,406 - k2=28,35,55,98,190 | - bandpass fhi=0.03 | smooth rect2=7 repeat=1 - ''' % par) -Plot('cor',['ssk','vp','vpvs','dipa'], - ''' - pp2pstsic a0=%(oa)g na=%(na)d da=%(da)g - velocity=${SOURCES[1]} - vpvs=${SOURCES[2]} - dip=${SOURCES[3]} - ''' % par + '|' + igrey(alabel+OSCR)) - -Result('ssk',igrey(slabelt+OSCR)) -Result('cor',['cor','psovl'],'Overlay') -# ------------------------------------------------------------ - -End() diff --git a/book/Grave/seg2006ConvertedWavesTSIC/macro.tex b/book/Grave/seg2006ConvertedWavesTSIC/macro.tex deleted file mode 100644 index e5d28d6fa6..0000000000 --- a/book/Grave/seg2006ConvertedWavesTSIC/macro.tex +++ /dev/null @@ -1,101 +0,0 @@ -\def\req#1{$\left( \ref{eqn:#1} \right)$} - -\def\bea{\begin{eqnarray}} -\def\eea{ \end{eqnarray}} - -\def\beq{\begin{equation}} -\def\eeq{ \end{equation}} - -\def\lp{\left (} -\def\rp{\right)} - -\def\pbox#1{ \fbox {$ \displaystyle #1 $}} -\def\K#1{\overline{#1}} - -% greek letters (angles,frequency, vp/vs) -\def\w{\omega} -\def\g{\gamma} -\def\t{\theta} -\def\d{\delta} -\def\p{\phi} - -% image, wavefield -\def\RR{{ \bf R}} -\def\US{{ \bf U}_s} -\def\UR{{ \bf U}_r} -\def\UU{{ \bf U}} - -\def\UO{{ \widehat{\bf U}}} - -\def\us{{ \bf u}_s} -\def\ur{{ \bf u}_r} -\def\uu{{ \bf u}} - -\def\uo{{ \widehat{\bf u}}} - -% coordinates -\def\ss{{ \bf s}} -\def\rr{{ \bf r}} -\def\mm{{ \bf m}} -\def\hh{{ \bf h}} - -\def\mo{{ \widehat{\bf m}}} -\def\ho{{ \widehat{\bf h}}} - -% vectors -\def\vv{{ \bf v}} % arbitrary vector (e.g. magnetic North) -\def\nn{{ \bf n}} % normal to reflector - -% wavenumbers -\def\ksv{{ \bf k}_\ss} -\def\krv{{ \bf k}_\rr} -\def\kmv{{ \bf k}_\mm} -\def\khv{{ \bf k}_\hh} - -% ray parameters -\def\psv{{ \bf p}_\ss} -\def\prv{{ \bf p}_\rr} -\def\pmv{{ \bf p}_\mm} -\def\phv{{ \bf p}_\hh} - -% vector magnitude -\def\mps{|\psv|} -\def\mpr{|\prv|} -\def\mpm{|\pmv|} -\def\mph{|\phv|} - -\def\mks{|\ksv|} -\def\mkr{|\krv|} -\def\mkm{|\kmv|} -\def\mkh{|\khv|} - -% components -\def\mv{ \left[ m_x,m_y,m_z \right]} -\def\hv{ \left[ h_x,h_y,h_z \right]} -\def\sv{ \left[ s_x,s_y,s_z \right]} -\def\rv{ \left[ r_x,r_y,r_z \right]} - -\def\kmx{ k_{m_x}} -\def\kmy{ k_{m_y}} -\def\kmz{ k_{m_z}} - -\def\khx{ k_{h_x}} -\def\khy{ k_{h_y}} -\def\khz{ k_{h_z}} - -\def\tt{{\tau}} -\def\ww{\omega} -\def\gg{\gamma} - -\def\mvv{|\vv|} - -\def\mynote#1{ \note{ -\begin{multicols}{2} \tiny{ #1 } - \end{multicols} -}} - -\def\ctitle#1{ \center{\bf #1} \vspace{0.1in}} - -\def\tint#1{\!\!\!\int\!\! #1 dt} -\def\mint#1{\!\!\!\int\!\! #1 d\mm} -\def\aint#1{\!\!\!\alert{\int}\!\! #1 d\alert{\mm}} diff --git a/book/Grave/seg2006ConvertedWavesTSIC/paper.tex b/book/Grave/seg2006ConvertedWavesTSIC/paper.tex deleted file mode 100644 index 9c83495e92..0000000000 --- a/book/Grave/seg2006ConvertedWavesTSIC/paper.tex +++ /dev/null @@ -1,573 +0,0 @@ -\published{SEG Expanded Abstracts, 25, 2460-2464, (2006)} -\title{Time-shift imaging condition for converted waves} -\author{ -Paul Sava, Center for Wave Phenomena, Colorado School of Mines, Golden CO 80401, USA \\ -Sergey Fomel, Bureau of Economic Geology, University of Texas (Austin), Austin, TX 78758, USA -} - -\maketitle - -\input{macro} - -% ------------------------------------------------------------ -\begin{abstract} -A typical imaging condition for seismic reflection data -involves source and receiver wavefield matching, e.g. by -cross-correlation, at every image location. -This statement is true no matter how the two wavefields -are reconstructed, for example by -one-way wavefield extrapolation, or -two-way reverse-time extrapolation, or -Kirchhoff integral methods. -This statement is also true when the source and receiver -wavefields are reconstructed using different velocity models, -as is the case for imaging of converted waves. -Angle-dependent reflectivity information can be extracted -from the source and receiver wavefield by retaining multiple lags -of the imaging cross-correlation, i.e. by analyzing the match of -wavefields shifted relative to one-another. -Wavefields can be shifted in space (3D) or in time (1D), and -each shift method has an associated angle-decomposition method. -This paper explores the various types of imaging condition -using space- and time-shifts and -derives relations for angle decomposition for converted-wave -imaging. -\end{abstract} - -% ------------------------------------------------------------ -\section{Introduction} -A key challenge for imaging in complex areas is accurate -determination of a velocity model in the area under investigation. -Migration velocity analysis is based on the principle that -image accuracy indicators are optimized when -data are correctly imaged. -A common procedure for velocity analysis is to examine the -alignment of images created with multi-offset data. -An optimal choice of image analysis can be done in the -angle domain which is free of complicated -artifacts present in surface offset gathers in complex areas -\cite[]{GEO69-02-05620575}. -\par -Migration velocity analysis after migration by wavefield -extrapolation requires image decomposition -in scattering angles relative -to reflector normals. Several methods have -been proposed for such decompositions -\cite[]{GEO55-09-12231234, -SEG-1999-08240827, -SEG-2000-08300833, -GEO67-03-08830889, -XieWu.adcig, -GEO68-03-10651074, -SEG-2003-08890892, -Fomel.seg.3dadcig, -SEG-2003-21042107}. -These procedures require decomposition of -extrapolated wavefields in variables that are -related to the reflection angle. - -A key component of such image decompositions -is the imaging condition. -A careful implementation of the imaging condition preserves -all information necessary to decompose images in their -angle-dependent components. -The challenge is efficient and reliable construction of these -angle-dependent images for velocity or amplitude analysis. - -In migration with wavefield extrapolation, a prestack imaging condition -based on spatial shifts of the source and receiver wavefields allows -for angle-decomposition -\cite[]{GEO67-03-08830889,SavaFomel.segab2.2005}. -Such formed angle-gathers describe reflectivity as a -function of reflection angles and are powerful tools for migration -velocity analysis (MVA) or amplitude versus angle analysis (AVA). -However, due to the large expense of space-time -cross-correlations, especially in three dimensions, -this imaging methodology is not yet used routinely in data processing. - -A different form of imaging condition involves -time-shifts instead of space-shifts -between wavefields computed from sources and receivers -\cite[]{SavaFomel.geo.tsic}. -Similarly to the space-shift imaging condition, an image is built by -space-time cross-correlations of subsurface wavefields, -and multiple lags of the time cross-correlation are preserved in the image. -Time-shifts have physical meaning that can be related directly -to reflection geometry, similarly to the procedure used for -space-shifts. -Furthermore, time-shift imaging is cheaper to apply than space-shift -imaging, and thus it might alleviate some of the difficulties -posed by costly cross-correlations in 3D space-shift imaging condition. - -The time-shift imaging concept is applicable to Kirchhoff -migration, migration by wavefield extrapolation, or -reverse-time migration. -This concept is also applicable to migration of single-mode (PP) or -converted-mode (PS) waves. In this paper, we develop the theory -and show examples of angle decomposition after time-shift -imaging of converted waves. All formulas developed for this purpose -reduce to the previously-derived formulas for decomposition of -single-mode images -\cite[]{SavaFomel.segab2.2005,SavaFomel.geo.tsic}. - -% ------------------------------------------------------------ -\section{Imaging condition} - -If we make the assumption that seismic data consists -of singly-scattered reflections, -we can describe migration as a succession of two steps: -\par -{\bf Wavefield extrapolation}, in which step we construct -source and receiver wavefields from synthetic or recorded data. -The source and receiver wavefields are four-dimensional objects -denoted by the symbols $\us(\mm,t)$ and $\ur(\mm,t)$, -where $\mm$ indicates position in a three-dimensional space, and -$t$ indicates time. -In typical migration procedures, -the four-dimensional objects $\us$ and $\ur$ are not stored -explicitly, but they are computed on-the-fly as needed for imaging -at a given position $\mm$ in space. -\par -{\bf Imaging condition}, in which step we extract reflectivity -information by comparing the source and receiver wavefields. -A useful imaging condition produces a map of reflectivity at all locations -in space, function of angles of incidence and reflection. -This information can be employed in migration velocity analysis (MVA) -and amplitude-versus-angle analysis (AVA). - -We can distinguish two parts of an imaging condition: -wavefield comparison and angle-decomposition. -In the first part, we explore the match of source and receiver -wavefields and build objects containing reflectivity information. -Cross-correlation at every location in space is an example of -wavefield comparison. -In the second part, -we extract the actual angle-dependent reflectivity information -from images produced by space-time wavefield cross-correlation. - -We can look at an imaging procedure formulated in this framework -as an exercise in matching of two four-dimensional objects. -Fundamentally, there is no difference between the four coordinate -axes, except for their physical meaning. We can exploit this similitude -of coordinate axes in formulating generic wavefield comparison procedures. -Deconvolution or cross-correlation are just two particular options. -Angle-decomposition, however, requires physical interpretation of the -four coordinate axes to extract meaningful information about reflection -angles. We exploit those physical relations to derive the formulas -presented in this paper. - -All types of migration procedures for converted waves, including -Kirchhoff migration, -migration by wavefield extrapolation, -reverse-time migration etc. -can be formulated in this framework. - -\subsection{Conventional imaging condition} -A conventional imaging condition for shot-record -migration, also known as $U \K{D}$ imaging condition \cite[]{Claerbout.iei}, -consists of time cross-correlation at every image location -between the source and receiver wavefields, -followed by image extraction at zero time. -Mathematically, we can represent this process by the relations -\bea -\uu \left(\mm, t \right) &=& -\us \left(\mm, t \right) \ast -\ur \left(\mm, t \right) \;, -\\ -\RR \left(\mm \right) &=& -\uu \left(\mm,t=0 \right) \;. -\eea -Here, $\mm=\mv$ is a vector -describing the locations of image points, -$\us(\mm,t)$ and -$\ur(\mm,t)$ are source and receiver wavefields -respectively, and $\RR(\mm)$ denotes the -migrated image, proportional to reflectivity at every location -in space. -The symbol $\ast$ denotes cross-correlation in time. - -A typical implementation of this imaging condition is in the -Fourier domain, where the image is produced using the -expression -\beq -\RR \left(\mm \right) = \sum_\w - \US\left(\mm,\w \right) -\K{\UR\left(\mm,\w \right)} \;, -\eeq -where summation over frequency $\w$ corresponds to imaging -at zero time. -The over-line represents a complex conjugate -applied on the receiver wavefield $\UR$ in the -Fourier domain. - -\subsection{Space- and time-shift imaging condition} -We can formulate a more general imaging condition -based on cross-correlation of the source and receiver -wavefields after shifting in both time and space. -Mathematically, we can represent this process by the relations -\bea \label{eqn:imgD} -\uu \left(\mm,\hh,t,\tt \right) &=& -\us \left(\mm-\hh,t-\tt \right) \ast -\ur \left(\mm+\hh,t+\tt \right) \;, -\\ -\RR \left(\mm,\hh,\tt \right) &=& -\uu \left(\mm,\hh,\tt,t=0 \right) \;. -\eea -Here, $\hh=\hv$ is a vector describing the local -source-receiver separation in the image space, and - $\tt$ is a time-shift between the source -and receiver wavefields prior to imaging. -In this imaging condition we do not assume that the -source and receiver wavefields maximize image strength -at the zero-lag of the space-time cross-correlation. -Instead, we probe wavefield similitude at other lags using -both shifting in space and time. - -This imaging condition can be implemented in the -Fourier domain using the expression -\beq \label{eqn:imgDw} -\RR \left(\mm,\hh,\tt \right) = \sum_\w - \US\left(\mm-\hh,\w \right) -\K{\UR\left(\mm-\hh,\w \right)} e^{2i\w\tt} \;. -\eeq -Special cases of this imaging condition correspond to -purely space-shift $\tt=0$, when the imaging condition reduces to -\cite[]{SavaFomel.segab2.2005} -\beq \label{eqn:imgHw} -\RR \left(\mm,\hh \right) = \sum_\w - \US\left(\mm-\hh ,\w \right) -\K{\UR\left(\mm+\hh ,\w \right)} \;, -\eeq -or purely time-shift $\hh=0$, when the imaging condition reduces to -\cite[]{SavaFomel.geo.tsic} -\beq \label{eqn:imgTw} -\RR \left(\mm,\tt \right) = \sum_\w - \US\left(\mm,\w \right) -\K{\UR\left(\mm,\w \right)} e^{2i\w\tt} \;. -\eeq -The imaging procedures described in this section produce -images that can be used for angle decomposition -of reflectivity at every image location, thus making this -imaging procedure useful for MVA or AVA. - -The imaging conditions presented in this section make no assumption -on the nature of the source and receiver wavefields -We can reconstruct those two wavefields using any type of -extrapolation, or using different velocity models for extrapolation of -the source and receiver wavefields. - -In the following section, we discuss angle-decomposition based on the -images obtained by conditions described in the current section. -For angle decomposition, we cannot ignore anymore the physical nature -of the two wavefields we are comparing, and we need to specify -what type of wave (P or S) do the various wavefields correspond to. -For the following analysis, we will assume that source wavefields -correspond to incident P waves, and receiver wavefields correspond to -reflected S waves. - -% ------------------------------------------------------------ -\inputdir{XFig} -\multiplot[t]{2}{experimentC,vecC}{height=1in} -{ (a) Synthetic PS reflection experiment, and - (b) Geometric relations between ray vectors at an image point.} - -% ------------------------------------------------------------ -\section{Angle decomposition} -We can develop procedures for angle-decomposition starting -from the multi-lag cross-correlations constructed in the preceding -section. At this stage, we need to exploit the physical -meaning of the various lags, either along space axes or along -the time axis. In general, 3-D angle-decomposition should define -reflectivity function of reflection and azimuth angles. -In this paper, we concentrate on decomposition function -of the reflection angle only. - -Using the definitions introduced in the preceding section, -we can make the standard notations for source and -receiver coordinates, respectively: -$\ss = \mm - \hh$ and $\rr = \mm + \hh$. -The traveltime from a source to a receiver is a function -of all spatial coordinates of the seismic experiment -$ t = t \lp \mm,\hh \rp$. -Suppose we could identify the function $t\lp \mm,\hh \rp$, then -differentiating $t$ with respect to all -components of the vectors $\mm$ and $\hh$, -and using the standard notations -$ {\bf p}_\alpha = \nabla_\alpha t$, -where $\alpha=\{\mm,\hh,\ss,\rr\}$, we can write -$\pmv = \prv + \psv$ and $\phv = \prv - \psv$. -Therefore, we can also write equivalent relations -$2\psv = \pmv - \phv$ and $2\prv = \pmv + \phv$. - -By analyzing the geometric relations of various -vectors at an image point, Figure~\ref{fig:vecC}, -we can write the trigonometric expressions: -\bea \label{eqn:PmPh-a} -4 \mph^2 &=& \mps^2 + \mpr^2 - 2 \mps \mpr \cos(2 \t) \;, -\\ \label{eqn:PmPh-b} -4 \mpm^2 &=& \mps^2 + \mpr^2 + 2 \mps \mpr \cos(2 \t) \;. -\eea - -\subsection{Space-shift angle decomposition for converted waves} -We can transform the expressions \req{PmPh-a}-\req{PmPh-b} -using the notations -$\mps=s$ and $\mpr=\g s$, where -$\g(\mm)$ is the $v_p/v_s$ ratio, and -$ s(\mm)$ is the slowness associated with the -incoming ray at every image point: -\bea \label{eqn:PmPh-a-cw} -\mph^2 &=& s^2 \lp 1+\g^2 -2\g \cos 2\t \rp \;, -\\ \label{eqn:PmPh-b-cw} -\mpm^2 &=& s^2 \lp 1+\g^2 +2\g \cos 2\t \rp \;. -\eea -If we eliminate $\w$ and make the notations -$\mkh=\mph/\w$ and -$\mkm=\mpm/\w$, we obtain the expression -\cite[]{SavaFomel.segab1.2005} -\beq \label{eqn:C-h} -\tan^2 \t = \frac -{(1+\g)^2 \mkh^2 - (1-\g)^2 \mkm^2} -{(1+\g)^2 \mkm^2 - (1-\g)^2 \mkh^2} \;, -\eeq -that can be used for angle decomposition for -converted waves after space-shift imaging condition. -For PP reflections ($\g=1$), this expression reduces to -\beq -\tan^2 \t = \frac{\mkh^2}{\mkm^2} \;. -\eeq - -\subsection{Time-shift angle decomposition for converted waves} -Using the same definitions for $\mps$ and $\mpr$ as in the -preceding subsection, we can use equation~\req{PmPh-b-cw} -to derive the relation -\beq \label{eqn:C-t-m} -\cos^2 \t = \frac{1}{\g} \frac{\mpm^2}{4s^2} - \frac{\lp 1-\g \rp^2}{4\g} \;. -\eeq -For PP reflections ($\g=1$), this expression reduces to -\beq -\cos \t = \frac{\mpm}{2s} \;. -\eeq - -% ------------------------------------------------------------ -\section{Algorithms} -In the most general case described in this paper, a seismic image -is a multi-dimensional object function of position $\mm$, -space-shift $\hh$ and time-shift $\tt$, $\RR(\mm,\hh,\tt)$. -We can use the relations between space and time coordinates -developed in the preceding section to define various -angle-decomposition algorithms. -Since $\RR(\mm,\hh,\tt)$ is a large object that is unlikely, in practice, -to be computed or stored completely, we design algorithms involving -subsets of this large image: - -\subsection{Space-shift angle decomposition} -If we construct a seismic image using only space-shift $\RR(\mm,\hh)$, -we use equation~\req{C-h} for angle decomposition of converted-mode waves. -The computation and storage requirements are high, since -we need to store images for 3-D cross-correlation lags. -However, if only the reflection angle is of interest, we can -reduce cost by storing only the absolute value of the space-shift -vector \cite[]{SavaFomel.segab2.2005}. - -A decomposition algorithm is a follows: -\[ -\RR(\mm,\hh) \rightarrow -\RR(\kmv,\khv) \rightarrow -\RR(\kmv,\mkh/\mkm) \rightarrow -\RR(\mm,\theta) -\] -where each arrow indicates a transformation from one domain -to another, and $\kmv$ and $\khv$ are the Fourier duals of -position $\mm$ and space-shift $\hh$. -The transform from $(\mm,\hh)$ to $(\kmv,\khv)$ and back -represent Fourier transforms, and the transformation -from $(\kmv,\khv)$ to $(\kmv,\mkh/\mkm)$ represents slant-stacking. -The decomposition -from the slant-stack parameter $\mkh/\mkm$ to the -reflection angle $\theta$ requires a -space-domain correction based on the $v_p/v_s$ ratio $\gamma$. - -\subsection{Time-shift angle decomposition} -If we construct a seismic image using only time-shift $\RR(\mm,\tt)$, -we use equation~\req{C-t-m} for angle decomposition -of converted-mode waves. -The computation and storage requirements are small, since -we need to store images for 1-D cross-correlation lags. -However, although the cost is smaller, we lose the option of computing -the azimuth of the reflection and we are limited only to the -reflection angle. - -A decomposition algorithm is a follows: -\[ -\RR(\mm,\tt) \rightarrow -\RR(\kmv,\w) \rightarrow -\RR(\kmv,\mkm/\w) \rightarrow -\RR(\mm,\theta) -\] -where $\kmv$ and $\w$ are the Fourier duals of -position $\mm$ and time-shift $\tt$. -The decomposition -from the slant-stack parameter $\mkm/\w$ requires a -space-domain correction based on the -slowness $s$ and the $v_p/v_s$ ratio $\gamma$. - -% ------------------------------------------------------------ -\section{Example} - -We illustrate the imaging and angle-decomposition methods derived -in this paper with a synthetic example. -The reflectivity model consists of five reflectors of increasing -slopes, from $0^\circ$ to $60^\circ$, as illustrated in -Figure~\ref{fig:experimentC}. -In this experiment, -the P-wave velocity is $v_p=3200$~m/s and -the S-wave velocity is $v_s=800$~m/s. -We chose those velocities in order to capture reflections off the -steeper dipping reflectors in a reasonable acquisition geometry. -In this experiment, we analyze one common-image gather located -at the same horizontal position as the surface seismic source. -In this way, the reflector dip is equal to the angle of incidence -on each reflector. - -Figure~\ref{fig:experimentC} shows a schematic of a converted-mode (PS) -experiment. Given the constant velocity of the model, -the single-mode data from the reflector dipping more than $45^\circ$ -would not be recorded at the surface. -In contrast, the converted-mode data from all reflectors -are recorded at the surface. - -\inputdir{cwtsic3} -% ------------------------------------------------------------ -\plot[t]{ps}{width=3.0in}{Synthetic PS reflection data} -% ------------------------------------------------------------ -\plot[b]{psimg-h}{width=3.0in}{Migrated image for PS data} -% ------------------------------------------------------------ - -Figure~\ref{fig:ps} shows the converted-mode seismic data from all -five reflectors. We analyze the positive offsets of the seismic data -which contain the reflections from the interfaces in the model. - -We migrate this shot using one-way wavefield extrapolation using -space-shift and time-shift imaging conditions. -Figure~\ref{fig:psimg-h} shows the migrated image at -zero shift. -As predicted by theory, this image is identical -for both space-shift and time-shift imaging conditions when the -values of the shift is zero. - -Figures~\ref{fig:psoff-h}-\ref{fig:psang-h} -show different views of the common-image gather (CIG) located at the -same horizontal location as the source $x=1000$~m. -Panel (a) depicts the CIG resulting from the space-shift imaging -condition. The vertical axis represents depth $z$ and the horizontal -axis represents horizontal space-shift labeled, for simplicity, $h$. -Panel (b) depicts the same CIG after slant-stack in the $z-h$ space. -The horizontal axis is the slant-stack parameter, which is related to -the reflection angle at every reflector, except for a correction based -on dip and the $v_p/v_s$ ratio. -Panel (c) depicts the same CIG after transformation to reflection -angle $\t$ using local values of P and S velocities, as well as a -correction for the structural dip measured on the migrated image -depicted in Figure~\ref{fig:psimg-h}. -As expected, each reflector is represented in this final plot at -a specific angle of incidence. The vertical lines indicate the -correct reflection angles of converted waves reflecting from the -interfaces dipping at angles between $0^\circ$ and $60^\circ$. - -Figures~\ref{fig:psoff-t}-\ref{fig:psang-t} show a similar analysis -to the one in Figures~\ref{fig:psoff-h}-\ref{fig:psang-h} but for -imaging using time-shift. -Panel (a) depicts one CIG at $x=1000$~m, -panel (b) depicts the CIG after slant-stack in the $z-\tt$ space, and -panel (c) depicts the CIG after transformation to reflection angle, -including the space-domain corrections for structural dip and -$v_p/v_s$ ratio. - -As for the space-shift images, the energy corresponding to every reflector -from the CIG obtained by time-shift imaging concentrates well in the -slant-stack panels, Figures\ref{fig:psssk-h} and \ref{fig:psssk-t}. -However, a striking difference occurs in the $z-\t$ panels: -while the energy for every reflector -in Figure~\ref{fig:psang-h} concentrates well, -the energy in Figure~\ref{fig:psang-t} is much less focused, -particularly at small angles. - -This phenomenon was observed and discussed in detail by -\cite{SavaFomel.segab2.2005}, and it is related to the lower angular resolution -for time-shift imaging at small angles. This fact is illustrated -in Figures~\ref{fig:ssk}-\ref{fig:cor} depicting impulse response -transformations for time-shift imaging: -panel (a) depicts various events in a slant-stack panel, -similar to Figure~\ref{fig:psssk-t}, and -panel (b) depicts the same events in a reflection angle panel, -similar to Figure~\ref{fig:psang-t}. -At small reflection angles, the angular resolution is low, but it increases -at large reflection angles to levels comparable with those of -reflections mapped using space-shift imaging. -The simple explanation for this phenomenon is that -the space-shift transformation involves the $\tan \t$ trigonometric -function whose slope at $\t \rightarrow 0$ is equal to $1$, -while the time-shift transformation involves the $\cos \t$ function -whose slope at $\t \rightarrow 0$ is equal to $0$. -Thus, even given equivalent slant-stack resolutions, -the angle resolution around $\t=0$ is poorer for time-shift -imaging than for space-shift imaging because of the -different trigonometric function. - -% ------------------------------------------------------------ -\multiplot{3}{psoff-h,psssk-h,psang-h}{width=0.90in} -{Common-image gather at $x=1000$~m for space-shift imaging condition: -common-image gather (a), -slant-stack gather (b) and -common-angle gather (c).} -% ------------------------------------------------------------ -% ------------------------------------------------------------ -\multiplot{3}{psoff-t,psssk-t,psang-t}{width=0.90in} -{Common-image gather at $x=1000$~m for time-shift imaging condition: -common-image gather (a), -slant-stack gather (b) and -common-angle gather (c).} -% ------------------------------------------------------------ -% ------------------------------------------------------------ -\multiplot{2}{ssk,cor}{width=0.90in} -{Resolution experiment for time-shift imaging condition: -simulated slant-stack (a) and -angle-decomposition (b). -Although the slant-stack is well focused for all events -both function of depth $z$ and slant-stack parameter $\nu$, -the resolution of the angle transformation is lower at small -angles and higher at large angles. -} -% ------------------------------------------------------------ - -% ------------------------------------------------------------ -\section{Conclusions} -We develop imaging conditions for converted waves -based on time-shifts between source and receiver wavefields. -This method is applicable to Kirchhoff, reverse-time and -wave-equation migrations and produces common-image gathers -indicative of velocity errors. -In wave-equation migration, time-shift imaging is -more efficient than space-shift imaging, since it only involves -a simple phase shift prior to the application -of the usual imaging cross-correlation. -Disk storage is also reduced, since the output volume -depends on only one parameter (time-shift $\tt$) instead -of three parameters (space-shift $\hh$). -We show how this imaging condition can be used to -construct angle-gathers from time-shift gathers. -Although time-shift imaging is, in principle, capable of -representing the same information as space-shift imaging, -in practice the angular resolution of the angle decomposition for -time-shift is much lower than the one for space-shift. -This inconvenience needs to be addressed by future research. - -% ------------------------------------------------------------ -\section{Acknowledgment} -We would like to acknowledge ExxonMobil for partial financial support -of this research. - -% ------------------------------------------------------------ -\bibliographystyle{seg} -\bibliography{SEG,PCS,MISC} - diff --git a/user/nobody/Maborn.c b/user/nobody/Maborn.c deleted file mode 100644 index 3912a04c1b..0000000000 --- a/user/nobody/Maborn.c +++ /dev/null @@ -1,549 +0,0 @@ -/* Born modeling */ - -/* - Copyright (C) 2006 Colorado School of Mines - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#ifdef _OPENMP -#include -#endif - -int main(int argc, char* argv[]) -{ - bool verb; /* verbosity flag */ - bool abc; /* absorbing boundary conditions flag */ - bool free; /* free surface flag*/ - bool snap; /* wavefield snapshots flag */ - int jsnap;/* save wavefield every *jsnap* time steps */ - - /* cube axes */ - sf_axis at,az,ax,as,ar,bt; - int it,iz,ix,is,ir, iop; - int nt,nz,nx,ns,nr,nz2,nx2; - float z0,x0,dt,dx,dz, idx,idz,dt2; - - /* Laplacian */ - int nop=2; /* Laplacian operator size */ - float c0, c1, c2; /* Laplacian operator coefficients */ - float co,c1x,c2x,c1z,c2z; - - int nbz,nbx; /* boundary size */ - float tz, tx; /* sponge boundary decay coefficients */ - float dp; - float ws; /* injected data */ - - /* linear interpolation */ - float *fzs,*fxs, *fzr,*fxr; - int *jzs,*jxs, *jzr,*jxr; - - float *ws00,*ws01,*ws10,*ws11; - float *wr00,*wr01,*wr10,*wr11; - - /* boundary */ - float *bzl,*bzh,*bxl,*bxh; - - /* I/O files */ - sf_file Fw,Fs,Fr; - float *ww; /* wavelet */ - pt2d *ss, *rr; /* source/receiver locations */ - - float **tt; /* taper */ - - /* background */ - sf_file Bv,Bd,Bu; /* velocity, data, wavefield */ - float **bvv,**bvo; /* velocity */ - float *bdd; /* data */ - float **bum,**buo,**bup,**bud; /* wavefields */ - - /* perturbation */ - sf_file Pv,Pd,Pu; - float **pvv,**pvo; - float *pdd; - float **pum,**puo,**pup,**pud; - - int ompchunk; /* OpenMP data chunk size */ - -/*------------------------------------------------------------*/ - - /* init RSF */ - sf_init(argc,argv); - - if(! sf_getint("ompchunk",&ompchunk)) ompchunk=1; - - if(! sf_getbool("verb",&verb)) verb=false; - if(! sf_getbool( "abc",&abc )) abc=false; - if(! sf_getbool("snap",&snap)) snap=false; - if(! sf_getbool("free",&free)) free=false; - - Fw = sf_input ("in" ); /* wavelet */ - Fs = sf_input ("sou"); /* sources */ - Fr = sf_input ("rec"); /* receivers */ - - Bv = sf_input ("vel"); /* velocity */ - Bu = sf_output("wfl"); /* wavefield */ - Bd = sf_output("out"); /* data */ - - Pv = sf_input ("ref"); /* velocity */ - Pu = sf_output("liw"); /* linearized wavefield */ - Pd = sf_output("lid"); /* linearized data */ - - /* read axes*/ - at=sf_iaxa(Fw,1); sf_setlabel(at,"t"); - nt=sf_n(at); dt=sf_d(at); if(verb) sf_raxa(at); /* time */ - as=sf_iaxa(Fs,2); sf_setlabel(as,"s"); - ns=sf_n(as); if(verb) sf_raxa(as); /* sources */ - ar=sf_iaxa(Fr,2); sf_setlabel(ar,"r"); - nr=sf_n(ar); if(verb) sf_raxa(ar); /* receivers */ - - az=sf_iaxa(Bv,1); sf_setlabel(az,"z"); - nz=sf_n(az); dz=sf_d(az); if(verb) sf_raxa(az); /* depth */ - ax=sf_iaxa(Bv,2); sf_setlabel(ax,"x"); - nx=sf_n(ax); dx=sf_d(ax); if(verb) sf_raxa(ax); /* space */ - - /* configure wavefield snapshots */ - if(snap) { - if(! sf_getint("jsnap",&jsnap)) jsnap=nt; - } - -/*------------------------------------------------------------*/ - - /* expand domain for absorbing boundary conditions */ - if(abc) { - if(! sf_getint("nbz",&nbz)) nbz=nop; if(nbz= z0 && - ss[is].z < z0 + (nz2-1)*dz && - ss[is].x >= x0 && - ss[is].x < x0 + (nx2-1)*dx) { - - jzs[is] = (int)( (ss[is].z-z0)/dz); - fzs[is] = (ss[is].z-z0)/dz - jzs[is]; - jxs[is] = (int)( (ss[is].x-x0)/dx); - fxs[is] = (ss[is].x-x0)/dx - jxs[is]; - } else { - jzs[is] = 0; jxs[is] = 0; - fzs[is] = 1; fxs[is] = 0; - ss[is].v= 0; - } - - ws00[is] = (1-fzs[is])*(1-fxs[is]); - ws01[is] = ( fzs[is])*(1-fxs[is]); - ws10[is] = (1-fzs[is])*( fxs[is]); - ws11[is] = ( fzs[is])*( fxs[is]); - - } - - for (ir=0;ir= z0 && - rr[ir].z < z0 + (nz2-1)*dz && - rr[ir].x >= x0 && - rr[ir].x < x0 + (nx2-1)*dx) { - - jzr[ir] = (int)( (rr[ir].z-z0)/dz); - fzr[ir] = (rr[ir].z-z0)/dz - jzr[ir]; - jxr[ir] = (int)( (rr[ir].x-x0)/dx); - fxr[ir] = (rr[ir].x-x0)/dx - jxr[ir]; - - rr[ir].v=1; - } else { - jzr[ir] = 0; - fzr[ir] = 1; - rr[ir].v= 0; - } - - wr00[ir] = (1-fzr[ir])*(1-fxr[ir]); - wr01[ir] = ( fzr[ir])*(1-fxr[ir]); - wr10[ir] = (1-fzr[ir])*( fxr[ir]); - wr11[ir] = ( fzr[ir])*( fxr[ir]); - } - -/*------------------------------------------------------------*/ - - /* allocate temporary arrays */ - bum=sf_floatalloc2(nz2,nx2); - buo=sf_floatalloc2(nz2,nx2); - bup=sf_floatalloc2(nz2,nx2); - bud=sf_floatalloc2(nz2,nx2); - - pum=sf_floatalloc2(nz2,nx2); - puo=sf_floatalloc2(nz2,nx2); - pup=sf_floatalloc2(nz2,nx2); - pud=sf_floatalloc2(nz2,nx2); - - tt=sf_floatalloc2(nz2,nx2); - -#ifdef _OPENMP -#pragma omp parallel for schedule(dynamic,ompchunk) private(iz,ix) shared(nx2,nz2,bum,buo,bup,bud,pum,puo,pup,pud,tt) -#endif - for (iz=0; iz - -int main(int argc, char* argv[]) -{ - bool inv, verb; - int nz, na, iz, ia, nw, n3, i3; - float **gather, *trace, *modl, *coord, *dzdx; - float da, a0, t,d; - sf_file in, out, dip; - - sf_init (argc,argv); - - if (!sf_getbool("verb",&verb)) verb=false; - - in = sf_input ( "in"); - out = sf_output( "out"); - dip = sf_input ( "dip"); - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - - if (!sf_histint (in,"n1",&nz)) sf_error("No n1= in input"); - if (!sf_histint (in,"n2",&na)) sf_error("No n2= in input"); - if (!sf_histfloat(in,"d2",&da)) sf_error("No d2= in input"); - if (!sf_histfloat(in,"o2",&a0)) sf_error("No o2= in input"); - - if (!sf_getint("nw",&nw)) nw=4; /* accuracy level */ - - sf_prefilter_init (nw,na,2*na); - - n3 = sf_leftsize(in,2); - - if (!sf_getbool("inv",&inv)) inv=false; - /* if y, do inverse transform */ - - gather = sf_floatalloc2(nz,na); - trace = sf_floatalloc ( na); - coord = sf_floatalloc ( na); - modl = sf_floatalloc ( na); - dzdx = sf_floatalloc (nz ); - - for (i3=0; i3 < n3; i3++) { /* loop over CIG */ - if(verb) sf_warning("%d of %d",i3+1,n3); - - sf_floatread( dzdx ,nz ,dip ); - sf_floatread(gather[0],nz*na,in ); - - for (iz=0; iz < nz; iz++) { /* loop over depth */ - d = dzdx[iz]; - - for (ia=0; ia < na; ia++) { /* loop over tan */ - t = a0+ia*da; - - /* - loop over output t; - find map to input t0, i.e. t0=f(t); - */ - coord[ia] = t * sqrtf(1.+d*d); - - trace[ia] = gather[ia][iz]; - } - - sf_prefilter_apply (na,trace); - sf_int1_init (coord, a0, da, na, sf_spline_int, nw, na); - sf_int1_lop (false,false,na,na,trace,modl); - - for (ia=0; ia < na; ia++) { - gather[ia][iz] = modl[ia]; - } - } - sf_floatwrite(gather[0],nz*na,out); - } - - exit(0); -} - diff --git a/user/nobody/Mafdm2d.c b/user/nobody/Mafdm2d.c deleted file mode 100644 index 86b47c8819..0000000000 --- a/user/nobody/Mafdm2d.c +++ /dev/null @@ -1,432 +0,0 @@ -/* Exploding reflector time-domain acoustic FD modeling */ -/* - Copyright (C) 2006 Colorado School of Mines - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -int main(int argc, char* argv[]) -{ - bool verb; /* verbosity flag */ - bool abc; /* absorbing boundary conditions flag */ - bool free; /* free surface flag*/ - bool snap; /* wavefield snapshots flag */ - int jsnap;/* save wavefield every *jsnap* time steps */ - - /* I/O files */ - sf_file Fw,Fv,Fs,Fr; - sf_file Fd,Fo; - - /* cube axes */ - sf_axis at,az,ax,as,ar,bt; - int nt,nz,nx,ns,nr,nz2,nx2; - int it,iz,ix,is,ir, iop; - float dx,dz,dt, x0,z0, idx,idz,dt2; - - /* arrays */ - float *ww,**vv; /* wavelet, velocity */ - pt2d *ss, *rr; /* source/receiver locations */ - float *dd; /* data */ - - float *fzs,*fxs, *fzr,*fxr; - int *jzs,*jxs, *jzr,*jxr; - - float *ws00,*ws01,*ws10,*ws11; - float *wr00,*wr01,*wr10,*wr11; - - float **um,**uo,**up,**ud,**vp,**tt; - float *bzl,*bzh,*bxl,*bxh; /* boundary */ - - int nop=2; /* Laplacian operator size */ - float c0, c1, c2; /* Laplacian operator coefficients */ - float co,c1x,c2x,c1z,c2z; - - int nbz,nbx; /* boundary size */ - float tz, tx; /* sponge boundary decay coefficients */ - float dp; - float ws; /* injected data */ - -/*------------------------------------------------------------*/ - - /* init RSF */ - sf_init(argc,argv); - - if(! sf_getbool("verb",&verb)) verb=false; - if(! sf_getbool( "abc",&abc )) abc=false; - if(! sf_getbool("snap",&snap)) snap=false; - if(! sf_getbool("free",&free)) free=false; - - Fw = sf_input ("in" ); /* wavelet */ - Fv = sf_input ("vel"); /* velocity */ - Fs = sf_input ("sou"); /* sources */ - Fr = sf_input ("rec"); /* receivers */ - Fo = sf_output("wfl"); /* wavefield */ - Fd = sf_output("out"); /* data */ - - /* read axes*/ - at = sf_iaxa(Fw,1); sf_setlabel(at,"t"); - nt = sf_n(at); dt=sf_d(at); if(verb) sf_raxa(at); /* time */ - az = sf_iaxa(Fv,1); sf_setlabel(az,"z"); - nz = sf_n(az); dz=sf_d(az); if(verb) sf_raxa(az); /* depth */ - ax = sf_iaxa(Fv,2); sf_setlabel(ax,"x"); - nx = sf_n(ax); dx=sf_d(ax); if(verb) sf_raxa(ax); /* space */ - as = sf_iaxa(Fs,2); sf_setlabel(as,"s"); - ns = sf_n(as); if(verb) sf_raxa(as); /* sources */ - ar = sf_iaxa(Fr,2); sf_setlabel(ar,"r"); - nr = sf_n(ar); if(verb) sf_raxa(ar); /* receivers */ - - /* configure wavefield snapshots */ - if(snap) { - if(! sf_getint("jsnap",&jsnap)) jsnap=nt; - } - -/*------------------------------------------------------------*/ - - /* expand domain for absorbing boundary conditions */ - if(abc) { - if(! sf_getint("nbz",&nbz)) nbz=nop; if(nbz= z0 && - ss[is].z < z0 + (nz2-1)*dz && - ss[is].x >= x0 && - ss[is].x < x0 + (nx2-1)*dx) { - - jzs[is] = (int)( (ss[is].z-z0)/dz); - fzs[is] = (ss[is].z-z0)/dz - jzs[is]; - jxs[is] = (int)( (ss[is].x-x0)/dx); - fxs[is] = (ss[is].x-x0)/dx - jxs[is]; - } else { - jzs[is] = 0; jxs[is] = 0; - fzs[is] = 1; fxs[is] = 0; - ss[is].v= 0; - } - - ws00[is] = (1-fzs[is])*(1-fxs[is]); - ws01[is] = ( fzs[is])*(1-fxs[is]); - ws10[is] = (1-fzs[is])*( fxs[is]); - ws11[is] = ( fzs[is])*( fxs[is]); - - } - - for (ir=0;ir= z0 && - rr[ir].z < z0 + (nz2-1)*dz && - rr[ir].x >= x0 && - rr[ir].x < x0 + (nx2-1)*dx) { - - jzr[ir] = (int)( (rr[ir].z-z0)/dz); - fzr[ir] = (rr[ir].z-z0)/dz - jzr[ir]; - jxr[ir] = (int)( (rr[ir].x-x0)/dx); - fxr[ir] = (rr[ir].x-x0)/dx - jxr[ir]; - - rr[ir].v=1; - } else { - jxr[ir] = 0; - fxr[ir] = 1; - jzr[ir] = 0; - fzr[ir] = 1; - rr[ir].v= 0; - } - - wr00[ir] = (1-fzr[ir])*(1-fxr[ir]); - wr01[ir] = ( fzr[ir])*(1-fxr[ir]); - wr10[ir] = (1-fzr[ir])*( fxr[ir]); - wr11[ir] = ( fzr[ir])*( fxr[ir]); - } - -/*------------------------------------------------------------*/ - - /* allocate temporary arrays */ - um=sf_floatalloc2(nz2,nx2); - uo=sf_floatalloc2(nz2,nx2); - up=sf_floatalloc2(nz2,nx2); - ud=sf_floatalloc2(nz2,nx2); - tt=sf_floatalloc2(nz2,nx2); - - for (iz=0; iz - -#ifdef _OPENMP -#include -#endif - -#define C1 0.66666666666666666666 /* 2/3 */ -#define C2 -0.08333333333333333333 /* -1/12 */ -#define D1(a,i2,i1,s) (C2*(a[i2 ][i1+2] - a[i2 ][i1-2]) + \ - C1*(a[i2 ][i1+1] - a[i2 ][i1-1]) )*s -#define D2(a,i2,i1,s) (C2*(a[i2+2][i1 ] - a[i2-2][i1 ]) + \ - C1*(a[i2+1][i1 ] - a[i2-1][i1 ]) )*s - -int main(int argc, char* argv[]) -{ - bool verb; /* verbosity flag */ - bool abc; /* absorbing boundary conditions flag */ - bool free; /* free surface flag*/ - bool snap; /* wavefield snapshots flag */ - bool dens; - int jsnap;/* save wavefield every *jsnap* time steps */ - - /* I/O files */ - sf_file Fw,Fs,Fr; - sf_file Fd,Fu; - sf_file Fv=NULL; /* velocity */ - sf_file Fe=NULL; /* density */ - - /* cube axes */ - sf_axis at,az,ax,as,ar; - int it,iz,ix,is,ir, iop; - int nt,nz,nx,ns,nr,nz2,nx2; - float z0,dz,x0,dx,idx,idz,dt,dt2; - - /* arrays */ - pt2d *ss, *rr; /* source/receiver locations */ - float *ww=NULL; /* wavelet */ - float *dd=NULL; /* data */ - float **vv=NULL; /* velocity */ - float **ee=NULL; /* density */ - - float *fzs,*fxs, *fzr,*fxr; - int *jzs,*jxs, *jzr,*jxr; - - float *ws00,*ws01,*ws10,*ws11; - float *wr00,*wr01,*wr10,*wr11; - - float **um,**uo,**up,**ud,**vp,**ro,**tt,**ut; - float *bzl,*bzh,*bxl,*bxh; /* boundary */ - - int nop=2; /* Laplacian operator size */ - float c0, c1, c2; /* Laplacian operator coefficients */ - float co,c1x,c2x,c1z,c2z; - - int nbz,nbx; /* boundary size */ - float tz, tx; /* sponge boundary decay coefficients */ - float dp; - float ws; /* injected data */ - - int ompchunk; /* OpenMP data chunk size */ - -/*------------------------------------------------------------*/ - - /* init RSF */ - sf_init(argc,argv); - - if(! sf_getint("ompchunk",&ompchunk)) ompchunk=1; - - if(! sf_getbool("verb",&verb)) verb=false; - if(! sf_getbool( "abc",&abc )) abc=false; - if(! sf_getbool("snap",&snap)) snap=false; - if(! sf_getbool("free",&free)) free=false; - if(! sf_getbool("dens",&dens)) dens=false; - - Fw = sf_input ("in" ); /* wavelet */ - Fv = sf_input ("vel"); /* velocity */ - Fs = sf_input ("sou"); /* sources */ - Fr = sf_input ("rec"); /* receivers */ - Fu = sf_output("wfl"); /* wavefield */ - Fd = sf_output("out"); /* data */ - - if(dens) Fe = sf_input("den"); /* density */ - - /* read axes*/ - at=sf_iaxa(Fw,1); sf_setlabel(at,"t"); if(verb) sf_raxa(at); /* time */ - az=sf_iaxa(Fv,1); sf_setlabel(az,"z"); if(verb) sf_raxa(az); /* depth */ - ax=sf_iaxa(Fv,2); sf_setlabel(ax,"x"); if(verb) sf_raxa(ax); /* space */ - as=sf_iaxa(Fs,2); sf_setlabel(as,"s"); if(verb) sf_raxa(as); /* source */ - ar=sf_iaxa(Fr,2); sf_setlabel(ar,"r"); if(verb) sf_raxa(ar); /* receiver */ - - nt=sf_n(at); dt=sf_d(at); - nz=sf_n(az); - nx=sf_n(ax); - ns=sf_n(as); - nr=sf_n(ar); - - /* configure wavefield snapshots */ - if(snap) { - if(! sf_getint("jsnap",&jsnap)) jsnap=nt; - } - -/*------------------------------------------------------------*/ - - /* expand domain for absorbing boundary conditions */ - if(abc) { - if(! sf_getint("nbz",&nbz)) nbz=nop; if(nbz= z0 && - ss[is].z < z0 + (nz2-1)*dz && - ss[is].x >= x0 && - ss[is].x < x0 + (nx2-1)*dx) { - - jzs[is] = (int)( (ss[is].z-z0)/dz); - fzs[is] = (ss[is].z-z0)/dz - jzs[is]; - jxs[is] = (int)( (ss[is].x-x0)/dx); - fxs[is] = (ss[is].x-x0)/dx - jxs[is]; - } else { - jzs[is] = 0; jxs[is] = 0; - fzs[is] = 1; fxs[is] = 0; - ss[is].v= 0; - } - - ws00[is] = (1-fzs[is])*(1-fxs[is]); - ws01[is] = ( fzs[is])*(1-fxs[is]); - ws10[is] = (1-fzs[is])*( fxs[is]); - ws11[is] = ( fzs[is])*( fxs[is]); - - } - - for (ir=0;ir= z0 && - rr[ir].z < z0 + (nz2-1)*dz && - rr[ir].x >= x0 && - rr[ir].x < x0 + (nx2-1)*dx) { - - jzr[ir] = (int)( (rr[ir].z-z0)/dz); - fzr[ir] = (rr[ir].z-z0)/dz - jzr[ir]; - jxr[ir] = (int)( (rr[ir].x-x0)/dx); - fxr[ir] = (rr[ir].x-x0)/dx - jxr[ir]; - - rr[ir].v=1; - } else { - jzr[ir] = 0; - fzr[ir] = 1; - rr[ir].v= 0; - } - - wr00[ir] = (1-fzr[ir])*(1-fxr[ir]); - wr01[ir] = ( fzr[ir])*(1-fxr[ir]); - wr10[ir] = (1-fzr[ir])*( fxr[ir]); - wr11[ir] = ( fzr[ir])*( fxr[ir]); - } - -/*------------------------------------------------------------*/ - - /* allocate temporary arrays */ - um=sf_floatalloc2(nz2,nx2); - uo=sf_floatalloc2(nz2,nx2); - up=sf_floatalloc2(nz2,nx2); - ud=sf_floatalloc2(nz2,nx2); - tt=sf_floatalloc2(nz2,nx2); - -#ifdef _OPENMP -#pragma omp parallel for schedule(dynamic,ompchunk) private(iz,ix) shared(nx2,nz2,um,uo,up,ud,tt) -#endif - for (iz=0; iz - -int main(int argc, char* argv[]) -{ - bool verb; - axa az,aa,ax; - int iz,ia,ix; - - sf_file Fd; /* data = angle z-a (input) */ - sf_file Fm; /* model = angle z-a (output) */ - sf_file Fa; - - int nw; /* spline order */ - - float **mmm=NULL; - float **ddd=NULL; - - float *dat=NULL; - float *mod=NULL; - float *map=NULL; - float *dip=NULL; - - float d,t; - -/*------------------------------------------------------------*/ - - sf_init(argc,argv); - - if(! sf_getbool("verb",&verb)) verb=false; /* verbosity flag */ - if(! sf_getint( "nw",&nw)) nw=4; /* spline order */ - - Fd = sf_input ("in"); - iaxa(Fd,&az,1); az.l="h"; if(verb) raxa(az); - iaxa(Fd,&aa,2); aa.l="a"; if(verb) raxa(aa); - iaxa(Fd,&ax,3); ax.l="x"; if(verb) raxa(ax); - - Fm = sf_output("out"); - oaxa(Fm,&az,1); - oaxa(Fm,&aa,2); - oaxa(Fm,&ax,3); - - Fa = sf_input("dip"); - -/*------------------------------------------------------------*/ - - mmm = sf_floatalloc2(az.n,aa.n); - ddd = sf_floatalloc2(az.n,aa.n); - - map = sf_floatalloc(aa.n); /* mapping */ - mod = sf_floatalloc(aa.n); /* model vector */ - dat = sf_floatalloc(aa.n); /* data vector */ - dip = sf_floatalloc(az.n); /* dip vector */ - - sf_prefilter_init(nw, /* spline order */ - aa.n, /* temporary storage */ - 2*aa.n); /* padding */ - - sf_int1_init( map, - aa.o, aa.d, aa.n, - sf_spline_int, - nw, - aa.n); - - for(ix=0;ix -#include -#ifdef _OPENMP -#include -#include "omputil.h" -#endif - -#include "fdutil.h" - -/* check: dt<= 0.2 * min(dx,dz)/vmin */ - -#define NOP 2 /* derivative operator half-size */ - -#define C0 -2.500000 /* c0=-30./12.; */ -#define CA +1.333333 /* ca=+16./12.; */ -#define CB -0.083333 /* cb=- 1./12.; */ - -#define C1 0.66666666666666666666 /* 2/3 */ -#define C2 -0.08333333333333333333 /* -1/12 */ - -#define Dxx(a,ix,iz,co,ca,cb) (co* a[ix ][iz ] + \ - ca*(a[ix-1][iz ] + a[ix+1][iz ]) + \ - cb*(a[ix-2][iz ] + a[ix+2][iz ]) ) - -#define Dzz(a,ix,iz,co,ca,cb) (co* a[ix ][iz ] + \ - ca*(a[ix ][iz-1] + a[ix ][iz+1]) + \ - cb*(a[ix ][iz-2] + a[ix ][iz+2]) ) - -#define D1x(a,ix,iz,c1x,c2x) \ - (c2x*(a[ix+2][iz ] - \ - a[ix-2][iz ])+ \ - c1x*(a[ix+1][iz ] - \ - a[ix-1][iz ]) ) - -#define D1z(a,ix,iz,c1z,c2z) \ - (c2z*(a[ix ][iz+2] - \ - a[ix ][iz-2])+ \ - c1z*(a[ix ][iz+1] - \ - a[ix ][iz-1]) ) - -#define Dxz(a,ix,iz,c1x,c2x,c1z,c2z) \ - (c2x * D1z(a,ix+2,iz,c1z,c2z) - \ - c2x * D1z(a,ix-2,iz,c1z,c2z) + \ - c1x * D1z(a,ix+1,iz,c1z,c2z) - \ - c1x * D1z(a,ix-1,iz,c1z,c2z)) - -#define Dzx(a,ix,iz,c1x,c2x,c1z,c2z) \ - (c2z * D1x(a,ix,iz+2,c1x,c2x) - \ - c2z * D1x(a,ix,iz-2,c1x,c2x) + \ - c1z * D1x(a,ix,iz+1,c1x,c2x) - \ - c1z * D1x(a,ix,iz-1,c1x,c2x)) - -int main(int argc, char* argv[]) -{ - bool verb,fsrf,snap,expl,dabc; - int jsnap,ntsnap,jdata; - char *atype; - - /* OMP parameters */ -#ifdef _OPENMP - int ompnth; -#endif - - /* I/O files */ - sf_file Fwav=NULL; /* wavelet */ - sf_file Fsou=NULL; /* sources */ - sf_file Frec=NULL; /* receivers */ - sf_file Fvel=NULL; /* velocity */ - sf_file Fdat=NULL; /* data */ - sf_file Fwfl=NULL; /* wavefield */ - - /* cube axes */ - sf_axis at,az,ax; - sf_axis as,ar; - - int nt,nz,nx,ns,nr,nb; - int it,iz,ix; - float dt,dz,dx,idz,idx,dt2; - - /* FDM structure */ - fdm2d fdm=NULL; - abcone2d abc=NULL; - sponge spo=NULL; - - /* I/O arrays */ - float *ww=NULL; /* wavelet */ - pt2d *ss=NULL; /* sources */ - pt2d *rr=NULL; /* receivers */ - float *dd=NULL; /* data */ - - float **tt=NULL; - float **vp=NULL; /* velocity */ - - float **vn2=NULL; - float **vv2=NULL; - float **vh2=NULL; - - float **ang=NULL; - float **sia=NULL; - float **coa=NULL; - - float **rm=NULL,**ro=NULL,**rp=NULL,**ra=NULL,**rt; /* main wavefield */ - float **qm,**qo,**qp,**qa,**qt; /* auxiliary wavefield */ - - /* linear interpolation weights/indices */ - lint2d cs,cr; - - /* FD operator size */ - float cox,coz,cax,cbx,caz,cbz; - float c1x,c2x,c1z,c2z; - - /* wavefield cut params */ - sf_axis acz=NULL,acx=NULL; - int nqz,nqx; - float oqz,oqx; - float dqz,dqx; - float **qc=NULL; - - float H2q,H1r; - float s2,c2,sc; - - /*------------------------------------------------------------*/ - /* init RSF */ - sf_init(argc,argv); - - /* select anisotropy model */ - if (NULL == (atype = sf_getstring("atype"))) atype = "i"; - switch(atype[0]) { - case 't': - sf_warning("TTI model"); - break; - - case 'v': - sf_warning("VTI model"); - break; - - case 'i': - sf_warning("ISO model"); - break; - - default: - sf_warning("ISO modeling - by default!"); - break; - } - - /*------------------------------------------------------------*/ - /* OMP parameters */ -#ifdef _OPENMP - ompnth=omp_init(); -#endif - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - if(! sf_getbool("verb",&verb)) verb=false; /* verbosity flag */ - if(! sf_getbool("snap",&snap)) snap=false; /* wavefield snapshots flag */ - if(! sf_getbool("free",&fsrf)) fsrf=false; /* free surface flag */ - if(! sf_getbool("expl",&expl)) expl=false; /* "exploding reflector" */ - if(! sf_getbool("dabc",&dabc)) dabc=false; /* absorbing BC */ - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* I/O files */ - Fwav = sf_input ("in" ); /* wavelet */ - Fvel = sf_input ("vel"); /* velocity */ - Fsou = sf_input ("sou"); /* sources */ - Frec = sf_input ("rec"); /* receivers */ - Fwfl = sf_output("wfl"); /* wavefield */ - Fdat = sf_output("out"); /* data */ - - /*------------------------------------------------------------*/ - /* axes */ - at = sf_iaxa(Fwav,2); sf_setlabel(at,"t"); if(verb) sf_raxa(at); /* time */ - az = sf_iaxa(Fvel,1); sf_setlabel(az,"z"); if(verb) sf_raxa(az); /* depth */ - ax = sf_iaxa(Fvel,2); sf_setlabel(ax,"x"); if(verb) sf_raxa(ax); /* space */ - - as = sf_iaxa(Fsou,2); sf_setlabel(as,"s"); if(verb) sf_raxa(as); /* sources */ - ar = sf_iaxa(Frec,2); sf_setlabel(ar,"r"); if(verb) sf_raxa(ar); /* receivers */ - - nt = sf_n(at); dt = sf_d(at); - nz = sf_n(az); dz = sf_d(az); - nx = sf_n(ax); dx = sf_d(ax); - - ns = sf_n(as); - nr = sf_n(ar); - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* other execution parameters */ - if(! sf_getint("jdata",&jdata)) jdata=1; - if(snap) { /* save wavefield every *jsnap* time steps */ - if(! sf_getint("jsnap",&jsnap)) jsnap=nt; - } - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* expand domain for FD operators and ABC */ - if( !sf_getint("nb",&nb) || nbnzpad); sf_seto(az,fdm->ozpad); if(verb) sf_raxa(az); - sf_setn(ax,fdm->nxpad); sf_seto(ax,fdm->oxpad); if(verb) sf_raxa(ax); - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* setup output data header */ - sf_oaxa(Fdat,ar,1); - - sf_setn(at,nt/jdata); - sf_setd(at,dt*jdata); - sf_oaxa(Fdat,at,2); - - /* setup output wavefield header */ - if(snap) { - if(!sf_getint ("nqz",&nqz)) nqz=sf_n(az); - if(!sf_getint ("nqx",&nqx)) nqx=sf_n(ax); - - if(!sf_getfloat("oqz",&oqz)) oqz=sf_o(az); - if(!sf_getfloat("oqx",&oqx)) oqx=sf_o(ax); - - dqz=sf_d(az); - dqx=sf_d(ax); - - acz = sf_maxa(nqz,oqz,dqz); sf_raxa(acz); - acx = sf_maxa(nqx,oqx,dqx); sf_raxa(acx); - /* check if the imaging window fits in the wavefield domain */ - - qc=sf_floatalloc2(sf_n(acz),sf_n(acx)); - - ntsnap=0; - for(it=0; itnzpad,fdm->nxpad); - - vv2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - sf_floatread(tt[0],nz*nx,Fvel ); expand(tt,vv2,fdm); /* vertical v */ - - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - vp [ix][iz] = vv2[ix][iz]; - vv2[ix][iz] = vv2[ix][iz] * vv2[ix][iz]; - } - } - if(fsrf) { /* free surface */ - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznb; iz++) { - vv2[ix][iz]=0; - } - } - } - - if(atype[0] != 'i') { - vn2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - vh2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - sf_floatread(tt[0],nz*nx,Fvel ); expand(tt,vn2,fdm); /* NMO v */ - sf_floatread(tt[0],nz*nx,Fvel ); expand(tt,vh2,fdm); /* horizontal v */ - - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - vn2[ix][iz] = vn2[ix][iz] * vn2[ix][iz]; - vh2[ix][iz] = vh2[ix][iz] * vh2[ix][iz]; - } - } - - if(fsrf) { /* free surface */ - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznb; iz++) { - vn2[ix][iz]=0; - vh2[ix][iz]=0; - } - } - } - } - - /*------------------------------------------------------------*/ - - if( atype[0]=='t') { - /* input tilt angle */ - ang =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - sia =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - coa =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - sf_floatread(tt[0],nz*nx,Fvel ); expand(tt,ang,fdm); - - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - ang[ix][iz] *= SF_PI/180.; - sia[ix][iz] = sinf(ang[ix][iz]); - coa[ix][iz] = cosf(ang[ix][iz]); - } - } - } - - /*------------------------------------------------------------*/ - free(*tt); free(tt); - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* allocate wavefield arrays */ - qm=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - qo=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - qp=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - qa=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - qm[ix][iz]=0; - qo[ix][iz]=0; - qp[ix][iz]=0; - qa[ix][iz]=0; - } - } - - if(atype[0] != 'i') { - rm=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - ro=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - rp=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - ra=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - rm[ix][iz]=0; - ro[ix][iz]=0; - rp[ix][iz]=0; - ra[ix][iz]=0; - } - } - } - - /*------------------------------------------------------------*/ - if(dabc) { - /* one-way abc setup */ - abc = abcone2d_make(NOP,dt,vp,fsrf,fdm); - /* sponge abc setup */ - spo = sponge_make(fdm->nb); - } - - /*------------------------------------------------------------*/ - /* - * MAIN LOOP - */ - /*------------------------------------------------------------*/ - if(verb) fprintf(stderr,"\n"); - for (it=0; itompchunk) \ - private(ix,iz,H2q,H1r,s2,c2,sc) \ - shared(fdm,ra,ro,qa,qo,cox,coz,cax,caz,cbx,cbz,c1x,c2x,c1z,c2z,idx,idz,vn2,vv2,vh2) -#endif - for (ix=NOP; ixnxpad-NOP; ix++) { - for(iz=NOP; iznzpad-NOP; iz++) { - - s2 = sia[ix][iz]*sia[ix][iz]; - c2 = coa[ix][iz]*coa[ix][iz]; - sc =2*sia[ix][iz]*coa[ix][iz]; - - H2q = c2*Dxx(qo,ix,iz,cox,cax,cbx) - + s2*Dzz(qo,ix,iz,coz,caz,cbz) - - sc*Dxz(qo,ix,iz,c1x,c2x,c1z,c2z); - - H1r = s2*Dxx(ro,ix,iz,cox,cax,cbx) - + c2*Dzz(ro,ix,iz,coz,caz,cbz) - + sc*Dxz(ro,ix,iz,c1x,c2x,c1z,c2z); - - /* main field - q */ - qa[ix][iz] = H2q * vh2[ix][iz] + H1r * vv2[ix][iz] ; - /* auxiliary field - r */ - ra[ix][iz] = H2q * vn2[ix][iz] + H1r * vv2[ix][iz] ; - - } - } - break; - - case 'v': - -#ifdef _OPENMP -#pragma omp parallel for \ - schedule(dynamic,fdm->ompchunk) \ - private(ix,iz,H2q,H1r) \ - shared(fdm,ra,ro,qa,qo,cox,coz,cax,caz,cbx,cbz,idx,idz,vn2) -#endif - for (ix=NOP; ixnxpad-NOP; ix++) { - for(iz=NOP; iznzpad-NOP; iz++) { - - H2q = Dxx(qo,ix,iz,cox,cax,cbx); - - H1r = Dzz(ro,ix,iz,coz,caz,cbz); - - /* main field - q */ - qa[ix][iz] = H2q * vh2[ix][iz] + H1r * vv2[ix][iz] ; - /* auxiliary field - r */ - ra[ix][iz] = H2q * vn2[ix][iz] + H1r * vv2[ix][iz] ; - - } - } - break; - - case 'i': - default: - -#ifdef _OPENMP -#pragma omp parallel for \ - schedule(dynamic,fdm->ompchunk) \ - private(ix,iz) \ - shared(fdm,qa,qo,cox,coz,cax,caz,cbx,cbz,idx,idz,vn2) -#endif - for (ix=NOP; ixnxpad-NOP; ix++) { - for(iz=NOP; iznzpad-NOP; iz++) { - - qa[ix][iz] = ( Dxx(qo,ix,iz,cox,cax,cbx) + - Dzz(qo,ix,iz,coz,caz,cbz) ) * vv2[ix][iz]; - - } - } - break; - } - - /* inject acceleration source */ - if(expl) { - sf_floatread(ww, 1,Fwav); - lint2d_inject1(qa,ww[0],cs); - if(atype[0] != 'i') lint2d_inject1(ra,ww[0],cs); - } else { - sf_floatread(ww,ns,Fwav); - lint2d_inject(qa,ww,cs); - if(atype[0] != 'i') lint2d_inject(ra,ww,cs); - } - - /* step forward in time */ -#ifdef _OPENMP -#pragma omp parallel for \ - schedule(dynamic,fdm->ompchunk) \ - private(ix,iz) \ - shared(fdm,qa,qo,qm,qp,dt2) -#endif - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - qp[ix][iz] = 2*qo[ix][iz] - - qm[ix][iz] - + qa[ix][iz] * dt2; - } - } - /* circulate wavefield arrays */ - qt=qm; - qm=qo; - qo=qp; - qp=qt; - - if(atype[0] != 'i') { - -#ifdef _OPENMP -#pragma omp parallel for \ - schedule(dynamic,fdm->ompchunk) \ - private(ix,iz) \ - shared(fdm,ra,ro,rm,rp,dt2) -#endif - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - rp[ix][iz] = 2*ro[ix][iz] - - rm[ix][iz] - + ra[ix][iz] * dt2; - } - } - /* circulate wavefield arrays */ - rt=rm; - rm=ro; - ro=rp; - rp=rt; - } - - if(dabc) { - /* one-way abc apply */ - abcone2d_apply(qo,qm,NOP,abc,fdm); - sponge2d_apply(qm,spo,fdm); - sponge2d_apply(qo,spo,fdm); - sponge2d_apply(qp,spo,fdm); - - if(atype[0] != 'i') { - /* one-way abc apply */ - abcone2d_apply(ro,rm,NOP,abc,fdm); - sponge2d_apply(rm,spo,fdm); - sponge2d_apply(ro,spo,fdm); - sponge2d_apply(rp,spo,fdm); - } - } - - /* extract data */ - lint2d_extract(qo,dd,cr); - - if(snap && it%jsnap==0) { - cut2d(qo,qc,fdm,acz,acx); - sf_floatwrite(qc[0],sf_n(acz)*sf_n(acx),Fwfl); - } - if( it%jdata==0) - sf_floatwrite(dd,nr,Fdat); - } - if(verb) fprintf(stderr,"\n"); - - /*------------------------------------------------------------*/ - /* deallocate arrays */ - - if(atype[0] != 'i') { - free(*rm); free(rm); - free(*rp); free(rp); - free(*ro); free(ro); - free(*ra); free(ra); - } - - free(*qm); free(qm); - free(*qp); free(qp); - free(*qo); free(qo); - free(*qa); free(qa); - free(*qc); free(qc); - - free(*vp); free(vp); - free(*vv2); free(vv2); - if(atype[0] != 'i') { - free(*vn2); free(vn2); - free(*vh2); free(vh2); - } - - if(atype[0] == 't') { - free(*ang); free(ang); - free(*sia); free(sia); - free(*coa); free(coa); - } - - free(ww); - free(ss); - free(rr); - free(dd); - /*------------------------------------------------------------*/ - - - exit (0); -} - diff --git a/user/nobody/Mawe.c b/user/nobody/Mawe.c deleted file mode 100644 index f54bf00905..0000000000 --- a/user/nobody/Mawe.c +++ /dev/null @@ -1,522 +0,0 @@ -/* Time-domain acoustic wave-equation FD modeling */ -/* - Copyright (C) 2006 Colorado School of Mines - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#ifdef _OPENMP -#include -#endif - -#define C1 0.66666666666666666666 /* 2/3 */ -#define C2 -0.08333333333333333333 /* -1/12 */ -#define D1(a,i2,i1,s) (C2*(a[i2 ][i1+2] - a[i2 ][i1-2]) + \ - C1*(a[i2 ][i1+1] - a[i2 ][i1-1]) )*s -#define D2(a,i2,i1,s) (C2*(a[i2+2][i1 ] - a[i2-2][i1 ]) + \ - C1*(a[i2+1][i1 ] - a[i2-1][i1 ]) )*s - -int main(int argc, char* argv[]) -{ - bool verb; - bool abc; - bool free; - bool snap; - bool dens; - int jsnap; - - /* I/O files */ - sf_file Fw,Fs,Fr; - sf_file Fd,Fu; - sf_file Fv=NULL; /* velocity */ - sf_file Fe=NULL; /* density */ - - /* cube axes */ - sf_axis at,az,ax,as,ar; - int it,iz,ix,is,ir, iop; - int nt,nz,nx,ns,nr, nz2,nx2; - float z0,dz,idz; - float x0,dx,idx; - float dt,dt2; - - /* arrays */ - pt2d *ss, *rr; /* source/receiver locations */ - float **ww=NULL; /* input data */ - float *dd=NULL; /* output data */ - float **vv=NULL; /* velocity */ - float **ee=NULL; /* density */ - - float *fzs,*fxs, *fzr,*fxr; - int *jzs,*jxs, *jzr,*jxr; - - float *ws00,*ws01,*ws10,*ws11; - float *wr00,*wr01,*wr10,*wr11; - - float **um,**uo,**up,**ud,**vp,**ro,**tt,**ut; - float *bzl,*bzh,*bxl,*bxh; /* boundary */ - - int nop=2; /* Laplacian operator size */ - float c0, c1, c2; /* Laplacian operator coefficients */ - float co,c1x,c2x,c1z,c2z; - - int nbz,nbx; - float tz, tx; - float dp; - float ws; /* injected data */ - - int ompchunk; - -/*------------------------------------------------------------*/ - - /* init RSF */ - sf_init(argc,argv); - - if(! sf_getint("ompchunk",&ompchunk)) ompchunk=1; /* OpenMP data chunk size */ - if(! sf_getbool("verb",&verb)) verb=false; /* verbosity flag */ - if(! sf_getbool( "abc",&abc )) abc=false; /* absorbing boundary conditions flag */ - if(! sf_getbool("snap",&snap)) snap=true; /* wavefield snapshots flag */ - if(! sf_getbool("free",&free)) free=false; /* free surface flag*/ - if(! sf_getbool("dens",&dens)) dens=false; /* variable density flag*/ - - Fw = sf_input ("in" ); /* input data */ - Fv = sf_input ("vel"); /* velocity */ - Fs = sf_input ("sou"); /* sources */ - Fr = sf_input ("rec"); /* receivers */ - Fu = sf_output("wfl"); /* wavefield */ - Fd = sf_output("out"); /* output data */ - - if(dens) Fe = sf_input("den"); /* density */ - - /* read axes */ - at=sf_iaxa(Fw,2); sf_setlabel(at,"t"); if(verb) sf_raxa(at); /* time */ - az=sf_iaxa(Fv,1); sf_setlabel(az,"z"); if(verb) sf_raxa(az); /* depth */ - ax=sf_iaxa(Fv,2); sf_setlabel(ax,"x"); if(verb) sf_raxa(ax); /* position */ - as=sf_iaxa(Fs,2); sf_setlabel(as,"s"); if(verb) sf_raxa(as); /* sources */ - ar=sf_iaxa(Fr,2); sf_setlabel(ar,"r"); if(verb) sf_raxa(ar); /* receivers */ - - nt=sf_n(at); dt=sf_d(at); - nz=sf_n(az); - nx=sf_n(ax); - ns=sf_n(as); - nr=sf_n(ar); - - /* configure wavefield snapshots */ - if(snap) { - if(! sf_getint("jsnap",&jsnap)) jsnap=nt; /* save wavefield every *jsnap* time steps */ - } - -/*------------------------------------------------------------*/ - - /* expand domain for absorbing boundary conditions */ - if(abc) { - if(! sf_getint("nbz",&nbz)) nbz=nop; /* boundary size */ - if(! sf_getint("nbx",&nbx)) nbx=nop; /* boundary size */ - - if(nbz= z0 && - ss[is].z < z0 + (nz2-1)*dz && - ss[is].x >= x0 && - ss[is].x < x0 + (nx2-1)*dx) { - - jzs[is] = (int)( (ss[is].z-z0)/dz); - fzs[is] = (ss[is].z-z0)/dz - jzs[is]; - jxs[is] = (int)( (ss[is].x-x0)/dx); - fxs[is] = (ss[is].x-x0)/dx - jxs[is]; - - ss[is].v=1; - } else { - jzs[is] = 0; jxs[is] = 0; - fzs[is] = 1; fxs[is] = 0; - ss[is].v= 0; - } - - ws00[is] = (1-fzs[is])*(1-fxs[is]); - ws01[is] = ( fzs[is])*(1-fxs[is]); - ws10[is] = (1-fzs[is])*( fxs[is]); - ws11[is] = ( fzs[is])*( fxs[is]); - } - - for (ir=0;ir= z0 && - rr[ir].z < z0 + (nz2-1)*dz && - rr[ir].x >= x0 && - rr[ir].x < x0 + (nx2-1)*dx) { - - jzr[ir] = (int)( (rr[ir].z-z0)/dz); - fzr[ir] = (rr[ir].z-z0)/dz - jzr[ir]; - jxr[ir] = (int)( (rr[ir].x-x0)/dx); - fxr[ir] = (rr[ir].x-x0)/dx - jxr[ir]; - - rr[ir].v=1; - } else { - jzr[ir] = 0; - fzr[ir] = 1; - rr[ir].v= 0; - } - - wr00[ir] = (1-fzr[ir])*(1-fxr[ir]); - wr01[ir] = ( fzr[ir])*(1-fxr[ir]); - wr10[ir] = (1-fzr[ir])*( fxr[ir]); - wr11[ir] = ( fzr[ir])*( fxr[ir]); - } - -/*------------------------------------------------------------*/ - - /* allocate temporary arrays */ - um=sf_floatalloc2(nz2,nx2); - uo=sf_floatalloc2(nz2,nx2); - up=sf_floatalloc2(nz2,nx2); - ud=sf_floatalloc2(nz2,nx2); - tt=sf_floatalloc2(nz2,nx2); - -#ifdef _OPENMP -#pragma omp parallel for schedule(dynamic,ompchunk) private(iz,ix) shared(nx2,nz2,um,uo,up,ud,tt) -#endif - for (iz=0; iz -#ifdef _OPENMP -#include -#endif - -#include "fdutil.h" - -/* check: dt<= 0.2 * min(dx,dz)/vmin */ - -#define NOP 2 /* derivative operator half-size */ - -#define C0 -2.500000 /* c0=-30./12.; */ -#define CA +1.333333 /* ca=+16./12.; */ -#define CB -0.083333 /* cb=- 1./12.; */ - -#define C1 0.66666666666666666666 /* 2/3 */ -#define C2 -0.08333333333333333333 /* -1/12 */ - -/* centered FD derivative stencils */ -#define D1(a,i2,i1,s) (C2*(a[i2 ][i1+2] - a[i2 ][i1-2]) + \ - C1*(a[i2 ][i1+1] - a[i2 ][i1-1]) )*s -#define D2(a,i2,i1,s) (C2*(a[i2+2][i1 ] - a[i2-2][i1 ]) + \ - C1*(a[i2+1][i1 ] - a[i2-1][i1 ]) )*s - -int main(int argc, char* argv[]) -{ - bool verb,fsrf,snap,expl; - int jsnap,ntsnap; - int jdata; - - /* I/O files */ - sf_file Fwav=NULL; /* wavelet */ - sf_file Fsou=NULL; /* sources */ - sf_file Frec=NULL; /* receivers */ - sf_file Fvel=NULL; /* velocity */ - sf_file Fden=NULL; /* density */ - sf_file Fdat=NULL; /* data */ - sf_file Fwfl=NULL; /* wavefield */ - - /* I/O arrays */ - float *ww=NULL; /* wavelet */ - pt2d *ss=NULL; /* sources */ - pt2d *rr=NULL; /* receivers */ - - float **vpin=NULL; /* velocity */ - float **roin=NULL; /* density */ - float **vp=NULL; /* velocity in expanded domain */ - float **ro=NULL; /* density in expanded domain */ - float **ro1=NULL; /* normalized 1st derivative of density on axis 1 */ - float **ro2=NULL; /* normalized 1st derivative of density on axis 2 */ - - float **vt=NULL; /* temporary vp*vp * dt*dt */ - - float *dd=NULL; /* data */ - float **um,**uo,**up,**ua,**ut; /* wavefield: um = U @ t-1; uo = U @ t; up = U @ t+1 */ - - /* cube axes */ - sf_axis at,a1,a2,as,ar; - int nt,n1,n2,ns,nr,nb; - int it,i1,i2; - float dt,d1,d2,id1,id2,dt2; - - /* linear interpolation weights/indices */ - lint2d cs,cr; - - fdm2d fdm; - abcone2d abc; /* abc */ - sponge spo; - - /* FD operator size */ - float co,ca2,cb2,ca1,cb1; - - int ompchunk; -#ifdef _OPENMP - int ompnth,ompath; -#endif - - sf_axis ac1=NULL,ac2=NULL; - int nq1,nq2; - float oq1,oq2; - float dq1,dq2; - float **uc=NULL; - - /*------------------------------------------------------------*/ - /* init RSF */ - sf_init(argc,argv); - - if(! sf_getint("ompchunk",&ompchunk)) ompchunk=1; - /* OpenMP data chunk size */ -#ifdef _OPENMP - if(! sf_getint("ompnth", &ompnth)) ompnth=0; - /* OpenMP available threads */ - -#pragma omp parallel - ompath=omp_get_num_threads(); - if(ompnth<1) ompnth=ompath; - omp_set_num_threads(ompnth); - sf_warning("using %d threads of a total of %d",ompnth,ompath); -#endif - - if(! sf_getbool("verb",&verb)) verb=false; /* verbosity flag */ - if(! sf_getbool("snap",&snap)) snap=false; /* wavefield snapshots flag */ - if(! sf_getbool("free",&fsrf)) fsrf=false; /* free surface flag */ - if(! sf_getbool("expl",&expl)) expl=false; /* "exploding reflector" */ - - Fwav = sf_input ("in" ); /* wavelet */ - Fvel = sf_input ("vel"); /* velocity */ - Fsou = sf_input ("sou"); /* sources */ - Frec = sf_input ("rec"); /* receivers */ - Fwfl = sf_output("wfl"); /* wavefield */ - Fdat = sf_output("out"); /* data */ - Fden = sf_input ("den"); /* density */ - - /* axes */ - at = sf_iaxa(Fwav,2); sf_setlabel(at,"t"); if(verb) sf_raxa(at); /* time */ - as = sf_iaxa(Fsou,2); sf_setlabel(as,"s"); if(verb) sf_raxa(as); /* sources */ - ar = sf_iaxa(Frec,2); sf_setlabel(ar,"r"); if(verb) sf_raxa(ar); /* receivers */ - a1 = sf_iaxa(Fvel,1); sf_setlabel(a1,"z"); if(verb) sf_raxa(a1); /* depth */ - a2 = sf_iaxa(Fvel,2); sf_setlabel(a2,"x"); if(verb) sf_raxa(a2); /* space */ - - nt = sf_n(at); dt = sf_d(at); - ns = sf_n(as); - nr = sf_n(ar); - n1 = sf_n(a1); d1 = sf_d(a1); - n2 = sf_n(a2); d2 = sf_d(a2); - - if(! sf_getint("jdata",&jdata)) jdata=1; - if(snap) { - if(! sf_getint("jsnap",&jsnap)) jsnap=nt; - /* save wavefield every *jsnap* time steps */ - } - - /*------------------------------------------------------------*/ - /* expand domain for FD operators and ABC */ - if( !sf_getint("nb",&nb) || nbnzpad); sf_seto(a1,fdm->ozpad); if(verb) sf_raxa(a1); - sf_setn(a2,fdm->nxpad); sf_seto(a2,fdm->oxpad); if(verb) sf_raxa(a2); - /*------------------------------------------------------------*/ - - /* setup output data header */ - sf_oaxa(Fdat,ar,1); - - sf_setn(at,nt/jdata); - sf_setd(at,dt*jdata); - sf_oaxa(Fdat,at,2); - - /* setup output wavefield header */ - if(snap) { - if(!sf_getint ("nq1",&nq1)) nq1=sf_n(a1); - if(!sf_getint ("nq2",&nq2)) nq2=sf_n(a2); - if(!sf_getfloat("oq1",&oq1)) oq1=sf_o(a1); - if(!sf_getfloat("oq2",&oq2)) oq2=sf_o(a2); - dq1=sf_d(a1); - dq2=sf_d(a2); - - ac1 = sf_maxa(nq1,oq1,dq1); - ac2 = sf_maxa(nq2,oq2,dq2); - - /* check if the imaging window fits in the wavefield domain */ - - uc=sf_floatalloc2(sf_n(ac1),sf_n(ac2)); - - ntsnap=0; - for(it=0; itnzpad,fdm->nxpad); - ro1 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - ro2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - sf_floatread(roin[0],n1*n2,Fden); - expand(roin,ro,fdm); - - /* normalized density derivatives */ - for (i2=NOP; i2nxpad-NOP; i2++) { - for(i1=NOP; i1nzpad-NOP; i1++) { - ro1[i2][i1] = D1(ro,i2,i1,id1) / ro[i2][i1]; - ro2[i2][i1] = D2(ro,i2,i1,id2) / ro[i2][i1]; - } - } - - free(*roin); free(roin); - - /*------------------------------------------------------------*/ - /* input velocity */ - vpin=sf_floatalloc2(n1, n2 ); - vp =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - vt =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - sf_floatread(vpin[0],n1*n2,Fvel); - expand(vpin,vp,fdm); - free(*vpin); free(vpin); - - for (i2=0; i2nxpad; i2++) { - for(i1=0; i1nzpad; i1++) { - vt[i2][i1] = vp[i2][i1] * vp[i2][i1] * dt2; - } - } - - /* free surface */ - if(fsrf) { - for (i2=0; i2nxpad; i2++) { - for(i1=0; i1nb; i1++) { - vt[i2][i1]=0; - } - } - } - - /*------------------------------------------------------------*/ - /* allocate wavefield arrays */ - um=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - uo=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - up=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - ua=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - for (i2=0; i2nxpad; i2++) { - for(i1=0; i1nzpad; i1++) { - um[i2][i1]=0; - uo[i2][i1]=0; - up[i2][i1]=0; - ua[i2][i1]=0; - } - } - - /*------------------------------------------------------------*/ - /* one-way abc setup */ - abc = abcone2d_make(NOP,dt,vp,fsrf,fdm); - /* sponge abc setup */ - spo = sponge_make(fdm->nb); - - /*------------------------------------------------------------*/ - /* - * MAIN LOOP - */ - /*------------------------------------------------------------*/ - if(verb) fprintf(stderr,"\n"); - for (it=0; itompchunk) \ - private(i2,i1) \ - shared(fdm,ua,uo,co,ca2,ca1,cb2,cb1,id2,id1) -#endif - for (i2=NOP; i2nxpad-NOP; i2++) { - for(i1=NOP; i1nzpad-NOP; i1++) { - - /* 4th order Laplacian operator */ - ua[i2][i1] = - co * uo[i2 ][i1 ] + - ca2*(uo[i2-1][i1 ] + uo[i2+1][i1 ]) + - cb2*(uo[i2-2][i1 ] + uo[i2+2][i1 ]) + - ca1*(uo[i2 ][i1-1] + uo[i2 ][i1+1]) + - cb1*(uo[i2 ][i1-2] + uo[i2 ][i1+2]); - - /* density term */ - ua[i2][i1] -= ( - D1(uo,i2,i1,id1) * ro1[i2][i1] + - D2(uo,i2,i1,id2) * ro2[i2][i1] ); - } - } - - /* inject acceleration source */ - if(expl) { - sf_floatread(ww, 1,Fwav); - lint2d_inject1(ua,ww[0],cs); - } else { - sf_floatread(ww,ns,Fwav); - lint2d_inject(ua,ww,cs); - } - - /* step forward in time */ -#ifdef _OPENMP -#pragma omp parallel for \ - schedule(dynamic,fdm->ompchunk) \ - private(i2,i1) \ - shared(fdm,ua,uo,um,up,vt,dt2) -#endif - for (i2=0; i2nxpad; i2++) { - for(i1=0; i1nzpad; i1++) { - up[i2][i1] = 2*uo[i2][i1] - - um[i2][i1] - + ua[i2][i1] * vt[i2][i1]; - } - } - /* circulate wavefield arrays */ - ut=um; - um=uo; - uo=up; - up=ut; - - /* one-way abc apply */ - abcone2d_apply(uo,um,NOP,abc,fdm); - sponge2d_apply(um,spo,fdm); - sponge2d_apply(uo,spo,fdm); - sponge2d_apply(up,spo,fdm); - - /* extract data */ - lint2d_extract(uo,dd,cr); - - if(snap && it%jsnap==0) { - cut2d(uo,uc,fdm,ac1,ac2); - sf_floatwrite(uc[0],sf_n(ac1)*sf_n(ac2),Fwfl); - } - if( it%jdata==0) - sf_floatwrite(dd,nr,Fdat); - } - if(verb) fprintf(stderr,"\n"); - - /*------------------------------------------------------------*/ - - - exit (0); -} - diff --git a/user/nobody/Mawefd1.c b/user/nobody/Mawefd1.c deleted file mode 100644 index 625bdd0059..0000000000 --- a/user/nobody/Mawefd1.c +++ /dev/null @@ -1,331 +0,0 @@ -/* Acoustic time-domain FD modeling */ -/* - Copyright (C) 2007 Colorado School of Mines - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include "fdutil.h" - -/* check: dt<= 0.2 * min(dx,dz)/vmin */ - -#define NOP 2 /* derivative operator half-size */ - -#define C0 -2.500000 /* c0=-30./12.; */ -#define CA +1.333333 /* ca=+16./12.; */ -#define CB -0.083333 /* cb=- 1./12.; */ - -#define C1 0.66666666666666666666 /* 2/3 */ -#define C2 -0.08333333333333333333 /* -1/12 */ - -/* centered FD derivative stencils */ -#define D1(a,i2,i1,s) (C2*(a[i2 ][i1+2] - a[i2 ][i1-2]) + \ - C1*(a[i2 ][i1+1] - a[i2 ][i1-1]) )*s -#define D2(a,i2,i1,s) (C2*(a[i2+2][i1 ] - a[i2-2][i1 ]) + \ - C1*(a[i2+1][i1 ] - a[i2-1][i1 ]) )*s - -int main(int argc, char* argv[]) -{ - bool verb,free,snap; - int jsnap; - int jdata; - - /* I/O files */ - sf_file Fwav=NULL; /* wavelet */ - sf_file Fsou=NULL; /* sources */ - sf_file Frec=NULL; /* receivers */ - sf_file Fvel=NULL; /* velocity */ - sf_file Fden=NULL; /* density */ - sf_file Fdat=NULL; /* data */ - sf_file Fwfl=NULL; /* wavefield */ - - /* I/O arrays */ - float *ww=NULL; /* wavelet */ - pt2d *ss=NULL; /* sources */ - pt2d *rr=NULL; /* receivers */ - - float **vpin=NULL; /* velocity */ - float **roin=NULL; /* density */ - float **vp=NULL; /* velocity in expanded domain */ - float **ro=NULL; /* density in expanded domain */ - - float **vt=NULL; /* temporary vp*vp * dt*dt */ - - float *dd=NULL; /* data */ - float **um,**uo,**up,**ua,**ut; /* wavefield: um = U @ t-1; uo = U @ t; up = U @ t+1 */ - - /* cube axes */ - sf_axis at,a1,a2,as,ar; - int nt,n1,n2,ns,nr,nb; - int it,i1,i2; - float dt,d1,d2,id1,id2,dt2; - - /* linear interpolation weights/indices */ - lint2d cs,cr; - - fdm2d fdm; - abcone2d abc; /* abc */ - sponge2d spo; - - /* FD operator size */ - float co,ca2,cb2,ca1,cb1; - - int ompchunk; -#ifdef _OPENMP - int ompnth,ompath; -#endif - - sf_axis c1=NULL, c2=NULL; - int nq1,nq2; - float oq1,oq2; - float dq1,dq2; - float **uc=NULL; - - /*------------------------------------------------------------*/ - /* init RSF */ - sf_init(argc,argv); - - if(! sf_getint("ompchunk",&ompchunk)) ompchunk=1; - /* OpenMP data chunk size */ -#ifdef _OPENMP - if(! sf_getint("ompnth", &ompnth)) ompnth=0; - /* OpenMP available threads */ - -#pragma omp parallel - ompath=omp_get_num_threads(); - if(ompnth<1) ompnth=ompath; - omp_set_num_threads(ompnth); - sf_warning("using %d threads of a total of %d",ompnth,ompath); -#endif - - if(! sf_getbool("verb",&verb)) verb=false; /* verbosity flag */ - if(! sf_getbool("snap",&snap)) snap=false; /* wavefield snapshots flag */ - if(! sf_getbool("free",&free)) free=false; /* free surface flag*/ - - Fwav = sf_input ("in" ); /* wavelet */ - Fvel = sf_input ("vel"); /* velocity */ - Fsou = sf_input ("sou"); /* sources */ - Frec = sf_input ("rec"); /* receivers */ - Fwfl = sf_output("wfl"); /* wavefield */ - Fdat = sf_output("out"); /* data */ - Fden = sf_input ("den"); /* density */ - - /* axes */ - at = sf_iaxa(Fwav,2); sf_setlabel(at,"t"); if(verb) sf_raxa(at); /* time */ - as = sf_iaxa(Fsou,2); sf_setlabel(as,"s"); if(verb) sf_raxa(as); /* sources */ - ar = sf_iaxa(Frec,2); sf_setlabel(ar,"r"); if(verb) sf_raxa(ar); /* receivers */ - a1 = sf_iaxa(Fvel,1); sf_setlabel(a1,"z"); if(verb) sf_raxa(a1); /* depth */ - a2 = sf_iaxa(Fvel,2); sf_setlabel(a2,"x"); if(verb) sf_raxa(a2); /* space */ - - nt = sf_n(at); dt = sf_d(at); - ns = sf_n(as); - nr = sf_n(ar); - n1 = sf_n(a1); d1 = sf_d(a1); - n2 = sf_n(a2); d2 = sf_d(a2); - - if(! sf_getint("jdata",&jdata)) jdata=1; - if(snap) { /* save wavefield every *jsnap* time steps */ - if(! sf_getint("jsnap",&jsnap)) jsnap=nt; - } - - /*------------------------------------------------------------*/ - /* expand domain for FD operators and ABC */ - if( !sf_getint("nb",&nb) || nbn1pad); sf_seto(a1,fdm->o1pad); if(verb) sf_raxa(a1); - sf_setn(a2,fdm->n2pad); sf_seto(a2,fdm->o2pad); if(verb) sf_raxa(a2); - /*------------------------------------------------------------*/ - - /* setup output data header */ - sf_oaxa(Fdat,ar,1); - - sf_setn(at,nt/jdata); - sf_setd(at,dt*jdata); - sf_oaxa(Fdat,at,2); - - /* setup output wavefield header */ - if(snap) { - if(!sf_getint ("nq1",&nq1)) nq1=sf_n(a1); - if(!sf_getint ("nq2",&nq2)) nq2=sf_n(a2); - if(!sf_getfloat("oq1",&oq1)) oq1=sf_o(a1); - if(!sf_getfloat("oq2",&oq2)) oq2=sf_o(a2); - dq1=sf_d(a1); - dq2=sf_d(a2); - - c1 = sf_maxa(nq1,oq1,dq1); - c2 = sf_maxa(nq2,oq2,dq2); - - /* check if the imaging window fits in the wavefield domain */ - - uc=sf_floatalloc2(sf_n(c1),sf_n(c2)); - - sf_setn(at,nt/jsnap); - sf_setd(at,dt*jsnap); - - sf_oaxa(Fwfl,c1,1); - sf_oaxa(Fwfl,c2,2); - sf_oaxa(Fwfl,at,3); - } - - ww = sf_floatalloc( 1); - dd = sf_floatalloc(nr); - - /*------------------------------------------------------------*/ - /* setup source/receiver coordinates */ - ss = (pt2d*) sf_alloc(ns,sizeof(*ss)); - rr = (pt2d*) sf_alloc(nr,sizeof(*rr)); - - pt2dread1(Fsou,ss,ns,2); /* read (x,z) coordinates */ - pt2dread1(Frec,rr,nr,2); /* read (x,z) coordinates */ - - cs = lint2d_make(ns,ss,fdm); - cr = lint2d_make(nr,rr,fdm); - - /*------------------------------------------------------------*/ - /* setup FD coefficients */ - dt2 = dt*dt; - id1 = 1/d1; - id2 = 1/d2; - - co = C0 * (id2*id2+id1*id1); - ca2= CA * id2*id2; - cb2= CB * id2*id2; - ca1= CA * id1*id1; - cb1= CB * id1*id1; - - /*------------------------------------------------------------*/ - /* setup model */ - roin=sf_floatalloc2(n1, n2 ); - ro =sf_floatalloc2(fdm->n1pad,fdm->n2pad); - sf_floatread(roin[0],n1*n2,Fden); - expand(roin,ro,fdm); - - vpin=sf_floatalloc2(n1, n2 ); - vp =sf_floatalloc2(fdm->n1pad,fdm->n2pad); - vt =sf_floatalloc2(fdm->n1pad,fdm->n2pad); - sf_floatread(vpin[0],n1*n2,Fvel); - expand(vpin,vp,fdm); - - for (i2=0; i2n2pad; i2++) { - for(i1=0; i1n1pad; i1++) { - vt[i2][i1] = vp[i2][i1] * vp[i2][i1] * dt2; - } - } - - /* free surface */ - if(free) { - for (i2=0; i2n2pad; i2++) { - for(i1=0; i1nb; i1++) { - vt[i2][i1]=0; - } - } - } - - /*------------------------------------------------------------*/ - /* allocate wavefield arrays */ - um=sf_floatalloc2(fdm->n1pad,fdm->n2pad); - uo=sf_floatalloc2(fdm->n1pad,fdm->n2pad); - up=sf_floatalloc2(fdm->n1pad,fdm->n2pad); - ua=sf_floatalloc2(fdm->n1pad,fdm->n2pad); - - for (i2=0; i2n2pad; i2++) { - for(i1=0; i1n1pad; i1++) { - um[i2][i1]=0; - uo[i2][i1]=0; - up[i2][i1]=0; - ua[i2][i1]=0; - } - } - - /*------------------------------------------------------------*/ - /* one-way abc setup */ - abc = abcone2d_make(NOP,dt,vp,free,fdm); - /* sponge abc setup */ - spo = sponge2d_make(fdm); - - /*------------------------------------------------------------*/ - /* - * MAIN LOOP - */ - /*------------------------------------------------------------*/ - if(verb) fprintf(stderr,"\n"); - for (it=0; itompchunk) private(i2,i1) shared(fdm,ua,uo,co,ca2,ca1,cb2,cb1,id2,id1) -#endif - for (i2=NOP; i2n2pad-NOP; i2++) { - for(i1=NOP; i1n1pad-NOP; i1++) { - - /* 4th order Laplacian operator */ - ua[i2][i1] = - co * uo[i2 ][i1 ] + - ca2*(uo[i2-1][i1 ] + uo[i2+1][i1 ]) + - cb2*(uo[i2-2][i1 ] + uo[i2+2][i1 ]) + - ca1*(uo[i2 ][i1-1] + uo[i2 ][i1+1]) + - cb1*(uo[i2 ][i1-2] + uo[i2 ][i1+2]); - - /* density term */ - ua[i2][i1] -= ( - D1(uo,i2,i1,id1) * D1(ro,i2,i1,id1) + - D2(uo,i2,i1,id2) * D2(ro,i2,i1,id2) ) / ro[i2][i1]; - } - } - - /* inject acceleration source */ - lint2d_inject1(ua,ww[0],cs); - - /* step forward in time */ -#ifdef _OPENMP -#pragma omp parallel for schedule(dynamic,fdm->ompchunk) private(i2,i1) shared(fdm,ua,uo,um,up,vt,dt2) -#endif - for (i2=0; i2n2pad; i2++) { - for(i1=0; i1n1pad; i1++) { - up[i2][i1] = 2*uo[i2][i1] - - um[i2][i1] - + ua[i2][i1] * vt[i2][i1]; - } - } - /* circulate wavefield arrays */ - ut=um; - um=uo; - uo=up; - up=ut; - - /* one-way abc apply */ - abcone2d_apply(uo,um,NOP,abc,fdm); - sponge2d_apply(um,spo,fdm); - sponge2d_apply(uo,spo,fdm); - sponge2d_apply(up,spo,fdm); - - /* extract data */ - lint2d_extract(uo,dd,cr); - - if(snap && (it+1)%jsnap==0) { - cut2d(uo,uc,fdm,c1,c2); - sf_floatwrite(uc[0],sf_n(c1)*sf_n(c2),Fwfl); - } - if( it %jdata==0) sf_floatwrite(dd,nr,Fdat); - } - if(verb) fprintf(stderr,"\n"); - - exit (0); -} diff --git a/user/nobody/Mbessel.c b/user/nobody/Mbessel.c deleted file mode 100644 index a56c6286e8..0000000000 --- a/user/nobody/Mbessel.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Bessel functions */ -/* - Copyright (C) 2008 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include - -#include "bessel_I0.h" -#include "bessel_I1.h" - -int main(int argc, char* argv[]) -{ - off_t nsiz; - int nbuf, k, order; - char *type; - float *fbuf; - sf_file inp, out; - double (*func)(double); - - sf_init(argc,argv); - inp = sf_input("in"); - out = sf_output("out"); - - if (SF_FLOAT != sf_gettype(inp)) sf_error("Need float input"); - - if (NULL == (type = sf_getstring("type"))) type="J"; - if (!sf_getint("order",&order)) order=0; - - switch(type[0]) { - case 'i': - case 'I': - switch (order) { - case 0: - func = bessel_I0; - break; - case 1: - func = bessel_I1; - break; - default: - sf_error("Order %d for type %s is not implemented",order,type); - } - break; - default: - sf_error("Type %s is not implemented",type); - break; - } - - nbuf = BUFSIZ/sizeof(float); - fbuf = sf_floatalloc(nbuf); - - for (nsiz = sf_filesize(inp); nsiz > 0; nsiz -= nbuf) { - if (nbuf > nsiz) nbuf = nsiz; - sf_floatread(fbuf,nbuf,inp); - for (k=0; k < nbuf; k++) { - fbuf[k] = func(fbuf[k]); - } - sf_floatwrite(fbuf,nbuf,out); - } - - exit(0); -} diff --git a/user/nobody/Mblindpick.c b/user/nobody/Mblindpick.c deleted file mode 100644 index 5ffdc2db49..0000000000 --- a/user/nobody/Mblindpick.c +++ /dev/null @@ -1,133 +0,0 @@ -/* Automatic picking from semblance-like panels using shaping regularization.*/ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include - -#include - -#include "divn.h" - -int main(int argc, char* argv[]) -{ - int dim, n[SF_MAX_DIM], rect[SF_MAX_DIM], nd; - int ns, nt, nm, nx, i, ix, is, it, niter, imax; - float **slice, *pick0, *pick, *ampl; - float s0, ds, t, asum, ai, amax, ap, am, num, den, dx; - char key[6]; - sf_file in, out; - - sf_init (argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - dim = sf_filedims (in,n); - if (dim < 2) sf_error("Need at least two dimensions"); - - nd = 1; - for (i=0; i < dim; i++) { - nd *= n[i]; - if (n[i] > 1) { - snprintf(key,6,"rect%d",i+1); - if (!sf_getint(key,rect+i)) rect[i]=1; - } else { - rect[i]=1; - } - } - nt = n[0]; - ns = n[1]; - nm = nd/ns; - nx = nm/nt; - - if (!sf_histfloat(in,"o2",&s0)) sf_error("No o2= in input"); - if (!sf_histfloat(in,"d2",&ds)) sf_error("No d2= in input"); - sf_putint(out,"n2",1); - - if (!sf_getint("niter",&niter)) niter=100; - /* number of iterations */ - - for (i=1; i < dim-1; i++) { - n[i] = n[i+1]; - } - dim--; - - divn_init(dim,nm,n,rect,niter); - - slice = sf_floatalloc2(nt,ns); - - pick0 = sf_floatalloc(nm); - pick = sf_floatalloc(nm); - ampl = sf_floatalloc(nm); - - for (ix = 0; ix < nx; ix++) { - sf_floatread (slice[0],nt*ns,in); - - /* pick blind maximum */ - for (it = 0; it < nt; it++) { - i = ix*nt+it; - - imax = 0; - amax = 0.; - for (is = 0; is < ns; is++) { - t = slice[is][it]; - if (t > amax) { - amax = t; - imax = is; - } - } - - /* quadratic interpolation for sub-pixel accuracy */ - if (imax > 0 && imax < ns-1) { - am = slice[imax-1][it]; - ap = slice[imax+1][it]; - num = 0.5*(am-ap); - den = am+ap-2.*amax; - dx = num*den/(den*den + FLT_EPSILON); - if (fabsf(dx) >= 1.) dx=0.; - - ampl[i] = amax - 0.5*dx*dx*den; - pick0[i] = s0+(imax+dx)*ds; - } else { - ampl[i] = amax; - pick0[i] = s0+imax*ds; - } - } - } - - /* normalize amplitudes */ - asum = 0.; - for (i = 0; i < nm; i++) { - ai = ampl[i]; - asum += ai*ai; - } - asum = sqrtf (asum/nm); - - for(i=0; i < nm; i++) { - ampl[i] /= asum; - pick0[i] *= ampl[i]; - } - - divn(pick0,ampl,pick); - - sf_floatwrite (pick,nm,out); - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mblindpick2.c b/user/nobody/Mblindpick2.c deleted file mode 100644 index 44c2493469..0000000000 --- a/user/nobody/Mblindpick2.c +++ /dev/null @@ -1,133 +0,0 @@ -/* Automatic picking from semblance panels using shaping regularization. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include - -#include - -#include "div2.h" -#include "div1.h" - -int main(int argc, char* argv[]) -{ - int nt, ns, nx, n, i, ix, is, it, niter, imax; - float **slice, *pick0, *pick, *ampl; - float s0, ds, eps, lam, t, asum, ai, amax, ap, am, num, den, dx; - bool gauss; - sf_file in, out; - - sf_init (argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_histint(in,"n1",&nt)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&ns)) ns=1; - nx = sf_leftsize(in,2); - - if (!sf_histfloat(in,"o2",&s0)) sf_error("No o2= in input"); - if (!sf_histfloat(in,"d2",&ds)) sf_error("No d2= in input"); - sf_putint(out,"n2",1); - - if (!sf_getfloat("eps",&eps)) eps=1.; - /* Vertical smoothness */ - if (!sf_getfloat("lam",&lam)) lam=1.; - /* Horizontal smoothness */ - - eps = sqrtf(12*eps+1.); - lam = sqrtf(12*lam+1.); - - if (!sf_getint("niter",&niter)) niter=100; - /* number of iterations */ - if (!sf_getbool("gauss",&gauss)) gauss = false; - /* if y, use exact Gaussian for smoothing */ - - if (nx > 1) { - div2_init(nt,nx,eps,lam,niter,gauss,true); - } else { - div1_init(nt,eps,niter,gauss); - } - - slice = sf_floatalloc2(nt,ns); - - n = nt*nx; - pick0 = sf_floatalloc(n); - pick = sf_floatalloc(n); - ampl = sf_floatalloc(n); - - for (ix = 0; ix < nx; ix++) { - sf_floatread (slice[0],nt*ns,in); - - /* pick blind maximum */ - for (it = 0; it < nt; it++) { - i = ix*nt+it; - - imax = 0; - amax = 0.; - for (is = 0; is < ns; is++) { - t = slice[is][it]; - if (t > amax) { - amax = t; - imax = is; - } - } - - /* quadratic interpolation for sub-pixel accuracy */ - if (imax > 0 && imax < ns-1) { - am = slice[imax-1][it]; - ap = slice[imax+1][it]; - num = 0.5*(am-ap); - den = am+ap-2.*amax; - dx = num*den/(den*den + FLT_EPSILON); - if (fabsf(dx) >= 1.) dx=0.; - - ampl[i] = amax - 0.5*dx*dx*den; - pick0[i] = s0+(imax+dx)*ds; - } else { - ampl[i] = amax; - pick0[i] = s0+imax*ds; - } - } - } - - /* normalize amplitudes */ - asum = 0.; - for (i = 0; i < n; i++) { - ai = ampl[i]; - asum += ai*ai; - } - asum = sqrtf (asum/n); - - for(i=0; i < n; i++) { - ampl[i] /= asum; - pick0[i] *= ampl[i]; - } - - if (nx > 1) { - div2(pick0,ampl,pick); - } else { - div1(pick0,ampl,pick); - } - - sf_floatwrite (pick,n,out); - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mborn2d.c b/user/nobody/Mborn2d.c deleted file mode 100644 index f597e99688..0000000000 --- a/user/nobody/Mborn2d.c +++ /dev/null @@ -1,511 +0,0 @@ -/* Born modeling */ - -/* - Copyright (C) 2006 Colorado School of Mines - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -int main(int argc, char* argv[]) -{ - bool verb; /* verbosity flag */ - bool abc; /* absorbing boundary conditions flag */ - bool free; /* free surface flag*/ - bool snap; /* wavefield snapshots flag */ - int jsnap;/* save wavefield every *jsnap* time steps */ - - /* cube axes */ - sf_axis at,az,ax,as,ar,bt; - int it,iz,ix,is,ir, iop; - int nt,nz,nx,ns,nr,nz2,nx2; - float z0,x0,dt,dx,dz, idx,idz,dt2; - - /* Laplacian */ - int nop=2; /* Laplacian operator size */ - float c0, c1, c2; /* Laplacian operator coefficients */ - float co,c1x,c2x,c1z,c2z; - - int nbz,nbx; /* boundary size */ - float tz, tx; /* sponge boundary decay coefficients */ - float dp; - float ws; /* injected data */ - - /* linear interpolation */ - float *fzs,*fxs, *fzr,*fxr; - int *jzs,*jxs, *jzr,*jxr; - - float *ws00,*ws01,*ws10,*ws11; - float *wr00,*wr01,*wr10,*wr11; - - /* boundary */ - float *bzl,*bzh,*bxl,*bxh; - - /* I/O files */ - sf_file Fw,Fs,Fr; - float *ww; /* wavelet */ - pt2d *ss, *rr; /* source/receiver locations */ - - float **tt; /* taper */ - - /* background */ - sf_file Bv,Bd,Bu; /* velocity, data, wavefield */ - float **bvv,**bvo; /* velocity */ - float *bdd; /* data */ - float **bum,**buo,**bup,**bud; /* wavefields */ - - /* perturbation */ - sf_file Pv,Pd,Pu; - float **pvv,**pvo; - float *pdd; - float **pum,**puo,**pup,**pud; - -/*------------------------------------------------------------*/ - - /* init RSF */ - sf_init(argc,argv); - - if(! sf_getbool("verb",&verb)) verb=false; - if(! sf_getbool( "abc",&abc )) abc=false; - if(! sf_getbool("snap",&snap)) snap=false; - if(! sf_getbool("free",&free)) free=false; - - Fw = sf_input ("in" ); /* wavelet */ - Fs = sf_input ("sou"); /* sources */ - Fr = sf_input ("rec"); /* receivers */ - - Bv = sf_input ("vel"); /* velocity */ - Bu = sf_output("wfl"); /* wavefield */ - Bd = sf_output("out"); /* data */ - - Pv = sf_input ("ref"); /* velocity */ - Pu = sf_output("liw"); /* linearized wavefield */ - Pd = sf_output("lid"); /* linearized data */ - - /* read axes*/ - at=sf_iaxa(Fw,1); sf_setlabel(at,"t"); - nt=sf_n(at); dt=sf_d(at); if(verb) sf_raxa(at); /* time */ - as=sf_iaxa(Fs,2); sf_setlabel(as,"s"); - ns=sf_n(as); if(verb) sf_raxa(as); /* sources */ - ar=sf_iaxa(Fr,2); sf_setlabel(ar,"r"); - nr=sf_n(ar); if(verb) sf_raxa(ar); /* receivers */ - - az=sf_iaxa(Bv,1); sf_setlabel(az,"z"); - nz=sf_n(az); dz=sf_d(az); if(verb) sf_raxa(az); /* depth */ - ax=sf_iaxa(Bv,2); sf_setlabel(ax,"x"); - nx=sf_n(ax); dx=sf_d(ax); if(verb) sf_raxa(ax); /* space */ - - /* configure wavefield snapshots */ - if(snap) { - if(! sf_getint("jsnap",&jsnap)) jsnap=nt; - } - -/*------------------------------------------------------------*/ - - /* expand domain for absorbing boundary conditions */ - if(abc) { - if(! sf_getint("nbz",&nbz)) nbz=nop; if(nbz= z0 && - ss[is].z < z0 + (nz2-1)*dz && - ss[is].x >= x0 && - ss[is].x < x0 + (nx2-1)*dx) { - - jzs[is] = (int)( (ss[is].z-z0)/dz); - fzs[is] = (ss[is].z-z0)/dz - jzs[is]; - jxs[is] = (int)( (ss[is].x-x0)/dx); - fxs[is] = (ss[is].x-x0)/dx - jxs[is]; - } else { - jzs[is] = 0; jxs[is] = 0; - fzs[is] = 1; fxs[is] = 0; - ss[is].v= 0; - } - - ws00[is] = (1-fzs[is])*(1-fxs[is]); - ws01[is] = ( fzs[is])*(1-fxs[is]); - ws10[is] = (1-fzs[is])*( fxs[is]); - ws11[is] = ( fzs[is])*( fxs[is]); - - } - - for (ir=0;ir= z0 && - rr[ir].z < z0 + (nz2-1)*dz && - rr[ir].x >= x0 && - rr[ir].x < x0 + (nx2-1)*dx) { - - jzr[ir] = (int)( (rr[ir].z-z0)/dz); - fzr[ir] = (rr[ir].z-z0)/dz - jzr[ir]; - jxr[ir] = (int)( (rr[ir].x-x0)/dx); - fxr[ir] = (rr[ir].x-x0)/dx - jxr[ir]; - - rr[ir].v=1; - } else { - jzr[ir] = 0; - fzr[ir] = 1; - rr[ir].v= 0; - } - - wr00[ir] = (1-fzr[ir])*(1-fxr[ir]); - wr01[ir] = ( fzr[ir])*(1-fxr[ir]); - wr10[ir] = (1-fzr[ir])*( fxr[ir]); - wr11[ir] = ( fzr[ir])*( fxr[ir]); - } - -/*------------------------------------------------------------*/ - - /* allocate temporary arrays */ - bum=sf_floatalloc2(nz2,nx2); - buo=sf_floatalloc2(nz2,nx2); - bup=sf_floatalloc2(nz2,nx2); - bud=sf_floatalloc2(nz2,nx2); - - pum=sf_floatalloc2(nz2,nx2); - puo=sf_floatalloc2(nz2,nx2); - pup=sf_floatalloc2(nz2,nx2); - pud=sf_floatalloc2(nz2,nx2); - - tt=sf_floatalloc2(nz2,nx2); - - for (iz=0; iz smooth.rsf -*/ - -#include - -#include "boxsl.h" -#include "freqfilt2.h" - -int main(int argc, char* argv[]) -{ - bool adj; - int n1, n2, m12, n12, n3, i3, rect1, rect2; - float *input, *smooth, **slope; - sf_file in, out, dip; - - sf_init(argc,argv); - in = sf_input("in"); - dip = sf_input("dip"); - out = sf_output("out"); - - if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input"); - n3 = sf_leftsize(in,2); - n12 = n1*n2; - - if (!sf_getint("rect1",&rect1)) rect1=3; - if (!sf_getint("rect2",&rect2)) rect2=3; - /* smoothing radius */ - - if (!sf_getbool("adj",&adj)) adj=false; - - if (adj) { - m12 = n1*(n2-rect2); - sf_putint(out,"n2",n2-rect2); - boxsl_init(n1, n2-rect2, rect1, rect2); - } else { - m12 = n1*(n2+rect2); - sf_putint(out,"n2",n2+rect2); - boxsl_init(n1, n2, rect1, rect2); - } - - input = sf_floatalloc(n12); - smooth = sf_floatalloc(m12); - slope = sf_floatalloc2(n1,n2); - - for (i3=0; i3 < n3; i3++) { - sf_floatread(input,n12,in); - sf_floatread(slope[0],n12,dip); - - boxsl_set(n2,slope); - - if (adj) { - boxsl_lop(true,false,m12,n12,smooth,input); - } else { - boxsl_lop(false,false,n12,m12,input,smooth); - } - - sf_floatwrite(smooth,m12,out); - } - - - exit(0); -} - -/* $Id$ */ - diff --git a/user/nobody/Mbyte2rsf.c b/user/nobody/Mbyte2rsf.c deleted file mode 100644 index 37c1806fa0..0000000000 --- a/user/nobody/Mbyte2rsf.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Convert raw byte images to RSF. - -Takes: < raw.img -*/ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -int main(int argc, char* argv[]) -{ - int n1, n2, x, y; - unsigned char *line; - float* array; - sf_file out; - - sf_init(argc,argv); - out = sf_output("out"); - - if(!sf_getint("n1",&n1)) sf_error("Need n1="); - /* vertical dimension */ - if(!sf_getint("n2",&n2)) sf_error("Need n2="); - /* horizontal dimension */ - - sf_putint(out,"n1",n1); - sf_putint(out,"n2",n2); - sf_putfloat(out,"d1",1.); - sf_putfloat(out,"d2",1.); - sf_setformat(out,"native_float"); - - array = sf_floatalloc(n1); - line = (unsigned char *) sf_alloc(n1,sizeof(unsigned char)); - - for (y = 0; y < n2; y++) { - if (n1 != fread(line, sizeof(unsigned char), n1, stdin)) - sf_error("trouble reading input data"); - for (x = 0; x < n1; x++) { - array[x] = (float) line[x]; - } - sf_floatwrite(array,n1,out); - } - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mcameron.c b/user/nobody/Mcameron.c deleted file mode 100644 index ef3ddd2a0a..0000000000 --- a/user/nobody/Mcameron.c +++ /dev/null @@ -1,154 +0,0 @@ -/* Convert Dix velocity to interval velocity (2-D). */ -/* - Copyright (C) 2010 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -int main(int argc, char *argv[]) -{ - bool verb; - int ix, it, nx, nt, niter, rect; - float ox, dx, dt, norm; - float **v, **vi, *x0, *z0, *x1, *z1, *x2, *num, *den; - sf_file vdix, zx; - - sf_init(argc,argv); - vdix = sf_input("in"); - zx = sf_output("out"); - - if (!sf_histint(vdix,"n1",&nx)) sf_error("No n1= in input"); - if (!sf_histint(vdix,"n2",&nt)) sf_error("No n2= in input"); - - if (!sf_histfloat(vdix,"o1",&ox)) sf_error("No o2= in input"); - if (!sf_histfloat(vdix,"d1",&dx)) sf_error("No d1= in input"); - if (!sf_histfloat(vdix,"d2",&dt)) sf_error("No d2= in input"); - - sf_shiftdim(vdix,zx,2); - sf_putint(zx,"n2",2); - - if (!sf_getint("niter",&niter)) niter=100; - /* number of iterations */ - - if (!sf_getint("rect",&rect)) rect=3; - /* lateral smoothing */ - - if (!sf_getbool("verb",&verb)) verb=false; - /* verbosity flag */ - - v = sf_floatalloc2(nx,nt); - vi = sf_floatalloc2(nx,nt); - - x0 = sf_floatalloc(nx); - z0 = sf_floatalloc(nx); - x1 = sf_floatalloc(nx); - z1 = sf_floatalloc(nx); - x2 = sf_floatalloc(nx); - - sf_floatread(v[0],nx*nt,vdix); - - for (ix=0; ix < nx; ix++) { - x0[ix] = 0.; - z0[ix] = 0.; - - x1[ix] = 0.; - z1[ix] = dt*v[0][ix]; - - x2[ix] = ox+ix*dx; - } - - sf_floatwrite(z0,nx,zx); - sf_floatwrite(x2,nx,zx); - - sf_floatwrite(z1,nx,zx); - sf_floatwrite(x2,nx,zx); - - /* dimensionless velocity */ - for (it=0; it < nt; it++) { - for (ix=0; ix < nx; ix++) { - v[it][ix] *= dt/dx; - vi[it][ix] = 1.0/v[it][ix]; - } - } - - sf_divn_init(1,nx,&nx,&rect,niter,verb); - - den = sf_floatalloc(nx); - num = sf_floatalloc(nx); - - for (it=2; it < nt; it++) { - norm = 0.; - for (ix=0; ix < nx; ix++) { - den[ix] = vi[it-1][ix]+0.25*(vi[it][ix]-vi[it-2][ix]); - norm += den[ix]*den[ix]; - } - norm = sqrtf(nx/norm); - - for (ix=0; ix < nx; ix++) { - den[ix] *= norm; - if (0==ix) { - num[ix] = -norm*(v[it-1][ix]*(z1[ix]-2*z1[ix+1]+z1[ix+2])+ - vi[it-1][ix]*(z0[ix]-2*z1[ix])+ - (v[it-1][ix+1]-v[it-1][ix])*(z1[ix+1]-z1[ix])- - 0.25*(vi[it][ix]-vi[it-2][ix])*z0[ix]); - } else if (nx-1==ix) { - num[ix] = -norm*(v[it-1][ix]*(z1[ix-2]-2*z1[ix-1]+z1[ix])+ - vi[it-1][ix]*(z0[ix]-2*z1[ix])+ - (v[it-1][ix]-v[it-1][ix-1])*(z1[ix]-z1[ix-1])- - 0.25*(vi[it][ix]-vi[it-2][ix])*z0[ix]); - } else { - num[ix] = -norm*(v[it-1][ix]*(z1[ix-1]-2*z1[ix]+z1[ix+1])+ - vi[it-1][ix]*(z0[ix]-2*z1[ix])+ - 0.25*(v[it-1][ix+1]-v[it-1][ix-1])*(z1[ix+1]-z1[ix-1])- - 0.25*(vi[it][ix]-vi[it-2][ix])*z0[ix]); - } - z0[ix] = z1[ix]; - } - sf_divn(num,den,z1); - sf_floatwrite(z1,nx,zx); - - for (ix=0; ix < nx; ix++) { - if (0==ix) { - num[ix] = -norm*(v[it-1][ix]*(x1[ix]-2*x1[ix+1]+x1[ix+2])+ - vi[it-1][ix]*(x0[ix]-2*x1[ix])+ - (v[it-1][ix+1]-v[it-1][ix])*(x1[ix+1]-x1[ix])- - 0.25*(vi[it][ix]-vi[it-2][ix])*x0[ix]+ - (v[it-1][ix+1]-v[it-1][ix])*dx); - } else if (nx-1==ix) { - num[ix] = -norm*(v[it-1][ix]*(x1[ix-2]-2*x1[ix-1]+x1[ix])+ - vi[it-1][ix]*(x0[ix]-2*x1[ix])+ - (v[it-1][ix]-v[it-1][ix-1])*(x1[ix]-x1[ix-1])- - 0.25*(vi[it][ix]-vi[it-2][ix])*x0[ix]+ - (v[it-1][ix]-v[it-1][ix-1])*dx); - } else { - num[ix] = -norm*(v[it-1][ix]*(x1[ix-1]-2*x1[ix]+x1[ix+1])+ - vi[it-1][ix]*(x0[ix]-2*x1[ix])+ - 0.25*(v[it-1][ix+1]-v[it-1][ix-1])*(x1[ix+1]-x1[ix-1])- - 0.25*(vi[it][ix]-vi[it-2][ix])*x0[ix]+ - 0.5*(v[it-1][ix+1]-v[it-1][ix-1])*dx); - } - x0[ix] = x1[ix]; - } - sf_divn(num,den,x1); - - for (ix=0; ix < nx; ix++) { - x2[ix] = x1[ix] + ox+ix*dx; - } - sf_floatwrite(x2,nx,zx); - } - - exit(0); -} diff --git a/user/nobody/Mcamig.c b/user/nobody/Mcamig.c deleted file mode 100644 index cd1d1dd384..0000000000 --- a/user/nobody/Mcamig.c +++ /dev/null @@ -1,233 +0,0 @@ -/* 3-D common-azimuth modeling/migration with extended split-step */ -/* - Copyright (C) 2006 Colorado School of Mines - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include "camig.h" - -int main (int argc, char *argv[]) -{ - char *mode; /* mode of operation */ - bool inv; /* forward or adjoint */ - bool verb; /* verbosity */ - float eps; /* dip filter constant */ - int nrmax; /* number of reference velocities */ - float dtmax; /* time error */ - int pmx,pmy,phx; /* padding in the k domain */ - int tmx,tmy,thx; /* boundary taper size */ - - sf_axis az,amx,amy,aw,alx,aly,ahx,ae; - int nz, n, nw; - float dw, w0; - - sf_file Fs; /* slowness file S(nlx,nly, nz ) */ - sf_file Fi=NULL; /* image file R(nmx,nmy,nhx,nz ) */ - sf_file Fd,Fw=NULL; /* data file D(nmx,nmy,nhx, nw) */ - - fslice slow,imag=NULL,data,wfld=NULL; - - /*------------------------------------------------------------*/ - sf_init(argc,argv); - - /* default mode is migration/modeling */ - if (NULL == (mode = sf_getstring("mode"))) mode = "m"; - - if (!sf_getbool( "inv", &inv )) inv = false; /* y=modeling; n=migration */ - if (!sf_getbool( "verb", &verb )) verb = false; /* verbosity flag */ - if (!sf_getfloat("eps", &eps )) eps = 0.01; /* stability parameter */ - if (!sf_getint( "nrmax",&nrmax)) nrmax = 1; /* maximum number of refs */ - if (!sf_getfloat("dtmax",&dtmax)) dtmax = 0.004; /* time error */ - if (!sf_getint( "pmx", &pmx )) pmx = 0; /* padding mx*/ - if (!sf_getint( "pmy", &pmy )) pmy = 0; /* padding my*/ - if (!sf_getint( "phx", &phx )) phx = 0; /* padding hx*/ - - if (!sf_getint( "tmx", &tmx )) tmx = 0; /* taper mx */ - if (!sf_getint( "tmy", &tmy )) tmy = 0; /* taper my */ - if (!sf_getint( "thx", &thx )) thx = 0; /* taper hx */ - - /* slowness parameters */ - Fs = sf_input ("slo"); - alx = sf_iaxa(Fs,1); sf_setlabel(alx,"lx"); - aly = sf_iaxa(Fs,2); sf_setlabel(aly,"ly"); - az = sf_iaxa(Fs,3); nz = sf_n(az); sf_setlabel(az,"z"); - slow = fslice_init(sf_n(alx)*sf_n(aly),nz,sizeof(float)); - fslice_load(Fs,slow,SF_FLOAT); - - switch(mode[0]) { - case 'w': /* save wavefield */ - Fd = sf_input ( "in"); - Fw = sf_output("out"); sf_settype(Fw,SF_COMPLEX); - if (SF_COMPLEX !=sf_gettype(Fd)) sf_error("Need complex data"); - - amx = sf_iaxa(Fd,1); sf_setlabel(amx,"mx"); sf_oaxa(Fw,amx,1); - amy = sf_iaxa(Fd,2); sf_setlabel(amy,"my"); sf_oaxa(Fw,amy,2); - ahx = sf_iaxa(Fd,3); sf_setlabel(ahx,"hx"); sf_oaxa(Fw,ahx,3); - ; sf_oaxa(Fw,az ,4); - aw = sf_iaxa(Fd,4); sf_setlabel(aw ,"w" ); sf_oaxa(Fw,aw ,5); - ae = sf_maxa(1,0,1); - - n = sf_n(amx)*sf_n(amy)*sf_n(ahx); - nw = sf_n(aw); - - data = fslice_init(n,nw,sizeof(sf_complex)); - wfld = fslice_init(n, nz*nw,sizeof(sf_complex)); - - fslice_load(Fd,data,SF_COMPLEX); - - break; - case 'd': - if (inv) { /* upward continuation */ - Fw = sf_input ( "in"); - Fd = sf_output("out"); sf_settype(Fd,SF_COMPLEX); - if (SF_COMPLEX !=sf_gettype(Fw)) sf_error("Need complex data"); - - amx = sf_iaxa(Fw,1); sf_setlabel(amx,"mx"); sf_oaxa(Fd,amx,1); - amy = sf_iaxa(Fw,2); sf_setlabel(amy,"my"); sf_oaxa(Fd,amy,2); - ahx = sf_iaxa(Fw,3); sf_setlabel(ahx,"hx"); sf_oaxa(Fd,ahx,3); - aw = sf_iaxa(Fw,4); sf_setlabel(aw , "w"); sf_oaxa(Fd,aw ,4); - ae = sf_iaxa(Fw,5); sf_setlabel(ae, "e"); sf_oaxa(Fd,ae ,5); - - n = sf_n(amx)*sf_n(amy)*sf_n(ahx); - nw = sf_n(aw)*sf_n(ae); - - data = fslice_init(n,nw,sizeof(sf_complex)); - wfld = fslice_init(n,nw,sizeof(sf_complex)); - - fslice_load(Fw,wfld,SF_COMPLEX); - } else { /* downward continuation */ - Fd = sf_input ( "in"); - Fw = sf_output("out"); sf_settype(Fw,SF_COMPLEX); - if (SF_COMPLEX !=sf_gettype(Fd)) sf_error("Need complex data"); - - amx = sf_iaxa(Fd,1); sf_setlabel(amx,"mx"); sf_oaxa(Fw,amx,1); - amy = sf_iaxa(Fd,2); sf_setlabel(amy,"my"); sf_oaxa(Fw,amy,2); - ahx = sf_iaxa(Fd,3); sf_setlabel(ahx,"hx"); sf_oaxa(Fw,ahx,3); - aw = sf_iaxa(Fd,4); sf_setlabel(aw , "w"); sf_oaxa(Fw,aw ,4); - ae = sf_iaxa(Fd,5); sf_setlabel(ae , "e"); sf_oaxa(Fw,ae ,5); - - n = sf_n(amx)*sf_n(amy)*sf_n(ahx); - nw = sf_n(aw)*sf_n(ae); - - data = fslice_init(n,nw,sizeof(sf_complex)); - wfld = fslice_init(n,nw,sizeof(sf_complex)); - - fslice_load(Fd,data,SF_COMPLEX); - } - break; - case 'm': - default: - if (inv) { /* modeling */ - Fi = sf_input ( "in"); - Fd = sf_output("out"); sf_settype(Fd,SF_COMPLEX); - if (SF_FLOAT !=sf_gettype(Fi)) sf_error("Need float image"); - - if (!sf_getint ("nw",&nw)) sf_error ("Need nw="); - if (!sf_getfloat("dw",&dw)) sf_error ("Need dw="); - if (!sf_getfloat("ow",&w0)) w0=0.; - aw = sf_maxa(nw,w0,dw); - sf_setlabel(aw, "w"); - sf_setunit(aw, "1/s"); - - amx = sf_iaxa(Fi,1); sf_setlabel(amx,"mx"); sf_oaxa(Fd,amx,1); - amy = sf_iaxa(Fi,2); sf_setlabel(amy,"my"); sf_oaxa(Fd,amy,2); - ahx = sf_iaxa(Fi,3); sf_setlabel(ahx,"hx"); sf_oaxa(Fd,ahx,3); - az = sf_iaxa(Fi,4); sf_setlabel(az , "z"); sf_oaxa(Fd,aw ,4); - ae = sf_maxa(1,0,1); - - n = sf_n(amx)*sf_n(amy)*sf_n(ahx); - - data = fslice_init(n,nw,sizeof(sf_complex)); - imag = fslice_init(n,nz,sizeof(float)); - - fslice_load(Fi,imag,SF_FLOAT); - } else { /* migration */ - Fd = sf_input ( "in"); - Fi = sf_output("out"); sf_settype(Fi,SF_FLOAT); - if (SF_COMPLEX !=sf_gettype(Fd)) sf_error("Need complex data"); - - amx = sf_iaxa(Fd,1); sf_setlabel(amx,"mx"); sf_oaxa(Fi,amx,1); - amy = sf_iaxa(Fd,2); sf_setlabel(amy,"my"); sf_oaxa(Fi,amy,2); - ahx = sf_iaxa(Fd,3); sf_setlabel(ahx,"hx"); sf_oaxa(Fi,ahx,3); - aw = sf_iaxa(Fd,4); sf_setlabel(aw , "w"); sf_oaxa(Fi,az ,4); - ae = sf_maxa(1,0,1); - - n = sf_n(amx)*sf_n(amy)*sf_n(ahx); - nw = sf_n(aw); - - data = fslice_init(n,nw,sizeof(sf_complex)); - imag = fslice_init(n,nz,sizeof(float)); - - fslice_load(Fd,data,SF_COMPLEX); - } - break; - } - - /*------------------------------------------------------------*/ - - camig_init(verb,eps,dtmax, - az,aw,ae, - amx,amy,ahx, - alx,aly, - tmx,tmy,thx, - pmx,pmy,phx, - nrmax,slow); - - switch(mode[0]) { - case 'w': - cawfl( data,wfld); - break; - case 'd': - cadtm(inv,data,wfld); - break; - case 'm': - default: - camig_aloc(); - camig(inv,data,imag); - camig_free(); - break; - } - - camig_close(); - - /*------------------------------------------------------------*/ - - switch(mode[0]) { - case 'w': - fslice_dump(Fw,wfld,SF_COMPLEX); - fslice_close(data); - fslice_close(wfld); - break; - case 'd': - if(inv) fslice_dump(Fd,data,SF_COMPLEX); - else fslice_dump(Fw,wfld,SF_COMPLEX); - fslice_close(data); - fslice_close(wfld); - break; - case 'm': - if(inv) fslice_dump(Fd,data,SF_COMPLEX); - else fslice_dump(Fi,imag,SF_FLOAT); - fslice_close(data); - fslice_close(imag); - default: - break; - } - fslice_close(slow); - - exit (0); -} diff --git a/user/nobody/Mcircle.py b/user/nobody/Mcircle.py deleted file mode 100755 index 4bc9cb2a7e..0000000000 --- a/user/nobody/Mcircle.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -'generate circle wave snapshot' - -## Copyright (C) 2012 Zhonghuan Chen, UT Austin, Tsinghua University -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -try: - from numpy import * - import rsf.api as rsf -except Exception, e: - import sys - print 'ERROR : need numpy' - sys.exit(1) - -par=rsf.Par() -output=rsf.Output() - - -n1=par.int("n1",500) -o1=par.float("o1",-250) -d1=par.float("d1",1) -n2=par.int("n2",500) -o2=par.float("o2",-250) -d2=par.float("d2",1) -f=par.float("f",0.05) -# frequency (circles per sampling interval) -df=par.float("df",0.0) -# chirp frequceny shift -a=par.float("a",0.0) -# amplitude attenuation - -output.put("n1",n1) -output.put("o1",o1) -output.put("d1",d1) -output.put("n2",n2) -output.put("o2",o2) -output.put("d2",d2) - -dat=zeros((n1,n2),'f') - -for i1 in range(n1): - x1=i1*d1+o1 - for i2 in range(n2): - x2=i2*d2+o2 - r=sqrt(x1*x1+x2*x2) - p=2*math.pi*(f+df*r)*r - dat[i1,i2]=exp(-a*r)*cos(p) - -output.write(dat) -#output.close() - - diff --git a/user/nobody/Mcoh.c b/user/nobody/Mcoh.c deleted file mode 100644 index 424e727c34..0000000000 --- a/user/nobody/Mcoh.c +++ /dev/null @@ -1,104 +0,0 @@ -/* 3-D coherency estimation using plane wave destruction. - -Takes: < data.rsf > residual.rsf -*/ - -#include - -#include "coh.h" - -int main (int argc, char *argv[]) -{ - int n1,n2,n3, w1,w2,w3, m1,m2,m3, i1,i2,i3, n123, nw, nj1, nj2; - float ***u, ***p, ***c; - sf_file in, out, dip; - coh ch; - - sf_init(argc,argv); - in = sf_input ("in"); - dip = sf_input ("dip"); - out = sf_output ("out"); - - if (SF_FLOAT != sf_gettype(in) || - SF_FLOAT != sf_gettype(dip)) sf_error("Need float type"); - - if (!sf_histint(in,"n1",&n1)) sf_error("Need n1= in input"); - if (!sf_histint(in,"n2",&n2)) n2=1; - if (!sf_histint(in,"n3",&n3)) n3=1; - n123 = n1*n2*n3; - - if (!sf_histint(dip,"n1",&m1) || m1 != n1) - sf_error("Need n1=%d in dip",n1); - if (1 != n2 && (!sf_histint(dip,"n2",&m2) || m2 != n2)) - sf_error("Need n2=%d in dip",n2); - if (1 != n3 && (!sf_histint(dip,"n3",&m3) || m3 != n3)) - sf_error("Need n3=%d in dip",n3); - - /* two dips output in 3-D */ - if (n3 > 1) sf_putint(out,"n4",2); - - if (!sf_getint("order",&nw)) nw=1; - /* [1,2,3] accuracy */ - if (nw < 1 || nw > 3) - sf_error ("Unsupported nw=%d, choose between 1 and 3",nw); - if (!sf_getint("nj1",&nj1)) nj1=1; - /* in-line aliasing */ - if (!sf_getint("nj2",&nj2)) nj2=1; - /* cross-line aliasing */ - - if (!sf_getint("w1",&w1)) sf_error("Need w1="); - if (!sf_getint("w2",&w2)) sf_error("Need w2="); - if (!sf_getint("w3",&w3)) w3=1; - /* window size */ - if (w1 > n1) w1=n1; - if (w2 > n2) w2=n2; - if (w3 > n3) w3=n3; - - u = sf_floatalloc3(n1,n2,n3); - p = sf_floatalloc3(n1,n2,n3); - c = sf_floatalloc3(n1,n2,n3); - - /* read data */ - sf_floatread(u[0][0],n123,in); - - /* read t-x dip */ - sf_floatread(p[0][0],n123,dip); - - ch = coh_init (nw,nj1,n1,n2,n3,p); - - /* apply */ - for (i3=0; i3 < n3; i3++) { - for (i2=0; i2 < n2; i2++) { - for (i1=0; i1 < n1; i1++) { - c[i3][i2][i1] = coh1(ch,i1,i2,i3,w1,w2,w3,u); - } - } - } - - /* write t-x coherency */ - sf_floatwrite(c[0][0],n123,out); - - if (n3 > 1) { /* if 3-D input */ - /* read t-y dip */ - sf_floatread(p[0][0],n123,dip); - - if (nj2 != nj1) ch = coh_init (nw,nj2,n1,n2,n3,p); - - /* apply */ - for (i3=0; i3 < n3; i3++) { - for (i2=0; i2 < n2; i2++) { - for (i1=0; i1 < n1; i1++) { - c[i3][i2][i1] = coh2(ch,i1,i2,i3,w1,w2,w3,u); - } - } - } - - /* write t-y coherency */ - sf_floatwrite(c[0][0],n123,out); - } - - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mctmf.c b/user/nobody/Mctmf.c deleted file mode 100644 index 0cf790c2a5..0000000000 --- a/user/nobody/Mctmf.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Constant-time 2D median filtering */ -/* - Copyright (C) 2008 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -int main (int argc, char* argv[]) -{ - int i3, n3, n1, n2, n12, r; - unsigned char* input; - unsigned char* output; - sf_file in, out; - - sf_init (argc, argv); - in = sf_input("in"); - out = sf_output("out"); - - if (SF_UCHAR != sf_gettype(in)) sf_error("Need uchar type"); - if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&n2)) n2=1; - - if (!sf_getint("r",&r)) sf_error ("Need r="); - /* filter radius - kernel will be a (2*r+1)x(2*r+1) square */ - - n3 = sf_leftsize(in,2); - n12 = n1*n2; - - input = sf_ucharalloc(n12); - output = sf_ucharalloc(n12); - - for (i3=0; i3 < n3; i3++) { - sf_ucharread(input, n12, in); - - ctmf (input, output, n1, n2, n1, n1, - r, 1, 1024*1024); - - sf_ucharwrite(output, n12, out); - } - - exit (0); -} diff --git a/user/nobody/Mcube2list.c b/user/nobody/Mcube2list.c deleted file mode 100644 index ce3a7a3f0a..0000000000 --- a/user/nobody/Mcube2list.c +++ /dev/null @@ -1,157 +0,0 @@ -/* Maps a cube to a list, given a threshold (clip value). */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef _LARGEFILE_SOURCE -#define _LARGEFILE_SOURCE -#endif - -#include - -int main(int argc, char* argv[]) -{ - bool verb; /* verbosity flag */ - float clip; /* threshold (clip value) */ - sf_file Fc; /* cube file */ - sf_file Fl; /* list file */ - extern int fseeko(FILE *stream, off_t offset, int whence); - - sf_axis ax,ay,az; - sf_axis aa; - int ix,iy,iz; - int nx,ny,nz,nj,na; - int nk=0,jk; - - float **cube; - float dx,dy,dz; - float x0,y0,z0; - - FILE* tfile; - char* tname; - float t2[3],t3[4]; - - /*------------------------------------------------------------*/ - - /* init RSF */ - sf_init(argc,argv); - if(! sf_getbool("verb",&verb)) verb=false; - if(! sf_getfloat("clip",&clip)) clip=0; - - Fc = sf_input ( "in"); /* input cube */ - Fl = sf_output("out"); /* output list */ - - /* read axes*/ - az=sf_iaxa(Fc,1); sf_setlabel(az,"z"); - ax=sf_iaxa(Fc,2); sf_setlabel(ax,"x"); - ay=sf_iaxa(Fc,3); sf_setlabel(ay,"y"); - - nz=sf_n(az); z0=sf_o(az); dz=sf_d(az); - nx=sf_n(ax); x0=sf_o(ax); dx=sf_d(ax); - ny=sf_n(ay); y0=sf_o(ay); dy=sf_d(ay); - - na=0; - if(ny>1) { - if(verb) sf_warning("initiating 3D points"); - nj=4; - } else { - if(verb) sf_warning("initiating 2D points"); - nj=3; - } - /*------------------------------------------------------------*/ - - cube = sf_floatalloc2(nz,nx); - - tfile = sf_tempfile(&(tname), "w+b"); - - for (iy=0;iy clip) { - nk++; - } - } - } - - if(ny>1) { - jk=0; - for (ix=0; ix clip) { - t3[0] = x0 + ix * dx; - t3[1] = y0 + iy * dy; - t3[2] = z0 + iz * dz; - t3[3] = cube[ix][iz]; - - fseeko(tfile,jk*4*sizeof(float),SEEK_SET); - fwrite( t3, sizeof(float),4,tfile); - jk++; - } - } - } - } else { - jk=0; - for (ix=0; ix clip) { - t2[0] = x0 + ix * dx; - t2[1] = z0 + iz * dz; - t2[2] = cube[ix][iz]; - - fseeko(tfile,jk*3*sizeof(float),SEEK_SET); - fwrite( t2, sizeof(float),3,tfile); - jk++; - } - } - } - } /* else ny=1 */ - - na += nk; - } /* iy */ - - /* output axes */ - aa = sf_maxa(nj,0,1); sf_oaxa(Fl,aa,1); if(verb) sf_raxa(aa); free(aa); - aa = sf_maxa(na,0,1); sf_oaxa(Fl,aa,2); if(verb) sf_raxa(aa); free(aa); - - if( ny>1) { - for( jk=0; jk - -#include "dip3.h" -#include "interpd.h" - -int main (int argc, char *argv[]) -{ - int n1, n2, n3, n12, niter, nf, i, i2, i1, m1, m2, m3, m12, nj1, nj2; - int rect[3], liter; - bool verb, sign; - float d2, d3, p0, q0, *t, *tt; - float ***u1, ***uu1, ***p, ***q, ***uu, ***u2, ***uu2, ***q2; - sf_file in, out; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input"); - if (!sf_histint(in,"n3",&n3)) n3=1; - if (!sf_histfloat(in,"d2",&d2)) d2=1.; - if (!sf_histfloat(in,"d3",&d3)) d3=d2; - - if (!sf_getint("niter",&niter)) niter=10; - /* number of dip-estimation iterations */ - if (!sf_getint("liter",&liter)) liter=100; - /* number of linear iterations */ - if (!sf_getint("rect1",&rect[0])) rect[0]=1; - if (!sf_getint("rect2",&rect[1])) rect[1]=1; - if (!sf_getint("rect3",&rect[2])) rect[2]=1; - /* dip smoothness */ - - if (!sf_getint("order",&nf)) nf=1; - /* [1,2,3] dip filter accuracy */ - if (nf < 1 || nf > 3) sf_error ("accuracy must be between 1 and 3"); - - if(SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - - if(!sf_getbool("verb",&verb)) verb = false; - /* verbosity flag */ - if(!sf_getbool("sign",&sign)) sign = false; - /* if y, keep dip sign constant */ - - if (!sf_getfloat("p0",&p0)) p0=0.; - /* initial in-line dip */ - if (!sf_getfloat("q0",&q0)) q0=0.; - /* initial cross-line dip */ - - if (!sf_getint("nj1",&nj1)) nj1=2; - /* in-line antialiasing */ - if (!sf_getint("nj2",&nj2)) nj2=2; - /* cross-line antialiasing */ - - m1 = n1; - m2 = n2*2-1; if (n2 > 1) d2 /= 2; - m3 = n3*2-1; if (n3 > 1) d3 /= 2; - - n12 = n1*n2*n3; - m12 = m1*m2*m3; - - sf_putint(out,"n2",m2); - sf_putfloat(out,"d2",d2); - sf_putint(out,"n3",m3); - sf_putfloat(out,"d3",d3); - - u1 = sf_floatalloc3(n1,n2,n3); - t = sf_floatalloc(n12); - - tt = sf_floatalloc(m12); - uu = sf_floatalloc3(m1,m2,m3); - u2 = sf_floatalloc3(m1,m3,m2); - - p = sf_floatalloc3(n1,n2,n3); - q = sf_floatalloc3(n1,n2,n3); - - uu1 = sf_floatalloc3(n1,m2,n3); - uu2 = sf_floatalloc3(n1,n3,m2); - q2 = sf_floatalloc3(n1,n3,m2); - - free (uu2[0][0]); - for (i1=0; i1 < m2; i1++) { - for (i2=0; i2 < n3; i2++) { - uu2[i1][i2] = uu1[i2][i1]; - } - } - - free (u2[0][0]); - for (i1=0; i1 < m2; i1++) { - for (i2=0; i2 < m3; i2++) { - u2[i1][i2] = uu[i2][i1]; - } - } - - dip3_init(n1, n2, n3, rect, liter, sign); - interp_init (n1, 0.0001); - - sf_floatread(u1[0][0],n12,in); - - if (verb) sf_warning("Estimating slopes..."); - - for (i2=0; i2 < n3; i2++) { - for (i1=0; i1 < n2; i1++) { - for (i=0; i < n1; i++) { - p[i2][i1][i]=p0; - q[i2][i1][i]=q0; - } - } - } - - dip3(1, niter, nf, nj1, verb, u1, p, NULL); - dip3(2, niter, nf, nj2, verb, u1, q, NULL); - - if (verb) sf_warning("Expanding slopes..."); - -/* - if (nj1 > 1) { - for (i=0; i < n12; i++) { - p[0][0][i] /= nj1; - } - } - - if (nj2 > 1) { - for (i=0; i < n12; i++) { - q[0][0][i] /= nj2; - } - } -*/ - - for (i2=0; i2 < n3; i2++) { - for (i1=0; i1 < n2-1; i1++) { - q2[2*i1][i2] = q[i2][i1]; - for (i=0; i < n1; i++) { - q2[2*i1+1][i2][i] = 0.5*(q[i2][i1][i]+q[i2][i1+1][i]); - } - } - } - - - if (verb) sf_warning("Interpolating..."); - - for (i2=0; i2 < n3; i2++) { - interp2(n2,u1[i2],uu1[i2],p[i2]); - } - - for (i1=0; i1 < m2; i1++) { - interp2(n3,uu2[i1],u2[i1],q2[i1]); - } - - sf_floatwrite(uu[0][0],m12,out); - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mdip2.c b/user/nobody/Mdip2.c deleted file mode 100644 index 36ac850d5a..0000000000 --- a/user/nobody/Mdip2.c +++ /dev/null @@ -1,129 +0,0 @@ -/* 2-D dip estimation by plane wave destruction. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -#include "dip2.h" -#include "mask6.h" - -int main (int argc, char *argv[]) -{ - int n1,n2, n3, i3, n12, niter, nw, nj, i, liter; - float eps, lam, p0, **u, **p; - bool verb, lverb, sign, gauss, **m; - sf_file in, out, mask, dip; - - sf_init(argc,argv); - in = sf_input ("in"); - out = sf_output ("out"); - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float type"); - - if (!sf_histint(in,"n1",&n1)) sf_error("Need n1= in input"); - if (!sf_histint(in,"n2",&n2)) sf_error("Need n2= in input"); - n12 = n1*n2; - n3 = sf_leftsize(in,2); - - if (!sf_getint("niter",&niter)) niter=5; - /* number of iterations */ - if (!sf_getint("niter",&liter)) liter=20; - /* number of linear iterations */ - - if (!sf_getfloat("eps",&eps)) eps=1.; - /* vertical smoothness */ - if (!sf_getfloat("lam",&lam)) lam=1.; - /* horizontal smoothness */ - - if (!sf_getfloat("rect1",&eps)) eps=sqrtf(12*eps+1.); - /* vertical smoothness (overrides eps) */ - if (!sf_getfloat("rect2",&lam)) lam=sqrtf(12*lam+1.); - /* horizontal smoothness (overrides lam) */ - - if (NULL != sf_getstring("dip0")) { - p0 = 0.; - dip = sf_input("dip0"); - } else { - if (!sf_getfloat("p0",&p0)) p0=0.; - /* initial dip */ - dip = NULL; - } - - if (!sf_getint("order",&nw)) nw=1; - /* [1,2,3] accuracy order */ - if (nw < 1 || nw > 3) - sf_error ("Unsupported nw=%d, choose between 1 and 3",nw); - if (!sf_getint("nj",&nj)) nj=1; - /* antialiasing */ - - if (!sf_getbool("verb",&verb)) verb = false; - /* verbosity flag */ - if (!sf_getbool("lverb",&lverb)) lverb = false; - /* verbosity flag for linear iterations */ - if (!sf_getbool("sign",&sign)) sign = false; - /* if y, keep dip sign constant */ - if (!sf_getbool("gauss",&gauss)) gauss = true; - /* if y, use exact Gaussian for smoothing */ - - /* initialize dip estimation */ - dip2_init(liter, n1, n2, eps, lam, sign, gauss, lverb); - - u = sf_floatalloc2(n1,n2); - p = sf_floatalloc2(n1,n2); - - if (NULL != sf_getstring("mask")) { - m = sf_boolalloc2(n1,n2); - mask = sf_input("mask"); - } else { - m = NULL; - mask = NULL; - } - - for (i3=0; i3 < n3; i3++) { - if (verb) sf_warning("cmp %d of %d",i3+1,n3); - - if (NULL != m) { - sf_floatread(u[0],n12,mask); - mask3 (nw, nj, n1, n2, u, m); - } - - /* read data */ - sf_floatread(u[0],n12,in); - - /* initialize dip */ - if (NULL != dip) { - sf_floatread(p[0],n12,dip); - } else { - for(i=0; i < n12; i++) { - p[0][i] = p0; - } - } - - /* estimate dip */ - dip2(niter, nw, nj, verb, u, p, m); - - /* write dip */ - sf_floatwrite(p[0],n12,out); - } - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mdipspray.c b/user/nobody/Mdipspray.c deleted file mode 100644 index 14911ca64d..0000000000 --- a/user/nobody/Mdipspray.c +++ /dev/null @@ -1,47 +0,0 @@ -#include - -int main(int argc, char* argv[]) -{ - int n1, n2, i1, i2, it; - float t, *data, *slope, *next; - sf_file trace, dip, out; - - sf_init(argc,argv); - trace = sf_input("trace"); - dip = sf_input("in"); - out = sf_output("out"); - - if (!sf_histint(dip,"n1",&n1)) sf_error("No n1= in dip"); - if (!sf_histint(dip,"n2",&n2)) sf_error("No n2= in dip"); - - data = sf_floatalloc(n1); - next = sf_floatalloc(n1); - slope = sf_floatalloc(n1); - - sf_floatread(next,n1,trace); - sf_floatwrite(next,n1,out); - - for (i2=1; i2 < n2; i2++) { - for (i1=0; i1 < n1; i1++) { - data[i1] = next[i1]; - } - sf_floatread(slope,n1,dip); - for (i1=0; i1 < n1; i1++) { - t = i1-slope[i1]; - it = t; t -= it; - if (it <= 0) { - next[i1] = data[0]; - } else if (it >= n1-1) { - next[i1] = data[n1-1]; - } else { - next[i1] = t*data[it+1] + (1.-t)*data[it]; - } - } - sf_floatwrite(next,n1,out); - } - - - exit(0); -} - -/* $Id$ */ diff --git a/user/nobody/Mdsr2.c b/user/nobody/Mdsr2.c deleted file mode 100644 index 462bb5ab6a..0000000000 --- a/user/nobody/Mdsr2.c +++ /dev/null @@ -1,150 +0,0 @@ -/* 2-D prestack modeling/migration with split-step DSR. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "dsr2.h" - -int main (int argc, char *argv[]) -{ - int nz; /* depth samples */ - int ny; /* lateral samples */ - int nx; /* number of midpoints */ - int nh; /* number of offsets */ - int nw; /* number of frequencies */ - int nt, ntx, nth; /* boundary taper size */ - int nr; /* number of reference velocities */ - int npad; /* padding on offset wavenumber */ - - float z0, dz; /* depth origin, sampling interval */ - float w0, dw; /* frequency origin, sampling interval */ - float x0, dx; /* midpoint origin, sampling interval */ - float y0, dy; /* spatial origin, sampling interval */ - float h0, dh; /* offset origin, sampling interval */ - float dt; /* time error */ - - float **slow; - - bool inv; /* modeling or migration */ - bool verb; /* verbosity */ - float eps; /* dip filter constant */ - sf_file in, out, vel; - slice imag; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - vel = sf_input("slowness"); - - if (!sf_getbool("inv",&inv)) inv = false; - /* If y, modeling; if n, migration */ - if (!sf_getbool("verb",&verb)) verb = false; - /* verbosity flag */ - if (!sf_getfloat("eps",&eps)) eps = 0.01; - /* stability parameter */ - - if (!sf_histint (in,"n1",&nh)) nh = 1; - if (!sf_histfloat(in,"d1",&dh)) sf_error ("No d1= in input"); - if (!sf_histfloat(in,"o1",&h0)) h0=0.; - - if (!sf_histint (in,"n2",&nx)) nx = 1; - if (!sf_histfloat(in,"d2",&dx)) sf_error ("No d2= in input"); - if (!sf_histfloat(in,"o2",&x0)) x0=0.; - - if (!sf_getint("nt",&nt)) nt = 1; - /* taper size */ - ntx = SF_MIN(nt,nx-1); - nth = SF_MIN(nt,nh-1); - - if (!sf_getint("nr",&nr)) nr = 1; - /* maximum number of references */ - - if (!sf_getfloat("dt",&dt)) dt=0.004; - /* time error */ - - if (!sf_getint("npad",&npad)) npad = 0; - /* padding on offset wavenumber */ - - if (inv) { /* modeling */ - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - sf_settype(out,SF_COMPLEX); - - if (!sf_histint (in,"n3",&nz)) sf_error ("No n3= in input"); - if (!sf_histfloat(in,"d3",&dz)) sf_error ("No d3= in input"); - - if (!sf_histint (in,"n2",&ny)) sf_error ("No n2= in input"); - if (!sf_histfloat(in,"d2",&dy)) sf_error ("No d2= in input"); - if (!sf_histfloat(in,"o2",&y0)) sf_error ("No o2= in input"); - - if (!sf_getint ("nw",&nw)) sf_error ("Need nw="); - /* Length of frequency axis (for modeling) */ - if (!sf_getfloat("dw",&dw)) sf_error ("Need dw="); - /* Frequency sampling (for modeling) */ - if (!sf_getfloat("w0",&w0)) w0=0.; - /* Frequency origin (for modeling) */ - sf_putint (out,"n3",nw); - sf_putfloat(out,"d3",dw); - sf_putfloat(out,"o3",w0); - } else { /* migration */ - if (SF_COMPLEX != sf_gettype(in)) sf_error("Need complex input"); - sf_settype(out,SF_FLOAT); - - if (!sf_histint (in,"n3",&nw)) sf_error ("No n3= in input"); - if (!sf_histfloat(in,"d3",&dw)) sf_error ("No d3= in input"); - if (!sf_histfloat(in,"o3",&w0)) sf_error ("No o3= in input"); - - if (!sf_histint (vel,"n2",&nz)) sf_error ("No n2= in slowness"); - if (!sf_histfloat(vel,"d2",&dz)) sf_error ("No d2= in slowness"); - if (!sf_histfloat(vel,"o2",&z0)) z0=0.; - - if (!sf_histint (vel,"n1",&ny)) sf_error ("No n1= in slowness"); - if (!sf_histfloat(vel,"d1",&dy)) sf_error ("No d1= in slowness"); - if (!sf_histfloat(vel,"o1",&y0)) y0=0.; - - sf_putint (out,"n3",nz); - sf_putfloat(out,"d3",dz); - sf_putfloat(out,"o3",z0); - } - /* from hertz to radian */ - dw *= 2.*SF_PI; - w0 *= 2.*SF_PI; - - slow = sf_floatalloc2(ny,nz); - sf_floatread(slow[0],ny*nz,vel); - sf_fileclose(vel); - - imag = slice_init( inv ? in:out,nh,ny,nz); - - dsr2_init (nz,dz, - nh,dh,h0, - nx,dx,x0, - ny,dy,y0, - ntx,nth, - nr, - npad); - dsr2 (verb, inv, eps, - nw, dw, w0, - inv ? out:in, - imag, - slow, - dt); - dsr2_close(); - - exit (0); -} diff --git a/user/nobody/Mdsrstep1.c b/user/nobody/Mdsrstep1.c deleted file mode 100644 index e434a36621..0000000000 --- a/user/nobody/Mdsrstep1.c +++ /dev/null @@ -1,220 +0,0 @@ -/* 2-D prestack modeling/migration with split-step DSR. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "dsr1.h" - -int main (int argc, char *argv[]) -{ - int nt; /* number of time samples */ - int nz; /* number of migrated time samples */ - int nx; /* number of midpoints */ - int nh; /* number of offsets */ - int ix,it,iz; /* loop counters */ - int ntfft; /* fft size */ - int nw; /* number of frequencies */ - - float dt; /* time sampling interval */ - float dz; /* migrated time sampling interval */ - float dw; /* frequency sampling interval */ - float x0, dx; /* spatial origin, sampling interval */ - float h0, dh; /* offset origin, sampling interval */ - float **vt, *v, v0; /* velocities */ - float *p,**q; /* input, output data */ - - float complex ***cp; /* complex input */ - - bool inv; /* modeling or migration */ - bool depth; /* depth or time */ - bool verb; /* verbosity */ - float eps; /* dip filter constant */ - kiss_fftr_cfg fft; - sf_file in, out, vel; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_getbool("inv",&inv)) inv = false; - /* If y, modeling; if n, migration */ - if (!sf_getbool("verb",&verb)) verb = false; - /* verbosity flag */ - if (!sf_getbool("depth",&depth)) depth = false; - /* depth or time migration */ - if (!sf_getfloat("eps",&eps)) eps = 0.01; - /* stability parameter */ - - if (NULL == sf_getstring("velocity")) { - /* velocity file */ - if (!sf_getfloat("vel",&v0)) sf_error ("Need vel="); - /* constant velocity (if no velocity file) */ - vel = NULL; - } else { - vel = sf_input("velocity"); - } - - if (inv) { /* modeling */ - if (!sf_histint(in,"n1",&nz)) sf_error ("No n1= in input"); - if (!sf_histfloat(in,"d1",&dz)) sf_error ("No d1= in input"); - if (!sf_getint("nt",&nt)) sf_error ("Need nt="); - /* Length of time axis (for modeling) */ - if (!sf_getfloat("dt",&dt)) sf_error ("Need dt="); - /* Time sampling (for modeling) */ - sf_putint(out,"n1",nt); - sf_putfloat(out,"d1",dt); - - if (!sf_histint(in,"n2",&nx)) nx=1; - if (!sf_histfloat(in,"d2",&dx)) sf_error ("No d2= in input"); - if (!sf_histfloat(in,"o2",&x0)) x0=0.; - - if (!sf_histint(in,"nh",&nh)) sf_error("Need nh="); - /* Number of offsets (for modeling) */ - if (!sf_histfloat(in,"dh",&dh)) sf_error ("Need dh="); - /* Offset sampling (for modeling) */ - if (!sf_histfloat(in,"h0",&h0)) h0=0.; - /* Offset origin (for modeling) */ - - sf_putint(out,"n2",nh); - sf_putfloat(out,"d2",dh); - sf_putfloat(out,"o2",h0); - - sf_putint(out,"n3",nx); - sf_putfloat(out,"d3",dx); - sf_putfloat(out,"o3",x0); - } else { /* migration */ - if (!sf_histint(in,"n1",&nt)) sf_error ("No n1= in input"); - if (!sf_histfloat(in,"d1",&dt)) sf_error ("No d1= in input"); - if (NULL == vel) { - if (!sf_getint("nz",&nz)) { - /* number of steps in depth - (for constant-velocity depth migration) */ - if (depth) sf_error ("Need nz="); - nz = nt; - } - if (!sf_getfloat("dz",&dz)) { - /* sampling in depth - (for constant-velocity depth migration) */ - if (depth) sf_error ("Need dz="); - dz = dt*v0; - } - } else { - if (!sf_histint(vel,"n1",&nz)) - sf_error ("No n1= in velocity"); - if (!sf_histfloat(vel,"d1",&dz)) - sf_error ("No d1= in velocity"); - } - sf_putint(out,"n1",nz); - sf_putfloat(out,"d1",dz); - - if (!sf_histint(in,"n2",&nh)) nh=1; - if (!sf_histfloat(in,"d2",&dh)) sf_error ("No d2= in input"); - if (!sf_histfloat(in,"o2",&h0)) h0=0.; - - if (!sf_histint(in,"n3",&nx)) nx=1; - if (!sf_histfloat(in,"d3",&dx)) sf_error ("No d3= in input"); - if (!sf_histfloat(in,"o3",&x0)) x0=0.; - - sf_putint(out,"n2",nx); - sf_putfloat(out,"d2",dx); - sf_putfloat(out,"o2",x0); - - sf_putint(out,"n3",1); - } - - vt = sf_floatalloc2(nz,nx); - v = sf_floatalloc(nz); - - if (NULL == vel) { - for (ix=0; ix < nx; ix++) { - for (iz=0; iz < nz; iz++) { - vt[ix][iz] = v0; - } - } - } else { - sf_floatread(vt[0],nx*nz,vel); - sf_fileclose(vel); - } - for (iz=0; iz < nz; iz++) { - v[iz] = 0.; - for (ix=0; ix < nx; ix++) { - vt[ix][iz] = 1./(vt[ix][iz]*vt[ix][iz]); - v[iz] += vt[ix][iz]; - } - v[iz] /= nx; - } - - /* determine wavenumber sampling (for real to complex FFT) */ - ntfft = nt*2; - nw = ntfft/2+1; - dw = 2.0*SF_PI/(ntfft*dt); - - /* allocate space */ - p = sf_floatalloc(ntfft); - q = sf_floatalloc2(nz,nx); - cp = sf_complexalloc3(nw,nh,nx); - - fft = kiss_fftr_alloc(ntfft,inv? 1: 0,NULL,NULL); - - for (ix=0; ix deriv.rsf - -*/ - -#include - -#include "eno.h" - -int main(int argc, char* argv[]) -{ - int i1, n1, i2, n2, order; - float *trace, f, f1, d1; - eno ent; - sf_file in, der; - - sf_init (argc, argv); - in = sf_input("in"); - der = sf_output("out"); - - if(!sf_histint(in,"n1",&n1)) sf_error ("No n1= in input"); - if(!sf_histfloat(in,"d1",&d1)) d1=1.; - - n2 = sf_leftsize(in,1); - - if(!sf_getint("accuracy",&order)) order=4; - /* Interpolation accuracy order */ - - trace = sf_floatalloc (n1); - ent = eno_init (order, n1); - - for (i2=0; i2 < n2; i2++) { - sf_floatread(trace,n1,in); - - eno_set (ent, trace); - for (i1=0; i1 < n1; i1++) { - eno_apply (ent, i1, 0., &f, &f1, DER); - trace[i1] = f1/d1; - } - - sf_floatwrite(trace,n1,der); - } - - - exit (0); -} - -/* $Id$ */ - diff --git a/user/nobody/Menoint2.c b/user/nobody/Menoint2.c deleted file mode 100644 index 93e010cd38..0000000000 --- a/user/nobody/Menoint2.c +++ /dev/null @@ -1,109 +0,0 @@ -/* ENO interpolation in 2-D slices. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -int main (int argc, char* argv[]) -{ - int id, nk, nd, nm, nt, it, nx, ny, xkey, ykey, interp, i, j; - float *mm, *dd, **xy, *hdr, x0, y0, dx, dy, x, y, dt, t0, f1[2]; - char *xk, *yk; - sf_eno2 ent; - sf_file in, out, head; - - sf_init (argc,argv); - in = sf_input("in"); - out = sf_output("out"); - head = sf_input("head"); - - if (SF_FLOAT != sf_gettype(head)) sf_error("Need float header"); - if (!sf_histint(head,"n1",&nk)) sf_error("No n1= in head"); - if (!sf_histint(head,"n2",&nd)) sf_error("Need n1= in in"); - - /* create coordinates */ - xy = sf_floatalloc2(2,nd); - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - if (!sf_histint(in,"n1",&nx)) sf_error("Need n1= in in"); - if (!sf_histint(in,"n2",&ny)) sf_error("Need n2= in in"); - if (!sf_histint(in,"n3",&nt)) sf_error("Need n3= in in"); - - if (!sf_histfloat(in,"d1",&dx)) dx=1.; - if (!sf_histfloat(in,"d2",&dy)) dy=1.; - if (!sf_histfloat(in,"o1",&x0)) x0=0.; - if (!sf_histfloat(in,"o2",&y0)) y0=0.; - - sf_putint(out,"n1",nd); - sf_putint(out,"n2",nt); - sf_putint(out,"n3",1); - - if (NULL != (xk = sf_getstring("xk"))) { - /* x key name */ - xkey = sf_segykey(xk); - } else if (!sf_getint("xkey",&xkey)) { - /* x key number (if no xk), default is fldr */ - xkey = sf_segykey("fldr"); - } - if (NULL != (yk = sf_getstring("yk"))) { - /* y key name */ - ykey = sf_segykey(yk); - } else if (!sf_getint("ykey",&ykey)) { - /* y key number (if no yk), default is tracf */ - ykey = sf_segykey("tracf"); - } - - if (xkey < 0 || xkey >= nk) - sf_error("xkey=%d is out of the range [0,%d]",xkey,nk-1); - if (ykey < 0 || ykey >= nk) - sf_error("ykey=%d is out of the range [0,%d]",ykey,nk-1); - - hdr = sf_floatalloc(nk); - for (id=0; id - -#include - -#include "envcorr.h" - -int main(int argc, char* argv[]) -{ - int dim, m[SF_MAX_DIM], nd, i, niter, rect[SF_MAX_DIM]; - float **inp, *rat; - char key[6]; - sf_file in, out; - - sf_init (argc, argv); - in = sf_input("in"); - out = sf_output("out"); - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - dim = sf_filedims(in,m); - - nd=1; - for (i=0; i < dim; i++) { - nd *= m[i]; - snprintf(key,6,"rect%d",i+1); - if (!sf_getint(key,rect+i)) rect[i]=1; - } - - if (!sf_getint("niter",&niter)) niter=100; - /* number of iterations */ - - inp = sf_floatalloc2 (m[0],nd/m[0]); - rat = sf_floatalloc (nd); - - envcorr_init(dim,m,rect,niter); - - sf_floatread(inp[0],nd,in); - - envcorr(inp,rat); - - sf_floatwrite(rat,nd,out); - - exit (0); -} - -/* $Id: Mwarpscan.c 744 2004-08-17 18:46:07Z fomels $ */ diff --git a/user/nobody/Merfdm.c b/user/nobody/Merfdm.c deleted file mode 100644 index c5a083a31d..0000000000 --- a/user/nobody/Merfdm.c +++ /dev/null @@ -1,195 +0,0 @@ - -/* - * time-domain acoustic FD modeling - */ - -#include - -int main(int argc, char* argv[]) -{ - - /* I/O files */ - sf_file in,out; - sf_file vel; /* velocity */ - sf_file den; /* density */ - sf_file ref; /* reflectivity */ - - /* I/O arrays */ - float *wvl; - float **vv; - float **dd; - float **rr; - - /* cube axes */ - int nt,nz,nx; - float ot,oz,ox; - float dt,dz,dx; - float idx,idz,dt2; - - /* wavefield arrays */ - float **um, **uo, **up, **ud; - - /* Laplacian coefficients */ - float c0=-30./12.; - float c1=+16./12.; - float c2=- 1./12.; - - /* indices */ - int it,iz,ix; - - /* - * init param I/O - */ - sf_init(argc,argv); - - /* - * setup I/O files - */ - in = sf_input ("in" ); - out = sf_output("out"); - vel = sf_input ("vel"); - den = sf_input ("den"); - ref = sf_input ("ref"); - - /* - * read wavelet params - */ - if(! sf_histint( in,"n1",&nt)) sf_error("No nt in wvl"); - if(! sf_histfloat( in,"d1",&dt)) sf_error("No dt in wvl"); - if(! sf_histfloat( in,"o1",&ot)) sf_error("No ot in wvl"); - dt2=dt*dt; - - /* - * read wavelet - */ - wvl=sf_floatalloc(nt); - sf_floatread(wvl,nt,in); - - /* - * read model params - */ - if(! sf_histint( vel,"n1",&nz)) sf_error("No nz in vel"); - if(! sf_histfloat(vel,"d1",&dz)) sf_error("No dz in vel"); - if(! sf_histfloat(vel,"o1",&oz)) sf_error("No oz in vel"); - if(! sf_histint( vel,"n2",&nx)) sf_error("No nx in vel"); - if(! sf_histfloat(vel,"d2",&dx)) sf_error("No dx in vel"); - if(! sf_histfloat(vel,"o2",&ox)) sf_error("No ox in vel"); - - idx = 1/(dx*dx); - idz = 1/(dz*dz); - - /* - * read velocity, density, reflectivity - */ - vv=sf_floatalloc2(nz,nx); - sf_floatread(vv[0],nz*nx,vel); - - dd=sf_floatalloc2(nz,nx); - sf_floatread(dd[0],nz*nx,den); - - rr=sf_floatalloc2(nz,nx); - sf_floatread(rr[0],nz*nx,ref); - - /* - * setup output header - */ - sf_putint (out,"n1",nz); - sf_putfloat(out,"o1",oz); - sf_putfloat(out,"d1",dz); - sf_putint (out,"n2",nx); - sf_putfloat(out,"o2",ox); - sf_putfloat(out,"d2",dx); - sf_putint (out,"n3",nt); - sf_putfloat(out,"o3",ot); - sf_putfloat(out,"d3",dt); - - /* - * allocate temporary arrays - */ - up=sf_floatalloc2(nz,nx); - uo=sf_floatalloc2(nz,nx); - um=sf_floatalloc2(nz,nx); - ud=sf_floatalloc2(nz,nx); - - for (iz=0; iz - -int main (int argc, char **argv) -{ - int nt, nx, n3; /* dimensions */ - int ik,ix,it,i3; /* loop counters */ - int nxfft; /* fft size */ - int nk; /* number of wavenumbers */ - int nw; /* number of frequencies */ - - float dx; /* space sampling interval */ - float dk; /* wavenumber sampling interval */ - float dt; /* time sampling interval */ - float dw; /* frequency sampling interval */ - float w0; /* starting frequency */ - float t0; /* starting time */ - float x0; /* staring space */ - float k0=0.; /* starting wavenumber */ - - float **p; /* time-space */ - float complex **cp; /* frequency-wavenumber */ - float complex *cq; /* frequency */ - - bool inv; /* forward or inverse */ - bool both; /* both coordinates or second only */ - - sf_file in, out; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_getbool("inv",&inv)) inv = false; - /* if y, perform inverse transform */ - if (!sf_getbool("both",&both)) both = false; - /* if y, transform both axes */ - - n3 = sf_leftsize(in,2); - - if (inv) { - if (!sf_histint(in,"n1",&nw)) sf_error ("No n1 in input"); - if (!sf_histfloat(in,"d1",&dw)) sf_error ("No d1 in input"); - if (!sf_histint(in,"n2",&nk)) sf_error ("No n2 in input"); - if (!sf_histfloat(in,"d2",&dk)) sf_error ("No d2 in input"); - - if (!sf_histint(in,"nx",&nx)) sf_error ("No nx in input"); - if (!sf_histfloat(in,"x0",&x0)) x0 = 0.; - - if (both) { - if (!sf_histint(in,"nt",&nt)) sf_error ("No nt in input"); - if (!sf_histfloat(in,"t0",&t0)) t0 = 0.; - - dt = 1./(nw*dw); - - sf_putint(out,"n1",nt); - sf_putfloat(out,"d1",dt); - sf_putfloat(out,"o1",t0); - } else { - nt = nw; - } - - nxfft = 2*(nk-1); - dx = 1./(nxfft*dk); - - sf_putint(out,"n2",nx); - sf_putfloat(out,"d2",dx); - sf_putfloat(out,"o2",x0); - - if (SF_COMPLEX != sf_gettype(in)) sf_error("Need complex input"); - sf_settype(out,SF_FLOAT); - } else { - if (!sf_histint(in,"n1",&nt)) sf_error ("No n1 in input"); - if (!sf_histfloat(in,"d1",&dt)) sf_error ("No d1 in input"); - if (!sf_histfloat(in,"o1",&t0)) t0 = 0.; - if (!sf_histint(in,"n2",&nx)) sf_error ("No n2 in input"); - if (!sf_histfloat(in,"d2",&dx)) sf_error ("No d2 in input"); - if (!sf_histfloat(in,"o2",&x0)) x0 = 0.; - - if (both) { - sf_putint (out,"nt",nt); - sf_putfloat (out,"t0",t0); - - /* determine frequency sampling */ - nw = sf_npfa(nt); - dw = 1./(nw*dt); - w0 = -0.5/dt; - - sf_putint(out,"n1",nw); - sf_putfloat(out,"d1",dw); - sf_putfloat(out,"o1",w0); - } else { - nw = nt; - } - - sf_putint(out,"nx",nx); - sf_putfloat(out,"x0",x0); - - /* determine wavenumber sampling (for real to complex FFT) */ - nxfft = nx*2; - nxfft = sf_npfaro(nxfft,2*nxfft); - nk = nxfft/2+1; - dk = 1./(nxfft*dx); - - sf_putint(out,"n2",nk); - sf_putfloat(out,"d2",dk); - sf_putfloat(out,"o2",k0); - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - sf_settype(out,SF_COMPLEX); - } - - p = sf_floatalloc2(nt,nxfft); - cp = sf_complexalloc2(nt,nk); - cq = sf_complexalloc(nw); - - for (i3=0; i3 - -#include "fint1.h" - -int main(int argc, char* argv[]) -{ - int nd, n1, i1, n2, i2, ix; - float x, o1, d1, *table1=NULL, *trace, x0, dx; - fint1 fnt; - sf_file in, out, pattern; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - - if (!sf_histint(in,"n1",&nd)) sf_error("Need n1= in input"); - - if (!sf_histfloat(in,"d1",&dx)) sf_error("Need d1= in input"); - if (!sf_histfloat(in,"o1",&x0)) sf_error("Need o1= in input"); - n2 = sf_leftsize(in,1); - - if (NULL != sf_getstring("pattern")) { - pattern = sf_input("pattern"); - } else { - pattern = NULL; - } - - if (!sf_getint("n1",&n1) && - (NULL== pattern || - !sf_histint(pattern,"n1",&n1))) sf_error("Need n1="); - /* Output grid size */ - if (!sf_getfloat("d1",&d1) && - (NULL== pattern || - !sf_histfloat(pattern,"d1",&d1))) sf_error("Need d1="); - /* Output sampling */ - if (!sf_getfloat("o1",&o1) && - (NULL== pattern || - !sf_histfloat(pattern,"o1",&o1))) sf_error("Need o1="); - /* Output origin */ - - sf_putint(out,"n1",n1); - sf_putfloat(out,"o1",o1); - sf_putfloat(out,"d1",d1); - - trace = sf_floatalloc(n1); - table1 = sf_floatalloc(nd); - - fnt = fint1_init (4,nd); - - for (i2=0; i2 < n2; i2++) { - sf_floatread(table1,nd,in); - fint1_set(fnt,table1); - - for (i1=0; i1 < n1; i1++) { - x = ((o1 + i1*d1)-x0)/dx; - ix = x; - trace[i1] = fint1_apply(fnt,ix,x-ix,false); - } - - sf_floatwrite(trace,n1,out); - } - - exit(0); -} - -/* $Id$ */ diff --git a/user/nobody/Mfkamopaco.c b/user/nobody/Mfkamopaco.c deleted file mode 100644 index 263b9f7d9d..0000000000 --- a/user/nobody/Mfkamopaco.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Azimuth moveout by log-stretch F-K operator. -*/ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include - -#include - -int main(int argc, char* argv[]) -{ - int nw, nx, ny, iw, ix, iy; - float complex *oper; - float dw,dx,dy, ow,ox,oy, w,x,y, x1,x2, h1,h2,f1,f2, maxe; - float eps1,eps2,amp1,amp2,phase1,phase2,amp; - sf_file in, out; - - sf_init (argc,argv); - in = sf_input ( "in"); - out = sf_output("out"); - - if (SF_COMPLEX != sf_gettype(in)) sf_error("Need complex input"); - if (!sf_histint(in,"n1",&nw)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&nx)) sf_error("No n2= in input"); - if (!sf_histint(in,"n3",&ny)) sf_error("No n3= in input"); - - if (!sf_histfloat (in,"o1",&ow)) sf_error("No o1= in input"); - if (!sf_histfloat (in,"d1",&dw)) sf_error("No d1= in input"); - if (!sf_histfloat (in,"o2",&ox)) sf_error("No o2= in input"); - if (!sf_histfloat (in,"d2",&dx)) sf_error("No d2= in input"); - if (!sf_histfloat (in,"o3",&oy)) sf_error("No o3= in input"); - if (!sf_histfloat (in,"d3",&dy)) sf_error("No d3= in input"); - - if (!sf_getfloat("h1",&h1)) sf_error("Need h1="); - /* input offset */ - if (!sf_getfloat("h2",&h2)) sf_error("Need h2="); - /* output offset */ - if (!sf_getfloat("f1",&f1)) sf_error("Need f1="); - /* input azimuth in degrees */ - if (!sf_getfloat("f2",&f2)) sf_error("Need f2="); - /* output azimuth in degrees */ - - if (!sf_getfloat("maxe",&maxe)) maxe=10.; - /* stability constraint */ - - f1 *= SF_PI/180.; - f2 *= SF_PI/180.; - - oper = sf_complexalloc (nw); - - for (iy=0; iy < ny; iy++) { - y = oy + iy*dy; - for (ix=0; ix < nx; ix++) { - x = ox + ix*dx; - x1 = x*cosf(f1) + y*sinf(f1); - x2 = x*cosf(f2) + y*sinf(f2); - for (iw=0; iw < nw; iw++) { - w = ow + iw*dw; - if (fabsf (w) > FLT_EPSILON) { - eps1 = 2.*fabsf(x1*h1/w); - eps2 = 2.*fabsf(x2*h2/w); - if (eps1 <= maxe && eps2 <= maxe) { - eps1 = hypotf (1.,eps1); - eps2 = hypotf (1.,eps2); - - amp1 = 1./eps1+eps1; - amp2 = 1./eps2+eps2; - phase1 = 1-eps1+logf(0.5*(1.+eps1)); - phase2 = 1-eps2+logf(0.5*(1.+eps2)); - - amp = expf(0.5*(eps1-logf(amp1)+logf(amp2)-eps2)); - oper[iw] = amp*cexpf(I*SF_PI*(phase2-phase1)*w); - } else { - oper[iw] = 0.; - } - } else { - oper[iw] = 0.; - } - } - sf_complexwrite (oper,nw,out); - } - } - - exit (0); -} - -/* $Id: Mfkamo.c 691 2004-07-04 19:28:08Z fomels $ */ diff --git a/user/nobody/Mflat.c b/user/nobody/Mflat.c deleted file mode 100644 index 1dad573c8e..0000000000 --- a/user/nobody/Mflat.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Moveout flattening. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include "predict.h" - -int main (int argc, char *argv[]) -{ - bool verb; - int n1,n2,n3, i3, i0, order; - float eps, **u, **p, **v; - sf_file in, out, dip; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - dip = sf_input("dip"); - - if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input"); - n3 = sf_leftsize(in,2); - - if (!sf_getbool("verb",&verb)) verb=false; - if (!sf_getfloat("eps",&eps)) eps=0.01; - /* regularization */ - - if (!sf_getint("i0",&i0)) i0=0; - /* reference trace */ - - if (!sf_getint("order",&order)) order=1; - /* accuracy order */ - - predict_init (n1, n2, eps*eps, order, 1); - - u = sf_floatalloc2(n1,n2); - p = sf_floatalloc2(n1,n2); - v = sf_floatalloc2(n1,n2); - - for (i3=0; i3 < n3; i3++) { - if (verb) fprintf(stderr,"cmp %d of %d\n",i3+1,n3); - - sf_floatread(u[0],n1*n2,in); - sf_floatread(p[0],n1*n2,dip); - - predict_flat(i0, u, v, p); - - sf_floatwrite(v[0],n1*n2,out); - } - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mflat3.c b/user/nobody/Mflat3.c deleted file mode 100644 index 678422c4a2..0000000000 --- a/user/nobody/Mflat3.c +++ /dev/null @@ -1,115 +0,0 @@ -/* 3-D flattening (without picking). */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include - -#include "predict.h" -#include "dijkstra.h" - -int main (int argc, char *argv[]) -{ - bool verb; - int n1,n2,n3, n12, ref2, ref3, i2,i3,i1, ud, lr, j3, j2; - float eps, *trace, ***p, ***q, **p2, **q2, pi, qi; - sf_file in, out, idip, xdip; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - idip = sf_input("idip"); - xdip = sf_input("xdip"); - - if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input"); - if (!sf_histint(in,"n3",&n3)) sf_error("No n3= in input"); - n12 = n1*n2*n3; - - if (!sf_getbool("verb",&verb)) verb=false; - if (!sf_getfloat("eps",&eps)) eps=0.01; - /* regularization */ - - if (!sf_getint("ref2",&ref2)) ref2=0; - if (!sf_getint("ref3",&ref3)) ref3=0; - /* reference trace */ - - p = sf_floatalloc3(n1,n2,n3); - q = sf_floatalloc3(n1,n2,n3); - - sf_floatread(p[0][0],n12,idip); - sf_floatread(q[0][0],n12,xdip); - - p2 = sf_floatalloc2(n2,n3); - q2 = sf_floatalloc2(n2,n3); - - for (i3=0; i3 < n3; i3++) { - for (i2=0; i2 < n2; i2++) { - pi = 0.; - qi = 0.; - for (i1=0; i1 < n1; i1++) { - pi += p[i3][i2][i1]*p[i3][i2][i1]; - qi += q[i3][i2][i1]*q[i3][i2][i1]; - } - p2[i3][i2] = sqrtf(pi/n1); - q2[i3][i2] = sqrtf(qi/n1); - } - } - - dijkstra_init(n2,n3); - dijkstra(ref2,ref3,p2,q2); - - trace = sf_floatalloc(n1); - predict_init(n1,n2,eps,1); - - for (i3=0; i3 < n3; i3++) { - for (i2=0; i2 < n2; i2++) { - sf_floatread(trace,n1,in); - dijkstra_start(i2,i3); - j2 = i2; - j3 = i3; - if (verb) sf_warning("start with %d,%d",j2,j3); - while (dijkstra_next(&ud,&lr)) { - if (0==lr) { - if (ud > 0) { - j2 -= ud; - predict_step(false,false,trace,p[j3][j2]); - } else { - predict_step(false,true,trace,p[j3][j2]); - j2 -= ud; - } - } else if (0==ud) { - if (lr > 0) { - j3 -= lr; - predict_step(false,false,trace,q[j3][j2]); - } else { - predict_step(false,true,trace,q[j3][j2]); - j3 -= lr; - } - } - - if (verb) sf_warning("then %d,%d",j2,j3); - } - sf_floatwrite(trace,n1,out); - } - } - - exit (0); -} - -/* $Id: Mflat.c 743 2004-08-16 20:41:00Z fomels $ */ diff --git a/user/nobody/Mfourvcd.c b/user/nobody/Mfourvcd.c deleted file mode 100644 index 4053e8b109..0000000000 --- a/user/nobody/Mfourvcd.c +++ /dev/null @@ -1,195 +0,0 @@ -/* Velocity continuation with differential semblance computation. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -#include "fint1.h" -#include "cosft.h" - -int main(int argc, char* argv[]) -{ - fint1 str, istr; - int i1,i2, n1,n2,n3, ix,iv,ih, nx,nv,nh, nw, next; - float d1,o1,d2,o2, eps, w,x,k, v0,v2,v,v1,dv, dx, h0,dh,h, t, t2; - float *trace, *strace, ***prev, ***semb, ***cont, **image; - float complex *ctrace, *ctrace0; - static kiss_fftr_cfg forw, invs; - sf_file in, out; - - sf_init (argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&nx)) sf_error("No n2= in input"); - if (!sf_histint(in,"n3",&nh)) sf_error("No n3= in input"); - - if (!sf_getfloat("eps",&eps)) eps=0.01; - if (!sf_getint("pad",&n2)) n2=n1; - if (!sf_getint("pad2",&n3)) n3=n2; - - if (n3%2) n3++; - nw = n3/2+1; - forw = kiss_fftr_alloc(n3,0,NULL,NULL); - invs = kiss_fftr_alloc(n3,1,NULL,NULL); - if (NULL == forw || NULL == invs) - sf_error("KISS FFT allocation error"); - - if (!sf_histfloat(in,"o1",&o1)) o1=0.; - o2 = o1*o1; - - if(!sf_histfloat(in,"d1",&d1)) sf_error("No d1= in input"); - d2 = o1+(n1-1)*d1; - d2 = (d2*d2 - o2)/(n2-1); - - if (!sf_getint("nv",&nv)) sf_error("Need nv="); - if (!sf_getfloat("dv",&dv)) sf_error("Need dv="); - if (!sf_getfloat("v0",&v0) && - !sf_histfloat(in,"v0",&v0)) sf_error("Need v0="); - - if(!sf_histfloat(in,"o3",&h0)) sf_error("No o2= in input"); - if(!sf_histfloat(in,"d3",&dh)) sf_error("No d2= in input"); - if(!sf_histfloat(in,"d2",&dx)) sf_error("No d3= in input"); - - sf_putfloat(out,"o3",v0+dv); - sf_putfloat(out,"d3",dv); - sf_putint(out,"n3",nv); - - sf_putstring(out,"label3","Velocity (km/s)"); - - dx = 2.*SF_PI/(2*(nx-1)*dx); - - prev = sf_floatalloc3(n1,nx,nv); - semb = sf_floatalloc3(n1,nx,nv); - cont = sf_floatalloc3(n1,nx,nv); - image = sf_floatalloc2(n1,nx); - trace = sf_floatalloc(n1); - strace = sf_floatalloc(n3); - ctrace = sf_complexalloc(nw); - ctrace0 = sf_complexalloc(nw); - - if (!sf_getint("extend",&next)) next=4; - /* trace extension */ - str = fint1_init(next,n1,0); - istr = fint1_init(next,n2,0); - - for (i1=0; i1 < n1*nx*nv; i1++) { - semb[0][0][i1] = 0.; - } - - cosft_init(nx); - - for (ih=0; ih < nh; ih++) { - sf_warning("offset %d of %d",ih+1,nh); - - h = h0 + ih*dh; - h *= h; - - sf_floatread(image[0],n1*nx,in); - - for (i1=0; i1 < n1; i1++) { - cosft_frw(image[0],i1,n1); - } - - for (ix=0; ix < nx; ix++) { - x = ix*dx; - x *= x; - - k = x * 0.25 * 0.25 * 0.5; - - fint1_set(str,image[ix]); - - for (i2=0; i2 < n2; i2++) { - t = o2+i2*d2; - t = sqrtf(t); - t = (t-o1)/d1; - i1 = t; - if (i1 >= 0 && i1 < n1) { - strace[i2] = fint1_apply(str,i1,t-i1,false); - } else { - strace[i2] = 0.; - } - } - - for (i2=n2; i2 < n3; i2++) { - strace[i2] = 0.; - } - - kiss_fftr(forw,strace, (kiss_fft_cpx *) ctrace0); - - for (iv=0; iv < nv; iv++) { - v = v0 + (iv+1)* dv; - - v1 = h * (1./(v*v) - 1./(v0*v0)) * 8.; - v2 = k * ((v0*v0) - (v*v)); - - ctrace[0]=0.; /* dc */ - - for (i2=1; i2 < nw; i2++) { - w = i2*SF_PI/(d2*n3); - - ctrace[i2] = ctrace0[i2] * cexpf(I*(v2/w+(v1-o2)*w)); - } /* w */ - - kiss_fftri(invs,(const kiss_fft_cpx *) ctrace, strace); - - fint1_set(istr,strace); - - for (i1=0; i1 < n1; i1++) { - t = o1+i1*d1; - t = t*t; - t = (t-o2)/d2; - i2 = t; - if (i2 >= 0 && i2 < n2) { - cont[iv][ix][i1] = fint1_apply(istr,i2,t-i2,false); - } else { - cont[iv][ix][i1] = 0.; - } - } - } /* v */ - } /* x */ - - for (iv=0; iv < nv; iv++) { - for (i1=0; i1 < n1; i1++) { - cosft_inv(cont[0][0],i1+iv*nx*n1,n1); - } - } - - for (iv=0; iv < nv; iv++) { - for (ix=0; ix < nx; ix++) { - for (i1=0; i1 < n1; i1++) { - t = cont[iv][ix][i1]; - if (ih > 0) { - t2 = prev[iv][ix][i1]-t; - semb[iv][ix][i1] += t2*t2; - } - prev[iv][ix][i1] = t; - } /* i1 */ - } /* x */ - } /* v */ - } /* h */ - - sf_floatwrite (semb[0][0],n1*nx*nv,out); - - exit(0); -} - -/* $Id: Mfourvc2.c 702 2004-07-11 23:06:26Z fomels $ */ diff --git a/user/nobody/Mfreqintpef.c b/user/nobody/Mfreqintpef.c deleted file mode 100644 index d21f061bd4..0000000000 --- a/user/nobody/Mfreqintpef.c +++ /dev/null @@ -1,133 +0,0 @@ -/* 1-D data regularization using freqlet transform and PEF frequencies*/ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "freqintpef.h" -#include "freqlets.h" -#include "cweight.h" - -int main(int argc, char *argv[]) -{ - int nd, i1, n1, i2, n2, nw, n1w, niter, i, ncycle; - float *w0, d1, o1, *ww, *crd; - char *type; - sf_complex *pp, *qq, *mm, *z0; - sf_file in, out, w, coord; - - sf_init(argc,argv); - - in = sf_input("in"); - out = sf_output("out"); - w = sf_input("freq"); - coord = sf_input("coord"); - - if (SF_COMPLEX != sf_gettype(in)) sf_error("Need complex input"); - - /* get data size */ - if (!sf_histint(in,"n1",&nd)) sf_error("No n1= in input"); - n2 = sf_leftsize(in,1); - - /* specify model size */ - if (!sf_getint("n1",&n1)) sf_error("Need n1="); - /* output samples */ - if (!sf_getfloat("d1",&d1)) sf_error("Need d1="); - /* output sampling */ - if (!sf_getfloat("o1",&o1)) sf_error("Need o1="); - /* output origin */ - - sf_putint(out,"n1",n1); - sf_putfloat(out,"d1",d1); - sf_putfloat(out,"o1",o1); - - if (!sf_histint(w,"n1",&nw)) sf_error("No n1= in freq"); - - if (SF_FLOAT == sf_gettype(w)) { - w0 = sf_floatalloc(nw); - z0 = NULL; - } else if (SF_COMPLEX == sf_gettype(w)) { - w0 = NULL; - z0 = sf_complexalloc(nw); - } else { - sf_error("Need float or complex type in freq"); - w0 = NULL; - z0 = NULL; - } - n1w = n1*nw; - - if (!sf_getint("niter",&niter)) niter=10; - /* number of iterations for inversion */ - - if (!sf_getint("ncycle",&ncycle)) ncycle=1; - /* number of IRLS iterations */ - - pp = sf_complexalloc(nd); - crd = sf_floatalloc(nd); - qq = sf_complexalloc(n1w); - mm = sf_complexalloc(n1); - - if (ncycle > 0) { - ww = sf_floatalloc(n1w); - cweight_init(ww); - } else { - ww = NULL; - } - - if (NULL == (type=sf_getstring("type"))) type="bior"; - /* [haar,linear,biorthogonal] wavelet type, the default is biorthogonal */ - - sf_floatread(crd,nd,coord); - - freqint_init(nd,crd,n1,d1,o1,sf_lin_int,2,true,true,type[0],nw,w0,z0); - - /* loop over traces */ - for (i2=0; i2 < n2; i2++) { - /* read frequencies */ - if (NULL != w0) { - sf_floatread(w0,nw,w); - } else { - sf_complexread(z0,nw,w); - } - - /* read data */ - sf_complexread(pp,nd,in); - - /* apply adjoint */ - freqint_lop(true,false,n1w,nd,qq,pp); - - /* do inversion if ncycle > 0 */ - for (i=0; i < ncycle; i++) { - /* weight by absolute value */ - for (i1=0; i1 < n1w; i1++) { - ww[i1] = cabsf(qq[i1]); - } - - /* sparse inverse */ - sf_csolver_prec (freqint_lop,sf_ccgstep,cweight_lop,n1w, - n1w,nd,qq,pp,niter,0.,"verb",true,"end"); - sf_ccgstep_close(); - } - - /* reconstruct regular data */ - freqlets_lop(false,false,n1w,n1,qq,mm); - sf_complexwrite(mm,n1,out); - } - - exit(0); -} diff --git a/user/nobody/Mfreqlet97.c b/user/nobody/Mfreqlet97.c deleted file mode 100644 index 1bffd139ff..0000000000 --- a/user/nobody/Mfreqlet97.c +++ /dev/null @@ -1,109 +0,0 @@ -/* 1-D 9/7 freqlet transform */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "freqlet97.h" - -int main(int argc, char *argv[]) -{ - int i1, n1, i2, n2, iw, nw; - bool inv, adj; - float *w0, d1; - sf_complex *pp, *qq; - sf_file in, out, w; - - sf_init(argc,argv); - - in = sf_input("in"); - out = sf_output("out"); - w = sf_input("freq"); - - if (SF_COMPLEX != sf_gettype(in)) sf_error("Need complex input"); - if (SF_FLOAT != sf_gettype(w)) sf_error("Need float freq"); - - if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input"); - - if (!sf_histint(w,"n1",&nw)) sf_error("No n1= in freq"); - w0 = sf_floatalloc(nw); - - if (!sf_getbool("inv",&inv)) inv=false; - /* if y, do inverse transform */ - - if (!sf_getbool("adj",&adj)) adj=false; - /* if y, do adjoint transform */ - - if (adj) { - n2 = sf_leftsize(in,2); - sf_unshiftdim(in, out, 2); - } else { - n2 = sf_leftsize(in,1); - sf_putint(out,"n2",nw); - (void) sf_shiftdim(in, out, 2); - } - - pp = sf_complexalloc(n1); - qq = sf_complexalloc(n1); - - if (!sf_histfloat(in,"d1",&d1)) d1=1.; - /* sampling in the input file */ - - freqlet97_init(n1,inv); - - /* loop over traces */ - for (i2=0; i2 < n2; i2++) { - sf_floatread(w0,nw,w); - - if (adj) { - for (i1=0; i1 < n1; i1++) { - pp[i1] = sf_cmplx(0.,0.); - } - } else { - sf_complexread(pp,n1,in); - } - - /* loop over frequencies */ - for (iw=0; iw < nw; iw++) { - freqlet97_set(w0[iw]* 2*SF_PI*d1); - - if (adj) { - sf_complexread(qq,n1,in); - freqlet97_lop(true,true,n1,n1,pp,qq); - } else { - freqlet97_lop(false,false,n1,n1,pp,qq); - sf_complexwrite(qq,n1,out); - } - } - - if (adj) { - if (inv) { - for (i1=0; i1 < n1; i1++) { -#ifdef SF_HAS_COMPLEX_H - pp[i1] /= nw; -#else - pp[i1] = sf_crmul(pp[i1],1.0f/nw); -#endif - } - } - sf_complexwrite(pp,n1,out); - } - } - - exit(0); -} diff --git a/user/nobody/Mgauss.c b/user/nobody/Mgauss.c deleted file mode 100644 index 02face09df..0000000000 --- a/user/nobody/Mgauss.c +++ /dev/null @@ -1,71 +0,0 @@ -/* Add a Gaussian anomaly to the data. - -The anomaly added is a*exp(-((x1-c1)^2+(x2-c2)^2)/r^2). -*/ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -int main(int argc, char** argv) -{ - int n1, n2, i1, i2; - float* vint, o1, d1, o2, d2, a, r, c1, c2, x1, x2; - sf_file in, out; - - sf_init (argc, argv); - in = sf_input("in"); - out = sf_output("out"); - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - if (!sf_histint (in,"n1",&n1)) sf_error ("No n1 in input"); - if (!sf_histint (in,"n2",&n2)) sf_error ("No n2 in input"); - - if (!sf_histfloat (in,"o1",&o1)) sf_error ("No o1 in input"); - if (!sf_histfloat (in,"d1",&d1)) sf_error ("No d1 in input"); - if (!sf_histfloat (in,"o2",&o2)) sf_error ("No o2 in input"); - if (!sf_histfloat (in,"d2",&d2)) sf_error ("No d2 in input"); - - if (!sf_getfloat ("a",&a)) a = 1.; - /* Amplitude of the anomaly */ - if (!sf_getfloat ("r",&r)) r = 25.; - /* Radius of the anomaly */ - r = 1./(r*r); - if (!sf_getfloat ("c1",&c1)) c1 = o1+0.5*(n1-1)*d1; - if (!sf_getfloat ("c2",&c2)) c2 = o2+0.5*(n2-1)*d2; - /* Anomaly center coordinates */ - - vint = sf_floatalloc(n1); - for (i2=0; i2 < n2; i2++) { - x2 = o2+i2*d2 - c2; - x2 *= x2; - sf_floatread (vint,n1,in); - for (i1=0; i1 < n1; i1++) { - x1 = o1+i1*d1 - c1; - x1 = (x1*x1 + x2)*r; - vint[i1] += a * exp(-x1); - } - sf_floatwrite (vint,n1,out); - } - - exit (0); -} - -/* $Id: Mgauss.c 691 2004-07-04 19:28:08Z fomels $ */ diff --git a/user/nobody/Mgazdagz.c b/user/nobody/Mgazdagz.c deleted file mode 100644 index bc9e472a30..0000000000 --- a/user/nobody/Mgazdagz.c +++ /dev/null @@ -1,178 +0,0 @@ -/* Post-stack 2-D v(z) time modeling/migration with curved-ray phase-shift. - -Takes: < input.rsf > output.rsf -*/ - -#include - -#include "gazdagz.h" - -int main (int argc, char *argv[]) -{ - int nt; /* number of time samples */ - int nz; /* number of migrated time samples */ - int nx; /* number of midpoints */ - int ik,ix,it,iz; /* loop counters */ - int nxfft; /* fft size */ - int nk; /* number of wave numbers */ - - float dt; /* time sampling interval */ - float dz; /* migrated time sampling interval */ - float dk; /* wave number sampling interval */ - float k2; /* wave number squared */ - float dx; /* spatial sampling interval */ - float *vt, v0; /* velocity v(t) */ - float **p,**q; /* input, output data */ - - float complex **cp,**cq; /* complex input,output */ - - bool inv; /* modeling or migration */ - bool depth; /* time or depth migration */ - bool midpoint; /* use midpoint rule */ - float eps; /* dip filter constant */ - - sf_file in, out, vel; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_getbool("inv",&inv)) inv = false; - /* If y, modeling; if n, migration */ - if (!sf_getfloat("eps",&eps)) eps = 0.01; - /* Stabilization parameter */ - - if (!sf_histint(in,"n2",&nx)) nx = 1; - if (!sf_histfloat(in,"d2",&dx)) - sf_error ("No d2= in input"); - - if (inv) { /* modeling */ - if (!sf_histint(in,"n1",&nz)) sf_error ("No n1= in input"); - if (!sf_histfloat(in,"d1",&dz)) sf_error ("No d1= in input"); - - if (!sf_getint("nt",&nt)) sf_error ("nt= must be supplied"); - /* Length of time axis (for modeling) */ - if (!sf_getfloat("dt",&dt)) sf_error ("dt= must be supplied"); - /* Sampling of time axis (for modeling) */ - - sf_putint(out,"n1",nt); - sf_putfloat(out,"d1",dt); - } else { /* migration */ - if (!sf_histint(in,"n1",&nt)) sf_error ("No n1= in input"); - if (!sf_histfloat(in,"d1",&dt)) sf_error ("No d1= in input"); - if (NULL == sf_getstring("velocity")) { - if (!sf_getint("nz",&nz)) nz = nt; - /* Length of depth axis (for migration, if no velocity file) */ - if (!sf_getfloat("dz",&dz)) dz = dt; - /* Sampling of depth axis (for migration, if no velocity file) */ - } else { - vel = sf_input("velocity"); - if (!sf_histint(vel,"n1",&nz)) - sf_error ("No n1= in velocity"); - if (!sf_histfloat(vel,"d1",&dz)) - sf_error ("No d1= in velocity"); - } - sf_putint(out,"n1",nz); - sf_putfloat(out,"d1",dz); - } - - vt = sf_floatalloc(nz); - if (NULL == sf_getstring("velocity")) { - /* file with velocity */ - if (!sf_getfloat("vel",&v0)) sf_error ("vel= must be supplied"); - /* Constant velocity (if no velocity file) */ - for (iz=0; iz < nz; iz++) { - vt[iz] = v0; - } - } else { - vel = sf_input("velocity"); - sf_floatread(vt,nz,vel); - sf_fileclose(vel); - } - - if (!sf_getbool("depth",&depth)) depth = false; - /* if true, depth migration */ - - if (!sf_getbool("midpoint",&midpoint)) midpoint = false; - /* if true, use midpoint rule */ - - /* vt -> 1/4 vt^2 */ - for (iz=0; iz < nz; iz++) { - vt[iz] *= 0.25*vt[iz]; - if (depth) vt[iz] = 1./vt[iz]; - } - - - /* determine wavenumber sampling (for real to complex FFT) */ - nxfft = sf_npfar(nx); - nk = nxfft/2+1; - dk = 2.0*SF_PI/(nxfft*dx); - - /* allocate space */ - p = sf_floatalloc2(nt,nxfft); - q = sf_floatalloc2(nz,nxfft); - cp = sf_complexalloc2(nt,nk); - cq = sf_complexalloc2(nz,nk); - - if (inv) { - sf_floatread(q[0],nz*nx,in); - - /* pad with zeros and Fourier transform x to k */ - for (ix=nx; ix - -#include - -int main (int argc, char* argv[]) -{ - int it, nt,nx,nz, ix,iz, iw, nw; - float a, dz, z, dw, w0, w1, w2, w, sx, sz, dx; - float *tx, *px, *zx, *trace2; - sf_complex *trace1, c, shift; - sf_file in, out, place, depth, wave; - - sf_init (argc,argv); - in = sf_input("in"); - place = sf_input("place"); - depth = sf_input("depth"); - out = sf_output("out"); - wave = sf_input("wave"); - - if (SF_COMPLEX != sf_gettype(wave)) sf_error("Need complex wave"); - if (!sf_histint(wave,"n1",&nw)) sf_error("No n1= in wave"); - if (!sf_histfloat(wave,"d1",&dw)) sf_error("No d1= in wave"); - if (!sf_histfloat(wave,"o1",&w0)) sf_error("No o1= in wave"); - if (!sf_getfloat("w1",&w1)) w1=w0; - /* lowest frequency */ - if (!sf_getfloat("w2",&w2)) w2=w0+(nw-1)*dw; - /* highest frequency */ - - if (!sf_histint(in,"n1",&nt)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&nx)) sf_error("No n2= in input"); - if (!sf_histint(in,"n3",&nz)) sf_error("No n3= in input"); - - trace1 = sf_complexalloc(nw); - trace2 = sf_floatalloc(nx); - - sf_complexread(trace1,nw,wave); - - if (!sf_getfloat("dx",&dx)) sf_error("Need dx= "); - /* location error */ - - if (!sf_histfloat(in,"d3",&dz)) sf_error("No d3= in input"); - dz *= (0.5*nz); - - if (!sf_getfloat ("sx",&sx)) sx=0.; - /* source x position */ - if (!sf_getfloat ("sz",&sz)) sz=0.; - /* source z position */ - if (!sf_getfloat ("z",&z)) z=0.5; - /* depth */ - - sf_putint(out,"n1",1); - - /* - sf_putfloat(out,"d1",dw); - sf_putfloat(out,"o1",w0); - sf_settype(out,SF_COMPLEX); - */ - - tx = sf_floatalloc(nt); - px = sf_floatalloc(nt); - zx = sf_floatalloc(nt); - - for (iz=0; iz w2) continue; - - c = trace1[iw]; -#ifdef SF_HAS_COMPLEX_H - if (fabsf(w) < dw) c *= 2.; -#else - if (fabsf(w) < dw) c = sf_crmul(c,2.); -#endif - - w *= SF_PI; /* 2.*SF_PI */ - - for (it = 0; it < nt; it++) { - if (zx[it] > sz+dz || zx[it] < sz-dz) continue; - - a = fabsf(px[it]-sx); - if (a < dx) { - shift = sf_cmplx(cosf(w*tx[it]),-sinf(w*tx[it])); -#ifdef SF_HAS_COMPLEX_H - trace2[ix] += crealf((1.-a/dx)*c*shift); -#else - trace2[ix] += crealf(sf_cmul(c, - sf_crmul(shift,1.-a/dx))); -#endif - } - } /* nt */ - } /* nw */ - } /* nx */ - sf_floatwrite (trace2,nx,out); - } /* nz */ - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mhale.c b/user/nobody/Mhale.c deleted file mode 100644 index 540de395fd..0000000000 --- a/user/nobody/Mhale.c +++ /dev/null @@ -1,84 +0,0 @@ -/* 2-D synthetic model for multiple-arrival generation. - -From Dave Hale. -*/ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -int main(int argc, char* argv[]) -{ - int nz, nx, ix, iz; - float *trace, x0, z0, x, z, dx, dz, v0, g, v, a, d; - sf_file mod; - - sf_init (argc,argv); - mod = sf_output("out"); - - if (!sf_getint("nz",&nz)) nz=601; - /* vertical dimension */ - if (!sf_getint("nx",&nx)) nx=401; - /* horizontal dimension */ - - dz = 4./(nz-1); - dx = 6./(nx-1); - - sf_putint (mod,"n1",nz); - sf_putfloat (mod,"d1",dz); - sf_putfloat (mod,"o1",0.); - sf_putint (mod,"n2",nx); - sf_putfloat (mod,"d2",dx); - sf_putfloat (mod,"o2",0.); - sf_setformat (mod,"native_float"); - - if(!sf_getfloat ("x0",&x0)) x0=4.; - /* anomaly center in x */ - if(!sf_getfloat ("z0",&z0)) z0=1.5; - /* anomaly center in z */ - if(!sf_getfloat ("v0",&v0)) v0=1.5; - /* surface velocity */ - if(!sf_getfloat ("g",&g)) g=0.6; - /* velocity gradient */ - if(!sf_getfloat ("a",&a)) a=1.; - /* anomaly magnitude */ - if(!sf_getfloat ("d",&d)) d=1.; - /* anomaly radius */ - d *= d; - - trace = sf_floatalloc(nz); - - for (ix=0; ix < nx; ix++) { - x = ix*dx - x0; - x *= x; - for (iz=0; iz < nz; iz++) { - z = iz*dz; - v = v0 + g*z; - z = z - z0; - z = z*z + x; - trace[iz] = v + a*exp(-z/d); - } - sf_floatwrite (trace,nz,mod); - } - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mhdtrace.c b/user/nobody/Mhdtrace.c deleted file mode 100644 index f5a9fa63a5..0000000000 --- a/user/nobody/Mhdtrace.c +++ /dev/null @@ -1,119 +0,0 @@ -/* Multiple arrivals by depth marching. */ -/* -Copyright (C) 2008 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include - -#include "hdtrace.h" - - -int main(int argc, char* argv[]) -{ - bool vel; - int nz, nx, iz, np, npx, is, order, iorder, ix, k; - float dz, dx, dp, x0, z0, p0; - float **slow; - float *slice[NS]; - sf_file in, out[NS]; - - sf_init(argc,argv); - in = sf_input("in"); - out[0] = sf_output("out"); - out[1] = sf_output("place"); - out[2] = sf_output("depth"); - out[3] = sf_output("angle"); - - if (!sf_histint(in,"n1",&nz)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&nx)) sf_error("No n2= in input"); - - if (!sf_histfloat(in,"d1",&dz)) sf_error("No d1= in input"); - if (!sf_histfloat(in,"d2",&dx)) sf_error("No d2= in input"); - - if (!sf_histfloat(in,"o1",&z0)) sf_error("No o1= in input"); - if (!sf_histfloat(in,"o2",&x0)) sf_error("No o2= in input"); - - /* default range from -1.0 to +1.0 (-90 to +90 from the vertical) */ - - if (!sf_getint("np",&np)) np=201; - /* number of horizontal slownesses */ - if (!sf_getfloat("dp",&dp)) dp=0.01; - /* slowness increment (non dimensional) */ - if (!sf_getfloat("p0",&p0)) p0=-1.; - /* starting horizontal slowness */ - - for (is=0; is < NS; is++) { - sf_putint(out[is],"n3",nz); - sf_putfloat(out[is],"d3",dz); - sf_putfloat(out[is],"o3",z0); - - sf_putint(out[is],"n2",nx); - sf_putfloat(out[is],"d2",dx); - sf_putfloat(out[is],"o2",x0); - - sf_putint(out[is],"n1",np); - sf_putfloat(out[is],"d1",dp); - sf_putfloat(out[is],"o1",p0); - } - - npx = np*nx; - - /* additional parameters */ - if(!sf_getbool("vel",&vel)) vel=true; - /* y, input is velocity; n, slowness */ - if(!sf_getint("order",&order)) order=3; - /* interpolation accuracy for velocity */ - if(!sf_getint("iorder",&iorder)) iorder=4; - /* interpolation accuracy for grid */ - - slow = sf_floatalloc2(nz,nx); - sf_floatread(slow[0],nz*nx,in); - if (vel) { /* convert to slowness */ - for(ix = 0; ix < nx; ix++){ - for (iz = 0; iz < nz; iz++) { - slow[ix][iz] = 1./slow[ix][iz]; - } - } - } - - for (is = 0; is < NS; is++) { - slice[is] = sf_floatalloc(npx); - for (k = 0; k < npx; k++) { - slice[is][k] = 0.; - } - } - - hdtrace_init (order, iorder, nx, nz, np, dx, dz, dp, x0, z0, p0, slow, slice); - - /* loop for upgoing rays */ - for (iz = 0; iz < nz; iz++) { - - sf_warning("depth %d of %d", iz+1, nz); - - hdtrace_step (iz,-1,slow); - - for (is = 0; is < NS; is++) { - sf_floatwrite (slice[is],npx,out[is]); - } - - } - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mhmiss.c b/user/nobody/Mhmiss.c deleted file mode 100644 index 68695c7a72..0000000000 --- a/user/nobody/Mhmiss.c +++ /dev/null @@ -1,132 +0,0 @@ -/* Multi-dimensional missing data interpolation with shaping regularization. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "hshape.h" -#include "bound.h" - -int main(int argc, char* argv[]) -{ - int i, ia, na, nx, ns, dim, niter; - int n[SF_MAX_DIM], m[SF_MAX_DIM], a[SF_MAX_DIM]; - float a0, eps, *mm, *pp; - bool verb, *known; - sf_filter aa; - char* lagfile; - sf_file in, out, filt, lag, mask; - - sf_init (argc,argv); - in = sf_input("in"); - filt = sf_input("filt"); - out = sf_output("out"); - - dim = sf_filedims (in,n); - - if (!sf_histint(filt,"n1",&na)) sf_error("No n1= in filt"); - aa = sf_allocatehelix (na); - - if (!sf_histfloat(filt,"a0",&a0)) a0=1.; - if (!sf_histints(filt,"a",a,dim)) { - for (i=0; i < dim; i++) { - a[i]=1; - } - } - - if (NULL != (lagfile = sf_getstring("lag")) /* file with filter lags */ - || - NULL != (lagfile = sf_histstring(filt,"lag"))) { - lag = sf_input(lagfile); - - sf_intread(aa->lag,na,lag); - } else { - lag = NULL; - for( ia=0; ia < na; ia++) { - aa->lag[ia] = ia+1; - } - } - - - if (!sf_getints ("n",m,dim) && (NULL == lag || - !sf_histints (lag,"n",m,dim))) { - for (i=0; i < dim; i++) { - m[i] = n[i]; - } - } - - if (NULL != lag) sf_fileclose(lag); - - bound (dim, false, m, n, a, aa); - - sf_floatread (aa->flt,na,filt); - sf_fileclose(filt); - - for( ia=0; ia < na; ia++) { - aa->flt[ia] /= a0; - } - - if (!sf_getint ("ns",&ns)) sf_error("Need ns="); - /* scaling */ - if (!sf_getint("niter",&niter)) niter=100; - /* Number of iterations */ - if (!sf_getfloat("eps",&eps)) eps=1.; - /* regularization parameter */ - if (!sf_getbool("verb",&verb)) verb=true; - /* verbosity flag */ - - nx = 1; - for( i=0; i < dim; i++) { - nx *= n[i]; - } - - mm = sf_floatalloc (nx); - pp = sf_floatalloc (nx); - known = sf_boolalloc (nx); - - sf_mask_init(known); - hshape_init (nx,ns,aa); - sf_conjgrad_init(nx, nx, nx, nx, eps, 1.e-8, verb, false); - - if (NULL != sf_getstring("mask")) { - /* optional input mask file for known data */ - mask = sf_input("mask"); - sf_floatread(mm,nx,mask); - sf_fileclose(mask); - - for (i=0; i < nx; i++) { - known[i] = (bool) (mm[i] != 0.); - } - sf_floatread(mm,nx,in); - } else { - sf_floatread(mm,nx,in); - - for (i=0; i < nx; i++) { - known[i] = (bool) (mm[i] != 0.); - } - } - - sf_conjgrad(NULL, sf_mask_lop, hshape_lop, pp, mm, mm, niter); - - sf_floatwrite (mm,nx,out); - - - exit (0); -} - - diff --git a/user/nobody/Mhshape.c b/user/nobody/Mhshape.c deleted file mode 100644 index ad29183fa3..0000000000 --- a/user/nobody/Mhshape.c +++ /dev/null @@ -1,106 +0,0 @@ -/* Multidimensional shaping using helix transform. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "hshape.h" -#include "regrid.h" - -int main(int argc, char* argv[]) -{ - int i, ia, na, nx, ns, dim, n[SF_MAX_DIM], m[SF_MAX_DIM]; - float a0, *pp, *qq; - bool adj; - sf_filter aa; - char* lagfile; - sf_file in, out, filt, lag; - - sf_init (argc,argv); - in = sf_input("in"); - filt = sf_input("filt"); - out = sf_output("out"); - - dim = sf_filedims (in,n); - - if (!sf_histint(filt,"n1",&na)) sf_error("No n1= in filt"); - aa = sf_allocatehelix (na); - - if (!sf_histfloat(filt,"a0",&a0)) a0=1.; - sf_floatread (aa->flt,na,filt); - for( ia=0; ia < na; ia++) { - aa->flt[ia] /= a0; - } - - if (NULL != (lagfile = sf_getstring("lag")) /* file with filter lags */ - || - NULL != (lagfile = sf_histstring(filt,"lag"))) { - lag = sf_input(lagfile); - - sf_intread(aa->lag,na,lag); - } else { - lag = NULL; - for( ia=0; ia < na; ia++) { - aa->lag[ia] = ia+1; - } - } - - sf_fileclose(filt); - - if (!sf_getints ("n",m,dim) && (NULL == lag || - !sf_histints (lag,"n",m,dim))) { - for (i=0; i < dim; i++) { - m[i] = n[i]; - } - } - - if (NULL != lag) sf_fileclose(lag); - - regrid (dim, m, n, aa); - - if (!sf_getbool ("adj",&adj)) adj=false; - /* if y, do adjoint operation */ - if (!sf_getint ("ns",&ns)) sf_error("Need ns="); - /* scaling */ - - nx = 1; - for( i=0; i < dim; i++) { - nx *= n[i]; - } - - pp = sf_floatalloc (nx); - qq = sf_floatalloc (nx); - - if (adj) { - sf_floatread (qq,nx,in); - } else { - sf_floatread (pp,nx,in); - } - - hshape_init (nx,ns,aa); - hshape_lop (adj,false,nx,nx,pp,qq); - - if (adj) { - sf_floatwrite (pp,nx,out); - } else { - sf_floatwrite (qq,nx,out); - } - - - exit (0); -} diff --git a/user/nobody/Mhslice.c b/user/nobody/Mhslice.c deleted file mode 100644 index d0fc05a1db..0000000000 --- a/user/nobody/Mhslice.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Extract horizons from data */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "fint1.h" - -int main(int argc, char* argv[]) -{ - int nt, nh, n2, it, ih, i2; - float *trace, *coord, t0, dt, t; - fint1 str; - sf_file in, out, pick; - - sf_init(argc,argv); - in = sf_input("in"); - pick = sf_input("pick"); - out = sf_output("out"); - - if (!sf_histint(in,"n1",&nt)) sf_error("No n1= in input"); - if (!sf_histfloat(in,"o1",&t0)) sf_error("No o1= in input"); - if (!sf_histfloat(in,"d1",&dt)) sf_error("No d1= in input"); - n2 = sf_leftsize(in,1); - - if (!sf_histint(pick,"n1",&nh)) sf_error("No n1= in pick"); - if (n2 != sf_leftsize(pick,1)) sf_error("Wrong number of traces in pick (need %d)",n2); - - sf_putint(out,"n1",nh); - - trace = sf_floatalloc (nt); - coord = sf_floatalloc (nh); - - str = fint1_init (4,nt,0); - - for (i2=0; i2 < n2; i2++) { - sf_floatread (trace,nt,in); - sf_floatread (coord,nh,pick); - - fint1_set(str,trace); - - for (ih=0; ih < nh; ih++) { - t = (coord[ih]-t0)/dt; - it = floorf(t); - if (it >=0 && it < nt) { - coord[ih] = fint1_apply(str,it,t-it,false); - } - } - - sf_floatwrite(coord,nh,out); - } - - exit(0); -} diff --git a/user/nobody/Minvwarp.c b/user/nobody/Minvwarp.c deleted file mode 100644 index 14c7a6f9c8..0000000000 --- a/user/nobody/Minvwarp.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Invert a warping function. - -Takes: < warp.rsf > invwarp.rsf -*/ - -#include - -#include "stretch.h" - -int main(int argc, char* argv[]) -{ - int i1, n1, n2, i2, m2; - float *inp, *outp; - float o1, d1, o2, d2, eps; - map str; - sf_file in, out, other; - - sf_init (argc, argv); - in = sf_input("in"); - other = sf_input("other"); - out = sf_output("out"); - - if(!sf_histint(in,"n1",&n1)) sf_error ("No n1= in input"); - if(!sf_histfloat(in,"d1",&d1)) sf_error ("No d1= in input"); - if(!sf_histfloat(in,"o1",&o1)) o1 = 0.; - - m2 = sf_leftsize(in,1); - - if(!sf_histint(other,"n1",&n2)) sf_error ("No n1= in other"); - if(!sf_histfloat(other,"d1",&d2)) sf_error ("No d1= in other"); - if(!sf_histfloat(other,"o1",&o2)) o2 = 0.; - - sf_putint(out,"n1",n2); - sf_putfloat(out,"d1",d2); - sf_putfloat(out,"o1",o2); - - if (!sf_getfloat("eps",&eps)) eps=0.01; - /* Smoothness parameter */ - - inp = sf_floatalloc (n1); - outp = sf_floatalloc (n2); - - str = stretch_init (n2, o2, d2, n1, eps, false); - - for (i2=0; i2 < m2; i2++) { - sf_floatread (inp,n1,in); - - stretch_define (str, inp); - - for (i1=0; i1 < n1; i1++) { - inp[i1] = o1 + i1*d1; - } - - stretch_apply (str, inp, outp); - -/* - for (i1=0; i1 < n2; i1++) { - outp[i1] -= (o2 + i1*d2); - } -*/ - - sf_floatwrite(outp,n2,out); - } - - - exit (0); -} - -/* $Id$ */ - diff --git a/user/nobody/Misomod.c b/user/nobody/Misomod.c deleted file mode 100644 index dadee3dc9c..0000000000 --- a/user/nobody/Misomod.c +++ /dev/null @@ -1,386 +0,0 @@ -/* 2D isotropic time-domain FD modeling */ -/* - Copyright (C) 2009 Colorado School of Mines - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#ifdef _OPENMP -#include -#include "omputil.h" -#endif - -#include "fdutil.h" - -/* check: dt<= 0.2 * min(dx,dz)/vmin */ - -#define NOP 2 /* derivative operator half-size */ - -#define C0 -2.500000 /* c0=-30./12.; */ -#define CA +1.333333 /* ca=+16./12.; */ -#define CB -0.083333 /* cb=- 1./12.; */ - -int main(int argc, char* argv[]) -{ - bool verb,fsrf,snap,expl,dabc; - int jsnap,ntsnap,jdata; - - /* OMP parameters */ -#ifdef _OPENMP - int ompnth; -#endif - - /* I/O files */ - sf_file Fwav=NULL; /* wavelet */ - sf_file Fsou=NULL; /* sources */ - sf_file Frec=NULL; /* receivers */ - sf_file Fvel=NULL; /* velocity */ - sf_file Fdat=NULL; /* data */ - sf_file Fwfl=NULL; /* wavefield */ - - /* cube axes */ - sf_axis at,az,ax; - sf_axis as,ar; - - int nt,nz,nx,ns,nr,nb; - int it,iz,ix; - float dt,dz,dx,idz,idx; - - /* FDM structure */ - fdm2d fdm=NULL; - abcone2d abc=NULL; - sponge spo=NULL; - - /* I/O arrays */ - float *ww=NULL; /* wavelet */ - pt2d *ss=NULL; /* sources */ - pt2d *rr=NULL; /* receivers */ - float *dd=NULL; /* data */ - - float **tt=NULL; - float **vp=NULL; /* velocity */ - float **vt=NULL; /* temporary vp*vp * dt*dt */ - - float **vp2=NULL; - float **vv2=NULL; - float **vh2=NULL; - - float **um,**uo,**up,**ua,**ut; /* wavefield: um = U @ t-1; uo = U @ t; up = U @ t+1 */ - - /* linear interpolation weights/indices */ - lint2d cs,cr; - - /* FD operator size */ - float cox,coz,cax,cbx,caz,cbz; - - /* wavefield cut params */ - sf_axis acz=NULL,acx=NULL; - int nqz,nqx; - float oqz,oqx; - float dqz,dqx; - float **uc=NULL; - - /*------------------------------------------------------------*/ - /* init RSF */ - sf_init(argc,argv); - - /*------------------------------------------------------------*/ - /* OMP parameters */ -#ifdef _OPENMP - ompnth=omp_init(); -#endif - /*------------------------------------------------------------*/ - - if(! sf_getbool("verb",&verb)) verb=false; /* verbosity flag */ - if(! sf_getbool("snap",&snap)) snap=false; /* wavefield snapshots flag */ - if(! sf_getbool("free",&fsrf)) fsrf=false; /* free surface flag */ - if(! sf_getbool("expl",&expl)) expl=false; /* "exploding reflector" */ - if(! sf_getbool("dabc",&dabc)) dabc=false; /* absorbing BC */ - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* I/O files */ - Fwav = sf_input ("in" ); /* wavelet */ - Fvel = sf_input ("vel"); /* velocity */ - Fsou = sf_input ("sou"); /* sources */ - Frec = sf_input ("rec"); /* receivers */ - Fwfl = sf_output("wfl"); /* wavefield */ - Fdat = sf_output("out"); /* data */ - - /*------------------------------------------------------------*/ - /* axes */ - at = sf_iaxa(Fwav,2); sf_setlabel(at,"t"); if(verb) sf_raxa(at); /* time */ - az = sf_iaxa(Fvel,1); sf_setlabel(az,"z"); if(verb) sf_raxa(az); /* depth */ - ax = sf_iaxa(Fvel,2); sf_setlabel(ax,"x"); if(verb) sf_raxa(ax); /* space */ - - as = sf_iaxa(Fsou,2); sf_setlabel(as,"s"); if(verb) sf_raxa(as); /* sources */ - ar = sf_iaxa(Frec,2); sf_setlabel(ar,"r"); if(verb) sf_raxa(ar); /* receivers */ - - nt = sf_n(at); dt = sf_d(at); - nz = sf_n(az); dz = sf_d(az); - nx = sf_n(ax); dx = sf_d(ax); - - ns = sf_n(as); - nr = sf_n(ar); - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* other execution parameters */ - if(! sf_getint("jdata",&jdata)) jdata=1; - if(snap) { /* save wavefield every *jsnap* time steps */ - if(! sf_getint("jsnap",&jsnap)) jsnap=nt; - } - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* expand domain for FD operators and ABC */ - if( !sf_getint("nb",&nb) || nbnzpad); sf_seto(az,fdm->ozpad); if(verb) sf_raxa(az); - sf_setn(ax,fdm->nxpad); sf_seto(ax,fdm->oxpad); if(verb) sf_raxa(ax); - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* setup output data header */ - sf_oaxa(Fdat,ar,1); - - sf_setn(at,nt/jdata); - sf_setd(at,dt*jdata); - sf_oaxa(Fdat,at,2); - - /* setup output wavefield header */ - if(snap) { - if(!sf_getint ("nqz",&nqz)) nqz=sf_n(az); - if(!sf_getint ("nqx",&nqx)) nqx=sf_n(ax); - - if(!sf_getfloat("oqz",&oqz)) oqz=sf_o(az); - if(!sf_getfloat("oqx",&oqx)) oqx=sf_o(ax); - - dqz=sf_d(az); - dqx=sf_d(ax); - - acz = sf_maxa(nqz,oqz,dqz); sf_raxa(acz); - acx = sf_maxa(nqx,oqx,dqx); sf_raxa(acx); - /* check if the imaging window fits in the wavefield domain */ - - uc=sf_floatalloc2(sf_n(acz),sf_n(acx)); - - ntsnap=0; - for(it=0; itnzpad,fdm->nxpad); - vt =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - vp2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - vv2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - vh2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - /* input velocity */ - sf_floatread(tt[0],nz*nx,Fvel ); expand(tt,vp,fdm); - /* precompute dt^2 and vp^2 */ - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - vt[ix][iz] = dt*dt; - - vp2[ix][iz] = vp[ix][iz] * vp[ix][iz]; - vh2[ix][iz] = vp[ix][iz] * vp[ix][iz]; - vv2[ix][iz] = vp[ix][iz] * vp[ix][iz]; - - } - } - if(fsrf) { /* free surface */ - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznb; iz++) { - vp2[ix][iz]=0; - vv2[ix][iz]=0; - vh2[ix][iz]=0; - } - } - } - - free(*tt); free(tt); - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* allocate wavefield arrays */ - um=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - uo=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - up=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - ua=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - um[ix][iz]=0; - uo[ix][iz]=0; - up[ix][iz]=0; - ua[ix][iz]=0; - } - } - - /*------------------------------------------------------------*/ - if(dabc) { - /* one-way abc setup */ - abc = abcone2d_make(NOP,dt,vp,fsrf,fdm); - /* sponge abc setup */ - spo = sponge_make(fdm->nb); - } - - /*------------------------------------------------------------*/ - /* - * MAIN LOOP - */ - /*------------------------------------------------------------*/ - if(verb) fprintf(stderr,"\n"); - for (it=0; itompchunk) \ - private(ix,iz) \ - shared(fdm,ua,uo,cox,coz,cax,caz,cbx,cbz,idx,idz,vp2) -#endif - for (ix=NOP; ixnxpad-NOP; ix++) { - for(iz=NOP; iznzpad-NOP; iz++) { - - /* 4th order Laplacian operator */ - ua[ix][iz] = - (cox* uo[ix ][iz ] + - cax*(uo[ix-1][iz ] + uo[ix+1][iz ]) + - cbx*(uo[ix-2][iz ] + uo[ix+2][iz ])) * vp2[ix][iz] + - (coz* uo[ix ][iz ] + - caz*(uo[ix ][iz-1] + uo[ix ][iz+1]) + - cbz*(uo[ix ][iz-2] + uo[ix ][iz+2])) * vp2[ix][iz] ; - - } - } - - /* inject acceleration source */ - if(expl) { - sf_floatread(ww, 1,Fwav); - lint2d_inject1(ua,ww[0],cs); - } else { - sf_floatread(ww,ns,Fwav); - lint2d_inject(ua,ww,cs); - } - - /* step forward in time */ -#ifdef _OPENMP -#pragma omp parallel for \ - schedule(dynamic,fdm->ompchunk) \ - private(ix,iz) \ - shared(fdm,ua,uo,um,up,vt) -#endif - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - up[ix][iz] = 2*uo[ix][iz] - - um[ix][iz] - + ua[ix][iz] * vt[ix][iz]; - } - } - /* circulate wavefield arrays */ - ut=um; - um=uo; - uo=up; - up=ut; - - if(dabc) { - /* one-way abc apply */ - abcone2d_apply(uo,um,NOP,abc,fdm); - sponge2d_apply(um,spo,fdm); - sponge2d_apply(uo,spo,fdm); - sponge2d_apply(up,spo,fdm); - } - - /* extract data */ - lint2d_extract(uo,dd,cr); - - if(snap && it%jsnap==0) { - cut2d(uo,uc,fdm,acz,acx); - sf_floatwrite(uc[0],sf_n(acz)*sf_n(acx),Fwfl); - } - if( it%jdata==0) - sf_floatwrite(dd,nr,Fdat); - } - if(verb) fprintf(stderr,"\n"); - - /*------------------------------------------------------------*/ - /* deallocate arrays */ - free(*um); free(um); - free(*up); free(up); - free(*uo); free(uo); - free(*ua); free(ua); - free(*uc); free(uc); - - free(*vp); free(vp); - free(*vt); free(vt); - - free(*vp2); free(vp2); - free(*vh2); free(vh2); - free(*vv2); free(vv2); - - free(ww); - free(ss); - free(rr); - free(dd); - - exit (0); -} - diff --git a/user/nobody/Mkgdmo.c b/user/nobody/Mkgdmo.c deleted file mode 100644 index 34e5dc8259..0000000000 --- a/user/nobody/Mkgdmo.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Wavenumber-domain Gardner's DMO for regularly sampled 2-D data - - The input/ouput is (time,offset,midpoint wavenumber). -*/ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include "warp2.h" - -int main(int argc, char* argv[]) -{ - bool inv; - int it, nt, ih, nh, ik, nk, ib, nb, **fold; - float dt, dh, dk, t0, h0, k0, t, h, k, eps, db, b, sinb, cosb, tanb; - float **slice, **tstr, **hstr, **slice2, **sum, amp, sample; - sf_file in, out; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_getbool("inv",&inv)) inv=true; - /* inversion flag */ - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - if (!sf_histint(in,"n1",&nt)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&nh)) sf_error("No n2= in input"); - if (!sf_histint(in,"n3",&nk)) sf_error("No n3= in input"); - - if (!sf_histfloat(in,"d1",&dt)) sf_error("No d1= in input"); - if (!sf_histfloat(in,"d2",&dh)) sf_error("No d2= in input"); - if (!sf_histfloat(in,"d3",&dk)) sf_error("No d3= in input"); - - if (!sf_histfloat(in,"o1",&t0)) sf_error("No o1= in input"); - if (!sf_histfloat(in,"o2",&h0)) sf_error("No o2= in input"); - if (!sf_histfloat(in,"o3",&k0)) sf_error("No o3= in input"); - - dk *= 2*SF_PI; - k0 *= 2*SF_PI; - - if (!sf_getfloat("eps",&eps)) eps=0.01; - /* stretch regularization */ - - slice = sf_floatalloc2(nt,nh); - tstr = sf_floatalloc2(nt,nh); - hstr = sf_floatalloc2(nt,nh); - slice2 = sf_floatalloc2(nt,nh); - - sum = sf_floatalloc2(nt,nh); - fold = sf_intalloc2(nt,nh); - - if (!sf_getint("nb",&nb)) nb=86; /* number of angles */ - if (!sf_getfloat("db",&db)) db=1; /* angle increment */ - db *= SF_PI/180; - - warp2_init(nt, t0, dt, - nh, h0, dh, - nt, nh, eps); - - for (ik=0; ik < nk; ik++) { - k = k0+ik*dk; - sf_warning("wavenumber %d of %d;",ik+1,nk); - - sf_floatread(slice[0],nt*nh,in); - - for (ih=0; ih < nh; ih++) { - for (it=0; it < nt; it++) { - sum[ih][it] = slice[ih][it]; - fold[ih][it] = 1; - } - } - - for (ib=1; ib < nb; ib++) { - b = ib*db; - sinb = sinf(b); - cosb = cosf(b); - tanb = sinb/cosb; - - for (ih=0; ih < nh; ih++) { - h = h0 + ih*dh; - for (it=0; it < nt; it++) { - t = t0 + it*dt; - if (inv) { - tstr[ih][it] = t*cosb; - hstr[ih][it] = h*cosb; - } else { - tstr[ih][it] = t/cosb; - hstr[ih][it] = h/cosb; - } - } - } - - if (inv) { - warp2(slice,tstr,hstr,slice2); - } else { - fwarp2(slice,tstr,hstr,slice2); - } - - for (ih=0; ih < nh; ih++) { - h = h0 + ih*dh; - if (inv) { - amp = 2.0f*cosf(k*h*sinb); - } else { - amp = 2.0f*cosf(k*h*tanb); - } - - for (it=0; it < nt; it++) { - sample = slice2[ih][it]*amp; - - if (sample != 0.0f) { - sum[ih][it] += sample; - fold[ih][it] += 2; - } - } - } - } /* b ended */ - - for (ih=0; ih < nh; ih++) { - for (it=0; it < nt; it++) { - if (fold[ih][it] > 1) sum[ih][it] /= fold[ih][it]; - } - } - - sf_floatwrite(sum[0],nt*nh,out); - } - sf_warning("."); - - exit(0); -} diff --git a/user/nobody/Mkirmodcmp.c b/user/nobody/Mkirmodcmp.c deleted file mode 100644 index 274db8aada..0000000000 --- a/user/nobody/Mkirmodcmp.c +++ /dev/null @@ -1,487 +0,0 @@ -/* Kirchhoff 3-D modeling with analytical Green's functions. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include - -#include - -#include "kirmod.h" -#include "kirmod3.h" -#include "ricker.h" -#include "aastretch.h" - -int main(int argc, char* argv[]) -{ - int nx,ny, nt, nsx,nsy, nmx,nmy, nhx,nhy, nc, nxyc, isx,isy, ihx,ihy, imx,imy, ix,iy, ic; - int ns,nh,nm, two, is, ih, im; - float ***rfl, ***rgd, ***crv, ***dipx, ***dipy, *trace; - float slow, dx, x0, dy, y0, dt, t0, aper, x, y, dx1, dy1, dx2, dy2; - float dsx, dsy, s0x, s0y, dmx, dmy, m0x, m0y, dhx, h0x, dhy, h0y, r0; - float theta, ava, amp, obl, ***time, ***ampl, ***delt, **geom, **geoms, freq; - char *type; - bool cmp; - velocity3 vel; - ktable ts, tg; - sf_file refl, curv, modl, head; - - sf_init(argc,argv); - curv = sf_input("in"); - modl = sf_output("out"); - - if (SF_FLOAT != sf_gettype(curv)) sf_error("Need float input"); - if (!sf_histint (curv,"n1",&nx)) sf_error("No n1= in input"); - if (!sf_histfloat(curv,"d1",&dx)) sf_error("No d1= in input"); - if (!sf_histfloat(curv,"o1",&x0)) sf_error("No o1= in input"); - if (!sf_histint (curv,"n2",&ny)) sf_error("No n2= in input"); - if (!sf_histfloat(curv,"d2",&dy)) sf_error("No d2= in input"); - if (!sf_histfloat(curv,"o2",&y0)) sf_error("No o2= in input"); - if (!sf_histint (curv,"n3",&nc)) nc=1; /* number of reflectors */ - nxyc = nx*ny*nc; - - /*** Initialize trace ***/ - if (!sf_getbool("cmp",&cmp)) cmp=false; - /* CMP or shot gather output. Default is shot gather. */ - if (!sf_getint("nt",&nt)) sf_error("Need nt="); - /* time samples */ - if (!sf_getfloat("dt",&dt)) dt=0.004; - /* time sampling */ - if (!sf_getfloat("t0",&t0)) t0=0.; - /* time origin */ - - trace = sf_floatalloc(nt+1); - - sf_putint (modl,"n1",nt); - sf_putfloat(modl,"d1",dt); - sf_putfloat(modl,"o1",t0); - - /*** Initialize shots ***/ - - if (NULL != sf_getstring("head")) { - /* source-receiver geometry (optional) */ - - /* possibly irregular geometry in a file */ - head = sf_input("head"); - - if (SF_FLOAT != sf_gettype(head)) sf_error("Need float type in head"); - if (!sf_histint(head,"n1",&two) || two != 2) - sf_error("Need n1=2 in head"); - if (!sf_histint(head,"n2",&nh) || nh < 2) - sf_error("Need n2 >=2 in head"); - nh--; /* nh includes shot */ - if (!sf_histint(head,"n3",&ns)) ns=1; - - sf_putint(modl,"n2",nh); - sf_putint(modl,"n3",ns); - } else { - /* assume regular geometry */ - head = NULL; - - /*shot gather output parameters*/ - if (!sf_getint("nsx",&nsx)) nsx=nx; - /* number of inline shots */ - if (!sf_getfloat("s0x",&s0x)) s0x=x0; - /* first inline shot */ - if (!sf_getfloat("dsx",&dsx)) dsx=dx; - /* inline shot increment */ - - if (!sf_getint("nsy",&nsy)) nsy=ny; - /* number of crossline shots */ - if (!sf_getfloat("s0y",&s0y)) s0y=y0; - /* first crossline shot */ - if (!sf_getfloat("dsy",&dsy)) dsy=dy; - /* crossline shot increment */ - - - /*CMP gather output parameters*/ - if (!sf_getint("nmx",&nmx)) nmx=(nx+3)/2.0; - /* number of inline CMPs */ - if (!sf_getfloat("m0x",&m0x)) m0x=x0; - /* first inline CMP */ - if (!sf_getfloat("dmx",&dmx)) dmx=2*dx; - /* inline CMP increment */ - - if (!sf_getint("nmy",&nmy)) nmy=(ny+3)/2.0; - /* number of crossline CMPs */ - if (!sf_getfloat("m0y",&m0y)) m0y=y0; - /* first crossline CMP */ - if (!sf_getfloat("dmy",&dmy)) dmy=2*dy; - /* crossline CMP increment */ - - if (!cmp){ - sf_putfloat(modl,"o4",s0x); - sf_putfloat(modl,"d4",dsx); - sf_putint(modl,"n4",nsx); - - sf_putfloat(modl,"o5",s0y); - sf_putfloat(modl,"d5",dsy); - sf_putint(modl,"n5",nsy); - - nm = 0; - ns = nsx*nsy; - - }else{ - sf_putfloat(modl,"o4",m0x); - sf_putfloat(modl,"d4",dmx); - sf_putint(modl,"n4",nmx); - - sf_putfloat(modl,"o5",m0y); - sf_putfloat(modl,"d5",dmy); - sf_putint(modl,"n5",nmy); - - nm = nmx*nmy; - } - - - - /*** Initialize offsets ***/ - - if (!sf_getint ("nhx",&nhx)) nhx=nx; - /* number of inline offsets */ - if (!sf_getfloat("h0x",&h0x)) h0x=0.; - /* first inline offset */ - if (!sf_getfloat("dhx",&dhx)) dhx=dx; - /* inline offset increment (if cmp=y, dhx should have same sign as h0x) */ - - sf_putint (modl,"n2",nhx); - sf_putfloat(modl,"o2",h0x); - sf_putfloat(modl,"d2",dhx); - - if (!sf_getint ("nhy",&nhy)) nhy=ny; - /* number of crossline offsets */ - if (!sf_getfloat("h0y",&h0y)) h0y=0.; - /* first crossline offset */ - if (!sf_getfloat("dhy",&dhy)) dhy=dy; - /* crossline offset increment (if cmp=y, dhy should have same sign as h0y) */ - - sf_putint (modl,"n3",nhy); - sf_putfloat(modl,"o3",h0y); - sf_putfloat(modl,"d3",dhy); - - nh = nhx*nhy; - } - - /*** Initialize reflector ***/ - - crv = sf_floatalloc3(nx,ny,nc); - rfl = sf_floatalloc3(nx,ny,nc); - rgd = sf_floatalloc3(nx,ny,nc); - dipx = sf_floatalloc3(nx,ny,nc); - dipy = sf_floatalloc3(nx,ny,nc); - - sf_floatread(crv[0][0],nxyc,curv); - - /* reflectivity (A) */ - if (NULL != sf_getstring("refl")) { - refl = sf_input("refl"); - sf_floatread(rfl[0][0],nxyc,refl); - sf_fileclose(refl); - } else { - if (!sf_getfloat("r0",&r0)) r0=1.; - /* constant reflectivity */ - for (ic=0; ic < nc; ic++) { - for (iy=0; iy < ny; iy++) { - for (ix=0; ix < nx; ix++) { - rfl[ic][iy][ix] = r0; - } - } - } - } - - /* AVO gradient (B/A) */ - if (NULL != sf_getstring("rgrad")) { - refl = sf_input("rgrad"); - sf_floatread(rgd[0][0],nxyc,refl); - sf_fileclose(refl); - } else { - for (ic=0; ic < nc; ic++) { - for (iy=0; iy < ny; iy++) { - for (ix=0; ix < nx; ix++) { - rgd[ic][iy][ix] = 0.; - } - } - } - } - - /* reflector inline dip */ - if (NULL != sf_getstring("dipx")) { - refl = sf_input("dipx"); - sf_floatread(dipx[0][0],nxyc,refl); - sf_fileclose(refl); - } else { - for (ic=0; ic < nc; ic++) { - for (iy=0; iy < ny; iy++) { - for (ix=0; ix < nx; ix++) { - dipx[ic][iy][ix] = 0.; - } - } - } - } - - /* reflector crossline dip */ - if (NULL != sf_getstring("dipy")) { - refl = sf_input("dipy"); - sf_floatread(dipy[0][0],nxyc,refl); - sf_fileclose(refl); - } else { - for (ic=0; ic < nc; ic++) { - for (iy=0; iy < ny; iy++) { - for (ix=0; ix < nx; ix++) { - dipy[ic][iy][ix] = 0.; - } - } - } - } - - /*** Initialize velocity ***/ - vel = (velocity3) sf_alloc(1,sizeof(*vel)); - - if (!sf_getfloat("vel",&(vel->v0))) sf_error("Need vel="); - /* velocity */ - - if (!sf_getfloat("gradx",&(vel->gx))) (vel->gx)=0.; - if (!sf_getfloat("grady",&(vel->gy))) (vel->gy)=0.; - if (!sf_getfloat("gradz",&(vel->gz))) (vel->gz)=0.; - /* velocity gradient */ - - type = sf_getstring("type"); - /* type of velocity ('c': constant, 's': linear sloth, 'v': linear velocity) */ - if (NULL==type) { - type= ((vel->gx)==0. && (vel->gy)==0. && (vel->gz)==0.)?"const":"veloc"; - } else if ((vel->gx)==0. && (vel->gy)==0. && (vel->gz)==0.) { - free(type); - type = "const"; - } else if ('s'==type[0]) { - /* linear slowness squared */ - - slow = 1./((vel->v0)*(vel->v0)); - /* slowness squared */ - (vel->gx) *= -2.*slow/(vel->v0); - (vel->gy) *= -2.*slow/(vel->v0); - (vel->gz) *= -2.*slow/(vel->v0); - (vel->v0) = slow; - } else if ('v' != type[0]) { - sf_error("Unknown type=%s",type); - } - - if (!sf_getfloat("refx",&(vel->x0))) (vel->x0)=x0; - if (!sf_getfloat("refy",&(vel->y0))) (vel->y0)=y0; - if (!sf_getfloat("refz",&(vel->z0))) (vel->z0)=0.; - /* reference coordinates for velocity */ - - if (!sf_getfloat("aper",&aper)) aper=hypotf(nx*dx,ny*dy); - /* aperture */ - aper *= aper; - - /*** Allocate space ***/ - kirmod3_init(x0, dx, y0, dy, vel, type[0], crv, dipx, dipy); - ts = (ktable) sf_alloc(1,sizeof(*ts)); - tg = (ktable) sf_alloc(1,sizeof(*tg)); - - - /*** Initialize stretch ***/ - aastretch_init (nt, t0, dt, nxyc); - - time = sf_floatalloc3(nx,ny,nc); - ampl = sf_floatalloc3(nx,ny,nc); - delt = sf_floatalloc3(nx,ny,nc); - geom = sf_floatalloc2(2,nh+1); - geoms = sf_floatalloc2(2,nh+1); - - if (!sf_getfloat("freq",&freq)) freq=0.2/dt; - /* peak frequency for Ricker wavelet */ - ricker_init(nt*2,freq*dt,2); - - /*** Main loop ***/ - if (!cmp){ - /* loop over sources */ - for (is=0; is < ns; is++) { - if (0==is%(ns/10+1)) sf_warning("source %d of %d",is+1,ns); - - if (NULL == head) { /* regular */ - isy = is/nsx; - isx = is - isy*nsx; - - geom[nh][0] = s0x + isx*dsx; - geom[nh][1] = s0y + isy*dsy; - } else { /* irregular */ - sf_floatread(geom[0],2*(nh+1),head); - /*guess: sf_floatread reads the 2*(nh+1) values starting from geom[0] into head.*/ - } - - - /* loop over offsets */ - for (ih=0; ih < nh; ih++) { - if (NULL == head) { /* regular */ - ihy = ih/nhx; - ihx = ih - ihy*nhx; - - geom[ih][0] = geom[nh][0] + h0x + ihx*dhx; - geom[ih][1] = geom[nh][1] + h0y + ihy*dhy; - } - - /* loop over reflector surface */ - for (iy=0; iy < ny; iy++) { for (ix=0; ix < nx; ix++) { - x = x0+ix*dx; dx1 = x-geom[nh][0]; dx2 = x-geom[ih][0]; - y = y0+iy*dy; dy1 = y-geom[nh][1]; dy2 = y-geom[ih][1]; - - /* skip if outside the aperture */ - if (aper < dx1*dx1 + dy1*dy1 || - aper < dx2*dx2 + dy2*dy2) { - for (ic=0; ic < nc; ic++) { - time[ic][iy][ix] = t0+2.*nt*dt; - ampl[ic][iy][ix] = 0.; - delt[ic][iy][ix] = dt; - } - continue; - } - - /* loop over reflector number */ - for (ic=0; ic < nc; ic++) { - kirmod3_map(ts,geom[nh],ix,iy,ic); - kirmod3_map(tg,geom[ih],ix,iy,ic); - - time[ic][iy][ix] = ts->t + tg->t; - - tg->an /= sqrtf(1.-(tg->tn)*(tg->tn)); - ts->an /= sqrtf(1.-(ts->tn)*(ts->tn)); - theta = hypotf((tg->an)*(tg->tx)-(ts->an)*(ts->tx), - (tg->an)*(tg->ty)-(ts->an)*(ts->ty)); - - /* AVA */ - theta = sinf(0.5*theta); - ava = rfl[ic][iy][ix]+rgd[ic][iy][ix]*theta*theta; - - /* obliguity */ - obl = 0.5*(ts->tn + tg->tn); - - /* Geometrical spreading */ - amp = ts->a * tg->a + FLT_EPSILON; - - ampl[ic][iy][ix] = ava*obl*dx/amp; - delt[ic][iy][ix] = SF_MAX(fabsf(ts->tx+tg->tx)*dx, - fabsf(ts->ty+tg->ty)*dy); - } - }} - - aastretch_define (time[0][0],delt[0][0],NULL); - aastretch_lop (false,false,nxyc,nt,ampl[0][0],trace); - - /* convolve with Ricker wavelet */ - sf_freqfilt(nt,trace); - - sf_floatwrite(trace,nt,modl); - } /* ih */ - } /* is */ - }else{ - /* loop over CMPs */ - s0x = h0x/2.0; - s0y = h0y/2.0; - ns = nh; - nsx = nhx; - nsy = nhy; - dsx = dhx/2.0; - dsy = dhx/2.0; - - for (im=0; im < nm; im++) { - if (0==im%(nm/10+1)) sf_warning("midpoint %d of %d",im+1,nm); - - if (NULL == head) { /* regular */ - imy = im/nmx; - imx = im - imy*nmx; - - geom[nh][0] = m0x + imx*dmx; - geom[nh][1] = m0y + imy*dmy; - geoms[nh][0] = m0x + imx*dmx; - geoms[nh][1] = m0y + imy*dmy; - } else { /* irregular */ - sf_error("CMP option not yet available for irregular geometry"); - sf_floatread(geom[0],2*(nh+1),head); - } - - - /* loop over offsets */ - for (ih=0; ih < nh; ih++) { - if (NULL == head) { /* regular */ - ihy = ih/nhx; - ihx = ih - ihy*nhx; - - geom[ih][0] = geom[nh][0] + s0x + ihx*dsx; - geom[ih][1] = geom[nh][1] + s0y + ihy*dsy; - - geoms[ih][0] = geom[nh][0] - s0x - ihx*dsx; - geoms[ih][1] = geom[nh][1] - s0y - ihy*dsy; - } - - /* loop over surface */ - for (iy=0; iy < ny; iy++) { for (ix=0; ix < nx; ix++) { - x = x0+ix*dx; dx1 = x-geoms[ih][0]; dx2 = x-geom[ih][0]; - y = y0+iy*dy; dy1 = y-geoms[ih][1]; dy2 = y-geom[ih][1]; - - /* skip if outside the aperture */ - if (aper < dx1*dx1 + dy1*dy1 || - aper < dx2*dx2 + dy2*dy2) { - for (ic=0; ic < nc; ic++) { - time[ic][iy][ix] = t0+2.*nt*dt; - ampl[ic][iy][ix] = 0.; - delt[ic][iy][ix] = dt; - } - continue; - } - - /* loop over surface number */ - for (ic=0; ic < nc; ic++) { - kirmod3_map(ts,geoms[ih],ix,iy,ic); - kirmod3_map(tg,geom[ih],ix,iy,ic); - - time[ic][iy][ix] = ts->t + tg->t; - - tg->an /= sqrtf(1.-(tg->tn)*(tg->tn)); - ts->an /= sqrtf(1.-(ts->tn)*(ts->tn)); - theta = hypotf((tg->an)*(tg->tx)-(ts->an)*(ts->tx), - (tg->an)*(tg->ty)-(ts->an)*(ts->ty)); - - /* AVA */ - theta = sinf(0.5*theta); - ava = rfl[ic][iy][ix]+rgd[ic][iy][ix]*theta*theta; - - /* obliguity */ - obl = 0.5*(ts->tn + tg->tn); - - /* Geometrical spreading */ - amp = ts->a * tg->a + FLT_EPSILON; - - ampl[ic][iy][ix] = ava*obl*dx/amp; - delt[ic][iy][ix] = SF_MAX(fabsf(ts->tx+tg->tx)*dx, - fabsf(ts->ty+tg->ty)*dy); - } - }} - - aastretch_define (time[0][0],delt[0][0],NULL); - aastretch_lop (false,false,nxyc,nt,ampl[0][0],trace); - - /* convolve with Ricker wavelet */ - sf_freqfilt(nt,trace); - - sf_floatwrite(trace,nt,modl); - } /* ih */ - } /* im */ - } - - exit(0); -} diff --git a/user/nobody/Mlayer.c b/user/nobody/Mlayer.c deleted file mode 100644 index c185c4a200..0000000000 --- a/user/nobody/Mlayer.c +++ /dev/null @@ -1,140 +0,0 @@ -/* Ray tracing in a layered medium. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "layer.h" - -int main(int argc, char* argv[]) -{ - int nx, nc, nxc, ix, ic, nv, iv; - float **rfl, **crv, **dip, *v0, **g, **r0; - float slow, dx, x0, s0, s1; - char **type; - bool twod; - sf_file curv; - - sf_init(argc,argv); - curv = sf_input("in"); - - if (SF_FLOAT != sf_gettype(curv)) sf_error("Need float input"); - if (!sf_histint (curv,"n1",&nx)) sf_error("No n1= in input"); - if (!sf_histfloat(curv,"d1",&dx)) sf_error("No d1= in input"); - if (!sf_histfloat(curv,"o1",&x0)) sf_error("No o1= in input"); - if (!sf_histint (curv,"n2",&nc) || nc < 2) - sf_error("Need n2 >= 2 in input"); - /* number of interfaces */ - nxc = nx*nc; - - /*** Initialize shots ***/ - if (!sf_getfloat("s0",&s0)) sf_error("Need s0="); - /* first point */ - if (!sf_getfloat("s1",&s1)) sf_error("Need s1="); - /* last point */ - - /*** Initialize reflector ***/ - - rfl = sf_floatalloc2(nx,nc); - dip = sf_floatalloc2(nx,nc); - crv = sf_floatalloc2(nx,nc); - - sf_floatread(crv[0],nxc,curv); - sf_fileclose(curv); - - /* reflector dip */ - if (NULL != sf_getstring("dip")) { - curv = sf_input("dip"); - sf_floatread(dip[0],nxc,curv); - sf_fileclose(curv); - } else { - for (ic=0; ic < nc; ic++) { - for (ix=0; ix < nx; ix++) { - dip[ic][ix] = 0.; - } - } - } - - /* reflector curvature */ - if (NULL != sf_getstring("crv")) { - curv = sf_input("crv"); - sf_floatread(crv[0],nxc,curv); - sf_fileclose(curv); - } else { - for (ic=0; ic < nc; ic++) { - for (ix=0; ix < nx; ix++) { - crv[ic][ix] = 0.; - } - } - } - - /*** Initialize velocity ***/ - nv = nc-1; - v0 = sf_floatalloc(nv); - g = sf_floatalloc2(nv,2); - r0 = sf_floatalloc2(nv,2); - type = (char**) sf_alloc(nv,sizeof(char*)); - - if (!sf_getfloats("vel",v0,nv)) sf_error("Need vel="); - /* velocity */ - if (!sf_getfloat("gradx",g[0])) { /* velocity gradient in x */ - for (iv=0; iv < nv; iv++) { - g[0][iv] = 0.; - } - } - if (!sf_getfloat("gradz",g[1])) { /* velocity gradient in z */ - for (iv=0; iv < nv; iv++) { - g[1][iv] = 0.; - } - } - - if (!sf_getstrings("type",type,nv)) { - /* type of velocity ('c': constant [default], - 's': linear sloth, 'v': linear velocity) */ - for (iv=0; iv < nv; iv++) { - type[iv] = "const"; - } - } - for (iv=0; iv < nv; iv++) { - if ('s'==type[iv][0]) { - /* linear slowness squared */ - slow = 1./(v0[iv]*v0[iv]); - /* slowness squared */ - g[0][iv] *= -2.*slow/v0[iv]; - g[1][iv] *= -2.*slow/v0[iv]; - v0[iv] = slow; - } - } - - if (!sf_getbool("twod",&twod)) twod=false; - /* 2-D or 2.5-D */ - - if (!sf_getfloat("refx",r0[0])) { /* velocity reference in x */ - for (iv=0; iv < nv; iv++) { - r0[0][iv] = x0; - } - } - if (!sf_getfloat("refz",r0[1])) { /* velocity reference in z */ - for (iv=0; iv < nv; iv++) { - r0[1][iv] = 0.; - } - } - - - exit(0); -} - diff --git a/user/nobody/Mlevint2.c b/user/nobody/Mlevint2.c deleted file mode 100644 index d48a1496df..0000000000 --- a/user/nobody/Mlevint2.c +++ /dev/null @@ -1,128 +0,0 @@ -/* Leveler inverse interpolation in 2-D. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "helix.h" -#include "bound.h" -#include "createhelix.h" - -#include "levint2.h" - -int main(int argc, char* argv[]) -{ - int nd, m[2], a[2], center[2], gap[2], nm, n2, id, nr, niter, warmup; - float *rr, *dd, *xx, *yy, o1, d1, o2, d2, eps; - float vmin, xmin, ymin, vmax, xmax, ymax, vrange, vaver; - filter aa; - bool cdstep; - sf_file in, out; - - sf_init (argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - /* create model */ - if (!sf_getint ("m1",&m[0])) sf_error("Need m1="); - if (!sf_getint ("m2",&m[1])) sf_error("Need m2="); - /* number of bins */ - sf_putint(out,"n1",m[0]); - sf_putint(out,"n2",m[1]); - - /* create filter */ - if (!sf_getint("a1",&a[0])) a[0]=5; - if (!sf_getint("a2",&a[1])) a[1]=3; - /* filter size */ - center[0] = a[0]/2; - center[1] = 0; - gap[0] = gap[1] = 0; - aa = createhelix(2, m, center, gap, a); - - /* create model */ - nm = m[0]*m[1]; - nr = nm + aa->nh; - rr = sf_floatalloc(nr); - for (id=0; id < nr; id++) { - rr[id] = 0.; - } - free(aa->flt); - aa->flt = rr+nm; - - bound(2,m,m,a,aa); - - /* initialize filter with Laplacian */ - aa->flt[a[0]-1] = -4.; - aa->flt[a[0]-2] = 1.; - aa->flt[a[0]] = 1.; - aa->flt[2*a[0]-1] = 1.; - - /* initialize inversion */ - if (!sf_getint("niter",&niter)) niter=20; - /* number of iterations */ - if (!sf_getint("warmup",&warmup)) warmup=20; - /* number of initial iterations */ - if (!sf_getfloat("eps",&eps)) eps=1.; - /* regularization parameter */ - if (!sf_getbool("cdstep",&cdstep)) cdstep=false; - /* if y, use conjugate directions */ - - if (!sf_histint(in,"n1",&nd)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&n2) || 3 != n2) sf_error("Need n2=3 in input"); - - /* create filter */ - xx = sf_floatalloc(nd); - yy = sf_floatalloc(nd); - dd = sf_floatalloc(nd); - - sf_floatread (yy,nd,in); - sf_floatread (xx,nd,in); - sf_floatread (dd,nd,in); - - vmin = xmin = ymin = FLT_MAX; - vmax = xmax = ymax = -FLT_MAX; - for (id=0; id < nd; id++) { - if (vmin > dd[id]) vmin=dd[id]; if (vmax < dd[id]) vmax=dd[id]; - if (xmin > xx[id]) xmin=xx[id]; if (xmax < xx[id]) xmax=xx[id]; - if (ymin > yy[id]) ymin=yy[id]; if (ymax < yy[id]) ymax=yy[id]; - } - vaver = (vmax+vmin)/2.; - vrange = (vmax-vmin)/2.; - for (id=0; id < nd; id++) { - dd[id] = (vaver - dd[id])/vrange; - } - - if (!sf_getfloat("o1",&o1)) o1=xmin; - if (!sf_getfloat("o2",&o2)) o2=ymin; - if (!sf_getfloat("d1",&d1)) d1=(xmax-xmin)/(m[0]-1); - if (!sf_getfloat("d2",&d2)) d2=(ymax-ymin)/(m[1]-1); - - sf_putfloat(out,"o1",o1); - sf_putfloat(out,"o2",o2); - sf_putfloat(out,"d1",d1); - sf_putfloat(out,"d2",d2); - - levint2 (cdstep, niter, warmup, nd, xx, yy, dd, - o1, d1, m[0], o2, d2, m[1], aa, rr, eps); - - sf_floatwrite (rr,nm,out); - - exit(0); -} - -/* $Id: Mlevint.c 1107 2005-04-11 16:52:19Z fomels $ */ diff --git a/user/nobody/Mlinsincos.c b/user/nobody/Mlinsincos.c deleted file mode 100644 index a4d1b264f0..0000000000 --- a/user/nobody/Mlinsincos.c +++ /dev/null @@ -1,157 +0,0 @@ -/* Convert F(vx,vy) to F(d) using equation vy*cos(d) + vx*sin(d) = 1/s0. */ -/* - Copyright (C) 2008 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -int main(int argc, char* argv[]) -{ - int na; /* number of output angles */ - int nt; /* number of radial lines or polar angles */ - int npos; /* number of frames */ - int nvx,nvy; /* number of velocity in x, number of velocity in y */ - - float da,oa; /* increment in output angle, starting position */ - float dt,ot; /* increment in polar angle, starting position */ - float dvx,ovx; /* increment of velocity in x, starting velocity */ - float dvy,ovy; /* increment of velocity in y, starting velocity */ - float s0; /* reference slowness */ - - float **v; /* data on squared grid vx-vy */ - float **a; /* data on output angle grid */ - - int ia; /* output angle counter */ - int it; /* polar angle counter */ - int ivxm,ivym; /* bilinear interpolation cell indices */ - - float d; /* output angle */ - float t; /* polar angle defining radial line */ - float vi; /* inverse velocity radius */ - float dat; /* interpolated data value at vx,vy */ - float vx,vy; /* velocity vx and vy */ - float tx,ty; /* bilinear inside cell position */ - - sf_axis aa,apos; - sf_file in,out; - - sf_init(argc,argv); - - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_getfloat("s0",&s0)) sf_error("Need s0="); - /* reference slowness */ - - if (!sf_getint("na",&na)) sf_error("Need na="); - /* number of output angle values. */ - if (!sf_getfloat("da",&da)) sf_error("Need da="); - /* output angle sampling. */ - if (!sf_getfloat("oa",&oa)) sf_error("Need oa="); - /* output angle origin */ - - if (!sf_getint("nt",&nt)) nt=360; - /* number of polar angles for integration. */ - if (!sf_getfloat("dt",&dt)) dt=1.; - /* polar angle sampling. */ - if (!sf_getfloat("ot",&ot)) ot=0.; - /* polar angle origin */ - - /* read input file parameters */ - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - - if (!sf_histint(in,"n1",&nvx)) sf_error("No nvx= in input"); - if (!sf_histfloat(in,"d1",&dvx)) sf_error("No dvx= in input"); - if (!sf_histfloat(in,"o1",&ovx)) sf_error("No ovx= in input"); - - if (!sf_histint(in,"n2",&nvy)) sf_error("No nvy= in input"); - if (!sf_histfloat(in,"d2",&dvy)) sf_error("No dvy= in input"); - if (!sf_histfloat(in,"o2",&ovy)) sf_error("No ovy= in input"); - - if ((nvx != nvy) || (dvx != dvy)) sf_error("Need squared grid for vx-vy plane"); - - /* number of vx-vy frames for computation. */ - npos = 1; - - /* output file parameters */ - aa = sf_maxa(na,oa,da); - sf_oaxa(out,aa,1); - - apos = sf_maxa(npos,0,1); - sf_oaxa(out,apos,2); - - sf_putstring(out,"label1","angle"); - sf_putstring(out,"label2","pos"); - - /* memory allocations */ - v = sf_floatalloc2(nvx,nvy); - a = sf_floatalloc2(na,npos); - - /* read data in velocity array */ - sf_floatread(v[0],nvx*nvy,in); - - /* initialize */ - for (ia = 0; ia < na; ia++) { - a[0][ia] = 0.; - } - - /* loop on polar angle directions */ - for (it = 0; it < nt; it++) { - t = (ot + it*dt)/180.*SF_PI; - - /* loop on output angle */ - for (ia = 0; ia < na; ia++) { - d = (oa + ia*da)/180.*SF_PI; - - /* inverse velocity radius equals scaled cos(d-t) on radial line */ - vi = s0*cosf(d-t); - - if (vi != 0.0) { - - vx = sinf(t)/vi; - vy = cosf(t)/vi; - - /* bilinear interpolation */ - ivxm = floorf((vx-ovx)/dvx); - ivym = floorf((vy-ovy)/dvy); - - if ( (ivxm >= 0) && (ivym >= 0) && (ivxm < (nvx-1)) && (ivym < (nvy-1)) ) { - - tx = (vx-ivxm*dvx-ovx)/dvx; - ty = (vy-ivym*dvy-ovy)/dvy; - - /* calculate interpolated value at vx,vy */ - dat = 0.0; - dat += v[ivym][ivxm]*(1.-tx)*(1.-ty); - dat += v[ivym][ivxm+1]*tx*(1.-ty); - dat += v[ivym+1][ivxm+1]*tx*ty; - dat += v[ivym+1][ivxm]*(1.-tx)*ty; - - /* sum */ - a[0][ia] += dat; - } - } - } - } - - /* output on angle grid */ - sf_floatwrite(a[0],na*npos,out); - - exit(0); -} diff --git a/user/nobody/Mlwefd1.c b/user/nobody/Mlwefd1.c deleted file mode 100644 index d695b12307..0000000000 --- a/user/nobody/Mlwefd1.c +++ /dev/null @@ -1,412 +0,0 @@ -/* linearized acoustic time-domain FD modeling */ -/* - Copyright (C) 2007 Colorado School of Mines - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include "fdutil.h" - -/* check: dt<= 0.2 * min(dx,dz)/vmin */ - -#define NOP 2 /* derivative operator half-size */ - -#define C0 -2.500000 /* c0=-30./12.; */ -#define CA +1.333333 /* ca=+16./12.; */ -#define CB -0.083333 /* cb=- 1./12.; */ - -#define C1 0.66666666666666666666 /* 2/3 */ -#define C2 -0.08333333333333333333 /* -1/12 */ - -/* centered FD derivative stencils */ -#define D1(a,i2,i1,s) (C2*(a[i2 ][i1+2] - a[i2 ][i1-2]) + \ - C1*(a[i2 ][i1+1] - a[i2 ][i1-1]) )*s -#define D2(a,i2,i1,s) (C2*(a[i2+2][i1 ] - a[i2-2][i1 ]) + \ - C1*(a[i2+1][i1 ] - a[i2-1][i1 ]) )*s - -int main(int argc, char* argv[]) -{ - bool verb,free,snap; - int jsnap; - int jdata; - - /* I/O files */ - sf_file Fwav=NULL; /* wavelet */ - sf_file Fsou=NULL; /* sources */ - sf_file Frec=NULL; /* receivers */ - - sf_file Fvel=NULL; /* velocity */ - sf_file Fref=NULL; /* reflectivity */ - sf_file Fden=NULL; /* density */ - - sf_file Fdat=NULL; /* data (background) */ - sf_file Fwfl=NULL; /* wavefield (background) */ - - sf_file Flid=NULL; /* data (scattered) */ - sf_file Fliw=NULL; /* wavefield (scattered) */ - - /* I/O arrays */ - float *ww=NULL; /* wavelet */ - pt2d *ss=NULL; /* sources */ - pt2d *rr=NULL; /* receivers */ - - float **vpin=NULL; /* velocity */ - float **roin=NULL; /* density */ - float **rfin=NULL; /* reflectivity */ - - float **vp=NULL; /* velocity in expanded domain */ - float **ro=NULL; /* density in expanded domain */ - float **rf=NULL; /* reflectivity in expanded domain */ - - float *bdd=NULL; /* data (background) */ - float *sdd=NULL; /* data (scattered) */ - - float **vt=NULL; /* temporary vp*vp * dt*dt */ - - float **bum,**buo,**bup,**bua,**but; /* wavefield: um = U @ t-1; uo = U @ t; up = U @ t+1 */ - float **sum,**suo,**sup,**sua,**sut; /* wavefield: um = U @ t-1; uo = U @ t; up = U @ t+1 */ - - /* cube axes */ - sf_axis at,a1,a2,as,ar; - int nt,n1,n2,ns,nr,nb; - int it,i1,i2; - float dt,d1,d2,id1,id2,dt2; - - /* linear interpolation weights/indices */ - lint2d cs,cr; - - fdm2d fdm; - abcone2d abc; /* abc */ - sponge2d spo; - - /* FD operator size */ - float co,ca2,cb2,ca1,cb1; - - int ompchunk; -#ifdef _OPENMP - int ompnth,ompath; -#endif - - sf_axis c1, c2; - int nq1,nq2; - float oq1,oq2; - float dq1,dq2; - float **uc; - - /*------------------------------------------------------------*/ - /* init RSF */ - sf_init(argc,argv); - if(! sf_getint("ompchunk",&ompchunk)) ompchunk=1; - /* OpenMP data chunk size */ - -#ifdef _OPENMP - if(! sf_getint("ompnth", &ompnth)) ompnth=0; - /* OpenMP available threads */ - -#pragma omp parallel - ompath=omp_get_num_threads(); - if(ompnth<1) ompnth=ompath; - omp_set_num_threads(ompnth); - sf_warning("using %d threads of a total of %d",ompnth,ompath); -#endif - - if(! sf_getbool("verb",&verb)) verb=false; /* verbosity flag */ - if(! sf_getbool("snap",&snap)) snap=false; /* wavefield snapshots flag */ - if(! sf_getbool("free",&free)) free=false; /* free surface flag*/ - - Fwav = sf_input ("in" ); /* wavelet */ - Fsou = sf_input ("sou"); /* sources */ - Frec = sf_input ("rec"); /* receivers */ - - Fvel = sf_input ("vel"); /* velocity */ - Fden = sf_input ("den"); /* density */ - Fref = sf_input ("ref"); /* reflectivity */ - - Fwfl = sf_output("wfl"); /* wavefield */ - Fdat = sf_output("out"); /* data */ - - Flid = sf_output("lid"); /* data (scattered) */ - Fliw = sf_output("liw"); /* wavefield (scattered) */ - - /* axes */ - at = sf_iaxa(Fwav,2); sf_setlabel(at,"t"); if(verb) sf_raxa(at); /* time */ - as = sf_iaxa(Fsou,2); sf_setlabel(as,"s"); if(verb) sf_raxa(as); /* sources */ - ar = sf_iaxa(Frec,2); sf_setlabel(ar,"r"); if(verb) sf_raxa(ar); /* receivers */ - a1 = sf_iaxa(Fvel,1); sf_setlabel(a1,"z"); if(verb) sf_raxa(a1); /* depth */ - a2 = sf_iaxa(Fvel,2); sf_setlabel(a2,"x"); if(verb) sf_raxa(a2); /* space */ - - nt = sf_n(at); dt = sf_d(at); - ns = sf_n(as); - nr = sf_n(ar); - n1 = sf_n(a1); d1 = sf_d(a1); - n2 = sf_n(a2); d2 = sf_d(a2); - - if(! sf_getint("jdata",&jdata)) jdata=1; - if(snap) { /* save wavefield every *jsnap* time steps */ - if(! sf_getint("jsnap",&jsnap)) jsnap=nt; - } - - /*------------------------------------------------------------*/ - /* expand domain for FD operators and ABC */ - if( !sf_getint("nb",&nb) || nbn1pad); sf_seto(a1,fdm->o1pad); if(verb) sf_raxa(a1); - sf_setn(a2,fdm->n2pad); sf_seto(a2,fdm->o2pad); if(verb) sf_raxa(a2); - /*------------------------------------------------------------*/ - - /* setup output data header */ - sf_oaxa(Fdat,ar,1); - sf_oaxa(Flid,ar,1); - - sf_setn(at,nt/jdata); - sf_setd(at,dt*jdata); - sf_oaxa(Fdat,at,2); - sf_oaxa(Flid,at,2); - - /* setup output wavefield header */ - if(snap) { - if(!sf_getint ("nq1",&nq1)) nq1=sf_n(a1); - if(!sf_getint ("nq2",&nq2)) nq2=sf_n(a2); - if(!sf_getfloat("oq1",&oq1)) oq1=sf_o(a1); - if(!sf_getfloat("oq2",&oq2)) oq2=sf_o(a2); - dq1=sf_d(a1); - dq2=sf_d(a2); - - c1 = sf_maxa(nq1,oq1,dq1); - c2 = sf_maxa(nq2,oq2,dq2); - - /* check if the imaging window fits in the wavefield domain */ - - uc=sf_floatalloc2(sf_n(c1),sf_n(c2)); - - sf_setn(at,nt/jsnap); - sf_setd(at,dt*jsnap); - - sf_oaxa(Fwfl,c1,1); - sf_oaxa(Fwfl,c2,2); - sf_oaxa(Fwfl,at,3); - - sf_oaxa(Fliw,c1,1); - sf_oaxa(Fliw,c2,2); - sf_oaxa(Fliw,at,3); - } - - ww =sf_floatalloc( 1); - bdd =sf_floatalloc(nr); - sdd =sf_floatalloc(nr); - - /*------------------------------------------------------------*/ - /* setup source/receiver coordinates */ - ss = (pt2d*) sf_alloc(ns,sizeof(*ss)); - rr = (pt2d*) sf_alloc(nr,sizeof(*rr)); - - pt2dread1(Fsou,ss,ns,2); /* read (x,z) coordinates */ - pt2dread1(Frec,rr,nr,2); /* read (x,z) coordinates */ - - cs = lint2d_make(ns,ss,fdm); - cr = lint2d_make(nr,rr,fdm); - - /*------------------------------------------------------------*/ - /* setup FD coefficients */ - dt2 = dt*dt; - id1 = 1/d1; - id2 = 1/d2; - - co = C0 * (id2*id2+id1*id1); - ca2= CA * id2*id2; - cb2= CB * id2*id2; - ca1= CA * id1*id1; - cb1= CB * id1*id1; - - /*------------------------------------------------------------*/ - /* setup model */ - roin=sf_floatalloc2(n1, n2 ); - ro =sf_floatalloc2(fdm->n1pad,fdm->n2pad); - sf_floatread(roin[0],n1*n2,Fden); - expand(roin,ro,fdm); - - vpin=sf_floatalloc2(n1, n2 ); - vp =sf_floatalloc2(fdm->n1pad,fdm->n2pad); - vt =sf_floatalloc2(fdm->n1pad,fdm->n2pad); - sf_floatread(vpin[0],n1*n2,Fvel); - expand(vpin,vp,fdm); - - rfin=sf_floatalloc2(n1, n2 ); - rf =sf_floatalloc2(fdm->n1pad,fdm->n2pad); - sf_floatread(rfin[0],n1*n2,Fref); - expand(rfin,rf,fdm); - - for (i2=0; i2n2pad; i2++) { - for(i1=0; i1n1pad; i1++) { - vt[i2][i1] = vp[i2][i1] * vp[i2][i1] * dt2; - } - } - - /* free surface */ - if(free) { - for (i2=0; i2n2pad; i2++) { - for(i1=0; i1nb; i1++) { - vt[i2][i1]=0; - } - } - } - - /*------------------------------------------------------------*/ - /* allocate wavefield arrays */ - bum=sf_floatalloc2(fdm->n1pad,fdm->n2pad); - buo=sf_floatalloc2(fdm->n1pad,fdm->n2pad); - bup=sf_floatalloc2(fdm->n1pad,fdm->n2pad); - bua=sf_floatalloc2(fdm->n1pad,fdm->n2pad); - - sum=sf_floatalloc2(fdm->n1pad,fdm->n2pad); - suo=sf_floatalloc2(fdm->n1pad,fdm->n2pad); - sup=sf_floatalloc2(fdm->n1pad,fdm->n2pad); - sua=sf_floatalloc2(fdm->n1pad,fdm->n2pad); - - for (i2=0; i2n2pad; i2++) { - for(i1=0; i1n1pad; i1++) { - bum[i2][i1]=0; - buo[i2][i1]=0; - bup[i2][i1]=0; - bua[i2][i1]=0; - - sum[i2][i1]=0; - suo[i2][i1]=0; - sup[i2][i1]=0; - sua[i2][i1]=0; - } - } - - /*------------------------------------------------------------*/ - /* one-way abc setup */ - abc = abcone2d_make(NOP,dt,vp,free,fdm); - /* sponge abc setup */ - spo = sponge2d_make(fdm); - - /*------------------------------------------------------------*/ - /* - * MAIN LOOP - */ - /*------------------------------------------------------------*/ - if(verb) fprintf(stderr,"\n"); - for (it=0; itompchunk) private(i2,i1) shared(fdm,bua,buo,sua,suo,co,ca2,ca1,cb2,cb1,id2,id1) -#endif - for (i2=NOP; i2n2pad-NOP; i2++) { - for(i1=NOP; i1n1pad-NOP; i1++) { - - /* 4th order Laplacian operator */ - bua[i2][i1] = - co * buo[i2 ][i1 ] + - ca2*(buo[i2-1][i1 ] + buo[i2+1][i1 ]) + - cb2*(buo[i2-2][i1 ] + buo[i2+2][i1 ]) + - ca1*(buo[i2 ][i1-1] + buo[i2 ][i1+1]) + - cb1*(buo[i2 ][i1-2] + buo[i2 ][i1+2]); - sua[i2][i1] = - co * suo[i2 ][i1 ] + - ca2*(suo[i2-1][i1 ] + suo[i2+1][i1 ]) + - cb2*(suo[i2-2][i1 ] + suo[i2+2][i1 ]) + - ca1*(suo[i2 ][i1-1] + suo[i2 ][i1+1]) + - cb1*(suo[i2 ][i1-2] + suo[i2 ][i1+2]); - - /* density term */ - bua[i2][i1] -= ( - D1(buo,i2,i1,id1) * D1(ro,i2,i1,id1) + - D2(buo,i2,i1,id2) * D2(ro,i2,i1,id2) ) / ro[i2][i1]; - sua[i2][i1] -= ( - D1(suo,i2,i1,id1) * D1(ro,i2,i1,id1) + - D2(suo,i2,i1,id2) * D2(ro,i2,i1,id2) ) / ro[i2][i1]; - } - } - - /* inject acceleration source */ - lint2d_inject1(bua,ww[0],cs); - - /* single scattering */ -#ifdef _OPENMP -#pragma omp parallel for schedule(dynamic,ompchunk) private(i2,i1) shared(fdm,bua,sua,rf) -#endif - for (i2=0; i2n2pad; i2++) { - for (i1=0; i1n1pad; i1++) { - sua[i2][i1] -= buo[i2][i1] * 2*rf[i2][i1]; - } - } - - /* step forward in time */ -#ifdef _OPENMP -#pragma omp parallel for schedule(dynamic,fdm->ompchunk) private(i2,i1) shared(fdm,bua,buo,bum,bup,sua,suo,sum,sup,vt,dt2) -#endif - for (i2=0; i2n2pad; i2++) { - for(i1=0; i1n1pad; i1++) { - bup[i2][i1] = 2*buo[i2][i1] - - bum[i2][i1] - + bua[i2][i1] * vt[i2][i1]; - - sup[i2][i1] = 2*suo[i2][i1] - - sum[i2][i1] - + sua[i2][i1] * vt[i2][i1]; - - } - } - /* circulate wavefield arrays */ - but=bum; - bum=buo; - buo=bup; - bup=but; - - sut=sum; - sum=suo; - suo=sup; - sup=sut; - - /* one-way abc apply*/ - abcone2d_apply(buo,bum,NOP,abc,fdm); - sponge2d_apply(bum, spo,fdm); - sponge2d_apply(buo, spo,fdm); - sponge2d_apply(bup, spo,fdm); - - abcone2d_apply(suo,sum,NOP,abc,fdm); - sponge2d_apply(sum, spo,fdm); - sponge2d_apply(suo, spo,fdm); - sponge2d_apply(sup, spo,fdm); - - /* extract data */ - lint2d_extract(buo,bdd,cr); - lint2d_extract(suo,sdd,cr); - - if(snap && (it+1)%jsnap==0) { - cut2d(buo,uc,fdm,c1,c2); - sf_floatwrite(uc[0],sf_n(c1)*sf_n(c2),Fwfl); - - cut2d(suo,uc,fdm,c1,c2); - sf_floatwrite(uc[0],sf_n(c1)*sf_n(c2),Fliw); - } - if( it%jdata==0) { - sf_floatwrite(bdd,nr,Fdat); - sf_floatwrite(sdd,nr,Flid); - } - } - if(verb) fprintf(stderr,"\n"); - - exit (0); -} diff --git a/user/nobody/Mmap2list.c b/user/nobody/Mmap2list.c deleted file mode 100644 index 7c21289a4b..0000000000 --- a/user/nobody/Mmap2list.c +++ /dev/null @@ -1,112 +0,0 @@ -/* */ -/* - Copyright (C) 2006 Colorado School of Mines - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -int main(int argc, char* argv[]) -{ - bool verb; - float threshold; - - sf_axis az,ax, ak,aa; - int iz,ix, ik; - float z, x; - - int nn,kk; - - sf_file Fi; - sf_file Fo; - - float **map=NULL; - float *xxx=NULL; - float *zzz=NULL; - float *rrr=NULL; - -/*------------------------------------------------------------*/ - - sf_init(argc,argv); - - if(! sf_getbool("verb",&verb)) verb=false; /* verbosity flag */ - if(! sf_getfloat("threshold",&threshold)) threshold=0; /* pick threshold */ - - Fi = sf_input ("in"); - az = sf_iaxa(Fi,1); sf_setlabel(az,"z"); if(verb) sf_raxa(az); - ax = sf_iaxa(Fi,2); sf_setlabel(ax,"x"); if(verb) sf_raxa(ax); - -/*------------------------------------------------------------*/ - map = sf_floatalloc2( sf_n(az), sf_n(ax) ); - nn = sf_n(az)* sf_n(ax); - sf_floatread(map[0],nn,Fi); -/*------------------------------------------------------------*/ -/* count */ - ik = 0; - for (ix=0; ix= threshold) ik++; - } - } - kk = ik; - -/*------------------------------------------------------------*/ - aa = sf_maxa( 3,0.,1.); if(verb) sf_raxa(aa); - ak = sf_maxa(kk,0.,1.); if(verb) sf_raxa(ak); - - Fo = sf_output("out"); - sf_oaxa(Fo,ak,1); - sf_oaxa(Fo,aa,2); - sf_putint(Fo,"n3",1); - -/*------------------------------------------------------------*/ - xxx = sf_floatalloc(kk); - zzz = sf_floatalloc(kk); - rrr = sf_floatalloc(kk); - - ik = 0; - for (ix=0; ix test threshold */ - if(SF_ABS( map[ix][iz]) >= threshold) { - ik++; - - xxx[ik] = x; - zzz[ik] = z; - rrr[ik] = map[ix][iz]; - - } - /* -> end test threshold */ - } - } - -/*------------------------------------------------------------*/ - - sf_floatwrite(xxx,kk,Fo); - sf_floatwrite(zzz,kk,Fo); - sf_floatwrite(rrr,kk,Fo); - -/*------------------------------------------------------------*/ - - free(*map); free(map); - - exit(0); -} - diff --git a/user/nobody/Mmig2.c b/user/nobody/Mmig2.c deleted file mode 100644 index bd822a27ca..0000000000 --- a/user/nobody/Mmig2.c +++ /dev/null @@ -1,141 +0,0 @@ -/* 2-D Kirchhoff time migration with antialiasing. */ -/* - Copyright (C) 2007 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -int main(int argc, char* argv[]) -{ - int nt, nx, ix, n1, it, iz, itp, itm, ntr, itr, i; - char *antialias; - float hdr[2], *trace, tt, **out; - float h_in, x_in, hx, ftm, ftp, imp; - float x, z, t, dx, ox, rx, ft; - float h, sq, ti, tx, ot, dt, tm, tp, vel; - sf_file in, mig, head; - - sf_init (argc,argv); - in = sf_input("in"); - head = sf_input("hdr"); - mig = sf_output("out"); - - if (!sf_histint(in,"n1",&nt)) sf_error("No n1= in input"); - ntr = sf_leftsize(in,1); - - if (!sf_histfloat(in,"o1",&ot)) sf_error("No o1= in input"); - if (!sf_histfloat(in,"d1",&dt)) sf_error("No d1= in input"); - - if (!sf_getint("n2",&nx)) sf_error("Need n2="); sf_putint(mig,"n2",nx); - if (!sf_getfloat("d2",&dx)) sf_error("Need d2="); sf_putfloat(mig,"d2",dx); - if (!sf_getfloat("o2",&ox)) sf_error("Need o2="); sf_putfloat(mig,"o2",ox); - - if (!sf_getint("n1",&n1)) sf_error("Need n1="); sf_putint(mig,"n1",n1); - - if (NULL == (antialias = sf_getstring("antialias"))) antialias="triangle"; - /* antialiasing type [triangle,flat,steep,none] */ - - if (!sf_getfloat("vel",&vel)) sf_error("Need vel="); - /* migration velocity */ - vel = 2./vel; - vel *= vel; - - trace = sf_floatalloc(nt); - out = sf_floatalloc2(n1,nx); - - for (i=0; i < n1*nx; i++) { - out[0][i] = 0.; - } - - for (itr=0; itr < ntr; itr++) { - sf_floatread (trace,nt,in); - sf_floatread (hdr,2,head); - - x_in = hdr[0]; - h_in = hdr[1]; - - h = h_in * h_in * vel; - - if ('t'==antialias[0]) { - /* double integration */ - tt = trace[0]; - for (it=1; it < nt; it++) { - tt += trace[it]; - trace[it] = tt; - } - tt = trace[nt-1]; - for (it=nt-2; it >=0; it--) { - tt += trace[it]; - trace[it] = tt; - } - } - - for (ix=0; ix < nx; ix++) { - x = ox + ix*dx - x_in; - rx = fabsf(x*dx) * vel; - x *= x * vel; - hx = h*x; - x += h; - - for (iz=0; iz < n1; iz++) { - z = ot + iz*dt; - - t = z*z + x; - if (t <= 0.) continue; - - sq = t*t - 4.*hx; - if (sq <= 0.) continue; - - sq = sqrtf(sq); - ti = sqrtf(0.5*(t + sq)); - - tx = rx / ti * 0.5 * (1 + (t - 2.*h)/sq); - - if ('f'==antialias[0] && tx > dt) continue; - - ft = (ti-ot)/dt; it = ft; ft -= it; - - if ( it < 0) continue; - if ( it >= nt-1) break; - - if ('t'==antialias[0]) { - tm = ti-tx-dt; - ftm = (tm-ot)/dt; itm = ftm; ftm = ftm - itm; - if (itm < 0) continue; - - tp = ti+tx+dt; - ftp = (tp-ot)/dt; itp = ftp; ftp = ftp - itp; - if (itp >= nt-1) continue; - - imp = dt/(dt+tp-tm); - imp *= imp; - - out[ix][iz] += imp*( - 2.*(1.-ft)*trace[it] + 2.*ft*trace[it+1] - - (1.-ftm)*trace[itm] - ftm*trace[itm+1] - - (1.-ftp)*trace[itp] - ftp*trace[itp+1]); - } else { - out[ix][iz] += - (1.-ft)*trace[it] + ft*trace[it+1]; - } - } /* iz */ - } /* ix */ - } /* itr */ - - sf_floatwrite(out[0],n1*nx,mig); - - exit(0); -} diff --git a/user/nobody/Mmig45.c b/user/nobody/Mmig45.c deleted file mode 100644 index 08703a419e..0000000000 --- a/user/nobody/Mmig45.c +++ /dev/null @@ -1,309 +0,0 @@ -/* Finite-difference modeling/migration: 15- and 45-degree approximation. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include "ctridiagonal.h" - -int main(int argc, char* argv[]) -{ - bool inv, hi; - int nw,nz,nx, iw,ix,iz; - float dw,dz,dx, vel0, beta, w, w1, w2, omega; - sf_complex aa, *cu=NULL, *cd=NULL, *diag=NULL, *offd=NULL; - float **depth=NULL, **vel=NULL, **voff=NULL; - ctris slv; - sf_file in=NULL, out=NULL, velocity=NULL; - - sf_init (argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_getbool("inv",&inv)) inv=false; - /* If y, modeling; if n, migration */ - if (!sf_getfloat("beta",&beta)) beta=1./12.; - /* "1/6th trick" parameter */ - if (!sf_getbool("hi",&hi)) hi=true; - /* if y, use 45-degree; n, 15-degree */ - - if (NULL != sf_getstring ("velocity")) { - /* velocity file */ - velocity = sf_input("velocity"); - } else { - velocity = NULL; - } - - if (inv) { /* modeling */ - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - - if (!sf_histint(in,"n1",&nz)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&nx)) sf_error("No n2= in input"); - if (!sf_histfloat(in,"d1",&dz)) sf_error("No d1= in input"); - if (!sf_histfloat(in,"d2",&dx)) sf_error("No d2= in input"); - - if (!sf_getint("nt",&nw)) sf_error("Need nt="); - /* Length of time axis (for modeling) */ - if (!sf_getfloat("dt",&dw)) sf_error("Need dt="); - /* Sampling of time axis for modeling) */ - - dw = 1./(dw*nw); - nw = 1+nw/2; - - sf_putint (out,"n2",nw); - sf_putfloat (out,"d2",dw); - sf_putint (out,"n1",nx); - sf_putfloat (out,"d1",dx); - - sf_settype(out,SF_COMPLEX); - } else { /* migration */ - if (SF_COMPLEX != sf_gettype(in)) sf_error("Need complex input"); - - if (!sf_histint(in,"n1",&nx)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&nw)) sf_error("No n2= in input"); - if (!sf_histfloat(in,"d1",&dx)) sf_error("No d1= in input"); - if (!sf_histfloat(in,"d2",&dw)) sf_error("No d2= in input"); - - if (NULL != velocity) { - if (!sf_histint(velocity,"n1",&nz)) - sf_error("No n1= in velocity"); - if (!sf_histfloat(velocity,"d1",&dz)) - sf_error("No d1= in velocity"); - } else { - if (!sf_getint("nz",&nz)) sf_error("Need nz="); - /* Length of depth axis (for migration, if no velocity file) */ - if (!sf_getfloat("dz",&dz)) sf_error("Need dz="); - /* Sampling of depth axis (for migration, if no velocity file) */ - } - - sf_putint (out,"n2",nx); - sf_putfloat (out,"d2",dx); - sf_putint (out,"n1",nz); - sf_putfloat (out,"d1",dz); - - sf_settype(out,SF_FLOAT); - } - - vel = sf_floatalloc2(nz,nx); - voff = sf_floatalloc2(nz,nx-1); - - if (NULL != velocity) { - sf_floatread (vel[0],nz*nx,velocity); - } else { /* constant velocity */ - if (!sf_getfloat ("vel", &vel0)) sf_error("Need vel0="); - /* Constant velocity (if no velocity file) */ - for (ix=0; ix < nx; ix++) { - for (iz=0; iz < nz; iz++) { - vel[ix][iz] = vel0; - } - } - } - - /* velocity to slowness */ - for (ix=0; ix < nx; ix++) { - for (iz=0; iz < nz; iz++) { - vel[ix][iz] = 2./vel[ix][iz]; - /* 2 from post-stack exploding reflector */ - } - } - - /* symmetrize for stability */ - for (ix=0; ix < nx-1; ix++) { - for (iz=0; iz < nz; iz++) { - voff[ix][iz] = sqrtf(vel[ix][iz]*vel[ix+1][iz]); - } - } - - dw *= 2.*SF_PI*dz; - dx = 0.25*(dz*dz)/(dx*dx); - - depth = sf_floatalloc2(nz,nx); - - cu = sf_complexalloc (nx); - cd = sf_complexalloc (nx); - diag = sf_complexalloc (nx); - offd = sf_complexalloc (nx-1); - - if (inv) { - sf_floatread(depth[0],nz*nx,in); - } else { - for (ix=0; ix < nx; ix++) { - for (iz=0; iz < nz; iz++) { - depth[ix][iz] = 0.; - } - } - } - - slv = ctridiagonal_init (nx); - - /* d.c. */ - sf_warning("frequency 1 of %d",nw); - - for (iw = 1; iw < nw; iw++) { - sf_warning("frequency %d of %d",iw+1, nw); - w = dw*iw; - - if (inv) { /* modeling */ - for (ix=0; ix < nx; ix++) { - cu[ix] = sf_cmplx(depth[ix][nz-1],0.); - } - - for (iz = nz-2; iz >= 0; iz--) { /* march up */ - - for (ix=0; ix < nx; ix++) { - w1 = w*vel[ix][iz]; - w2 = w*vel[ix][iz+1]; - omega = 0.5*(w1+w2); - aa = sf_cmplx(beta*omega,dx); -#ifdef SF_HAS_COMPLEX_H - if (hi) aa += dx*0.5*(1./w1+1./w2); - diag[ix] = omega - 2.*aa; -#else - if (hi) aa.r += dx*0.5*(1./w1+1./w2); - diag[ix].r = omega - 2.*aa.r; - diag[ix].i = - 2.*aa.i; -#endif - } - for (ix=0; ix < nx-1; ix++) { - w1 = w*voff[ix][iz]; - w2 = w*voff[ix][iz+1]; - omega = 0.5*(w1+w2); - aa = sf_cmplx(beta*omega,dx); -#ifdef SF_HAS_COMPLEX_H - if (hi) aa += dx*0.5*(1./w1+1./w2); -#else - if (hi) aa.r += dx*0.5*(1./w1+1./w2); -#endif - offd[ix] = aa; - } - /* worry about boundary conditions later */ - - cd[0] = sf_cmplx(0.,0.); - for (ix=1; ix < nx-1; ix++) { -#ifdef SF_HAS_COMPLEX_H - cd[ix] = - conjf(offd[ix-1])*cu[ix-1] + - conjf(diag[ix])*cu[ix] + - conjf(offd[ix])*cu[ix+1]; -#else - cd[ix] = sf_cadd( - sf_cmul(conjf(offd[ix-1]),cu[ix-1]), - sf_cadd(sf_cmul(conjf(diag[ix]),cu[ix]), - sf_cmul(conjf(offd[ix]),cu[ix+1]))); -#endif - } - cd[nx-1] = sf_cmplx(0.,0.); - - ctridiagonal_define (slv, diag, offd); - ctridiagonal_solve (slv, cd); - - for (ix=0; ix < nx; ix++) { - w1 = w*vel[ix][iz]; - w2 = w*vel[ix][iz+1]; - omega = 2.*(w1+w2-1./(1./w1+1/w2))/3.; -#ifdef SF_HAS_COMPLEX_H - cu[ix] = cd[ix] * sf_cmplx(cosf(omega), - -sinf(omega)) + depth[ix][iz]; -#else - cu[ix] = sf_cadd(sf_cmul(cd[ix], - sf_cmplx(cosf(omega), - -sinf(omega))), - sf_cmplx(depth[ix][iz],0.)); -#endif - } - } - - sf_complexwrite (cu,nx,out); - - } else { /* migration */ - - sf_complexread (cu,nx,in); - - for (iz=0; iz < nz-1; iz++) { /* march down */ - - for (ix=0; ix < nx; ix++) { - w1 = w*vel[ix][iz]; - w2 = w*vel[ix][iz+1]; - omega = 2.*(w1+w2-1./(1./w1+1/w2))/3.; - - depth[ix][iz] += crealf (cu[ix]); -#ifdef SF_HAS_COMPLEX_H - cd[ix] = cu[ix] * sf_cmplx(cosf(omega),sinf(omega)); -#else - cd[ix] = sf_cmul(cu[ix],sf_cmplx(cosf(omega),sinf(omega))); -#endif - } - - for (ix=0; ix < nx; ix++) { - w1 = w*vel[ix][iz]; - w2 = w*vel[ix][iz+1]; - omega = 0.5*(w1+w2); - aa = sf_cmplx(beta*omega,-dx); -#ifdef SF_HAS_COMPLEX_H - if (hi) aa += dx*0.5*(1./w1+1./w2); - diag[ix] = omega - 2.*aa; -#else - if (hi) aa.r += dx*0.5*(1./w1+1./w2); - diag[ix].r = omega - 2.*aa.r; - diag[ix].i = - 2.*aa.i; -#endif - } - for (ix=0; ix < nx-1; ix++) { - w1 = w*voff[ix][iz]; - w2 = w*voff[ix][iz+1]; - omega = 0.5*(w1+w2); - aa = sf_cmplx(beta*omega,-dx); -#ifdef SF_HAS_COMPLEX_H - if (hi) aa += dx*0.5*(1./w1+1./w2); -#else - if (hi) aa.r += dx*0.5*(1./w1+1./w2); -#endif - offd[ix] = aa; - } - /* worry about boundary conditions later */ - - cu[0] = sf_cmplx(0.,0.); - for (ix=1; ix < nx-1; ix++) { -#ifdef SF_HAS_COMPLEX_H - cu[ix] = - conjf(offd[ix-1])*cd[ix-1] + - conjf(diag[ix])*cd[ix] + - conjf(offd[ix])*cd[ix+1]; -#else - cu[ix] = - sf_cadd(sf_cmul(conjf(offd[ix-1]),cd[ix-1]), - sf_cadd(sf_cmul(conjf(diag[ix]),cd[ix]), - sf_cmul(conjf(offd[ix]),cd[ix+1]))); -#endif - } - cu[nx-1] = sf_cmplx(0.,0.); - - ctridiagonal_define (slv, diag, offd); - ctridiagonal_solve (slv, cu); - } /* iz depth loop */ - - for (ix=0; ix < nx; ix++) { - depth[ix][nz-1] += crealf (cu[ix]); - } - } /* if inverse */ - } /* iw frequency loop */ - - if (!inv) sf_floatwrite (depth[0],nz*nx,out); - - exit (0); -} diff --git a/user/nobody/Mnfill.c b/user/nobody/Mnfill.c deleted file mode 100644 index 83d89fbe4a..0000000000 --- a/user/nobody/Mnfill.c +++ /dev/null @@ -1,107 +0,0 @@ -/* Fill holes (nearest-neighbor) - pcs 2005 -*/ - -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -int main(int argc, char* argv[]) -{ - bool verb; - int fill; /* hole-filling parameter */ - float feps; - - axa az,ax,ay; /* Cartesian coordinates */ - int iz,ix,iy; - int kz,kx,ky; - int lz,lx,ly; - int jz,jx,jy; - - int k,n; - float v; - - sf_file Fh; - sf_file Ff; - - float ***hh=NULL; - - sf_init(argc,argv); - - if(! sf_getbool ( "verb",&verb )) verb=false; - if(! sf_getint ( "fill",&fill )) fill=0; - if(! sf_getfloat( "feps",&feps )) feps=0.; - - Fh = sf_input ("in"); - iaxa(Fh,&az,1); az.l="z"; if(verb) raxa(az); - iaxa(Fh,&ax,2); ax.l="x"; if(verb) raxa(ax); - iaxa(Fh,&ay,3); ay.l="y"; if(verb) raxa(ay); - - Ff = sf_output("out"); - oaxa(Ff,&az,1); - oaxa(Ff,&ax,2); - oaxa(Ff,&ay,3); - - hh=sf_floatalloc3(az.n,ax.n,ay.n); - sf_floatread(hh[0][0],az.n*ax.n*ay.n,Fh); - - /* fill holes */ - n = fill; - - for(iy=0;iy feps) { - v += hh[jy][jx][jz]; - k++; - } - } - } - } /* local loop */ - - if(k>0) hh[iy][ix][iz] = v/k; - } /* end if missing */ - - } - } - } /* global loop */ - - sf_floatwrite(hh[0][0],az.n*ax.n*ay.n,Ff); - - free(**hh); free(*hh); free(hh); - - exit (0); -} diff --git a/user/nobody/Mnmova2.c b/user/nobody/Mnmova2.c deleted file mode 100644 index 86fecea81c..0000000000 --- a/user/nobody/Mnmova2.c +++ /dev/null @@ -1,97 +0,0 @@ -#include - -int main(int argc, char* argv[]) -{ - bool adj; - int nx, nt, ix, it, i, nm, im; - float dx, dt, x0, t0, x; - float *dT=NULL, *X=NULL, *m=NULL; - - sf_file inp=NULL, out=NULL, gather=NULL; - - sf_init(argc, argv); - inp = sf_input("in"); - out = sf_output("out"); - gather = sf_input("gather"); - - /* Adjoint flag */ - if (!sf_getbool("adj",&adj)) adj=false; - - if (adj) { - /* input dT vector x^2/ (t^2-t0^2), output m vector (v^2_nmo, a)' */ - if (!sf_histint(inp,"n1",&nx)) sf_error("No n1="); - if (!sf_histint(inp,"n2",&nt)) sf_error("No n2="); - if (!sf_histfloat(inp,"d1",&dx)) sf_error("No d1="); - if (!sf_histfloat(inp,"d2",&dt)) sf_error("No d2="); - if (!sf_histfloat(inp,"o1",&x0)) sf_error("No o1="); - if (!sf_histfloat(inp,"o2",&t0)) sf_error("No o2="); - - if (!sf_getint("nm",&nm)) nm=2; - - sf_putint(out,"n1",nm); - sf_putint(out,"n2",nt); - sf_putint(out,"n3",1); - - } else { - /* input m vector (v^2_nmo, a), output dT vector x^2/(t^2-t0^2) */ - if (!sf_histint(inp,"n1",&nm)) sf_error("No n1="); - - if (!sf_histint(gather,"n1",&nx)) sf_error("No n1="); - if (!sf_histint(gather,"n2",&nt)) sf_error("No n2="); - if (!sf_histfloat(gather,"d1",&dx)) sf_error("No d1="); - if (!sf_histfloat(gather,"d2",&dt)) sf_error("No d2="); - if (!sf_histfloat(gather,"o1",&x0)) sf_error("No o1="); - if (!sf_histfloat(gather,"o2",&t0)) sf_error("No o2="); - - } - - m = sf_floatalloc(nm); - X = sf_floatalloc(nm); - dT = sf_floatalloc(nx); - - /* Initial Filter */ - if (adj) { - for(i=0; i < nm; i++) m[i]=0.0; - } else { - sf_floatread(m,nm,inp); - } - - /* Loop through t0 coordinate*/ - for (it=0; it < nt; it++) { - - /* Initial Data */ - if (adj) { - sf_floatread(dT,nx,inp); - for(i=0; i < nm; i++) { - m[i]=0.0; - } - } else { - for(i=0; i < nx; i++) dT[i]=0.0; - } - - /* Loop through x-coordinates*/ - - for (ix=0; ix < nx; ix++){ - x=(x0+ix*dx); - - X[0]=1.0; - X[1]=x*x; - - /* Loop through model parameters*/ - for (im=0; im < nm; im++){ - - /* Solve */ - if (adj) { - m[im]+=X[im]*dT[ix]; - } else { - dT[ix]+=X[im]*m[im]; - } - } - } - - if (adj) sf_floatwrite(m,nm,out); - if (!adj) sf_floatwrite(dT,nx,out); - } - - exit(0); -} diff --git a/user/nobody/Modip2.c b/user/nobody/Modip2.c deleted file mode 100644 index f7cb6e69f7..0000000000 --- a/user/nobody/Modip2.c +++ /dev/null @@ -1,139 +0,0 @@ -/* 2-D dip estimation by omnidirectional plane-wave destruction */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "opwd.h" - -int main(int argc, char *argv[]) -{ - int i, k, n1, n2, n12, n[2], niter, iter, liter, rect[2]; - float mean, a0, ai, norm, norm2, lam; - float **dat, **ang, **p1, **p2, ***den, *dena, *rat, **out; - sf_file inp, dip; - - sf_init(argc,argv); - inp = sf_input("in"); - dip = sf_output("out"); - - if (SF_FLOAT != sf_gettype(inp)) sf_error("Need float input"); - if (!sf_histint(inp,"n1",&n1)) sf_error("No n1= in input"); - if (!sf_histint(inp,"n2",&n2)) sf_error("No n2= in input"); - n12 = n1*n2; - n[0] = n1; - n[1] = n2; - - if (!sf_getint("liter",&liter)) liter=100; - /* number of linear iterations */ - if (!sf_getint("niter",&niter)) niter=10; - /* number of iterations */ - - if (!sf_getint("rect1",&rect[0])) rect[0]=1; - /* vertical smoothing */ - if (!sf_getint("rect2",&rect[1])) rect[1]=1; - /* horizontal smoothing */ - - if (!sf_getfloat("a0",&a0)) a0=0; - /* initial angle */ - - dat = sf_floatalloc2(n1,n2); - ang = sf_floatalloc2(n1,n2); - out = sf_floatalloc2(n1,n2); - - p1 = sf_floatalloc2(n1,n2); - p2 = sf_floatalloc2(n1,n2); - - den = sf_floatalloc3(n1,n2,2); - dena = sf_floatalloc(n12); - rat = sf_floatalloc(n12); - - sf_floatread(dat[0],n12,inp); - - for (i=0; i < n12; i++) { - ang[0][i] = a0; - p1[0][i] = sinf(a0); - p2[0][i] = cosf(a0); - } - - opwd_init(n1,n2); - sf_divn_init(2, n12, n, rect, liter, true); - - opwd_filter(lagrange,lagrange,NULL,NULL,p1,p2,dat,out); - - norm = 0.; - for (i=0; i < n12; i++) { - out[0][i] = dat[0][i] - out[0][i]; - norm += out[0][i]*out[0][i]; - } - - for (iter=0; iter < niter; iter++) { - sf_warning("iter=%d of %d",iter+1,niter); - - opwd_filter(lagrange_der,lagrange,NULL,NULL,p1,p2,dat,den[0]); - opwd_filter(lagrange,lagrange_der,NULL,NULL,p1,p2,dat,den[1]); - - for(i=0; i < n12; i++) { - dena[i] = den[0][0][i]*p2[0][i]-den[1][0][i]*p1[0][i]; - } - - mean = 0.; - for(i=0; i < n12; i++) { - mean += dena[i]*dena[i]; - } - mean = sqrtf (n12/mean); - - for(i=0; i < n12; i++) { - out[0][i] *= mean; - dena[i] *= mean; - } - - sf_divn (out[0],dena,rat); - - /* Choose step size */ - lam = 1.; - for (k=0; k < 8; k++) { - for(i=0; i < n12; i++) { - ai = ang[0][i] + lam*rat[i]; - if (ai < -0.5*SF_PI) ai=-0.5*SF_PI; - else if (ai > 0.5*SF_PI) ai= 0.5*SF_PI; - - p1[0][i] = sinf(ai); - p2[0][i] = cosf(ai); - } - opwd_filter(lagrange,lagrange,NULL,NULL,p1,p2,dat,out); - - norm2 = 0.; - for (i=0; i < n12; i++) { - out[0][i] = dat[0][i] - out[0][i]; - norm2 += out[0][i]*out[0][i]; - } - if (norm2 < norm) break; - lam *= 0.5; - } - - for(i=0; i < n12; i++) { - ang[0][i] += lam*rat[i]; - norm = norm2; - } - } - - sf_floatwrite(ang[0],n12,dip); - - exit(0); -} diff --git a/user/nobody/Moff2abs2.c b/user/nobody/Moff2abs2.c deleted file mode 100644 index 292793d011..0000000000 --- a/user/nobody/Moff2abs2.c +++ /dev/null @@ -1,135 +0,0 @@ -/* Transform vector-offset to absolute-offset - h = sqrt(hx^2+hy^2+hz^2) - pcs 2005 -*/ - -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -int main(int argc, char* argv[]) -{ - bool verb; - axa az,ah,aa,ahx,ahz,aj; - float h, a, hx, hz; - int iz,ih,ia; - - sf_file Fd; /* data = vector offset (hx,hz)-z */ - sf_file Fm; /* model = absolute offset ( h, a)-z */ - - int nw; /* spline order */ - int nd,id; /* data size (nd=nh *na ) */ - int nm; /* model size (nm=nhx*nhz) */ - - float *dat=NULL; - float *mod=NULL; - float **map=NULL; - -/*------------------------------------------------------------*/ - - sf_init(argc,argv); - - if(! sf_getbool("verb",&verb)) verb=false; /* verbosity flag */ - if(! sf_getint( "nw",&nw)) nw=4; /* spline order */ - - Fm = sf_input ("in"); - iaxa(Fm,&ahx,1); ahx.l="hx"; if(verb) raxa(ahx); - iaxa(Fm,&ahz,2); ahz.l="hz"; if(verb) raxa(ahz); - iaxa(Fm,&az, 3); az.l="z"; if(verb) raxa(az); - - if(!sf_getint ("nh",&ah.n)) ah.n=ahx.n + ahx.o/ahx.d; - if(!sf_getfloat("oh",&ah.o)) ah.o=0; - if(!sf_getfloat("dh",&ah.d)) ah.d=ahx.d; - ah.l="h"; - if(verb) raxa(ah); - - aa.n = 180; - aa.d = 2; - aa.o = 0; - aa.l ="a"; - if(verb) raxa(aa); - - aj.n=1; aj.o=0; aj.d=1.; aj.l=""; - - Fd = sf_output("out"); - oaxa(Fd,&ah,1); - oaxa(Fd,&aa,2); - oaxa(Fd,&az,3); - oaxa(Fd,&aj,4); - oaxa(Fd,&aj,5); - -/*------------------------------------------------------------*/ - nm = ahx.n*ahz.n; /* model size */ - nd = ah.n* aa.n; /* data size */ - sf_warning("nm=%d nd=%d",nm,nd); - - map = sf_floatalloc2(2,nd); /* mapping */ - - mod = sf_floatalloc(nm); /* model vector */ - dat = sf_floatalloc(nd); /* data vector */ - - id=0; - for(ia=0;ia - -#include "opwd.h" - -int main(int argc, char *argv[]) -{ - char *type; - sf_tris t1=NULL, t2=NULL; - interpolate interp; - int i, n1, n2, n12; - float **dat, **ang, **p1, **p2; - sf_file inp, out, dip; - - sf_init(argc,argv); - inp = sf_input("in"); - out = sf_output("out"); - - dip = sf_input("angle"); - /* dip angle */ - - if (SF_FLOAT != sf_gettype(inp)) sf_error("Need float input"); - if (!sf_histint(inp,"n1",&n1)) sf_error("No n1= in input"); - if (!sf_histint(inp,"n2",&n2)) sf_error("No n2= in input"); - n12 = n1*n2; - - if (NULL == (type = sf_getstring("interp"))) type="lagrange"; - /* interpolation type */ - - switch(type[0]) { - case 'l': - interp = lagrange; - break; - case 'b': - interp = bspline; - t1 = sf_tridiagonal_init(n1); - t2 = sf_tridiagonal_init(n2); - sf_tridiagonal_const_define(t1,0.75,0.125,true); - sf_tridiagonal_const_define(t2,0.75,0.125,true); - break; - default: - interp = NULL; - sf_error("unknown interp=%s",type); - } - - dat = sf_floatalloc2(n1,n2); - ang = sf_floatalloc2(n1,n2); - p1 = sf_floatalloc2(n1,n2); - p2 = sf_floatalloc2(n1,n2); - - sf_floatread(dat[0],n12,inp); - sf_floatread(ang[0],n12,dip); - - for (i=0; i < n12; i++) { - p1[0][i] = sinf(ang[0][i]); - p2[0][i] = cosf(ang[0][i]); - } - - opwd_init(n1,n2); - - opwd_filter(interp,interp,t1,t2,p1,p2,dat,ang); - - for (i=0; i < n12; i++) { - dat[0][i] -= ang[0][i]; - } - - sf_floatwrite(dat[0],n12,out); - - exit(0); -} diff --git a/user/nobody/Mpgen.c b/user/nobody/Mpgen.c deleted file mode 100644 index 7fcfe3d816..0000000000 --- a/user/nobody/Mpgen.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Generate stereopicks from time-migration velocities and slopes. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include - -#include - -int main (int argc, char* argv[]) -{ - bool half; - int it,ix,ih, nt,nx, nh, CDPtype; - float z, dt, t0, h, h0, dh, x, dx, x0, r, q, vv, pp, t2; - float *t, *y, *py, *ph, *p, *v; - sf_file vel, dip, tim, cmp, ydip, hdip; - - sf_init (argc,argv); - vel = sf_input("in"); - dip = sf_input("dip"); - - tim = sf_output("out"); - cmp = sf_output("cmp"); - ydip = sf_output("ydip"); - hdip = sf_output("hdip"); - - if (SF_FLOAT != sf_gettype(vel)) sf_error("Need float input"); - if (!sf_histint(vel,"n1",&nt)) sf_error("No n1= in input"); - if (!sf_histfloat(vel,"d1",&dt)) sf_error("No d1= in input"); - if (!sf_histfloat(vel,"o1",&t0)) sf_error("No o1= in input"); - - if (!sf_histint(vel,"n2",&nx)) sf_error("No n2= in input"); - if (!sf_histfloat(vel,"d2",&dx)) sf_error("No d2= in input"); - if (!sf_histfloat(vel,"o2",&x0)) sf_error("No o2= in input"); - - if (!sf_getint("nh",&nh)) nh=1; - if (!sf_getfloat("dh",&dh)) dh=dx; - if (!sf_getfloat("h0",&h0)) h0=0.; - - sf_putint(tim,"n3",nh); - sf_putfloat(tim,"d3",dh); - sf_putfloat(tim,"o3",h0); - - sf_putint(cmp,"n3",nh); - sf_putfloat(cmp,"d3",dh); - sf_putfloat(cmp,"o3",h0); - - sf_putint(ydip,"n3",nh); - sf_putfloat(ydip,"d3",dh); - sf_putfloat(ydip,"o3",h0); - - sf_putint(hdip,"n3",nh); - sf_putfloat(hdip,"d3",dh); - sf_putfloat(hdip,"o3",h0); - - if (!sf_getbool("half",&half)) half=true; - /* if y, the second axis is half-offset instead of full offset */ - - if (!half) { - dh *= 0.5; - h0 *= 0.5; - } - - CDPtype=0.5+dh/dx; - if (1 != CDPtype) sf_histint(cmp,"CDPtype",&CDPtype); - sf_warning("CDPtype=%d",CDPtype); - - t = sf_floatalloc(nt); - y = sf_floatalloc(nt); - py = sf_floatalloc(nt); - ph = sf_floatalloc(nt); - p = sf_floatalloc(nt); - v = sf_floatalloc(nt); - - - for (ih = 0; ih < nh; ih++) { - for (ix = 0; ix < nx; ix++) { - x = x0 + ix*dx; - h = h0 + (ih+0.5)*dh + (dh/CDPtype)*(ix%CDPtype); - - sf_floatread (v, nt, vel); - sf_floatread (p, nt, dip); - - for (it=0; it < nt; it++) { - z = t0 + it*dt; - - vv = 0.25*v[it]*v[it]; - pp = p[it]; - - r = 1.+pp*pp*vv; - t2 = h*h/vv + 0.5*z*(z*r+hypotf(z*r,2.*h*pp)); - q = sqrtf(t2*r-h*h/vv); - - t[it] = sqrtf(t2); - y[it] = x + pp*vv*t2/q; - py[it] = pp*q/(t[it]*r+FLT_EPSILON); - ph[it] = h/(t[it]*r*vv+FLT_EPSILON); - } - - sf_floatwrite(t, nt, tim); - sf_floatwrite(y, nt, cmp); - sf_floatwrite(py, nt, ydip); - sf_floatwrite(ph, nt, hdip); - } - } - - exit (0); -} - -/* $Id: Minmo.c 729 2004-07-29 18:22:16Z fomels $ */ diff --git a/user/nobody/Mphmig.c b/user/nobody/Mphmig.c deleted file mode 100644 index 487552aaf6..0000000000 --- a/user/nobody/Mphmig.c +++ /dev/null @@ -1,111 +0,0 @@ -#include -#include "slice.h" -#include "phs.h" -#include "nos.h" - -#define LOOP(a) for(ihx=0;ihx - -#include "pick0.h" - -int main (int argc, char *argv[]) -{ - int i1, n1, n2, n3, i2, i3, order; - float *dip, *pik; - sf_file in, out; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input"); - n3 = sf_leftsize(in,2); - - /* transpose */ - sf_putint(out,"n1",n2); - sf_putint(out,"n2",n1); - sf_putfloat(out,"o1",0.); - sf_putfloat(out,"d1",1.); - sf_putfloat(out,"o2",0.); - sf_putfloat(out,"d2",1.); - - if (!sf_getint("order",&order)) order=4; - /* Accuracy order */ - - dip = sf_floatalloc (n1); - pik = sf_floatalloc (n2); - - pick0_init (n1, n2, order); - - for (i3=0; i3 < n3; i3++) { - for (i2=0; i2 < n2; i2++) { - sf_floatread(dip,n1,in); - pick0_set (i2, dip); - } - - for (i1=0; i1 < n1; i1++) { - pick0_step0 (0, n2, (float) i1, pik); - sf_floatwrite(pik,n2,out); - } - } - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mpick2.c b/user/nobody/Mpick2.c deleted file mode 100644 index 0fabe6177a..0000000000 --- a/user/nobody/Mpick2.c +++ /dev/null @@ -1,168 +0,0 @@ -/* Automatic picking from semblance-like panels. - -Takes: rect1=1 rect2=1 ... - -rectN defines the size of the smoothing stencil in N-th dimension. -*/ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "dynprog2.h" -#include "divn.h" - -int main(int argc, char* argv[]) -{ - int dim, n[SF_MAX_DIM], rect[SF_MAX_DIM]; - int it, niter, nm, n1, n2, n3, n4, i4, i3, i2, i1, i, gate, i0, **ipick; - float ***scan, ***weight, *pick, *ampl, *pick2, o2, d2, an, asum, a, vel0; - bool smooth; - char key[6], *label; - sf_file scn, pik; - - sf_init(argc,argv); - scn = sf_input("in"); - pik = sf_output("out"); - - if (SF_FLOAT != sf_gettype(scn)) sf_error("Need float input"); - dim = sf_filedims (scn,n); - if (dim < 3) sf_error("Need at least three dimensions"); - - n4 = 1; - for (i=3; i < dim; i++) { - n4 *= n[i]; - } - - n1 = n[0]; - n2 = n[1]; - n3 = n[2]; - nm = n1*n3*n4; - - if (!sf_histfloat(scn,"o2",&o2)) o2=0.; - if (!sf_histfloat(scn,"d2",&d2)) d2=1.; - - if (!sf_getfloat("vel0",&vel0)) vel0=o2; - /* surface velocity */ - i0 = 0.5 + (vel0-o2)/d2; - if (i0 < 0) i0=0; - if (i0 >= n2) i0=n2-1; - - sf_putint(pik,"n2",1); - if (NULL != (label = sf_histstring(scn,"label2"))) - sf_putstring(pik,"label",label); - if (NULL != (label = sf_histstring(scn,"unit2"))) - sf_putstring(pik,"unit",label); - - for (i=1; i < dim-1; i++) { - n[i] = n[i+1]; - } - dim--; - - for (i=0; i < dim; i++) { - if (n[i] > 1) { - snprintf(key,6,"rect%d",i+1); - if (!sf_getint(key,rect+i)) rect[i]=1; - } else { - rect[i]=1; - } - } - - if (!sf_getint("niter",&niter)) niter=100; - /* number of iterations */ - - if (!sf_getfloat("an",&an)) an=1.; - /* axes anisotropy */ - if (!sf_getint("gate",&gate)) gate=3; - /* picking gate */ - if (!sf_getbool("smooth",&smooth)) smooth=true; - /* if apply smoothing */ - - scan = sf_floatalloc3(n1,n2,n3); - weight = sf_floatalloc3(n2,n3,n1); - - dynprog2_init(n1,n2,n3,gate,gate,an,1.); - - ipick = sf_intalloc2(n1,n3); - - if (smooth) { - pick = sf_floatalloc(nm); - pick2 = sf_floatalloc(nm); - ampl = sf_floatalloc(nm); - - divn_init(dim,nm,n,rect,niter); - } else { - pick = NULL; - pick2 = sf_floatalloc(n1); - ampl = NULL; - } - - for (i4=0; i4 < n4; i4++) { - sf_warning("record %d of %d",i4+1,n4); - - sf_floatread(scan[0][0],n1*n2*n3,scn); - - /* transpose and reverse */ - for (i3=0; i3 < n3; i3++) { - for (i2=0; i2 < n2; i2++) { - for (i1=0; i1 < n1; i1++) { - weight[i1][i3][i2] = expf(-scan[i3][i2][i1]); - } - } - } - - dynprog2(i0, weight); - dynprog2_traj(ipick); - - for (i3=0; i3 < n3; i3++) { - if (smooth) { - for (i1=0; i1 < n1; i1++) { - i = i1 + n1*(i3+i4*n3); - it = ipick[i3][i1]; - pick[i] = it; - ampl[i] = scan[i1][it][i3]; - } - } else { - for (i1=0; i1 < n1; i1++) { - pick2[i1] = o2+ipick[i3][i1]*d2; - } - sf_floatwrite(pick2,n1,pik); - } - } - - - if (smooth) { - /* normalize amplitudes */ - asum = 0.; - for (i = 0; i < nm; i++) { - a = ampl[i]; - asum += a*a; - } - asum = sqrtf (asum/nm); - for(i=0; i < nm; i++) { - ampl[i] /= asum; - pick[i] = (o2+pick[i]*d2)*ampl[i]; - } - - divn(pick,ampl,pick2); - - sf_floatwrite(pick2,nm,pik); - } - } - - exit(0); -} diff --git a/user/nobody/Mpickd.c b/user/nobody/Mpickd.c deleted file mode 100644 index 7b4589b6b7..0000000000 --- a/user/nobody/Mpickd.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Automatic traveltime picking (yet another) - -Takes: < input.rsf > output.rsf - -*/ - -#include - -#include "pick0.h" - -int main (int argc, char *argv[]) -{ - int n1, n2, n3, i2, i3, order; - float *trace; - sf_file in, out; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input"); - n3 = sf_leftsize(in,2); - - if (!sf_getint("order",&order)) order=4; - /* Accuracy order */ - - trace = sf_floatalloc (n1); - - pick0_init (n1, n2, order); - - for (i3=0; i3 < n3; i3++) { - for (i2=0; i2 < n2; i2++) { - sf_floatread(trace,n1,in); - pick0_set (i2, trace); - } - - for (i2=0; i2 < n2; i2++) { - pick0_delta (i2, trace); - sf_floatwrite(trace,n1,out); - } - } - - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mpradon.c b/user/nobody/Mpradon.c deleted file mode 100644 index 449f5fc298..0000000000 --- a/user/nobody/Mpradon.c +++ /dev/null @@ -1,136 +0,0 @@ -/* Phase-space Radon transform */ -/* - Copyright (C) 2007 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "triangle2.h" - -int main(int argc, char* argv[]) -{ - bool verb; - int nt, nx, np, n3, i, it, ix, ip, i3, ntx, ntp; - int interp, rect1, rect2, niter; - float t0, dt, t, x0, dx, x, p0, dp, p, eps; - float *dtx, *dtp, **tp, **tx, *pp; - sf_file in, dip, out, dip2; - - sf_init(argc,argv); - in = sf_input("in"); - dip = sf_input("dip"); - out = sf_output("out"); - - /* allocations */ - if (!sf_histint(in,"n1",&nt)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&nx)) sf_error("No n2= in input"); - n3 = sf_leftsize(in,2); - ntx = nt*nx; - - if (!sf_histfloat(in,"o1",&t0)) sf_error("No o1= in input"); - if (!sf_histfloat(in,"d1",&dt)) sf_error("No d1= in input"); - if (!sf_histfloat(in,"o2",&x0)) sf_error("No o2= in input"); - if (!sf_histfloat(in,"d2",&dx)) sf_error("No d2= in input"); - - if (!sf_getint("np",&np)) sf_error("Need np="); - /* number of slopes */ - if (!sf_getfloat("p0",&p0)) sf_error("Need p0="); - /* first slope */ - if (!sf_getfloat("dp",&dp)) sf_error("Need dp="); - /* slope increment */ - ntp = nt*np; - - if (!sf_getint("interp",&interp)) interp=2; - /* interpolation length */ - - if (!sf_getint("rect1",&rect1)) rect1=3; - if (!sf_getint("rect2",&rect2)) rect2=3; - /* smoothing length for shaping */ - - if (!sf_getbool("verb",&verb)) verb=true; - /* verbosity flag */ - - if (!sf_getfloat("eps",&eps)) eps=1./ntx; - /* regularization parameter */ - - if (!sf_getint("niter",&niter)) niter=100; - /* number of iterations */ - - triangle2_init(rect1, rect2, nt, np, 1); - sf_conjgrad_init(ntp, ntp, ntx, ntx, eps, FLT_EPSILON, verb, false); - - sf_putint(out,"n2",np); - sf_putfloat(out,"o2",p0); - sf_putfloat(out,"d2",dp); - - if (NULL != sf_getstring("dip2")) { - dip2 = sf_output("dip2"); - sf_putint(dip2,"n2",np); - sf_putfloat(dip2,"o2",p0); - sf_putfloat(dip2,"d2",dp); - } else { - dip2 = NULL; - } - - dtx = sf_floatalloc(ntx); - dtp = sf_floatalloc(ntp); - pp = sf_floatalloc(ntp); - tp = sf_floatalloc2(2,ntx); - tx = sf_floatalloc2(2,ntp); - - for (i3=0; i3 < n3; i3++) { - /* push slope */ - sf_floatread(dtx,ntx,dip); - - for (i=ix=0; ix < nx; ix++) { - x = x0+ix*dx; - for (it=0; it < nt; it++, i++) { - t = t0+it*dt; - - p = dtx[i]*dt/dx; - dtx[i] = -x*dp/dt; - - tp[i][0] = t-p*x; - tp[i][1] = p; - } - } - - sf_int2_init(tp, t0,p0, dt,dp, nt,np, sf_spline_int, interp, ntx); - sf_conjgrad(NULL, sf_int2_lop, triangle2_lop, - pp, dtp, dtx, niter); - if (NULL != dip2) sf_floatwrite(dtp,ntp,dip2); - sf_int2_close(); - - /* pull data */ - sf_floatread(dtx,ntx,in); - for (i=ip=0; ip < np; ip++) { - p = p0+ip*dp; - for (it=0; it < nt; it++, i++) { - t = t0+it*dt; - x = -dtp[i]*dt/dp; - - tx[i][0] = t+p*x; - tx[i][1] = x; - } - } - sf_int2_init(tx, t0,x0, dt,dx, nt,nx, sf_spline_int, interp, ntp); - sf_int2_lop(false,false,ntx,ntp,dtx,dtp); - sf_floatwrite(dtp,ntp,out); - sf_int2_close(); - } - - exit(0); -} diff --git a/user/nobody/Mrcat.py b/user/nobody/Mrcat.py deleted file mode 100755 index 379e28bda4..0000000000 --- a/user/nobody/Mrcat.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -'Recursive sfcat (useful for a long list of files)' - -## Copyright (C) 2007 University of Texas at Austin -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -import os,sys,string,tempfile -from subprocess import Popen, call -import rsf.path, rsf.prog - -bindir = os.path.join(rsf.prog.RSFROOT,'bin') -sfcat = os.path.join(bindir,'sfcat') -sfrm = os.path.join(bindir,'sfrm') -datapath = rsf.path.datapath().rstrip('/') - -def rcat(files,options,out): - 'Call sfcat recursively on a list of files' - global sfcat, sfrm, datapath - if len(files) <= 3: - p = Popen([sfcat]+options+files,stdout=out,close_fds=True) - p.wait() - else: - middle = len(files)/2 - first = files[:middle] - secon = files[middle:] - fd,ffile = tempfile.mkstemp(dir=datapath) - sd,sfile = tempfile.mkstemp(dir=datapath) - rcat(first,options,fd) - rcat(secon,options,sd) - rcat([ffile,sfile],options,out) - call([sfrm,ffile,sfile]) - -if __name__ == "__main__": - options = [] - files = [] - for arg in sys.argv[1:]: - if '=' in arg: - options.append(arg) - else: - files.append(arg) - rcat(files,options,1) - - sys.exit(0) - - diff --git a/user/nobody/Mrwemete2d.c b/user/nobody/Mrwemete2d.c deleted file mode 100644 index 3d51f91642..0000000000 --- a/user/nobody/Mrwemete2d.c +++ /dev/null @@ -1,109 +0,0 @@ -/* 2-D metric tensor */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include - -#define LOOP1( a) for(iq1=0;iq1 - -#include - -int main (int argc, char* argv[]) -{ - int n1, n2, i1, i2; - float a, z0, y, d2, d1, t, z, s, g, s0, w; - float sina, cosa, sin2a, sina2, sina4, cosa2; - float *trace; - sf_file out; - - /* plane reflector: z = z0 + (x-x0)*tan(a) */ - /* slowness: s = sqrt(s0^2 + 2*g*z) */ - - sf_init (argc,argv); - out = sf_output("out"); - - if (!sf_getint("n1",&n1)) sf_error("Need n1="); - if (!sf_getint("n2",&n2)) sf_error("Need n2="); - - if (!sf_getfloat("d1",&d1)) sf_error("Need d1="); - if (!sf_getfloat("d2",&d2)) sf_error("Need d2="); - - sf_putint(out,"n1",n1); sf_putfloat(out,"d1",d1); sf_putfloat(out,"o1",0.); - sf_putint(out,"n2",n2); sf_putfloat(out,"d2",d2); sf_putfloat(out,"o2",0.); - sf_setformat(out,"native_float"); - - if (!sf_getfloat("s0",&s0)) sf_error("Need s0="); - s0 *= s0; - if (!sf_getfloat("g",&g)) g=0; - - if (!sf_getfloat("z0",&z0)) sf_error("Need z0="); - if (!sf_getfloat("a",&a)) a=0.; - a *= SF_PI/180.; /* degrees to radians */ - - sina = sinf(a); - cosa = cosf(a); - sin2a = 2.*sina*cosa; - sina2 = sina*sina; - sina4 = sin2a*sin2a; - cosa2 = cosa*cosa; - - trace = sf_floatalloc(n1); - - for (i2=0; i2 < n2; i2++) { - for (i1=0; i1 < n1; i1++) { - trace[i1] = 0.; - } - - if (sina==0.) { - z = z0; - } else { - y = z0*cosa/sina + i2*d2; - - z = s0*sin2a - 4.*g*y*sina4; - - if (s0*s0+g*y*z < 0.) { - sf_floatwrite(trace,n1,out); - continue; - } - - z = y*sina/(1.+3.*sina2)* - (cosa*(1.+2.*sina2) + sina*z/(s0+sqrtf(s0*s0+g*y*z))); - } - - s = sqrtf(s0+2.*g*z); - - sf_warning("depth=%g slowness=%g",z,s); - - if (z < z0) { - sf_floatwrite(trace,n1,out); - continue; - } - - if (s*s*cosa2 - 2.*g*z < 0.) { - sf_floatwrite(trace,n1,out); - continue; - } - - t = sqrtf(s*s*cosa2 - 2.*g*z); - - t = 2.*z*(2.*(s*s - g*z) - (s*cosa - t)*(s*cosa - t)/3.)/(s*cosa + t); - - w = t/d1; - i1 = w; - w -= i1; - - if (i1>=0 && i1 < n1-1) { - trace[i1] = (1.-w)/t; - trace[i1+1] = w/t; - } - - sf_floatwrite(trace,n1,out); - } - - exit(0); -} - -/* $Id$ */ diff --git a/user/nobody/Msag.c b/user/nobody/Msag.c deleted file mode 100644 index 7c8130d7ce..0000000000 --- a/user/nobody/Msag.c +++ /dev/null @@ -1,99 +0,0 @@ -/* Simple v(z) synthetic. - -Notes about theory: - -v = v0 + alpha * z -t = 2 * \int_0^z dz/(v0+alpha*z) -t = 2 * log( 1 + alpha*z/v0 ) / alpha -exp(alpha*tmax/2.) = 1 + alpha * zmax/ v0 -v0 * (exp( alpha * tmax/2.) - 1) /alpha = zmax = dz * (nz+1) -*/ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -int main(int argc, char* argv[]) -{ - int nt, nx, it,ix; - float t,t0,dt, x,x0,dx, z; - float tmax,xmax,delx, dxdz,v0,alpha; - float** datr; - sf_file sag; - - sf_init (argc, argv); - sag = sf_output("out"); - - if (!sf_getint ("nt",&nt)) nt = 200; - /* Number of samples in time */ - if (!sf_getint ("nx",&nx)) nx = 200; - /* Number of samples in distance */ - - if (!sf_getfloat ("tmax",&tmax)) tmax = 4.; - /* Maximum time */ - if (!sf_getfloat ("xmax",&xmax)) xmax = 4.; - /* Maximum distance */ - if (!sf_getfloat ("delx",&delx)) delx = .5; - /* Increment in x */ - if (!sf_getfloat ("dxdz",&dxdz)) dxdz = 1.; - /* Slope for the line of diffractors */ - if (!sf_getfloat ("v0",&v0)) v0 = 1.5; - /* Initial velocity */ - if (!sf_getfloat ("alpha",&alpha)) alpha = 0.; - /* Velocity gradient */ - - t0 = 0; - x0 = 0.; - dt = tmax / nt; - dx = xmax / nx; - - sf_setformat(sag,"native_float"); - sf_putint (sag,"n1",nt); - sf_putfloat (sag,"o1",t0); - sf_putfloat (sag,"d1",dt); - sf_putint (sag,"n2",nx); - sf_putfloat (sag,"o2",x0); - sf_putfloat (sag,"d2",dx); - sf_putstring (sag,"label1","Pseudo-depth (s)"); - sf_putstring (sag,"label2","Lateral (km)"); - - datr = sf_floatalloc2(nt,nx); - for (ix=0; ix < nx; ix++) { - for (it=0; it < nt; it++) { - datr[ix][it] = 0.; - } - } - - for (x = delx/2; x <= xmax; x+= delx) { - z = x / dxdz; - if( alpha != 0.) { - t = 2. * log( 1. + alpha * z / v0) / alpha; - } else { - t = 2. * z / v0; - } - it = 0.5 + t/dt; - ix = 0.5 + x/dx; - if(ix < nx && it < nt) datr[ix][it] += 1.; - } - - sf_floatwrite (datr[0],nt*nx,sag); - - exit (0); -} diff --git a/user/nobody/Msegy2rsf.c b/user/nobody/Msegy2rsf.c deleted file mode 100644 index eb8f577b79..0000000000 --- a/user/nobody/Msegy2rsf.c +++ /dev/null @@ -1,149 +0,0 @@ -/* Convert a SEG-Y dataset to RSF. -Same as sfsegyread su=n. Split from sfsuread to decrease the number of -options of sfsuread and to improve readability -of both codes. See sfsegyread help for more info.*/ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef _LARGEFILE_SOURCE -#define _LARGEFILE_SOURCE -#endif -#include -#include -#include -#include -#include "su_or_segy_to_rsf.h" - -int -main (int argc, char *argv[]) -{ - const bool su = false; - bool verb, xdr; - char ahead[SF_EBCBYTES], bhead[SF_BNYBYTES]; - char *headname, *filename; - int format, ns, ntr, itrace[SF_NKEYS]; - off_t pos, nsegy; - FILE *head, *file; - float dt; - - /**** Start common code with su2rsf (16 lines) ****/ - sf_init (argc, argv); - - if (!sf_getbool ("verb", &verb)) - verb = false; - /* Verbosity flag */ - - if (!sf_getbool ("endian", &xdr)) - xdr = true; - /* Whether to automatically estimate endianness or not */ - if (xdr) - endian (); - - if (NULL == (filename = sf_getstring ("tape"))) /* input data */ - sf_error ("Need to specify tape="); - - if (NULL == (file = fopen (filename, "rb"))) - sf_error ("Cannot open \"%s\" for reading:", filename); - - pos = readfilesize (file); -/**** End common code with su2rsf ****/ - if (SF_EBCBYTES != fread (ahead, 1, SF_EBCBYTES, file)) - sf_error ("Error reading ebcdic header"); - - ebc2asc (SF_EBCBYTES, ahead); - - if (NULL == (headname = sf_getstring ("hfile"))) - headname = "header"; - /* output text data header file */ - - if (NULL == (head = fopen (headname, "w"))) - sf_error ("Cannot open file \"%s\" for writing ascii header:", headname); - - if (SF_EBCBYTES != fwrite (ahead, 1, SF_EBCBYTES, head)) - sf_error ("Error writing ascii header"); - fclose (head); - - if (verb) - sf_warning ("ASCII header written to \"%s\"", headname); - - if (SF_BNYBYTES != fread (bhead, 1, SF_BNYBYTES, file)) - sf_error ("Error reading binary header"); - - if (NULL == (headname = sf_getstring ("bfile"))) - headname = "binary"; - /* output binary data header file */ - - if (NULL == (head = fopen (headname, "wb"))) - sf_error ("Cannot open file \"%s\" for writing binary header:", headname); - - if (SF_BNYBYTES != fwrite (bhead, 1, SF_BNYBYTES, head)) - sf_error ("Error writing binary header"); - fclose (head); - - if (verb) - sf_warning ("Binary header written to \"%s\"", headname); - - if (!sf_getint ("format", &format)) - format = segyformat (bhead); - /* [1,2,3,5] Data format. The default is taken from binary header. - 1 is IBM floating point - 2 is 4-byte integer - 3 is 2-byte integer - 5 is IEEE floating point - */ - - switch (format) - { - case 1: - if (verb) - sf_warning ("Assuming IBM floating point format"); - break; - case 2: - if (verb) - sf_warning ("Assuming 4 byte integer format"); - break; - case 3: - if (verb) - sf_warning ("Assuming 2 byte integer format"); - break; - case 5: - if (verb) - sf_warning ("Assuming IEEE floating point format"); - break; - default: - sf_error ("Nonstandard format: %d", format); - break; - } - - if (!sf_getint ("ns", &ns)) - ns = segyns (bhead); - /* Number of samples. The default is taken from binary header */ - if (0 >= ns) - sf_error ("Number of samples is not set in binary header"); - - if (verb) - sf_warning ("Detected trace length of %d", ns); - - dt = segydt (bhead); - nsegy = SF_HDRBYTES + ((3 == format) ? ns * 2 : ns * 4); - ntr = (pos - SF_EBCBYTES - SF_BNYBYTES) / nsegy; - - su_or_segy_to_rsf (verb, su, ntr, format, ns, itrace, nsegy, file, dt); - - exit (0); -} diff --git a/user/nobody/Mseislet97.c b/user/nobody/Mseislet97.c deleted file mode 100644 index 0476c1bc0f..0000000000 --- a/user/nobody/Mseislet97.c +++ /dev/null @@ -1,109 +0,0 @@ -/* CDF 9/7 biorthogonal seislet transform */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "seislet97.h" - -int main(int argc, char *argv[]) -{ - int i1, n1, i2, n2, i3, n3, n12, niter; - bool inv, adj, unit; - char *type; - float *pp, *qq, **ww, *hilb, **dd, eps; - sf_file in, out, dip; - - sf_init(argc,argv); - - in = sf_input("in"); - out = sf_output("out"); - dip = sf_input("dip"); - - if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input"); - n3 = sf_leftsize(in,2); - n12 = n1*n2; - - pp = sf_floatalloc(n12); - qq = sf_floatalloc(n12); - dd = sf_floatalloc2(n1,n2); - - if (!sf_getbool("inv",&inv)) inv=false; - /* if y, do inverse transform */ - - if (!sf_getbool("adj",&adj)) adj=false; - /* if y, do adjoint transform */ - - if (!sf_getfloat("eps",&eps)) eps=0.01; - /* regularization */ - - if (!sf_getint("niter",&niter)) niter=0; - /* number of iterations */ - - if (adj && 0 != niter) { - ww = sf_floatalloc2(n1,n2); - hilb = sf_floatalloc(n1); - sf_weight_init(ww[0]); - sf_hilbert_init(n1, 6, 1.); - } else { - ww = NULL; - hilb = NULL; - } - - if (!sf_getbool("unit",&unit)) unit=false; - /* if y, use unitary scaling */ - - if (NULL == (type=sf_getstring("type"))) type="biorthogonal"; - /* [biorthogonal] wavelet type, the default is biorthogonal */ - - seislet97_init(n1,n2,inv,unit,eps,type[0]); - seislet97_set(dd); - - for (i3=0; i3 < n3; i3++) { - sf_floatread(pp,n12,in); - sf_floatread(dd[0],n12,dip); - - if (adj) { - if (0==niter) { - seislet97_lop(adj,false,n12,n12,qq,pp); - } else { - sf_solver (seislet97_lop,sf_cgstep, - n12,n12,qq,pp,niter,"verb",true,"end"); - sf_cgstep_close(); - - /* find envelope */ - for (i2=0; i2 < n2; i2++) { - sf_hilbert(qq+i2*n1,hilb); - for (i1=0; i1 < n1; i1++) { - ww[i2][i1] = hypotf(qq[i1+i2*n1],hilb[i1]); - } - } - - sf_solver_prec (seislet97_lop,sf_cgstep,sf_weight_lop,n12, - n12,n12,qq,pp,niter,0.,"verb",true,"end"); - sf_cgstep_close(); - } - } else { - seislet97_lop(adj,false,n12,n12,pp,qq); - } - sf_floatwrite(qq,n12,out); - } - - exit(0); -} diff --git a/user/nobody/Mshot2cmp3.c b/user/nobody/Mshot2cmp3.c deleted file mode 100644 index 4ee1d0ca35..0000000000 --- a/user/nobody/Mshot2cmp3.c +++ /dev/null @@ -1,194 +0,0 @@ -/* Convert shots to CMPs for regular 3-D geometry. - -The axes in the input are {time, offset_x, offset_y, shot_x, shoty} -The axes in the output are {time, offset_x, offset_y, midpoint_x, midpoint_y} -*/ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -int main(int argc, char* argv[]) -{ - - off_t pos; - bool sign, half; - int nsx, nsy, nmx, nmy, nhx, nhy, nmhx, nmhy, nt; - int isx, isy, imx, imy, ihx, ihy; - float osx, osy, dsx, dsy, omx, omy, dmx, dmy, ohx, ohy, dhx, dhy, dmhx, dmhy, binx, biny; - float s_xmin, s_ymin, r_xmin, r_ymin, s_xmax, s_ymax, r_xmax, r_ymax, survey_xmin, survey_ymin, survey_xmax, survey_ymax; - char *trace, *zero; - sf_file in, out; - - - sf_init(argc,argv); - in = sf_input ( "in"); - out = sf_output("out"); - sf_warning("WARNING: This 3-D CMP sorting code is not yet ready for use--this message will be removed when it is. "); - - if (!sf_histint (in,"n1",&nt)) sf_error("No n1= in input"); - /* Number of samples per trace */ - - if (!sf_histint (in,"n2",&nhx)) sf_error("No n2= in input"); - /* Number of offsets per shot gather in x-direction*/ - if (!sf_histfloat(in,"o2",&ohx)) sf_error("No o2= in input"); - /* First offset x-component */ - if (!sf_histfloat(in,"d2",&dhx)) sf_error("No d2= in input"); - /* Offset increment in x-direction */ - if (!sf_histint (in,"n3",&nhy)) sf_error("No n3= in input"); - /* Number of offsets per shot gather in y-direction*/ - if (!sf_histfloat(in,"o3",&ohy)) sf_error("No o3= in input"); - /* First offset y-component */ - if (!sf_histfloat(in,"d3",&dhy)) sf_error("No d3= in input"); - /* Offset increment in y-direction */ - if (!sf_histint (in,"n4",&nsx)) sf_error("No n4= in input"); - /* Number of sources along x-direction*/ - if (!sf_histfloat(in,"d4",&dsx)) sf_error("No d4= in input"); - /* Source spacing in x-direction*/ - if (!sf_histfloat(in,"o4",&osx)) sf_error("No o4= in input"); - /* First source x-coordinate*/ - if (!sf_histint (in,"n5",&nsy)) sf_error("No n5= in input"); - /* Number of sources along y-direction*/ - if (!sf_histfloat(in,"d5",&dsy)) sf_error("No d5= in input"); - /* Source spacing in y-direction*/ - if (!sf_histfloat(in,"o5",&osy)) sf_error("No o5= in input"); - /* First source y-coordinate*/ - - if (!sf_getfloat("binx",&binx)) sf_error("No x bin size specified. Please set binx="); - /*Number of bins along x-direction*/ - if (!sf_getfloat("biny",&biny)) sf_error("No y bin size specified. Please set biny="); - /*Number of bins along y-direction*/ - - if (!sf_getbool("positive",&sign)) sign=true; - /* initial offset orientation: - yes is generally for off-end surveys, where the first offsets are positive. - no is generally for split-spread surveys with first negative then positive offsets. */ - - if (!sf_getbool("half",&half)) half=true; - /* if y, the second axis is half-offset instead of full offset*/ - - if (!half) { - dhx /= 2; - ohx /= 2; - dhy /= 2; - ohy /= 2; - } - - s_xmin = osx; - s_ymin = osy; - s_xmax = osx+(nsx*dsx); - s_ymax = osy+(nsy*dsy); - - r_xmin = s_xmin+2*ohx; - r_ymin = s_ymin+2*ohy; - r_xmax = s_xmax+2*(ohx+dhx*nhx); - r_ymax = s_ymax+2*(ohy+dhy*nhy); - - if (s_xmin <= r_xmin){ - survey_xmin = s_xmin; - }else{ - survey_xmin = r_xmin; - } - - if (s_ymin <= r_ymin){ - survey_ymin = s_ymin; - }else{ - survey_ymin = r_ymin; - } - - if (s_xmax <= r_xmax){ - survey_xmax = r_xmax; - }else{ - survey_xmax = s_xmax; - } - - if (s_ymax <= r_ymax){ - survey_ymax = r_ymax; - }else{ - survey_ymax = s_ymax; - } - - dmx = (survey_xmax - survey_xmin)/binx; - dmy = (survey_ymax - survey_ymin)/biny; - omx = survey_xmin + dmx/2.; - omy = survey_ymin + dmy/2.; - nmx = binx; - nmy = biny; - nmhx = (int)(nhx*nsx/nmx); - nmhy = (int)(nhy*nsy/nmy); - dmhx = dhx; - dmhy = dhy; - - sf_putint (out,"n2",nmhx); - sf_putint (out,"n3",nmhy); - sf_putfloat(out,"d2",dmhx); - sf_putfloat(out,"d3",dmhy); - - sf_putint (out,"n4",nmx); - sf_putint (out,"n5",nmy); - sf_putfloat(out,"d4",dmx); - sf_putfloat(out,"d5",dmy); - sf_putfloat(out,"o4",omx); - sf_putfloat(out,"o5",omy); - - sf_putstring(out,"label3","hx"); - sf_putstring(out,"label4","hy"); - sf_putstring(out,"label5","mx"); - sf_putstring(out,"label6","my"); - - nt *= sf_esize(in); - - trace = sf_charalloc(nt); - zero = sf_charalloc(nt); - memset(zero,0,nt); - - sf_fileflush(out,in); - sf_setform( in,SF_NATIVE); - sf_setform(out,SF_NATIVE); - - sf_unpipe(in,(off_t) nsx*nsy*nhx*nhy*nt); - pos = sf_tell(in); - - for (isx=0; isx < nsx; isx++) { - for (isy=0; isy < nsy; isy++) { - - for (ihx=0; ihx < nhx; ihx++) { - for (ihy=0; ihy < nhy; ihy++) { - - imx = (int)((isx + ihx)/2.0); - imy = (int)((isy + ihy)/2.0); - - if (isx >= 0 && isx < nsx && ihx < nhx) { - if (isy >= 0 && isy < nsy && ihy < nhy) { - sf_seek(in,pos+((isx*nhx+ihx)+(isy*nhy+ihy))*nt,SEEK_SET); - sf_charread(trace,nt,in); - sf_charwrite(trace,nt,out); - } - } else { - sf_charwrite(zero,nt,out); - } - } - } - } - } - - - exit(0); -} diff --git a/user/nobody/Mslowft.c b/user/nobody/Mslowft.c deleted file mode 100644 index b1a29300bc..0000000000 --- a/user/nobody/Mslowft.c +++ /dev/null @@ -1,146 +0,0 @@ -/* Slow FT transform on the first axis. - -Input and output are complex data. The input is padded by factor pad. -*/ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -int main (int argc, char **argv) -{ - int nx, n1, n2; /* dimensions */ - int ix, i2, ik; /* loop counters */ - int nk; /* number of wavenumbers */ - int npad; /* padding */ - - float dx; /* space sampling interval */ - float dk; /* wavenumber sampling interval */ - float x0; /* staring space */ - float k0; /* starting wavenumber */ - float wt; /* Fourier scaling */ - float x, k; - - sf_complex *ck, *cx; /* frequency-wavenumber */ - sf_complex shift; /* phase shift */ - - bool inv; /* forward or inverse */ - bool sym; /* symmetric scaling */ - int sign; /* transform sign */ - - sf_file in, out; - - sf_init(argc,argv); - in = sf_input ( "in"); - out = sf_output("out"); - - if (SF_COMPLEX != sf_gettype(in)) sf_error ("Need complex input"); - - if (!sf_getbool("inv",&inv)) inv = false; - /* if y, perform inverse transform */ - - if (!sf_getbool("sym",&sym)) sym=false; - /* if y, apply symmetric scaling to make the FFT operator Hermitian */ - - if (!sf_getint("sign",&sign)) sign = inv? 1: 0; - /* transform sign (0 or 1) */ - - if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input"); - - n2 = sf_leftsize(in,1); - - if (inv) { - nk = n1; - if (!sf_histfloat(in,"d1",&dk)) sf_error("No d1= in input"); - if (!sf_histfloat(in,"o1",&k0)) sf_error("No o1= in input"); - if (!sf_histint (in,"m1",&nx)) nx=nk; - if (!sf_histfloat(in,"c1",&x0)) x0 = 0.; - dx = 1./(nk*dk); - - sf_putint (out,"n1",nx); - sf_putfloat (out,"d1",dx); - sf_putfloat (out,"o1",x0); - } else { - nx = n1; - if (!sf_histfloat(in,"d1",&dx)) sf_error("No d1= in input"); - if (!sf_histfloat(in,"o1",&x0)) x0 = 0.; - - sf_putint(out,"m1",nx); - sf_putfloat(out,"c1",x0); - - if (!sf_getint("pad",&npad)) npad=2; - /* padding factor */ - - /* determine wavenumber sampling */ - nk = nx*npad; - dk = 1./(nk*dx); - k0 = -0.5/dx; - - sf_putint (out,"n1",nk); - sf_putfloat (out,"d1",dk); - sf_putfloat (out,"o1",k0); - } - - - ck = sf_complexalloc(nk); - cx = sf_complexalloc(nx); - - /* FFT scaling */ - wt = sym? 1./sqrtf((float) nk): 1./nk; - - for (i2=0; i2 smooth.rsf -*/ - -#include - -#include "triangle2.h" -#include "gauss2.h" -#include "freqfilt2.h" - -int main(int argc, char* argv[]) -{ - bool gauss; - int n1, n2, n12, n3, i3; - float rect1, rect2, *input, *smooth; - sf_file in, out; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input"); - n3 = sf_leftsize(in,2); - n12 = n1*n2; - - if (!sf_getfloat("rect1",&rect1)) rect1=3.; - if (!sf_getfloat("rect2",&rect2)) rect2=3.; - /* smoothing radius */ - - if (!sf_getbool("gauss",&gauss)) gauss=false; - /* if y, use exact Gaussian */ - - if (gauss) { - gauss2_init(n1, n2, rect1, rect2); - } else { - triangle2_init((int) rect1, (int) rect2, n1, n2); - } - - input = sf_floatalloc(n12); - smooth = sf_floatalloc(n12); - - for (i3=0; i3 < n3; i3++) { - sf_floatread(input,n12,in); - - if (gauss) { - freqfilt2_lop(false,false,n12,n12,input,smooth); - } else { - triangle2_lop(false,false,n12,n12,input,smooth); - } - - sf_floatwrite(smooth,n12,out); - } - - - exit(0); -} - -/* $Id$ */ - diff --git a/user/nobody/Msmoothdiv.c b/user/nobody/Msmoothdiv.c deleted file mode 100644 index f9583f214e..0000000000 --- a/user/nobody/Msmoothdiv.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Smooth signal division. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "divn.h" - -int main (int argc, char* argv[]) -{ - int i, n12, niter, dim, n[SF_MAX_DIM], rect[SF_MAX_DIM]; - float *num, *den, *rat; - char key[6]; - sf_file in, out, denom; - - sf_init (argc,argv); - in = sf_input("in"); - denom = sf_input("den"); - out = sf_output("out"); - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - - dim = sf_filedims (in,n); - n12 = 1; - for (i=0; i < dim; i++) { - snprintf(key,6,"rect%d",i+1); - if (!sf_getint(key,rect+i)) rect[i]=1; - n12 *= n[i]; - } - - num = sf_floatalloc(n12); - den = sf_floatalloc(n12); - rat = sf_floatalloc(n12); - - if (!sf_getint("niter",&niter)) niter=100; - /* number of iterations */ - - divn_init(dim, n12, n, rect, niter); - - sf_floatread(num,n12,in); - sf_floatread(den,n12,denom); - - divn (num, den, rat); - - sf_floatwrite(rat,n12,out); - - exit(0); -} - -/* $Id: Menvelope.c 696 2004-07-06 23:17:31Z fomels $ */ diff --git a/user/nobody/Mspectra.c b/user/nobody/Mspectra.c deleted file mode 100644 index 9f5494d6d4..0000000000 --- a/user/nobody/Mspectra.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Frequency spectra. -*/ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include - -#include - -int main (int argc, char* argv[]) -{ - int n1, n2, ni, nfft, nw, i, i1, i2; - float d1, o1, dw, *spec, *trace, scale; - float complex *fft; - char key[3]; - bool sum, isphase; - sf_file in, out; - - sf_init (argc, argv); - in = sf_input("in"); - out = sf_output("out"); - - if (SF_FLOAT != sf_gettype (in)) sf_error("Need float data"); - - if (!sf_histint(in,"n1",&n1)) n1=1; - n2 = sf_leftsize(in,1); - - if (!sf_getbool("all",&sum)) sum=false; - /* if y, compute average spectrum for all traces */ - - if (!sf_histfloat(in,"d1",&d1)) d1=0.004; - if (!sf_histfloat(in,"o1",&o1)) o1=0.; - - /* determine frequency sampling (for real to complex FFT) */ - nfft = sf_npfar(n1); - nw = nfft/2+1; - dw = 1./(nfft*d1); - - trace = sf_floatalloc (nfft); - fft = sf_complexalloc (nw); - spec = sf_floatalloc (nw); - - sf_putint(out,"n1",nw); - sf_putfloat(out,"d1",dw); - sf_putfloat(out,"o1",0.); - - if (sum) { - for (i=1; i < SF_MAX_DIM; i++) { - snprintf(key,3,"n%d",i+1); - if (!sf_histint(in,key,&ni)) break; - if (ni > 1) sf_putint(out,key,1); - } - for (i1=0; i1 < nw; i1++) { - spec[i1] = 0.; - } - } - - if (!sf_getbool("phase",&isphase)) isphase=false; - /* if y, compute phase spectra */ - - for (i1=n1; i1 < nfft; i1++) { /* pad with zeros */ - trace[i1]=0.; - } - - scale = sqrtf(1./nfft); /* FFT scaling */ - -/* loop over all traces */ - for (i2=0; i2 < n2; i2++) { - sf_floatread(trace,n1,in); - - /* Fourier transform */ - sf_pfarc (1,nfft,trace,fft); - - if (sum) { - if (isphase) { - for (i1=0; i1 < nw; i1++) { - spec[i1] += cargf(fft[i1]*cexpf(2.*I*SF_PI*i1*dw*o1)); - } - } else { - for (i1=0; i1 < nw; i1++) { - spec[i1] += cabsf(fft[i1]); - } - } - } else { - if (isphase) { - for (i1=0; i1 < nw; i1++) { - spec[i1] = cargf(fft[i1]*cexpf(2.*I*SF_PI*i1*dw*o1)); - } - } else { - for (i1=0; i1 < nw; i1++) { - spec[i1] = cabsf(fft[i1])*scale; - } - } - sf_floatwrite(spec,nw,out); - } - } - - if (sum) { /* normalize and output */ - scale /= n2; - for (i1=0; i1 < nw; i1++) { - spec[i1] *= scale; - } - sf_floatwrite(spec,nw,out); - } - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Msphere.c b/user/nobody/Msphere.c deleted file mode 100644 index 34ee6b6526..0000000000 --- a/user/nobody/Msphere.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Creates a simple spherical surface. */ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include - -int main(int argc, char* argv[]) -{ - int i1, i2, n1, n2; - float o1, o2, d1, d2, x, y, *z; - sf_file sphere; - - sf_init (argc,argv); - sphere = sf_output("out"); - sf_setformat(sphere,"native_float"); - - if (!sf_getint("n1",&n1)) n1=101; sf_putint(sphere,"n1",n1); - if (!sf_getint("n2",&n2)) n2=101; sf_putint(sphere,"n2",n2); - if (!sf_getfloat("o1",&o1)) o1=0.; sf_putfloat(sphere,"o1",o1); - if (!sf_getfloat("o2",&o2)) o2=0.; sf_putfloat(sphere,"o2",o2); - if (!sf_getfloat("d1",&d1)) d1=0.01; sf_putfloat(sphere,"d1",d1); - if (!sf_getfloat("d2",&d2)) d2=0.01; sf_putfloat(sphere,"d2",d2); - - z = sf_floatalloc(n1); - - for (i2=0; i2 < n2; i2++) { - y = o2+i2*d2; - y = 0.25 - (y-0.5)*(y-0.5); - for (i1 =0; i1 < n1; i1++) { - x = o1 + i1*d1; - x = y - (x-0.5)*(x-0.5); - z[i1] = (x > 0.)? sqrtf(x): 0.; - } - sf_floatwrite(z,n1,sphere); - } - - exit(0); -} - diff --git a/user/nobody/Mspicks.c b/user/nobody/Mspicks.c deleted file mode 100644 index 2b033752d4..0000000000 --- a/user/nobody/Mspicks.c +++ /dev/null @@ -1,133 +0,0 @@ -/* Generate stereotomography picks from time migration. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include - -#include - -int main (int argc, char* argv[]) -{ - int nt, nx, nh, it, ix, ih; - const int na=5; /* number of data attributes in a pick */ - float dt, t0, dh, h0, dx, x0, h, h2, r, v, p, t, t2, x, y, q, py, ph; - float *imgt, *velt, *dipt, ***pikt; - sf_file img, vel, dip, pik; - - sf_init (argc,argv); - img = sf_input("in"); - vel = sf_input("vel"); - dip = sf_input("dip"); - pik = sf_output("out"); - - if (SF_FLOAT != sf_gettype(img)) sf_error("Need float input"); - if (!sf_histint(img,"n1",&nt)) sf_error("No n1= in input"); - if (!sf_histfloat(img,"d1",&dt)) sf_error("No d1= in input"); - if (!sf_histfloat(img,"o1",&t0)) sf_error("No o1= in input"); - if (!sf_histint(img,"n2",&nx)) sf_error("No n1= in input"); - if (!sf_histfloat(img,"d2",&dx)) sf_error("No d1= in input"); - if (!sf_histfloat(img,"o2",&x0)) sf_error("No o1= in input"); - - if (!sf_getint("nh",&nh)) sf_error("Need nh="); - /* number of offsets */ - if (!sf_getfloat("dh",&dh)) sf_error("Need dh="); - /* offset sampling */ - if (!sf_getfloat("h0",&h0)) h0=0.; - /* offset origin */ - - sf_putint(pik,"n1",na); - sf_putint(pik,"n2",nh); - sf_putfloat(pik,"d2",dh); - sf_putfloat(pik,"o2",h0); - sf_putint(pik,"n3",nt); - sf_putfloat(pik,"d3",dt); - sf_putfloat(pik,"o3",t0); - sf_putint(pik,"n4",nx); - sf_putfloat(pik,"d4",dx); - sf_putfloat(pik,"o4",x0); - - imgt = sf_floatalloc(nt); - velt = sf_floatalloc(nt); - dipt = sf_floatalloc(nt); - pikt = sf_floatalloc3(na,nh,nt); - - for (ix=0; ix < nx; ix++) { - x = x0 + ix*dx; - - sf_floatread(imgt,nt,img); - sf_floatread(velt,nt,vel); - sf_floatread(dipt,nt,dip); - for (it=0; it < nt; it++) { - t = t0 + it*dt; - - v = 0.5*velt[it]; - v *= v; - - p = dipt[it]*dt/dx; - r = 1.+p*p*v; - - for (ih=0; ih < nh; ih++) { - h = h0 + ih*dh; - h2 = h*h/v; - - /* time squared */ - t2 = h2+0.5*t*(t*r+hypotf(t*r,2*h*p)); - - q = t2*r - h2; - - if (q > 0.01*dt*dt) { - q = sqrtf(q); - } else { - q = 0.1*dt; - } - - /* midpoint */ - y = x + p*v*t2/q; - - t2 = sqrtf(t2); - - /* time */ - pikt[it][ih][0] = t2; - - /* source */ - pikt[it][ih][1] = y - h; - - /* receiver */ - pikt[it][ih][2] = y + h; - - /* offset slope */ - ph = dt*h/(dt*t2*r*v+0.0001*dx*dx); - - /* midpoint slope */ - py = p*q/(t2*r+0.01*dt); - - /* source slope */ - pikt[it][ih][3] = 0.5*(py-ph); - - /* receiver slope */ - pikt[it][ih][4] = 0.5*(py+ph); - } - } - sf_floatwrite(pikt[0][0],na*nh*nt,pik); - } - - exit (0); -} - -/* $Id: Mspicks.c 729 2004-07-29 18:22:16Z fomels $ */ diff --git a/user/nobody/Msrmig.c b/user/nobody/Msrmig.c deleted file mode 100644 index 7f3181d6d2..0000000000 --- a/user/nobody/Msrmig.c +++ /dev/null @@ -1,216 +0,0 @@ -/* 3-D S/R migration with extended split-step */ - -/* - Copyright (C) 2006 Colorado School of Mines - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include "srmig.h" - -#include "img.h" - -int main (int argc, char *argv[]) -{ - bool verb; /* verbosity */ - float eps; /* dip filter constant */ - int nrmax; /* number of reference velocities */ - float dtmax; /* time error */ - int pmx,pmy; /* padding in the k domain */ - int tmx,tmy; /* boundary taper size */ - bool cw; /* converted waves flag */ - char *itype; /* imaging type - o = zero offset (default) - x = space offset - t = time offset - */ - bool hsym; - - sf_axis amx,amy,amz; - sf_axis alx,aly; - sf_axis aw,ae; - sf_axis ahx,ahy,ahz,aht; - - int n,nm,nz,nw,nh,nhx,nhy,nhz; - float oh,dh; - - sf_file Fs_s=NULL,Fs_r=NULL;/* slowness file S (nlx,nly,nz) */ - sf_file Fw_s=NULL,Fw_r=NULL;/* wavefield file W ( nx, ny,nw) */ - sf_file Fi=NULL; /* image file R ( nx, ny,nz) */ - - fslice wfl_s=NULL,wfl_r=NULL,imag=NULL; - fslice slo_s=NULL,slo_r=NULL; - - /*------------------------------------------------------------*/ - sf_init(argc,argv); - - if (NULL == (itype = sf_getstring("itype"))) itype = "o"; - - /* converted waves flag */ - if (NULL != sf_getstring("sls")) { - cw=true; - } else { - cw=false; - } - - if (!sf_getbool( "verb",&verb )) verb = true; /* verbosity flag */ - if (!sf_getfloat( "eps",&eps )) eps = 0.01; /* stability parameter */ - if (!sf_getint( "nrmax",&nrmax)) nrmax = 1; /* max number of refs */ - if (!sf_getfloat("dtmax",&dtmax)) dtmax = 0.004; /* max time error */ - if (!sf_getint( "pmx",&pmx )) pmx = 0; /* padding on x */ - if (!sf_getint( "pmy",&pmy )) pmy = 0; /* padding on y */ - if (!sf_getint( "tmx",&tmx )) tmx = 0; /* taper on x */ - if (!sf_getint( "tmy",&tmy )) tmy = 0; /* taper on y */ - - /*------------------------------------------------------------*/ - /* SLOWNESS */ - ; Fs_s = sf_input("slo"); - if(cw) Fs_r = sf_input("sls"); - alx = sf_iaxa(Fs_s,1); sf_setlabel(alx,"lx"); - aly = sf_iaxa(Fs_s,2); sf_setlabel(aly,"ly"); - amz = sf_iaxa(Fs_s,3); sf_setlabel(amz,"mz"); - /* test here if slo and sls have similar sizes */ - - n = sf_n(alx)*sf_n(aly); - nz = sf_n(amz); - - ; slo_s = fslice_init(n, nz, sizeof(float)); - if(cw) slo_r = fslice_init(n, nz, sizeof(float)); - ; fslice_load(Fs_s,slo_s,SF_FLOAT); - if(cw) fslice_load(Fs_r,slo_r,SF_FLOAT); - - /*------------------------------------------------------------*/ - /* WAVEFIELD/IMAGE */ - - Fw_s = sf_input ( "in"); - Fw_r = sf_input ("rwf"); - Fi = sf_output("out"); sf_settype(Fi,SF_FLOAT); - - if (SF_COMPLEX != sf_gettype(Fw_s)) sf_error("Need complex source data"); - if (SF_COMPLEX != sf_gettype(Fw_r)) sf_error("Need complex receiver data"); - - amx = sf_iaxa(Fw_s,1); sf_setlabel(amx,"mx"); sf_oaxa(Fi,amx,1); - amy = sf_iaxa(Fw_s,2); sf_setlabel(amy,"my"); sf_oaxa(Fi,amy,2); - aw = sf_iaxa(Fw_s,3); sf_setlabel(aw ,"w" ); sf_oaxa(Fi,amz,3); - ae = sf_iaxa(Fw_s,4); sf_setlabel(ae ,"e" ); /* experiments */ - - nm = sf_n(amx)*sf_n(amy); - n = nm*nz; - - switch(itype[0]) { - case 't': /* time offset imaging condition */ - if(!sf_getint ("nht",&nh)) nh=1; - if(!sf_getfloat("oht",&oh)) oh=0; - if(!sf_getfloat("dht",&dh)) dh=0.1; - aht = sf_maxa(nh,oh,dh); sf_setlabel(aht,"ht"); - - sf_oaxa(Fi,aht,4); - sf_putint(Fi,"n5",1); - - imag = fslice_init(n,nh,sizeof(float)); - imgt_init(amz,amx,amy,aht,aw,imag); - - break; - case 'x': /* space offset imaging condition */ - if(!sf_getint("nhx",&nhx)) nhx=1; - if(!sf_getint("nhy",&nhy)) nhy=1; - if(!sf_getint("nhz",&nhz)) nhz=1; - ahx = sf_maxa(nhx,0.,sf_d(amx)); sf_setlabel(ahx,"hx"); - ahy = sf_maxa(nhy,0.,sf_d(amy)); sf_setlabel(ahy,"hy"); - ahz = sf_maxa(nhz,0.,sf_d(amz)); sf_setlabel(ahz,"hz"); - - if(!sf_getbool("hsym",&hsym)) hsym = false; - if(hsym) { - if(nhx>1) { - sf_seto(ahx,- nhx*sf_d(ahx)); nhx *= 2; sf_setn(ahx,nhx); } - if(nhy>1) { - sf_seto(ahy,- nhy*sf_d(ahy)); nhx *= 2; sf_setn(ahy,nhy); } - if(nhz>1) { - sf_seto(ahz,- nhz*sf_d(ahz)); nhz *= 2; sf_setn(ahz,nhz); } - } - - sf_oaxa(Fi,ahx,4); - sf_oaxa(Fi,ahy,5); - sf_oaxa(Fi,ahz,6); - - imag = fslice_init(n,nhx*nhy*nhz,sizeof(float)); - imgx_init(amz,amx,amy,ahx,ahy,ahz,imag); - - break; - case 'o': /* zero offset imaging condition */ - default: - sf_putint(Fi,"n4",1); - sf_putint(Fi,"n5",1); - - imag = fslice_init(n,1,sizeof(float)); - imgo_init(amz,amx,amy,imag); - - break; - } - - /* slice management (temp files) */ - nw = sf_n(aw)*sf_n(ae); - - wfl_s = fslice_init( nm, nw, sizeof(sf_complex)); - wfl_r = fslice_init( nm, nw, sizeof(sf_complex)); - - fslice_load(Fw_s,wfl_s,SF_COMPLEX); - fslice_load(Fw_r,wfl_r,SF_COMPLEX); - /*------------------------------------------------------------*/ - /* MIGRATION */ - srmig_init (verb,eps,dtmax, - ae,aw,amx,amy,amz,alx,aly, - tmx,tmy,pmx,pmy); - - if(cw) { - srmig_cw_init (dtmax,nrmax,slo_s,slo_r); - switch(itype[0]) { - case 't': srmig_cw(wfl_s,wfl_r,imag, &imgt); break; - case 'x': srmig_cw(wfl_s,wfl_r,imag, &imgx); break; - case 'o': default: srmig_cw(wfl_s,wfl_r,imag, &imgo); break; - } - srmig_cw_close(); - } else { - srmig_pw_init (dtmax,nrmax,slo_s); - switch(itype[0]) { - case 't': srmig_pw(wfl_s,wfl_r,imag, &imgt); break; - case 'x': srmig_pw(wfl_s,wfl_r,imag, &imgx); break; - case 'o': default: srmig_pw(wfl_s,wfl_r,imag, &imgo); break; - } - srmig_pw_close(); - } - - srmig_close(); - - switch(itype[0]) { - case 't': imgt_close(); break; - case 'x': imgx_close(); break; - case 'o': default: imgo_close(); break; - } - - /*------------------------------------------------------------*/ - /* slice management (temp files) */ - fslice_dump(Fi,imag,SF_FLOAT); - - ; fslice_close(slo_s); - if(cw) fslice_close(slo_r); - ; fslice_close(wfl_s); - ; fslice_close(wfl_r); - ; fslice_close(imag); - - exit (0); -} diff --git a/user/nobody/Msrmig2.c b/user/nobody/Msrmig2.c deleted file mode 100644 index 072a67ee23..0000000000 --- a/user/nobody/Msrmig2.c +++ /dev/null @@ -1,303 +0,0 @@ -/* 3-D S/R migration with extended split-step */ - -/* - Copyright (C) 2006 Colorado School of Mines - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include "srmig2.h" -#include "img2.h" - -int main (int argc, char *argv[]) -{ - bool verb; /* verbosity */ - float eps; /* dip filter constant */ - int nrmax; /* number of reference velocities */ - float dtmax; /* time error */ - int pmx,pmy; /* padding in the k domain */ - int tmx,tmy; /* boundary taper size */ - bool cw; /* converted waves flag */ - char *itype; /* imaging type - o = zero lag (default) - x = space-lags - h = absolute space-lag - t = time-lag - */ - bool hsym; - float vpvs; -/* int dec;*/ -/* float deceps;*/ - void (*imop)(int); - void (*close)(fslice,fslice); - - sf_axis amx,amy,amz; - sf_axis alx,aly; - sf_axis aw,ae; - sf_axis ahx,ahy,ahz,aht; - sf_axis acx,acy,acz; - int jcx,jcy,jcz; - sf_axis ahh,aha,ahb; /* |h|,alpha,beta */ - - int n,nz,nx,ny,nh,nhx,nhy,nhz,nha,nhb,nw; - float dz,dx,dy,oh,dh,oha,dha,ohb,dhb; - - /* I/O files */ - sf_file Fw_s=NULL,Fw_r=NULL; /* wavefield file W ( nx, ny,nw) */ - sf_file Fs_s=NULL,Fs_r=NULL; /* slowness file S (nlx,nly,nz) */ - sf_file Fi=NULL; /* image file R ( nx, ny,nz) */ - sf_file Fc=NULL; /* cigs file C */ - - /* I/O slices */ - fslice wfl_s=NULL,wfl_r=NULL; - fslice slo_s=NULL,slo_r=NULL; - fslice imag=NULL; - fslice cigs=NULL; - - /*------------------------------------------------------------*/ - sf_init(argc,argv); - - if (NULL == (itype = sf_getstring("itype"))) itype = "o"; - /* imaging condition type - o = zero lag (default) - x = space-lags - h = space-lags magnitude - t = time-lag - */ - - /* converted waves flag */ - if (NULL != sf_getstring("sls")) { - cw=true; - } else { - cw=false; - } - - if (!sf_getbool( "verb",&verb )) verb = true; /* verbosity flag */ - if (!sf_getfloat( "eps",&eps )) eps = 0.01; /* stability parameter */ - if (!sf_getint( "nrmax",&nrmax)) nrmax = 1; /* max number of refs */ - if (!sf_getfloat("dtmax",&dtmax)) dtmax = 0.004; /* max time error */ - if (!sf_getint( "pmx",&pmx )) pmx = 0; /* padding on x */ - if (!sf_getint( "pmy",&pmy )) pmy = 0; /* padding on y */ - if (!sf_getint( "tmx",&tmx )) tmx = 0; /* taper on x */ - if (!sf_getint( "tmy",&tmy )) tmy = 0; /* taper on y */ - - if (!sf_getfloat( "vpvs",&vpvs)) vpvs = 1.; - /*------------------------------------------------------------*/ - /* SLOWNESS */ - - ; Fs_s = sf_input("slo"); - if(cw) Fs_r = sf_input("sls"); - alx = sf_iaxa(Fs_s,1); sf_setlabel(alx,"lx"); - aly = sf_iaxa(Fs_s,2); sf_setlabel(aly,"ly"); - amz = sf_iaxa(Fs_s,3); sf_setlabel(amz,"mz"); - /* test here if slo and sls have similar sizes */ - - n = sf_n(alx)*sf_n(aly); - nz = sf_n(amz); - dz = sf_d(amz); - - ; slo_s = fslice_init(n, nz, sizeof(float)); - if(cw) slo_r = fslice_init(n, nz, sizeof(float)); - ; fslice_load(Fs_s,slo_s,SF_FLOAT); - if(cw) fslice_load(Fs_r,slo_r,SF_FLOAT); - - /*------------------------------------------------------------*/ - /* WAVEFIELD/IMAGE */ - - Fw_s = sf_input( "in"); - Fw_r = sf_input("rwf"); - - if (SF_COMPLEX != sf_gettype(Fw_s)) sf_error("need complex source data"); - if (SF_COMPLEX != sf_gettype(Fw_r)) sf_error("need complex receiver data"); - - amx = sf_iaxa(Fw_s,1); sf_setlabel(amx,"x"); - amy = sf_iaxa(Fw_s,2); sf_setlabel(amy,"y"); - aw = sf_iaxa(Fw_s,3); sf_setlabel(aw, "w"); - ae = sf_iaxa(Fw_s,4); sf_setlabel(ae, "e"); /* experiments */ - - nx=sf_n(amx); dx=sf_d(amx); - ny=sf_n(amy); dy=sf_d(amy); - - Fi = sf_output("out"); sf_settype(Fi,SF_FLOAT); - sf_oaxa(Fi,amx,1); - sf_oaxa(Fi,amy,2); - sf_oaxa(Fi,amz,3); - sf_putint(Fi,"n4",1); - sf_putint(Fi,"n5",1); - - imag = fslice_init( nx*ny*nz,1,sizeof(float)); - - /*------------------------------------------------------------*/ - /* CIGS */ - - if(!sf_getint ("jcx",&jcx) || nx==1) jcx=1; - if(!sf_getint ("jcy",&jcy) || ny==1) jcy=1; - if(!sf_getint ("jcz",&jcz) || nz==1) jcz=1; - /* CIGs windowing */ - - acx = sf_maxa(SF_MAX(1,nx/jcx),sf_o(amx),dx*jcx); sf_setlabel(acx,"cx"); - acy = sf_maxa(SF_MAX(1,ny/jcy),sf_o(amy),dy*jcy); sf_setlabel(acy,"cy"); - acz = sf_maxa(SF_MAX(1,nz/jcz),sf_o(amz),dz*jcz); sf_setlabel(acz,"cz"); - n = sf_n(acx)*sf_n(acy)*sf_n(acz); - - Fc = sf_output("cig"); sf_settype(Fc,SF_FLOAT); - sf_oaxa(Fc,acx,1); - sf_oaxa(Fc,acy,2); - sf_oaxa(Fc,acz,3); - - /*------------------------------------------------------------*/ - /* init output files */ - -/* if (!sf_getint("dec",&dec)) dec=0;*/ -/* if (dec) {*/ -/* if (!sf_getfloat("deceps",&deceps)) deceps=0.01;*/ -/* img2dec(dec,deceps);*/ -/* }*/ - - switch(itype[0]) { - case 't': - if(verb) sf_warning("time-lag I.C."); - if(!sf_getint ("nht",&nh)) nh=1; - if(!sf_getfloat("oht",&oh)) oh=0; - if(!sf_getfloat("dht",&dh)) dh=0.1; - aht = sf_maxa(nh,oh,dh); sf_setlabel(aht,"ht"); - - sf_oaxa(Fc,aht,4); - cigs = fslice_init(n*nh,1,sizeof(float)); - - img2t_init(amx,amy,amz,jcx,jcy,jcz,aht,aw,imag); - imop = img2t; - close = img2t_close; - break; - case 'x': - if(verb) sf_warning("space-lags I.C."); - if(!sf_getint("nhx",&nhx) || nx==1) nhx=1; - if(!sf_getint("nhy",&nhy) || ny==1) nhy=1; - if(!sf_getint("nhz",&nhz) || nz==1) nhz=1; - ahx = sf_maxa(nhx,0.,dx); sf_setlabel(ahx,"hx"); - ahy = sf_maxa(nhy,0.,dy); sf_setlabel(ahy,"hy"); - ahz = sf_maxa(nhz,0.,dz); sf_setlabel(ahz,"hz"); - - if(!sf_getbool("hsym",&hsym)) hsym = false; - if(hsym) { - if(nhx>1) { sf_seto(ahx,-nhx*dx); sf_setn(ahx,nhx*2); } - if(nhy>1) { sf_seto(ahy,-nhy*dy); sf_setn(ahy,nhy*2); } - if(nhz>1) { sf_seto(ahz,-nhz*dz); sf_setn(ahz,nhz*2); } - } - - sf_oaxa(Fc,ahx,4); sf_raxa(ahx); - sf_oaxa(Fc,ahy,5); sf_raxa(ahy); - sf_oaxa(Fc,ahz,6); sf_raxa(ahz); - - n *= sf_n(ahx)*sf_n(ahy)*sf_n(ahz); - cigs = fslice_init(n,1,sizeof(float)); - - img2x_init(amx,amy,amz,jcx,jcy,jcz,ahx,ahy,ahz,imag); - imop = img2x; - close = img2x_close; - break; - case 'g': - case 'h': - if(verb) sf_warning("space-lag magnitude I.C."); - - if(!sf_getint ("nhh",&nh)) nh=1; - if(!sf_getfloat("ohh",&oh)) oh=0; - if(!sf_getfloat("dhh",&dh)) dh=0.1; - ahh = sf_maxa(nh,oh,dh); sf_setlabel(ahh,"hh"); - - /* longitude */ - if(!sf_getint ("nha",&nha)) nha=180; - if(!sf_getfloat("oha",&oha)) oha=0; oha *= SF_PI/180; - if(!sf_getfloat("dha",&dha)) dha=2.0; dha *= SF_PI/180; - if(nz==1) { nha=1; oha=0.; dha=SF_PI;} - aha = sf_maxa(nha,oha,dha); sf_setlabel(aha,"ha"); - - /* latitude */ - if(!sf_getint ("nhb",&nhb)) nhb=180; - if(!sf_getfloat("ohb",&ohb)) ohb=0; ohb *= SF_PI/180; - if(!sf_getfloat("dhb",&dhb)) dhb=2.0; dhb *= SF_PI/180; - if(nx==1) { nhb=1; ohb=SF_PI/2.; dhb=SF_PI;} - if(ny==1) { nhb=1; ohb=0.; dhb=SF_PI;} - ahb = sf_maxa(nhb,ohb,dhb); sf_setlabel(ahb,"hb"); - - sf_raxa(ahh); - sf_raxa(aha); - sf_raxa(ahb); - - sf_oaxa(Fc,ahh,4); - cigs = fslice_init( n*nh,1,sizeof(float)); - - img2h_init(amx,amy,amz,jcx,jcy,jcz,ahh,aha,ahb,aw,imag,vpvs); - imop = img2h; - close = img2h_close; - break; - case 'o': - default: - if(verb) sf_warning("zero-lag I.C."); - cigs = fslice_init(n,1,sizeof(float)); - - img2o_init(amx,amy,amz,jcx,jcy,jcz,imag); - imop = img2o; - close = img2o_close; - break; - } - - /*------------------------------------------------------------*/ - /* slice management (temp files) */ - nw = sf_n(aw)*sf_n(ae); - - wfl_s = fslice_init( nx*ny, nw,sizeof(sf_complex)); - wfl_r = fslice_init( nx*ny, nw,sizeof(sf_complex)); - - fslice_load(Fw_s,wfl_s,SF_COMPLEX); - fslice_load(Fw_r,wfl_r,SF_COMPLEX); - - /*------------------------------------------------------------*/ - /* MIGRATION */ - srmig2_init (verb,eps,dtmax, - ae,aw,amx,amy,amz,alx,aly, - tmx,tmy,pmx,pmy); - - if(cw) { - srmig2_cw_init (dtmax,nrmax,slo_s,slo_r); - srmig2_cw(wfl_s,wfl_r,imag,cigs, imop); - srmig2_cw_close(); - } else { - srmig2_pw_init (dtmax,nrmax,slo_s); - srmig2_pw(wfl_s,wfl_r,imag,cigs, imop); - srmig2_pw_close(); - } - - srmig2_close(); - close(imag,cigs); - - /*------------------------------------------------------------*/ - /* slice management (temp files) */ - if(verb) sf_warning("dump imag"); - fslice_dump(Fi,imag,SF_FLOAT); - - if(verb) sf_warning("dump cigs"); - fslice_dump(Fc,cigs,SF_FLOAT) - - ; fslice_close(slo_s); - if(cw) fslice_close(slo_r); - ; fslice_close(wfl_s); - ; fslice_close(wfl_r); - ; fslice_close(imag); - - exit (0); -} diff --git a/user/nobody/Msrmod.c b/user/nobody/Msrmod.c deleted file mode 100644 index 95f71ff89e..0000000000 --- a/user/nobody/Msrmod.c +++ /dev/null @@ -1,135 +0,0 @@ -/* 3-D S/R modeling with extended split-step */ -/* - Copyright (C) 2006 Colorado School of Mines - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include "srmod.h" - -int main (int argc, char *argv[]) -{ - bool verb; /* verbosity */ - bool incore; /* in core execution */ - float eps; /* dip filter constant */ - int nrmax; /* number of reference velocities */ - float dtmax; /* time error */ - int pmx,pmy; /* padding in the k domain */ - int tmx,tmy; /* boundary taper size */ - bool cw; /* converted waves flag */ - - sf_axis az,ax,ay,aw,alx,aly; - - int n,nz,nw; - - sf_file Fs_s=NULL,Fs_r=NULL; /* slowness file S (nlx,nly,nz) */ - sf_file Fw_s=NULL,Fw_r=NULL; /* wavefield file D or U ( nx, ny,nw) */ - sf_file Fr=NULL; /* reflectivity */ - - fslice wfl_s=NULL,wfl_r=NULL,refl=NULL; - fslice slo_s=NULL,slo_r=NULL; - - /*------------------------------------------------------------*/ - sf_init(argc,argv); - - /* converted waves flag */ - if (NULL != sf_getstring("sls")) { - cw=true; - } else { - cw=false; - } - - if (!sf_getbool("verb", &verb)) verb = true; /* verbosity flag */ - if (!sf_getbool("incore",&incore))incore = false; /* in core execution */ - if (!sf_getfloat("eps", &eps )) eps = 0.01; /* stability parameter */ - if (!sf_getint( "nrmax",&nrmax)) nrmax = 1; /* maximum number of refs */ - if (!sf_getfloat("dtmax",&dtmax)) dtmax = 0.004; /* time error */ - if (!sf_getint( "pmx", &pmx )) pmx = 0; /* padding on x */ - if (!sf_getint( "pmy", &pmy )) pmy = 0; /* padding on y */ - if (!sf_getint( "tmx", &tmx )) tmx = 0; /* taper on x */ - if (!sf_getint( "tmy", &tmy )) tmy = 0; /* taper on y */ - - /*------------------------------------------------------------*/ - /* SLOWNESS */ - ; Fs_s = sf_input("slo"); - if(cw) Fs_r = sf_input("sls"); - alx = sf_iaxa(Fs_s,1); sf_setlabel(alx,"lx"); - aly = sf_iaxa(Fs_s,2); sf_setlabel(aly,"ly"); - az = sf_iaxa(Fs_s,3); sf_setlabel(az , "z"); - /* test here if slo and sls have similar sizes */ - - n = sf_n(alx)*sf_n(aly); - nz = sf_n(az); - - ; slo_s = fslice_init(n,nz,sizeof(float)); - if(cw) slo_r = fslice_init(n,nz,sizeof(float)); - ; fslice_load(Fs_s,slo_s,SF_FLOAT); - if(cw) fslice_load(Fs_r,slo_r,SF_FLOAT); - - /*------------------------------------------------------------*/ - /* WAVEFIELD/IMAGE */ - Fw_s = sf_input ( "in"); - Fw_r = sf_output("out"); sf_settype(Fw_r,SF_COMPLEX); - Fr = sf_input ("ref"); - - if (SF_COMPLEX !=sf_gettype(Fw_s)) - sf_error("Need complex source wavefield"); - - ax = sf_iaxa(Fw_s,1); sf_setlabel(ax,"x"); sf_oaxa(Fw_r,ax,1); - ay = sf_iaxa(Fw_s,2); sf_setlabel(ay,"y"); sf_oaxa(Fw_r,ay,2); - aw = sf_iaxa(Fw_s,3); sf_setlabel(aw,"w"); sf_oaxa(Fw_r,aw,3); - - n = sf_n(ax)*sf_n(ay); - nw = sf_n(aw); - - /* slice management (temp files) */ - wfl_s = fslice_init(n,nw,sizeof(sf_complex)); - wfl_r = fslice_init(n,nw,sizeof(sf_complex)); - refl = fslice_init(n,nz,sizeof(float)); - - fslice_load(Fw_s,wfl_s,SF_COMPLEX); - fslice_load(Fr, refl, SF_FLOAT); - - /*------------------------------------------------------------*/ - /* MODELING */ - srmod_init (verb,incore,eps,dtmax, - az,aw,ax,ay,alx,aly, - tmx,tmy,pmx,pmy); - - if(cw) { - srmod_cw_init (dtmax,nrmax,slo_s,slo_r); - srmod_cw (wfl_s,wfl_r,refl); - srmod_cw_close(); - } else { - srmod_pw_init (dtmax,nrmax,slo_s); - srmod_pw (wfl_s,wfl_r,refl); - srmod_pw_close(); - } - - srmod_close(); - - /*------------------------------------------------------------*/ - /* slice management (temp files) */ - fslice_dump(Fw_r,wfl_r,SF_COMPLEX); - ; fslice_close(slo_s); - if(cw) fslice_close(slo_r); - ; fslice_close(wfl_s); - ; fslice_close(wfl_r); - ; fslice_close(refl); - - exit (0); -} diff --git a/user/nobody/Msstep1.c b/user/nobody/Msstep1.c deleted file mode 100644 index e25c53bdcd..0000000000 --- a/user/nobody/Msstep1.c +++ /dev/null @@ -1,185 +0,0 @@ -/* 2-D post-stack modeling/migration with split step. -*/ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "split1.h" - -int main (int argc, char *argv[]) -{ - int nt; /* number of time samples */ - int nz; /* number of migrated time samples */ - int nx; /* number of midpoints */ - int ix,it,iz; /* loop counters */ - int ntfft; /* fft size */ - int nw; /* number of frequencies */ - - float dt; /* time sampling interval */ - float dz; /* migrated time sampling interval */ - float dw; /* frequency sampling interval */ - float dx; /* spatial sampling interval */ - float **vt, *v, v0; /* velocities */ - float *p,**q; /* input, output data */ - - float complex **cp; /* complex input */ - - bool inv; /* modeling or migration */ - bool depth; /* depth or time */ - bool verb; /* verbosity */ - float eps; /* dip filter constant */ - kiss_fftr_cfg fft; - sf_file in, out, vel; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_getbool("inv",&inv)) inv = false; - /* If y, modeling; if n, migration */ - if (!sf_getbool("verb",&verb)) verb = false; - /* verbosity flag */ - if (!sf_getbool("depth",&depth)) depth = false; - /* depth or time migration */ - if (!sf_getfloat("eps",&eps)) eps = 0.01; - /* stability parameter */ - - if (!sf_histint(in,"n2",&nx)) nx = 1; - if (!sf_histfloat(in,"d2",&dx)) sf_error ("No d2= in input"); - - if (NULL == sf_getstring("velocity")) { - /* velocity file */ - if (!sf_getfloat("vel",&v0)) sf_error ("Need vel="); - /* constant velocity (if no velocity file) */ - vel = NULL; - } else { - vel = sf_input("velocity"); - } - - if (inv) { /* modeling */ - if (!sf_histint(in,"n1",&nz)) sf_error ("No n1= in input"); - if (!sf_histfloat(in,"d1",&dz)) sf_error ("No d1= in input"); - if (!sf_getint("nt",&nt)) sf_error ("Need nt="); - /* Length of time axis (for modeling) */ - if (!sf_getfloat("dt",&dt)) sf_error ("Need dt="); - /* Time sampling (for modeling) */ - sf_putint(out,"n1",nt); - sf_putfloat(out,"d1",dt); - } else { /* migration */ - if (!sf_histint(in,"n1",&nt)) sf_error ("No n1= in input"); - if (!sf_histfloat(in,"d1",&dt)) sf_error ("No d1= in input"); - if (NULL == vel) { - if (!sf_getint("nz",&nz)) { - /* number of steps in depth - (for constant-velocity depth migration) */ - if (depth) sf_error ("Need nz="); - nz = nt; - } - if (!sf_getfloat("dz",&dz)) { - /* sampling in depth - (for constant-velocity depth migration) */ - if (depth) sf_error ("Need dz="); - dz = dt*v0; - } - } else { - if (!sf_histint(vel,"n1",&nz)) - sf_error ("No n1= in velocity"); - if (!sf_histfloat(vel,"d1",&dz)) - sf_error ("No d1= in velocity"); - } - sf_putint(out,"n1",nz); - sf_putfloat(out,"d1",dz); - } - - vt = sf_floatalloc2(nz,nx); - v = sf_floatalloc(nz); - - if (NULL == vel) { - for (ix=0; ix < nx; ix++) { - for (iz=0; iz < nz; iz++) { - vt[ix][iz] = v0; - } - } - } else { - sf_floatread(vt[0],nx*nz,vel); - sf_fileclose(vel); - } - for (iz=0; iz < nz; iz++) { - v[iz] = 0.; - for (ix=0; ix < nx; ix++) { - vt[ix][iz] = 4./(vt[ix][iz]*vt[ix][iz]); - v[iz] += vt[ix][iz]; - } - v[iz] /= nx; - } - - /* determine wavenumber sampling (for real to complex FFT) */ - ntfft = nt*2; - nw = ntfft/2+1; - dw = 2.0*SF_PI/(ntfft*dt); - - /* allocate space */ - p = sf_floatalloc(ntfft); - q = sf_floatalloc2(nz,nx); - cp = sf_complexalloc2(nw,nx); - - fft = kiss_fftr_alloc(ntfft,inv? 1: 0,NULL,NULL); - - for (ix=0; ix - -#include "split3.h" - -int main (int argc, char *argv[]) -{ - int nt; /* number of time samples */ - int nz; /* number of migrated time samples */ - int nx, ny; /* number of midpoints */ - int ix,iy,it,iz; /* loop counters */ - int ntfft; /* fft size */ - int nw; /* number of frequencies */ - - float dt; /* time sampling interval */ - float dz; /* migrated time sampling interval */ - float dw; /* frequency sampling interval */ - float dx,dy; /* spatial sampling interval */ - float ***vt, *v, v0; /* velocities */ - float *p,***q; /* input, output data */ - - float complex ***cp; /* complex input */ - - bool inv; /* modeling or migration */ - bool depth; /* depth or time */ - bool verb; /* verbosity */ - float eps; /* dip filter constant */ - kiss_fftr_cfg fft; - sf_file in, out, vel; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_getbool("inv",&inv)) inv = false; - /* If y, modeling; if n, migration */ - if (!sf_getbool("verb",&verb)) verb = false; - /* verbosity flag */ - if (!sf_getbool("depth",&depth)) depth = false; - /* depth or time migration */ - if (!sf_getfloat("eps",&eps)) eps = 0.01; - /* stability parameter */ - - if (!sf_histint(in,"n2",&ny)) ny = 1; - if (!sf_histfloat(in,"d2",&dy)) sf_error ("No d2= in input"); - - if (!sf_histint(in,"n3",&nx)) nx = 1; - if (!sf_histfloat(in,"d3",&dx)) dx=dy; - - if (NULL == sf_getstring("velocity")) { - /* velocity file */ - if (!sf_getfloat("vel",&v0)) sf_error ("Need vel="); - /* constant velocity (if no velocity file) */ - vel = NULL; - } else { - vel = sf_input("velocity"); - } - - if (inv) { /* modeling */ - if (!sf_histint(in,"n1",&nz)) sf_error ("No n1= in input"); - if (!sf_histfloat(in,"d1",&dz)) sf_error ("No d1= in input"); - if (!sf_getint("nt",&nt)) sf_error ("Need nt="); - /* Length of time axis (for modeling) */ - if (!sf_getfloat("dt",&dt)) sf_error ("Need dt="); - /* Time sampling (for modeling) */ - sf_putint(out,"n1",nt); - sf_putfloat(out,"d1",dt); - } else { /* migration */ - if (!sf_histint(in,"n1",&nt)) sf_error ("No n1= in input"); - if (!sf_histfloat(in,"d1",&dt)) sf_error ("No d1= in input"); - if (NULL == vel) { - if (!sf_getint("nz",&nz)) { - /* number of steps in depth - (for constant-velocity depth migration) */ - if (depth) sf_error ("Need nz="); - nz = nt; - } - if (!sf_getfloat("dz",&dz)) { - /* sampling in depth - (for constant-velocity depth migration) */ - if (depth) sf_error ("Need dz="); - dz = dt*v0; - } - } else { - if (!sf_histint(vel,"n1",&nz)) - sf_error ("No n1= in velocity"); - if (!sf_histfloat(vel,"d1",&dz)) - sf_error ("No d1= in velocity"); - } - sf_putint(out,"n1",nz); - sf_putfloat(out,"d1",dz); - } - - vt = sf_floatalloc3(nz,ny,nx); - v = sf_floatalloc(nz); - - if (NULL == vel) { - for (ix=0; ix < nx; ix++) { - for (iy=0; iy < ny; iy++) { - for (iz=0; iz < nz; iz++) { - vt[ix][iy][iz] = v0; - } - } - } - } else { - sf_floatread(vt[0][0],nx*ny*nz,vel); - sf_fileclose(vel); - } - for (iz=0; iz < nz; iz++) { - v[iz] = 0.; - for (ix=0; ix < nx; ix++) { - for (iy=0; iy < ny; iy++) { - vt[ix][iy][iz] = 4./(vt[ix][iy][iz]*vt[ix][iy][iz]); - v[iz] += vt[ix][iy][iz]; - } - } - v[iz] /= (nx*ny); - } - - /* determine wavenumber sampling (for real to complex FFT) */ - ntfft = nt*2; - nw = ntfft/2+1; - dw = 2.0*SF_PI/(ntfft*dt); - - /* allocate space */ - p = sf_floatalloc(ntfft); - q = sf_floatalloc3(nz,ny,nx); - cp = sf_complexalloc3(nw,ny,nx); - - fft = kiss_fftr_alloc(ntfft,inv? 1: 0,NULL,NULL); - - for (ix=0; ix stretched.rsf -*/ - -#include - -#include "stretch2.h" - -int main(int argc, char* argv[]) -{ - int nx, nd; - float x0, dx, eps, lam; - float *dat, *coord, *mod; - map2 str; - sf_file in, out, head; - - sf_init(argc,argv); - in = sf_input("in"); - head = sf_input("head"); - out = sf_output("out"); - - if (!sf_histint(in,"n1",&nd)) sf_error("No n1= in input"); - - dat = sf_floatalloc(nd); - coord = sf_floatalloc(nd); - - sf_floatread (dat,nd,in); - sf_floatread (coord,nd,head); - - if (!sf_getint("nx",&nx)) sf_error ("Need nx="); - /* number of output samples */ - if (!sf_getfloat("x0",&x0)) x0=coord[0]; - /* output origin */ - if (!sf_getfloat("dx",&dx)) dx=(coord[nd-1]-x0)/(nd-1); - /* output sampling */ - - sf_putint(out,"n1",nx); - sf_putfloat(out,"d1",dx); - sf_putfloat(out,"o1",x0); - - if (!sf_getfloat("eps",&eps)) eps=0.01; - /* vertical smoothness */ - if (!sf_getfloat("lam",&lam)) lam=0.5; - /* horizontal smoothness */ - - mod = sf_floatalloc(nx); - - str = stretch2_init (nx,x0,dx,nd,eps,lam); - stretch2_define (str, coord, true); - stretch2_apply (str, dat, mod); - - sf_floatwrite (mod,nx,out); - - - exit(0); -} - -/* $Id$ */ - diff --git a/user/nobody/Msu2rsf.c b/user/nobody/Msu2rsf.c deleted file mode 100644 index 9120f663a1..0000000000 --- a/user/nobody/Msu2rsf.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Convert a SU dataset to RSF. -Same as sfsegyread su=n. Split from sfsegyread to decrease the number of -options of sfsuread, and to improve readability -of both codes. See sfsegyread help for more info.*/ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef _LARGEFILE_SOURCE -#define _LARGEFILE_SOURCE -#endif -#include -#include -#include -#include -#include "su_or_segy_to_rsf.h" - -int -main (int argc, char *argv[]) -{ - const bool su = true; - bool verb, xdr; - char *filename, *trace; - int format=0, ns, ntr, itrace[SF_NKEYS]; - off_t pos, nsegy; - float dt; - FILE *file; - extern int fseeko (FILE * stream, off_t offset, int whence); - -/**** Start common code with segy2rsf (16 lines) ****/ - sf_init (argc, argv); - - if (!sf_getbool ("verb", &verb)) - verb = false; - /* Verbosity flag */ - - if (!sf_getbool ("endian", &xdr)) - xdr = true; - /* Whether to automatically estimate endianness or not */ - if (xdr) - endian (); - - if (NULL == (filename = sf_getstring ("tape"))) /* input data */ - sf_error ("Need to specify tape="); - - if (NULL == (file = fopen (filename, "rb"))) - sf_error ("Cannot open \"%s\" for reading:", filename); - - pos = readfilesize (file); -/**** End common code with segy2rsf ****/ - - /* Figure out ns and ntr */ - - trace = sf_charalloc (SF_HDRBYTES); - if (SF_HDRBYTES != fread (trace, 1, SF_HDRBYTES, file)) - sf_error ("Error reading first trace header"); - fseeko (file, 0, SEEK_SET); - - segy2head (trace, itrace, SF_NKEYS); - ns = itrace[segykey ("ns")]; - dt = itrace[segykey ("dt")] / 1000000.; - free (trace); - - nsegy = SF_HDRBYTES + ns * 4; - ntr = pos / nsegy; - - su_or_segy_to_rsf (verb, su, ntr, format, ns, itrace, nsegy, file, dt); - - exit (0); -} diff --git a/user/nobody/Msymes.c b/user/nobody/Msymes.c deleted file mode 100644 index 9264f30632..0000000000 --- a/user/nobody/Msymes.c +++ /dev/null @@ -1,69 +0,0 @@ -/* 2-D synthetic model for multiple-arrival generation. - -From Bill Symes. -*/ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -#include "symes.h" - -int main(int argc, char* argv[]) -{ - int nx, nz, ix, iz; - float* trace; - float dx, dz, x[2]; - sf_file mod; - - sf_init (argc,argv); - mod = sf_output("out"); - - if (!sf_getint("nx",&nx)) nx=400; - /* horizontal dimension */ - if (!sf_getint("nz",&nz)) nz=800; - /* vertical dimension */ - - dx = 1./(nx-1); - dz = 2./(nz-1); - - sf_putint (mod,"n1",nz); - sf_putfloat (mod,"d1",dz); - sf_putfloat (mod,"o1",0.); - sf_putint (mod,"n2",nx); - sf_putfloat (mod,"d2",dx); - sf_putfloat (mod,"o2",0.); - sf_setformat (mod,"native_float"); - - trace = sf_floatalloc(nz); - - for (ix = 0; ix < nx; ix++) { - x[1] = ix*dx; - for (iz = 0; iz < nz; iz++) { - x[0] = iz*dz; - trace[iz] = 1./sqrtf(symes_vel(NULL,x)); - } - sf_floatwrite(trace,nz,mod); - } - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mtpow.c b/user/nobody/Mtpow.c deleted file mode 100644 index 32abb463aa..0000000000 --- a/user/nobody/Mtpow.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Time power gain - -Does not estimate tpow automatically. -*/ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -int main(int argc, char *argv[]) -{ - int nt, nx, n2, i2, it, ix; - float tpow, xpow, *trace, *tgain=NULL, *xgain=NULL, dt, t0, dx, x0, x; - sf_file in, out; - - sf_init(argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); - - if (!sf_histint(in,"n1",&nt)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&nx)) nx=1; - n2 = sf_leftsize(in,2); - - if (!sf_getfloat("tpow",&tpow)) tpow=2.; - /* power of time */ - if (!sf_getfloat("xpow",&xpow)) xpow=0.; - /* power of space */ - - trace = sf_floatalloc(nt); - - if (0. != tpow) { - if (!sf_histfloat(in,"d1",&dt)) dt=1.; - if (!sf_histfloat(in,"o1",&t0)) t0=0.; - - tgain = sf_floatalloc(nt); - for (it=0; it < nt; it++) { - tgain[it] = powf(t0+(it+1)*dt,tpow); - } - } - - if (0. != xpow) { - if (!sf_histfloat(in,"d2",&dx)) dx=1.; - if (!sf_histfloat(in,"o2",&x0)) x0=0.; - - xgain = sf_floatalloc(nx); - for (ix=0; ix < nx; ix++) { - xgain[ix] = powf(x0+(ix+1)*dx,xpow); - } - } - - - for (i2=0; i2 < n2; i2++) { - for (ix=0; ix < nx; ix++) { - sf_floatread(trace,nt,in); - - if (0. != tpow) { - for (it=0; it < nt; it++) { - trace[it] *= tgain[it]; - } - } - - if (0. != xpow) { - x = xgain[ix]; - for (it=0; it < nt; it++) { - trace[it] *= x; - } - } - - sf_floatwrite(trace,nt,out); - } - } - - exit(0); -} - -/* $Id$ */ diff --git a/user/nobody/Mtshiftcos.c b/user/nobody/Mtshiftcos.c deleted file mode 100644 index 3de274bb53..0000000000 --- a/user/nobody/Mtshiftcos.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Compute cos(theta) from 1/|pm| for time-shift imaging condition */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -#include "fint1.h" - -int main (int argc, char* argv[]) -{ - fint1 sft; - int ext; - - float v,a,n,f; - int fint; - - sf_axa ax,az,av,aa; - int ix,iz,iv,ia; - - float **stk, **ang, *vel, *tmp; - sf_file Fstk, Fang, Fvel; - - sf_init (argc,argv); - - /*------------------------------------------------------------*/ - Fstk = sf_input("in"); - Fvel = sf_input("velocity"); - Fang = sf_output("out"); - - if (SF_FLOAT != sf_gettype(Fstk)) sf_error("Need float input"); - - az=sf_iaxa(Fstk,1); nz=sf_n(az); - av=sf_iaxa(Fstk,2); nv=sf_n(av); - ax=sf_iaxa(Fstk,3); - - if (!sf_getint ("na",&na)) na=nv; - if (!sf_getfloat("da",&da)) da=1./(nv-1); - if (!sf_getfloat("a0",&a0)) a0=0.; - - aa = sf_maxa(na,a0,da); - sf_oaxa(Fang,aa,2); - - if (!sf_getint("extend",&ext)) ext=4; /* tmp extension */ - /*------------------------------------------------------------*/ - - stk = sf_floatalloc2(nz,nv); - ang = sf_floatalloc2(nz,na); - tmp = sf_floatalloc(nv); - vel = sf_floatalloc(nz); - - sft = fint1_init(ext,nv,0); - - for (ix = 0; ix < ax.n; ix++) { - sf_floatread(vel ,nz ,Fvel); - sf_floatread(stk[0],nz*nv,Fstk); - - /*------------------------------------------------------------*/ - for (iz = 0; iz < az.n; iz++) { - for (iv = 0; iv < av.n; iv++) { - tmp[iv] = stk[iv][iz]; - } - fint1_set(sft,tmp); - v = vel[iz]; - - for (ia=0; ia < aa.n; ia++) { - a = aa.o+ia*aa.d; /* ang */ - a = cosf(a/180*SF_PI); /* cos */ - - n = v / a; /* nu = v / cos */ - f = (n - av.o) / av.d; - fint = f; - - if (fint >= 0 && fint < av.n) { - ang[ia][iz] = fint1_apply(sft,fint,f-fint,false); - } else { - ang[ia][iz] = 0.; - } - } - } - /*------------------------------------------------------------*/ - - sf_floatwrite(ang[0],az.n*aa.n,Fang); - } - - exit (0); -} diff --git a/user/nobody/Mttimod.c b/user/nobody/Mttimod.c deleted file mode 100644 index ead1744843..0000000000 --- a/user/nobody/Mttimod.c +++ /dev/null @@ -1,503 +0,0 @@ -/* 2D TTI time-domain FD modeling */ -/* - Copyright (C) 2009 Colorado School of Mines - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include -#ifdef _OPENMP -#include -#include "omputil.h" -#endif - -#include "fdutil.h" - -/* check: dt<= 0.2 * min(dx,dz)/vmin */ - -#define NOP 2 /* derivative operator half-size */ - -#define C0 -2.500000 /* c0=-30./12.; */ -#define CA +1.333333 /* ca=+16./12.; */ -#define CB -0.083333 /* cb=- 1./12.; */ - -#define C1 0.66666666666666666666 /* 2/3 */ -#define C2 -0.08333333333333333333 /* -1/12 */ - -#define Dxx(a,ix,iz,co,ca,cb) (co* a[ix ][iz ] + \ - ca*(a[ix-1][iz ] + a[ix+1][iz ]) + \ - cb*(a[ix-2][iz ] + a[ix+2][iz ]) ) - -#define Dzz(a,ix,iz,co,ca,cb) (co* a[ix ][iz ] + \ - ca*(a[ix ][iz-1] + a[ix ][iz+1]) + \ - cb*(a[ix ][iz-2] + a[ix ][iz+2]) ) - -#define D1x(a,ix,iz,c1x,c2x) \ - (c2x*(a[ix+2][iz ] - \ - a[ix-2][iz ])+ \ - c1x*(a[ix+1][iz ] - \ - a[ix-1][iz ]) ) - -#define D1z(a,ix,iz,c1z,c2z) \ - (c2z*(a[ix ][iz+2] - \ - a[ix ][iz-2])+ \ - c1z*(a[ix ][iz+1] - \ - a[ix ][iz-1]) ) - -#define Dxz(a,ix,iz,c1x,c2x,c1z,c2z) \ - (c2x * D1z(a,ix+2,iz,c1z,c2z) - \ - c2x * D1z(a,ix-2,iz,c1z,c2z) + \ - c1x * D1z(a,ix+1,iz,c1z,c2z) - \ - c1x * D1z(a,ix-1,iz,c1z,c2z)) - -#define Dzx(a,ix,iz,c1x,c2x,c1z,c2z) \ - (c2z * D1x(a,ix,iz+2,c1x,c2x) - \ - c2z * D1x(a,ix,iz-2,c1x,c2x) + \ - c1z * D1x(a,ix,iz+1,c1x,c2x) - \ - c1z * D1x(a,ix,iz-1,c1x,c2x)) - -int main(int argc, char* argv[]) -{ - bool verb,fsrf,snap,expl,dabc; - int jsnap,ntsnap,jdata; - - /* OMP parameters */ -#ifdef _OPENMP - int ompnth; -#endif - - /* I/O files */ - sf_file Fwav=NULL; /* wavelet */ - sf_file Fsou=NULL; /* sources */ - sf_file Frec=NULL; /* receivers */ - sf_file Fvel=NULL; /* velocity */ - sf_file Fdat=NULL; /* data */ - sf_file Fwfl=NULL; /* wavefield */ - sf_file Fang=NULL; /* tilt angle */ - - /* cube axes */ - sf_axis at,az,ax; - sf_axis as,ar; - - int nt,nz,nx,ns,nr,nb; - int it,iz,ix; - float dt,dz,dx,idz,idx,dt2; - - /* FDM structure */ - fdm2d fdm=NULL; - abcone2d abc=NULL; - sponge spo=NULL; - - /* I/O arrays */ - float *ww=NULL; /* wavelet */ - pt2d *ss=NULL; /* sources */ - pt2d *rr=NULL; /* receivers */ - float *dd=NULL; /* data */ - - float **tt=NULL; - float **vp=NULL; /* velocity */ - - float **vp2=NULL; - float **vv2=NULL; - float **vh2=NULL; - - float **ang=NULL; - float **sia=NULL; - float **coa=NULL; - - float **rm,**ro,**rp,**ra,**rt; /* main wavefield */ - float **qm,**qo,**qp,**qa,**qt; /* auxiliary wavefield */ - - /* linear interpolation weights/indices */ - lint2d cs,cr; - - /* FD operator size */ - float cox,coz,cax,cbx,caz,cbz; - float c1x,c2x,c1z,c2z; - - /* wavefield cut params */ - sf_axis acz=NULL,acx=NULL; - int nqz,nqx; - float oqz,oqx; - float dqz,dqx; - float **qc=NULL; - - float H2q,H1r; - float s2,c2,sc; - - /*------------------------------------------------------------*/ - /* init RSF */ - sf_init(argc,argv); - - /*------------------------------------------------------------*/ - /* OMP parameters */ -#ifdef _OPENMP - ompnth=omp_init(); -#endif - /*------------------------------------------------------------*/ - - if(! sf_getbool("verb",&verb)) verb=false; /* verbosity flag */ - if(! sf_getbool("snap",&snap)) snap=false; /* wavefield snapshots flag */ - if(! sf_getbool("free",&fsrf)) fsrf=false; /* free surface flag */ - if(! sf_getbool("expl",&expl)) expl=false; /* "exploding reflector" */ - if(! sf_getbool("dabc",&dabc)) dabc=false; /* absorbing BC */ - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* I/O files */ - Fwav = sf_input ("in" ); /* wavelet */ - Fvel = sf_input ("vel"); /* velocity */ - Fsou = sf_input ("sou"); /* sources */ - Frec = sf_input ("rec"); /* receivers */ - Fang = sf_input ("ang"); /* tilt angle */ - Fwfl = sf_output("wfl"); /* wavefield */ - Fdat = sf_output("out"); /* data */ - - /*------------------------------------------------------------*/ - /* axes */ - at = sf_iaxa(Fwav,2); sf_setlabel(at,"t"); if(verb) sf_raxa(at); /* time */ - az = sf_iaxa(Fvel,1); sf_setlabel(az,"z"); if(verb) sf_raxa(az); /* depth */ - ax = sf_iaxa(Fvel,2); sf_setlabel(ax,"x"); if(verb) sf_raxa(ax); /* space */ - - as = sf_iaxa(Fsou,2); sf_setlabel(as,"s"); if(verb) sf_raxa(as); /* sources */ - ar = sf_iaxa(Frec,2); sf_setlabel(ar,"r"); if(verb) sf_raxa(ar); /* receivers */ - - nt = sf_n(at); dt = sf_d(at); - nz = sf_n(az); dz = sf_d(az); - nx = sf_n(ax); dx = sf_d(ax); - - ns = sf_n(as); - nr = sf_n(ar); - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* other execution parameters */ - if(! sf_getint("jdata",&jdata)) jdata=1; - if(snap) { /* save wavefield every *jsnap* time steps */ - if(! sf_getint("jsnap",&jsnap)) jsnap=nt; - } - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* expand domain for FD operators and ABC */ - if( !sf_getint("nb",&nb) || nbnzpad); sf_seto(az,fdm->ozpad); if(verb) sf_raxa(az); - sf_setn(ax,fdm->nxpad); sf_seto(ax,fdm->oxpad); if(verb) sf_raxa(ax); - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* setup output data header */ - sf_oaxa(Fdat,ar,1); - - sf_setn(at,nt/jdata); - sf_setd(at,dt*jdata); - sf_oaxa(Fdat,at,2); - - /* setup output wavefield header */ - if(snap) { - if(!sf_getint ("nqz",&nqz)) nqz=sf_n(az); - if(!sf_getint ("nqx",&nqx)) nqx=sf_n(ax); - - if(!sf_getfloat("oqz",&oqz)) oqz=sf_o(az); - if(!sf_getfloat("oqx",&oqx)) oqx=sf_o(ax); - - dqz=sf_d(az); - dqx=sf_d(ax); - - acz = sf_maxa(nqz,oqz,dqz); sf_raxa(acz); - acx = sf_maxa(nqx,oqx,dqx); sf_raxa(acx); - /* check if the imaging window fits in the wavefield domain */ - - qc=sf_floatalloc2(sf_n(acz),sf_n(acx)); - - ntsnap=0; - for(it=0; itnzpad,fdm->nxpad); - vp2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - vv2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - vh2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - sf_floatread(tt[0],nz*nx,Fvel ); expand(tt,vv2,fdm); /* vertical v */ - sf_floatread(tt[0],nz*nx,Fvel ); expand(tt,vp2,fdm); /* NMO v */ - sf_floatread(tt[0],nz*nx,Fvel ); expand(tt,vh2,fdm); /* horizontal v */ - - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - vp2[ix][iz] = vp2[ix][iz] * vp2[ix][iz]; - vv2[ix][iz] = vv2[ix][iz] * vv2[ix][iz]; - vh2[ix][iz] = vh2[ix][iz] * vh2[ix][iz]; - } - } - if(fsrf) { /* free surface */ - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznb; iz++) { - vp2[ix][iz]=0; - vv2[ix][iz]=0; - vh2[ix][iz]=0; - } - } - } - - /*------------------------------------------------------------*/ - - /* input tilt angle */ - - ang =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - sia =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - coa =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - sf_floatread(tt[0],nz*nx,Fang ); expand(tt,ang,fdm); - - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - ang[ix][iz] *= SF_PI/180.; - sia[ix][iz] = sinf(ang[ix][iz]); - coa[ix][iz] = cosf(ang[ix][iz]); - } - } - - /*------------------------------------------------------------*/ - free(*tt); free(tt); - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* allocate wavefield arrays */ - qm=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - qo=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - qp=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - qa=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - rm=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - ro=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - rp=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - ra=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - qm[ix][iz]=0; - qo[ix][iz]=0; - qp[ix][iz]=0; - qa[ix][iz]=0; - - rm[ix][iz]=0; - ro[ix][iz]=0; - rp[ix][iz]=0; - ra[ix][iz]=0; - } - } - - /*------------------------------------------------------------*/ - if(dabc) { - /* one-way abc setup */ - abc = abcone2d_make(NOP,dt,vp,fsrf,fdm); - /* sponge abc setup */ - spo = sponge_make(fdm->nb); - } - - /*------------------------------------------------------------*/ - /* - * MAIN LOOP - */ - /*------------------------------------------------------------*/ - if(verb) fprintf(stderr,"\n"); - for (it=0; itompchunk) \ - private(ix,iz,H2q,H1r,s2,c2,sc) \ - shared(fdm,ra,ro,qa,qo,cox,coz,cax,caz,cbx,cbz,c1x,c2x,c1z,c2z,idx,idz,vp2,vv2,vh2) -#endif - for (ix=NOP; ixnxpad-NOP; ix++) { - for(iz=NOP; iznzpad-NOP; iz++) { - - s2 = sia[ix][iz]*sia[ix][iz]; - c2 = coa[ix][iz]*coa[ix][iz]; - sc =2*sia[ix][iz]*coa[ix][iz]; - - H2q = c2*Dxx(qo,ix,iz,cox,cax,cbx) - + s2*Dzz(qo,ix,iz,coz,caz,cbz) - - sc*Dxz(qo,ix,iz,c1x,c2x,c1z,c2z); - - H1r = s2*Dxx(ro,ix,iz,cox,cax,cbx) - + c2*Dzz(ro,ix,iz,coz,caz,cbz) - + sc*Dxz(ro,ix,iz,c1x,c2x,c1z,c2z); - - /* main field - q */ - qa[ix][iz] = H2q * vh2[ix][iz] + H1r * vv2[ix][iz] ; - - /* auxiliary field - r */ - ra[ix][iz] = H2q * vp2[ix][iz] + H1r * vv2[ix][iz] ; - - } - } - - /* inject acceleration source */ - if(expl) { - sf_floatread(ww, 1,Fwav); - lint2d_inject1(ra,ww[0],cs); - lint2d_inject1(qa,ww[0],cs); - } else { - sf_floatread(ww,ns,Fwav); - lint2d_inject(ra,ww,cs); - lint2d_inject(qa,ww,cs); - } - - /* step forward in time */ -#ifdef _OPENMP -#pragma omp parallel for \ - schedule(dynamic,fdm->ompchunk) \ - private(ix,iz) \ - shared(fdm,ra,ro,rm,rp,qa,qo,qm,qp,dt2) -#endif - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - qp[ix][iz] = 2*qo[ix][iz] - - qm[ix][iz] - + qa[ix][iz] * dt2; - - rp[ix][iz] = 2*ro[ix][iz] - - rm[ix][iz] - + ra[ix][iz] * dt2; - } - } - /* circulate wavefield arrays */ - qt=qm; - qm=qo; - qo=qp; - qp=qt; - - rt=rm; - rm=ro; - ro=rp; - rp=rt; - - if(dabc) { - /* one-way abc apply */ - abcone2d_apply(qo,qm,NOP,abc,fdm); - sponge2d_apply(qm,spo,fdm); - sponge2d_apply(qo,spo,fdm); - sponge2d_apply(qp,spo,fdm); - - /* one-way abc apply */ - abcone2d_apply(ro,rm,NOP,abc,fdm); - sponge2d_apply(rm,spo,fdm); - sponge2d_apply(ro,spo,fdm); - sponge2d_apply(rp,spo,fdm); - } - - /* extract data */ - lint2d_extract(qo,dd,cr); - - if(snap && it%jsnap==0) { - cut2d(qo,qc,fdm,acz,acx); - sf_floatwrite(qc[0],sf_n(acz)*sf_n(acx),Fwfl); - } - if( it%jdata==0) - sf_floatwrite(dd,nr,Fdat); - } - if(verb) fprintf(stderr,"\n"); - - /*------------------------------------------------------------*/ - /* deallocate arrays */ - free(*rm); free(rm); - free(*rp); free(rp); - free(*ro); free(ro); - free(*ra); free(ra); - - free(*qm); free(qm); - free(*qp); free(qp); - free(*qo); free(qo); - free(*qa); free(qa); - free(*qc); free(qc); - - free(*vp); free(vp); - free(*vp2); free(vp2); - free(*vh2); free(vh2); - free(*vv2); free(vv2); - - free(*ang); free(ang); - free(*sia); free(sia); - free(*coa); free(coa); - - free(ww); - free(ss); - free(rr); - free(dd); - - exit (0); -} - diff --git a/user/nobody/Mvtimod.c b/user/nobody/Mvtimod.c deleted file mode 100644 index 88057b44c4..0000000000 --- a/user/nobody/Mvtimod.c +++ /dev/null @@ -1,431 +0,0 @@ -/* 2D VTI time-domain FD modeling */ -/* - Copyright (C) 2009 Colorado School of Mines - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#ifdef _OPENMP -#include -#include "omputil.h" -#endif - -#include "fdutil.h" - -/* check: dt<= 0.2 * min(dx,dz)/vmin */ - -#define NOP 2 /* derivative operator half-size */ - -#define C0 -2.500000 /* c0=-30./12.; */ -#define CA +1.333333 /* ca=+16./12.; */ -#define CB -0.083333 /* cb=- 1./12.; */ - -#define Dxx(a,ix,iz,co,ca,cb) (co* a[ix ][iz ] + \ - ca*(a[ix-1][iz ] + a[ix+1][iz ]) + \ - cb*(a[ix-2][iz ] + a[ix+2][iz ]) ) - -#define Dzz(a,ix,iz,co,ca,cb) (co* a[ix ][iz ] + \ - ca*(a[ix ][iz-1] + a[ix ][iz+1]) + \ - cb*(a[ix ][iz-2] + a[ix ][iz+2]) ) - -int main(int argc, char* argv[]) -{ - bool verb,fsrf,snap,expl,dabc; - int jsnap,ntsnap,jdata; - - /* OMP parameters */ -#ifdef _OPENMP - int ompnth; -#endif - - /* I/O files */ - sf_file Fwav=NULL; /* wavelet */ - sf_file Fsou=NULL; /* sources */ - sf_file Frec=NULL; /* receivers */ - sf_file Fvel=NULL; /* velocity */ - sf_file Fdat=NULL; /* data */ - sf_file Fwfl=NULL; /* wavefield */ - - /* cube axes */ - sf_axis at,az,ax; - sf_axis as,ar; - - int nt,nz,nx,ns,nr,nb; - int it,iz,ix; - float dt,dz,dx,idz,idx,dt2; - - /* FDM structure */ - fdm2d fdm=NULL; - abcone2d abc=NULL; - sponge spo=NULL; - - /* I/O arrays */ - float *ww=NULL; /* wavelet */ - pt2d *ss=NULL; /* sources */ - pt2d *rr=NULL; /* receivers */ - float *dd=NULL; /* data */ - - float **tt=NULL; - float **vp=NULL; /* velocity */ - - float **vp2=NULL; - float **vv2=NULL; - float **vh2=NULL; - - float **rm,**ro,**rp,**ra,**rt; /* main wavefield */ - float **qm,**qo,**qp,**qa,**qt; /* auxiliary wavefield */ - - /* linear interpolation weights/indices */ - lint2d cs,cr; - - /* FD operator size */ - float cox,coz,cax,cbx,caz,cbz; - - /* wavefield cut params */ - sf_axis acz=NULL,acx=NULL; - int nqz,nqx; - float oqz,oqx; - float dqz,dqx; - float **qc=NULL; - - float H2q,H1r; - - /*------------------------------------------------------------*/ - /* init RSF */ - sf_init(argc,argv); - - /*------------------------------------------------------------*/ - /* OMP parameters */ -#ifdef _OPENMP - ompnth=omp_init(); -#endif - /*------------------------------------------------------------*/ - - if(! sf_getbool("verb",&verb)) verb=false; /* verbosity flag */ - if(! sf_getbool("snap",&snap)) snap=false; /* wavefield snapshots flag */ - if(! sf_getbool("free",&fsrf)) fsrf=false; /* free surface flag */ - if(! sf_getbool("expl",&expl)) expl=false; /* "exploding reflector" */ - if(! sf_getbool("dabc",&dabc)) dabc=false; /* absorbing BC */ - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* I/O files */ - Fwav = sf_input ("in" ); /* wavelet */ - Fvel = sf_input ("vel"); /* velocity */ - Fsou = sf_input ("sou"); /* sources */ - Frec = sf_input ("rec"); /* receivers */ - Fwfl = sf_output("wfl"); /* wavefield */ - Fdat = sf_output("out"); /* data */ - - /*------------------------------------------------------------*/ - /* axes */ - at = sf_iaxa(Fwav,2); sf_setlabel(at,"t"); if(verb) sf_raxa(at); /* time */ - az = sf_iaxa(Fvel,1); sf_setlabel(az,"z"); if(verb) sf_raxa(az); /* depth */ - ax = sf_iaxa(Fvel,2); sf_setlabel(ax,"x"); if(verb) sf_raxa(ax); /* space */ - - as = sf_iaxa(Fsou,2); sf_setlabel(as,"s"); if(verb) sf_raxa(as); /* sources */ - ar = sf_iaxa(Frec,2); sf_setlabel(ar,"r"); if(verb) sf_raxa(ar); /* receivers */ - - nt = sf_n(at); dt = sf_d(at); - nz = sf_n(az); dz = sf_d(az); - nx = sf_n(ax); dx = sf_d(ax); - - ns = sf_n(as); - nr = sf_n(ar); - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* other execution parameters */ - if(! sf_getint("jdata",&jdata)) jdata=1; - if(snap) { /* save wavefield every *jsnap* time steps */ - if(! sf_getint("jsnap",&jsnap)) jsnap=nt; - } - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* expand domain for FD operators and ABC */ - if( !sf_getint("nb",&nb) || nbnzpad); sf_seto(az,fdm->ozpad); if(verb) sf_raxa(az); - sf_setn(ax,fdm->nxpad); sf_seto(ax,fdm->oxpad); if(verb) sf_raxa(ax); - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* setup output data header */ - sf_oaxa(Fdat,ar,1); - - sf_setn(at,nt/jdata); - sf_setd(at,dt*jdata); - sf_oaxa(Fdat,at,2); - - /* setup output wavefield header */ - if(snap) { - if(!sf_getint ("nqz",&nqz)) nqz=sf_n(az); - if(!sf_getint ("nqx",&nqx)) nqx=sf_n(ax); - - if(!sf_getfloat("oqz",&oqz)) oqz=sf_o(az); - if(!sf_getfloat("oqx",&oqx)) oqx=sf_o(ax); - - dqz=sf_d(az); - dqx=sf_d(ax); - - acz = sf_maxa(nqz,oqz,dqz); sf_raxa(acz); - acx = sf_maxa(nqx,oqx,dqx); sf_raxa(acx); - /* check if the imaging window fits in the wavefield domain */ - - qc=sf_floatalloc2(sf_n(acz),sf_n(acx)); - - ntsnap=0; - for(it=0; itnzpad,fdm->nxpad); - vp2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - vv2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - vh2 =sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - sf_floatread(tt[0],nz*nx,Fvel ); expand(tt,vv2,fdm); /* vertical v */ - sf_floatread(tt[0],nz*nx,Fvel ); expand(tt,vp2,fdm); /* NMO v */ - sf_floatread(tt[0],nz*nx,Fvel ); expand(tt,vh2,fdm); /* horizontal v */ - - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - vp2[ix][iz] = vp2[ix][iz] * vp2[ix][iz]; - vv2[ix][iz] = vv2[ix][iz] * vv2[ix][iz]; - vh2[ix][iz] = vh2[ix][iz] * vh2[ix][iz]; - } - } - if(fsrf) { /* free surface */ - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznb; iz++) { - vp2[ix][iz]=0; - vv2[ix][iz]=0; - vh2[ix][iz]=0; - } - } - } - - /*------------------------------------------------------------*/ - free(*tt); free(tt); - /*------------------------------------------------------------*/ - - /*------------------------------------------------------------*/ - /* allocate wavefield arrays */ - qm=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - qo=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - qp=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - qa=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - rm=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - ro=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - rp=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - ra=sf_floatalloc2(fdm->nzpad,fdm->nxpad); - - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - qm[ix][iz]=0; - qo[ix][iz]=0; - qp[ix][iz]=0; - qa[ix][iz]=0; - - rm[ix][iz]=0; - ro[ix][iz]=0; - rp[ix][iz]=0; - ra[ix][iz]=0; - } - } - - /*------------------------------------------------------------*/ - if(dabc) { - /* one-way abc setup */ - abc = abcone2d_make(NOP,dt,vp,fsrf,fdm); - /* sponge abc setup */ - spo = sponge_make(fdm->nb); - } - - /*------------------------------------------------------------*/ - /* - * MAIN LOOP - */ - /*------------------------------------------------------------*/ - if(verb) fprintf(stderr,"\n"); - for (it=0; itompchunk) \ - private(ix,iz,H2q,H1r) \ - shared(fdm,ra,ro,qa,qo,cox,coz,cax,caz,cbx,cbz,idx,idz,vp2) -#endif - for (ix=NOP; ixnxpad-NOP; ix++) { - for(iz=NOP; iznzpad-NOP; iz++) { - - H2q = Dxx(qo,ix,iz,cox,cax,cbx); - - H1r = Dzz(ro,ix,iz,coz,caz,cbz); - - /* main field - q */ - qa[ix][iz] = H2q * vh2[ix][iz] + H1r * vv2[ix][iz] ; - - /* auxiliary field - r */ - ra[ix][iz] = H2q * vp2[ix][iz] + H1r * vv2[ix][iz] ; - - } - } - - /* inject acceleration source */ - if(expl) { - sf_floatread(ww, 1,Fwav); - lint2d_inject1(ra,ww[0],cs); - lint2d_inject1(qa,ww[0],cs); - } else { - sf_floatread(ww,ns,Fwav); - lint2d_inject(ra,ww,cs); - lint2d_inject(qa,ww,cs); - } - - /* step forward in time */ -#ifdef _OPENMP -#pragma omp parallel for \ - schedule(dynamic,fdm->ompchunk) \ - private(ix,iz) \ - shared(fdm,ra,ro,rm,rp,qa,qo,qm,qp,dt2) -#endif - for (ix=0; ixnxpad; ix++) { - for(iz=0; iznzpad; iz++) { - qp[ix][iz] = 2*qo[ix][iz] - - qm[ix][iz] - + qa[ix][iz] * dt2; - - rp[ix][iz] = 2*ro[ix][iz] - - rm[ix][iz] - + ra[ix][iz] * dt2; - } - } - /* circulate wavefield arrays */ - qt=qm; - qm=qo; - qo=qp; - qp=qt; - - rt=rm; - rm=ro; - ro=rp; - rp=rt; - - if(dabc) { - /* one-way abc apply */ - abcone2d_apply(qo,qm,NOP,abc,fdm); - sponge2d_apply(qm,spo,fdm); - sponge2d_apply(qo,spo,fdm); - sponge2d_apply(qp,spo,fdm); - - /* one-way abc apply */ - abcone2d_apply(ro,rm,NOP,abc,fdm); - sponge2d_apply(rm,spo,fdm); - sponge2d_apply(ro,spo,fdm); - sponge2d_apply(rp,spo,fdm); - } - - /* extract data */ - lint2d_extract(qo,dd,cr); - - if(snap && it%jsnap==0) { - cut2d(qo,qc,fdm,acz,acx); - sf_floatwrite(qc[0],sf_n(acz)*sf_n(acx),Fwfl); - } - if( it%jdata==0) - sf_floatwrite(dd,nr,Fdat); - } - if(verb) fprintf(stderr,"\n"); - - /*------------------------------------------------------------*/ - /* deallocate arrays */ - free(*rm); free(rm); - free(*rp); free(rp); - free(*ro); free(ro); - free(*ra); free(ra); - - free(*qm); free(qm); - free(*qp); free(qp); - free(*qo); free(qo); - free(*qa); free(qa); - free(*qc); free(qc); - - free(*vp); free(vp); - free(*vp2); free(vp2); - free(*vh2); free(vh2); - free(*vv2); free(vv2); - - free(ww); - free(ss); - free(rr); - free(dd); - - exit (0); -} - diff --git a/user/nobody/Mwarp2gamma.c b/user/nobody/Mwarp2gamma.c deleted file mode 100644 index 1e2564e129..0000000000 --- a/user/nobody/Mwarp2gamma.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Convert warping function to gamma=Vp/Vs using LS and shaping regularization. - -Takes: < warp.rsf [warpout=wout.rsf] > gamma.rsf -rect1= rect2= ... - -rectN defines the size of the smoothing stencil in N-th dimension. -*/ -#include - -#include - -#include "smoothder.h" - -int main(int argc, char* argv[]) -{ - int i, niter, nw, nd, dim, n1,n2, i1,i2; - int n[SF_MAX_DIM], rect[SF_MAX_DIM]; - float **w, **g, t0, dt; - char key[6]; - sf_file warp, gamma, wout; - - sf_init(argc,argv); - warp = sf_input("in"); - gamma = sf_output("out"); - - if (!sf_histfloat(warp,"d1",&dt)) sf_warning("No d1= in input"); - if (!sf_histfloat(warp,"o1",&t0)) sf_warning("No o1= in input"); - - dim = sf_filedims (warp,n); - - for (i=0; i < dim; i++) { - snprintf(key,6,"rect%d",i+1); - if (!sf_getint(key,rect+i)) rect[i]=1; - } - - if (!sf_getint("nw",&nw)) nw=2*rect[0]; - /* trace extension */ - n[0] += 2*nw; - - nd = smoothder_init(dim, rect,n,false,false); - n1 = n[0]; - n2 = nd/n1; - - w = sf_floatalloc2(n1,n2); - g = sf_floatalloc2(n1,n2); - - if (!sf_getint("niter",&niter)) niter=100; - /* maximum number of iterations */ - - sf_floatread(w[0],nd,warp); - - for (i2=0; i2 < n2; i2++) { - for (i1=0; i1 < n1; i1++) { - w[i2][i1] += (t0+i1*dt); - - } - } - - smoothder(niter, NULL, w[0], g[0]); - - for (i2=0; i2 < n2; i2++) { - for (i1=0; i1 < n1; i1++) { - g[i2][i1] = 2.*g[i2][i1]/dt-1.; - w[i2][i1] -= (t0+i1*dt); - } - } - - sf_floatwrite(g[0],nd,gamma); - - if (NULL != sf_getstring("warpout")) { - /* optionally, output predicted warp */ - wout = sf_output("warpout"); - - sf_floatwrite(w[0],nd,wout); - } - - - exit(0); -} - -/* $Id$ */ diff --git a/user/nobody/Mwefic.c b/user/nobody/Mwefic.c deleted file mode 100644 index 9379721d12..0000000000 --- a/user/nobody/Mwefic.c +++ /dev/null @@ -1,87 +0,0 @@ -#include -#include "wefic.h" - -int main (int argc, char *argv[]) -{ - bool verb; /* verbosity */ - char *itype; /* imaging type (zero-time, finite-time) */ - axa az,ax,ay,aw,ah; - - sf_file Fus; /* source wavefield D(x,y,z,w) */ - sf_file Fur; /* receiver wavefield U(x,y,z,w) */ - sf_file Fi; /* image R(x,y,z,h) */ - - fslice imag,sdat,rdat; - - /*------------------------------------------------------------*/ - sf_init(argc,argv); - - if (!sf_getbool("verb",&verb)) verb = true; /* verbosity flag */ - if (NULL == (itype = sf_getstring("itype"))) itype = "z"; - - Fus = sf_input ( "in"); - Fur = sf_input ("rwf"); - Fi = sf_output("out"); - - iaxa(Fus,&ax,1); ax.l="x"; oaxa(Fi,&ax,1); - iaxa(Fus,&ay,2); ay.l="y"; oaxa(Fi,&ay,2); - iaxa(Fus,&az,3); az.l="z"; oaxa(Fi,&az,3); - iaxa(Fus,&aw,4); aw.l="w"; - - sdat = fslice_init( ax.n*ay.n*az.n*aw.n,1,sizeof(float complex)); - rdat = fslice_init( ax.n*ay.n*az.n*aw.n,1,sizeof(float complex)); - - switch(itype[0]) { - case 'p': - sf_warning("Full offset IC"); - sf_settype(Fi,SF_FLOAT); - - if(!sf_getint ("nh",&ah.n)) ah.n=1; - if(!sf_getfloat("oh",&ah.o)) ah.o=0; - if(!sf_getfloat("dh",&ah.d)) ah.d=0.1; - ah.l="ht"; - - oaxa(Fi,&ah,4); - - imag = fslice_init( ax.n*ay.n*az.n,ah.n,sizeof(float)); - break; - case 'z': - default: - sf_warning("Zero offset IC"); - sf_settype(Fi,SF_FLOAT); - - ah.n=1; ah.o=0; ah.d=1; ah.l=" "; - oaxa(Fi,&ah,4); - - imag = fslice_init( ax.n*ay.n*az.n,1,sizeof(float)); - break; - } - - fslice_load(Fus,sdat,SF_COMPLEX); - fslice_load(Fur,rdat,SF_COMPLEX); - /*------------------------------------------------------------*/ - wefic_init(verb,ax,ay,az,aw); - - switch(itype[0]) { - case 'p': - hhfic_init(ah); - hhfic(sdat,rdat,imag); - hhfic_close(); - break; - case 'z': - default: - zofic(sdat,rdat,imag); - break; - } - wefic_close(); - /*------------------------------------------------------------*/ - - /* slice management (temp files) */ - fslice_dump(Fi,imag,SF_FLOAT); - - fslice_close(sdat); - fslice_close(rdat); - fslice_close(imag); - - exit (0); -} diff --git a/user/nobody/Mweimc.c b/user/nobody/Mweimc.c deleted file mode 100644 index ef586550c4..0000000000 --- a/user/nobody/Mweimc.c +++ /dev/null @@ -1,120 +0,0 @@ -/* 3-D imaging conditions for shot-profile WE migration */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include "weimc.h" - -int main (int argc, char *argv[]) -{ - bool verb; /* verbosity */ - bool hsym; /* symmetric offset */ - char *itype; /* imaging type (zero-offset, prestack) */ - axa az, ax, ay, aw,aj; - axa ahz,ahx,ahy; /* offset */ - - sf_file Fus; /* source wavefield D(x,y,z,w) */ - sf_file Fur; /* receiver wavefield U(x,y,z,w) */ - sf_file Fi; /* image R(x,y,z) */ - - fslice imag,sdat,rdat; - - /*------------------------------------------------------------*/ - sf_init(argc,argv); - - if (!sf_getbool("verb",&verb)) verb = true; /* verbosity flag */ - - if (NULL == (itype = sf_getstring("itype"))) itype = "z"; - - Fus = sf_input ( "in"); - Fur = sf_input ("rwf"); - Fi = sf_output("out"); sf_settype(Fi,SF_FLOAT); - - iaxa(Fus,&ax,1); ax.l="x"; oaxa(Fi,&ax,1); - iaxa(Fus,&ay,2); ay.l="y"; oaxa(Fi,&ay,2); - iaxa(Fus,&az,3); az.l="z"; oaxa(Fi,&az,3); - iaxa(Fus,&aw,4); aw.l="w"; - - sdat = fslice_init( ax.n*ay.n*az.n,aw.n,sizeof(float complex)); - rdat = fslice_init( ax.n*ay.n*az.n,aw.n,sizeof(float complex)); - - switch(itype[0]) { - case 'p': - sf_warning("Full offset IC"); - - if(!sf_getint("nhx",&ahx.n)) ahx.n=1; - if(!sf_getint("nhy",&ahy.n)) ahy.n=1; - if(!sf_getint("nhz",&ahz.n)) ahz.n=1; - - ahx.o=0; ahy.o=0; ahz.o=0; - ahx.d=ax.d; ahy.d=ay.d; ahz.d=az.d; - ahx.l="hx"; ahy.l="hy"; ahz.l="hz"; - - if(!sf_getbool("hsym",&hsym)) hsym = false; - if(hsym) { - if(ahx.n>1) { ahx.o = - ahx.n * ahx.d; ahx.n *=2; } - if(ahy.n>1) { ahy.o = - ahy.n * ahy.d; ahy.n *=2; } - if(ahz.n>1) { ahz.o = - ahz.n * ahz.d; ahz.n *=2; } - } - - oaxa(Fi,&ahx,4); - oaxa(Fi,&ahy,5); - oaxa(Fi,&ahz,6); - - imag = fslice_init( ax.n* ay.n* az.n, - ahx.n*ahy.n*ahz.n,sizeof(float)); - break; - case 'z': - default: - sf_warning("Zero offset IC"); - aj.n=1; aj.o=0; aj.d=1; aj.l=" "; - oaxa(Fi,&aj,4); - - imag = fslice_init( ax.n*ay.n*az.n,1,sizeof(float)); - break; - } - - fslice_load(Fus,sdat,SF_COMPLEX); - fslice_load(Fur,rdat,SF_COMPLEX); - /*------------------------------------------------------------*/ - - weimc_init(verb,ax,ay,az,aw); - - switch(itype[0]) { - case 'p': - hhimc_init(ahx,ahy,ahz); - hhimc(sdat,rdat,imag); - break; - case 'z': - default: - zoimc(sdat,rdat,imag); - break; - } - - weimc_close(); - - /*------------------------------------------------------------*/ - /* slice management (temp files) */ - fslice_dump(Fi,imag,SF_FLOAT); - - fslice_close(sdat); - fslice_close(rdat); - fslice_close(imag); - - exit (0); -} diff --git a/user/nobody/Mwindow1.c b/user/nobody/Mwindow1.c deleted file mode 100644 index d5cd78a164..0000000000 --- a/user/nobody/Mwindow1.c +++ /dev/null @@ -1,88 +0,0 @@ -/* Divide a dataset into smooth overlapping windows. - -The input dimensions n1,... become n1,nw,... - -If no taper parameter is present, running -< window.rsf sfstack norm=no > input.rsf -should reconstruct the original input. -*/ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "window1.h" - -int main(int argc, char* argv[]) -{ - int n2, i2, i1, n, nw, w, iw, i0; - float h, *dat, *win, *dat2; - bool taper, hastaper; - sf_file in, out; - - sf_init (argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_histint(in,"n1",&n)) sf_error("No n1= in input"); - n2 = sf_leftsize(in,1); - - if (!sf_getint ("nw",&nw)) sf_error("Need nw="); - /* Number of windows */ - if (!sf_getint ("w",&w)) sf_error("Need w="); - /* Window length */ - if (!sf_getfloat ("h",&h)) h = (nw*w - n)/(nw-1.); - /* Window separation */ - - hastaper = sf_getbool("taper",&taper); - /* Window tapering */ - - sf_putint(out,"n2",nw); - sf_putint(out,"n3",n2); - - dat = sf_floatalloc (n); - win = sf_floatalloc (w); - dat2 = sf_floatalloc (n); - - window1_init (h,w-h); - - for (i2=0; i2 < n2; i2++) { - sf_floatread (dat, n, in); - for (iw=0; iw < nw; iw++) { - if (hastaper) { - i0 = window1_apply(iw,w,dat,taper,taper,win); - } else { - i0 = window1_apply(iw,w,dat,(iw > 0),(iw < nw-1),win); - } - for (i1=0; i1 < i0; i1++) { - dat2[i1] = 0.; - } - for (i1=i0; i1 < i0+w; i1++) { - dat2[i1] = win[i1-i0]; - } - for (i1=i0+w; i1 < n; i1++) { - dat2[i1] = 0.; - } - sf_floatwrite (dat2,n,out); - } - } - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mwindow2.c b/user/nobody/Mwindow2.c deleted file mode 100644 index 338ac6dbd2..0000000000 --- a/user/nobody/Mwindow2.c +++ /dev/null @@ -1,79 +0,0 @@ -/* Divide a dataset into 2-D smooth overlapping windows. -*/ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "window2.h" - -int main(int argc, char* argv[]) -{ - int n[2], nw[2], w[2], i0[2], i[2], i1, i2, j; - float h[2], **dat, **win, **dat2; - sf_file in, out; - - sf_init (argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_histint(in,"n1",n)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",n+1)) sf_error("No n2= in input"); - - if (!sf_getints("nw",nw,2)) sf_error("Need nw="); - /* number of windows */ - if (!sf_getints("w",w,2)) sf_error("Need w="); - /* window size */ - if (!sf_getfloats ("h",h,2)) { - for (j=0; j < 2; j++) { - h[j] = (nw[j]*w[j] - n[j])/(nw[j]-1.); - } - } - sf_putint(out,"n3",nw[0]*nw[1]); - - dat = sf_floatalloc2(n[0],n[1]); - win = sf_floatalloc2(w[0],w[1]); - dat2 = sf_floatalloc2(n[0],n[1]); - - window2_init (w,nw,n,h); - - sf_floatread (dat[0],n[0]*n[1],in); - - for (i[1]=0; i[1] < nw[1]; i[1]++) { - for (i[0]=0; i[0] < nw[0]; i[0]++) { - window2_apply(i,dat, - (i[1] > 0),(i[1] < nw[1]-1), - (i[0] > 0),(i[0] < nw[0]-1),i0,win); - for (i2=0; i2 < n[1]; i2++) { - for (i1=0; i1 < n[0]; i1++) { - if (i1 >= i0[0] && i1 < i0[0]+w[0] && - i2 >= i0[1] && i2 < i0[1]+w[1]) { - dat2[i2][i1] = win[i2-i0[1]][i1-i0[0]]; - } else { - dat2[i2][i1] = 0.; - } - } - } - sf_floatwrite (dat2[0],n[0]*n[1],out); - } - } - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mwindow3.c b/user/nobody/Mwindow3.c deleted file mode 100644 index 0cb55e3aea..0000000000 --- a/user/nobody/Mwindow3.c +++ /dev/null @@ -1,87 +0,0 @@ -/* Divide a dataset into 3-D smooth overlapping windows. -*/ -/* -Copyright (C) 2004 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "window3.h" - -int main(int argc, char* argv[]) -{ - int n[3], nw[3], w[3], i0[3], i[3], i1, i2, i3, j; - float h[3], ***dat, ***win, ***dat2; - sf_file in, out; - - sf_init (argc,argv); - in = sf_input("in"); - out = sf_output("out"); - - if (!sf_histint(in,"n1",n)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",n+1)) sf_error("No n2= in input"); - if (!sf_histint(in,"n3",n+2)) sf_error("No n3= in input"); - - if (!sf_getints("nw",nw,3)) sf_error("Need nw="); - /* number of windows */ - if (!sf_getints("w",w,3)) sf_error("Need w="); - /* window size */ - if (!sf_getfloats ("h",h,3)) { - for (j=0; j < 3; j++) { - h[j] = (nw[j]*w[j] - n[j])/(nw[j]-1.); - } - } - sf_putint(out,"n4",nw[0]*nw[1]*nw[2]); - - dat = sf_floatalloc3(n[0],n[1],n[2]); - win = sf_floatalloc3(w[0],w[1],w[2]); - dat2 = sf_floatalloc3(n[0],n[1],n[2]); - - window3_init (w,nw,n,h); - - sf_floatread (dat[0][0],n[0]*n[1]*n[2],in); - - for (i[2]=0; i[2] < nw[2]; i[2]++) { - for (i[1]=0; i[1] < nw[1]; i[1]++) { - for (i[0]=0; i[0] < nw[0]; i[0]++) { - window3_apply(i,dat, - (i[2] > 0),(i[2] < nw[2]-1), - (i[1] > 0),(i[1] < nw[1]-1), - (i[0] > 0),(i[0] < nw[0]-1),i0,win); - for (i3=0; i3 < n[2]; i3++) { - for (i2=0; i2 < n[1]; i2++) { - for (i1=0; i1 < n[0]; i1++) { - if (i1 >= i0[0] && i1 < i0[0]+w[0] && - i2 >= i0[1] && i2 < i0[1]+w[1] && - i3 >= i0[2] && i3 < i0[2]+w[2]) { - dat2[i3][i2][i1] = - win[i3-i0[2]][i2-i0[1]][i1-i0[0]]; - } else { - dat2[i3][i2][i1] = 0.; - } - } - } - } - sf_floatwrite (dat2[0][0],n[0]*n[1]*n[2],out); - } - } - } - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Mxcorr1.c b/user/nobody/Mxcorr1.c deleted file mode 100644 index 136068a7c2..0000000000 --- a/user/nobody/Mxcorr1.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Cross-correlation analysis. - -Takes: < data.rsf other=other.rsf > out.rsf xcorr=xcorr.rsf -*/ - -#include - -#include "xcorr.h" -#include "window1.h" -#include "stretch2.h" - -int main(int argc, char* argv[]) -{ - int n, nw, w, iw, i0=0, maxshift, i, i2, n2, nc; - float dt,h, eps, lam; - bool verb, taper; - float **dat, **dat2, **win, **win2, *coord, *shift, *warp, *xc; - map2 str; - sf_file in, out, other, xcr; - - sf_init(argc,argv); - in = sf_input("in"); - other = sf_input("other"); - out = sf_output("out"); - xcr = sf_output("xcorr"); - - if (!sf_histint(in,"n1",&n)) sf_error("No n1= in input"); - if (!sf_histfloat(in,"d1",&dt)) sf_error("No d1= in input"); - - n2 = sf_leftsize(in,1); - - if (!sf_getint("nw",&nw)) sf_error ("Need nw="); - /* number of windows */ - if (!sf_getint("w",&w)) sf_error ("Need w="); - /* window size */ - if (!sf_getfloat("h",&h)) h=0.5*(w-1); - /* window overlap */ - if (!sf_getint("maxshift",&maxshift)) maxshift=w/2; nc=2*maxshift-1; - /* maximum correlation lag */ - if (!sf_getfloat("eps",&eps)) eps=0.01; - /* vertical smoothness (for picking) */ - if (!sf_getfloat("lam",&lam)) lam=0.5; - /* horizontal smoothness (for picking) */ - if (!sf_getbool("verb",&verb)) verb=false; - /* verbosity flag */ - if (!sf_getbool("taper",&taper)) taper=true; - /* window tapering */ - - dat = sf_floatalloc2(n,n2); - dat2 = sf_floatalloc2(n,n2); - win = sf_floatalloc2(w,n2); - win2 = sf_floatalloc2(w,n2); - coord = sf_floatalloc(nw); - shift = sf_floatalloc(nw); - warp = sf_floatalloc(n); - xc = sf_floatalloc(nc); - - window1_init (w,nw,n,h,w-h); - str = stretch2_init (n,1.,1.,nw,eps,lam); - - sf_floatread (dat[0],n*n2,in); - sf_floatread (dat2[0],n*n2,other); - - sf_putint(xcr,"n1",nc); - sf_putint(xcr,"n2",nw); - sf_putfloat(xcr,"o2",(0.5*w+1.)*dt); - sf_putfloat(xcr,"d2",(n-w)*dt/(nw-1.)); - sf_putfloat(xcr,"o1",-maxshift*dt); - - for (iw=0; iw < nw; iw++) { - for (i2=0; i2 < n2; i2++) { - i0 = window1_apply(iw,dat[i2] ,taper,taper,win[i2] ); - i0 = window1_apply(iw,dat2[i2],taper,taper,win2[i2]); - } - coord[iw] = i0 + 0.5*(w+1.); - shift[iw] = xcorr (w,n2,win[0], win2[0],nc,xc); - sf_floatwrite(xc,nc,xcr); - if (verb) sf_warning("shift[%d]=%g",iw,shift[iw]); - } - - stretch2_define (str, coord, false); - stretch2_apply (str, shift, warp); - - for (i=0; i < n; i++) { - warp[i] *= dt; - } - - for (i2=0; i2 < n2; i2++) { - sf_floatwrite (warp,n,out); - } - - - exit(0); -} - -/* $Id$ */ diff --git a/user/nobody/Mzoimg3.c b/user/nobody/Mzoimg3.c deleted file mode 100644 index 0e488c208d..0000000000 --- a/user/nobody/Mzoimg3.c +++ /dev/null @@ -1,303 +0,0 @@ -/* 3-D zero-offset modeling/migration with extended SSF with time images */ - -/* - Copyright (C) 2007 Colorado School of Mines - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#ifdef _OPENMP -#include -#endif - -#include "zomig3.h" -#include "taper3.h" -#include "ssr3.h" -#include "slow3.h" - -#include "weutil.h" -/*^*/ - -int main (int argc, char *argv[]) -{ - char *mode; /* mode of operation */ - bool verb; /* verbosity */ - bool inv; /* forward or adjoint */ - bool causal; /* causal/anti-causal flag */ - bool twoway; /* two-way traveltime */ - float eps; /* dip filter constant */ - int nrmax; /* number of reference velocities */ - float dtmax; /* time error */ - int pmx,pmy; /* padding in the k domain */ - int tmx,tmy; /* boundary taper size */ - - sf_axis amx,amy,amz; - sf_axis alx,aly; - sf_axis aw,ae; - - int n,nz,nw; - float dw,ow; - - /* I/O files */ - sf_file Fs=NULL; /* slowness file S(nlx,nly,nz ) */ - sf_file Fi=NULL; /* image file R(nmx,nmy,nz ) */ - sf_file Fd=NULL; /* data file D(nmx,nmy, nw) */ - sf_file Fw=NULL; - - /* I/O slices */ - fslice slow=NULL; - fslice imag=NULL; - fslice data=NULL; - fslice wfld=NULL; - - int ompchunk=1; - int ompnth=1; -#ifdef _OPENMP - int ompath=1; -#endif - - cub3d cub; /* wavefield hypercube */ - tap3d tap; /* tapering */ - ssr3d ssr; /* SSR operator */ - slo3d slo; /* slowness */ - - ssroperator3d weop; - - float dsmax; - - /*------------------------------------------------------------*/ - sf_init(argc,argv); - - if(! sf_getint("ompchunk",&ompchunk)) ompchunk=1; - /* OpenMP data chunk size */ -#ifdef _OPENMP - if(! sf_getint("ompnth", &ompnth)) ompnth=0; - /* OpenMP available threads */ - -#pragma omp parallel - ompath=omp_get_num_threads(); - if(ompnth<1) ompnth=ompath; - omp_set_num_threads(ompnth); - sf_warning("using %d threads of a total of %d",ompnth,ompath); -#endif - - /* default mode is migration/modeling */ - if (NULL == (mode = sf_getstring("mode"))) mode = "m"; - - if (!sf_getbool( "verb",&verb )) verb = false; /* verbosity flag */ - if (!sf_getfloat( "eps",&eps )) eps = 0.01; /* stability parameter */ - if (!sf_getbool( "inv",&inv )) inv = false; /* y=modeling; n=migration */ - if (!sf_getbool("causal",&causal)) causal= false; /* y=causal; n=anti-causal */ - if (!sf_getbool("twoway",&twoway)) twoway= true; /* two-way traveltime */ - if (!sf_getint( "nrmax",&nrmax )) nrmax = 1; /* maximum references */ - if (!sf_getfloat("dtmax",&dtmax )) dtmax = 0.004; /* time error */ - - if (!sf_getint( "pmx",&pmx )) pmx = 0; /* padding on x */ - if (!sf_getint( "pmy",&pmy )) pmy = 0; /* padding on y*/ - - if (!sf_getint( "tmx",&tmx )) tmx = 0; /* taper on x*/ - if (!sf_getint( "tmy",&tmy )) tmy = 0; /* taper on y */ - - /* slowness parameters */ - Fs = sf_input ("slo"); - alx = sf_iaxa(Fs,1); sf_setlabel(alx,"lx"); - aly = sf_iaxa(Fs,2); sf_setlabel(aly,"ly"); - amz = sf_iaxa(Fs,3); sf_setlabel(amz,"z" ); - - n = sf_n(alx)*sf_n(aly); - nz = sf_n(amz); - - slow = fslice_init(n,nz,sizeof(float)); - fslice_load(Fs,slow,SF_FLOAT); - - switch(mode[0]) { - case 'w': /* save wavefield */ - Fd = sf_input ( "in"); - Fw = sf_output("out"); sf_settype(Fw,SF_COMPLEX); - if (SF_COMPLEX !=sf_gettype(Fd)) sf_error("Need complex data"); - - amx = sf_iaxa(Fd,1); sf_setlabel(amx,"mx"); sf_oaxa(Fw,amx,1); - amy = sf_iaxa(Fd,2); sf_setlabel(amy,"my"); sf_oaxa(Fw,amy,2); - ; sf_oaxa(Fw,amz,3); - aw = sf_iaxa(Fd,3); sf_setlabel(aw ,"w" ); sf_oaxa(Fw,aw ,4); - ae = sf_maxa(1,0,1); - - n = sf_n(amx)*sf_n(amy); - nw = sf_n(aw); - - data = fslice_init(n, nw,sizeof(sf_complex)); - wfld = fslice_init(n,nz*nw,sizeof(sf_complex)); - - fslice_load(Fd,data,SF_COMPLEX); - break; - case 'd': - if (inv) { /* upward continuation */ - Fw = sf_input ( "in"); - Fd = sf_output("out"); sf_settype(Fd,SF_COMPLEX); - if (SF_COMPLEX !=sf_gettype(Fw)) sf_error("Need complex data"); - - amx = sf_iaxa(Fw,1); sf_setlabel(amx,"mx"); sf_oaxa(Fd,amx,1); - amy = sf_iaxa(Fw,2); sf_setlabel(amy,"my"); sf_oaxa(Fd,amy,2); - aw = sf_iaxa(Fw,3); sf_setlabel(aw , "w"); sf_oaxa(Fd,aw ,3); - ae = sf_iaxa(Fw,4); sf_setlabel(ae , "e"); sf_oaxa(Fd,ae ,4); - - n = sf_n(amx)*sf_n(amy); - nw = sf_n(aw)*sf_n(ae); - - data = fslice_init(n,nw,sizeof(sf_complex)); - wfld = fslice_init(n,nw,sizeof(sf_complex)); - - fslice_load(Fw,wfld,SF_COMPLEX); - } else { /* downward continuation */ - Fd = sf_input ( "in"); - Fw = sf_output("out"); sf_settype(Fw,SF_COMPLEX); - if (SF_COMPLEX !=sf_gettype(Fd)) sf_error("Need complex data"); - - amx = sf_iaxa(Fd,1); sf_setlabel(amx,"mx"); sf_oaxa(Fw,amx,1); - amy = sf_iaxa(Fd,2); sf_setlabel(amy,"my"); sf_oaxa(Fw,amy,2); - aw = sf_iaxa(Fd,3); sf_setlabel(aw , "w"); sf_oaxa(Fw,aw ,3); - ae = sf_iaxa(Fd,4); sf_setlabel(ae , "e"); sf_oaxa(Fw,ae ,4); - - n = sf_n(amx)*sf_n(amy); - nw = sf_n(aw)*sf_n(ae); - - data = fslice_init(n,nw,sizeof(sf_complex)); - wfld = fslice_init(n,nw,sizeof(sf_complex)); - - fslice_load(Fd,data,SF_COMPLEX); - } - break; - case 'm': - default: - if (inv) { /* modeling */ - Fi = sf_input ( "in"); - Fd = sf_output("out"); sf_settype(Fd,SF_COMPLEX); - if (SF_FLOAT !=sf_gettype(Fi)) sf_error("Need float image"); - - if (!sf_getint ("nw",&nw)) sf_error ("Need nw="); - if (!sf_getfloat("dw",&dw)) sf_error ("Need dw="); - if (!sf_getfloat("ow",&ow)) ow=0.; - aw = sf_maxa(nw,ow,dw); - sf_setlabel(aw, "w"); - sf_setunit (aw,"1/s"); - ae = sf_maxa(1,0,1); - - amx = sf_iaxa(Fi,1); sf_setlabel(amx,"mx"); sf_oaxa(Fd,amx,1); - amy = sf_iaxa(Fi,2); sf_setlabel(amy,"my"); sf_oaxa(Fd,amy,2); - amz = sf_iaxa(Fi,3); sf_setlabel(amz, "z"); sf_oaxa(Fd,aw ,3); - - n = sf_n(amx)*sf_n(amy); - - data = fslice_init(n,nw,sizeof(sf_complex)); - imag = fslice_init(n,nz,sizeof(float)); - - fslice_load(Fi,imag,SF_FLOAT); - } else { /* migration, output = frequency domain complex cross-correlation at t=0 */ - Fd = sf_input ( "in"); - Fi = sf_output("out"); sf_settype(Fi,SF_COMPLEX); - if (SF_COMPLEX !=sf_gettype(Fd)) sf_error("Need complex data"); - - amx = sf_iaxa(Fd,1); sf_setlabel(amx,"mx"); sf_oaxa(Fi,amx,1); - amy = sf_iaxa(Fd,2); sf_setlabel(amy,"my"); sf_oaxa(Fi,amy,2); - aw = sf_iaxa(Fd,3); sf_setlabel(aw , "w"); sf_oaxa(Fi,amz,3); - ae = sf_maxa(1,0,1); - - n = sf_n(amx)*sf_n(amy); - nw = sf_n(aw); - - data = fslice_init(n,nw,sizeof(sf_complex)); - imag = fslice_init(n,nz,sizeof(sf_complex)); - - fslice_load(Fd,data,SF_COMPLEX); - } - break; - } - /*------------------------------------------------------------*/ - cub = zomig3_cube(verb, - amx,amy,amz, - alx,aly, - aw, - ae, - eps, - ompnth, - ompchunk); - - dsmax = dtmax/cub->amz.d; - - /*------------------------------------------------------------*/ - /* init structures */ - tap = taper_init(cub->amx.n, - cub->amy.n, - 1, - SF_MIN(tmx,cub->amx.n-1), /* tmx */ - SF_MIN(tmy,cub->amy.n-1), /* tmy */ - 0, /* tmz */ - true,true,false); - - ssr = ssr3_init(cub,pmx,pmy,tmx,tmy,dsmax); - - slo = slow3_init(cub,slow,nrmax,dsmax,twoway); - /*------------------------------------------------------------*/ - weop = zomig3_init(cub); - - switch(mode[0]) { - case 'w': - zowfl3(weop,cub,ssr,tap,slo,inv,causal,data,wfld); - break; - case 'd': - zodtm3(weop,cub,ssr,tap,slo,inv,causal,data,wfld); - break; - case 'm': - default: - zomig3(weop,cub,ssr,tap,slo,inv, data,imag); - break; - } - - zomig3_close(weop); - - /*------------------------------------------------------------*/ - /* close structures */ - slow3_close(slo); - ssr3_close(ssr); - taper2d_close(tap); - - /*------------------------------------------------------------*/ - /* slice management (temp files) */ - switch(mode[0]) { - case 'w': - fslice_dump(Fw,wfld,SF_COMPLEX); - fslice_close(data); - fslice_close(wfld); - break; - case 'd': - if(inv) fslice_dump(Fd,data,SF_COMPLEX); - else fslice_dump(Fw,wfld,SF_COMPLEX); - fslice_close(data); - fslice_close(wfld); - break; - case 'm': - if(inv) fslice_dump(Fd,data,SF_COMPLEX); - else fslice_dump(Fi,imag,SF_COMPLEX); - fslice_close(data); - fslice_close(imag); - default: - break; - } - fslice_close(slow); - - exit (0); -} diff --git a/user/nobody/Mztrace2.c b/user/nobody/Mztrace2.c deleted file mode 100644 index 06a14c2d76..0000000000 --- a/user/nobody/Mztrace2.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Multiple arrivals by depth marching. */ -/* -Copyright (C) 2008 University of Texas at Austin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -#include "ztrace2.h" - -int main(int argc, char* argv[]) -{ - bool vel; - int nz,nx, iz, na, nax, ix, order, iorder; - float **slow, dz,dx,da,x0,z0,a0; - sf_file in, out; - - sf_init(argc,argv); - in = sf_input("in"); - /* velocity or slowness */ - - out = sf_output("out"); - /* escape time */ - - if (!sf_histint(in,"n1",&nz)) sf_error("No n1= in input"); - if (!sf_histint(in,"n2",&nx)) sf_error("No n2= in input"); - - if (!sf_histfloat(in,"d1",&dz)) sf_error("No d1= in input"); - if (!sf_histfloat(in,"d2",&dx)) sf_error("No d2= in input"); - - if (!sf_histfloat(in,"o1",&z0)) sf_error("No o1= in input"); - if (!sf_histfloat(in,"o2",&x0)) sf_error("No o2= in input"); - - if (!sf_getint("na",&na)) na=362; - /* number of angles */ - if (!sf_getfloat("da",&da)) da=0.5; - /* angle increment (in degrees) */ - if (!sf_getfloat("a0",&a0)) a0=-90.; - /* starting angle (in degrees) */ - - /* default range from -90 to +90 from the vertical */ - - sf_putint(out,"n4",nz); - sf_putfloat(out,"d4",dz); - sf_putfloat(out,"o4",z0); - - sf_putint(out,"n3",nx); - sf_putfloat(out,"d3",dx); - sf_putfloat(out,"o3",x0); - - sf_putint(out,"n2",na); - sf_putfloat(out,"d2",da); - sf_putfloat(out,"o2",a0); - - sf_putint(out,"n1",NS+1); - - /* convert degrees to radians */ - da *= (SF_PI/180.); - a0 *= (SF_PI/180.); - - nax = na*nx; - /* size of one depth slice */ - - /* additional parameters */ - if(!sf_getbool("vel",&vel)) vel=true; - /* y, input is velocity; n, slowness */ - - if(!sf_getint("order",&order)) order=3; - /* interpolation accuracy for velocity */ - if(!sf_getint("iorder",&iorder)) iorder=4; - /* interpolation accuracy for grid */ - - /* read velocity or slowness */ - slow = sf_floatalloc2(nz,nx); - sf_floatread(slow[0],nz*nx,in); - - /* convert to slowness */ - if (vel) { - for(ix = 0; ix < nx; ix++){ - for (iz = 0; iz < nz; iz++) { - slow[ix][iz] = 1./slow[ix][iz]; - } - } - } - - ztrace2_init (order, iorder, slow, - nx, nz, na, - dx, dz, da, - x0, z0, a0); - - for (iz = 0; iz < nz; iz++) { - sf_warning("depth %d of %d", iz+1, nz); - ztrace2_step (iz); - ztrace2_write(out); - } - - ztrace2_close(); - - exit (0); -} - -/* $Id$ */ diff --git a/user/nobody/Testboxsl.c b/user/nobody/Testboxsl.c deleted file mode 100644 index 23ff731ee7..0000000000 --- a/user/nobody/Testboxsl.c +++ /dev/null @@ -1,36 +0,0 @@ -#include - -#include - -#include "boxsl.h" - -int main(void) { - float dot1[2], dot2[2]; - static int n1=100, n2=100, rect1=10, rect2=5; - int i1, i2; - float **p; - - p = sf_floatalloc2(n1,n2); - - for (i2=0; i2 < n2; i2++) { - for (i1=0; i1 < n1; i1++) { - p[i2][i1] = (i1-n1/2)*(i2-n2/2)/((n1-1.)*(n2-1.)); - } - } - - boxsl_init(n1, n2-rect2, rect1, rect2); - boxsl_set(n2, p); - - sf_dot_test(boxsl_lop, n1*(n2-rect2), n1*n2, dot1, dot2); - - printf ("%12.8f ? %12.8f\n",dot1[0],dot1[1]); - printf ("%12.8f ? %12.8f\n",dot2[0],dot2[1]); - - sf_dot_test(trisl_lop, n1*n2, n1*n2, dot1, dot2); - - printf ("%12.8f ? %12.8f\n",dot1[0],dot1[1]); - printf ("%12.8f ? %12.8f\n",dot2[0],dot2[1]); - - boxsl_close(); - exit(0); -} diff --git a/user/nobody/Testntriangle1.c b/user/nobody/Testntriangle1.c deleted file mode 100644 index f2e278bb5b..0000000000 --- a/user/nobody/Testntriangle1.c +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#include - -#include "ntriangle1.h" - -int main(void) { - double dot1[2], dot2[2]; - int nbox=5, ndat1=50, ndat2=10, ndat, **shift, i1, i2; - float **rect; - - rect = sf_floatalloc2(ndat1,ndat2); - shift = sf_intalloc2(ndat1,ndat2); - - for (i2=0; i2 < ndat2; i2++) { - for (i1=0; i1 < ndat1; i1++) { - rect[i2][i1] = 1+0.3*((i1+i2)%(nbox-1)); - shift[i2][i1] = i1%2; - } - } - - ntriangle1_init(nbox, ndat1, ndat2, rect, shift); - - ndat = ndat1*ndat2; - sf_dot_test(ntriangle1_lop, ndat, ndat, dot1, dot2); - ntriangle1_close(); - - printf ("%12.8f ? %12.8f\n",dot1[0],dot1[1]); - printf ("%12.8f ? %12.8f\n",dot2[0],dot2[1]); - - exit(0); -} diff --git a/user/nobody/Testtomo.c b/user/nobody/Testtomo.c deleted file mode 100644 index 3dd5b3707f..0000000000 --- a/user/nobody/Testtomo.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -#include - -#include "tomo.h" - -int main(void) { - float dot1[2], dot2[2]; - static int nz=100, nx=100, np=11; - static float dz=1., dx=2.; - - tomo_init(np, nz, nx, dz, dx); - sf_dot_test(tomo_lop, nz*nx, np*nx, dot1, dot2); - - printf ("%12.8f ? %12.8f\n",dot1[0],dot1[1]); - printf ("%12.8f ? %12.8f\n",dot2[0],dot2[1]); - - exit(0); -} diff --git a/user/nobody/_fftsize.h b/user/nobody/_fftsize.h deleted file mode 100644 index abc448cc09..0000000000 --- a/user/nobody/_fftsize.h +++ /dev/null @@ -1,582 +0,0 @@ -#ifndef _sf_fft_size_h -#define _sf_fft_size_h - -#define SF_FFTR_SIZE 334 -#define SF_FFT_SIZE 230 - -typedef struct { - int size; - float cost; -} sf_Table; - -const sf_Table SF_FFTR[SF_FFTR_SIZE] = { - {1,0}, - {2,0}, - {5,0}, - {6,0}, - {10,0}, - {11,0}, - {15,0}, - {17,0}, - {18,0}, - {19,0}, - {20,0}, - {22,0}, - {24,0}, - {28,0}, - {31,0}, - {34,0}, - {37,0}, - {38,0}, - {47,0}, - {49,0}, - {50,0}, - {54,0}, - {55,0}, - {59,0}, - {63,0}, - {64,0}, - {66,0}, - {87,0}, - {99,0}, - {107,0}, - {192,0.01}, - {215,0.01}, - {216,0.01}, - {249,0.01}, - {250,0.01}, - {270,0.01}, - {499,0.03}, - {500,0.03}, - {511,0.03}, - {512,0.03}, - {639,0.04}, - {640,0.04}, - {767,0.05}, - {768,0.05}, - {800,0.05}, - {863,0.05}, - {899,0.05}, - {900,0.06}, - {960,0.06}, - {972,0.06}, - {1023,0.06}, - {1024,0.07}, - {1079,0.07}, - {1080,0.07}, - {1151,0.08}, - {1152,0.08}, - {1200,0.08}, - {1279,0.08}, - {1280,0.08}, - {1295,0.08}, - {1296,0.08}, - {1319,0.02}, - {1320,0.01}, - {1343,0.05}, - {1344,0.08}, - {1349,0.06}, - {1350,0.07}, - {1439,0.09}, - {1440,0.09}, - {1457,0.1}, - {1458,0.1}, - {1535,0.09}, - {1536,0.1}, - {1599,0.11}, - {1600,0.11}, - {1619,0.11}, - {1620,0.1}, - {1727,0.12}, - {1728,0.11}, - {1799,0.13}, - {1800,0.12}, - {1919,0.12}, - {1920,0.13}, - {1943,0.13}, - {1944,0.13}, - {1999,0.15}, - {2000,0.14}, - {2047,0.13}, - {2048,0.12}, - {2159,0.15}, - {2160,0.15}, - {2199,0.11}, - {2200,0.07}, - {2249,0.17}, - {2250,0.16}, - {2303,0.16}, - {2304,0.15}, - {2399,0.17}, - {2400,0.16}, - {2429,0.17}, - {2430,0.17}, - {2499,0.19}, - {2500,0.19}, - {2559,0.15}, - {2560,0.17}, - {2591,0.17}, - {2592,0.18}, - {2659,0.08}, - {2660,0.07}, - {2661,0.11}, - {2662,0.09}, - {2663,0.1}, - {2664,0.13}, - {2667,0.2}, - {2687,0.18}, - {2688,0.17}, - {2699,0.21}, - {2700,0.2}, - {2879,0.19}, - {2880,0.19}, - {2915,0.2}, - {2916,0.2}, - {2999,0.21}, - {3000,0.2}, - {3071,0.2}, - {3072,0.2}, - {3199,0.22}, - {3200,0.23}, - {3239,0.22}, - {3240,0.22}, - {3455,0.22}, - {3456,0.23}, - {3535,0.17}, - {3536,0.26}, - {3599,0.27}, - {3600,0.26}, - {3749,0.25}, - {3750,0.25}, - {3839,0.26}, - {3840,0.26}, - {3869,0.25}, - {3871,0.19}, - {3872,0.24}, - {3887,0.21}, - {3888,0.24}, - {3999,0.29}, - {4000,0.3}, - {4049,0.31}, - {4050,0.3}, - {4095,0.26}, - {4096,0.28}, - {4199,0.34}, - {4200,0.34}, - {4319,0.3}, - {4320,0.29}, - {4373,0.3}, - {4374,0.31}, - {4499,0.33}, - {4500,0.33}, - {4607,0.3}, - {4608,0.3}, - {4774,0.25}, - {4799,0.34}, - {4800,0.33}, - {4859,0.34}, - {4860,0.34}, - {4999,0.39}, - {5000,0.38}, - {5119,0.35}, - {5120,0.34}, - {5183,0.35}, - {5184,0.34}, - {5375,0.45}, - {5376,0.46}, - {5399,0.39}, - {5400,0.38}, - {5459,0.45}, - {5759,0.39}, - {5760,0.38}, - {5831,0.4}, - {5832,0.4}, - {5999,0.44}, - {6000,0.46}, - {6143,0.4}, - {6144,0.4}, - {6249,0.5}, - {6250,0.5}, - {6399,0.46}, - {6400,0.45}, - {6479,0.46}, - {6480,0.47}, - {6749,0.51}, - {6750,0.51}, - {6911,0.47}, - {6912,0.47}, - {7199,0.52}, - {7200,0.46}, - {7259,0.43}, - {7260,0}, - {7289,0.53}, - {7290,0.51}, - {7499,0.59}, - {7500,0.58}, - {7679,0.45}, - {7680,0.4}, - {7775,0.53}, - {7776,0.54}, - {7849,0.58}, - {7999,0.6}, - {8000,0.6}, - {8007,0.64}, - {8008,0.71}, - {8099,0.57}, - {8100,0.6}, - {8191,0.52}, - {8192,0.54}, - {8279,0}, - {8280,0.2}, - {8639,0.61}, - {8640,0.58}, - {8747,0.66}, - {8748,0.65}, - {8819,0.79}, - {8820,0.76}, - {8999,0.7}, - {9000,0.7}, - {9215,0.65}, - {9216,0.65}, - {9416,0.53}, - {9599,0.7}, - {9600,0.7}, - {9719,0.71}, - {9720,0.73}, - {9843,0.77}, - {9996,0.07}, - {9999,0.79}, - {10000,0.8}, - {10239,0.7}, - {10240,0.7}, - {10367,0.74}, - {10368,0.75}, - {10752,0.96}, - {10799,0.82}, - {10800,0.82}, - {10981,0.79}, - {10982,0.41}, - {11069,0.77}, - {11070,0.84}, - {11249,0.92}, - {11250,0.91}, - {11263,0.79}, - {11264,0.91}, - {11499,0.76}, - {11500,0.97}, - {11519,0.83}, - {11520,0.82}, - {11663,0.83}, - {11664,0.86}, - {11999,0.9}, - {12000,0.88}, - {12149,0.83}, - {12150,0.9}, - {12287,0.89}, - {12288,0.88}, - {12499,0}, - {12500,0.11}, - {12799,0.94}, - {12800,0.91}, - {12959,0.97}, - {12960,0.94}, - {13121,0.94}, - {13122,0.93}, - {13132,0.73}, - {13499,1.01}, - {13500,1.01}, - {13607,1.28}, - {13608,1.26}, - {13823,0.96}, - {13824,0.98}, - {14399,1.18}, - {14400,1.14}, - {14579,1.09}, - {14580,1.07}, - {14999,1.17}, - {15000,1.23}, - {15359,1.11}, - {15360,1.12}, - {15427,0.73}, - {15503,0.73}, - {15504,1.07}, - {15551,1.13}, - {15552,1.14}, - {15659,1.04}, - {15660,1.01}, - {15999,1.22}, - {16000,1.21}, - {16072,1.44}, - {16127,1.56}, - {16199,1.22}, - {16200,1.2}, - {16383,1.16}, - {16384,1.18}, - {16523,1.57}, - {16820,1.46}, - {17167,1.35}, - {17219,1.19}, - {17279,1.29}, - {17280,1.23}, - {17480,1.16}, - {17495,1.32}, - {17496,1.3}, - {17759,0.9}, - {17760,1.04}, - {17999,1.47}, - {18000,1.45}, - {18143,1.51}, - {18144,1.46}, - {18431,1.26}, - {18432,1.27}, - {18620,0.21}, - {18749,1.6}, - {18750,1.57}, - {19199,1.52}, - {19200,1.44}, - {19439,1.41}, - {19440,1.44}, - {19999,1.6}, - {20000,1.54}, - {20249,1.61}, - {20250,1.61}, - {20479,1.52}, - {20480,1.44}, - {20735,1.48}, - {20736,1.51} -}; - -const sf_Table SF_FFT[SF_FFT_SIZE] = { - {1,0.003}, - {2,0.002}, - {3,0.002}, - {4,0.002}, - {5,0.003}, - {6,0.002}, - {7,0.002}, - {8,0.002}, - {9,0.003}, - {10,0.003}, - {11,0.003}, - {12,0.002}, - {14,0.003}, - {15,0.003}, - {16,0.003}, - {18,0.003}, - {20,0.003}, - {21,0.004}, - {24,0.004}, - {25,0.004}, - {27,0.004}, - {30,0.004}, - {32,0.005}, - {36,0.004}, - {40,0.005}, - {45,0.005}, - {48,0.006}, - {50,0.006}, - {54,0.006}, - {60,0.007}, - {64,0.006}, - {72,0.008}, - {75,0.008}, - {80,0.009}, - {81,0.008}, - {90,0.009}, - {96,0.009}, - {100,0.01}, - {108,0.011}, - {120,0.012}, - {125,0.013}, - {128,0.013}, - {135,0.013}, - {144,0.014}, - {150,0.015}, - {160,0.016}, - {162,0.015}, - {180,0.017}, - {192,0.017}, - {200,0.021}, - {216,0.021}, - {225,0.023}, - {240,0.023}, - {243,0.023}, - {250,0.026}, - {256,0.022}, - {270,0.026}, - {288,0.027}, - {300,0.032}, - {320,0.029}, - {324,0.03}, - {360,0.038}, - {375,0.04}, - {384,0.034}, - {400,0.039}, - {405,0.039}, - {432,0.04}, - {450,0.046}, - {480,0.046}, - {486,0.047}, - {500,0.052}, - {512,0.046}, - {540,0.055}, - {576,0.052}, - {600,0.06}, - {625,0.07}, - {640,0.059}, - {648,0.062}, - {675,0.069}, - {720,0.068}, - {729,0.072}, - {750,0.08}, - {756,0.103}, - {768,0.068}, - {800,0.079}, - {810,0.081}, - {864,0.082}, - {896,0.121}, - {900,0.09}, - {960,0.09}, - {972,0.095}, - {1000,0.107}, - {1008,0.138}, - {1024,0.094}, - {1080,0.107}, - {1120,0.16}, - {1125,0.122}, - {1134,0.159}, - {1152,0.111}, - {1200,0.12}, - {1215,0.122}, - {1250,0.142}, - {1260,0.182}, - {1280,0.115}, - {1296,0.123}, - {1344,0.182}, - {1350,0.141}, - {1440,0.14}, - {1458,0.145}, - {1500,0.156}, - {1512,0.21}, - {1536,0.14}, - {1600,0.159}, - {1620,0.161}, - {1680,0.24}, - {1701,0.24}, - {1728,0.163}, - {1792,0.243}, - {1800,0.188}, - {1875,0.213}, - {1890,0.276}, - {1920,0.186}, - {1944,0.195}, - {2000,0.214}, - {2016,0.281}, - {2025,0.215}, - {2048,0.197}, - {2100,0.315}, - {2160,0.213}, - {2187,0.221}, - {2240,0.318}, - {2250,0.247}, - {2268,0.327}, - {2304,0.215}, - {2400,0.249}, - {2430,0.251}, - {2500,0.284}, - {2520,0.374}, - {2560,0.245}, - {2592,0.259}, - {2688,0.377}, - {2700,0.285}, - {2800,0.418}, - {2835,0.421}, - {2880,0.285}, - {2916,0.293}, - {3000,0.334}, - {3024,0.425}, - {3072,0.284}, - {3125,0.383}, - {3150,0.487}, - {3200,0.347}, - {3240,0.338}, - {3360,0.49}, - {3375,0.384}, - {3402,0.498}, - {3456,0.341}, - {3500,0.556}, - {3584,0.513}, - {3600,0.395}, - {3645,0.392}, - {3750,0.448}, - {3780,0.572}, - {3840,0.384}, - {3888,0.399}, - {4000,0.456}, - {4032,0.572}, - {4050,0.444}, - {4096,0.366}, - {4200,0.66}, - {4320,0.449}, - {4374,0.466}, - {4480,0.68}, - {4500,0.51}, - {4536,0.684}, - {4608,0.464}, - {4725,0.766}, - {4800,0.51}, - {4860,0.523}, - {5000,0.597}, - {5040,0.81}, - {5103,0.803}, - {5120,0.525}, - {5184,0.549}, - {5250,0.889}, - {5376,0.786}, - {5400,0.622}, - {5600,0.906}, - {5625,0.689}, - {5670,0.905}, - {5760,0.631}, - {5832,0.657}, - {6000,0.723}, - {6048,0.956}, - {6075,0.73}, - {6144,0.655}, - {6250,0.815}, - {6300,1.063}, - {6400,0.705}, - {6480,0.694}, - {6561,0.724}, - {6720,1.073}, - {6750,0.803}, - {6804,1.067}, - {6912,0.729}, - {7000,1.238}, - {7168,1.087}, - {7200,0.819}, - {7290,0.818}, - {7500,0.922}, - {7560,1.219}, - {7680,0.837}, - {7776,0.84}, - {7875,1.372}, - {8000,0.965}, - {8064,1.267}, - {8100,0.948}, - {8192,0.904}, - {8400,1.391}, - {8505,1.425}, - {8640,0.94}, - {8748,1.011}, - {8960,1.507}, - {9000,1.229}, - {9072,1.573}, - {9216,1.068}, - {9375,1.307}, - {9600,1.248}, - {9720,1.218}, - {10000,1.402} -}; - -#endif diff --git a/user/nobody/allp.c b/user/nobody/allp.c deleted file mode 100644 index df6d2b70d0..0000000000 --- a/user/nobody/allp.c +++ /dev/null @@ -1,45 +0,0 @@ -#include - -#include "allp.h" -#include "apfilt.h" - -static int n1, n2, nw, nj; -static float** pp; - -void allp_init(int nw1, int nj1, int m1, int m2, float **pp1) -{ - nw = nw1; - nj = nj1; - n1 = m1; - n2 = n2; - pp = pp1; -} - -void allp_lop (bool adj, bool add, int nx, int ny, float* xx, float* yy) -{ - int i1, i2, iw, is, i; - float a[7]; - - sf_adjnull (adj, add, nx, ny, xx, yy); - - for (i2=0; i2 < n2-1; i2++) { - for (i1 = nw*nj; i1 < n1-nw*nj; i1++) { - i = i1 + i2*n1; - - passfilter(nw, pp[i2][i1], a); - - for (iw = 0; iw <= 2*nw; iw++) { - is = (iw-nw)*nj; - - if (adj) { - xx[i+is+n1] += yy[i] * a[iw]; - xx[i-is] -= yy[i] * a[iw]; - } else { - yy[i] += (xx[i+is+n1] - xx[i-is]) * a[iw]; - } - } - } - } -} - -/* $Id$ */ diff --git a/user/nobody/bandpass.c b/user/nobody/bandpass.c deleted file mode 100644 index 11bea0d70c..0000000000 --- a/user/nobody/bandpass.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Bandpass filtering */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include - -#include "bandpass.h" -#include "butter.h" - -static butter blo, bhi; - -void bandpass_init (void) -/*< initialize (using a fixed band definition) >*/ -{ - const float fhi=0.275314, flo=0.0141445; - const int nphi=10, nplo=5; - - blo = butter_init(false,flo,nplo); - bhi = butter_init(true, fhi,nphi); -} - -void bandpass_close (void) -/*< free allocated storage >*/ -{ - butter_close(blo); - butter_close(bhi); -} - -void bandpass (int n1, float* trace /* [n1] */) -/*< bandpass a trace (in place) >*/ -{ - int i1; - float t; - - butter_apply(blo,n1,trace); - for (i1=0; i1 < n1/2; i1++) { - t=trace[i1]; - trace[i1]=trace[n1-1-i1]; - trace[n1-1-i1]=t; - } - butter_apply(blo,n1,trace); - for (i1=0; i1 < n1/2; i1++) { - t=trace[i1]; - trace[i1]=trace[n1-1-i1]; - trace[n1-1-i1]=t; - } - butter_apply(bhi,n1,trace); - for (i1=0; i1 < n1/2; i1++) { - t=trace[i1]; - trace[i1]=trace[n1-1-i1]; - trace[n1-1-i1]=t; - } - butter_apply(bhi,n1,trace); - for (i1=0; i1 < n1/2; i1++) { - t=trace[i1]; - trace[i1]=trace[n1-1-i1]; - trace[n1-1-i1]=t; - } -} - -/* $Id$ */ diff --git a/user/nobody/bessel.c b/user/nobody/bessel.c deleted file mode 100644 index d98d10d822..0000000000 --- a/user/nobody/bessel.c +++ /dev/null @@ -1,214 +0,0 @@ -/* Bessel function */ -/* - Copyright (C) 2008 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -/* 1983 version. w. fullerton, c3, los alamos scientific lab */ - -#include -#include - -#include - -#include "bessel.h" - -static float xmin, xsml, xmax; - -static float cheb_eval(float x, const double *cs, int n) -/* evaluate n-term chebyshev series cs at x - r. broucke, algorithm 446, c.a.c.m., 16, 254 (1973) */ -{ - int i, ni; - float c, b0, b1, b2, twox; - - b0 = b1 = b2 = 0.; - twox = 2.*x; - - for (i=0; i < n; i++) { - b2 = b1; - b1 = b0; - ni = n - 1 - i; - b0 = twox*b1 - b2 + cs[ni]; - } - - c = 0.5 * (b0-b2); - return c; -} - -static int bessel_init(const double *cs, int n) -{ - double err; - int i, ii; - - err = 0.; - for (ii=0; ii < n; ii++) { - i = n - 1 - ii; - err += fabs(cs[i]); - if (err > 0.1*FLT_EPSILON) - return (i+1); - } - - sf_error("%s: precision issue",__FILE__); - return 0; -} - -static float bessel_i1e(float x) -{ - const int nb=11, na1=21, na2=22; - const double bc[] = { - -.001971713261099859, - .407348876675464810, - .034838994299959456, - .001545394556300123, - .000041888521098377, - .000000764902676483, - .000000010042493924, - .000000000099322077, - .000000000000766380, - .000000000000004741, - .000000000000000024 - }; - const double a1c[] = { - -.02846744181881479, - -.01922953231443221, - -.00061151858579437, - -.00002069971253350, - +.00000858561914581, - +.00000104949824671, - -.00000029183389184, - -.00000001559378146, - +.00000001318012367, - -.00000000144842341, - -.00000000029085122, - +.00000000012663889, - -.00000000001664947, - -.00000000000166665, - +.00000000000124260, - -.00000000000027315, - +.00000000000002023, - +.00000000000000730, - -.00000000000000333, - +.00000000000000071, - -.00000000000000006 - }; - const double a2c[] = { - +.02857623501828014, - -.00976109749136147, - -.00011058893876263, - -.00000388256480887, - -.00000025122362377, - -.00000002631468847, - -.00000000383538039, - -.00000000055897433, - -.00000000001897495, - +.00000000003252602, - +.00000000001412580, - +.00000000000203564, - -.00000000000071985, - -.00000000000040836, - -.00000000000002101, - +.00000000000004273, - +.00000000000001041, - -.00000000000000382, - -.00000000000000186, - +.00000000000000033, - +.00000000000000028, - -.00000000000000003 - }; - static int ntb=0, nta1, nta2; - float y, b; - - if (0.0==x) return 0.0f; - - if (0==ntb) { - ntb = bessel_init(bc,nb); - nta1 = bessel_init(a1c,na1); - nta2 = bessel_init(a2c,na2); - } - - y = fabsf(x); - - if (y <= 3.0) { - if (y < xmin) sf_error("%s: underflow",__FILE__); - if (y > xsml) { - b = x * (.875 + cheb_eval(y*y/4.5-1., bc,ntb)); - } else { - b = 0.5*x; - } - b *= expf(-y); - } else { - if (y <= 8.0) { - b = (.375 + cheb_eval ((48./y-11.)/5., a1c, nta1)) / sqrtf(y); - } else { - b = (.375 + cheb_eval (16./y-1.0, a2c, nta2)) / sqrtf(y); - } - b *= SF_SIG(x); - } - - return b; -} - - -float bessel_i1 (float x) -/*< Bessel I_1 function >*/ -{ - const int ns=11; - const double cs[] = { - -.001971713261099859, - .407348876675464810, - .034838994299959456, - .001545394556300123, - .000041888521098377, - .000000764902676483, - .000000010042493924, - .000000000099322077, - .000000000000766380, - .000000000000004741, - .000000000000000024 - }; - static int nt=0; - float y, b; - - if (0.0==x) return 0.0f; - - if (0==nt) { - nt = bessel_init(cs,ns); - xmin = 2.0*FLT_MIN; - xsml = sqrtf(8.0*FLT_EPSILON); - xmax = logf (FLT_MAX); - } - - y = fabsf(x); - - if (y < xmin) sf_error("%s: undeflow",__FILE__); - if (y > xmax) sf_error("%s: overflow",__FILE__); - - if (y <= 3.0) { - if (y > xsml) { - b = x * (0.875 + cheb_eval(y*y/4.5-1.,cs,nt)); - } else { - b = 0.5*x; - } - } else { - b = exp(y) * bessel_i1e(x); - } - - return b; -} - - - - diff --git a/user/nobody/boxsl.c b/user/nobody/boxsl.c deleted file mode 100644 index c6d37b9496..0000000000 --- a/user/nobody/boxsl.c +++ /dev/null @@ -1,210 +0,0 @@ -#include - -#include - -#include "boxsl.h" -#include "triangle.h" - -static int n1, n2, rect; -static float **p, **tmp, *trace1, *trace2, amp; -static triangle tr; - -void boxsl_init(int m1, int m2, int rect1, int rect2) -{ - n1 = m1; - n2 = m2; - rect = rect2; - p = sf_floatalloc2(n1,n2+rect); - - tmp = sf_floatalloc2(n1,n2+rect); - trace1 = sf_floatalloc(n1); - trace2 = sf_floatalloc(n1); - - tr = triangle_init (rect1,n1); - amp = 1./rect; -} - -void boxsl_set(int m2, float** p1) -{ - int i1, i2; - - if (m2 >= n2+rect) { - for (i2=0; i2 < n2+rect; i2++) { - for (i1=0; i1 < n1; i1++) { - p[i2][i1]=p1[i2][i1]; - } - } - } else { - for (i2=0; i2 < m2; i2++) { - for (i1=0; i1 < n1; i1++) { - p[i2][i1]=p1[i2][i1]; - } - } - for (i2=m2; i2 < n2+rect; i2++) { - for (i1=0; i1 < n1; i1++) { - p[i2][i1]=p1[m2-1][i1]; - } - } - } -} - -void boxsl_close(void) -{ - free(*p); - free(p); - free(*tmp); - free(tmp); - free(trace1); - free(trace2); -} - -static void roll(bool adj, float** in) -{ - int i1, i2, it; - float t; - - if (adj) { - /* roll from the future */ - for (i2=n2+rect-2; i2 >=0; i2--) { - for (i1=0; i1 < n1; i1++) { - t = i1 + p[i2][i1]; - if (t < 0.) continue; - it = t; - t -= it; - if (it >=0 && it < n1-1) - in[i2][i1] += in[i2+1][it]*(1.-t) + in[i2+1][it+1]*t; - } - } - } else { - /* unroll to the future */ - for (i2=0; i2 < n2+rect-1; i2++) { - for (i1=0; i1 < n1; i1++) { - t = i1 + p[i2][i1]; - if (t < 0.) continue; - it = t; - t -= it; - if (it >=0 && it < n1-1) { - in[i2+1][it] += in[i2][i1]*(1.-t); - in[i2+1][it+1] += in[i2][i1]*t; - } - } - } - } -} - -static void shifts(bool adj, float** in, float* out) -{ - int i1, i2, ir, it; - float t; - - for (i2=0; i2 < n2+rect; i2++) { - if (adj) { - for (i1=0; i1 < n1; i1++) { - in[i2][i1] = amp*out[i2*n1+i1]; - } - - if (i2 < n2) { - for (i1=0; i1 < n1; i1++) { - trace2[i1] = -amp*out[(i2+rect)*n1+i1]; - } - - for (ir=i2+rect-1; ir >= i2; ir--) { - for (i1=0; i1 < n1; i1++) { - trace1[i1] = trace2[i1]; - trace2[i1] = 0.; - } - for (i1=0; i1 < n1; i1++) { - t = i1 + p[ir][i1]; - if (t < 0.) continue; - it = t; - t -= it; - if (it >=0 && it < n1-1) - trace2[i1] = trace1[it]*(1.-t) + trace1[it+1]*t; - } - } - - for (i1=0; i1 < n1; i1++) { - in[i2][i1] += trace2[i1]; - } - } - } else { - if (i2 < n2) { - for (i1=0; i1 < n1; i1++) { - trace2[i1]=in[i2][i1]; - } - - for (ir=i2; ir < i2+rect; ir++) { - for (i1=0; i1 < n1; i1++) { - trace1[i1] = trace2[i1]; - trace2[i1]=0.; - } - for (i1=0; i1 < n1; i1++) { - t = i1 + p[ir][i1]; - if (t < 0.) continue; - it = t; - t -= it; - if (it >=0 && it < n1-1) { - trace2[it] += trace1[i1]*(1.-t); - trace2[it+1] += trace1[i1]*t; - } - } - } - - for (i1=0; i1 < n1; i1++) { - out[(i2+rect)*n1+i1] -= amp*trace2[i1]; - } - } - - for (i1=0; i1 < n1; i1++) { - out[i2*n1+i1] += amp*in[i2][i1]; - } - } - } -} - -void boxsl_lop(bool adj, bool add, int nx, int ny, float* x, float* y) -{ - int i1, i2; - - if (nx != n1*n2 || ny != n1*(n2+rect)) - sf_error("%s: wrong dimensions",__FILE__); - - sf_adjnull(adj, add, nx, ny, x, y); - - if (adj) { - shifts(adj,tmp,y); - roll(adj,tmp); - for (i2=0; i2 < n2; i2++) { - smooth (tr,0,1,false,tmp[i2]); - for (i1=0; i1 < n1; i1++) { - x[i2*n1+i1] += tmp[i2][i1]; - } - } - } else { - for (i2=0; i2 < n2; i2++) { - for (i1=0; i1 < n1; i1++) { - tmp[i2][i1] = x[i2*n1+i1]; - } - smooth (tr,0,1,false,tmp[i2]); - } - for (i2=n2; i2 < n2+rect; i2++) { - for (i1=0; i1 < n1; i1++) { - tmp[i2][i1] = 0.; - } - } - roll(adj,tmp); - shifts(adj,tmp,y); - } -} - -void trisl_lop(bool adj, bool add, int nx, int ny, float* x, float* y) -{ - if (nx != n1*(n2+rect) || ny != nx) - sf_error("%s: wrong dimensions",__FILE__); - - sf_adjnull(adj, add, nx, ny, x, y); - - boxsl_lop(true, false, n1*n2, ny, tmp[0], adj? y: x); - boxsl_lop(false, true, n1*n2, ny, tmp[0], adj? x: y); -} - diff --git a/user/nobody/cam.c b/user/nobody/cam.c deleted file mode 100644 index 6f9c57bf1b..0000000000 --- a/user/nobody/cam.c +++ /dev/null @@ -1,310 +0,0 @@ -/* 3-D CAM migration/modeling using extended split-step */ -/* - Copyright (C) 2006 Colorado School of Mines - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include -/*^*/ - -#include "fft3.h" -#include "taper.h" - -#include "slice.h" -/*^*/ - -#define LOOP(a) for(ihx=0;ihxn-1) ? n-1 : i ); -#define KMAP(i,n) (i*/ -{ - int imy, imx, ihx, ilx, ily; - int jmx, jhx; - float my, mx, hx, k; - float kmx, khx; - - az = sf_nod(az_); - amx= sf_nod(amx_); - amy= sf_nod(amy_); - alx= sf_nod(alx_); - aly= sf_nod(aly_); - ahx= sf_nod(ahx_); - - /* construct K-domain axes */ - X2K(amx,bmx,pmx); - X2K(amy,bmy,pmy); - X2K(ahx,bhx,phx); - fft3_init(bmx.n,bmy.n,bhx.n); - - /* precompute wavenumbers */ - ksx= sf_floatalloc2(bmx.n,bhx.n); - krx= sf_floatalloc2(bmx.n,bhx.n); - for (imx=0; imx*/ -{ - fft3_close(); - taper3_close(); - - ; free( *ksx);free(ksx); - ; free( *krx);free(krx); - ; free( *is); free( is); - ; free( *ir); free( ir); - ; free( jx); - ; free( jy); - - free(**pk); free( *pk); free( pk); - free(**wk); free( *wk); free( wk); - free(**wt); free( *wt); free( wt); -} - -/*------------------------------------------------------------*/ - -void cam_ssf( - sf_complex w /* frequency */, - sf_complex ***wx /* wavefield */, - float **so /* slowness */, - float **ss /* slowness */, - int nr /* nr. of ref slo */, - float *sm /* ref slo squared */ - ) -/*< Wavefield extrapolation by SSF >*/ -{ - int imy,imx,ihx,jmy,js,jr; - float s, kmy, d, dsc,drc; - sf_complex co, w2, cs, cr, khy, kss, krr; - - co = sf_cmplx(0,0); -#ifdef SF_HAS_COMPLEX_H - w2 = w*w; -#else - w2 = sf_cmul(w,w); -#endif - -#ifdef SF_HAS_COMPLEX_H - LOOP( s = so[ jy[imy] ][ is[ihx][imx] ] - + so[ jy[imy] ][ ir[ihx][imx] ]; - wx[ihx][imy][imx] *= cexpf(-w*s* az.d/2); ); -#else - LOOP( s = so[ jy[imy] ][ is[ihx][imx] ] - + so[ jy[imy] ][ ir[ihx][imx] ]; - wx[ihx][imy][imx] = sf_cmul(wx[ihx][imy][imx], - cexpf(sf_crmul(w,-s*az.d/2))); ); -#endif - - /* FFT */ - KOOP( pk[ihx][imy][imx] = sf_cmplx(0.,0.); ); - LOOP( pk[ihx][imy][imx] = wx[ihx][imy][imx]; ); - fft3(false,(kiss_fft_cpx***) pk); - - LOOP( wx[ihx][imy][imx] = sf_cmplx(0.,0.); - wt[ihx][imy][imx] = 0.; ); - for (js=0; js - -#include -/*^*/ - -#include "camig.h" -#include "taper.h" -#include "slowref.h" -#include "cam.h" - -#include "slice.h" -/*^*/ - -#define LOOP(a) for(ihx=0;ihx*/ -{ - int iz, j; - float dsmax; - - verb=verb_; - eps = eps_; - - az = sf_nod(az_); - aw = sf_nod(aw_); - ae = sf_nod(ae_); - amx= sf_nod(amx_); - amy= sf_nod(amy_); - alx= sf_nod(alx_); - aly= sf_nod(aly_); - ahx= sf_nod(ahx_); - - /* from hertz to radian */ - aw.d *= 2.*SF_PI; - aw.o *= 2.*SF_PI; - - dsmax = dtmax/az.d; - - /* CAM */ - cam_init(az_ , - amx_,amy_,ahx_, - alx_,aly_, - pmx ,pmy, phx, - tmx ,tmy, thx, - dsmax); - - /* precompute taper */ - taper3_init(ahx.n, - amy.n, - amx.n, - SF_MIN(thx,ahx.n-1), - SF_MIN(tmy,amy.n-1), - SF_MIN(tmx,amx.n-1), - false,true,true); - - /* compute reference slowness */ - ss = sf_floatalloc2(alx.n,aly.n); /* slowness */ - so = sf_floatalloc2(alx.n,aly.n); /* slowness */ - sm = sf_floatalloc2 (nrmax,az.n); /* reference slowness squared*/ - nr = sf_intalloc (az.n); /* number of reference slownesses */ - slow = slow_; - for (iz=0; iz*/ -{ - cam_close(); - - free(**wx); free( *wx); free( wx); - ; free( *ss); free( ss); - ; free( *so); free( so); - ; free( *sm); free( sm); - ; ; free( nr); -} - -/*------------------------------------------------------------*/ - -void camig_aloc() -/*< allocate migration storage >*/ -{ - qq = sf_floatalloc3(amx.n,amy.n,ahx.n); -} - -void camig_free() -/*< free migration storage >*/ -{ - free(**qq); free( *qq); free( qq); -} -/*------------------------------------------------------------*/ - -void camig(bool inv /* forward/adjoint flag */, - fslice data /* data [nw][nhx][nmy][nmx] */, - fslice imag /* image [nz][nhx][nmy][nmx] */) -/*< Apply migration/modeling >*/ -{ - int iz,iw,imy,imx,ihx,ilx,ily; - sf_complex w; - - if (!inv) { /* prepare image for migration */ - LOOP( qq[ihx][imy][imx] = 0.0; ); - for (iz=0; iz0; iz--) { - if (verb) sf_warning ("iw=%3d of %3d: iz=%3d of %3d", - iw+1,aw.n,iz+1,az.n); - fslice_get(imag,iz,qq[0][0]); -#ifdef SF_HAS_COMPLEX_H - LOOP( wx[ihx][imy][imx] += - qq[ihx][imy][imx]; ); -#else - LOOP( wx[ihx][imy][imx].r += - qq[ihx][imy][imx]; ); -#endif - /* upward continuation */ - fslice_get(slow,iz-1,ss[0]); - cam_ssf(w,wx,so,ss,nr[iz-1],sm[iz-1]); - SOOP( so[ily][ilx] = ss[ily][ilx]; ); - } - - fslice_get(imag,0,qq[0][0]); /* imaging @ iz=0 */ -#ifdef SF_HAS_COMPLEX_H - LOOP( wx[ihx][imy][imx] += - qq[ihx][imy][imx]; ); -#else - LOOP( wx[ihx][imy][imx].r += - qq[ihx][imy][imx]; ); -#endif - - taper3(wx); - fslice_put(data,iw,wx[0][0]); /* output data @ iz=0 */ - - } else { /* MIGRATION */ - w = sf_cmplx(eps*aw.d, - -(aw.o+iw*aw.d)); /* -1 for downward continuation */ - - fslice_get(data,iw,wx[0][0]); /* input data @ iz=0 */ - taper3(wx); - - fslice_get(imag,0,qq[0][0]); /* imaging @ iz=0 */ - LOOP(; qq[ihx][imy][imx] += - crealf(wx[ihx][imy][imx] ); ); - fslice_put(imag,0,qq[0][0]); - - fslice_get(slow,0,so[0]); - for (iz=0; iz*/ -{ - int iz,iw,ie, ilx,ily; - sf_complex w; - - for(ie=0; ie0; iz--) { - fslice_get(slow,iz-1,ss[0]); - cam_ssf(w,wx,so,ss,nr[iz-1],sm[iz-1]); - SOOP( so[ily][ilx] = ss[ily][ilx]; ); - } - - taper3(wx); - fslice_put(data,iw+ie*aw.n,wx[0][0]); - } else { /* DOWNWARD DATUMING */ - w = sf_cmplx(eps*aw.d,-(aw.o+iw*aw.d)); - - fslice_get(data,iw+ie*aw.n,wx[0][0]); - taper3(wx); - - fslice_get(slow,0,so[0]); - for (iz=0; iz*/ -{ - int iz,iw, ilx,ily; - sf_complex w; - - /* loop over frequencies w */ - for (iw=0; iw - -void chebder (bool inv /* inverse flag (derivative or integral) */, - int n /* data size */, - const float *f /* input data */, - float *b /* output derivative */) -/*< Compute derivative or integral in the Chebyshev domain >*/ -{ - int i; - - n--; - if (inv) { - b[n] = f[n-1]/(2.*n); - for (i=2; i < n; i++) { - b[i] = (f[i-1] - f[i+1])/(2.*(i-1)); - } - b[1] = f[0] - 0.5*f[2]; - b[0] = 0.; - for (i=1; i < n; i+= 2) { - b[0] += b[i] - b[i+1]; - } - } else { - b[n] = 0.; - b[n-1] = 2.*n*f[n]; - for (i=n-1; i >= 2; i--) { - b[i-1] = 2.*(i-1)*f[i] + b[i+1]; - } - b[0] = f[1] + 0.5*b[2]; - } -} - diff --git a/user/nobody/coh.c b/user/nobody/coh.c deleted file mode 100644 index e985a38af8..0000000000 --- a/user/nobody/coh.c +++ /dev/null @@ -1,139 +0,0 @@ -#include -#include - -#include - -#include "coh.h" -#include "apfilt.h" - -static int window (int j, int w, int n); - -struct Coh { - int nx, ny, nz, nw, nj; - float*** pp; -}; - -coh coh_init(int nw, int nj, int nx, int ny, int nz, float ***pp) -{ - coh ap; - - ap = (coh) sf_alloc(1,sizeof(*ap)); - - ap->nw = nw; - ap->nj = nj; - ap->nx = nx; - ap->ny = ny; - ap->nz = nz; - ap->pp = pp; - - return ap; -} - -static int window (int j, int w, int n) { - j -= w/2; - if (j < 0) j = 0; - else if (j + w > n) j = n - w; - return j; -} - -float coh1 (const coh ap, int jx, int jy, int jz, int nx, int ny, int nz, - float*** xx) -{ - int ix, iy, iz, iw, is, xmin, xmax, np; - float f[7], ab, a2, b2, a, b, p; - - jy = window(jy,ny,ap->ny-1); - jz = window(jz,nz,ap->nz); - - xmin = window(jx,nx,ap->nx); - xmax = xmin+nx; - - if (xmin < ap->nw*ap->nj) xmin = ap->nw*ap->nj; - if (xmax > ap->nx-ap->nw*ap->nj) xmax=ap->nx-ap->nw*ap->nj; - - /* find the average dip in window */ - p = 0.; - np = 0; - for (iz=jz; iz < jz+nz; iz++) { - for (iy=jy; iy < jy+ny; iy++) { - for (ix = xmin; ix < xmax; ix++) { - p += ap->pp[iz][iy][ix]; - np++; - } - } - } - if (np) p /= np; - - ab = a2 = b2 = 0.; - passfilter(ap->nw, p, f); - - for (iz=jz; iz < jz+nz; iz++) { - for (iy=jy; iy < jy+ny; iy++) { - for (ix = xmin; ix < xmax; ix++) { - a = b = 0.; - for (iw = 0; iw <= 2*ap->nw; iw++) { - is = (iw-ap->nw)*ap->nj; - a += f[iw]*xx[iz][iy+1][ix+is]; - b += f[iw]*xx[iz][iy ][ix-is]; - } - ab += a*b; - a2 += a*a; - b2 += b*b; - } - } - } - - return ab/(sqrtf(a2*b2)+FLT_EPSILON); -} - -float coh2 (const coh ap, int jx, int jy, int jz, int nx, int ny, int nz, - float*** xx) -{ - int ix, iy, iz, iw, is, xmin, xmax, np; - float f[7], ab, a2, b2, a, b, p; - - jy = window(jy,ny,ap->ny); - jz = window(jz,nz,ap->nz-1); - - xmin = window(jx,nx,ap->nx); - xmax = xmin+nx; - - if (xmin < ap->nw*ap->nj) xmin = ap->nw*ap->nj; - if (xmax > ap->nx-ap->nw*ap->nj) xmax=ap->nx-ap->nw*ap->nj; - - /* find the average dip in window */ - p = 0.; - np = 0; - for (iz=jz; iz < jz+nz; iz++) { - for (iy=jy; iy < jy+ny; iy++) { - for (ix = xmin; ix < xmax; ix++) { - p += ap->pp[iz][iy][ix]; - np++; - } - } - } - if (np) p /= np; - - ab = a2 = b2 = 0.; - passfilter(ap->nw, p, f); - - for (iz=jz; iz < jz+nz; iz++) { - for (iy=jy; iy < jy+ny; iy++) { - for (ix = xmin; ix < xmax; ix++) { - a = b = 0.; - for (iw = 0; iw <= 2*ap->nw; iw++) { - is = (iw-ap->nw)*ap->nj; - a += f[iw]*xx[iz+1][iy][ix+is]; - b += f[iw]*xx[iz ][iy][ix-is]; - } - ab += a*b; - a2 += a*a; - b2 += b*b; - } - } - } - - return ab/(sqrt(a2*b2)+FLT_EPSILON); -} - -/* $Id$ */ diff --git a/user/nobody/comaz.c b/user/nobody/comaz.c deleted file mode 100644 index 7ea03d6d2b..0000000000 --- a/user/nobody/comaz.c +++ /dev/null @@ -1,414 +0,0 @@ -/* 3-D prestack migration/modeling by split-step common-azimuth */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include -/*^*/ - -#include "comaz.h" -#include "fft3.h" -#include "taper.h" -#include "slowref.h" - -#define LOOPxyh(a) for(ix=0;ix*/ -{ - int ix, iy, jy, ih, jh, iu, iv; - float x, y, h, y0, h0, dy, dh, ky, kh, k; - - nz = nz1; - dz = dz1; - - nx = nx1; - dx = 2.0*SF_PI/(nx*dx1); - x0 = -SF_PI/ dx1 ; - - ny = ny1; - dy = 2.0*SF_PI/(ny*dy1); - y0 = -SF_PI/ dy1 ; - - nh = nh1; - nh2 = nh+npad; - - dh = 2.0*SF_PI/(nh2*dh1); - h0 = -SF_PI/ dh1 ; - - nu = nu1; - nv = nv1; - - nrmax = nr1; - - fft3_init(nh2,ny,nx); - - /* allocate workspace */ - sz = sf_floatalloc2 (nrmax,nz); /* reference slowness */ - sm = sf_floatalloc2 (nrmax,nz); /* reference slowness squared*/ - nr = sf_intalloc ( nz); /* number of reference slownesses */ - - qq = sf_floatalloc3 (nh,nu,nv); /* image */ - ss = sf_floatalloc2 (nu,nv); /* slowness */ - - ks = sf_floatalloc2 (nh2,ny); /* source wavenumber */ - kr = sf_floatalloc2 (nh2,ny); /* receiver wavenumber */ - is = sf_intalloc2 (nh ,ny); /* source reference */ - ir = sf_intalloc2 (nh ,ny); /* receiver reference */ - ii = sf_intalloc (nx); /* midpoint reference */ - ij = sf_intalloc (ny); /* midpoint reference */ - - pk = sf_complexalloc3 (nh2,ny, nx); /* padded wavefield */ - wk = sf_complexalloc3 (nh2,ny, nx); /* k wavefield */ - wx = sf_complexalloc3 (nh, ny, nx); /* x wavefield */ - - ms = sf_intalloc3 (nh, ny, nx); /* MRS map */ - mr = sf_intalloc3 (nh, ny, nx); /* MRS map */ - - skip = sf_boolalloc3 (nrmax,nrmax,nz);/* skip S-R reference slowness combination */ - - /* precompute wavenumbers */ - for (ix=0; ix= nv) iv=nv-1; - ii[ix] = iv; - } - - for (iy=0; iy= nu) iu=nu-1; - ij[iy] = iu; - - for (ih=0; ih= nu) iu=nu-1; - is[iy][ih] = iu; - - iu = 0.5+(y+h-u0)/du; - if (iu < 0) iu=0; - else if (iu >= nu) iu=nu-1; - ir[iy][ih] = iu; - } - - for (ih=0; ih*/ -{ - free(**pk); - free( *pk); free(pk); - free(**wk); - free( *wk); free(wk); - free(**wx); - free( *wx); free(wx); - - free( *sz); free(sz); - free( *sm); free(sm); - free( nr); - - free(**qq); - free( *qq); free( qq); - - free( *ss); free( ss); - free( *ks); free( ks); - free( *kr); free( kr); - free( *is); free( is); - free( *ir); free( ir); - - fslice_close(mms); - fslice_close(mmr); - taper3_close(); - fft3_close(); -} - -void comaz(bool verb /* verbosity flag */, - bool inv /* migration/modeling flag */, - float eps /* stability factor */, - int nw, float dw, float w0 /* frequency (radian) */, - sf_file data /* data [nw][nx][ny][nh] */, - slice imag /* image file [nz][nv][nu][nh] */, - slice slow /* slowness [nz][nv][nu] */, - float dt /* time error */) -/*< Apply migration/modeling >*/ -{ - int iz,iw,ix,iy,ih,iu,iv, j,k; - int jx; - float sy, kx; - float complex cshift, cref, w, w2, cs, cr, kh, kss, krr; - - if (!inv) { /* prepare image for migration */ - LOOPvuh( qq[iv][iu][ih] = 0.0; ); - for (iz=0; iz sy) ms[ix][iy][ih]++; - if(ss[ii[ix]][ ir[iy][ih] ] > sy) mr[ix][iy][ih]++; ); - } - fslice_put(mms,iz,ms[0][0]); - fslice_put(mmr,iz,mr[0][0]); - for (j=0; j=0; iz--) { - /* w-x @ bottom */ - LOOPxyh2( pk[ix][iy][ih] = 0.;); - taper3(true,true,false,nx,ny,nh,wx); - LOOPxyh( sy = 0.5*(ss[ ii[ix] ][ is[iy][ih] ] + - ss[ ii[ix] ][ ir[iy][ih] ]); - cshift = cexpf(-w*sy*dz); - pk[ix][iy][ih] = - wx[ix][iy][ih] * cshift; ); - - /* FFT */ - fft3(false,pk); - - slice_get(slow,iz,ss[0]); - fslice_get(mms,iz,ms[0][0]); - fslice_get(mmr,iz,mr[0][0]); - - LOOPxyh( wx[ix][iy][ih] = 0; ); - for (j=0; j -/*^*/ - -#include "cpredict.h" -#include "cpwd.h" - -static int n1, nb; -static sf_bands slv; -static float *offd, eps, *tt; -static cpwd w; - -void cpredict_init (int nx /* data size */, - float e /* regularization parameter */) -/*< initialize >*/ -{ - const int nw=1; - - n1 = nx; - nb = 2*nw; - - eps = e; - - slv = sf_banded_init (n1, nb); - offd = sf_floatalloc (nb); - - w = cpwd_init (n1, nw); - tt = sf_floatalloc (n1); -} - -void cpredict_close (void) -/*< free allocated storage >*/ -{ - sf_banded_close (slv); - free (offd); - cpwd_close (w); - free (tt); -} - -void cpredict_step(bool adj /* adjoint flag */, - bool forw /* forward or backward */, - float* trace /* trace */, - float pp /* slope */) -/*< prediction step >*/ -{ - float diag; - - offd[0] = -4.*eps; - offd[1] = eps; - diag = 6.*eps + cpwd_define (forw, w, pp, offd); - sf_banded_const_define (slv, diag, offd); - - if (adj) { - sf_banded_solve (slv, trace); - cpwd_set (true, w, trace, trace, tt); - } else { - cpwd_set (false, w, trace, trace, tt); - sf_banded_solve (slv, trace); - } -} diff --git a/user/nobody/ctmf.c b/user/nobody/ctmf.c deleted file mode 100644 index 64e53dccdf..0000000000 --- a/user/nobody/ctmf.c +++ /dev/null @@ -1,444 +0,0 @@ -/* - * ctmf.c - Constant-time median filtering - * Copyright (C) 2006 Simon Perreault - * - * Reference: S. Perreault and P. Hébert, "Median Filtering in Constant Time", - * IEEE Transactions on Image Processing, September 2007. - * - * This program has been obtained from http://nomis80.org/ctmf.html. No patent - * covers this program, although it is subject to the following license: - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * Contact: - * Laboratoire de vision et systèmes numériques - * Pavillon Adrien-Pouliot - * Université Laval - * Sainte-Foy, Québec, Canada - * G1K 7P4 - * - * perreaul@gel.ulaval.ca - */ - -/* Standard C includes */ -#include -#include -#include -#include - -/* Type declarations */ -#ifdef _MSC_VER -#include -typedef UINT8 uint8_t; -typedef UINT16 uint16_t; -typedef UINT32 uint32_t; -#pragma warning( disable: 4799 ) -#else -#include -#endif - -/* Intrinsic declarations */ -#if defined(__SSE2__) || defined(__MMX__) -#if defined(__SSE2__) -#include -#define USE_SSE2 1 -#elif defined(__MMX__) -#include -#define USE_MMX 1 -#endif - -#if defined(__GNUC__) && __GNUC__ >= 4 -/* gcc 3.4 lacks mm_malloc.h */ -#include -#define HAVE_MM_MALLOC 1 -#elif defined(_MSC_VER) -#include -#else -/* No aligned malloc - no SSE2/MMX! */ -#undef USE_SSE2 -#undef USE_MMX - -#endif - -#elif defined(__ALTIVEC__) -#include -#endif - -/* Compiler peculiarities */ -#if defined(__GNUC__) -#include -#define inline __inline__ -#define align(x) __attribute__ ((aligned (x))) -#elif defined(_MSC_VER) -#define inline __inline -#define align(x) __declspec(align(x)) -#else -#define inline -#define align(x) -#endif - -#ifndef MIN -#define MIN(a,b) ((a) > (b) ? (b) : (a)) -#endif - -#ifndef MAX -#define MAX(a,b) ((a) < (b) ? (b) : (a)) -#endif - -/** - * This structure represents a two-tier histogram. The first tier (known as the - * "coarse" level) is 4 bit wide and the second tier (known as the "fine" level) - * is 8 bit wide. Pixels inserted in the fine level also get inserted into the - * coarse bucket designated by the 4 MSBs of the fine bucket value. - * - * The structure is aligned on 16 bytes, which is a prerequisite for SIMD - * instructions. Each bucket is 16 bit wide, which means that extra care must be - * taken to prevent overflow. - */ -typedef struct align(16) -{ - uint16_t coarse[16]; - uint16_t fine[16][16]; -} Histogram; - -/** - * HOP is short for Histogram OPeration. This macro makes an operation \a op on - * histogram \a h for pixel value \a x. It takes care of handling both levels. - */ -#define HOP(h,x,op) \ - h.coarse[x>>4] op; \ - *((uint16_t*) h.fine + x) op; - -#define COP(c,j,x,op) \ - h_coarse[ 16*(n*c+j) + (x>>4) ] op; \ - h_fine[ 16 * (n*(16*c+(x>>4)) + j) + (x & 0xF) ] op; - -/** - * Adds histograms \a x and \a y and stores the result in \a y. Makes use of - * SSE2, MMX or Altivec, if available. - */ -#if defined(USE_SSE2) -static inline void histogram_add( const uint16_t x[16], uint16_t y[16] ) -{ - *(__m128i*) &y[0] = _mm_add_epi16( *(__m128i*) &y[0], *(__m128i*) &x[0] ); - *(__m128i*) &y[8] = _mm_add_epi16( *(__m128i*) &y[8], *(__m128i*) &x[8] ); -} -#elif defined(USE_MMX) -static inline void histogram_add( const uint16_t x[16], uint16_t y[16] ) -{ - *(__m64*) &y[0] = _mm_add_pi16( *(__m64*) &y[0], *(__m64*) &x[0] ); - *(__m64*) &y[4] = _mm_add_pi16( *(__m64*) &y[4], *(__m64*) &x[4] ); - *(__m64*) &y[8] = _mm_add_pi16( *(__m64*) &y[8], *(__m64*) &x[8] ); - *(__m64*) &y[12] = _mm_add_pi16( *(__m64*) &y[12], *(__m64*) &x[12] ); -} -#elif defined(__ALTIVEC__) -static inline void histogram_add( const uint16_t x[16], uint16_t y[16] ) -{ - *(vector unsigned short*) &y[0] = vec_add( *(vector unsigned short*) &y[0], *(vector unsigned short*) &x[0] ); - *(vector unsigned short*) &y[8] = vec_add( *(vector unsigned short*) &y[8], *(vector unsigned short*) &x[8] ); -} -#else -static inline void histogram_add( const uint16_t x[16], uint16_t y[16] ) -{ - int i; - for ( i = 0; i < 16; ++i ) { - y[i] += x[i]; - } -} -#endif - -/** - * Subtracts histogram \a x from \a y and stores the result in \a y. Makes use - * of SSE2, MMX or Altivec, if available. - */ -#if defined(USE_SSE2) -static inline void histogram_sub( const uint16_t x[16], uint16_t y[16] ) -{ - *(__m128i*) &y[0] = _mm_sub_epi16( *(__m128i*) &y[0], *(__m128i*) &x[0] ); - *(__m128i*) &y[8] = _mm_sub_epi16( *(__m128i*) &y[8], *(__m128i*) &x[8] ); -} -#elif defined(USE_MMX) -static inline void histogram_sub( const uint16_t x[16], uint16_t y[16] ) -{ - *(__m64*) &y[0] = _mm_sub_pi16( *(__m64*) &y[0], *(__m64*) &x[0] ); - *(__m64*) &y[4] = _mm_sub_pi16( *(__m64*) &y[4], *(__m64*) &x[4] ); - *(__m64*) &y[8] = _mm_sub_pi16( *(__m64*) &y[8], *(__m64*) &x[8] ); - *(__m64*) &y[12] = _mm_sub_pi16( *(__m64*) &y[12], *(__m64*) &x[12] ); -} -#elif defined(__ALTIVEC__) -static inline void histogram_sub( const uint16_t x[16], uint16_t y[16] ) -{ - *(vector unsigned short*) &y[0] = vec_sub( *(vector unsigned short*) &y[0], *(vector unsigned short*) &x[0] ); - *(vector unsigned short*) &y[8] = vec_sub( *(vector unsigned short*) &y[8], *(vector unsigned short*) &x[8] ); -} -#else -static inline void histogram_sub( const uint16_t x[16], uint16_t y[16] ) -{ - int i; - for ( i = 0; i < 16; ++i ) { - y[i] -= x[i]; - } -} -#endif - -static inline void histogram_muladd( const uint16_t a, const uint16_t x[16], - uint16_t y[16] ) -{ - int i; - for ( i = 0; i < 16; ++i ) { - y[i] += a * x[i]; - } -} - -static void ctmf_helper( - const unsigned char* const src, unsigned char* const dst, - const int width, const int height, - const int src_step, const int dst_step, - const int r, const int cn, - const int pad_left, const int pad_right - ) -{ - const int m = height, n = width; - int i, j, k, c; - const unsigned char *p, *q; - - Histogram H[4]; - uint16_t *h_coarse, *h_fine, luc[4][16]; - - assert( src ); - assert( dst ); - assert( r >= 0 ); - assert( width >= 2*r+1 ); - assert( height >= 2*r+1 ); - assert( src_step != 0 ); - assert( dst_step != 0 ); - - /* SSE2 and MMX need aligned memory, provided by _mm_malloc(). */ -#if defined(USE_SSE2) || defined(USE_MMX) - h_coarse = (uint16_t*) _mm_malloc( 1 * 16 * n * cn * sizeof(uint16_t), 16 ); - h_fine = (uint16_t*) _mm_malloc( 16 * 16 * n * cn * sizeof(uint16_t), 16 ); - memset( h_coarse, 0, 1 * 16 * n * cn * sizeof(uint16_t) ); - memset( h_fine, 0, 16 * 16 * n * cn * sizeof(uint16_t) ); -#else - h_coarse = (uint16_t*) calloc( 1 * 16 * n * cn, sizeof(uint16_t) ); - h_fine = (uint16_t*) calloc( 16 * 16 * n * cn, sizeof(uint16_t) ); -#endif - - /* First row initialization */ - for ( j = 0; j < n; ++j ) { - for ( c = 0; c < cn; ++c ) { - COP( c, j, src[cn*j+c], += r+1 ); - } - } - for ( i = 0; i < r; ++i ) { - for ( j = 0; j < n; ++j ) { - for ( c = 0; c < cn; ++c ) { - COP( c, j, src[src_step*i+cn*j+c], ++ ); - } - } - } - - for ( i = 0; i < m; ++i ) { - - /* Update column histograms for entire row. */ - p = src + src_step * MAX( 0, i-r-1 ); - q = p + cn * n; - for ( j = 0; p != q; ++j ) { - for ( c = 0; c < cn; ++c, ++p ) { - COP( c, j, *p, -- ); - } - } - - p = src + src_step * MIN( m-1, i+r ); - q = p + cn * n; - for ( j = 0; p != q; ++j ) { - for ( c = 0; c < cn; ++c, ++p ) { - COP( c, j, *p, ++ ); - } - } - - /* First column initialization */ - memset( H, 0, cn*sizeof(H[0]) ); - memset( luc, 0, cn*sizeof(luc[0]) ); - if ( pad_left ) { - for ( c = 0; c < cn; ++c ) { - histogram_muladd( r, &h_coarse[16*n*c], H[c].coarse ); - } - } - for ( j = 0; j < (pad_left ? r : 2*r); ++j ) { - for ( c = 0; c < cn; ++c ) { - histogram_add( &h_coarse[16*(n*c+j)], H[c].coarse ); - } - } - for ( c = 0; c < cn; ++c ) { - for ( k = 0; k < 16; ++k ) { - histogram_muladd( 2*r+1, &h_fine[16*n*(16*c+k)], &H[c].fine[k][0] ); - } - } - - for ( j = pad_left ? 0 : r; j < (pad_right ? n : n-r); ++j ) { - for ( c = 0; c < cn; ++c ) { - const uint16_t t = 2*r*r + 2*r; - uint16_t sum = 0, *segment; - int b; - - histogram_add( &h_coarse[16*(n*c + MIN(j+r,n-1))], H[c].coarse ); - - /* Find median at coarse level */ - for ( k = 0; k < 16 ; ++k ) { - sum += H[c].coarse[k]; - if ( sum > t ) { - sum -= H[c].coarse[k]; - break; - } - } - assert( k < 16 ); - - /* Update corresponding histogram segment */ - if ( luc[c][k] <= j-r ) { - memset( &H[c].fine[k], 0, 16 * sizeof(uint16_t) ); - for ( luc[c][k] = j-r; luc[c][k] < MIN(j+r+1,n); ++luc[c][k] ) { - histogram_add( &h_fine[16*(n*(16*c+k)+luc[c][k])], H[c].fine[k] ); - } - if ( luc[c][k] < j+r+1 ) { - histogram_muladd( j+r+1 - n, &h_fine[16*(n*(16*c+k)+(n-1))], &H[c].fine[k][0] ); - luc[c][k] = j+r+1; - } - } - else { - for ( ; luc[c][k] < j+r+1; ++luc[c][k] ) { - histogram_sub( &h_fine[16*(n*(16*c+k)+MAX(luc[c][k]-2*r-1,0))], H[c].fine[k] ); - histogram_add( &h_fine[16*(n*(16*c+k)+MIN(luc[c][k],n-1))], H[c].fine[k] ); - } - } - - histogram_sub( &h_coarse[16*(n*c+MAX(j-r,0))], H[c].coarse ); - - /* Find median in segment */ - segment = H[c].fine[k]; - for ( b = 0; b < 16 ; ++b ) { - sum += segment[b]; - if ( sum > t ) { - dst[dst_step*i+cn*j+c] = 16*k + b; - break; - } - } - assert( b < 16 ); - } - } - } - -#if defined(USE_SSE2) || defined(USE_MMX) - _mm_empty(); - _mm_free(h_coarse); - _mm_free(h_fine); -#else - free(h_coarse); - free(h_fine); -#endif -} - -/** - * \brief Constant-time median filtering - * - * This function does a median filtering of an 8-bit image. The source image is - * processed as if it was padded with zeros. The median kernel is square with - * odd dimensions. Images of arbitrary size may be processed. - * - * To process multi-channel images, you must call this function multiple times, - * changing the source and destination adresses and steps such that each channel - * is processed as an independent single-channel image. - * - * Processing images of arbitrary bit depth is not supported. - * - * The computing time is O(1) per pixel, independent of the radius of the - * filter. The algorithm's initialization is O(r*width), but it is negligible. - * Memory usage is simple: it will be as big as the cache size, or smaller if - * the image is small. For efficiency, the histograms' bins are 16-bit wide. - * This may become too small and lead to overflow as \a r increases. - * - * \param src Source image data. - * \param dst Destination image data. Must be preallocated. - * \param width Image width, in pixels. - * \param height Image height, in pixels. - * \param src_step Distance between adjacent pixels on the same column in - * the source image, in bytes. - * \param dst_step Distance between adjacent pixels on the same column in - * the destination image, in bytes. - * \param r Median filter radius. The kernel will be a 2*r+1 by - * 2*r+1 square. - * \param cn Number of channels. For example, a grayscale image would - * have cn=1 while an RGB image would have cn=3. - * \param memsize Maximum amount of memory to use, in bytes. Set this to - * the size of the L2 cache, then vary it slightly and - * measure the processing time to find the optimal value. - * For example, a 512 kB L2 cache would have - * memsize=512*1024 initially. - */ -void ctmf( - const unsigned char* const src, unsigned char* const dst, - const int width, const int height, - const int src_step, const int dst_step, - const int r, const int cn, const long unsigned int memsize - ) -{ - /* - * Processing the image in vertical stripes is an optimization made - * necessary by the limited size of the CPU cache. Each histogram is 544 - * bytes big and therefore I can fit a limited number of them in the cache. - * That number may sometimes be smaller than the image width, which would be - * the number of histograms I would need without stripes. - * - * I need to keep histograms in the cache so that they are available - * quickly when processing a new row. Each row needs access to the previous - * row's histograms. If there are too many histograms to fit in the cache, - * thrashing to RAM happens. - * - * To solve this problem, I figure out the maximum number of histograms - * that can fit in cache. From this is determined the number of stripes in - * an image. The formulas below make the stripes all the same size and use - * as few stripes as possible. - * - * Note that each stripe causes an overlap on the neighboring stripes, as - * when mowing the lawn. That overlap is proportional to r. When the overlap - * is a significant size in comparison with the stripe size, then we are not - * O(1) anymore, but O(r). In fact, we have been O(r) all along, but the - * initialization term was neglected, as it has been (and rightly so) in B. - * Weiss, "Fast Median and Bilateral Filtering", SIGGRAPH, 2006. Processing - * by stripes only makes that initialization term bigger. - * - * Also, note that the leftmost and rightmost stripes don't need overlap. - * A flag is passed to ctmf_helper() so that it treats these cases as if the - * image was zero-padded. - */ - int stripes = (int) ceil( (double) (width - 2*r) / (memsize / sizeof(Histogram) - 2*r) ); - int stripe_size = (int) ceil( (double) ( width + stripes*2*r - 2*r ) / stripes ); - - int i; - - for ( i = 0; i < width; i += stripe_size - 2*r ) { - int stripe = stripe_size; - /* Make sure that the filter kernel fits into one stripe. */ - if ( i + stripe_size - 2*r >= width || width - (i + stripe_size - 2*r) < 2*r+1 ) { - stripe = width - i; - } - - ctmf_helper( src + cn*i, dst + cn*i, stripe, height, src_step, dst_step, r, cn, - i == 0, stripe == width - i ); - - if ( stripe == width - i ) { - break; - } - } -} diff --git a/user/nobody/ctmf.h b/user/nobody/ctmf.h deleted file mode 100644 index 3cd82de689..0000000000 --- a/user/nobody/ctmf.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef CTMF_H -#define CTMF_H - -/* - * ctmf.h - Constant-time median filtering - * Copyright (C) 2006 Simon Perreault - * - * Reference: S. Perreault and P. Hébert, "Median Filtering in Constant Time", - * IEEE Transactions on Image Processing, September 2007. - * - * This program has been obtained from http://nomis80.org/ctmf.html. No patent - * covers this program, although it is subject to the following license: - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifdef __cplusplus -extern "C" { -#endif - -void ctmf( - const unsigned char* src, unsigned char* dst, - int width, int height, - int src_step_row, int dst_step_row, - int r, int channels, unsigned long memsize - ); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/user/nobody/device.c b/user/nobody/device.c deleted file mode 100644 index bf10d18668..0000000000 --- a/user/nobody/device.c +++ /dev/null @@ -1,2824 +0,0 @@ -#include -#include -#include -#include -#include - -#include - -#include - -#include "device.h" -#include "vplot.h" - -#define NHATCH 20 /* Maximum number of lines in a hatch pattern */ -#define MAX_COL 511 /* Maximum color table number, maximum color number */ -#define NPAT 512 /* Maximum internal pattern number, MAX_COL + 1 */ -#define MAXDASH 10 /* Maximum number of dot-dashes */ -#define NUM_PRIM 6 /* Number of Color table array elements */ -#define MAX_GUN 255 /* Maximum color gun strength */ - -#define TXBUFLEN 250 /* Initial max length of a text string */ -#define VXBUFLEN 250 /* Initial max number of vertices in a polygon */ - -/* BSD - MAXNAMELEN, Posix - NAME_MAX */ -#ifndef NAME_MAX -#define NAME_MAX MAXNAMELEN -#endif - -static bool need_devcolor = false; -static int xwmax_last, xwmin_last, ywmax_last, ywmin_last; -static int xmax = 0; -static int ymax = 0; -static int xmin = 0; -static int ymin = 0; -static float ppi = 0.; -static float aspect_ratio = 0.; -static int num_col = -1; - -/* -static bool need_end_erase = false; -static bool buffer_output = true; -static bool buffer_input = true; -static bool allow_pipe = true; -static bool smart_clip = false; -*/ - -static bool smart_raster = false; - -static float fatmult = 1.; -static float patternmult = 1.; - -static char wstype[25]; - -/* -static char callname[25]; -*/ - -static int xcenterflag, ycenterflag; - -static bool ever_called = false; -static bool first_time = true; -static bool device_open = false; /* used by ERR */ - -static int nplots = 0; /* number of plots made */ -static bool no_stretch_text = true; /* Don't allow stretched text? */ - -static int xnew, ynew; /* new pen location */ -static int xold, yold; /* old pen location */ -static int xorigin = 0, yorigin = 0; /* global "origin" */ -static char *txbuffer; -static int txbuflen, vxbuflen; - -struct vp_vertex *vxbuffer; - -/* -static int xret, yret; -*/ - -static float mxx, mxy, myx, myy; - -static int default_rotate = 0, default_hshift = 0, default_vshift = 0; -static float default_scale = 1., default_xscale = 1., default_yscale = 1.; - -/* -static int linestyle; -*/ - -static int cur_color = VP_DEFAULT_COLOR; -static int pat_color = VP_DEFAULT_COLOR + 1; -static int next_color; - -struct txalign { - int hor, ver; -} txalign; - -static int txfont = VP_DEFAULT_FONT; -static int txprec = VP_DEFAULT_PREC; -static int txovly = OVLY_NORMAL; -static int default_txfont, default_txprec, default_txovly; -static int fat = 0; -static int afat = 0; -static int ipat = 0; - -struct pat /* area fill pattern */ -{ - int xdim, ydim, xdim_orig, ydim_orig, *patbits; -} pat[NPAT + 1]; - -static float dashsum = 0.; -static bool dashon = false; -static float dashes[MAXDASH * 2]; -static float dashpos = 0.; /* Position in current dashing pattern */ -static int color_set[MAX_COL + 1][NUM_PRIM]; -static int num_col_8; - -static bool mono; -/* - * Invras determines the polarity of dithered raster. - * invras=n means raster works the same way as vectors; what is normally - * WHITE on most devices is BLACK on a hardcopy black and white device. - * invras=y is the proper default to make dithered images not come out - * as negatives - */ -static bool invras = true; -static bool window = true; -static bool shade = true; - -typedef enum {BREAK_BREAK, BREAK_ERASE, BREAK_IGNORE} breaks; - -static breaks brake = BREAK_BREAK; -static bool framewindows = false; -static bool endpause = false; -static bool cachepipe = false; -/* Setting cachepipe = true will copy any piped files to a temporary file */ - -static bool wantras = true; -static bool colormask[5] = {true, true, true, true, true}; - -static vp_plotstyle style = VP_NO_STYLE_YET; -static vp_plotstyle default_style = VP_STANDARD; -static int rotate; - -typedef enum {RELATIVE, ABSOLUTE} sizes; - -static sizes size = RELATIVE; - -enum {DO_NOTHING, DO_LITERALS=1, FORCE_INITIAL}; - -static int erase = FORCE_INITIAL | DO_LITERALS; - -static int xcenter, ycenter; /* Vplot of point to force as center */ -static int fatbase = 0; -static int epause = 0; /* time to pause before erasing screen */ -static bool overlay = false; /* 1=overlay 0=replace */ -static bool default_overlay; - -/* - * 0 = none - * 1 = random - * 2 = Ordered - * 3 = Floyd-Steinberg - * 4 = Halftone - */ -static int dither = 1; /* Dithering type */ - -static int xWmax, xWmin, yWmax, yWmin; -static float hshift, vshift; /* Allow global translation of plot */ -static float scale; /* global scale */ -static float xscale; /* global x-scale */ -static float yscale; /* global y-scale */ -static float hdevscale; /* Vplot units to device units for x */ -static float vdevscale; /* Vplot units to device units for y */ -static float txscale;/* global text scale */ -static float mkscale;/* global marker scale */ -static float dashscale; /* global dashed line scale */ -static char *interact; /* Coordinate file */ -static float greyc = 1.; /* Nonlinear correction */ -static float pixc = 1.; /* Pixel overlap correction */ -static float redpow = 1., redmap[4] = {1., 0., 0., 0.}; -static float greenpow = 1., greenmap[4] = {0., 1., 0., 0.}; -static float bluepow = 1., bluemap[4] = {0., 0., 1., 0.}; - -/* filter options - resettable between plots */ -static int user_rotate; -static float user_txscale; -static float user_mkscale; -static float user_dashscale; -static float user_scale; -static float user_xscale; -static float user_yscale; -static int user_size; -static float user_hshift; -static float user_vshift; -static int user_xwmax_flag; -static float user_xwmax; -static int user_ywmax_flag; -static float user_ywmax; -static int user_xwmin_flag; -static float user_xwmin; -static int user_ywmin_flag; -static float user_ywmin; - -static int ifat = 0; -static float fatmult_orig; - -/************** -static int (*message) () = genmessage; -***************/ - -/* -static char group_name[NAME_MAX + 1]; -static int group_number = 0; -*/ - -/************* -static int (*genreader) () = gen_do_dovplot; -**************/ - -enum {STATUS, MAP, RED, GREEN, BLUE, GREY}; - -enum {UNSET, SET, MAPPED, MAP_SET}; - -static int greycorr (int colornum); -static void reset_parameters (vp_device dev, - void (*attributes)(vp_device,vp_attribute, - int,int,int,int)); -static void vptodevxy (int x, int y, int *outx, int *outy); -static void vptodevw (int x1, int y1, int x2, int y2, - int *x1out, int *y1out, int *x2out, int *y2out); -static void devtovpxy (int x, int y, int *outx, int *outy); -static void devtovpw (int x1, int y1, int x2, int y2, - int *x1out, int *y1out, int *x2out, int *y2out); -static void vptodevxy_text (int x, int y, int *outx, int *outy); -static void reset_windows (vp_device dev, - void (*attributes)(vp_device, - vp_attribute,int,int,int,int)); -static void init_colors (void); -static void outline_window (vp_device dev, - void (*attributes)(vp_device, - vp_attribute,int,int,int,int), - void (*vector)(vp_device, - int,int,int,int,int,bool)); -static void setstyle (vp_plotstyle new_style, vp_device dev, - void (*attributes)(vp_device, - vp_attribute,int,int,int,int)); -static void update_color (vp_device dev, - void (*attributes)(vp_device, - vp_attribute,int,int,int,int)); -static void getxy (int *x, int *y); -static void getxy_text (int *x, int *y); -static void getvpstring (void); -static int getpolygon (int npts); -static bool dupside (struct vp_vertex *base); -static void vecoutline (vp_device dev, struct vp_vertex *head, - void (*vector)(vp_device,int,int,int,int,int,bool)); -static void reset_all (vp_device dev, - void (*attributes)(vp_device, - vp_attribute,int,int,int,int)); -static void dithline (unsigned char *inpline, - unsigned char *outline, - int npixels, int linenum, int imethod); -static void drawpolygon (vp_device dev, int npts, int *x, int *y, - void (*attributes)(vp_device,vp_attribute, - int,int,int,int), - void (*area) (vp_device,int,struct vp_vertex*), - void (*vector)(vp_device,int,int,int,int,int,bool)); -static void vplot_init (vp_device dev, void (*open)(vp_device)); -static void vplot_do (vp_device dev, - void (*reset)(vp_device), - void (*close)(vp_device,vp_close), - void (*eras)(vp_device,vp_eras), - void (*attributes)(vp_device, - vp_attribute,int,int,int,int), - void (*vector)(vp_device,int,int,int,int,int,bool), - void (*marker)(vp_device,int,int,int,int*), - void (*text) (vp_device,char*,float,float,float,float), - void (*area) (vp_device,int,struct vp_vertex*), - void (*raster) (vp_device,int,int,int,int,int,int, - unsigned char*,int,int)); - -static void vplot_init (vp_device dev, void (*open)(vp_device)) -{ - char *string; - int i; - float ftemp; - - txbuffer = sf_charalloc (TXBUFLEN); - txbuflen = TXBUFLEN; - - vxbuflen = VXBUFLEN; - vxbuffer = (struct vp_vertex *) sf_alloc (vxbuflen, sizeof (*vxbuffer)); - - if (!sf_getbool("mono",&mono)) mono=false; - - if (NULL != (string = sf_getstring ("wstype")) || - NULL != (string = getenv ("WSTYPE"))) { - strncpy (wstype, string, 24); - } else { - strncpy (wstype, "default",24); - } - - for (i = 0; i <= NPAT; i++) { - pat[i].patbits = NULL; - } - - open (dev); - device_open = true; - - if (!sf_getbool ("endpause",&endpause)) endpause=false; - if (!sf_getbool ("cachepipe", &cachepipe)) cachepipe=false; - if (!sf_getbool ("shade", &shade)) shade=true; - if (!sf_getbool ("wantras", &wantras)) wantras=true; - if (!sf_getbool ("window", &window)) window=true; - if (!sf_getbool ("frame", &framewindows)) framewindows=false; - if (!sf_getbool ("overlay", &overlay)) overlay=false; - - default_overlay = overlay; - if (!sf_getbool ("invras", &invras)) invras=true; - if (!sf_getbool ("txsquare", &no_stretch_text)) no_stretch_text=true; - - if (!sf_getbools ("colormask", colormask, 5)) { - colormask[0] = - colormask[1] = colormask[2] = colormask[3] = colormask[4] = true; - } else if (!colormask[4]) { - if (!colormask[0] && !colormask[1] && !colormask[2] && !colormask[3]) - sf_error ("%s: Possibly invalid colormask=",__FILE__); - if (colormask[3]) colormask[4] = true; - } - - if (!sf_getfloat ("redpow",&redpow)) redpow=1.; - if (!sf_getfloat ("greenpow",&greenpow)) greenpow=1.; - if (!sf_getfloat ("bluepow",&bluepow)) bluepow=1.; - - if (redpow <= 0. || greenpow <= 0. || bluepow <= 0.) - sf_error ("%s: Invalid (color)pow=",__FILE__); - - if (!sf_getfloats ("red", redmap,4)) { - redmap[0]=1.; redmap[1]=redmap[2]=redmap[3]=0.; - } - if (!sf_getfloats ("green", greenmap,4)) { - greenmap[1]=1.; greenmap[0]=greenmap[2]=greenmap[3]=0.; - } - if (!sf_getfloats ("blue", bluemap, 4)) { - bluemap[2]=1.; bluemap[0]=bluemap[1]=bluemap[3]=0.; - } - - if (!sf_getint ("dither",&dither)) dither=1; - if (!sf_getfloat ("greyc",&greyc)) greyc=1.; - if (!sf_getfloat ("pixc",&pixc)) pixc=1.; - - if (!sf_getint("txfont",&txfont)) txfont= VP_DEFAULT_FONT; - if (!sf_getint ("txprec",&txprec)) txprec= VP_DEFAULT_PREC; - if (!sf_getint ("txovly",&txovly)) txovly= OVLY_NORMAL; - default_txfont = txfont; - default_txprec = txprec; - default_txovly = txovly; - - if (NULL != (string = sf_getstring("erase"))) { - switch (string[0]) { - case 'n': - case 'N': - erase = DO_NOTHING; - break; - case 'o': - case 'O': - erase = FORCE_INITIAL; - break; - case 'l': - case 'L': - erase = DO_LITERALS; - break; - default: - erase = FORCE_INITIAL | DO_LITERALS; - break; - } - } - - if (NULL != sf_getstring ("break")) { - switch (string[0]) { - case 'b': - brake = BREAK_BREAK; - break; - case 'e': - brake = BREAK_ERASE; - break; - default: - brake = BREAK_IGNORE; - break; - } - } - - xcenter = 0; - ycenter = 0; - xcenterflag = false; - ycenterflag = false; - if (sf_getfloat ("xcenter",&ftemp)) { - xcenterflag = true; - ftemp *= RPERIN; - xcenter = (ftemp<0)? ftemp-0.5: ftemp+0.5; - } - if (sf_getfloat ("ycenter",&ftemp)) { - ycenterflag = true; - ftemp *= RPERIN; - ycenter = (ftemp<0)? ftemp-0.5: ftemp+0.5; - } - - if (!sf_getfloat ("patternmult",&patternmult)) { - if (NULL != (string = getenv ("PATTERNMULT"))) { - sscanf (string, "%f", &patternmult); - } else { - patternmult = 1.; - } - } - - - if (!sf_getint ("pause",&epause)) epause = 0; - - if (NULL == (interact = sf_getstring("interact"))) { - interact = ""; - } else if ('\0' != interact[0]) { - epause = 0; /* interact makes it own sort of pausing */ - endpause = false; - } - - if (NULL != (string = sf_getstring("style")) || - NULL != (string = getenv ("PLOTSTYLE"))) { - switch (string[0]) { - case 'r': - case 'R': - case 'm': - case 'M': - default_style = VP_ROTATED; - break; - case 'a': - case 'A': - default_style = VP_ABSOLUTE; - break; - default: - default_style = VP_STANDARD; - break; - } - } - - if (NULL == (string = sf_getstring("fatmult")) && - NULL == (string = getenv ("FATMULT"))) - fatmult=1.; - fatmult_orig = fatmult; - - if (!sf_getint ("rotate",&user_rotate)) user_rotate=0; - - if (!sf_getfloat("txscale", &user_txscale)) user_txscale = 1.0; - if (!sf_getfloat("mkscale", &user_mkscale)) user_mkscale = 1.0; - if (!sf_getfloat("dashscale", &user_dashscale)) user_dashscale = 1.0; - - if (!sf_getfloat ("scale", &user_scale)) user_scale = 1.0; - if (!sf_getfloat ("xscale", &user_xscale)) user_xscale = 1.0; - if (!sf_getfloat ("yscale", &user_yscale)) user_yscale = 1.0; - - if (NULL != sf_getstring ("size")) { - switch (string[0]) { - case 'a': - case 'A': - user_size = ABSOLUTE; - break; - default: - user_size = RELATIVE; - break; - } - } else { - user_size = size; - } - - if (!sf_getfloat ("hshift", &user_hshift)) user_hshift = 0.; - if (!sf_getfloat ("vshift", &user_vshift)) user_vshift = 0.; - - user_xwmax_flag = sf_getfloat ("xwmax", &user_xwmax); - user_ywmax_flag = sf_getfloat ("ywmax", &user_ywmax); - user_xwmin_flag = sf_getfloat ("xwmin", &user_xwmin); - user_ywmin_flag = sf_getfloat ("ywmin", &user_ywmin); - - if (!sf_getint ("fat", &fatbase)) fatbase=0; -} - -static void init_colors (void) -{ - int i; - - for (i = 0; i < 8; i++) { - color_set[i][STATUS] = SET; - color_set[i][RED] = MAX_GUN * ((i & 2) / 2); - color_set[i][GREEN] = MAX_GUN * ((i & 4) / 4); - color_set[i][BLUE] = MAX_GUN * ((i & 1) / 1); - color_set[i][GREY] = greycorr ((MAX_GUN * i) / 7); - } - - num_col_8 = (num_col > 8) ? num_col : 8; - - if (mono) { - - /* Monochrome devices are assumed to have no settable colors */ - num_col = 0; - - color_set[0][MAP] = 0; - for (i = 1; i <= MAX_COL; i++) { - color_set[i][MAP] = 7; - } - for (i = num_col_8; i < 256; i++) { - color_set[i][GREY] = color_set[((i - 8) % 7) + 1][GREY]; - } - /* Put a grey scale in the upper half of the color table */ - for (i = 256; i <= MAX_COL; i++) { - color_set[i][GREY] = greycorr (i - 256); - } - } else { - /* Unmapped colors shouldn't be mapped; ie, they map to themselves */ - for (i = 0; i < num_col_8; i++) { - color_set[i][MAP] = i; - } - - /* Colors outside the range of map cyclically back into 1 through 7 */ - for (i = num_col_8; i <= MAX_COL; i++) { - color_set[i][MAP] = ((i - 8) % 7) + 1; - } - } -} - -static void setstyle (vp_plotstyle new_style, vp_device dev, - void (*attributes)(vp_device, - vp_attribute,int,int,int,int)) -{ - if (new_style != style) { - style = new_style; - reset_parameters (dev, attributes); - } -} - -static void reset_parameters (vp_device dev, - void (*attributes)(vp_device, - vp_attribute,int,int,int,int)) -{ - float inches, screenheight, screenwidth, f; - int ix, iy; - - xorigin = 0; - yorigin = 0; - - rotate = default_rotate; - rotate += user_rotate; - - txscale = user_txscale; - mkscale = user_mkscale; - dashscale = user_dashscale; - - scale = default_scale * user_scale; - xscale = default_xscale * user_xscale; - yscale = default_yscale * user_yscale; - - fatmult = fatmult_orig; - - size = user_size; - - switch (style) { - case VP_ROTATED: - rotate += 90; - inches = VP_ROTATED_HEIGHT; - break; - case VP_ABSOLUTE: - size = ABSOLUTE; - case VP_STANDARD: - default: - inches = VP_STANDARD_HEIGHT; - break; - } - - if (rotate >= 0) { - rotate %= 360; - } else { - rotate = ((rotate % 360) + 360) % 360; - } - - mxx = cosf (SF_PI * rotate / 180.); - myy = cosf (SF_PI * rotate / 180.); - mxy = sinf (SF_PI * rotate / 180.); - myx = -sinf (SF_PI * rotate / 180.); - - if (ABSOLUTE == size) { - vdevscale = ppi / (RPERIN * aspect_ratio); - hdevscale = ppi / RPERIN; - } else { - /* Fit into a displayable box with aspect ratio SCREEN_RATIO */ - - screenwidth = (xmax - xmin) * ppi; - screenheight = (ymax - ymin) * ppi * aspect_ratio; - if ((screenheight / screenwidth) > VP_SCREEN_RATIO) { - vdevscale = VP_SCREEN_RATIO * (xmax - xmin)/aspect_ratio / - (inches * RPERIN); - hdevscale = vdevscale * aspect_ratio; - } else { - vdevscale = (ymax - ymin) / (inches * RPERIN); - hdevscale = vdevscale * aspect_ratio; - } - } - - hshift = default_hshift; - vshift = default_vshift; - - if (VP_ROTATED == style) vshift += ymax - ymin; - - yscale *= scale; - xscale *= scale; - mkscale *= scale; - -/* fatness multiplication factor */ - fatmult *= scale * hdevscale * RPERIN / FATPERIN; - - /* (xcenter,ycenter) in vplot coordinates to be centered in the screen. */ - if (xcenterflag || ycenterflag) { - vptodevxy (xcenter, ycenter, &ix, &iy); - if (xcenterflag) hshift += (xmax + xmin) / 2 - ix; - if (ycenterflag) vshift += (ymax + ymin) / 2 - iy; - } - - hshift += user_hshift * ppi; - vshift += user_vshift * ppi / aspect_ratio; - - devtovpw (xmin, ymin, xmax, ymax, &xWmin, &yWmin, &xWmax, &yWmax); - - if (user_xwmax_flag) { - f = user_xwmax * RPERIN; xWmax = (f < 0.)? f-0.5: f+0.5; - } - if (user_ywmax_flag) { - f = user_ywmax * RPERIN; yWmax = (f < 0.)? f-0.5: f+0.5; - } - if (user_xwmin_flag) { - f = user_xwmin * RPERIN; xWmin = (f < 0.)? f-0.5: f+0.5; - } - if (user_ywmin_flag) { - f = user_ywmin * RPERIN; yWmin = (f < 0.)? f-0.5: f+0.5; - } - - vptodevw (xWmin, yWmin, xWmax, yWmax, &xWmin, &yWmin, &xWmax, &yWmax); - - if (xWmin < xmin) xWmin = xmin; - if (yWmin < ymin) yWmin = ymin; - if (xWmax > xmax) xWmax = xmax; - if (yWmax > ymax) yWmax = ymax; - - /* plot window parameters defaulted to maximum size */ - dev->xwmax = xWmax; - dev->xwmin = xWmin; - dev->ywmax = yWmax; - dev->ywmin = yWmin; - - reset_windows (dev, attributes); -} - -/* Utility to modify color tables for plotting grey rasters. */ -static int greycorr (int colornum) -{ - float newval; - - newval = invras? 255-colornum: colornum; - -/* correction to simulate nonlinearity of graphics displays */ - if (greyc != 1.) { - newval /= 255.; - newval *= ((-2. + 2. * greyc) * newval + 3. * (1. - greyc)) * newval - + greyc; - newval *= 255.; - - if (newval < 0) newval = 0.; - else if (newval > 255.) newval = 255.; - } - -/* correction for pixel overlap on hardcopy devices */ - if (pixc != 1.) { - if (newval < pixc * 128.) { - newval /= pixc; - } else { - newval = 128. + (newval - pixc * 128.) / (2. - pixc); - } - - if (newval < 0) newval = 0.; - else if (newval > 255.) newval = 255.; - } - - return ((int) (newval+0.5)); -} - -/* convert vplot coordinates to device coordinates, or vice versa */ - -static void vptodevxy (int x, int y, int *outx, int *outy) -{ - float fx, fy, f; - - fx = (x - xorigin) * xscale; - fy = (y - yorigin) * yscale; - - f = mxx * fx + mxy * fy; - fy = myx * fx + myy * fy; - fx = f; - - fx = fx * hdevscale + xmin + hshift; - fy = fy * vdevscale + ymin + vshift; - - *outx = (fx < 0.)? fx-0.5: fx+0.5; - *outy = (fy < 0.)? fy-0.5: fy+0.5; -} - -static void vptodevw (int x1, int y1, int x2, int y2, - int *x1out, int *y1out, int *x2out, int *y2out) -{ - int x11, y11, x12, y12, x21, y21, x22, y22, a, b; - - vptodevxy (x1, y1, &x11, &y11); - vptodevxy (x1, y2, &x12, &y12); - vptodevxy (x2, y1, &x21, &y21); - vptodevxy (x2, y2, &x22, &y22); - - a = (x11 > x12 ? x11 : x12); - b = (x22 > x21 ? x22 : x21); - *x2out = (a > b ? a : b); - - a = (y11 > y12 ? y11 : y12); - b = (y22 > y21 ? y22 : y21); - *y2out = (a > b ? a : b); - - a = (x11 < x12 ? x11 : x12); - b = (x22 < x21 ? x22 : x21); - *x1out = (a < b ? a : b); - - a = (y11 < y12 ? y11 : y12); - b = (y22 < y21 ? y22 : y21); - *y1out = (a < b ? a : b); -} - -static void devtovpxy (int x, int y, int *outx, int *outy) -{ - float fx, fy, f; - - fx = (x - xmin - hshift) / hdevscale; - fy = (y - ymin - vshift) / vdevscale; - - f = mxx * fx - mxy * fy; - fy = -myx * fx + myy * fy; - fx = f; - - fx = fx / xscale + xorigin; - fy = fy / yscale + yorigin; - - *outx = (fx < 0.)? fx-0.5:fx+0.5; - *outy = (fy < 0.)? fy-0.5:fy+0.5; -} - -static void devtovpw (int x1, int y1, int x2, int y2, - int *x1out, int *y1out, int *x2out, int *y2out) -{ - int x11, y11, x12, y12, x21, y21, x22, y22, a, b; - - devtovpxy (x1, y1, &x11, &y11); - devtovpxy (x1, y2, &x12, &y12); - devtovpxy (x2, y1, &x21, &y21); - devtovpxy (x2, y2, &x22, &y22); - - a = (x11 > x12 ? x11 : x12); - b = (x22 > x21 ? x22 : x21); - *x2out = (a > b ? a : b); - - a = (y11 > y12 ? y11 : y12); - b = (y22 > y21 ? y22 : y21); - *y2out = (a > b ? a : b); - - a = (x11 < x12 ? x11 : x12); - b = (x22 < x21 ? x22 : x21); - *x1out = (a < b ? a : b); - - a = (y11 < y12 ? y11 : y12); - b = (y22 < y21 ? y22 : y21); - *y1out = (a < b ? a : b); -} - -static void vptodevxy_text (int x, int y, int *outx, int *outy) -{ - float xscale_save=0., yscale_save=0.; - - if (no_stretch_text) { - xscale_save = xscale; - yscale_save = yscale; - - if (fabsf (xscale) < fabsf (yscale)) { - yscale = xscale; - } else { - xscale = yscale; - } - } - - vptodevxy (x, y, outx, outy); - - if (no_stretch_text) { - xscale = xscale_save; - yscale = yscale_save; - } -} - -static void vplot_do (vp_device dev, - void (*reset)(vp_device), - void (*close)(vp_device,vp_close), - void (*eras)(vp_device,vp_eras), - void (*attributes)(vp_device, - vp_attribute,int,int,int,int), - void (*vector)(vp_device,int,int,int,int,int,bool), - void (*marker)(vp_device,int,int,int,int*), - void (*text) (vp_device,char*,float,float,float,float), - void (*area) (vp_device,int,struct vp_vertex*), - void (*raster) (vp_device,int,int,int,int,int,int, - unsigned char*,int,int)) -{ - int i, j=0, k, c, key, size, npts, nmul, nx, ny, nx_orig, ny_orig; - int orient, ras_orient, *ptr=NULL, nx_mult, ny_mult, nx_temp, ny_temp; - int *tempbuf, new_style; - int col_tab_no, red, green, blue, grey, dist, min_dist, best_col=0; - int red_mask, green_mask, blue_mask; - int red_0, green_0, blue_0; - int red_7, green_7, blue_7; - int hacol[NHATCH * 2], hafat[NHATCH * 2], haoff[NHATCH * 2]; - int hasiz[NHATCH * 2], numhatch; - int xpix, ypix, num_pat, num_byte, yrast, lastrast; - int xvr_min, xvr_max, yvr_min, yvr_max; - int xvru_min, xvru_max, yvru_min, yvru_max; - int xr_min=0, xr_max=0, yr_min=0, yr_max=0; - int xru_min=0, yru_max=0, xxx[4], yyy[4]; - int pos, ii, jj, kk, num_rep, ras_offset, dither_it; - int xnewer, ynewer; - int xtext0, xtext1, xtext2, ytext0, ytext1, ytext2, type; - int *marker_vec, *mvec; - int savefat; - unsigned char *rasterline, *rasterline2, *outraster, *outraster2, ibyte; - float red_f, green_f, blue_f, red_fm, green_fm, blue_fm; - float angle, xrasmult=0., yrasmult=0., savefatmult, f; - bool starterase, skip=false; - - starterase = false; - while ((VP_ERASE == (c = getchar ())) || - ((VP_BREAK == c) && (brake == BREAK_ERASE))) { - starterase = true; - } - - if (c == EOF) return; - - if (first_time) { - reset (dev); - - if (xmax <= xmin || - ymax <= ymin || - ppi == 0. || - aspect_ratio == 0. || - num_col == -1) - sf_error ("%s: wrong values for critical device variables", - __FILE__); - - /* Set maximum clipping window */ - xwmax_last = xmax; - xwmin_last = xmin; - ywmax_last = ymax; - ywmin_last = ymin; - - /* Set up color maps */ - init_colors (); - - ever_called = true; - } else { - close (dev,CLOSE_FLUSH); - if (epause > 0) { - sleep ((unsigned int) epause); - } else if (epause < 0) { - close (dev,CLOSE_FLUSH); - -/* - message (MESG_ERASE); - message (MESG_ON); - message (MESG_HOME); - message (MESG_READY); - message (MESG_HIGHLIGHT_ON); - message (MESG_TEXT, "Type Return to Continue... "); - message (MESG_DONE); - - ii = dev.interact (INT_PAUSE, controltty, string); - if (ii == DOVPLOT_EXIT) - { - dev.close (CLOSE_FLUSH); - return; - } - message (MESG_HIGHLIGHT_OFF); - if (!allowecho) - { - message (MESG_READY); - message (MESG_TEXT, CRLF); - } - message (MESG_DONE); - message (MESG_OFF); - message (MESG_ERASE); - } - - if (interact[0] != '\0') - { - getapoint (); - } -*/ - } - } - - /* Erase the screen to background color */ - if (((erase & FORCE_INITIAL) && (first_time || (erase & DO_LITERALS))) - || (starterase && (erase & DO_LITERALS))) { - if (first_time) { - eras (dev,ERASE_START); - } else { - eras (dev,ERASE_MIDDLE); - nplots++; - } - close (dev,CLOSE_FLUSH); - } - - first_time = false; - - -/* Reset fatness, cur_color, etc. */ - new_style = default_style; - setstyle (new_style,dev,attributes); - reset_all (dev, attributes); - -/* Make SURE the color is what it's supposed to be, just to be safe. */ - attributes (dev,SET_COLOR, cur_color, 0, 0, 0); - need_devcolor = false; - -/* message (MESG_OFF); */ - close (dev,CLOSE_FLUSH); - -/* Start a group that will contain this frame (always group 0). */ - - /* ?????????????? - ii = ftell (pltin); - sprintf (group_name, "%s.%d", pltname, nplots); - dev.attributes (BEGIN_GROUP, group_number, ii, 0, 0); - group_number++; - ?????????????????? */ - - if (framewindows) outline_window (dev, attributes, vector); - - while (EOF != c) { - switch (c) { - case VP_SETSTYLE: - c = getchar (); - switch (c) { - case 'r': case 'R': case 'm': case 'M': - new_style = VP_ROTATED; - break; - case 'a': case 'A': - new_style = VP_ABSOLUTE; - break; - default: - new_style = VP_STANDARD; - break; - } - setstyle (new_style,dev,attributes); - - if (framewindows) outline_window (dev, attributes, vector); - break; - case VP_MOVE: - /* Reset position in dash pattern. */ - dashpos = 0.; - - getxy(&xold,&yold); - break; - case VP_DRAW: - getxy (&xnew,&ynew); - update_color (dev, attributes); - - while (VP_DRAW == (c = getchar ())) { - getxy (&xnewer,&ynewer); - - /* Is it the same point? */ - if (xnewer == xnew && ynewer == ynew) continue; - - /* Is it colinear and horizontal or vertical? */ - - if ((ynewer == ynew && ynew == yold && - ((xnewer > xnew) == (xnew > xold))) || - (xnewer == xnew && xnew == xold && - ((ynewer > ynew) == (ynew > yold)))) { - ynew = ynewer; - xnew = xnewer; - continue; - } - - vector (dev, xold, yold, xnew, ynew, fat, dashon); - xold = xnew; - yold = ynew; - xnew = xnewer; - ynew = ynewer; - } - - vector (dev, xold, yold, xnew, ynew, fat, dashon); - xold = xnew; - yold = ynew; - - skip = true; - break; - case VP_PLINE: - - /* Reset position in dash pattern. */ - dashpos = 0.; - - npts = vp_getint (); - if (0 == npts) break; - - getxy (&xold, &yold); - npts--; - if (0 == npts) break; - - getxy (&xnew, &ynew); - npts--; - - update_color (dev,attributes); - while (npts > 0) { - getxy (&xnewer, &ynewer); - npts--; - - /* Is it the same point? */ - if (xnewer == xnew && ynewer == ynew) continue; - - /* Is it colinear and horizontal or vertical? */ - if ((ynewer == ynew && ynew == yold && - ((xnewer > xnew) == (xnew > xold))) || - (xnewer == xnew && xnew == xold && - ((ynewer > ynew) == (ynew > yold)))) { - ynew = ynewer; - xnew = xnewer; - continue; - } - - vector (dev, xold, yold, xnew, ynew, fat, dashon); - xold = xnew; - yold = ynew; - xnew = xnewer; - ynew = ynewer; - } - - vector (dev, xold, yold, xnew, ynew, fat, dashon); - xold = xnew; - yold = ynew; - break; - case VP_PMARK: /* polymarker */ - npts = vp_getint (); /* how many markers ? */ - type = vp_getint (); /* what symbol? (any positive integer) */ - size = vp_getint (); /* How big? */ - - size *= mkscale * vdevscale * RPERIN / TXPERIN; - - if (0 == npts) break; - - /* allocate space for the points */ - marker_vec = sf_intalloc (npts * 2); - mvec = marker_vec; - - /* read locations, and transform them to device coordinates */ - for (ii = 0; ii < 2*npts; ii += 2) { - getxy (mvec+ii,mvec+ii+1); - } - - update_color (dev, attributes); - - marker (dev, npts, type, size, marker_vec); - - free (marker_vec); - break; - case VP_ORIGIN: - xorigin = vp_getint(); - yorigin = vp_getint(); - break; - case VP_BEGIN_GROUP: - sf_error("%s: VP_BEGIN_GROUP not implemented",__FILE__); - /* - ii = ftell (pltin) - 1; - getvpstring (); - strncpy (group_name, txbuffer, MAXFLEN); - dev.attributes (BEGIN_GROUP, group_number, ii, 0, 0); - group_number++; - */ - break; - case VP_END_GROUP: - sf_error("%s: VP_END_GROUP not implemented",__FILE__); - /* - group_number--; - if (group_number < 1) - { - ERR (WARN, name, - "group invalidly nested"); - group_number = 1; - } - else - { - ii = dev.attributes (END_GROUP, group_number, USER_EGROUP, 0, 0); - if (ii == DOVPLOT_EXIT) - { - dev.close (CLOSE_FLUSH); - return; - } - if (ii != DOVPLOT_CONT) - ERR (WARN, name, "dev.attributes(END_GROUP,...) returned junk."); - } - */ - break; - case VP_GTEXT: - case VP_TEXT: - case VP_OLDTEXT: - xtext0 = 0; - ytext0 = 0; - - if (VP_GTEXT == c) { - vptodevxy_text (xtext0, ytext0, &xtext0, &ytext0); - getxy_text (&xtext1, &ytext1); - getxy_text (&xtext2, &ytext2); - } else { - if (VP_TEXT == c) { - size = vp_getint (); - size *= RPERIN / (float) TXPERIN; - - orient = vp_getint(); - } else { - if ((key = vp_getint ()) < 0) - sf_error ("%s: invalid text key",__FILE__); - size = (key & 037); - size *= RPERIN / (float) TXPERIN; - orient = (((key & 0140) >> 5) * 90); - } - - /* Character path direction */ - f = TEXTVECSCALE * size * cosf (orient * SF_PI / 180.); - xtext1 = (f < 0.)? f-0.5:f+0.5; - f = TEXTVECSCALE * size * sinf (orient * SF_PI / 180.); - ytext1 = (f < 0.)? f-0.5:f+0.5; - - /* Character up vector direction */ - orient += 90; - f = TEXTVECSCALE * size * cosf (orient * SF_PI / 180.); - xtext2 = (f < 0.)? f-0.5:f+0.5; - f = TEXTVECSCALE * size * sinf (orient * SF_PI / 180.); - ytext2 = (f < 0.)? f-0.5:f+0.5; - - vptodevxy_text (xtext0, ytext0, &xtext0, &ytext0); - vptodevxy_text (xtext1, ytext1, &xtext1, &ytext1); - vptodevxy_text (xtext2, ytext2, &xtext2, &ytext2); - } - - xtext1 -= xtext0; - xtext2 -= xtext0; - ytext1 -= ytext0; - ytext2 -= ytext0; - - savefat = fat; - savefatmult = fatmult; - fatmult *= txscale; - - fat = (ifat >= 0)? fatmult * (ifat + fatbase): -1; - - update_color (dev, attributes); - - getvpstring (); - - text (dev, txbuffer, - txscale * xtext1 / TEXTVECSCALE, - txscale * ytext1 / TEXTVECSCALE, - txscale * xtext2 / TEXTVECSCALE, - txscale * ytext2 / TEXTVECSCALE); - - fat = savefat; - fatmult = savefatmult; - break; - - case VP_OLDAREA: - npts = vp_getint(); - afat = vp_getint (); - - if (afat >= 0) afat = fatmult * (fatbase + afat); - - nx_temp = vp_getint (); - ny_temp = vp_getint (); - - nx = nx_temp * patternmult; - if (nx_temp == 1 || (nx_temp > 0 && nx == 0)) nx = 1; - - ny = ny_temp * patternmult; - if (ny_temp == 1 || (ny_temp > 0 && ny == 0)) ny = 1; - - nx_orig = nx; - ny_orig = ny; - - /* If a monochrome device, then fill with dot pattern. - * If a color device, fill with solid color. */ - - if (!mono) { - if (nx_temp == 0 || ny_temp == 0) { - nx = 0; - ny = 0; - } else { - nx = 1; - ny = 1; - } - } - - /* Create a temporary pattern */ - ipat = 0; - if (nx * ny > 0) { - ptr = sf_intalloc (nx*ny); - for (i=0; i < nx*ny-1; i++) { - ptr[i]=0; - } - ptr[nx*ny-1] = cur_color; - - pat[ipat].patbits = ptr; - } else { - pat[ipat].patbits = NULL; - } - - pat[ipat].xdim = nx; - pat[ipat].ydim = ny; - pat[ipat].xdim_orig = nx_orig; - pat[ipat].ydim_orig = ny_orig; - - npts = getpolygon (npts); - update_color (dev, attributes); - - /* Do the polygon */ - if (npts > 2 && shade && nx > 0 && ny > 0) - area (dev, npts, vxbuffer); - - /* And then its border */ - if (afat >= 0) vecoutline (dev,vxbuffer,vector); - - if (nx * ny > 0) free (ptr); - break; - case VP_AREA: - npts = vp_getint(); - ipat = pat_color; - - if (NULL == pat[ipat].patbits && shade) { - /* Create default pattern (solid fill with this color) */ - nx = 1; - ny = 1; - - ptr = sf_intalloc (nx*ny); - for (i=0; i < nx*ny-1; i++) { - ptr[i]=0; - } - ptr[nx*ny-1] = cur_color; - - pat[ipat].patbits = ptr; - pat[ipat].xdim = nx; - pat[ipat].ydim = ny; - pat[ipat].xdim_orig = nx; - pat[ipat].ydim_orig = ny; - } - - npts = getpolygon (npts); - - if (!shade) { - /* At least draw the boundary to show where it is */ - afat = 0; - update_color (dev, attributes); - vecoutline (dev,vxbuffer,vector); - } else { - /* See whether raster or hatch area */ - if (pat[ipat].xdim >= 0) { /* raster */ - if (npts > 2 && - pat[ipat].ydim > 0 && - pat[ipat].xdim > 0) { - update_color (dev, attributes); - area (dev, npts, vxbuffer); - } - } else { /* hatch */ - numhatch = -pat[ipat].xdim; - angle = SF_PI * pat[ipat].ydim / 180.; - ptr = pat[ipat].patbits; - for (i = 0; i < numhatch * 2; i++) { - hafat[i] = (*ptr++); - hacol[i] = (*ptr++); - haoff[i] = (*ptr++); - hasiz[i] = (*ptr++); - } - if (npts > 2) { - /* Hatch patterns don't rotate. */ - /* The polygon does, the fill pattern doesn't. - genhatch (npts, numhatch, angle, hafat, - hacol, haoff, hasiz, vxbuffer); - */ - } - } - } - break; - case VP_FAT: - ifat = vp_getint (); - - fat = (ifat >= 0)? fatmult * (ifat + fatbase): -1; - - attributes (dev, NEW_FAT, fat, 0, 0, 0); - break; - - case VP_COLOR: - pat_color = vp_getint(); - - if (pat_color > MAX_COL || pat_color < 0) { - sf_warning("%s: bad color number %d (max %d, min 0)", - __FILE__,pat_color, MAX_COL); - pat_color = VP_DEFAULT_COLOR; - } - - next_color = color_set[pat_color][MAP]; - if (next_color != cur_color) { - cur_color = next_color; - need_devcolor = true; - } - - pat_color++; - break; - - case VP_SET_COLOR_TABLE: - /* The logic here is a bit tricky. - * If the device actually has a settable color of that number, - * then reset the device's color as asked. Otherwise, take the - * closest color that we have and map to that. Color 0 is the - * background color, and is special. Merely "close" colors are - * not mapped to Color 0... it has to be exact. Devices with - * NO settable colors are still sent colors 0 through 7, and - * these colors are then always left set to their original - * defaults. In this way you can handle terminals like the GIGI - * which have colors but not SETTABLE colors. Remember that - * the device itself will have to permute colors 0 through 7 - * to correspond with Vplot's definitions! */ - - col_tab_no = vp_getint(); - if (col_tab_no > MAX_COL || col_tab_no < 0) - sf_error("%s: Bad color table value %d (%d max)", - __FILE__, col_tab_no, MAX_COL); - - red = vp_getint(); - green = vp_getint(); - blue = vp_getint(); - - if (red > MAX_GUN || - green > MAX_GUN || - blue > MAX_GUN || - red < 0 || - green < 0 || - blue < 0) - sf_error("%s: Bad color level in color %d (%d,%d,%d)," - " %d max",__FILE__,col_tab_no, - red, green, blue, MAX_GUN); - - red_f = red / (float) MAX_GUN; - green_f = green / (float) MAX_GUN; - blue_f = blue / (float) MAX_GUN; - - red_fm = redmap[3] + - redmap[0] * red_f + - redmap[1] * green_f + - redmap[2] * blue_f; - - if (red_fm < 0.) red_fm = 0.; - else if (red_fm > 1.) red_fm = 1.; - red_fm = powf (red_fm, redpow); - red = red_fm * MAX_GUN + 0.5; - - green_fm = greenmap[3] + - greenmap[0] * red_f + - greenmap[1] * green_f + - greenmap[2] * blue_f; - - if (green_fm < 0.) green_fm = 0.; - else if (green_fm > 1.) green_fm = 1.; - green_fm = powf (green_fm, greenpow); - green = green_fm * MAX_GUN + 0.5; - - blue_fm = bluemap[3] + - bluemap[0] * red_f + - bluemap[1] * green_f + - bluemap[2] * blue_f; - - if (blue_fm < 0.) blue_fm = 0.; - else if (blue_fm > 1.) blue_fm = 1.; - blue_fm = powf (blue_fm, bluepow); - blue = blue_fm * MAX_GUN + 0.5; - - if (col_tab_no != 0) { - red_mask = red; - green_mask = green; - blue_mask = blue; - - /* Background color */ - red_0 = color_set[0][RED]; - green_0 = color_set[0][GREEN]; - blue_0 = color_set[0][BLUE]; - - /* Opposite of background color */ - red_7 = MAX_GUN - color_set[0][RED]; - green_7 = MAX_GUN - color_set[0][GREEN]; - blue_7 = MAX_GUN - color_set[0][BLUE]; - - if (red == red_7 && green == green_7 && blue == blue_7) { - if (!colormask[3]) { - red_mask = red_0; - green_mask = green_0; - blue_mask = blue_0; - } - } else { - if (colormask[4]) { - if (!colormask[0]) red_mask = red_0; - if (!colormask[1]) green_mask = green_0; - if (!colormask[2]) blue_mask = blue_0; - } else { - if (colormask[0]) { - green_mask = red_mask; - blue_mask = red_mask; - } - if (colormask[1]) { - red_mask = green_mask; - blue_mask = green_mask; - } - if (colormask[2]) { - red_mask = blue_mask; - green_mask = blue_mask; - } - } - } - - red = red_mask; - green = green_mask; - blue = blue_mask; - } - - /* Process the new color table value */ - if (col_tab_no < num_col) { - attributes (dev, SET_COLOR_TABLE, - col_tab_no, red, green, blue); - color_set[col_tab_no][STATUS] = SET; - } else if (col_tab_no > 7) { - color_set[col_tab_no][STATUS] = MAPPED; - } else if (col_tab_no > 0) { - color_set[col_tab_no][STATUS] = MAP_SET; - /* Means that we need to map these but they are still set - * to the original colors and can't be changed. Color 0 - * is always background, and any other color exactly the - * same color as color 0 "wants to be", even if color 0 - * actually can't be and hasn't been reset, is mapped to - * color zero if it can't be set. */ - } - - /* Save the color that this color table number wants to be */ - color_set[col_tab_no][RED] = red; - color_set[col_tab_no][GREEN] = green; - color_set[col_tab_no][BLUE] = blue; - - /* grey level is "Black and White TV style" mapped from color, - * with corrections added by the subroutine greycorr. */ - - grey = (blue * 1 + red * 2 + green * 4 + 6) / 7; - color_set[col_tab_no][GREY] = greycorr (grey); - - /* If the next command is also a set color table command - * postpone doing this and kill 2 birds with one stone. */ - - c = getchar (); - skip = true; - - if (EOF == c) break; - - if (VP_SET_COLOR_TABLE != c) { - if (mono) { - for (ii = 1; ii <= MAX_COL; ii++) { - color_set[ii][MAP] = - (color_set[ii][RED] == color_set[0][RED] && - color_set[ii][GREEN] == color_set[0][GREEN] && - color_set[ii][BLUE] == color_set[0][BLUE])? - 0:7; - } - } else { - /* For all color table entries that aren't set, - * find the color that IS set and use that instead. */ - for (ii = num_col; ii <= MAX_COL; ii++) { - if (color_set[ii][STATUS] & MAPPED) { - min_dist = MAX_GUN * MAX_GUN * 8; - for (i = num_col_8 - 1; i >= 0; i--) { - /* Colors 1 through 7 are guaranteed SET, - * we always get an answer. Color zero is - * background and special. To map to it you - * have to hit its color exactly, and no - * other color matched exactly first. */ - if (color_set[i][STATUS] & SET) { - if (color_set[i][STATUS] == SET) { - k = color_set[i][RED] - - color_set[ii][RED]; - dist = 2 * k * k; - k = color_set[i][GREEN] - - color_set[ii][GREEN]; - dist += 4 * k * k; - k = color_set[i][BLUE] - - color_set[ii][BLUE]; - dist += k * k; - } else { - k = MAX_GUN * ((i & 2) / 2) - - color_set[ii][RED]; - dist = 2 * k * k; - k = MAX_GUN * ((i & 4) / 4) - - color_set[ii][GREEN]; - dist += 4 * k * k; - k = MAX_GUN * ((i & 1) / 1) - - color_set[ii][BLUE]; - dist += k * k; - } - if (dist < min_dist && - (i != 0 || dist == 0)) { - min_dist = dist; - best_col = i; - if (0 == dist) break; - } - } - } - color_set[ii][MAP] = best_col; - } - } - } - } - break; - - case VP_PURGE: - close (dev, CLOSE_FLUSH); - break; - case VP_BREAK: /* break */ - if (BREAK_IGNORE == brake) break; - /* fall through */ - - case VP_ERASE: - close (dev, CLOSE_FLUSH); - -/* - * Erases and breaks can't occur inside groups. - - group_number--; - if (group_number != 0) - { - ERR (WARN, name, - "group contains erase or break"); - group_number = 0; - } - else - { - if (erase & DO_LITERALS) - { - if (c == VP_ERASE || brake) - ii = dev.attributes (END_GROUP, group_number, ERASE_EGROUP, 0, 0); - else - ii = dev.attributes (END_GROUP, group_number, BREAK_EGROUP, 0, 0); - } - else - ii = dev.attributes (END_GROUP, group_number, IGNORE_EGROUP, 0, 0); - - if (ii == DOVPLOT_EXIT) - return; - if (ii != DOVPLOT_CONT) - ERR (WARN, name, "dev.attributes(END_GROUP,...) returned junk."); - } - - if (epause < 0) - { - message (MESG_ERASE); - message (MESG_ON); - message (MESG_HOME); - message (MESG_READY); - message (MESG_HIGHLIGHT_ON); - message (MESG_TEXT, "Type Return to Continue... "); - message (MESG_DONE); - ii = dev.interact (INT_PAUSE, controltty, string); - if (ii == DOVPLOT_EXIT) - return; - message (MESG_HIGHLIGHT_OFF); - if (!allowecho) - { - message (MESG_READY); - message (MESG_TEXT, CRLF); - } - message (MESG_DONE); - message (MESG_OFF); - message (MESG_ERASE); - } - else - { - if (epause > 0) - sleep ((unsigned) epause); - } - - * Inquire point back from device - - if (interact[0] != '\0') - { - getapoint (); - } - -*/ - - if (erase & DO_LITERALS) { - if ((VP_ERASE == c) || brake) { - eras (dev, ERASE_MIDDLE); - } else { - eras (dev, ERASE_BREAK); - } - nplots++; - } - - new_style = default_style; - setstyle (new_style,dev,attributes); - reset_all (dev,attributes); - - /* - * Start a new group level 0 to contain the next frame (separated - * from the previous one by either an erase or break) - - ii = ftell (pltin); - sprintf (group_name, "%s.%d", pltname, nplots); - dev.attributes (BEGIN_GROUP, group_number, ii, 0, 0); - group_number++; - */ - - if (framewindows) outline_window (dev, attributes, vector); - break; - - case VP_WINDOW: - if (window) { - dev->xwmin = vp_getint(); - dev->ywmin = vp_getint(); - dev->xwmax = vp_getint(); - dev->ywmax = vp_getint(); - - if (dev->xwmin > dev->xwmax || - dev->ywmin > dev->ywmax) { - dev->xwmin = xWmax + 1; - dev->xwmax = xWmin - 1; - dev->ywmin = yWmax + 1; - dev->ywmax = yWmin - 1; - } else { - vptodevw (dev->xwmin, dev->ywmin, - dev->xwmax, dev->ywmax, - &(dev->xwmin), &(dev->ywmin), - &(dev->xwmax), &(dev->ywmax)); - if (dev->xwmin < xWmin) dev->xwmin=xWmin; - if (dev->xwmax > xWmax) dev->xwmax=xWmax; - if (dev->ywmin < yWmin) dev->ywmin=yWmin; - if (dev->ywmax > yWmax) dev->ywmax=yWmax; - } - } else { - vp_getint(); - vp_getint(); - vp_getint(); - vp_getint(); - } - - reset_windows (dev, attributes); - if (framewindows) outline_window (dev, attributes, vector); - break; - - case VP_NOOP: - break; - - case VP_TXALIGN: - txalign.hor = vp_getint(); - txalign.ver = vp_getint(); - attributes (dev, NEW_ALIGN, txalign.hor, txalign.ver, 0, 0); - break; - - case VP_TXFONTPREC: - ii = vp_getint(); - if (ii >= 0) { - txfont = ii; - } else { - ii = -1; - } - - jj = vp_getint(); - if (jj >= 0) { - txprec = jj; - } else { - jj = -1; - } - - kk = vp_getint(); - if (kk >= 0) { - txovly = kk; - } else { - kk = -1; - } - - attributes (dev, NEW_FONT, ii, jj, kk, 0); - break; - - case VP_OVERLAY: - overlay = vp_getint(); - attributes (dev, NEW_OVERLAY, overlay, 0, 0, 0); - break; - - case VP_PATLOAD: - nmul = vp_getint(); - ny = vp_getint(); - - /* See whether Raster or Hatch */ - if (ny >= 0) { /* Raster */ - ny_mult = ny * (ppi / nmul) * patternmult / aspect_ratio; - if (ny_mult == 0 && ny > 0) ny_mult = 1; - - nx = vp_getint(); - nx_mult = nx * (ppi / nmul) * patternmult; - if (nx_mult == 0 && nx > 0) nx_mult = 1; - - ipat = vp_getint() + 1; - if (ipat > NPAT || ipat < 1) - sf_error ("%s: Bad pattern number %d (max %d, min 1)", - __FILE__,ipat, NPAT); - - if (NULL != pat[ipat].patbits) - free (pat[ipat].patbits); - - if (nx_mult * ny_mult > 0) { - pat[ipat].patbits = sf_intalloc(nx_mult * ny_mult); - } else { - pat[ipat].patbits = sf_intalloc(1); - pat[ipat].patbits[0] = 0; - } - - tempbuf = (nx * ny > 0)? sf_intalloc (nx * ny): NULL; - - /* read in pattern */ - for (j = 0; j < nx * ny; j++) { - k = vp_getint(); - if (k > MAX_COL || k < 0) { - sf_warning("%s: bad color number in pattern " - "%d (max %d, min 0)", - __FILE__,k,MAX_COL); - k = VP_DEFAULT_COLOR; - } - tempbuf[j] = color_set[k][MAP]; - } - - /* copy into patbits, with "stretching" */ - for (i = 0; i < ny_mult; i++) { - ny_temp = i * ny / ny_mult; - for (j = 0; j < nx_mult; j++) { - nx_temp = j * nx / nx_mult; - pat[ipat].patbits[j + nx_mult * i] = - tempbuf[nx_temp + nx * ny_temp]; - } - } - - /* set dimensions of pattern */ - pat[ipat].xdim = nx_mult; - pat[ipat].ydim = ny_mult; - pat[ipat].xdim_orig = nx_mult; - pat[ipat].ydim_orig = ny_mult; - - if (NULL != tempbuf) free (tempbuf); - - attributes (dev, NEW_PAT, ipat, 0, 0, 0); - } else { /* Hatch Pattern */ - nx = vp_getint(); - if (nx <= 0 || nx * 2 > NHATCH) - sf_error ("%s: Bad numhatch %d (max %d/2, min 1)", - __FILE__,nx, NHATCH); - - ipat = vp_getint() + 1; - if (ipat > NPAT || ipat < 1) - sf_error("%s: Bad pattern number %d (max %d, min 1)", - __FILE__,ipat, NPAT); - - if (NULL != pat[ipat].patbits) free (pat[ipat].patbits); - - pat[ipat].patbits = sf_intalloc(nx*8); - - for (i = 0; i < nx * 2; i++) { - hafat[i] = vp_getint(); - if (hafat[i] >= 0) - hafat[i] = fatmult * (fatbase + hafat[i]); - - k = vp_getint(); - if (k > MAX_COL || k < 0) { - sf_warning("%s: Bad color number in " - "hatch %d (max %d, min 0)", - __FILE__,k, MAX_COL); - k = VP_DEFAULT_COLOR; - } - - hacol[i] = color_set[k][MAP]; - haoff[i] = vp_getint() * patternmult * ppi / RPERIN; - hasiz[i] = vp_getint(); - } - - /* Find smallest hatch interval. 1/2 that, and then force - * everything to be a multiple of that. If this were not - * done, then hatch intervals that originally differed by - * some simple fraction might end up slightly off, causing - * very unsightly beats. */ - - /* Upper quantization limit of 1/10 inch */ - k = (RPERIN / 10) * 2; - for (i = 0; i < nx * 2; i++) { - if (hasiz[i] > 0 && hasiz[i] < k) - k = hasiz[i]; - } - j = k * (patternmult * ppi / RPERIN) / 2.; - if (j < 1) j = 1; - - for (i = 0; i < nx * 2; i++) { - hasiz[i] = ((hasiz[i] * 2) / k) * j; - } - - ptr = pat[ipat].patbits; - for (i = 0; i < nx * 2; i++) { - if (haoff[i] >= hasiz[i]) haoff[i] = 0; - *ptr++ = hafat[i]; - *ptr++ = hacol[i]; - *ptr++ = haoff[i]; - *ptr++ = hasiz[i]; - } - - pat[ipat].xdim = -nx; - pat[ipat].ydim = nmul; /* angle */ - } - break; - - case VP_BIT_RASTER: - case VP_BYTE_RASTER: - ras_orient = vp_getint(); - if (rotate % 90 != 0) { - if (wantras) { - sf_warning ("%s: Raster only possible in " - "4 principal orientations",__FILE__); - wantras = false; - } - } else { - ras_orient += rotate / 90; - if (ras_orient >= 0) { - ras_orient %= 4; - } else { - ras_orient = ((ras_orient % 4) + 4) % 4; - } - } - - ras_offset = vp_getint(); - - if (ras_offset > MAX_COL || ras_offset + 255 < 0) - sf_error("%s: Absurd raster offset %d", - __FILE__,ras_offset); - - xvr_min = vp_getint(); - yvr_min = vp_getint(); - xvr_max = vp_getint(); - yvr_max = vp_getint(); - vptodevw (xvr_min, yvr_min, xvr_max, yvr_max, - &xvr_min, &yvr_min, &xvr_max, &yvr_max); - xvru_min = xvr_min; - yvru_min = yvr_min; - xvru_max = xvr_max; - yvru_max = yvr_max; - - xpix = vp_getint(); - ypix = vp_getint(); - - switch (ras_orient) { - case 0: - xrasmult = xpix / (float) (xvr_max - xvr_min); - yrasmult = ypix / (float) (yvr_max - yvr_min); - xvr_max--; - yvr_max--; - break; - case 1: - yrasmult = ypix / (float) (xvr_max - xvr_min); - xrasmult = xpix / (float) (yvr_max - yvr_min); - xvr_max--; - yvr_min++; - break; - case 2: - xrasmult = xpix / (float) (xvr_max - xvr_min); - yrasmult = ypix / (float) (yvr_max - yvr_min); - xvr_min++; - yvr_min++; - break; - case 3: - yrasmult = ypix / (float) (xvr_max - xvr_min); - xrasmult = xpix / (float) (yvr_max - yvr_min); - xvr_min++; - yvr_max--; - break; - } - - if (wantras && smart_raster) { -/* - rasterline = (unsigned char *) malloc ((unsigned) ((xpix + 7 + 2) * sizeof (unsigned char))); - rasterline2 = (unsigned char *) malloc ((unsigned) ((xpix + 7 + 2) * sizeof (unsigned char))); - if (rasterline == NULL || rasterline2 == NULL) - ERR (FATAL, name, "cannot alloc memory to load raster line"); - - outraster = (unsigned char *) malloc ((unsigned) (xpix * ypix) * sizeof (unsigned char)); - if (outraster == NULL) - ERR (FATAL, name, "cannot alloc memory to load raster image"); - - - * See whether we want to dither or not. - * Dither if monochrome device and dithering has been asked for. - * It's up to the device to decide whether to actually do this. - - dither_it = dither && mono; - - - * If the device is color, but the raster happens to all be shades - * of grey, let the device know so it can take advantage of the - * fact. This is available to the routine via the external variable - * "ras_allgrey". joe & david 10/03/94 - - ras_allgrey = YES; - if (!mono) - { - if (c == VP_BIT_RASTER) - { - for (ii=0; ii<2; ii++) - { - if ( - (color_set [ras_offset * ii][_RED] != - color_set [ras_offset * ii][_GREEN]) || - (color_set [ras_offset * ii][_GREEN] != - color_set [ras_offset * ii][_BLUE]) - ) - { - ras_allgrey = NO; - break; - } - } - } - else - { - for (ii=0; ii<256; ii++) - { - if ( - (color_set [ras_offset + ii][_RED] != - color_set [ras_offset + ii][_GREEN]) || - (color_set [ras_offset + ii][_GREEN] != - color_set [ras_offset + ii][_BLUE]) - ) - { - ras_allgrey = NO; - break; - } - } - } - } - - - * Read in the Raster data for "Smart" devices, ie, those - * which can stretch (and dither) their own raster. - - num_rep = 0; - for (yrast = 0; yrast < ypix; yrast++) - { - - * Read in the next raster line, if we have a new one - - if (num_rep <= 0) - { - num_rep = vp_getint(); - if (num_rep <= 0) - ERR (FATAL, name, "Bad Raster line multiplier"); - pos = 0; - new_pat:num_pat = vp_getint(); - num_byte = vp_getint(); - if (num_pat <= 0 || num_byte <= 0 || - pos + num_pat * num_byte > xpix) - ERR (FATAL, name, "Raster line not length promised"); - - if (num_pat > 1) - { - if (dither_it) - { - READ_RASTER ( - rasterline2[j] = GREY_MAP (ras_offset + (int) fgetc (pltin)), - rasterline2[j + jj] = GREY_MAP (ras_offset * ((ibyte & (001 << (7 - j))) != 0)) - ); - } - else - { - READ_RASTER ( - rasterline2[j] = COLOR_MAP (ras_offset + (int) fgetc (pltin)), - rasterline2[j + jj] = COLOR_MAP (ras_offset * ((ibyte & (001 << (7 - j))) != 0)) - ); - } - for (j = 0; j < num_pat; j++) - { - for (k = 0; k < num_byte; k++) - { - rasterline[pos] = rasterline2[k]; - pos++; - } - } - } - else - { - if (dither_it) - { - READ_RASTER ( - rasterline[pos + j] = GREY_MAP (ras_offset + (int) fgetc (pltin)), - rasterline[pos + j + jj] = GREY_MAP (ras_offset * ((ibyte & (001 << (7 - j))) != 0)) - ); - } - else - { - READ_RASTER ( - rasterline[pos + j] = COLOR_MAP (ras_offset + (int) fgetc (pltin)), - rasterline[pos + j + jj] = COLOR_MAP (ras_offset * ((ibyte & (001 << (7 - j))) != 0)) - ); - } - pos += num_byte; - } - - if (pos < xpix) - goto new_pat; - if (pos != xpix) - ERR (FATAL, name, "Raster line not length promised"); - } - num_rep--; - for (ii = 0; ii < xpix; ii++) - { - outraster[ii + yrast * xpix] = rasterline[ii]; - } - } - - Smart form - dev.raster (xpix, ypix, xvr_min, yvr_min, xvr_max, yvr_max, - outraster, ras_orient, dither_it); - - free ((char *) rasterline); - free ((char *) rasterline2); - free ((char *) outraster); -*/ - } else { - if (xvr_min < dev->xwmin) xvr_min=dev->xwmin; - if (xvr_max > dev->xwmax) xvr_max=dev->xwmax; - if (yvr_min < dev->ywmin) yvr_min=dev->ywmin; - if (yvr_max > dev->ywmax) yvr_max=dev->ywmax; - - switch (ras_orient) { - case 0: - xvr_max++; - yvr_max++; - xr_max = xvr_max - xvru_min; - xr_min = xvr_min - xvru_min; - yr_max = yvr_max - yvru_min; - yr_min = yvr_min - yvru_min; - yru_max = yvru_max - yvru_min; - break; - case 1: - xvr_max++; - yvr_min--; - xr_max = yvru_max - yvr_min; - xr_min = yvru_max - yvr_max; - yr_max = xvr_max - xvru_min; - yr_min = xvr_min - xvru_min; - yru_max = xvru_max - xvru_min; - break; - case 2: - xvr_min--; - yvr_min--; - xr_max = xvru_max - xvr_min; - xr_min = xvru_max - xvr_max; - yr_max = yvru_max - yvr_min; - yr_min = yvru_max - yvr_max; - yru_max = yvru_max - yvru_min; - break; - case 3: - xvr_min--; - yvr_max++; - xr_max = yvr_max - yvru_min; - xr_min = yvr_min - yvru_min; - yr_max = xvru_max - xvr_min; - yr_min = xvru_max - xvr_max; - yru_max = xvru_max - xvru_min; - break; - } - xru_min = 0; - - if (yr_max < yr_min || - xr_max < xr_min || !wantras) { - yr_max = yr_min; - xr_max = xr_min; - } - - rasterline = (unsigned char *) - sf_alloc (xpix + 7 + 2,sizeof (unsigned char)); - rasterline2 = (unsigned char *) - sf_alloc (xpix + 7 + 2,sizeof (unsigned char)); - - dither_it = dither && mono; - - if (xr_max > xr_min) { - outraster2 = (unsigned char *) - sf_alloc (xr_max - xr_min, sizeof (unsigned char)); - outraster = dither_it? (unsigned char *) - sf_alloc (xr_max - xr_min, sizeof (unsigned char)): - outraster2; - } else { - outraster2 = NULL; - outraster = NULL; - } - - /* Read in the Raster data */ - lastrast = -1; - num_rep = 0; - for (i = yr_max - 1; i >= yr_min - 1; i--) { - yrast = (i == yr_min - 1)? - ypix-1: (yru_max - 1 - i) * yrasmult; - - for (ii = 0; ii < (yrast - lastrast); ii++) { - if (num_rep <= 0) { - num_rep = vp_getint(); - if (num_rep <= 0) - sf_error ("%s: Bad Raster line multiplier", - __FILE__); - pos = 0; - - do { - num_pat = vp_getint(); - num_byte = vp_getint(); - if (num_pat <= 0 || num_byte <= 0 || - pos + num_pat * num_byte > xpix) - sf_error ("%s: Raster not length promised", - __FILE__); - - if (ii + num_rep >= yrast - lastrast - && xr_max > xr_min && i >= yr_min) { - if (num_pat > 1) { - if (dither_it) { - if (c == VP_BYTE_RASTER) { - for (j=0; j < num_byte; j++) { - k = ras_offset + getchar(); - rasterline2[j] = - color_set[k][GREY]; - } - } else { - for (jj=0;jj xr_min && i >= yr_min) { - for (j = xr_min; j < xr_max; j++) { - outraster2[j - xr_min] = - rasterline[(int)((j - xru_min) * - xrasmult)]; - } - } - } - num_rep--; - } - lastrast = yrast; - - if (xr_max > xr_min && i >= yr_min) { - if (dither_it) - dithline (outraster2, outraster, - xr_max - xr_min, yr_max - 1 - i, dither); - - switch (ras_orient) { - case 0: - raster (dev,yr_max - 1 - i, yr_max - yr_min, - xvr_min, i + yvru_min, - xr_max - xr_min, ras_orient, - outraster, 0, 0); - break; - case 1: - raster (dev,yr_max - 1 - i, yr_max - yr_min, - xvru_min + i, yvr_max, - xr_max - xr_min, ras_orient, - outraster, 0, 0); - break; - case 2: - raster (dev,yr_max - 1 - i, yr_max - yr_min, - xvr_max, yvru_max - i, - xr_max - xr_min, ras_orient, - outraster, 0, 0); - break; - case 3: - raster (dev,yr_max - 1 - i, yr_max - yr_min, - xvru_max - i, yvr_min, - xr_max - xr_min, ras_orient, - outraster, 0, 0); - break; - } - } - } - free (rasterline); - free (rasterline2); - - if (NULL != outraster2) { - free (outraster2); - if (dither_it) free (outraster); - } - - if (!wantras) { - xxx[0] = xvru_min; - yyy[0] = yvru_min; - xxx[1] = xvru_min; - yyy[1] = yvru_max; - xxx[2] = xvru_max; - yyy[2] = yvru_max; - xxx[3] = xvru_max; - yyy[3] = yvru_min; - drawpolygon (dev,4, xxx, yyy,attributes,area,vector); - } - } - break; - - case VP_MESSAGE: - getvpstring (); -/* - message (MESG_READY); - message (MESG_MESSAGE); - message (MESG_TEXT, txbuffer); - message (MESG_TEXT, CRLF); - message (MESG_DONE); -*/ - break; - case VP_SETDASH: - npts = vp_getint(); - if (npts > MAXDASH) - sf_error("%s: Too complicated dash line pattern",__FILE__); - dashon = npts; - k = 0; - dashsum = 0.; - for (ii = 0; ii < npts * 2; ii++) { - dashes[ii] = dashscale * vp_getint() / RPERIN; - if (dashes[ii] < 0.) - sf_error("%s: Negative dash distance.",__FILE__); - - if (dashes[ii] != 0.) k = 1; - - dashsum += dashes[ii]; - } - if (!k) dashon = false; - attributes (dev,NEW_DASH, dashon, 0, 0, 0); - break; - default: - sf_error("%s: invalid VPLOT command decimal %d character %c", - __FILE__, c, (char) c); - break; - } - if (!skip) c = getchar(); - skip = false; - } - - close (dev,CLOSE_FLUSH); - -/* End the group for this frame - group_number--; - if (group_number != 0) - { - ERR (WARN, name, - "group left unclosed at end of file"); - group_number = 0; - } - else - { - if ((erase & FORCE_INITIAL) && (erase & DO_LITERALS)) - ii = dev.attributes (END_GROUP, group_number, EOF_ERASE_EGROUP, 0, 0); - else - ii = dev.attributes (END_GROUP, group_number, EOF_IGNORE_EGROUP, 0, 0); - - if (ii == DOVPLOT_EXIT) - return; - if (ii != DOVPLOT_CONT) - ERR (WARN, name, "dev.attributes(END_GROUP,...) returned junk."); - } - -*/ -} - -static void reset_windows (vp_device dev, - void (*attributes)(vp_device, - vp_attribute,int,int,int,int)) -{ - if (dev->xwmax != xwmax_last || - dev->ywmax != ywmax_last || - dev->xwmin != xwmin_last || - dev->ywmin != ywmin_last) - attributes (dev,SET_WINDOW, - dev->xwmin, dev->ywmin, dev->xwmax, dev->ywmax); - - xwmin_last = dev->xwmin; - ywmin_last = dev->ywmin; - xwmax_last = dev->xwmax; - ywmax_last = dev->ywmax; -} - -static void outline_window (vp_device dev, - void (*attributes)(vp_device, - vp_attribute,int,int,int,int), - void (*vector)(vp_device,int,int,int,int,int,bool)) -{ - int color; - - color = color_set[VP_DEFAULT_COLOR][MAP]; - - if (need_devcolor || cur_color != color) { - attributes (dev, SET_COLOR, color, 0, 0, 0); - need_devcolor = false; - } - - vector (dev, dev->xwmin, dev->ywmin, dev->xwmax, dev->ywmin, 0, false); - vector (dev, dev->xwmax, dev->ywmin, dev->xwmax, dev->ywmax, 0, false); - vector (dev, dev->xwmax, dev->ywmax, dev->xwmin, dev->ywmax, 0, false); - vector (dev, dev->xwmin, dev->ywmax, dev->xwmin, dev->ywmin, 0, false); - - if (cur_color != color) - attributes (dev, SET_COLOR, cur_color, 0, 0, 0); -} - -static void update_color (vp_device dev, - void (*attributes)(vp_device, - vp_attribute,int,int,int,int)) -{ - if (need_devcolor) { - attributes (dev, SET_COLOR, cur_color, 0, 0, 0); - need_devcolor = false; - } -} - -static void getxy (int *x, int *y) -{ - int x0, y0; - - x0 = vp_getint(); - y0 = vp_getint(); - - vptodevxy(x0,y0,x,y); -} - -static void getxy_text (int *x, int *y) -{ - int x0, y0; - - x0 = vp_getint(); - y0 = vp_getint(); - - vptodevxy_text(x0,y0,x,y); -} - -static void getvpstring (void) -{ - char *txptr; - int i; - - txptr = txbuffer; - - while (1) { - i = getchar (); - - if (EOF == i) - sf_error("%s: Unexpected EOF encountered in text string",__FILE__); - - *txptr = i; - txptr++; - - if (0 == i) break; - - if ((txptr - txbuffer) == txbuflen) { - txbuffer = (char *) - sf_realloc (txbuffer, (txbuflen + TXBUFLEN), sizeof(char)); - txptr = txbuffer + txbuflen; - txbuflen += TXBUFLEN; - } - } -} - -static int getpolygon (int npts) -{ - int i; - struct vp_vertex *vertex; - - if (npts > vxbuflen - 1) { - vxbuflen = npts+1; - vxbuffer = (struct vp_vertex *) - sf_realloc (vxbuffer,vxbuflen,sizeof(*vxbuffer)); - } - vertex = vxbuffer; - - getxy (&xnew, &ynew); - vertex->x = xnew; - vertex->y = ynew; - vertex->next = vertex + 1; - vertex++; - i = npts - 1; - while (i--) { - getxy (&(vertex->x), &(vertex->y)); - if ((vertex->x != xnew) || - (vertex->y != ynew)) { - xnew = vertex->x; - ynew = vertex->y; - vertex->next = vertex + 1; - vertex->last = vertex - 1; - vertex++; - continue; - } - npts--; - } - vertex--; - vxbuffer->last = vertex; - vertex->next = vxbuffer; - - return npts; -} - -/* Draw the outline of the polygon pointed to by 'head'. If any side of - * the polygon is identical to any other (that is they have identical - * endpoints), then neither line is drawn. This allows among things a - * doughnut to be defined by a single polygon without the line that - * connects the inner and outer being plotted. */ - -static void vecoutline (vp_device dev, struct vp_vertex *head, - void (*vector)(vp_device,int,int,int,int,int,bool)) -{ - int xlast, ylast; - struct vp_vertex *v; - - xlast = head->last->x; - ylast = head->last->y; - - for (v = head; v->next != head; v = v->next) { - if (!dupside (v)) - vector (dev,v->x, v->y, xlast, ylast, afat, false); - xlast = v->x; - ylast = v->y; - } -} - -/* Determine if other sides in the polygon are - * identical to the side specified by the - * vertices v and v->b. */ -static bool dupside (struct vp_vertex *base) -{ - struct vp_vertex *v; - int x1, x2, y1, y2; - - x1 = base->x; - x2 = base->last->x; - y1 = base->y; - y2 = base->last->y; - for (v = base->next; v != base; v = v->next) { - if (x1 == v->x && - y1 == v->y && - x2 == v->last->x && - y2 == v->last->y) - return true; - - if (x2 == v->x && - y2 == v->y && - x1 == v->last->x && - y1 == v->last->y) - return true; - } - - return false; -} - -/* reset variables that can be affected by vplot commands when - * processing multiple plots, and don't stay set across pages */ -static void reset_all (vp_device dev, - void (*attributes)(vp_device, - vp_attribute,int,int,int,int)) -{ - int i, j, k, color; - - dev->xwmin = xWmin; /* plot window parameters defaulted */ - dev->xwmax = xWmax; /* to maximum size */ - dev->ywmin = yWmin; - dev->ywmax = yWmax; - - reset_windows (dev, attributes); - - fat = fatmult * fatbase; - attributes (dev, NEW_FAT, fat, 0, 0, 0); - - color = color_set[VP_DEFAULT_COLOR][MAP]; - if (cur_color != color) { - need_devcolor = true; - cur_color = color; - } - - txalign.hor = TH_NORMAL; - txalign.ver = TV_NORMAL; - attributes (dev, NEW_ALIGN, txalign.hor, txalign.ver, 0, 0); - - i = -1; - j = -1; - k = -1; - if (txfont != default_txfont) { - txfont = default_txfont; - i = txfont; - } - if (txprec != default_txprec) { - txprec = default_txprec; - j = txprec; - } - if (txovly != default_txovly) { - txovly = default_txovly; - k = txovly; - } - attributes (dev, NEW_FONT, i, j, k, 0); - - dashon = false; - attributes (dev, NEW_DASH, dashon, 0, 0, 0); - - overlay = default_overlay; - attributes (dev, NEW_OVERLAY, overlay, 0, 0, 0); -} - -/* 1 random threshold - * 2 256 element ordered dither (oriented at 0 degrees) - * 3 Floyd-Steinberg minimized average error method - * 4 32 element halftone (oriented at 45 degrees) */ -static void dithline (unsigned char *inpline, - unsigned char *outline, - int npixels, int linenum, int imethod) -{ - int greydata, i1, ipoint, jpoint, irand; - float pixel, pixerr, nexterr; - const int pix_on = 0, pix_off = 7; - static float *errline = NULL; - static int ialloc = 0; - static float alpha = 0.4375; - const float beta = 0.1875, gamma = 0.3125, delta = 0.0625; - const int dith256[256] = { - 1,128,32,160,8,136,40,168,2,130,34,162,10,138,42,170, - 192,64,224,96,200,72,232,104,194,66,226,98,202,74,234,106, - 48,176,16,144,56,184,24,152,50,178,18,146,58,186,26,154, - 240,112,208,80,248,120,216,88,242,114,210,82,250,122,218,90, - 12,140,44,172,4,132,36,164,14,142,46,174,6,134,38,166, - 204,76,236,108,196,68,228,100,206,78,238,110,198,70,230,102, - 60,188,28,156,52,180,20,148,62,190,30,158,54,182,22,150, - 252,124,220,92,244,116,212,84,254,126,222,94,246,118,214,86, - 3,131,35,163,11,139,43,171,1,129,33,161,9,137,41,169, - 195,67,227,99,203,75,235,107,193,65,225,97,201,73,233,105, - 51,179,19,147,59,187,27,155,49,177,17,145,57,185,25,153, - 243,115,211,83,251,123,219,91,241,113,209,81,249,121,217,89, - 15,143,47,175,7,135,39,167,13,141,45,173,5,133,37,165, - 207,79,239,111,199,71,231,103,205,77,237,109,197,69,229,101, - 63,191,31,159,55,183,23,151,61,189,29,157,53,181,21,149, - 254,127,223,95,247,119,215,87,253,125,221,93,245,117,213,85}; - const int halftone32[64] = { - 92,100,124,148,164,156,132,108, - 28,20,76,220,228,236,180,36, - 4,12,84,212,252,244,172,44, - 52,60,116,188,204,196,140,68, - 164,156,132,108,92,100,124,148, - 228,236,180,36,28,20,76,220, - 252,244,172,44,4,12,84,212, - 204,196,140,68,52,60,116,188 - }; - - switch (imethod) { - case 1: /* Random Dither */ - for (i1 = 0; i1 < npixels; i1++) { - greydata = inpline[i1]; - irand = (random () & 255); - - outline[i1] = (greydata > irand)? pix_off: pix_on; - } - break; - case 2: /* Ordered Dither */ - for (i1 = 0; i1 < npixels; i1++) { - greydata = inpline[i1]; - ipoint = i1 % 16; - jpoint = linenum % 16; - ipoint = ipoint * 16 + jpoint; - - outline[i1] = (greydata > dith256[ipoint])? pix_off:pix_on; - } - break; - case 3: /* Floyd-Steinberg */ - if (ialloc < npixels) { - if (ialloc > 0) { - free (errline); - ialloc = 0; - } - errline = sf_floatalloc (npixels); - ialloc = npixels; - for (i1 = 0; i1 < npixels; i1++) { - errline[i1] = 0.; - } - } - - nexterr = errline[0]; - for (i1 = 0; i1 < npixels; i1++) { - pixel = inpline[i1]; - pixel += nexterr; - if (pixel < 128) { - outline[i1] = pix_on; - pixerr = pixel; - } else { - outline[i1] = pix_off; - pixerr = pixel - 255; - } - if (i1 < npixels - 1) { - nexterr = errline[i1 + 1] + pixerr * alpha; - errline[i1 + 1] = pixerr * delta; - } - if (i1 > 0) { - errline[i1 - 1] += pixerr * beta; - } - if (i1 == 0) { - errline[i1] = pixerr * gamma; - } else { - errline[i1] += pixerr * gamma; - } - } - break; - case 4: /* 32 element halftone at 45 degrees */ - default: - for (i1 = 0; i1 < npixels; i1++) { - greydata = inpline[i1]; - ipoint = i1 % 8; - jpoint = linenum % 8; - ipoint = ipoint * 8 + jpoint; - - outline[i1] = (greydata > halftone32[ipoint])? pix_off: pix_on; - } - break; - } -} - -static void drawpolygon (vp_device dev, int npts, int *x, int *y, - void (*attributes)(vp_device,vp_attribute, - int,int,int,int), - void (*area) (vp_device,int,struct vp_vertex*), - void (*vector)(vp_device,int,int,int,int,int,bool)) -{ - int i, j; - static int point; - struct vp_vertex *vertex; - - j = 0; - if (npts > vxbuflen - 1) - vxbuffer = (struct vp_vertex *) - sf_realloc (vxbuffer,npts+1,sizeof(*vxbuffer)); - vertex = vxbuffer; - - xnew = x[j]; - ynew = y[j]; - j++; - vertex->x = xnew; - vertex->y = ynew; - vertex->next = vertex + 1; - vertex++; - - i = npts - 1; - while (i--) { - vertex->x = x[j]; - vertex->y = y[j]; - j++; - if ((vertex->x != xnew) || - (vertex->y != ynew)) { - xnew = vertex->x; - ynew = vertex->y; - vertex->next = vertex + 1; - vertex->last = vertex - 1; - vertex++; - continue; - } - npts--; - } - vertex--; - vxbuffer->last = vertex; - vertex->next = vxbuffer; - - ipat = 0; - point = cur_color; - pat[ipat].patbits = &point; - pat[ipat].xdim = 1; - pat[ipat].ydim = 1; - pat[ipat].xdim_orig = 1; - pat[ipat].ydim_orig = 1; - update_color (dev, attributes); - if (npts > 2) { - if (shade) { - area (dev, npts, vxbuffer); - } else { - vecoutline (dev,vxbuffer,vector); - } - } -} - -void vp_main(int argc, char* argv[], vp_device dev, - void (*open)(vp_device), - void (*reset)(vp_device), - void (*close)(vp_device,vp_close), - void (*eras)(vp_device,vp_eras), - void (*attributes)(vp_device, - vp_attribute,int,int,int,int), - void (*vector)(vp_device,int,int,int,int,int,bool), - void (*marker)(vp_device,int,int,int,int*), - void (*text) (vp_device,char*,float,float,float,float), - void (*area) (vp_device,int,struct vp_vertex*), - void (*raster) (vp_device,int,int,int,int,int,int, - unsigned char*,int,int)) -{ - int i; - char *arg; - - vplot_init (dev, open); - vplot_do(dev,reset,close,eras,attributes,vector,marker,text,area,raster); - - for (i=1; i < argc; i++) { - arg = argv[i]; - if (NULL == strchr(arg,'=')) { /* not a parameter */ - if (NULL == freopen(arg,"rb",stdin)) - sf_error("%s: Cannot open file %s:",__FILE__,arg); - vplot_do(dev,reset,close,eras,attributes, - vector,marker,text,area,raster); - } - } -} diff --git a/user/nobody/dip2.c b/user/nobody/dip2.c deleted file mode 100644 index 074281c3bd..0000000000 --- a/user/nobody/dip2.c +++ /dev/null @@ -1,128 +0,0 @@ -/* 2-D dip estimation */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include - -#include - -#include "dip2.h" -#include "div2.h" -#include "allp2.h" - -static float **u1, **u2, **dp; -static int n1, n2, n; -static bool sign; - -void dip2_init(int niter /* number of linear iterations */, - int nx, int ny /* dimensions */, - float fx, float fy /* smoothing */, - bool sign1 /* to keep sign */, - bool gauss /* to use Gaussian smoothing */, - bool verb /* verbosity flag */) -/*< initialize >*/ -{ - n1=nx; n2=ny; n=n1*n2; - u1 = sf_floatalloc2(n1,n2); - u2 = sf_floatalloc2(n1,n2); - dp = sf_floatalloc2(n1,n2); - - div2_init(n1,n2,fx,fy,niter,gauss,verb); - sign = sign1; -} - -void dip2_close(void) -/*< free allocated storage >*/ -{ - free (u1[0]); free (u1); - free (u2[0]); free (u2); - free (dp[0]); free (dp); - /* divide2_close(div0); */ - div2_close(); -} - -void dip2(int niter /* number of iterations */, - int nw /* filter size */, - int nj /* filter stretch for aliasing */, - bool verb /* verbosity */, - float **u /* input data */, - float** p /* output dip */, - bool **mask /* input mask for known data */) -/*< estimate local dip >*/ -{ - int i, iter; - float mean, usum, psum, ui, dpi, pi; - allpass2 ap; - - ap = allpass2_init (nw,nj,n1,n2,p); - - for (iter =0; iter < niter; iter++) { - allpass21 (false, ap, u,u2); - allpass21 (true, ap, u,u1); - - mean = 0.; - for(i=0; i < n; i++) { - ui = u1[0][i]; - mean += ui*ui; - } - if (mean == 0.) return; - - mean = sqrtf(mean/n); - - usum = 0.; - psum = 0.; - - for(i=0; i < n; i++) { - u1[0][i] /= mean; - u2[0][i] /= mean; - if (verb) { - usum += u2[0][i]*u2[0][i]; - psum += p[0][i]; - } - } - - if (verb) sf_warning("%d %g %g", iter+1, sqrt(usum/n), psum/n); - - if (NULL != mask) { - for(i=0; i < n; i++) { - if (mask[0][i]) { - u1[0][i] = 0.; - u2[0][i] = 0.; - } - } - } - - div2(u2[0],u1[0],dp[0]); - - for(i=0; i < n; i++) { - dpi = dp[0][i]; - pi = p[0][i]; - if (sign && - fabsf(pi) > FLT_EPSILON && - fabsf(pi) > fabsf (dpi)) { - p[0][i] *= expf(dpi/pi); - } else { - p[0][i] += dpi; - } - } - } /* iter */ -} - -/* $Id$ */ diff --git a/user/nobody/div1.c b/user/nobody/div1.c deleted file mode 100644 index dd0d400160..0000000000 --- a/user/nobody/div1.c +++ /dev/null @@ -1,71 +0,0 @@ -/* 1-D smooth division */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "div1.h" -#include "gauss.h" -#include "weight.h" - -static int niter; -static float *p; -static bool gauss; - -void div1_init(int n1 /* data size */, - float f1 /* smoothing */, - int niter1 /* number of iterations */, - bool gauss1 /* if use exact gaussian */) -/*< initialize >*/ -{ - niter = niter1; - gauss = gauss1; - - if (gauss) { - gauss_init(n1,f1); - } else { - sf_triangle1_init((int) f1, n1); - } - sf_conjgrad_init(n1, n1, n1, n1, 1., 1.e-6, true, false); - p = sf_floatalloc (n1); -} - -void div1_close (void) -/*< free allocated storage >*/ -{ - if (gauss) { - gauss_close(); - } else { - sf_triangle1_close(); - } - sf_conjgrad_close(); - free (p); -} - -void div1 (float* num, float* den, float* rat) -/*< smooth division: rat=num/den >*/ -{ - weight_init(den); - if (gauss) { - sf_conjgrad(NULL, weight_lop,sf_freqfilt_lop,p,rat,num,niter); - } else { - sf_conjgrad(NULL, weight_lop,sf_triangle1_lop,p,rat,num,niter); - } -} - -/* $Id$ */ diff --git a/user/nobody/divide1.c b/user/nobody/divide1.c deleted file mode 100644 index 27d9aa94e7..0000000000 --- a/user/nobody/divide1.c +++ /dev/null @@ -1,102 +0,0 @@ -#include - -#include "divide1.h" -#include "tridiagonal.h" - -/* concrete data type */ -struct Div1 { - int n; - float eps, lam, *diag, *offd; - tris slv; -}; - -div1 divide1_init(int n, float eps, float lam) -{ - div1 div; - int i; - - div = (div1) sf_alloc(1,sizeof(*div)); - - div->n = n; div->eps = eps; div->lam = lam; - div->slv = tridiagonal_init (n); - div->diag = sf_floatalloc(n); - div->offd = sf_floatalloc(n); - for (i=0; i < n; i++) { - div->offd[i] = -eps; - } - - return div; -} - -void divide1_close (div1 div) -{ - tridiagonal_close (div->slv); - free (div->diag); - free (div->offd); - free (div); -} - -void divide2 (div1 div, int n2, float** num, float** den, float** rat) -{ - int i2; - - divide1 (div, num[0], den[0], NULL, NULL, rat[0]); - for (i2=1; i2 < n2; i2++) { - divide1 (div, num[i2], den[i2], rat[i2-1], NULL, rat[i2]); - } -} - -void divide3 (div1 div, int n3, int n2, - float*** num, float*** den, float*** rat) -{ - int i2, i3; - - divide2 (div, n2, num[0], den[0], rat[0]); - for (i3=1; i3 < n3; i3++) { - divide1 (div, num[i3][0], den[i3][0], rat[i3-1][0], NULL, rat[i3][0]); - for (i2=1; i2 < n2; i2++) { - divide1 (div, num[i3][i2], den[i3][i2], - rat[i3-1][i2], rat[i3][i2-1], rat[i3][i2]); - } - } -} - -void divide1 (div1 div, float* num, float* den, - float* rat1, float* rat2, float* rat) -{ - int i; - - if (rat1 != NULL) { - if (rat2 != NULL) { - for (i=0; i < div->n; i++) { - div->diag[i] = 2.*div->eps + den[i]*den[i] + 2.*div->lam; - } - for (i=0; i < div->n; i++) { - rat[i] = num[i]*den[i] + div->lam*(rat1[i] + rat2[i]); - } - } else { - for (i=0; i < div->n; i++) { - div->diag[i] = 2.*div->eps + den[i]*den[i] + div->lam; - } - for (i=0; i < div->n; i++) { - rat[i] = num[i]*den[i] + div->lam*rat1[i]; - } - } - } else { - for (i=0; i < div->n; i++) { - div->diag[i] = 2.*div->eps + den[i]*den[i]; - } - for (i=0; i < div->n; i++) { - rat[i] = num[i]*den[i]; - } - } - - /* reflecting b.c. */ - div->diag[0] -= div->eps; - div->diag[div->n-1] -= div->eps; - - tridiagonal_define (div->slv, div->diag, div->offd); - tridiagonal_solve (div->slv, rat); -} - -/* $Id$ */ diff --git a/user/nobody/divide2.c b/user/nobody/divide2.c deleted file mode 100644 index a8e0352e56..0000000000 --- a/user/nobody/divide2.c +++ /dev/null @@ -1,100 +0,0 @@ -#include - -#include "divide2.h" -#include "tridiagonal.h" - -/* concrete data type */ -struct Div2 { - int n1, n2; - float eps1, eps2; - float *diag1, *diag2, *offd1, *offd2, *rat2; - tris slv1, slv2; -}; - -div2 divide2_init(int n1, int n2, float eps1, float eps2) -{ - div2 div; - int i; - - div = (div2) sf_alloc(1,sizeof(*div)); - - eps1 *= 2; - eps2 *= 2; - - div->n1 = n1; - div->n2 = n2; - div->eps1 = eps1; - div->eps2 = eps2; - div->slv1 = tridiagonal_init (n1); - div->slv2 = tridiagonal_init (n2); - div->diag1 = sf_floatalloc(n1); - div->diag2 = sf_floatalloc(n2); - div->offd1 = sf_floatalloc(n1); - div->offd2 = sf_floatalloc(n2); - for (i=0; i < n1; i++) { - div->offd1[i] = -eps1; - } - for (i=0; i < n2; i++) { - div->offd2[i] = -eps2; - } - div->rat2 = sf_floatalloc(n2); - - return div; -} - -void divide2_close (div2 div) -{ - tridiagonal_close (div->slv1); - tridiagonal_close (div->slv2); - free (div->diag1); - free (div->diag2); - free (div->offd1); - free (div->offd2); - free (div->rat2); - free (div); -} - -/* AOS - additive splitting */ -void divide2 (div2 div, float** num, float** den, float** rat) -{ - int i1, i2, n1, n2; - float deni; - - n1 = div->n1; - n2 = div->n2; - - for (i2=0; i2 < n2; i2++) { - for (i1=0; i1 < n1; i1++) { - deni = den[i2][i1]; - div->diag1[i1] = 2.*div->eps1 + deni*deni; - rat[i2][i1] = 0.5*num[i2][i1]*deni; - } - - /* almost reflecting b.c. */ - div->diag1[0] -= 0.999*div->eps1; - div->diag1[n1-1] -= 0.999*div->eps1; - - tridiagonal_define (div->slv1, div->diag1, div->offd1); - tridiagonal_solve (div->slv1, rat[i2]); - } - for (i1=0; i1 < n1; i1++) { - for (i2=0; i2 < n2; i2++) { - deni = den[i2][i1]; - div->diag2[i2] = 2.*div->eps2 + deni*deni; - div->rat2[i2] = 0.5*num[i2][i1]*deni; - } - - /* almost reflecting b.c. */ - div->diag2[0] -= 0.999*div->eps2; - div->diag2[n2-1] -= 0.999*div->eps2; - - tridiagonal_define (div->slv2, div->diag2, div->offd2); - tridiagonal_solve (div->slv2, div->rat2); - - for (i2=0; i2 < n2; i2++) { - rat[i2][i1] += div->rat2[i2]; - } - } -} - -/* $Id$ */ diff --git a/user/nobody/divlap1.c b/user/nobody/divlap1.c deleted file mode 100644 index d3e95757cf..0000000000 --- a/user/nobody/divlap1.c +++ /dev/null @@ -1,137 +0,0 @@ -#include - -#include "divlap1.h" -#include "banded.h" - -/* concrete data type */ -struct Divlap { - int n; - float eps, lam; - bands slv; - float *diag, *offd[2]; -}; - -divlap divlap1_init(int n, float eps, float lam) -{ - divlap div; - int i; - - div = (divlap) sf_alloc(1,sizeof(*div)); - div->n = n; div->eps = eps; div->lam = lam; - div->slv = banded_init (n,2); - div->diag = sf_floatalloc(n); - div->offd[0] = sf_floatalloc(n); - div->offd[1] = sf_floatalloc(n); - for (i=0; i < n; i++) { - div->offd[0][i] = -4.*eps; - div->offd[1][i] = eps; - } - - return div; -} - -void divlap1_close (divlap div) -{ - banded_close (div->slv); - free (div->diag); - free (div->offd[0]); - free (div->offd[1]); - free (div); -} - -void divlap2 (divlap div, int n2, - float** num, float** den, float** ref, float** rat) -{ - int i2; - - if (ref != NULL) { - divlap1 (div, num[0], den[0], ref[0], NULL, NULL, rat[0]); - for (i2=1; i2 < n2; i2++) { - divlap1 (div, num[i2], den[i2], ref[i2], - rat[i2-1], NULL, rat[i2]); - } - } else { - divlap1 (div, num[0], den[0], NULL, NULL, NULL, rat[0]); - for (i2=1; i2 < n2; i2++) { - divlap1 (div, num[i2], den[i2], NULL, - rat[i2-1], NULL, rat[i2]); - } - } -} - -void divlap3 (divlap div, int n3, int n2, - float*** num, float*** den, float*** ref, float*** rat) -{ - int i2, i3; - - divlap2 (div, n2, num[0], den[0], ref[0], rat[0]); - for (i3=1; i3 < n3; i3++) { - divlap1 (div, num[i3][0], den[i3][0], ref[i3][0], - rat[i3-1][0], NULL, rat[i3][0]); - for (i2=1; i2 < n2; i2++) { - divlap1 (div, num[i3][i2], den[i3][i2], ref[i3][i2], - rat[i3-1][i2], rat[i3][i2-1], rat[i3][i2]); - } - } -} - -void divlap1 (divlap div, float* num, float* den, float* ref, - float* rat1, float* rat2, float* rat) -{ - int i; -/* const float a=1.; */ - - if (rat1 != NULL) { - if (rat2 != NULL) { - for (i=0; i < div->n; i++) { - div->diag[i] = 6.*(div->eps) + den[i] + 2.*(div->lam); - } - for (i=0; i < div->n; i++) { - rat[i] = num[i] + (div->lam)*(rat1[i] + rat2[i]); - } - } else { - for (i=0; i < div->n; i++) { - div->diag[i] = 6.*(div->eps) + den[i] + (div->lam); - } - for (i=0; i < div->n; i++) { - rat[i] = num[i] + (div->lam)*rat1[i]; - } - } - } else { - for (i=0; i < div->n; i++) { - div->diag[i] = 6.*(div->eps) + den[i]; - } - for (i=0; i < div->n; i++) { - rat[i] = num[i]; - } - } - - /* absorbing b.c. - div->diag[0] += (a-6.)*(div->eps); - div->diag[1] += (a-2.)*(div->eps); - div->diag[div->n-2] += (a-2.)*(div->eps); - div->diag[div->n-1] += (a-6.)*(div->eps); - div->offd[0][0] = -(1.+a)*(div->eps); - div->offd[0][div->n-2] = -(1.+a)*(div->eps); - */ - - if (ref != NULL) { - rat[0] += (div->eps)*(ref[0]-2.*ref[1]+ref[2]); - rat[1] += (div->eps)*(5.*ref[1]-2.*ref[0]-4.*ref[2]+ref[3]); - for (i=2; i < div->n-2; i++) { - rat[i] += (div->eps)* - (6.*ref[i]-4.*ref[i-1]-4.*ref[i+1]+ref[i-2]+ref[i+2]); - } - rat[div->n-2] += (div->eps)* - (5.*ref[div->n-2]-2.*ref[div->n-1]-4.*ref[div->n-3]+ - ref[div->n-4]); - rat[div->n-1] += (div->eps)* - (ref[div->n-1]-2.*ref[div->n-2]+ref[div->n-3]); - } - - banded_define (div->slv, div->diag, div->offd); - banded_solve (div->slv, rat); -} - -/* $Id$ */ - diff --git a/user/nobody/dsr1.c b/user/nobody/dsr1.c deleted file mode 100644 index df569128a1..0000000000 --- a/user/nobody/dsr1.c +++ /dev/null @@ -1,241 +0,0 @@ -/* 2-D prestack migration/modeling by split-step DSR */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include -/*^*/ - -#include "dsr1.h" - -void dsr1 (bool verb /* verbosity flag */, - bool inv /* migration/modeling flag */, - float eps /* stability factor */, - int nw, float dw /* frequency */, - int nz, float dz /* depth */, - int nx, float dx /* midpoint */, - int nh, float dh, float h0 /* offset */, - float **vt /* slowness [nx][nz] */, - float *v /* reference slowness [nz] */, - float complex ***cp /* data [nx][nh][nw] */, - float **q /* image [nx][nz] */) -/*< Apply migration/modeling >*/ -{ - int nk,ng,iz,iw,ix,jx,ih,jh; - float k,dk,fk, g,dg,fg, s,r; - float complex cshift,**pp, w2; - kiss_fft_cfg xforw, xinvs, hforw, hinvs; - - /* determine wavenumber sampling, pad by 2 */ - nk = nx*2; - nk *= 2; - dk = 2.0*SF_PI/(nk*dx); - fk = -SF_PI/dx; - - ng = nh*2; - nh *= 2; - dg = 2.0*SF_PI/(ng*dh); - fg = -SF_PI/dh; - - xforw = kiss_fft_alloc(nk,0,NULL,NULL); - xinvs = kiss_fft_alloc(nk,1,NULL,NULL); - hforw = kiss_fft_alloc(nk,0,NULL,NULL); - hinvs = kiss_fft_alloc(nk,1,NULL,NULL); - - if (NULL == xforw || NULL == xinvs || - NULL == hforw || NULL == xinvs) - sf_error("%s: KISS FFT allocation error",__FILE__); - - /* allocate workspace */ - pp = sf_complexalloc2 (ng,nk); - - if (!inv) { /* prepare image for migration */ - for (ix=0; ix=0; iz--) { - for (ih=0; ih - -#include -/*^*/ - -#include "dsr2.h" -#include "fft2.h" -#include "taper.h" -#include "slowref.h" - -#define LOOPxh(a) for(ix=0;ix*/ -{ - int ix, ih, iu; - int jx, jh; - float x, h; - float kx, kh, k; - float dx, dh; - float x0, h0; - - nz = nz1; - dz = dz1; - - nx = nx1; - dx = 2.0*SF_PI/(nx*dx1); - x0 = -SF_PI/ dx1 ; - - nh = nh1; - nh2 = nh+npad; - - dh = 2.0*SF_PI/(nh2*dh1); - h0 = -SF_PI/ dh1 ; - - nu = nu1; - - nrmax = nr1; - - fft2_init(nh2,nx); - - /* allocate workspace */ - sz = sf_floatalloc2 (nrmax,nz); /* reference slowness */ - sm = sf_floatalloc2 (nrmax,nz); /* reference slowness squared*/ - nr = sf_intalloc ( nz); /* number of reference slownesses */ - - qq = sf_floatalloc2 (nh,nu); /* image */ - - ks = sf_floatalloc2 (nh2,nx); /* source wavenumber */ - kr = sf_floatalloc2 (nh2,nx); /* receiver wavenumber */ - is = sf_intalloc2 (nh, nx); /* source reference */ - ir = sf_intalloc2 (nh, nx); /* receiver reference */ - ii = sf_intalloc (nx); /* midpoint reference */ - - pk = sf_complexalloc2 (nh2,nx); /* padded wavefield */ - wx = sf_complexalloc2 (nh, nx); /* x wavefield */ - wk = sf_complexalloc2 (nh2,nx); /* k wavefield */ - - ms = sf_intalloc2 (nh, nx); /* MRS map source */ - mr = sf_intalloc2 (nh, nx); /* MRS map receiver */ - ma = sf_floatalloc2 (nh, nx); /* MRS mask */ - - skip = sf_boolalloc3 (nrmax,nrmax,nz); /* skip slowness combination */ - - /* precompute wavenumbers */ - for (ix=0; ix= nu) iu=nu-1; - ii[ix] = iu; - - for (ih=0; ih= nu) iu=nu-1; - is[ix][ih] = iu; - - iu = 0.5+(x+h-u0)/du; - if (iu < 0) iu=0; - else if (iu >= nu) iu=nu-1; - ir[ix][ih] = iu; - } - - for (ih=0; ih*/ -{ - free( *pk); free( pk); - free( *wk); free( wk); - free( *wx); free( wx); - - free( *sz); free( sz); - free( *sm); free( sm); - free( nr); - - free( *qq); free( qq); - free( *ks); free( ks); - free( *kr); free( kr); - free( *is); free( is); - free( *ir); free( ir); - free( ii); - - free( *ms); free( ms); - free( *mr); free( mr); - free( *ma); free( ma); - - free(**skip); - free( *skip); free(skip); - fslice_close(mms); - fslice_close(mmr); - taper2_close(); - fft2_close(); -} - -void dsr2(bool verb /* verbosity flag */, - bool inv /* migration/modeling flag */, - float eps /* stability factor */, - int nw, float dw, float w0 /* frequency (radian) */, - sf_file data /* data [nw][nx][nh] */, - slice imag /* image file [nz][nu][nh] */, - float **slow /* slowness [nz][nx] */, - float dt /* time error */) -/*< Apply migration/modeling >*/ -{ - int iz,iw,ix,ih,iu, j,k; - float sy, *si; - float complex cshift, w, w2, cs, cr, cref; - - if (!inv) { /* prepare image for migration */ - LOOPuh( qq[iu][ih] = 0.0; ); - for (iz=0; iz sy) ms[ix][ih]++; - if(si[ ir[ix][ih] ] > sy) mr[ix][ih]++; ); - } - fslice_put(mms,iz,ms[0]); - fslice_put(mmr,iz,mr[0]); - for (j=0; j=0; iz--) { - /* w-x @ bottom */ - LOOPxh2( pk[ix][ih] = 0.;); - taper2(true,false,nx,nh,wx); - LOOPxh( sy = 0.5*(si[ is[ix][ih] ] + - si[ ir[ix][ih] ]); - cshift = cexpf(-w*sy*dz); - pk[ix][ih] = - wx[ix][ih] * cshift; ); - - /* FFT */ - fft2(false,pk); - - si = slow[iz]; - fslice_get(mms,iz,ms[0]); - fslice_get(mmr,iz,mr[0]); - - LOOPxh( wx[ix][ih] = 0; ); - for (j=0; j -#include - -#include - -static float **prev, **next, **dist; -static int ***what; -static int n1, n2, n3, gt2, gt3; - -void dynprog2_init(int nz /* vertical */, - int nx, int ny /* horizontal */, - int xgate, int ygate /* picking gate */, - float anx, float any /* anisotropy */) -/*< Initialize >*/ -{ - int i2, i3; - float d; - - n1=nz; - n2=nx; - n3=ny; - gt2=xgate; - gt3=ygate; - - prev = sf_floatalloc2(n2,n3); - next = sf_floatalloc2(n2,n3); - dist = sf_floatalloc2(n2,n3); - what = sf_intalloc3(n2,n3,n1); - - for (i3=0; i3 < n3; i3++) { - d = hypotf(any*i3,anx); - for (i2=0; i2 < n2; i2++) { - dist[i3][i2] = hypotf(i2,d); - } - } -} - -void dynprog2_close(void) -/*< deallocate >*/ -{ - free(*prev); free(prev); - free(*next); free(next); - free(*dist); free(dist); - free(**what); free(*what); free(what); -} - -void dynprog2(int i0 /* starting velocity */, - float*** weight /* [n1][n3][n2] */) -/*< apply >*/ -{ - float d, c, w, w2; - int i1, i2, i3, j2, j3, ic, ib3, ie3, ib2, ie2; - - for (i3=0; i3 < n3; i3++) { - for (i2=0; i2 < n2; i2++) { - w = 0.5*(weight[1][i3][i2]+weight[0][i3][i0]); - prev[i3][i2] = dist[0][SF_ABS(i2-i0)]*w; - what[1][i3][i2] = i0; - } - } - - for (i1=2; i1 < n1; i1++) { - sf_warning("depth %d of %d",i1+1,n1); - - for (i3=0; i3 < n3; i3++) { - ib3 = SF_MAX(i3-gt3,-1); - ie3 = SF_MIN(i3+gt3,n3); - for (i2=0; i2 < n2; i2++) { - w = weight[i1][i3][i2]; - ib2 = SF_MAX(i2-gt2,-1); - ie2 = SF_MIN(i2+gt2,n2); - c = FLT_MAX; - ic = -1; - - for (j3=ib3+1; j3 < ie3; j3++) { - for (j2=ib2+1; j2 < ie2; j2++) { - w2 = 0.5*(w+weight[i1-1][j3][j2]); - d = dist[SF_ABS(i3-j3)][SF_ABS(i2-j2)]*w2+prev[j3][j2]; - - if (d < c) { - c = d; - ic = j2-ib2-1; - } - } - } - - what[i1][i3][i2] = ic; - next[i3][i2]=c; - } - } - if (i1==n1-1) return; - for (i3=0; i3 < n3; i3++) { - for (i2=0; i2 < n2; i2++) { - prev[i3][i2]=next[i3][i2]; - } - } - } -} - -void dynprog2_traj(int **traj /* [n3][n1] */) -/*< extract trajectory >*/ -{ - int i3, i2, i1, ic; - float c, d; - - for (i3=0; i3 < n3; i3++) { - c = FLT_MAX; - ic = 0; - for (i2=0; i2 < n2; i2++) { - d = next[i3][i2]; - if (d < c) { - c = d; - ic = i2; - } - } - for (i1=n1-1; i1 >= 0; i1--) { - traj[i3][i1]=ic; - ic = what[i1][i3][ic]; - } - } -} diff --git a/user/nobody/enogrid.c b/user/nobody/enogrid.c deleted file mode 100644 index 44f879b018..0000000000 --- a/user/nobody/enogrid.c +++ /dev/null @@ -1,108 +0,0 @@ -/* ENO interpolation in second dimension + adaptive grid in first dimension */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "enogrid.h" - -#include "grid1.h" -/*^*/ - -#ifndef _enogrid_h - -typedef struct Enogrid *enogrid; -/* abstract data type */ -/*^*/ - -#endif - -struct Enogrid { - int order, ng, n2, nf; - sf_eno jnt; - grid1 *grid; - float **f, *f0; -}; -/* concrete data type */ - -enogrid enogrid_init (int order /* interpolation order */, - int n2 /* second data dimensions */, - int nf /* number of values */, - grid1 *grid /* first dimension grids */) -/*< Initialize interpolation object >*/ -{ - enogrid pnt; - - pnt = (enogrid) sf_alloc(1,sizeof(*pnt)); - pnt->order = order; - pnt->n2 = n2; - pnt->ng = 2*order-2; - if (pnt->ng > pnt->n2) sf_error("%s: ng=%d is too big",__FILE__,pnt->ng); - pnt->jnt = sf_eno_init (order, pnt->ng); - pnt->nf = nf; - pnt->f = sf_floatalloc2(nf,pnt->ng); - pnt->f0 = sf_floatalloc(pnt->ng); - pnt->grid = grid; - - return pnt; -} - -void enogrid_close (enogrid pnt) -/*< Free internal storage >*/ -{ - sf_eno_close (pnt->jnt); - free (pnt->f[0]); - free (pnt->f); - free (pnt->f0); - free (pnt); -} - -void enogrid_apply (enogrid pnt, - int j /* grid location */, - float y /* offset from grid */, - float x /* coordinate on the 1st axis */, - float* f /* output data values */) -/*< Apply interpolation. >*/ -{ - int k, b2, i; - float *f1; - - if (j-pnt->order+2 < 0) { - b2 = 0; - } else if (j+pnt->order-1 > pnt->n2-1) { - b2 = pnt->n2 - pnt->ng; - } else { - b2 = j-pnt->order+2; - } - - j -= b2; - - for (k = 0; k < pnt->ng; k++) { - grid1_interpolate(pnt->grid[b2+k],x,pnt->nf,pnt->f[k]); - } - - for (i = 0; i < pnt->nf; i++) { - for (k = 0; k < pnt->ng; k++) { - pnt->f0[k] = pnt->f[k][i]; - } - - sf_eno_set (pnt->jnt,pnt->f0); - sf_eno_apply (pnt->jnt,j,y,f+i,f1,FUNC); - } -} - -/* $Id: eno2.c 2086 2006-07-27 23:13:17Z sfomel $ */ diff --git a/user/nobody/envcorr.c b/user/nobody/envcorr.c deleted file mode 100644 index d55ef64871..0000000000 --- a/user/nobody/envcorr.c +++ /dev/null @@ -1,129 +0,0 @@ -/* Correlation with the envelope. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "envcorr.h" -#include "hilbert.h" -#include "divn.h" - -static float **hlb, *den, *num, *rat2; -static int n1, ntr, nd; - -void envcorr_init(int dim /* dimensionality */, - int *m /* data dimensions [dim] */, - int *rect /* smoothing radius [dim] */, - int niter /* number of iterations */) -/*< initialize >*/ -{ - int i; - const int order=6; - const float c=1.; - - n1 = m[0]; - nd = 1; - for (i=0; i < dim; i++) { - nd *= m[i]; - } - ntr = nd/n1; - - hlb = sf_floatalloc2(n1,ntr); - den = sf_floatalloc(nd); - num = sf_floatalloc(nd); - rat2 = sf_floatalloc(nd); - - hilbert_init(n1, order, c); - divn_init(dim, nd, m, rect, niter); -} - -void envcorr_close(void) -/*< free allocated storage >*/ -{ - free(*hlb); - free(hlb); - free(num); - free(den); - free(rat2); - hilbert_free(); - divn_close(); -} - -void envcorr(float** inp /* input data [ntr][n1] */, float* rat1) -/*< compute correlation >*/ -{ - float doth, dout, *data, *hilb; - int i1, i2, i; - - doth = 0.; - dout = 0.; - for (i2=0; i2 < ntr; i2++) { - data = inp[i2]; - hilb = hlb[i2]; - - hilbert(data,hilb); - - for (i1=0; i1 < n1; i1++) { - hilb[i1] = hypotf(data[i1],hilb[i1]); - dout += data[i1]*data[i1]; - doth += hilb[i1]*hilb[i1]; - } - } - doth = sqrtf(nd/doth); - dout = sqrtf(nd/dout); - - for (i2=0; i2 < ntr; i2++) { - data = inp[i2]; - hilb = hlb[i2]; - - for (i1=0; i1 < n1; i1++) { - i = i2*n1 + i1; - den[i] = data[i1]*dout; - num[i] = hilb[i1]*dout; - } - } - - divn(num,den,rat1); - - for (i2=0; i2 < ntr; i2++) { - for (i1=0; i1 < n1; i1++) { - i = i2*n1 + i1; - num[i] = inp[0][i1]*doth; - den[i] = hlb[0][i1]*doth; - } - } - - divn(num,den,rat2); - - for (i=0; i < nd; i++) { - if (rat1[i] > 0.) { - if (rat2[i] > 0. || -rat2[i] < rat1[i]) { - rat1[i] = sqrtf(fabsf(rat1[i]*rat2[i])); - } else { - rat1[i] = -sqrtf(fabsf(rat1[i]*rat2[i])); - } - } else { - if (rat2[i] < 0. || rat2[i] < -rat1[i]) { - rat1[i] = -sqrtf(fabsf(rat1[i]*rat2[i])); - } else { - rat1[i] = sqrtf(fabsf(rat1[i]*rat2[i])); - } - } - } -} - -/* $Id: envcorr.c 744 2004-08-17 18:46:07Z fomels $ */ diff --git a/user/nobody/fdm.py b/user/nobody/fdm.py deleted file mode 100644 index 967d491a17..0000000000 --- a/user/nobody/fdm.py +++ /dev/null @@ -1,99 +0,0 @@ -from rsf.proj import * - -# ------------------------------------------------------------ -def igrey(args,par): - return ''' - grey labelrot=n %s - label1="z" label2="x" title=" " - min2=%g max2=%g min1=%g max1=%g - ''' % (args,par['xmin'],par['xmax'],par['zmin'],par['zmax']) -def pgraph(args,par): - return ''' - graph %s - yreverse=y symbolsz=16 wantaxis=n title=" " - min1=%g max1=%g min2=%g max2=%g - ''' % (args,par['xmin'],par['xmax'],par['zmin'],par['zmax']) -def dgrey(args,par): - return ''' - grey labelrot=n %s - label1="t" label2="x" title=" " - min2=%g max2=%g - ''' % (args,par['xmin'],par['xmax']) - -# ------------------------------------------------------------ - -def velo(velo,par): - Plot(velo,velo,igrey('pclip=100 bias=900 allpos=y',par)) - -def coor(s_i,ss,rr,par): - r_o = par['r_o'] - r_d = par['r_d'] - r_n = par['r_n'] - - s_o = par['s_o'] - s_d = par['s_d'] - s_n = par['s_n'] - s_x = s_o + s_i * s_d - - _zs = '_zs' + str(s_i) - _xs = '_xs' + str(s_i) - _rs = '_rs' + str(s_i) - Flow(_zs,None,'math n1=1 d1=0 o1=0 output=0') - Flow(_xs,None,'math n1=1 d1=0 o1=0 output=%s' % s_x) - Flow(_rs,None,'math n1=1 d1=0 o1=0 output=1') - Flow(ss,[_xs,_zs,_rs], - ''' - cat axis=2 space=n ${SOURCES[0]} ${SOURCES[1]} ${SOURCES[2]} | - transp - ''', stdin=0) - - _zr = '_zr' + str(s_i) - _xr = '_xr' + str(s_i) - Flow(_zr,None,'math n1=%d d1=%g o1=%g output="00"' % (r_n,r_d,s_x) ) - Flow(_xr,None,'math n1=%d d1=%g o1=%g output="x1"' % (r_n,r_d,s_x) ) - Flow(rr,[_xr,_zr] , - ''' - cat axis=2 space=n ${SOURCES[0]} ${SOURCES[1]} | - transp - ''', stdin=0) - - Plot(ss,ss,'window n1=2 | dd type=complex | window | ' + pgraph('symbol=* plotcol=2',par)) - Plot(rr,rr,'window n1=2 | dd type=complex | window | ' + pgraph('symbol=. plotcol=1 symbolsz=.01',par)) - -def shot(s_i,data,wfld,wave,velo,ss,rr,par): - - s_o = par['s_o'] - s_d = par['s_d'] - s_n = par['s_n'] - s_x = s_o + s_i * s_d - - par['s_x']=s_x - - _dd = '_dd' + str(s_i) - Flow([_dd,wfld],[wave,velo,ss,rr], - ''' - afdm2d - verb=%(verb)s - abc=%(abc)s - free=%(free)s - snap=%(snap)s jsnap=%(jsnap)d - nbz=%(nbz)d tz=%(tz)g - nbx=%(nbx)d tx=%(tx)g - vel=${SOURCES[1]} - sou=${SOURCES[2]} - rec=${SOURCES[3]} - wfl=${TARGETS[1]} - ''' % par) - - Flow(data,_dd, - ''' - window min2=%(ft)g | - pad n2out=%(nt)d | - put o1=0 | - transp | - mutter half=n t0=%(ft)g v0=1500 | - put o3=%(s_x)g d3=%(s_d)g - ''' % par ) - - Plot(data,data,'put o2=%s | ' % s_x + dgrey('pclip=100',par)) - diff --git a/user/nobody/fft.py b/user/nobody/fft.py deleted file mode 100755 index f2c00bc9a2..0000000000 --- a/user/nobody/fft.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python - -import os,commands, re - -retime = re.compile('(\w+)\s([\d\.]+)m([\d\.]+)s') -out = open('fft.rsf','w') - -for size in xrange(8813,50001): - spike = 'spike%d.rsf' % size - fft = 'fft%d.rsf' % size - os.system('sfspike n1=%d n2=1000 | sfrtoc > %s' % (size,spike)) - times = commands.getoutput('time sffft3 axis=1 pad=1 < %s > %s' % - (spike,fft)) - total = 0.0 - for time in times.split('\n'): - got = retime.match(time) - if got and (got.group(1)=='user' or got.group(1)=='sys'): - total += 60*float(got.group(2))+float(got.group(3)) - print 'time[%d]=%g' % (size,total) - out.write('%g\n' % total) - os.system('sfrm %s %s' % (spike,fft)) - -out.write('n1=%d o1=1 d1=1\n' % size) -out.write('in=fft.rsf\n') -out.write('data_format=ascii_float\n') -out.close() - -## < fft.rsf sfdd form=native > fft2.rsf -## < fft2.rsf sfmath output="0.00001*x1*log(x1)-input" | sfmask min=0 > mask.rsf -## < fft2.rsf sftransp | sfheaderwindow mask=mask.rsf > y.rsf -## < fft2.rsf sftransp | sfmath output=x2 | sfheaderwindow mask=mask.rsf > x.rsf -## sfcmplx x.rsf y.rsf | sfdd form=ascii line=1 format=" {%g,%g}," > dat.rsf -## cp /var/scratch/dat.rsf@ fft.dat -## cp ~/fft.dat filt/lib/_fftsize.h - diff --git a/user/nobody/fft1.c b/user/nobody/fft1.c deleted file mode 100644 index ea62c334d6..0000000000 --- a/user/nobody/fft1.c +++ /dev/null @@ -1,221 +0,0 @@ -/* 1-D FFT encapsulated */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -/*^*/ - -#include "fft1.h" - -static kiss_fft_cfg forw1, invs1; /* FFT on axis 1 */ -static kiss_fft_cfg forw2, invs2; /* FFT on axis 2 */ -static int n1,n2; -static int axis; -static float fftscale; -static kiss_fft_cpx *ctrace; -static sf_complex *shf1,*shf2; - -void fft1_init(int n1_, int n2_, int axis_) -/*< initialize >*/ -{ - n1 = n1_; - n2 = n2_; - axis = axis_; - - if(axis==1) { - forw1 = kiss_fft_alloc(n1,0,NULL,NULL); - invs1 = kiss_fft_alloc(n1,1,NULL,NULL); - - if (NULL == forw1 || NULL == invs1) - sf_error("%s: KISS FFT allocation error (axis 1)",__FILE__); - - fftscale = 1./n1; - } else { - ctrace = (kiss_fft_cpx*) sf_complexalloc(n2); - - forw2 = kiss_fft_alloc(n2,0,NULL,NULL); - invs2 = kiss_fft_alloc(n2,1,NULL,NULL); - - if (NULL == forw2 || NULL == invs2) - sf_error("%s: KISS FFT allocation error (axis 2)",__FILE__); - - fftscale = 1./n2; - } -} - -void fft1_close(void) -/*< Free allocated storage >*/ -{ - if(axis==1) { - free (forw1); - free (invs1); - } else { - free (forw2); - free (invs2); - free (ctrace); - } -} - -void fft1a1(bool inv, - kiss_fft_cpx **pp /* [1...n2][1...n1] */) -/*< Apply 1-D FFT on axis 1 >*/ -{ - int i1,i2; - - if (inv) { - for (i2=0; i2 < n2; i2++) { - kiss_fft(invs1,pp[i2],pp[i2]); - } - for (i1=0; i1 < n1; i1++) { - for (i2=0; i2*/ -{ - int i1,i2; - - if (inv) { - for (i1=0; i1 < n1; i1++) { - kiss_fft_stride(invs2,pp[0]+i1,ctrace,n1); - for (i2=0; i2*/ -{ - int i1,i2; - float t; - - if(axis==1) { - shf1 = sf_complexalloc(n1); - for( i1=0; i1*/ -{ - if(axis==1) { - free(shf1); - } else { - free(shf2); - } -} - -void sft1a1(sf_complex **pp) -/*< apply shift >*/ -{ - int i1,i2; - - for(i2=0; i2*/ -{ - int i1,i2; - - for(i2=0; i2*/ -{ - int i1,i2; - - for(i2=0; i2*/ -{ - int i1,i2; - - for(i2=1; i2 -/*^*/ - -#include "fft2.h" - -static kiss_fft_cfg forw1, invs1; /* FFT on axis 1 */ -static kiss_fft_cfg forw2, invs2; /* FFT on axis 2 */ -static int n1,n2; -static float fftscale; -static kiss_fft_cpx *trace2; -static sf_complex *shf1,*shf2; - -/*------------------------------------------------------------*/ -void fft2_init(int n1_, int n2_) -/*< initialize >*/ -{ - n1 = n1_; - n2 = n2_; - - forw1 = kiss_fft_alloc(n1,0,NULL,NULL); - invs1 = kiss_fft_alloc(n1,1,NULL,NULL); - - forw2 = kiss_fft_alloc(n2,0,NULL,NULL); - invs2 = kiss_fft_alloc(n2,1,NULL,NULL); - - trace2 = (kiss_fft_cpx*) sf_complexalloc(n2); - - if (NULL == forw2 || NULL == invs2 || - NULL == forw1 || NULL == invs1) - sf_error("%s: KISS FFT allocation error",__FILE__); - - fftscale = 1./sqrtf(n1*n2); -} - -/*------------------------------------------------------------*/ -void fft2_close(void) -/*< Free allocated storage >*/ -{ - free (trace2); - - free (forw1); - free (invs1); - free (forw2); - free (invs2); -} - -/*------------------------------------------------------------*/ -void fft2(bool inv /* inverse/forward flag */, - kiss_fft_cpx **pp /* [1...n2][1...n1] */) -/*< Apply 2-D FFT >*/ -{ - int i1,i2; - - if (inv) { - - /* IFT 1 */ - for(i2=0; i2 < n2; i2++) { - kiss_fft(invs1,pp[i2],pp[i2]); - } - - /* IFT 2 */ - for(i1=0; i1 < n1; i1++) { - kiss_fft_stride(invs2,pp[0]+i1,trace2,n1); - for(i2=0; i2*/ -{ - int i1,i2; - int k1,k2; - float w1,w2; - float shift; - - w1=2.0*SF_PI/(n1*d1) * o1; - w2=2.0*SF_PI/(n2*d2) * o2; - - k1=n1/2; - k2=n2/2; - - shf1 = sf_complexalloc(n1); - for(i1=0; i1*/ -{ - free(shf1); - free(shf2); -} - -/*------------------------------------------------------------*/ -void sft2(sf_complex **pp) -/*< apply shift >*/ -{ - int i1,i2; - - for (i2=0; i2*/ -{ - int i1,i2; - - for (i2=1; i2 -/*^*/ - -#include "fft3.h" - -static kiss_fft_cfg forw1, invs1; /* FFT on axis 1 */ -static kiss_fft_cfg forw2, invs2; /* FFT on axis 2 */ -static kiss_fft_cfg forw3, invs3; /* FFT on axis 3 */ -static int n1,n2,n3; -static float fftscale; -static kiss_fft_cpx *trace2, *trace3; -static sf_complex *shf1,*shf2,*shf3; - -/*------------------------------------------------------------*/ -void fft3_init(int n1_, int n2_, int n3_) -/*< initialize >*/ -{ - n1 = n1_; - n2 = n2_; - n3 = n3_; - - forw1 = kiss_fft_alloc(n1,0,NULL,NULL); - invs1 = kiss_fft_alloc(n1,1,NULL,NULL); - - forw2 = kiss_fft_alloc(n2,0,NULL,NULL); - invs2 = kiss_fft_alloc(n2,1,NULL,NULL); - - forw3 = kiss_fft_alloc(n3,0,NULL,NULL); - invs3 = kiss_fft_alloc(n3,1,NULL,NULL); - - if (NULL == forw1 || NULL == invs1 || - NULL == forw2 || NULL == invs2 || - NULL == forw3 || NULL == invs3) - sf_error("%s: KISS FFT allocation error",__FILE__); - - trace2 = (kiss_fft_cpx*) sf_complexalloc(n2); - trace3 = (kiss_fft_cpx*) sf_complexalloc(n3); - - fftscale = 1./sqrtf(n1*n2*n3); -} - -/*------------------------------------------------------------*/ -void fft3_close(void) -/*< Free allocated storage >*/ -{ - free (trace2); - free (trace3); - - free (forw1); - free (invs1); - free (forw2); - free (invs2); - free (forw3); - free (invs3); -} - -/*------------------------------------------------------------*/ -void fft3(bool inv /* inverse/forward flag */, - kiss_fft_cpx ***pp /* [n1][n2][n3] */) -/*< Apply 3-D FFT >*/ -{ - int i1, i2, i3; - - if (inv) { - - /* IFT 1 */ - for (i3=0; i3 < n3; i3++) { - for(i2=0; i2 < n2; i2++) { - kiss_fft(invs1,pp[i3][i2],pp[i3][i2]); - } - } - - /* IFT 2 */ - for (i3=0; i3 < n3; i3++) { - for(i1=0; i1 < n1; i1++) { - kiss_fft_stride(invs2,pp[i3][0]+i1,trace2,n1); - for(i2=0; i2 < n2; i2++) { - pp[i3][i2][i1] = trace2[i2]; - } - } - } - - /* IFT 3 */ - for (i2=0; i2 < n2; i2++) { - for(i1=0; i1 < n1; i1++) { - kiss_fft_stride(invs3,pp[0][0]+i1+i2*n1,trace3,n1*n2); - for(i3=0; i3 < n3; i3++) { - pp[i3][i2][i1] = trace3[i3]; - } - } - } - - /* scaling */ - for (i3=0; i3 < n3; i3++) { - for (i2=0; i2 < n2; i2++) { - for(i1=0; i1 < n1; i1++) { - pp[i3][i2][i1] = sf_crmul(pp[i3][i2][i1],fftscale); - } - } - } - - } else { - /* scaling */ - for (i3=0; i3 < n3; i3++) { - for (i2=0; i2 < n2; i2++) { - for(i1=0; i1 < n1; i1++) { - pp[i3][i2][i1] = sf_crmul(pp[i3][i2][i1],fftscale); - } - } - } - - /* FFT 3 */ - for (i2=0; i2 < n2; i2++) { - for(i1=0; i1 < n1; i1++) { - kiss_fft_stride(forw3,pp[0][0]+i1+i2*n1,trace3,n1*n2); - for(i3=0; i3 < n3; i3++) { - pp[i3][i2][i1] = trace3[i3]; - } - } - } - - /* FFT 2 */ - for (i3=0; i3 < n3; i3++) { - for(i1=0; i1 < n1; i1++) { - kiss_fft_stride(forw2,pp[i3][0]+i1,trace2,n1); - for(i2=0; i2 < n2; i2++) { - pp[i3][i2][i1] = trace2[i2]; - } - } - } - - /* FFT 1 */ - for (i3=0; i3 < n3; i3++) { - for(i2=0; i2 < n2; i2++) { - kiss_fft(forw1,pp[i3][i2],pp[i3][i2]); - } - } - - } -} - -/*------------------------------------------------------------*/ -void sft3_init(float o1, float d1, - float o2, float d2, - float o3, float d3) -/*< origin shift (assumes no centering) >*/ -{ - int i1,i2,i3; - int k1,k2,k3; - float w1,w2,w3; - float shift; - - w1=2.0*SF_PI/(n1*d1) * o1; - w2=2.0*SF_PI/(n2*d2) * o2; - w3=2.0*SF_PI/(n3*d3) * o3; - - k1=n1/2; - k2=n2/2; - k3=n3/2; - - shf1 = sf_complexalloc(n1); - for(i1=0; i1*/ -{ - free(shf1); - free(shf2); - free(shf3); -} - -/*------------------------------------------------------------*/ -void sft3(sf_complex ***pp) -/*< apply shift >*/ -{ - int i1,i2,i3; - - for (i3=0; i3 - -#include "fftsize.h" -#include "_fftsize.h" - -static int opt_size(int min, int tabsize, const sf_Table *table) -{ - int n, size; - - for (n=0; n < tabsize; n++) { - size = table[n].size; - if (size >= min) { - min=size; - break; - } - } - return min; -} - -int sf_fftr_size(int min) -/*< Find optimal size for real FFT greater or equal min >*/ -{ - min = opt_size(min,SF_FFTR_SIZE,SF_FFTR); - if (min%2) min++; /* make it even */ - return min; -} - - -int sf_fft_size(int min) -/*< Find optimal size for complex FFT greater or equal min >*/ -{ - min = opt_size(min,SF_FFT_SIZE,SF_FFT); - return min; -} - -static int opt_size2(int min, int max, int tabsize, const sf_Table *table) -{ - int n, size, nmin, nmax; - float cost, mincost; - - size=min; - - nmin=-1; - for (n=0; n < tabsize; n++) { - size = table[n].size; - if (size >= min) { - nmin = n; - break; - } - } - if (nmin < 0) return min; - - nmax=0; - for (n=tabsize-1; n >= 0; n--) { - size = table[n].size; - if (size <= max) { - nmax = n; - break; - } - } - - mincost = FLT_MAX; - for (n=nmin; n <= nmax; n++) { - cost = table[n].cost; - if (cost < mincost) { - mincost = cost; - size=table[n].size; - } - } - - return size; -} - -int sf_fftr_size2(int min, int max) -/*< Find optimal size for real FFT between min and max >*/ -{ - min = opt_size2(min,max,SF_FFTR_SIZE,SF_FFTR); - if (min%2) min++; /* make it even */ - return min; -} - -int sf_fft_size2(int min, int max) -/*< Find optimal size for complex FFT between min and max >*/ -{ - min = opt_size2(min,max,SF_FFT_SIZE,SF_FFT); - return min; -} diff --git a/user/nobody/find_file_leaks.py b/user/nobody/find_file_leaks.py deleted file mode 100755 index 529f68debe..0000000000 --- a/user/nobody/find_file_leaks.py +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/env python -''' -Finds C source code files that call sf_input for a given file, but forget to -call sf_close. Call this program from the upper directory (RSFSRC) with no -arguments, i.e.: - ./admin/find_file_leaks.py > results.asc -It will print a list of affected files, sorted in a few categories. - -To eliminate the file leak, make sure all file pointers are initialized with -NULL, i.e.: - sf_file in=NULL; - -Then call just before exit(): - sf_close(); - -This script checks that each file that has at least one sf_input also has a -sf_close call. It can be fooled by multi-procedure files, or by procedures -specially created to handle input. Flag such files by including them in the -'exceptions' variable in main(). - -Make sure that the list of directories to check for *.c files (variable -dirs_to_check at the beginning of this script) is not out of date. - -This script has grep as a dependency. -''' -# Copyright (C) 2009 Ioan Vlad -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from rsf.user.ivlad import unix_success, unix_error -import os, sys - -if not hasattr(os, 'walk'): - print 'Please get Python 2.3 or greater' - sys.exit(unix_error) - -try: - import subprocess -except: - print 'Please get Python 2.4 or greater, or just the subprocess module' - sys.exit(unix_error) - -############################################################################### - -def grep_from_py(filename, string): - 'Runs "grep string filename", and returns the result' - proc = subprocess.Popen('grep ' + string + ' ' + filename, - shell=True, - stdout=subprocess.PIPE) - stdout_val = proc.communicate()[0] - return stdout_val - -############################################################################### - -def print_list(file_list, what_is_list): - 'Formated display of list of suspect files' - - if file_list != []: - msg = '\n-----------------------\nFound %d ' % len(file_list) - msg += what_is_list + ':\n' - print msg - file_list.sort() - for file in file_list: - print file - -############################################################################### - -def main(): - - dirs_to_check = 'api pens plot su system user' - - exceptions = ''' - api/matlab/rsf_write.c - system/main/attr.c - system/main/in.c - system/main/mpi.c - system/main/omp.c - user/trip/wavefun.c - ''' - - exceptions_list = exceptions.split() - - primary_suspects = [] # Main progs with sf_input, but no sf_fileclose - secondary_suspects = [] # other files with sf_input, but no sf_fileclose - - for d in dirs_to_check.split(): - for root,dirs,files in os.walk(d): - # Avoid Subversion bookkeeping directories - if '.svn' not in root: - for file in files: - (shortname, extension) = os.path.splitext(file) - if extension == '.c': - c_file = os.path.join(root, file) - if c_file not in exceptions_list: - grep_4_sf_input = grep_from_py(c_file, 'sf_input') - if grep_4_sf_input != '': # file_c has sf_input - grep_4_sf_close = \ - grep_from_py(c_file, 'sf_close') - if grep_4_sf_close == '': # no sf_fileclose - if shortname[0] == 'M' or 'system/main/' in c_file: - primary_suspects.append(c_file) - else: - secondary_suspects.append(c_file) - - print_list(primary_suspects, - 'main program C files containing sf_input, but not sf_fileclose') - - print_list(secondary_suspects, - 'other C files containing sf_input, but not sf_fileclose') - - return unix_success - -############################################################################### - -if __name__ == '__main__': - sys.exit(main()) # Exit with the success or error code returned by main diff --git a/user/nobody/foldplot.c b/user/nobody/foldplot.c deleted file mode 100644 index a15c074002..0000000000 --- a/user/nobody/foldplot.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - build a fold map - Program change history: - date Who What - 12/10/2011 Karl Schleicher Original program -*/ - -#include -#include - -#include "/home/yihua/RSFSRC/build/system/seismic/segy.h" -#include "/home/yihua/RSFSRC/build/system/seismic/segy.c" - -int main(int argc, char* argv[]) -{ - int verbose; - float o1,o2,o3; - int n1,n2,n3; - float d1,d2,d3; - char* label1; - char* label2; - char* label3; - - int n1_input; - int n_input; - float* hdrin; - int idx_offset,idx_xline,idx_iline; - int i_input; - float*** foldplot; - - sf_file in=NULL, out=NULL; - - sf_init (argc,argv); - in = sf_input ("in"); - out = sf_output ("out"); - - sf_putint(out,"input",2); - - /* verbose flag controls ammount of print */ - /*( verbose=1 0 terse, 1 informative, 2 chatty, 3 debug ) */ - if(!sf_getint("verbose",&verbose))verbose=1; - - /* Axis1, 2 and 3 define the bins for the output fold map. These - are usually (offset,xline,offset), but you might want to compute some - other histogram. This can be done by selecting other segy headers - using label1, 2 and 3. - */ - - /* get o1, n1, d1, label1 for axis1. Do the same for axis2 and 3. */ - - /*( o1=-32.5 required parameter. Minimum label1 - usually min offset ) */ - if(!sf_getfloat("o1",&o1))sf_error("o1 is a required parameter"); - /*( o2=32 required parameter. Minimum label2 - usually min xline ) */ - if(!sf_getfloat("o2",&o2))sf_error("o2 is a required parameter"); - /*( o3=32 required parameter. Minimum label3 - usually min iline ) */ - if(!sf_getfloat("o3",&o3))sf_error("o3 is a required parameter"); - - /*( n1=96 required parameter. Number label1 - usually number offset ) */ - if(!sf_getint("n1",&n1))sf_error("n1 is a required parameter"); - /*( n1=623 required parameter. Number label2 - usually number xline ) */ - if(!sf_getint("n2",&n2))sf_error("n2 is a required parameter"); - /*( n1=623 required parameter. Number label3 - usually number iline ) */ - if(!sf_getint("n3",&n3))sf_error("n3 is a required parameter"); - - /*( d1=110 required parameter. delta label1 - usually delta offset ) */ - if(!sf_getfloat("d1",&d1))sf_error("d1 is a required parameter"); - /*( d2=1 required parameter. delta label2 - usually delta xline ) */ - if(!sf_getfloat("d2",&d2))sf_error("d2 is a required parameter"); - /*( d3=1 required parameter. delta label3 - usually delta iline ) */ - if(!sf_getfloat("d3",&d3))sf_error("d3 is a required parameter"); - - /*( label1=offset header for axis1 - usually offset ) */ - if(NULL == (label1 = sf_getstring("label1")))label1="offset"; - /*( label2=xline header for axis2 - usually xline or cdp ) */ - if(NULL == (label2 = sf_getstring("label2")))label2="cdp"; - /*( label3=iline header for axis3 - usually iline ) */ - if(NULL == (label3 = sf_getstring("label3")))label3="iline"; - - if (SF_FLOAT != sf_gettype (in)) sf_error("Need float input"); - - /* Find out the length of headers (vectors) in the input file and the - number of locations to loop over - */ - - if (!sf_histint(in,"n1",&n1_input)) - sf_error("input file does not define n1"); - - n_input = sf_leftsize(in,1); /* left dimensions after the first two */ - - /* allocate space for the one location from the input file */ - hdrin = sf_floatalloc(n1_input); - - /* The output file will have new shape. The axis have new lengths and - names. Write this information to the output history file. - */ - if(verbose >=1)fprintf(stderr,"write axis information to output history\n"); - sf_putfloat(out,"o1",o1); - sf_putfloat(out,"o2",o2); - sf_putfloat(out,"o3",o3); - - sf_putint(out,"n1",n1); - sf_putint(out,"n2",n2); - sf_putint(out,"n3",n3); - - sf_putfloat(out,"d1",d1); - sf_putfloat(out,"d2",d2); - sf_putfloat(out,"d3",d3); - - sf_putstring(out,"label1",label1); - sf_putstring(out,"label2",label2); - sf_putstring(out,"label3",label3); - - /* get the location of the three labels in the header */ - idx_offset=segykey (label1); - idx_xline =segykey (label2); - idx_iline =segykey (label3); - - /* allocate the output data. This is one big array in memory */ - foldplot=sf_floatalloc3(n1,n2,n3); - - /* loop over the input locations. Read a trace header and increment - the fold in each bin. This is a 3d histogram. - */ - - if(verbose >=1)fprintf(stderr,"loop processing input trace headers\n"); - for (i_input=0 ; i_input2){ - fprintf(stderr,"offset=%f,xline=%f,iline=%f\n", - hdrin[idx_offset], - hdrin[idx_xline ], - hdrin[idx_iline ]); - fprintf(stderr,"ioffset=%d,ixline=%d,iiline=%d\n", - ioffset ,ixline ,iiline); - } - if(ioffset>=0 && ioffset< n1 && - ixline >=0 && ixline < n2 && - iiline >=0 && iiline < n3 ){ - if(verbose>2) - fprintf(stderr,"increment fold at %d,%d,%d\n", - iiline,ixline,ioffset); - foldplot[iiline][ixline][ioffset]++; - } - } - if(verbose >=1)fprintf(stderr,"write foldplot to output\n"); - /* write the output in one big write */ - sf_floatwrite(&(foldplot[0][0][0]),n1*n2*n3,out); - - exit(0); -} diff --git a/user/nobody/freqintpef.c b/user/nobody/freqintpef.c deleted file mode 100644 index 1774882d0b..0000000000 --- a/user/nobody/freqintpef.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Freqlet frame plus interpolation with PEF frequencies */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "freqintpef.h" -#include "freqlets.h" - -static int nt; -static sf_complex *t; - -void freqint_init (int nd /* irregular data size */, - float *coord /* [nd] irregular coordinates */, - int n /* regular data size */, - float d /* sampling */, - float o /* origin */, - sf_interpolator interp /* interpolation function */, - int nf /* interpolator length */, - bool inv, bool unit, char type, - int nw /* number of frequencies */, - float *w /* [nw] frequencies */, - sf_complex *z1 /* [nw] Z factors */) -/*< allocate space >*/ -{ - nt = n; - t = sf_complexalloc(nt); - - sf_int1_init (coord,o,d,n,interp,nf,nd); - freqlets_init(n,d,inv,unit,type,nw,w,z1); -} - -void freqint_close(void) -/*< deallocate space >*/ -{ - free(t); - freqlets_close(); -} - -void freqint_lop(bool adj, bool add, int nx, int ny, - sf_complex *x, sf_complex *y) -/*< linear operator >*/ -{ - sf_cadjnull(adj,add,nx,ny,x,y); - sf_cchain(sf_cint1_lop,freqlets_lop,adj,true,nx,ny,nt,x,y,t); -} diff --git a/user/nobody/freqlet97.c b/user/nobody/freqlet97.c deleted file mode 100644 index cc97402bed..0000000000 --- a/user/nobody/freqlet97.c +++ /dev/null @@ -1,472 +0,0 @@ -/* Digital freqlet transform */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "freqlet97.h" - -static int nt; -static bool inv; -static sf_complex *t, *z; - -static void biorthogonal(bool adj) -/* Lifting CDF 9/7 biorthogonal wavelet transform in place */ -{ - int i, j; - sf_complex z0; - float a; - - if (adj) { - - for (j=nt/2; j >= 1; j /= 2) { - z0 = z[j]; - if (inv) { /*reverse dwt9/7 transform*/ - a= 1.230174105f; - for (i=2*j; i < nt-j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i] /= a; -#else - t[i] = sf_crmul(t[i],(1/a)); -#endif - } -#ifdef SF_HAS_COMPLEX_H - t[0] /= a; /*left boundary*/ -#else - t[0] = sf_crmul(t[0],(1/a)); -#endif - for (i=0; i < nt-2*j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i+j] *= a; -#else - t[i+j] = sf_crmul(t[i+j],a); -#endif - /* Undo Scale */ - } -#ifdef SF_HAS_COMPLEX_H - if (i+j < nt) t[i+j] *= a; /*right boundary*/ -#else - if (i+j < nt) t[i+j] = sf_crmul(t[i+j],a); -#endif - a= -0.4435068522f; - for (i=2*j; i < nt-j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i] += (t[i+j]/z0+t[i-j]*z0)*a; -#else - t[i] = sf_cadd(t[i], - sf_crmul( - sf_cadd( - sf_cmul(t[i+j],sf_conjf(z0)), - sf_cmul(t[i-j],z0)), - a)); -#endif - /* Undo Update 2 */ - } -#ifdef SF_HAS_COMPLEX_H - t[0] += 2*a*t[j]/z0; /*left boundary*/ -#else - t[0] = sf_cadd(t[0],sf_crmul(sf_crmul(sf_cmul(t[j],sf_conjf(z0)),a),2)); -#endif - a = -0.8829110762f; - for (i=0; i < nt-2*j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i+j] += (t[i]*z0+t[i+2*j]/z0)*a; -#else - t[i+j] = sf_cadd(t[i+j], - sf_crmul( - sf_cadd( - sf_cmul(t[i],z0), - sf_cmul(t[i+2*j],sf_conjf(z0))), - a)); -#endif - /* Undo Predict 2 */ - } -#ifdef SF_HAS_COMPLEX_H - if (i+j < nt) t[i+j] += 2*a*t[i]*z0; /*right boundary*/ -#else - if (i+j < nt) t[i+j] = sf_cadd(t[i+j],sf_crmul(sf_crmul(sf_cmul(t[i],z0),a),2)); -#endif - /* Undo Step 2 */ - - a= 0.05298011854f; - - for (i=2*j; i < nt-j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i] += (t[i+j]/z0+t[i-j]*z0)*a; -#else - t[i] = sf_cadd(t[i], - sf_crmul( - sf_cadd( - sf_cmul(t[i+j],sf_conjf(z0)), - sf_cmul(t[i-j],z0)), - a)); -#endif - /* Undo Update 1 */ - } -#ifdef SF_HAS_COMPLEX_H - t[0] += 2*a*t[j]/z0; /*left boundary*/ -#else - t[0] = sf_cadd(t[0],sf_crmul(sf_crmul(sf_cmul(t[j],sf_conjf(z0)),a),2)); -#endif - - a = 1.586134342f; - for (i=0; i < nt-2*j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i+j] += (t[i]*z0+t[i+2*j]/z0)*a; -#else - t[i+j] = sf_cadd(t[i+j], - sf_crmul( - sf_cadd( - sf_cmul(t[i],z0), - sf_cmul(t[i+2*j],sf_conjf(z0))), - a)); -#endif - /* Undo Predict 1 */ - } -#ifdef SF_HAS_COMPLEX_H - if (i+j < nt) t[i+j] += 2*a*t[i]*z0; /*right boundary*/ -#else - if (i+j < nt) t[i+j] = sf_cadd(t[i+j],sf_crmul(sf_crmul(sf_cmul(t[i],z0),a),2)); -#endif - /* Undo Step 1 */ - - - } else { /*adjoint transform*/ - a= 1.230174105f; - for (i=2*j; i < nt-j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i] *= a; -#else - t[i] = sf_crmul(t[i],a); -#endif - } -#ifdef SF_HAS_COMPLEX_H - t[0] *= a; /*left boundary*/ -#else - t[0] = sf_crmul(t[0],a); -#endif - for (i=0; i < nt-2*j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i+j] /= a; -#else - t[i+j] = sf_crmul(t[i+j],(1/a)); -#endif - /* Undo Scale */ - } -#ifdef SF_HAS_COMPLEX_H - if (i+j < nt) t[i+j] /= a; /*right boundary*/ -#else - if (i+j < nt) t[i+j] = sf_crmul(t[i+j],(1/a)); -#endif - a= -0.4435068522f; - for (i=2*j; i < nt-j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i+j] -= t[i]*z0*a; - t[i-j] -= t[i]/z0*a; -#else - t[i+j] = sf_cadd(t[i+j], - sf_crmul(sf_cmul(t[i],z0),(-a))); - t[i-j] = sf_cadd(t[i-j], - sf_crmul(sf_cmul(t[i],sf_conjf(z0)),(-a))); -#endif - /* Undo Update 2 */ - } -#ifdef SF_HAS_COMPLEX_H - t[j] -= 2*a*t[0]*z0; /*left boundary*/ -#else - t[j] = sf_cadd(t[j],sf_crmul(sf_crmul(sf_cmul(t[0],z0),a),-2)); -#endif - a = -0.8829110762f; - for (i=0; i < nt-2*j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i] -= (t[i+j]/z0)*a; - t[i+2*j] -= (t[i+j]*z0)*a; -#else - t[i] = sf_cadd(t[i],sf_crmul(sf_cmul(t[i+j],sf_conjf(z0)),(-a))); - t[i+2*j] = sf_cadd(t[i+2*j],sf_crmul(sf_cmul(t[i+j],z0),(-a))); -#endif - /* Undo Predict 2 */ - } -#ifdef SF_HAS_COMPLEX_H - if (i+j < nt) t[i] -= 2*a*t[i+j]/z0; /*right boundary*/ -#else - if (i+j < nt) t[i] = sf_cadd(t[i],sf_crmul(sf_crmul(sf_cmul(t[i],sf_conjf(z0)),a),-2)); -#endif - /* Undo Step 2 */ - - a= 0.05298011854f; - for (i=2*j; i < nt-j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i+j] -= t[i]*z0*a; - t[i-j] -= t[i]/z0*a; -#else - t[i+j] = sf_cadd(t[i+j], - sf_crmul(sf_cmul(t[i],z0),(-a))); - t[i-j] = sf_cadd(t[i-j], - sf_crmul(sf_cmul(t[i],sf_conjf(z0)),(-a))); -#endif /* Undo Update 1 */ - } -#ifdef SF_HAS_COMPLEX_H - t[j] -= 2*a*t[0]*z0; /*left boundary*/ -#else - t[j] = sf_cadd(t[j],sf_crmul(sf_crmul(sf_cmul(t[0],z0),a),-2)); -#endif - a = 1.586134342f; - for (i=0; i < nt-2*j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i] -= (t[i+j]/z0)*a; - t[i+2*j] -= (t[i+j]*z0)*a; -#else - t[i] = sf_cadd(t[i],sf_crmul(sf_cmul(t[i+j],sf_conjf(z0)),(-a))); - t[i+2*j] = sf_cadd(t[i+2*j],sf_crmul(sf_cmul(t[i+j],z0),(-a))); -#endif - /* Undo Predict 1 */ - } -#ifdef SF_HAS_COMPLEX_H - if (i+j < nt) t[i] -= 2*a*t[i+j]/z0; /*right boundary*/ -#else - if (i+j < nt) t[i] = sf_cadd(t[i],sf_crmul(sf_crmul(sf_cmul(t[i],sf_conjf(z0)),a),-2)); -#endif /* Undo Step 1 */ - } - } - } else { - for (j=1; j <= nt/2; j *= 2) { /*different scale*/ - z0=z[j]; - a = -1.586134342f; - for (i=0; i < nt-2*j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i+j] += (t[i]*z0+t[i+2*j]/z0)*a; -#else - t[i+j] = sf_cadd(t[i+j], - sf_crmul( - sf_cadd( - sf_cmul(t[i],z0), - sf_cmul(t[i+2*j],sf_conjf(z0))), - a)); -#endif -// a = -1.586134342f; -// for (i=0; i < nt-2*j; i += 2*j) { -// t[i+j] += (t[i]+t[i+2*j])*a; - /* Predict 1 */ - } - -#ifdef SF_HAS_COMPLEX_H - if (i+j < nt) t[i+j] += 2*a*t[i]*z0; /*right boundary*/ -#else - if (i+j < nt) t[i+j] = sf_cadd(t[i+j],sf_crmul(sf_crmul(sf_cmul(t[i],z0),a),2)); -#endif -// if (i+j < nt) t[i+j] += 2*a*t[i]; /*right boundary*/ - - a= -0.05298011854f; -#ifdef SF_HAS_COMPLEX_H - t[0] += 2*a*t[j]/z0; /*left boundary*/ -#else - t[0] = sf_cadd(t[0],sf_crmul(sf_crmul(sf_cmul(t[j],sf_conjf(z0)),a),2)); -#endif -// t[0] += 2*a*t[j]; /*left boundary*/ - for (i=2*j; i < nt-j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i] += (t[i+j]/z0+t[i-j]*z0)*a; -#else - t[i] = sf_cadd(t[i], - sf_crmul( - sf_cadd( - sf_cmul(t[i+j],sf_conjf(z0)), - sf_cmul(t[i-j],z0)), - a)); -#endif -// t[i] += (t[i+j]+t[i-j])*a; - /* Update 1 */ - } - /* Step 1 */ - - a = 0.8829110762f; - for (i=0; i < nt-2*j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i+j] += (t[i]*z0+t[i+2*j]/z0)*a; -#else - t[i+j] = sf_cadd(t[i+j], - sf_crmul( - sf_cadd( - sf_cmul(t[i],z0), - sf_cmul(t[i+2*j],sf_conjf(z0))), - a)); -#endif -// t[i+j] += (t[i]+t[i+2*j])*a; - /* Predict 2 */ - } -#ifdef SF_HAS_COMPLEX_H - if (i+j < nt) t[i+j] += 2*a*t[i]*z0; /*right boundary*/ -#else - if (i+j < nt) t[i+j] = sf_cadd(t[i+j],sf_crmul(sf_crmul(sf_cmul(t[i],z0),a),2)); -#endif -// if (i+j < nt) t[i+j] += 2*a*t[i]; /*right boundary*/ - - a= 0.4435068522f; -#ifdef SF_HAS_COMPLEX_H - t[0] += 2*a*t[j]/z0; /*left boundary*/ -#else - t[0] = sf_cadd(t[0],sf_crmul(sf_crmul(sf_cmul(t[j],sf_conjf(z0)),a),2)); -#endif -// t[0] += 2*a*t[j]; /*left boundary*/ - for (i=2*j; i < nt-j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i] += (t[i+j]/z0+t[i-j]*z0)*a; -#else - t[i] = sf_cadd(t[i], - sf_crmul( - sf_cadd( - sf_cmul(t[i+j],sf_conjf(z0)), - sf_cmul(t[i-j],z0)), - a)); -#endif -// t[i] += (t[i+j]+t[i-j])*a; - /* Update 2 */ - } - /* Step 2 */ - - a= 1/(1.230174105f); - for (i=0; i < nt-2*j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i+j] *= a; -#else - t[i+j] = sf_crmul(t[i+j],a); -#endif -// t[i+j] *= a; - } -#ifdef SF_HAS_COMPLEX_H - if (i+j < nt) t[i+j] *= a; /*right boundary*/ -#else - if (i+j < nt) t[i+j] = sf_crmul(t[i+j],a); -#endif -// if (i+j < nt) t[i+j] *= a; /*right boundary*/ -#ifdef SF_HAS_COMPLEX_H - t[0] /= a; /*left boundary*/ -#else - t[0] = sf_crmul(t[0],(1/a)); -#endif -// t[0] /= a; /*left boundary*/ - for (i=2*j; i < nt-j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - t[i] /= a; -#else - t[i] = sf_crmul(t[i],(1/a)); -#endif -// t[i] /= a; - /* Scale */ - } - } - } -} - -void freqlet97_init(int n /* data size */, bool inv1) -/*< allocate space >*/ -{ - int j; - inv = inv1; - - for (nt=1; nt < n; nt *= 2) ; - t = sf_complexalloc(nt); - z = sf_complexalloc(nt); - - for (j=1; j <= nt/2; j *= 2) { - z[j] = sf_cmplx(1.,0.); - } -} - -void freqlet97_set(float w0) -/*< set frequency >*/ -{ - int j; - - for (j=1; j <= nt/2; j *= 2) { - z[j] = sf_cmplx(cosf(w0*j),sinf(w0*j)); - } -} - -void freqlet97_close(void) -/*< deallocate space >*/ -{ - free (t); - free (z); -} - -void freqlet97_lop(bool adj, bool add, int nx, int ny, - sf_complex *x, sf_complex *y) -/*< linear operator >*/ -{ - int it, i, j; - - sf_cadjnull (adj,add,nx,ny,x,y); - - if (adj) { - t[0] = y[0]; - it = 1; - for (j=nt/2; j >= 1; j /= 2) { - for (i=0; i < nt-j; i += 2*j) { - if (it < ny) { - t[i+j]=y[it]; - it++; - } else { - t[i+j]=sf_cmplx(0.,0.); - } - } - } - - } else { - for (it=0; it < nx; it++) { - t[it]=x[it]; - } - for (it=nx; it < nt; it++) { - t[it] = sf_cmplx(0.,0.); - } - } - - biorthogonal(adj); - - if (adj) { - for (it=0; it < nx; it++) { -#ifdef SF_HAS_COMPLEX_H - x[it] += t[it]; -#else - x[it] = sf_cadd(x[it],t[it]); -#endif - } - } else { - -#ifdef SF_HAS_COMPLEX_H - y[0] += t[0]; -#else - y[0] = sf_cadd(y[0],t[0]); -#endif - it = 1; - for (j=nt/2; j >= 1; j /= 2) { - for (i=0; i < nt-j; i += 2*j) { -#ifdef SF_HAS_COMPLEX_H - y[it] += t[i+j]; -#else - y[it] = sf_cadd(y[it],t[i+j]); -#endif - it++; - if (it >= ny) return; - } - } - } -} - - - diff --git a/user/nobody/gazdagz.c b/user/nobody/gazdagz.c deleted file mode 100644 index 22b3356b37..0000000000 --- a/user/nobody/gazdagz.c +++ /dev/null @@ -1,151 +0,0 @@ -#include - -#include - -#include "gazdagz.h" - -static float eps, dt, dz, *vt, dw, fw; -static int nt, nz, nw; -static float complex *pp; -static bool depth, midpoint; - -void gazdagz_init (float eps1, int nt1, float dt1, - int nz1, float dz1, float *vt1, bool depth1, bool midpoint) -{ - eps = eps1; - nt = nt1; dt = dt1; - nz = nz1; dz = dz1; - vt = vt1; - depth = depth1; - - /* determine frequency sampling */ - nw = sf_npfa(nt); - dw = 2.0*SF_PI/(nw*dt); - fw = -SF_PI/dt; - - /* allocate workspace */ - pp = sf_complexalloc (nw); -} - -void gazdagz_close () -{ - /* free workspace */ - free (pp); -} - -void gazdagz (bool inv, float k2, float complex *p, float complex *q) -{ - int it,iz,iw; - float complex cshift1, cshift2, cshift, w2, y; - float x; - - if (inv) { /* modeling */ - for (iw=0; iw=0; iz--) { - /* loop over frequencies w */ - for (iw=0; iw -#include - -#include "hdtrace.h" -#include "symplectrace.h" - -#ifdef _it_does_not_compile - -include "grad2fill.h" - -#ifndef _hdtrace_h - -#define NS 4 -/*^*/ - -#endif - -static int nx, nz, np, npx; -static float dx, dz, dp, x0, z0, p0, xm, zm, pm; -static sf_eno2 cvel, fslc[NS]; -static float **slice; -static bool *known; -static pqv hvec; - -static const float eps = 1.e-5; -static void psnap (float* p, float* q, int* iq); - - -void hdtrace_init (int order /* interpolation order for velocity */, - int iorder /* interpolation order for values */, - int nx1 /* lateral samples */, - int nz1 /* depth samples */, - int np1 /* horizontal slowness samples */, - float dx1 /* lateral sampling */, - float dz1 /* depth sampling */, - float dp1 /* horizontal slowness sampling */, - float x01 /* lateral origin */, - float z01 /* depth origin */, - float p01 /* horizontal slowness origin */, - float** vel /* slowness [nx][nz] */, - float** slice_in /* depth slice [nx][np][NS] */) -/*< Initialize >*/ -{ - int is; - - slice = slice_in; - - nx = nx1; - nz = nz1; - np = np1; - - dx = dx1; - dz = dz1; - dp = dp1; - - x0 = x01; - z0 = z01; - p0 = p01; - - npx = np*nx; - - xm = x0 + (nx-1)*dx; - zm = z0 + (nz-1)*dz; - pm = p0 + (np-1)*dp; - - cvel = sf_eno2_init (order,nz,nx); - sf_eno2_set (cvel,vel); - - known = sf_boolalloc (npx); - - grad2fill_init (np,nx); - - for (is=0; is < NS; is++) { - fslc[is] = sf_eno2_init (iorder,np,nx); - } - - nc4_init(); - hvec = (pqv)malloc(sizeof(pqv)); -} - -void hdtrace_step (int kz, int up, float **slow) -/*< Step in depth >*/ -{ - int incell, is, nk, kx, kp, k, ix, iz, step; - float z, x, p[2], t, ds; - float ssi, gi[2], ss, g[2]; - float fx, fz, fp; - bool onx, onz; - - /* grid dimension restrictions */ - /* dx.dp > 1/(4.pi.f) */ - /* dz.dp > 1/(4.pi.f) */ - - if (up == -1) sf_warning("upgoing rays"); - if (up == 1) sf_warning("downgoing rays"); - - for (is=0; is < NS; is++) { - sf_eno2_set1 (fslc[is],slice[is]); - } - - nk = 0; /* number of known */ - - z = z0 + kz*dz; - - for (kx = 0; kx < nx; kx++) { - - x = x0 + kx*dx; - - sf_eno2_apply(cvel,kz,kx,0.,0.,&ssi,gi,BOTH); - gi[1] /= dx; - gi[0] /= dz; - - for (kp = 0; kp < np; kp++) { - - k = kp + kx*np; - - /* initial dimensionless horizontal slowness */ - p[1] = p0 + kp*dp; - - /* initial dimensionless vertical one-way slowness */ - p[0] = up*sqrt(1.-p[1]*p[1]); - - ss = ssi; - g[0] = gi[0]; - g[1] = gi[1]; - - ix = kx; - onx = true; - - iz = kz; - onz = true; - - incell = 1; - - /* decide if we are out already */ - if ((iz == 0 && p[0] < 0.) || - (iz == nz-1 && p[0] > 0.) || - (ix == 0 && p[1] < 0.) || - (ix == nx-1 && p[1] > 0.)) { - slice[0][k] = 0.; - slice[1][k] = x0 + ix*dx; - slice[2][k] = z0 + iz*dz; - slice[3][k] = p[1]; - known[k] = true; - nk++; - continue; - } else { - known[k] = false; - } - - /* Hamiltonian vector */ - hvec_init(hvec,0.,x,z,ss0*p[1],ss0*p[0]); - - /* predict sigma step size to the next cell */ - ds = nc4_cellstep(hvec,slow,nx,nz,dx,dz,x0,z0,dp,dp); - - /* Loop until previous depth level or exiting from phase space grid */ - while (incell == 1) { - - /* symplectic cell step and traveltime integration */ - nc4_sigmastep(hvec,fabs(ds),&ss,slow,nx,nz,dx,dz,x0,z0); - - value_exitlevel(hvec,ss,&step,&fx,&fz,&fp,&t); - - /* exit at previous/next depth level */ - if (step == 1) { - onz = true; - onx = sf_cell_snap (&fx,&ix,eps); - incell = 0; - break; - } - - /* exit from spatial grid sides */ - if (step == 2) { - onx = true; - onz = sf_cell_snap (&z,&iz,eps); - if ((xm-fx) <= dx && fp > 0.) { - /* exit from the right side */ - - enogrid_apply(slice,nx-1,0.,p2,f); - f[2] = z1; - incell = 0; - break; - } - else if (fx <= dx && fp < 0.) { - /* exit from the left side */ - enogrid_apply(slice,0,0.,p2,f); - f[2] = z1; - incell = 0; - break; - } - } - - ix < 0 || ix > nx-1 || - (onx && ix == 0 && p[1] < 0.) || - (ix == nx-1 && (!onx || p[1] > 0.))) { - slice[0][k] = t; - slice[1][k] = x0+(x+ix)*dx; - slice[2][k] = z0+(z+iz)*dz; - slice[3][k] = sf_cell_p2a(p)*180./SF_PI; - known[k] = true; - nk++; - break; - - - - /* update for next sigma step */ - ds = nc4_cellstep(hvec,slow,nx,nz,dx,dz,x0,z0,dp,dp); - - /* exit from slowness grid sides (overturning ray) */ - if (step == 3) { - if ((pm-p2) <= dp && ds > 0.) { - fx = (x2-x0)/dx; - ix = snap(&x2,nx); - enogrid_apply(slice,ix,fx,p2,f); - f[2] = z1; - incell = 0; - break; - } - else if (p2 <= dp && ds < 0.) { - fx = (x2-x0)/dx; - ix = snap(&x2,nx); - enogrid_apply(slice,ix,fx,p2,f); - f[2] = z1; - incell = 0; - break; - } - } - } - - - slice[0][k] = t; - slice[1][k] = x0+(x+ix)*dx; - slice[2][k] = z0+(z+iz)*dz; - slice[3][k] = p[1]; - known[k] = true; - nk++; - - } /* kp */ - } /* kx */ - - if (nk < npx) { - fprintf(stderr,"known=%d (%d)\n",nk,npx); - nk = SF_MIN(SF_MIN(np,nx),npx-nk); - for (is=0; is < NS; is++) { - grad2fill (nk, slice[is], known): - } - } - -} - - - - - -static void psnap (float* p, float* q, int* iq) -/* snap to the grid (non dimensional horizontal slowness) */ -{ - int ip; - float fp2, fp; - - fp = (p-p0)/dp; - ip = floor (fp); - fp2 = fp-ip; - sf_cell_snap (&fp2,&ip,eps); - - if (ip < 0) { - ip = 0; - fp2 = 0.; - fp = p0; - } else if (ip >= np || (ip == np-1 && fp2 > 0.)) { - ip = np-1; - fp2 = 0.; - fp = f0+(np-1)*dp; - } - - p[1] = fp; /* px is sin(a) */ - p[0] = -sqrt(1.-fp*fp); /* pz is -cos(a) */ - - *q = fp2; - *iq = ip; -} - -#endif diff --git a/user/nobody/hshape.c b/user/nobody/hshape.c deleted file mode 100644 index c22b5a82e2..0000000000 --- a/user/nobody/hshape.c +++ /dev/null @@ -1,101 +0,0 @@ -/* Helical shaping. */ -/* - Copyright (C) 2008 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -/*^*/ - -#include "conv.h" - -static sf_filter aa, bb; -static float *t1, *t2, wt; - -void hshape_init( int nd /* data size */, - int ns /* scaling */, - sf_filter ff /* filter */) -/*< initialize >*/ -{ - int is, ia, na; - sf_filter cc; - - aa = ff; - na = aa->nh; - - bb = sf_allocatehelix(na); - for (ia=0; ia < na; ia++) { - bb->lag[ia] = aa->lag[ia]; - bb->flt[ia] = aa->flt[ia]; - } - - /* convolve ns times */ - for (is=0; is < ns-1; is++) { - cc = conv (bb, aa, false); - sf_deallocatehelix(bb); - bb = cc; - } - - if (0==(ns%2)) { - for (ia=0; ia < bb->nh; ia++) { - bb->flt[ia] = - bb->flt[ia]; - } - } - - wt = 1.0/ns; - t1 = sf_floatalloc (nd); - t2 = sf_floatalloc (nd); - - sf_polydiv_init(nd,aa); - sf_helicon_init(bb); -} - -void hshape_lop( bool adj, bool add, - int nx, int ny, float* xx, float*yy) -/*< linear operator >*/ -{ - int i; - - if (ny != nx) sf_error("%s: Different size",__FILE__); - - sf_adjnull(adj,add,nx,ny,xx,yy); - - if (adj) { - for (i=0; i < nx; i++) { - t2[i] = wt*yy[i]; - } - - sf_polydiv_lop (true, false, nx, nx, t1, t2); - sf_helicon_lop(true, true, nx, nx, xx, t1); - } else { - sf_helicon_lop(false, false, nx, nx, xx, t1); - sf_polydiv_lop (false, false, nx, nx, t1, t2); - - for (i=0; i < nx; i++) { - yy[i] += wt*t2[i]; - } - } -} - -void hshape_close (void) -/*< free allocated storage >*/ -{ - free (t1); - free (t2); - sf_deallocatehelix(bb); - sf_polydiv_close(); -} - diff --git a/user/nobody/img.c b/user/nobody/img.c deleted file mode 100644 index 1c657a5991..0000000000 --- a/user/nobody/img.c +++ /dev/null @@ -1,311 +0,0 @@ -/* Imaging condition for shot-profile migration */ -/* - Copyright (C) 2006 Colorado School of Mines - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include -/*^*/ - -#include "img.h" - -#include "slice.h" -/*^*/ - -#define LOOP(a) for( imy=0; imy< amy.n; imy++){ \ - for( imx=0; imx< amx.n; imx++){ {a} }} - -#define MLOOP(a) for( imz=0; imz< amz.n; imz++){ \ - for( imy=0; imy< amy.n; imy++){ \ - for( imx=0; imx< amx.n; imx++){ {a} }}} - -#define HLOOP(a) for(ihz=LOz; ihz*/ -{ - int imx,imy; - - LOOP( - qs[imz][imy][imx] = ww_s[imy][imx]; - qr[imz][imy][imx] = ww_r[imy][imx]; - ); -} - -/*------------------------------------------------------------*/ -void imgo_init(sf_axis amz_, - sf_axis amx_, - sf_axis amy_, - fslice imag - ) -/*< initialize o-offset imaging condition >*/ -{ - int imx,imy,imz; - - amx = sf_nod(amx_); - amy = sf_nod(amy_); - amz = sf_nod(amz_); - - /* allocate image storage */ - qs = sf_complexalloc3(amx.n,amy.n,amz.n); - qr = sf_complexalloc3(amx.n,amy.n,amz.n); - qi = sf_floatalloc3 (amx.n,amy.n,amz.n); - MLOOP( - qs[imz][imy][imx] = sf_cmplx(0.0,0.0); - qr[imz][imy][imx] = sf_cmplx(0.0,0.0); - qi[imz][imy][imx] = 0.0; - ); - fslice_put(imag,1,qi[0][0]); -} - -void imgx_init(sf_axis amz_, - sf_axis amx_, - sf_axis amy_, - sf_axis ahx_, - sf_axis ahy_, - sf_axis ahz_, - fslice imag - ) -/*< initialize x-offset imaging condition >*/ -{ - int imx,imy,imz; - int ihx,ihy,ihz,ih; - - amx = sf_nod(amx_); - amy = sf_nod(amy_); - amz = sf_nod(amz_); - - ahx = sf_nod(ahx_); - ahy = sf_nod(ahy_); - ahz = sf_nod(ahz_); - - LOx = floor(ahx.o/ahx.d); HIx = LOx + ahx.n; - LOy = floor(ahy.o/ahy.d); HIy = LOy + ahy.n; - LOz = floor(ahz.o/ahz.d); HIz = LOz + ahz.n; - - /* allocate image storage */ - qs = sf_complexalloc3(amx.n,amy.n,amz.n); - qr = sf_complexalloc3(amx.n,amy.n,amz.n); - qi = sf_floatalloc3 (amx.n,amy.n,amz.n); - MLOOP( - qs[imz][imy][imx] = sf_cmplx(0.0,0.0); - qr[imz][imy][imx] = sf_cmplx(0.0,0.0); - qi[imz][imy][imx] = 0.0; - ); - - HLOOP( ih = IND(ihx,ihy,ihz); - fslice_put(imag,ih,qi[0][0]); - ); -} - -void imgt_init(sf_axis amz_, - sf_axis amx_, - sf_axis amy_, - sf_axis aht_, - sf_axis aw_, - fslice imag - ) -/*< initialize t-offset imaging condition >*/ -{ - int imx,imy,imz; - int iht,iw; - float ht, w; - - amx = sf_nod(amx_); - amy = sf_nod(amy_); - amz = sf_nod(amz_); - - aht = sf_nod(aht_); - aw = sf_nod(aw_); - - /* allocate image storage */ - qs = sf_complexalloc3(amx.n,amy.n,amz.n); - qr = sf_complexalloc3(amx.n,amy.n,amz.n); - qi = sf_floatalloc3 (amx.n,amy.n,amz.n); - MLOOP( - qs[imz][imy][imx] = sf_cmplx(0.0,0.0); - qr[imz][imy][imx] = sf_cmplx(0.0,0.0); - qi[imz][imy][imx] = 0.0; - ); - - for (iht=0; iht*/ -{ - int imx,imy,imz; - - fslice_get(imag,0,qi[0][0]); -#ifdef SF_HAS_COMPLEX_H - MLOOP( - ; qi[imz][imy][imx] += - crealf( conjf(qs[imz][imy][imx]) - * qr[imz][imy][imx] ); - ); -#else - MLOOP( - ; qi[imz][imy][imx] += - crealf( sf_cmul(conjf(qs[imz][imy][imx]),qr[imz][imy][imx])); - ); -#endif - fslice_put(imag,0,qi[0][0]); -} - -void imgx( fslice imag, - int iw) -/*< Apply x-offset imaging condition >*/ -{ - int imx ,imy ,imz; - int ihx ,ihy ,ihz ,ih; - int imys,imyr,imzs; - int imxs,imxr,imzr; - -#ifdef SF_HAS_COMPLEX_H - HLOOP( ih = IND(ihx,ihy,ihz); - fslice_get(imag,ih,qi[0][0]); - CLOOP( - ; qi[imz ][imy ][imx ] += - crealf( conjf(qs[imzs][imys][imxs]) - * qr[imzr][imyr][imxr] ); - ); - fslice_put(imag,ih,qi[0][0]); - ); -#else - HLOOP( ih = IND(ihx,ihy,ihz); - fslice_get(imag,ih,qi[0][0]); - CLOOP( - ; qi[imz ][imy ][imx ] += - crealf( sf_cmul(conjf(qs[imzs][imys][imxs]), - qr[imzr][imyr][imxr] )); - ); - fslice_put(imag,ih,qi[0][0]); - ); -#endif -} - -void imgt( fslice imag, - int iw) -/*< Apply t-offset imaging condition >*/ -{ - int imx,imy,imz,iht; - sf_complex wt; - - for(iht=0; iht*/ -{ - img_close(); -} - -void imgt_close() -/*< deallocate >*/ -{ - img_close(); - free(*tt); free(tt); -} - -void imgx_close() -/*< deallocate >*/ -{ - img_close(); -} - -void img_close() -/*< deallocate >*/ -{ - free(**qs); free(*qs); free(qs); - free(**qr); free(*qr); free(qr); - free(**qi); free(*qi); free(qi); -} diff --git a/user/nobody/layer.c b/user/nobody/layer.c deleted file mode 100644 index 7e150534cb..0000000000 --- a/user/nobody/layer.c +++ /dev/null @@ -1,161 +0,0 @@ -/* Layered medium */ -/* - Copyright (C) 2006 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "layer.h" -#include "kirmod.h" - -static int n; /* number of layers */ -static float *y; /* ray points */ -static sf_eno *lay, *dip, *cur; /* interfaces, dips, and curvatures */ -static char *type; /* type of velocity distribution */ -static ktable table; /* traveltime attributes table */ -static float *v0, **g, **x0; /* velocity, gradient, reference */ - -void layer_init(int n_in /* number of layers */, - char *types /* [n] velocity model types */, - float *v0_in /* [n] reference velocity */, - float **g_in /* [n] velocity gradient */, - float **x0_in /* [n] gradient reference point */, - int order /* interpolation order */, - int nx /* horizontal sampling */, - float **lays, - float **dips, - float **curs /* [n+1][nx] interfaces */) -/*< initialize >*/ -{ - int k; - - n = n_in; - - y = sf_floatalloc(n-1); - type = types; - lay = (sf_eno*) sf_alloc(n,sizeof(sf_eno)); - dip = (sf_eno*) sf_alloc(n,sizeof(sf_eno)); - cur = (sf_eno*) sf_alloc(n,sizeof(sf_eno)); - table = (ktable) sf_alloc(1,sizeof(*table)); - - for (k=0; k < n+1; k++) { - lay[k] = sf_eno_init (order,nx); sf_eno_set (lay[k],lays[k]); - dip[k] = sf_eno_init (order,nx); sf_eno_set (dip[k],dips[k]); - cur[k] = sf_eno_init (order,nx); sf_eno_set (cur[k],curs[k]); - } - - v0 = v0_in; - g = g_in; - x0 = x0_in; -} - -void layer_close(void) -/*< free allocated memory >*/ -{ - int k; - - free(y); - free(table); - - for (k=0; k < n+1; k++) { - sf_eno_close(lay[k]); - sf_eno_close(dip[k]); - sf_eno_close(cur[k]); - } - - free(lay); - free(dip); - free(cur); -} - -void layer_set(float* start /* [2] start ray point */, - float* end /* [2] end ray point */) -/*< initialize intersections >*/ -{ - int i; - float dx; - - dx = (end[0]-start[0])/n; - - for (i=1; i < n; i++) { - y[i-1] = start[0] + i*dx; - } -} - -float layer_time(float* start /* [2] start ray point */, - float* end /* [2] end ray point */) -{ - int ix, i; - float t, x, x2, z, z2, v, v2; - - /* first intersection */ - x = y[0]; - ix = floorf(x); - sf_eno_apply (lay[0],ix,x-ix,&z,NULL,FUNC); - - /* velocities */ - v = v0[0]+g[0][0]*(start[0]-x0[0][0])+g[1][0]*(start[1]-x0[1][0]); - v2 = v0[0]+g[0][0]*(x -x0[0][0])+g[1][0]*(z -x0[1][0]); - - /* first layer */ - kirmod_table(type[0], true, - z-start[1], - x-start[0],0., - hypotf(g[0][0],g[1][0]), - g[0][0],0.,g[1][0], /* gradient */ - v,v2,v,0., - 0., 0., 0., 1., - table); - t = table->t; - - for (i=1; i < n-1; i++) { - /* next intersection */ - x2 = y[i]; - ix = floorf(x2); - sf_eno_apply (lay[i],ix,x2-ix,&z2,NULL,FUNC); - v = v0[i]+g[0][i]*(x -x0[0][i])+g[1][0]*(z -x0[1][i]); - v2 = v0[i]+g[0][i]*(x2-x0[0][i])+g[1][0]*(z2-x0[1][i]); - - /* current layer */ - kirmod_table(type[i], true, - z2-z,x2-x,0., - hypotf(g[0][i],g[1][i]), - g[0][i],0.,g[1][i], /* gradient */ - v,v2,v,0., - 0., 0., 0., 1., - table); - t += table->t; - - x = x2; - z = z2; - } - - /* endvelocity */ - v = v0[n-1]+g[0][n-1]*(x -x0[0][n-1])+g[1][n-1]*(z -x0[1][n-1]); - v2 = v0[n-1]+g[0][n-1]*(end[0]-x0[0][n-1])+g[1][n-1]*(end[1]-x0[1][n-1]); - - /* last layer */ - kirmod_table(type[n-1], true, - end[1]-z,end[0]-x,0., - hypotf(g[0][n-1],g[1][n-1]), - g[0][n-1],0.,g[1][n-1], /* gradient */ - v,v2,v,0., - 0., 0., 0., 1., - table); - t += table->t; - - return t; -} diff --git a/user/nobody/levint2.c b/user/nobody/levint2.c deleted file mode 100644 index eb142e4f78..0000000000 --- a/user/nobody/levint2.c +++ /dev/null @@ -1,72 +0,0 @@ -/* 2-D inverse interpolation with PEF estimation */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "levint2.h" - -#include "helix.h" -/*^*/ - -#include "helicon.h" -#include "pefhel.h" -#include "lint2.h" - -void levint2 (bool cdstep /* if use conj. directions */, - int niter /* number of iterations */, - int warmup /* initial iterations */, - int nd /* data size */, - float *x, float *y /* data coordinates */, - float *dd /* data */, - float o1, float d1, int n1 /* inline */, - float o2, float d2, int n2 /* crossline */, - filter aa /* PEF */, - float *rr /* residual */, - float eps /* regularization parameter */) -/*< 2-D inverse interpolation with PEF estimation >*/ -{ - int nm, nr; - - nm = n1*n2; - nr = nm+aa->nh; - - lint2_init (n1,o1,d1, n2,o2,d2, x, y); - pefhel_init (aa, nm, rr); - - if (cdstep) { - sf_cdstep_init(); - sf_solver_reg (lint2_lop, sf_cdstep, helicon_lop, nm, nm, nd, rr, dd, - warmup, eps, "x0", rr, "nmem", warmup, "end"); - sf_cdstep_close(); - /* - sf_solver_reg (lint2_lop, sf_cdstep, pefhel_lop, nm, nr, nd, rr, dd, - niter, eps, "x0", rr, "nlreg", helicon_lop, "nmem", 3, "end"); - sf_cdstep_close(); - */ - } else { - sf_solver_reg (lint2_lop, sf_cgstep, helicon_lop, nm, nm, nd, rr, dd, - warmup, eps, "x0", rr, "end"); - sf_cgstep_close(); - /* - sf_solver_reg (lint2_lop, sf_cgstep, pefhel_lop, nm, nr, nd, rr, dd, - niter, eps, "x0", rr, "nlreg", helicon_lop,"end"); - sf_cgstep_close(); - */ - } -} diff --git a/user/nobody/log.c b/user/nobody/log.c deleted file mode 100644 index 8bd811f2a6..0000000000 --- a/user/nobody/log.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Take the base-10 logarithm of input data. - -Alternatively, use sfmath or sfheadermath. -*/ - -#include -#include - -#include - -int main (int argc, char* argv[]) -{ - float range, *data, di, avg=0., big; - int esize, centered; - size_t i, size; - sf_file in=NULL, out=NULL; - - sf_init (argc,argv); - in = sf_input ("in"); - out = sf_output ("out"); - - if (SF_FLOAT != sf_gettype(in)) sf_error("Need float data type"); - if(!sf_histint(in,"esize",&esize)) esize=4; - size = (size_t) sf_filesize (in); - - if(!sf_getint("centered",¢ered)) centered=2; - /* [0,1,2] defines method of shifting mean */ - if(!sf_getfloat("range",&range)) range=3.; - /* Smallest allowed value */ - - data = sf_floatalloc(size); - sf_floatread (data,size,in); - - big = (float) FLT_MIN_10_EXP; - for (i=0; i< size; i++) { - di = fabsf(data[i]); - di = (0. >= di)? (float) FLT_MIN_10_EXP: log10f(di); - if (di > big) big=di; - data[i] = di; - } - - for (i=0; i< size; i++) { - di = data[i]; - if (di < big-range) di = big-range; - } - - switch (centered) { - case 0: - avg=big; - sf_putstring(out,"label2","log base 10"); - break; - case 1: - sf_putint(out,"pclip",100); - avg = (big + (big-range)) / 2.; - break; - case 2: - avg = 0.; - for (i=0; i< size; i++) { - avg += data[i]; - } - avg /= size; - sf_putfloat(out,"range",2.*(big-avg)); - break; - default: - sf_error ("Unsupported centered=%d",centered); - break; - } - - for (i=0; i< size; i++) { - data[i] -= avg; - } - - sf_floatwrite (data,size,out); - - - exit (0); -} diff --git a/user/nobody/nos.c b/user/nobody/nos.c deleted file mode 100644 index 5885182a26..0000000000 --- a/user/nobody/nos.c +++ /dev/null @@ -1,164 +0,0 @@ -/* Narrow-offset space-domain shift */ - -#include -#include -#include "nos.h" -#include "fft1.h" - -#define X2K(a,b,p) b.n=a.n+p; \ - b.d=2.0*SF_PI/(b.n*a.d); \ - b.o=(1==b.n)?0:-SF_PI/a.d; -#define KMAP(i,n) (i*/ -{ - int im; - int jm; - - am = am_; - ah = ah_; - aw = aw_; - az = az_; - - X2K(am,bm,0); - - wk = sf_complexalloc2(bm.n,ah.n); - uk = sf_complexalloc2(bm.n,ah.n); - - /* precompute wavenumbers */ - km = sf_floatalloc(bm.n); - - for (im=0; im*/ -{ - int ih,im; - int jh; - - float ho,hh,dh; - float h_; /* H */ - float complex w_; /* W */ - float k_; /* K, K' */ -/* float complex kp; */ -/* float complex s_, sp; */ /* S, S' */ -/* float complex ss, ds; */ -/* float complex a,b,c; */ - - float complex cc; - float complex w2; - float s2, aa, fold; - -/* int jn; */ -/*------------------------------------------------------------*/ - - w2 = 0.1*aw.d - I*w; - w2 = w2*w2; - s2 = sz*sz; - - KOOP( wk[ih][im] = 0.; ); - - LOOP( wk[ih][im] = - wx[ih][im]; ); - - fft1a1(false,wk); - /*------------------------------------------------------------*/ - /* begin K-domain computation */ - - w_ = 4*w2*s2; - - /* loop over km */ - for(im=0; im0.001*cabs(sp) && jn<10 ) { - a = h_*(1+h_)*kp*kp; - b = 2*h_*kp + (2-3*sp)*sp; - c = 4*h_*kp + (3-4*sp)*sp; - - sp = (a + b * sp*sp)/(c * sp); - - ds = cabs(sp-ss); - ss = sp; - - jn++; - } /* Newton iterations for S */ - s_ = sp / ((1+h_)/w_); - - - cc = csqrtf(s_ + k_); -#endif - -/* cc = -I*w*sz*sqrtf(1.+h_)*az.d;*/ -/* aa = sqrtf(cabsf(cc))/(1+h_);*/ -/* uk[ih][im] += wk[jh][im] * cexpf(-cc) * aa;*/ -/* fold += aa;*/ - - cc = -I*2*w*sz*sqrtf(1.+h_)*az.d; - aa = sqrtf(cabsf(cc)) / (1+h_); - - uk[ih][im] += wk[jh][im] * cexpf(-cc - I*SF_PI/4.) * aa; - fold += aa; - - } /* ho */ - - if (fold > 0.) uk[ih][im] *= sqrtf(2.*w*sz*az.d)/fold; - - } /* hh */ - } /* km */ - - /* end K-domain computation */ - /*------------------------------------------------------------*/ - fft1a1(false,uk); - - LOOP( wx[ih][im] = - uk[ih][im]; ); -} diff --git a/user/nobody/ntriangle1.c b/user/nobody/ntriangle1.c deleted file mode 100644 index 2e39e16e5e..0000000000 --- a/user/nobody/ntriangle1.c +++ /dev/null @@ -1,89 +0,0 @@ -/* Nonstationary triangle smoothing as a linear operator, applied in 2-D */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "ntriangle1.h" -#include "ntriangle.h" - -#include -/*^*/ - -static int n1, n2, nd, **ns; -static ntriangle tr; -static float *tmp, **nr; - -void ntriangle1_init (int nbox1 /* maximum triangle size */, - int ndat1, int ndat2 /* data size */, - float **rect /* triangle sizes */, - int **shift /* triangle shifts */) -/*< initialize >*/ -{ - n1 = ndat1; - n2 = ndat2; - nd = n1*n2; - nr = rect; - ns = shift; - - tr = ntriangle_init (nbox1,ndat1); - tmp = sf_floatalloc (n1); -} - -void ntriangle1_lop (bool adj, bool add, int nx, int ny, float* x, float* y) -/*< linear operator >*/ -{ - int i1, i2; - - if (nx != ny || nx != nd) - sf_error("%s: Wrong data dimensions: nx=%d, ny=%d, nd=%d", - __FILE__,nx,ny,nd); - - sf_adjnull (adj,add,nx,ny,x,y); - - for (i2=0; i2 < n2; i2++) { - if (adj) { - for (i1=0; i1 < n1; i1++) { - tmp[i1] = y[i1+i2*n1]; - } - - nsmooth2 (tr, 0, 1, false, nr[i2], ns[i2], tmp); - - for (i1=0; i1 < n1; i1++) { - x[i1+i2*n1] += tmp[i1]; - } - } else { - for (i1=0; i1 < n1; i1++) { - tmp[i1] = x[i1+i2*n1]; - } - - nsmooth (tr, 0, 1, false, nr[i2], ns[i2], tmp); - - for (i1=0; i1 < n1; i1++) { - y[i1+i2*n1] += tmp[i1]; - } - } - } -} - -void ntriangle1_close(void) -/*< free allocated storage >*/ -{ - free (tmp); - ntriangle_close (tr); -} - -/* $Id: ntriangle1.c 839 2004-10-25 11:54:43Z fomels $ */ diff --git a/user/nobody/off2ang.c b/user/nobody/off2ang.c deleted file mode 100644 index 20c52c7cfc..0000000000 --- a/user/nobody/off2ang.c +++ /dev/null @@ -1,155 +0,0 @@ -/* Offset to angle transformation for common-azimuth migration */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "off2ang.h" - -static int nt, nt2, np, nx, nw; -static float *tt, **pp, dw, dp, p0, dx, x0; -static sf_complex **cd, **cm, *dd; -static kiss_fftr_cfg forw, invs; - -void off2ang_init(int nz /* depth samples */, - float dz /* depth sampling */, - int na /* angle samples */, - float da /* angle sampling (in radians) */, - float a0 /* first angle (in radians) */, - int nh /* offset sampling */, - float dh /* offset sampling */, - float h0 /* first offset */) -/*< initialize >*/ -{ - nt=nz; - np=na; dp=da; p0=a0; - nx=nh; dx=dh; x0=h0; - nt2 = 2*kiss_fft_next_fast_size(nt); /* padding */ - nw = nt2/2+1; - dw = 2.0*SF_PI/(nt2*dz); - - tt = sf_floatalloc (nt2); - pp = sf_floatalloc2 (np,nt); - - forw = kiss_fftr_alloc(nt2,0,NULL,NULL); - invs = kiss_fftr_alloc(nt2,1,NULL,NULL); - - cm = sf_complexalloc2 (nw,np); - cd = sf_complexalloc2 (nw,nx); - dd = sf_complexalloc(nx); -} - -void off2ang_close() -/*< free allocated storage >*/ -{ - free(tt); - free(*pp); - free(pp); - free(forw); - free(invs); - free(*cm); - free(cm); - free(*cd); - free(cd); - free(dd); -} - -void off2ang(float **off /* input: local offset gather [nx][nz] */, - float **ang /* output: angle gather [na][nz] */, - const float *dip /* cross-line dip [nz] */) -/*< transform >*/ -{ - int ix, ip, it, iw, iq; - float w, p, dq, t; - sf_complex m, c; - - /*** frequency-domain Radon transform ***/ - for (ix=0; ix < nx; ix++) { /* loop over offsets */ - for (it=0; it < nt; it++) { - tt[it]=off[ix][it]; - } - for (it=nt; it < nt2; it++) { - tt[it]=0.; - } - - /* FFT to frequency */ - kiss_fftr(forw,tt, (kiss_fft_cpx *) cd[ix]); - } - - for (iw=0; iw < nw; iw++) { /* loop over frequencies */ - w = iw*dw; - - for (ix=0; ix < nx; ix++) { /* loop over offsets */ - /* transpose + FFT scaling */ -#ifdef SF_HAS_COMPLEX_H - dd[ix] = cd[ix][iw]/nt2; -#else - dd[ix] = sf_crmul(cd[ix][iw],1./nt2); -#endif - } - - for (ip=0; ip < np; ip++) { /* loop over slopes */ - p = tanf(p0+ip*dp); - t = w*p*dx; - c = sf_cmplx(cosf(t),sinf(t)); - - m = sf_cmplx(0.,0.); - for (ix=nx-1; ix >= 0; ix--) { -#ifdef SF_HAS_COMPLEX_H - m = m*c + dd[ix]; -#else - m = sf_cadd(sf_cmul(m,c),dd[ix]); -#endif - } - - t = w*p*x0; - c = sf_cmplx(cosf(t),sinf(t)); - - /* transpose */ -#ifdef SF_HAS_COMPLEX_H - cm[ip][iw] = m*c; -#else - cm[ip][iw] = sf_cmul(m,c); -#endif - } - } - - for (ip=0; ip < np; ip++) { /* loop over slopes */ - /* FFT to time */ - kiss_fftri(invs,(const kiss_fft_cpx *) cm[ip], tt); - - for (it=0; it < nt; it++) { - pp[it][ip]=tt[it]; - } - } - - /*** dip correction ***/ - for (it=0; it < nt; it++) { /* loop over depth */ - dq = sqrtf(1+dip[it]); - for (ip=0; ip < np; ip++) { - p = (atanf(tanf(p0+ip*dp)*dq)-p0)/dp; - /* linear interpolation */ - iq = floorf(p); - if (iq >= 0 && iq < np-1) { - p -= iq; - ang[ip][it]=pp[it][iq]*(1.-p)+pp[it][iq+1]*p; - } else { - ang[ip][it]=0.; - } - } - } -} diff --git a/user/nobody/omputil.c b/user/nobody/omputil.c deleted file mode 100644 index 6ef4b505b5..0000000000 --- a/user/nobody/omputil.c +++ /dev/null @@ -1,37 +0,0 @@ -#include - -#include "omputil.h" - -#ifdef _OPENMP -#include -#endif - - -/*------------------------------------------------------------*/ -int omp_init() -/*< init OMP parameters >*/ -{ - int ompnth; - int ompchunk; - -#ifdef _OPENMP - int ompath; -#endif - - /* OMP data chunk size */ - if(! sf_getint("ompchunk",&ompchunk)) ompchunk=1; - -#ifdef _OPENMP - /* OMP available threads */ - if(! sf_getint("ompnth", &ompnth)) ompnth=0; -#pragma omp parallel - ompath=omp_get_num_threads(); - if(ompnth<1) ompnth=ompath; - omp_set_num_threads(ompnth); - sf_warning("using %d threads of a total of %d",ompnth,ompath); -#else - ompnth=0; -#endif - - return ompnth; -} diff --git a/user/nobody/opwd.c b/user/nobody/opwd.c deleted file mode 100644 index b5d2c58856..0000000000 --- a/user/nobody/opwd.c +++ /dev/null @@ -1,100 +0,0 @@ -/* omnidirectional plane-wave destruction */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "opwd.h" - -#ifndef _opwd_h - -typedef void (*interpolate)(float,float*); -/*^*/ - -#endif - -static int n1, n2; -static float **res; - -void lagrange(float p, float *f) -/*< Lagrange interpolator >*/ -{ - f[0]=0.5f*p*(p-1.0f); - f[1]=1.0f-p*p; - f[2]=0.5f*p*(p+1.0f); -} - -void lagrange_der(float p, float *f) -/*< Lagrange interpolator derivative >*/ -{ - f[0]=p-0.5f; - f[1]=-2.0f*p; - f[2]=p+0.5f; -} - -void bspline(float p, float *f) -/*< B-spline interpolator >*/ -{ - f[0]=0.125*(2*p-1)*(2*p-1); - f[1]=0.75-p*p; - f[2]=0.125*(2*p+1)*(2*p+1); -} - -void opwd_init(int m1, int m2 /* data dimensions */) -/*< initialize >*/ -{ - n1 = m1; - n2 = m2; - res = sf_floatalloc2(n2,n1); -} - -void opwd_close(void) -/*< free allocated storage >*/ -{ - free(*res); - free(res); -} - -void opwd_filter(interpolate int1, interpolate int2 /* interpolators */, - sf_tris t1, sf_tris t2 /* prefilters */, - float **p1, float **p2 /* slopes [n2][n1] */, - float **inp, float **out /* [n2][n1] */) -/*< filter input >*/ -{ - int i1, i2; - float *trace, filt[3]; - - for (i2=0; i2 < n2; i2++) { - res[0][i2] = res[n1-1][i2] = 0.; - trace = inp[i2]; - if (NULL != t1) sf_tridiagonal_solve(t1,trace); - for (i1=1; i1 < n1-1; i1++) { - int1(p1[i2][i1],filt); - res[i1][i2] = filt[0]*trace[i1-1]+filt[1]*trace[i1]+filt[2]*trace[i1+1]; - } - out[i2][0] = out[i2][n1-1] = 0.; - } - for (i1=0; i1 < n1; i1++) { - out[0][i1] = out[n2-1][i1] = 0.; - trace = res[i1]; - if (NULL != t2) sf_tridiagonal_solve(t2,trace); - for (i2=1; i2 < n2-1; i2++) { - int2(p2[i2][i1],filt); - out[i2][i1] = filt[0]*trace[i2-1]+filt[1]*trace[i2]+filt[2]*trace[i2+1]; - } - } -} diff --git a/user/nobody/phs.c b/user/nobody/phs.c deleted file mode 100644 index 86452d0ce4..0000000000 --- a/user/nobody/phs.c +++ /dev/null @@ -1,102 +0,0 @@ -/* K-domain phase shift */ - -#include -#include -#include "fft2.h" -#include "phs.h" - -#define X2K(a,b,p) b.n=a.n+p; \ - b.d=2.0*SF_PI/(b.n*a.d); \ - b.o=(1==b.n)?0:-SF_PI/a.d; -#define KMAP(i,n) (i*/ -{ - int im,ih; - int jm,jh; - float km,kh,k; - - am = am_; - ah = ah_; - aw = aw_; - az = az_; - - X2K(am,bm,0); - X2K(ah,bh,0); - fft2_init(bm.n,bh.n); - - wk = sf_complexalloc2(bm.n,bh.n); - - /* precompute wavenumbers */ - ks= sf_floatalloc2(bm.n,bh.n); - kr= sf_floatalloc2(bm.n,bh.n); - - for (im=0; im*/ -{ - int ih,im; - - float complex cs,cr,cc; - float complex w2; - float s2; - w2 = 0.1*aw.d - I*w; - w2 = w2*w2; - s2 = sz*sz; - - KOOP( wk[ih][im] = 0.; ); - - LOOP( wk[ih][im] = - wx[ih][im]; ); - fft2(false,wk); - -/*------------------------------------------------------------*/ - KOOP( - cs = csqrtf(w2*s2 + ks[ih][im]); - cr = csqrtf(w2*s2 + kr[ih][im]); - - cc = cs + cr; - wk[ih][im] *= cexpf(-cc*az.d); - ); -/*------------------------------------------------------------*/ - fft2(true,wk); - LOOP( wx[ih][im] = - wk[ih][im]; ); -} diff --git a/user/nobody/prf.c b/user/nobody/prf.c deleted file mode 100644 index 5b98a552b8..0000000000 --- a/user/nobody/prf.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "prf.h" - -float prf_burg(int n, float* trace) -{ - int i; - float a, avto, cros; - - avto = trace[n-1]*trace[n-1]; - a = avto + trace[0]*trace[0]; - cros = 0.; - for (i=0; i < n-1; i++) { - avto += trace[i]*trace[i]; - cros += trace[i]*trace[i+1]; - } - if (avto == 0.) { - a=-2.; - } else { - a = - (a + 2.*cros)/avto; - } - - return a; -} - -float prf_burg2(int n1, int n2, float** trace) -{ - int i1, i2; - float a; - double avto, cros; - - a = avto = cros = 0.; - - for (i2=0; i2 < n2; i2++) { - avto += trace[i2][n1-1]*trace[i2][n1-1]; - a += (trace[i2][n1-1]*trace[i2][n1-1] + trace[i2][0]*trace[i2][0]); - for (i1=0; i1 < n1-1; i1++) { - avto += trace[i2][i1]*trace[i2][i1]; - cros += trace[i2][i1]*trace[i2][i1+1]; - } - } - - if (avto == 0.) { - a=-2.; - } else { - a = - (a + 2.*cros)/avto; - } - - return a; -} - -void prf_define (int n, float a, float eps, float* diag, float** offd) -{ - int i; - - for (i=0; i < n-2; i++) { - diag[i+1] = (2. + a*a)*eps; - offd[0][i] = (2.*a)*eps; - offd[1][i] = eps; - } - offd[0][0] = (1.+2.*a)*eps; - offd[0][n-2] = (1.+2.*a)*eps; - diag[0] = (1.+(1.+a)*(1.+a))*eps; - diag[n-1] = (1.+(1.+a)*(1.+a))*eps; -} diff --git a/user/nobody/scale.c b/user/nobody/scale.c deleted file mode 100644 index 26d904b3b3..0000000000 --- a/user/nobody/scale.c +++ /dev/null @@ -1,29 +0,0 @@ -#include - -#include "scale.h" - -static float w; - -void scale_init(float w1) -{ - w = w1; -} - -void scale_lop (bool adj, bool add, int nx, int ny, float* xx, float* yy) -{ - int i; - - if (ny!=nx) sf_error("%s: size mismatch: %d != %d",__FILE__,ny,nx); - - sf_adjnull (adj, add, nx, ny, xx, yy); - - for (i=0; i < nx; i++) { - if (adj) { - xx[i] += yy[i] * w; - } else { - yy[i] += xx[i] * w; - } - } -} - -/* $Id$ */ diff --git a/user/nobody/seislet97.c b/user/nobody/seislet97.c deleted file mode 100644 index 6aafc429dd..0000000000 --- a/user/nobody/seislet97.c +++ /dev/null @@ -1,665 +0,0 @@ -/* Seislet transform */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "seislet97.h" -#include "predict.h" - -static int nt, n; -static bool inv, unit; -static float **t, **d, *t1, *t2, *w; -static void (*transform)(bool); - -static void predict_forw(bool adj, float *tt, int i, int j) -/* Predict forward */ -{ - int i2; - - for (i2=i; i2 < i+j; i2++) { - predict_step(adj,true,tt,d[i2]); - } -} - -static void predict_back(bool adj, float *tt, int i, int j) -/* Predict backward */ -{ - int i2; - - for (i2=i+j-1; i2 >= i; i2--) { - predict_step(adj,false,tt,d[i2]); - } -} - - -static void biorthogonal(bool adj) -{ - int i, j, i1; - float a; - if (adj) { - for (j=1; j <= nt/2; j *= 2) { - if (inv) { - - a = -1.586134342f; - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(false,t1,i,j); - predict_back(false,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])*a; - /* Predict 1 */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += 2*a*t1[i1]; /*right boundary*/ - } - } - - -/* for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(false,t1,i,j); - predict_back(false,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] -= (t1[i1]+t2[i1])/2; - - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] -= t1[i1]; - - } - } -*/ - a= -0.05298011854f; - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(false,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += 2*a*t1[i1]; /*left boundary*/ - } - - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(false,t1,i,j); - predict_forw(false,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])*a; - /* Update 1 */ - } - } - /* Step 1 */ - -/* - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(false,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += t1[i1]/2; - } - - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(false,t1,i,j); - predict_forw(false,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])/4; - } - } -*/ - a = 0.8829110762f; - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(false,t1,i,j); - predict_back(false,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])*a; - /* Predict 2 */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += 2*a*t1[i1]; /*right boundary*/ - } - } - a= 0.4435068522f; - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(false,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += 2*a*t1[i1]; /*left boundary*/ - } - - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(false,t1,i,j); - predict_forw(false,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])*a; - /* Update 2 */ - } - } - /* Step 2 */ - - - a= 1/(1.230174105f); - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] *= a; - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] *= a; /*right boundary*/ - } - } - for (i1=0; i1 < n; i1++) { - t[0][i1] /= a; /*left boundary*/ - } - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t[i][i1] /= a; - } - } - /* Scale */ - } else { - - a = -1.586134342f; - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(true,t1,i,j); - predict_back(true,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])*a; - /* Predict 1 */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(true,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += 2*a*t1[i1]; /*right boundary*/ - } - } - a= -0.05298011854f; - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(true,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += 2*a*t1[i1]; /*left boundary*/ - } - - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(true,t1,i,j); - predict_forw(true,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])*a; - /* Update 1 */ - } - } - /* Step 1 */ - a = 0.8829110762f; - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(true,t1,i,j); - predict_back(true,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])*a; - /* Predict 2 */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(true,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += 2*a*t1[i1]; /*right boundary*/ - } - } - a= 0.4435068522f; - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(true,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += 2*a*t1[i1]; /*left boundary*/ - } - - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(true,t1,i,j); - predict_forw(true,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])*a; - /* Update 2 */ - } - } - /* Step 2 */ - a= 1/(1.230174105f); - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] *= a; - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] *= a; /*right boundary*/ - } - } - for (i1=0; i1 < n; i1++) { - t[0][i1] /= a; /*left boundary*/ - } - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t[i][i1] /= a; - } - } - /* Scale */ -/* for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(true,t1,i,j); - predict_back(true,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] -= (t1[i1]+t2[i1])/2; - - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(true,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] -= t1[i1]; - - } - } - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(true,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += t1[i1]/2; - } - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(true,t1,i,j); - predict_forw(true,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])/4; - - } - } -*/ - - - } - - - } - } else { - for (j=nt/2; j >= 1; j /= 2) { - - a= 1.230174105f; - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t[i][i1] /= a; - } - } - for (i1=0; i1 < n; i1++) { - t[0][i1] /= a; /*left boundary*/ - } - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] *= a; - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] *= a; /*right boundary*/ - } - } - /* Undo Scale */ - - a= -0.4435068522f; - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(false,t1,i,j); - predict_forw(false,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])*a; - /* Undo Update 2 */ - } - } - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(false,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += 2*a*t1[i1]; /*left boundary*/ - } - - a = -0.8829110762f; - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(false,t1,i,j); - predict_back(false,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])*a; - /* Undo Predict 2 */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += 2*a*t1[i1]; /*right boundary*/ - } - } - /* Undo Step 2 */ - - a= 0.05298011854f; - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(false,t1,i,j); - predict_forw(false,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])*a; - /* Undo Update 1 */ - } - } - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(false,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += 2*a*t1[i1]; /*left boundary*/ - } - a = 1.586134342f; - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(false,t1,i,j); - predict_back(false,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])*a; - /* Undo Predict 1 */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += 2*a*t1[i1]; /*right boundary*/ - } - } - /* Undo Step 1 */ - -/* for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(false,t1,i,j); - predict_forw(false,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] -= (t1[i1]+t2[i1])/4; - - } - } - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(false,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] -= t1[i1]/2; - } - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(false,t1,i,j); - predict_back(false,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])/2; - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += t1[i1]; - } - } -*/ - } - } -} - -void seislet97_init(int n1 /* trace length */, - int n2 /* number of traces */, - bool inv1 /* inversion flag */, - bool unit1 /* weighting flag */, - float eps /* regularization parameter */, - char type /* transform type */) -/*< allocate space >*/ -{ - int i,j; - float wi; - - inv = inv1; - unit = unit1; - - n = n1; - for (nt=1; nt < n2; nt *= 2) ; - t = sf_floatalloc2(n,nt); - predict_init (n, nt, eps*eps, 1); - - t1 = sf_floatalloc(n); - t2 = sf_floatalloc(n); - - switch(type) { - case 'b': - transform = biorthogonal; - break; - default: - sf_error("Unknown wavelet type=%c",type); - break; - } - - if (unit) { - w = sf_floatalloc(nt); - - w[0] = sqrtf((float) nt); - wi = 0.5; - for (j=1; j <= nt/2; j *= 2, wi *= 2) { - for (i=0; i < nt-j; i += 2*j) { - w[i+j] = sqrtf(wi); - } - } - } -} - -void seislet97_set(float **dip /* local slope */) -/*< set local slope >*/ -{ - d = dip; -} - -void seislet97_close(void) -/*< deallocate space >*/ -{ - free (*t); - free (t); - free (t1); - free (t2); - if (unit) free(w); - predict_close(); -} - -void seislet97_lop(bool adj, bool add, int nx, int ny, float *x, float *y) -/*< linear operator >*/ -{ - int it, i, j, i1; - - sf_adjnull (adj,add,nx,ny,x,y); - - if (adj) { - for (it=0; it < nx; it++) { - t[0][it] = y[it]; - } - for (it=nx; it < n*nt; it++) { - t[0][it] = 0.; - } - } else { - for (i1=0; i1 < n; i1++) { - t[0][i1] = x[i1]; - } - it = n; - for (j=nt/2; j >= 1; j /= 2) { - for (i=0; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - if (it < ny) { - t[i+j][i1]=x[it]; - it++; - } else { - t[i+j][i1]=0.; - } - } - } - } - - if (unit) { - for (it=0; it < nt; it++) { - for (i1=0; i1 < n; i1++) { - if (inv) { - t[it][i1] /= w[it]; - } else { - t[it][i1] *= w[it]; - } - } - } - } - } - - transform(adj); - - if (adj) { - if (unit) { - for (it=0; it < nt; it++) { - for (i1=0; i1 < n; i1++) { - t[it][i1] *= w[it]; - } - } - } - - for (i1=0; i1 < n; i1++) { - x[i1] += t[0][i1]; - } - it = n; - for (j=nt/2; j >= 1; j /= 2) { - for (i=0; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - x[it] += t[i+j][i1]; - it++; - if (it >= ny) return; - } - } - } - } else { - for (it=0; it < nx; it++) { - y[it] += t[0][it]; - } - } -} diff --git a/user/nobody/seisletoper.c b/user/nobody/seisletoper.c deleted file mode 100644 index 4b615becb7..0000000000 --- a/user/nobody/seisletoper.c +++ /dev/null @@ -1,906 +0,0 @@ -/* Seislet operator for data interpolation */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include - -#include "seisletoper.h" -#include "predict.h" - -static int nt, n; -static bool inv, unit; -static float **t, **d, *t1, *t2, *w; -static void (*transform)(bool); - -static void predict_forw(bool adj, float *tt, int i, int j) -/* Predict forward */ -{ - int i2; - - for (i2=i; i2 < i+j; i2++) { - predict_step(adj,true,tt,d[i2]); - } -} - -static void predict_back(bool adj, float *tt, int i, int j) -/* Predict backward */ -{ - int i2; - - for (i2=i+j-1; i2 >= i; i2--) { - predict_step(adj,false,tt,d[i2]); - } -} - -static void haar(bool adj) -/* Lifting Haar transform in place */ -{ - int i, j, i1; - - if (adj) { - for (j=1; j <= nt/2; j *= 2) { - for (i=0; i < nt-j; i += 2*j) { - if (inv) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); /* *z0 */ - for (i1=0; i1 < n; i1++) { - t[i+j][i1] -= t1[i1]; - /* d = o - P[e] */ - } - for (i1=0; i1 < n; i1++) { - t2[i1] = t[i+j][i1]; - } - predict_back(false,t2,i,j); /* 1/z0 */ - for (i1=0; i1 < n; i1++) { - t[i][i1] += t2[i1]/2; - /* s = e + U[d] */ - } - } else { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - } - predict_forw(true,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += t1[i1]; - /* s = e + P'[d] */ - } - for (i1=0; i1 < n; i1++) { - t2[i1] = -t[i][i1]/2; - } - predict_back(true,t2,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += t2[i1]; - /* d = o - U'[s] */ - } - } - } - } - } else { - for (j=nt/2; j >= 1; j /= 2) { - for (i=0; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t2[i1] = t[i+j][i1]; - } - predict_back(false,t2,i,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] -= t2[i1]/2; - /* e = s - U[d] */ - } - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += t1[i1]; - /* o = d + P[e] */ - } - } - } - } -} - -static void linear(bool adj) -{ - int i, j, i1; - - if (adj) { - for (j=1; j <= nt/2; j *= 2) { - if (inv) { - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(false,t1,i,j); - predict_back(false,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] -= (t1[i1]+t2[i1])/2; - /* d = o - P[e] */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] -= t1[i1]; - /* d = o - P[e] */ - } - } - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(false,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += t1[i1]/2; - } - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(false,t1,i,j); - predict_forw(false,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])/4; - /* s = e + U d */ - } - } - } else { - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(true,t1,i,j); - predict_back(true,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] -= (t1[i1]+t2[i1])/2; - /* d = o - P[e] */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(true,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] -= t1[i1]; - /* d = o - P[e] */ - } - } - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(true,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += t1[i1]/2; - } - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(true,t1,i,j); - predict_forw(true,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])/4; - /* s = e + U d */ - } - } - } - } - } else { - for (j=nt/2; j >= 1; j /= 2) { - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(false,t1,i,j); - predict_forw(false,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] -= (t1[i1]+t2[i1])/4; - /* e = s - U d */ - } - } - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(false,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] -= t1[i1]/2; - } - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(false,t1,i,j); - predict_back(false,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])/2; - /* o = d + P[e] */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += t1[i1]; - /* o = d + P[e] */ - } - } - } - } -} - -static void biorthogonal(bool adj) -{ - int i, j, i1; - float a; - if (adj) { - for (j=1; j <= nt/2; j *= 2) { - if (inv) { - - a = -1.586134342f; - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(false,t1,i,j); - predict_back(false,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])*a; - /* Predict 1 */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += 2*a*t1[i1]; /*right boundary*/ - } - } - a= -0.05298011854f; - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(false,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += 2*a*t1[i1]; /*left boundary*/ - } - - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(false,t1,i,j); - predict_forw(false,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])*a; - /* Update 1 */ - } - } - /* Step 1 */ - a = 0.8829110762f; - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(false,t1,i,j); - predict_back(false,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])*a; - /* Predict 2 */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += 2*a*t1[i1]; /*right boundary*/ - } - } - a= 0.4435068522f; - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(false,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += 2*a*t1[i1]; /*left boundary*/ - } - - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(false,t1,i,j); - predict_forw(false,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])*a; - /* Update 2 */ - } - } - /* Step 2 */ - - - a= 1/(1.230174105f); - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] *= a; - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] *= a; /*right boundary*/ - } - } - for (i1=0; i1 < n; i1++) { - t[0][i1] /= a; /*left boundary*/ - } - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] /= a; - } - } - /* Scale */ - } else { - - a = -1.586134342f; - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(true,t1,i,j); - predict_back(true,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])*a; - /* Predict 1 */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(true,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += 2*a*t1[i1]; /*right boundary*/ - } - } - a= -0.05298011854f; - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(true,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += 2*a*t1[i1]; /*left boundary*/ - } - - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(true,t1,i,j); - predict_forw(true,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])*a; - /* Update 1 */ - } - } - /* Step 1 */ - a = 0.8829110762f; - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(true,t1,i,j); - predict_back(true,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])*a; - /* Predict 2 */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(true,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += 2*a*t1[i1]; /*right boundary*/ - } - } - a= 0.4435068522f; - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(true,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += 2*a*t1[i1]; /*left boundary*/ - } - - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(true,t1,i,j); - predict_forw(true,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])*a; - /* Update 2 */ - } - } - /* Step 2 */ - a= 1/(1.230174105f); - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] *= a; - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] *= a; /*right boundary*/ - } - } - for (i1=0; i1 < n; i1++) { - t[0][i1] /= a; /*left boundary*/ - } - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] /= a; - } - } - /* Scale */ - } - - } - } else { - for (j=nt/2; j >= 1; j /= 2) { - - a= 1.230174105f; - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] /= a; - } - } - for (i1=0; i1 < n; i1++) { - t[0][i1] /= a; /*left boundary*/ - } - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] *= a; - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t[i+j][i1] *= a; /*right boundary*/ - } - } - /* Undo Scale */ - - a= -0.4435068522f; - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(false,t1,i,j); - predict_forw(false,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])*a; - /* Undo Update 2 */ - } - } - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(false,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += 2*a*t1[i1]; /*left boundary*/ - } - - a = -0.8829110762f; - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(false,t1,i,j); - predict_back(false,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])*a; - /* Undo Predict 2 */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += 2*a*t1[i1]; /*right boundary*/ - } - } - /* Undo Step 2 */ - - a= 0.05298011854f; - for (i=2*j; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i+j][i1]; - t2[i1] = t[i-j][i1]; - } - predict_back(false,t1,i,j); - predict_forw(false,t2,i-j,j); - for (i1=0; i1 < n; i1++) { - t[i][i1] += (t1[i1]+t2[i1])*a; - /* Undo Update 1 */ - } - } - for (i1=0; i1 < n; i1++) { - t1[i1] = t[j][i1]; - } - predict_back(false,t1,0,j); - for (i1=0; i1 < n; i1++) { - t[0][i1] += 2*a*t1[i1]; /*left boundary*/ - } - a = 1.586134342f; - for (i=0; i < nt-2*j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - t2[i1] = t[i+2*j][i1]; - } - predict_forw(false,t1,i,j); - predict_back(false,t2,i+j,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += (t1[i1]+t2[i1])*a; - /* Undo Predict 1 */ - } - } - if (i+j < nt) { - for (i1=0; i1 < n; i1++) { - t1[i1] = t[i][i1]; - } - predict_forw(false,t1,i,j); - for (i1=0; i1 < n; i1++) { - t[i+j][i1] += 2*a*t1[i1]; /*right boundary*/ - } - } - /* Undo Step 1 */ - } - } -} - - -void seislet_init(int n1 /* trace length */, - int n2 /* number of traces */, - bool inv1 /* inversion flag */, - bool unit1 /* weighting flag */, - float eps /* regularization parameter */, - char type /* transform type */) -/*< allocate space >*/ -{ - int i,j; - float wi; - - inv = inv1; - unit = unit1; - - n = n1; - for (nt=1; nt < n2; nt *= 2) ; - t = sf_floatalloc2(n,nt); - predict_init (n, nt, eps*eps, 1); - - t1 = sf_floatalloc(n); - t2 = sf_floatalloc(n); - - switch(type) { - case 'h': - transform = haar; - break; - case 'l': - transform = linear; - break; - case 'b': - transform = biorthogonal; - break; - default: - sf_error("Unknown wavelet type=%c",type); - break; - } - - if (unit) { - w = sf_floatalloc(nt); - - w[0] = sqrtf((float) nt); - wi = 0.5; - for (j=1; j <= nt/2; j *= 2, wi *= 2) { - for (i=0; i < nt-j; i += 2*j) { - w[i+j] = sqrtf(wi); - } - } - } -} - -void seislet_set(float **dip /* local slope */) -/*< set local slope >*/ -{ - d = dip; -} - -void seislet_close(void) -/*< deallocate space >*/ -{ - free (*t); - free (t); - free (t1); - free (t2); - if (unit) free(w); - predict_close(); -} - -void seislet_lop(bool adj, bool add, int nx, int ny, float *x, float *y) -/*< linear operator >*/ -{ - int it, i, j, i1; - - sf_adjnull (adj,add,nx,ny,x,y); - - if (adj) { - for (it=0; it < nx; it++) { - t[0][it] = y[it]; - } - for (it=nx; it < n*nt; it++) { - t[0][it] = 0.; - } - } else { - for (i1=0; i1 < n; i1++) { - t[0][i1] = x[i1]; - } - it = n; - for (j=nt/2; j >= 1; j /= 2) { - for (i=0; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - if (it < ny) { - t[i+j][i1]=x[it]; - it++; - } else { - t[i+j][i1]=0.; - } - } - } - } - - if (unit) { - for (it=0; it < nt; it++) { - for (i1=0; i1 < n; i1++) { - if (inv) { - t[it][i1] /= w[it]; - } else { - t[it][i1] *= w[it]; - } - } - } - } - } - - transform(adj); - - if (adj) { - if (unit) { - for (it=0; it < nt; it++) { - for (i1=0; i1 < n; i1++) { - t[it][i1] *= w[it]; - } - } - } - - for (i1=0; i1 < n; i1++) { - x[i1] += t[0][i1]; - } - it = n; - for (j=nt/2; j >= 1; j /= 2) { - for (i=0; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - x[it] += t[i+j][i1]; - it++; - if (it >= ny) return; - } - } - } - } else { - for (it=0; it < nx; it++) { - y[it] += t[0][it]; - } - } -} - -void seislet_destruct(bool adj, bool add, int nx, int ny, float *x, float *y) -/*< linear operator >*/ -{ - int it, i, j, i1; - inv=(bool)!adj; - - sf_adjnull (adj,add,nx,ny,x,y); - - if (adj) { - for (i1=0; i1 < n; i1++) { - t[0][i1] = y[i1]; - } - it = n; - for (j=nt/2; j >= 1; j /= 2) { - for (i=0; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - if (it < ny) { - t[i+j][i1]=y[it]; - it++; - } else { - t[i+j][i1]=0.; - } - } - } - } - - if (unit) { - for (it=0; it < nt; it++) { - for (i1=0; i1 < n; i1++) { - if (inv) { - t[it][i1] /= w[it]; - } else { - t[it][i1] *= w[it]; - } - } - } - } - - } else { - for (it=0; it < nx; it++) { - t[0][it] = x[it]; - } - for (it=nx; it < n*nt; it++) { - t[0][it] = 0.; - } - - } - - transform((bool)!adj); - - if (adj) { - for (it=0; it < nx; it++) { - x[it] += t[0][it]; - } - } else { - if (unit) { - for (it=0; it < nt; it++) { - for (i1=0; i1 < n; i1++) { - t[it][i1] *= w[it]; - } - } - } - - for (i1=0; i1 < n; i1++) { - y[i1] += t[0][i1]; - } - it = n; - for (j=nt/2; j >= 1; j /= 2) { - for (i=0; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - y[it] += t[i+j][i1]; - it++; - if (it >= ny) return; - } - } - } - - } -} - -void seislet_construct(bool adj, bool add, int nx, int ny, float *x, float *y) -/*< linear operator >*/ -{ - int it, i, j, i1; - inv=(bool)!adj; - - sf_adjnull (adj,add,nx,ny,x,y); - - if (adj) { - for (it=0; it < nx; it++) { - t[0][it] = y[it]; - } - for (it=nx; it < n*nt; it++) { - t[0][it] = 0.; - } - } else { - for (i1=0; i1 < n; i1++) { - t[0][i1] = x[i1]; - } - it = n; - for (j=nt/2; j >= 1; j /= 2) { - for (i=0; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - if (it < ny) { - t[i+j][i1]=x[it]; - it++; - } else { - t[i+j][i1]=0.; - } - } - } - } - - if (unit) { - for (it=0; it < nt; it++) { - for (i1=0; i1 < n; i1++) { - if (inv) { - t[it][i1] /= w[it]; - } else { - t[it][i1] *= w[it]; - } - } - } - } - } - - transform(adj); - - if (adj) { - if (unit) { - for (it=0; it < nt; it++) { - for (i1=0; i1 < n; i1++) { - t[it][i1] *= w[it]; - } - } - } - - for (i1=0; i1 < n; i1++) { - x[i1] += t[0][i1]; - } - it = n; - for (j=nt/2; j >= 1; j /= 2) { - for (i=0; i < nt-j; i += 2*j) { - for (i1=0; i1 < n; i1++) { - x[it] += t[i+j][i1]; - it++; - if (it >= ny) return; - } - } - } - } else { - for (it=0; it < nx; it++) { - y[it] += t[0][it]; - } - } - -} - -/* $Id$ */ diff --git a/user/nobody/sinsl.c b/user/nobody/sinsl.c deleted file mode 100644 index ef3566599e..0000000000 --- a/user/nobody/sinsl.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Shaping complex sinusoids */ -/* - Copyright (C) 2009 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -/*^*/ - -#include "sin.h" - -static int n,k,n2; -static float amp; -static sf_complex *tmp1, *tmp2; - -void sinsl_init(int m /* data dimensions */, - int rect /* triangle radius */, - sf_complex z0 /* center frequency */) -/*< initialize >*/ -{ - n = m; - n2 = n+2*rect; - - tmp1 = sf_complexalloc(n2); - tmp2 = sf_complexalloc(n2); - - k = rect; - amp = 1.0/rect; - - sinpred_init (z0,n,k); -} - -void sinsl_close(void) -/*< free allocated storage >*/ -{ - free(tmp1); - free(tmp2); -} - -void sinsl_lop(bool adj, bool add, int nx, int ny, - sf_complex* x, sf_complex* y) -/*< linear operator >*/ -{ - int i; - sf_complex *inp, *out; - - if (nx != n || ny !=n) - sf_error("%s: size problem",__FILE__); - - sf_cadjnull(adj,add,nx,ny,x,y); - - if (adj) { - inp = y; - out = x; - } else { - inp = x; - out = y; - } - - for (i=0; i < k; i++) { - tmp1[i] = sf_cmplx(0.,0.); - tmp1[i+k+n] = sf_cmplx(0.,0.); - } - for (i=0; i < n; i++) { -#ifdef SF_HAS_COMPLEX_H - tmp1[i+k] = amp*inp[i]; -#else - tmp1[i+k] = sf_crmul(inp[i],amp); -#endif - } - - sinpredicter_lop (true, false, n2, n2, tmp2, tmp1); - sinsubtracter_lop (true, false, n2, n2, tmp1, tmp2); - sinsubtracter_lop (false, false, n2, n2, tmp1, tmp2); - sinpredicter_lop (false, false, n2, n2, tmp2, tmp1); - - for (i=0; i < n; i++) { -#ifdef SF_HAS_COMPLEX_H - out[i] += amp*tmp1[i+k]; -#else - out[i] = sf_cadd(out[i], sf_crmul(tmp1[i+k],amp)); -#endif - } -} diff --git a/user/nobody/slinint.c b/user/nobody/slinint.c deleted file mode 100644 index 1db7fed9b1..0000000000 --- a/user/nobody/slinint.c +++ /dev/null @@ -1,54 +0,0 @@ -#include -/*^*/ - -#include "slinint.h" - -float a, b; - -void slinint_init(float t) -/*< initialize with shift >*/ -{ - a = 1./(1.-t); - b = t; -} - -void slinint_pre(int n, float *x) -/*< prefilter x[n] for interpolation >*/ -{ - int i; - float y0, y1; - - y1 = 0.; - for (i=0; i < n; i++) { - y0 = a*(x[i] - b*y1); - x[i] = y1 = y0; - } -} - -bool slinint_int(int n, float *c, float x, float *y) -/*< interpolate c[n] to find y(x), return true on success >*/ -{ - int i; - - x -= b; - i = floorf(x); - - if (i < 0 || i > n-1) return false; - - x -= i; - - if (x == 0.) { - *y = c[i]; - return true; - } - - if (i == n-1) return false; - - *y = (1.-x)*c[i]+x*c[i+1]; - return true; -} - - - - - diff --git a/user/nobody/slow3.c b/user/nobody/slow3.c deleted file mode 100644 index 5173722df0..0000000000 --- a/user/nobody/slow3.c +++ /dev/null @@ -1,150 +0,0 @@ -/* Computing reference slownesses */ -/* - Copyright (C) 2007 Colorado School of Mines - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include "slow3.h" - -#include "weutil.h" -/*^*/ - -#define SOOP(a) for(ily=0;ilyaly.n;ily++){ \ - for(ilx=0;ilxalx.n;ilx++){ \ - {a} \ - }} - -/*------------------------------------------------------------*/ -slo3d slow3_init(cub3d cub, - fslice slice_, /* slowness slice */ - int nrmax, /* maximum number of references */ - float dsmax, - float twoway - ) -/*< initialize slowness >*/ -{ - int imz, jj; - int ompith=0; - - /*------------------------------------------------------------*/ - slo3d slo; - slo = (slo3d) sf_alloc(1,sizeof(*slo)); - - slo->slice=slice_; - slo->nrmax=nrmax; - slo->dsmax=dsmax; - - if(twoway) { slo->twoway = 2; - } else { slo->twoway = 1; - } - - slo->ss = sf_floatalloc3(cub->alx.n,cub->aly.n,cub->ompnth); /* slowness */ - slo->so = sf_floatalloc3(cub->alx.n,cub->aly.n,cub->ompnth); /* slowness */ - slo->sm = sf_floatalloc2(slo->nrmax,cub->amz.n); /* ref slowness squared */ - slo->nr = sf_intalloc (cub->amz.n); /* nr of ref slownesses */ - - for (imz=0; imzamz.n; imz++) { - fslice_get(slo->slice,imz,slo->ss[0][0]); - slow3_twoway(cub,slo,slo->ss,ompith); - - slo->nr[imz] = slow3(slo->nrmax, - slo->dsmax, - cub->alx.n*cub->aly.n, - slo->ss[0][0], - slo->sm[imz]); - } - for (imz=0; imzamz.n-1; imz++) { - for (jj=0; jjnr[imz]; jj++) { - slo->sm[imz][jj] = 0.5*(slo->sm[imz][jj]+slo->sm[imz+1][jj]); - } - } - - return slo; -} - -/*------------------------------------------------------------*/ -int slow3(int nr /* maximum number of references */, - float ds /* minimum slowness separation */, - int ns /* number of slownesses */, - const float* ss /* [ns] slowness array */, - float* sr /* [nr] reference slownesses squared */) -/*< compute reference slownesses, return their number >*/ -{ - int is,jr,ir; - float smin, smax, s, s2=0., qr, *ss2; - - ss2 = sf_floatalloc(ns); - for (is=0; is ds) { - sr [jr] = s*s; - s2 = s; - jr++; - } - } - - free(ss2); - return jr; -} - -/*------------------------------------------------------------*/ -void slow3_close( slo3d slo) -/*< close slowness >*/ -{ - free(**slo->ss); free( *slo->ss); free( slo->ss); - free(**slo->so); free( *slo->so); free( slo->so); - ; free( *slo->sm); free( slo->sm); - ; free( slo->nr); -} - -/*------------------------------------------------------------*/ -void slow3_advance( cub3d cub, - slo3d slo, - int ompith) -/*< close slowness >*/ -{ - int ilx,ily; - - SOOP( slo->so[ompith][ily][ilx] = slo->ss[ompith][ily][ilx]; ); - -} - -/*------------------------------------------------------------*/ -void slow3_twoway( cub3d cub, - slo3d slo, - float ***slow, - int ompith) -/*< close slowness >*/ -{ - int ilx,ily; - - SOOP( slow[ompith][ily][ilx]*= slo->twoway; ); - -} - - diff --git a/user/nobody/split1.c b/user/nobody/split1.c deleted file mode 100644 index 3e5e30f3cb..0000000000 --- a/user/nobody/split1.c +++ /dev/null @@ -1,170 +0,0 @@ -/* 2-D split-step migration/modeling */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include -/*^*/ - -#include "split1.h" - -void split1 (bool verb /* verbosity flag */, - bool inv /* migration/modeling flag */, - float eps /* stability factor */, - int nw, float dw /* frequency */, - int nz, float dz /* depth */, - int nx, float dx /* midpoint */, - float **vt /* slowness [nx][nz] */, - float *v /* reference slowness [nz] */, - float complex **cp /* data [nx][nw] */, - float **q /* image [nx][nz] */) -/*< Apply migration/modeling >*/ -{ - int nk,iz,iw,ix,jx; - float k,dk,fk; - float complex cshift,*pp,w2; - kiss_fft_cfg forw, invs; - - /* determine wavenumber sampling, pad by 2 */ - nk = nx*2; - nk *= 2; - dk = 2.0*SF_PI/(nk*dx); - fk = -SF_PI/dx; - - forw = kiss_fft_alloc(nk,0,NULL,NULL); - invs = kiss_fft_alloc(nk,1,NULL,NULL); - if (NULL == forw || NULL == invs) - sf_error("%s: KISS FFT allocation error",__FILE__); - - /* allocate workspace */ - pp = sf_complexalloc (nk); - - if (!inv) { /* prepare image for migration */ - for (ix=0; ix=0; iz--) { - kiss_fft(forw,(const kiss_fft_cpx *) pp, - (kiss_fft_cpx *) pp); - - for (ix=0; ix - -#include -/*^*/ - -#include "split3.h" - -void split3 (bool verb /* verbosity flag */, - bool inv /* migration/modeling flag */, - float eps /* stability factor */, - int nw, float dw /* frequency */, - int nz, float dz /* depth */, - int nx, float dx /* cross-line midpoint */, - int ny, float dy /* in-line midpoint */, - float ***vt /* slowness [nx][ny][nz] */, - float *v /* reference slowness [nz] */, - float complex ***cp /* data [nx][ny][nw] */, - float ***q /* image [nx][ny][nz] */) -/*< Apply migration/modeling >*/ -{ - int nkx,nky,iz,iw,ix,jx,iy,jy; - float kx,dkx,fkx,ky,dky,fky; - float complex cshift,**pp,w2, *ctrace; - kiss_fft_cfg xforw, xinvs, yforw, yinvs; - - /* determine wavenumber sampling, pad by 2 */ - nkx = nx*2; - nkx *= 2; - dkx = 2.0*SF_PI/(nkx*dx); - fkx = -SF_PI/dx; - - nky = ny*2; - nky *= 2; - dky = 2.0*SF_PI/(nky*dy); - fky = -SF_PI/dy; - - xforw = kiss_fft_alloc(nkx,0,NULL,NULL); - xinvs = kiss_fft_alloc(nkx,1,NULL,NULL); - yforw = kiss_fft_alloc(nky,0,NULL,NULL); - yinvs = kiss_fft_alloc(nky,1,NULL,NULL); - - if (NULL == xforw || NULL == xinvs || NULL == yforw || NULL == yinvs) - sf_error("%s: KISS FFT allocation error",__FILE__); - - /* allocate workspace */ - pp = sf_complexalloc2 (nky,nkx); - ctrace = sf_complexalloc(nkx); - - if (!inv) { /* prepare image for migration */ - for (ix=0; ix=0; iz--) { - for (iy=0; iy < nky; iy++) { - kiss_fft_stride(xforw,(const kiss_fft_cpx *) (pp[0]+iy), - (kiss_fft_cpx *) ctrace,nky); - for (ix=0; ix - -#include -/*^*/ - -#include "srmig.h" -#include "taper.h" -#include "slowref.h" -#include "ssr.h" -#include "img.h" - -#include "slice.h" -/*^*/ - -#define SOOP(a) for(ily=0;ily*/ -{ - float dsmax; - - verb=verb_; - eps = eps_; - - aw = sf_nod(aw_); - amx = sf_nod(amx_); - amy = sf_nod(amy_); - amz = sf_nod(amz_); - alx = sf_nod(alx_); - aly = sf_nod(aly_); - ae = sf_nod(ae_); - - /* from hertz to radian */ - aw.d *= 2.*SF_PI; - aw.o *= 2.*SF_PI; - - dsmax = dtmax/amz.d; - - /* SSR */ - ssr_init(amz_ , - amx_,amy_, - alx_,aly_, - pmx ,pmy, - tmx ,tmy, - dsmax); - - /* precompute taper */ - taper2_init(amy.n, - amx.n, - SF_MIN(tmy,amy.n-1), - SF_MIN(tmx,amx.n-1), - true, - true); - - /* allocate wavefield storage */ - ww_s = sf_complexalloc2(amx.n,amy.n); - ww_r = sf_complexalloc2(amx.n,amy.n); -} -/*------------------------------------------------------------*/ - -void srmig_pw_init(float dtmax, - int nrmax, /* maximum number of references */ - fslice slow_) -/*< initialize P-wave slowness >*/ -{ - int imz, jj; - float dsmax; - - dsmax = dtmax/amz.d; - - /*------------------------------------------------------------*/ - /* slowness: downgoing wavefield */ - ss = sf_floatalloc2(alx.n,aly.n); /* slowness */ - so = sf_floatalloc2(alx.n,aly.n); /* slowness */ - sm = sf_floatalloc2(nrmax,amz.n); /* ref slowness squared */ - nr = sf_intalloc (amz.n); /* nr of ref slownesses */ - slow = slow_; - for (imz=0; imz*/ -{ - int imz, jj; - float dsmax; - - dsmax = dtmax/amz.d; - - /*------------------------------------------------------------*/ - /* slowness: downgoing wavefield */ - ss_s = sf_floatalloc2(alx.n,aly.n); /* slowness */ - so_s = sf_floatalloc2(alx.n,aly.n); /* slowness */ - sm_s = sf_floatalloc2(nrmax,amz.n); /* ref slowness squared */ - nr_s = sf_intalloc (amz.n); /* nr of ref slownesses */ - slow_s = slow_s_; - for (imz=0; imz*/ -{ - free( *ss); free( ss); - free( *so); free( so); - free( *sm); free( sm); - ; free( nr); -} - -/*------------------------------------------------------------*/ - -void srmig_cw_close(void) -/*< free slowness storage (C waves) >*/ -{ - free( *ss_s); free( ss_s); - free( *so_s); free( so_s); - free( *sm_s); free( sm_s); - ; free( nr_s); - - free( *ss_r); free( ss_r); - free( *so_r); free( so_r); - free( *sm_r); free( sm_r); - ; free( nr_r); -} - -/*------------------------------------------------------------*/ - -void srmig_close(void) -/*< free allocated storage >*/ -{ - ssr_close(); - - free( *ww_s); free( ww_s); - free( *ww_r); free( ww_r); -} - -/*------------------------------------------------------------*/ -void srmig_pw(fslice sdat /* source data [nw][ny][nx] */, - fslice rdat /* receiver data [nw][ny][nx] */, - fslice imag /* image [nz][ny][nx] */, - void (*imop)( fslice, int) - ) -/*< Apply S/R migration >*/ -{ - int imz,iw,ilx,ily,ie; - sf_complex ws,wr; - - for (ie=0; ie*/ -{ - int imz,iw,ilx,ily,ie; - sf_complex ws,wr; - - for (ie=0; ie - -#include -/*^*/ - -#include "srmig2.h" -#include "taper.h" -#include "slowref.h" -#include "ssr.h" -#include "img2.h" - -#include "slice.h" -/*^*/ - -#define SOOP(a) for(ily=0;ily*/ -{ - float dsmax; - - verb=verb_; - eps = eps_; - - aw = sf_nod(aw_); - amx = sf_nod(amx_); - amy = sf_nod(amy_); - amz = sf_nod(amz_); - alx = sf_nod(alx_); - aly = sf_nod(aly_); - ae = sf_nod(ae_); - - /* from hertz to radian */ - aw.d *= 2.*SF_PI; - aw.o *= 2.*SF_PI; - - dsmax = dtmax/amz.d; - - /* SSR */ - ssr_init(amz_ , - amx_,amy_, - alx_,aly_, - pmx ,pmy, - tmx ,tmy, - dsmax); - - /* precompute taper */ - taper2_init(amy.n, - amx.n, - SF_MIN(tmy,amy.n-1), - SF_MIN(tmx,amx.n-1), - true, - true); - - /* allocate wavefield storage */ - ww_s = sf_complexalloc2(amx.n,amy.n); - ww_r = sf_complexalloc2(amx.n,amy.n); -} -/*------------------------------------------------------------*/ - -void srmig2_pw_init(float dtmax, - int nrmax, /* maximum number of references */ - fslice slow_) -/*< initialize P-wave slowness >*/ -{ - int imz, jj; - float dsmax; - - dsmax = dtmax/amz.d; - - /*------------------------------------------------------------*/ - /* slowness: downgoing wavefield */ - ss = sf_floatalloc2(alx.n,aly.n); /* slowness */ - so = sf_floatalloc2(alx.n,aly.n); /* slowness */ - sm = sf_floatalloc2(nrmax,amz.n); /* ref slowness squared */ - nr = sf_intalloc (amz.n); /* nr of ref slownesses */ - slow = slow_; - for (imz=0; imz*/ -{ - int imz, jj; - float dsmax; - - dsmax = dtmax/amz.d; - - /*------------------------------------------------------------*/ - /* slowness: downgoing wavefield */ - ss_s = sf_floatalloc2(alx.n,aly.n); /* slowness */ - so_s = sf_floatalloc2(alx.n,aly.n); /* slowness */ - sm_s = sf_floatalloc2(nrmax,amz.n); /* ref slowness squared */ - nr_s = sf_intalloc (amz.n); /* nr of ref slownesses */ - slow_s = slow_s_; - for (imz=0; imz*/ -{ - free( *ss); free( ss); - free( *so); free( so); - free( *sm); free( sm); - ; free( nr); -} - -/*------------------------------------------------------------*/ -void srmig2_cw_close(void) -/*< free slowness storage (C waves) >*/ -{ - free( *ss_s); free( ss_s); - free( *so_s); free( so_s); - free( *sm_s); free( sm_s); - ; free( nr_s); - - free( *ss_r); free( ss_r); - free( *so_r); free( so_r); - free( *sm_r); free( sm_r); - ; free( nr_r); -} - -/*------------------------------------------------------------*/ -void srmig2_close(void) -/*< free allocated storage >*/ -{ - ssr_close(); - - free( *ww_s); free( ww_s); - free( *ww_r); free( ww_r); -} - -/*------------------------------------------------------------*/ -void srmig2_pw(fslice sdat /* source data [nw][ny][nx] */, - fslice rdat /* receiver data [nw][ny][nx] */, - fslice imag /* image [nz][ny][nx] */, - fslice cigs, - void (*imop)(int) - ) -/*< Apply S/R migration >*/ -{ - int imz,iw,ilx,ily,ie; - sf_complex ws,wr; - - for (ie=0; ie*/ -{ - int imz,iw,ilx,ily,ie; - sf_complex ws,wr; - - for (ie=0; ie - -#include -/*^*/ - -#include "srmod.h" -#include "taper.h" -#include "slowref.h" -#include "ssr.h" - -#include "slice.h" -/*^*/ - -#define LOOP(a) for( iy=0; iy< ay.n; iy++){ \ - for( ix=0; ix< ax.n; ix++){ {a} }} -#define SOOP(a) for(ily=0;ily*/ -{ - float dsmax; - - verb = verb_; - incore = incore_; - eps = eps_; - - az = sf_nod(az_); - aw = sf_nod(aw_); - ax = sf_nod(ax_); - ay = sf_nod(ay_); - alx= sf_nod(alx_); - aly= sf_nod(aly_); - - /* from hertz to radian */ - aw.d *= 2.*SF_PI; - aw.o *= 2.*SF_PI; - - dsmax = dtmax/az.d; - - /* SSR */ - ssr_init(az_ , - ax_ ,ay_, - alx_,aly_, - px ,py, - tx ,ty, - dsmax); - - /* precompute taper */ - taper2_init(ay.n, - ax.n, - SF_MIN(ty,ay.n-1), - SF_MIN(tx,ax.n-1), - true, - true); - - /* compute reference slowness */ - ss = sf_floatalloc2(alx.n,aly.n); /* slowness */ - so = sf_floatalloc2(alx.n,aly.n); /* slowness */ - - ww_s = sf_complexalloc2(ax.n,ay.n); /* wavefield storage */ - ww_r = sf_complexalloc2(ax.n,ay.n); - rr = sf_floatalloc2 (ax.n,ay.n); /* reflectivity storage */ - - if(incore) { - www = sf_complexalloc3(ax.n,ay.n,az.n); - rrr = sf_floatalloc3 (ax.n,ay.n,az.n); - } else { - wtmp = fslice_init( ax.n * ay.n, az.n,sizeof(sf_complex)); - } -} - -void srmod_pw_init( float dtmax, - int nrmax /* maximum number of references */, - fslice slow_) -/*< initialize P-wave S/R modeling >*/ -{ - int iz, jj; - float dsmax; - - dsmax = dtmax/az.d; - - sm= sf_floatalloc2 (nrmax,az.n); /* ref slowness squared*/ - nr= sf_intalloc (az.n); /* nr of ref slownesses */ - slow= slow_; - for (iz=0; iz*/ -{ - int iz, jj; - float dsmax; - - dsmax = dtmax/az.d; - - /*------------------------------------------------------------*/ - /* slowness: downgoing wavefield */ - sm_s= sf_floatalloc2 (nrmax,az.n); /* ref slowness squared*/ - nr_s= sf_intalloc (az.n); /* nr of ref slownesses */ - slow_s= slow_s_; - for (iz=0; iz*/ -{ - free( *sm); free( sm); - ; free( nr); - - if(incore) { - free(**ssp); free(*ssp); free(ssp); - } -} - -void srmod_cw_close(void) -/*< free C-wave slowness storage >*/ -{ - free( *sm_s); free( sm_s); - ; free( nr_s); - free( *sm_r); free( sm_r); - ; free( nr_r); - - if(incore) { - free(**ssp); free(*ssp); free(ssp); - free(**sss); free(*sss); free(sss); - } -} - -void srmod_close(void) -/*< free allocated storage >*/ -{ - ssr_close(); - - free( *ss); free( ss); - free( *so); free( so); - - free( *ww_s); free( ww_s); - free( *ww_r); free( ww_r); - free( *rr ); free( rr ); - - if(incore) { - free(**www); free( *www); free( www); - free(**rrr); free( *rrr); free( rrr); - } else { - fslice_close(wtmp); - } -} - -/*------------------------------------------------------------*/ -void srmod_pw(fslice dwfl /* source data [nw][ny][nx] */, - fslice uwfl /* receiver data [nw][ny][nx] */, - fslice refl - ) -/*< Apply P-wave S/R modeling >*/ -{ - int iz,iw,ix,iy,ilx,ily; - sf_complex w; - - if(incore) { - - /* read reflectivity */ - for( iz=0; iz0; iz--) { -#ifdef SF_HAS_COMPLEX_H - LOOP( ww_r[iy][ix] += www[iz][iy][ix]*rrr[iz][iy][ix]; ); -#else - LOOP( ww_r[iy][ix] = sf_cadd(ww_r[iy][ix], - sf_crmul(www[iz][iy][ix], - rrr[iz][iy][ix])); ); -#endif - ssr_ssf(w,ww_r,ssp[iz],ssp[iz-1],nr[iz-1],sm[iz-1]); - } - - fslice_put(uwfl,iw,ww_r[0]); - } /* iw */ - - } else { - - for (iw=0; iw0; iz--) { - fslice_get(slow,iz-1,ss[0]); - - fslice_get(wtmp,iz,ww_s[0]); - fslice_get(refl,iz,rr[0]); /* reflectivity */ - -#ifdef SF_HAS_COMPLEX_H - LOOP( ww_s[iy][ix] *= rr [iy][ix]; - ww_r[iy][ix] += ww_s[iy][ix]; ); -#else - LOOP( ww_s[iy][ix] = sf_crmul(ww_s[iy][ix],rr[iy][ix]); - ww_r[iy][ix] = sf_cadd(ww_r[iy][ix],ww_s[iy][ix]); ); -#endif - ssr_ssf(w,ww_r,so,ss,nr[iz-1],sm[iz-1]); - SOOP( so[ily][ilx] = ss[ily][ilx]; ); - } - fslice_put(uwfl,iw,ww_r[0]); - } /* iw */ - } /* in core */ -} - -/*------------------------------------------------------------*/ - -void srmod_cw(fslice dwfl /* source data [nw][ny][nx] */, - fslice uwfl /* receiver data [nw][ny][nx] */, - fslice refl - ) -/*< Apply C-wave S/R modeling >*/ -{ - int iz,iw,ix,iy,ilx,ily; - sf_complex w; - - if(incore) { - - /* read reflectivity */ - for( iz=0; iz0; iz--) { -#ifdef SF_HAS_COMPLEX_H - LOOP( ww_r[iy][ix] += www[iz][iy][ix]*rrr[iz][iy][ix]; ); -#else - LOOP( ww_r[iy][ix] = sf_cadd(ww_r[iy][ix], - sf_crmul(www[iz][iy][ix], - rrr[iz][iy][ix])); ); -#endif - ssr_ssf(w,ww_r,sss[iz],sss[iz-1],nr[iz],sm[iz]); - } - fslice_put(uwfl,iw,ww_r[0]); - } /* iw */ - - } else { - - for (iw=0; iw0; iz--) { - fslice_get(slow_r,iz-1,ss[0]); - - fslice_get(wtmp,iz,ww_s[0]); - fslice_get(refl,iz,rr[0]); /* reflectivity */ -#ifdef SF_HAS_COMPLEX_H - LOOP( ww_s[iy][ix] *= rr [iy][ix]; - ww_r[iy][ix] += ww_s[iy][ix]; ); -#else - LOOP( ww_s[iy][ix] = sf_crmul(ww_s[iy][ix],rr[iy][ix]); - ww_r[iy][ix] = sf_cadd(ww_r[iy][ix],ww_s[iy][ix]); ); -#endif - - ssr_ssf(w,ww_r,so,ss,nr_r[iz],sm_r[iz]); - SOOP( so[ily][ilx] = ss[ily][ilx]; ); - } - fslice_put(uwfl,iw,ww_r[0]); - } /* iw */ - } /* in core */ - -} diff --git a/user/nobody/stretch2.c b/user/nobody/stretch2.c deleted file mode 100644 index 82a2d93aa2..0000000000 --- a/user/nobody/stretch2.c +++ /dev/null @@ -1,134 +0,0 @@ -#include - -#include - -#include "stretch2.h" -#include "banded.h" - -struct Map2 { - int nt, nd; - float t0,dt, eps, lam; - int *x; - bool *m; - float *w, *diag, **offd; - bands slv; -}; - -map2 stretch2_init (int n1, float o1, float d1, int nd, float eps, float lam) -{ - map2 str; - - str = (map2) sf_alloc (1, sizeof(*str)); - - str->nt = n1; - str->t0 = o1; - str->dt = d1; - str->nd = nd; - str->eps = eps; - str->lam = lam; - - str->x = sf_intalloc (nd); - str->m = sf_boolalloc (nd); - str->w = sf_floatalloc (nd); - str->diag = sf_floatalloc (n1); - str->offd = sf_floatalloc2 (n1,2); - - str->slv = banded_init (n1,2); - - return str; -} - -void stretch2_define (map2 str, float* coord, bool refl) -{ - int id, ix, i1; - float rx, r1; - - for (i1 = 0; i1 < str->nt; i1++) { - /* regularization */ - str->diag[i1] = str->eps*(6.*str->lam+2.5*(1.-str->lam)); - str->offd[0][i1] = -4.*str->eps*(str->lam+(1.-str->lam)/3.); - str->offd[1][i1] = str->eps*(str->lam+(1.-str->lam)/12.); - } - - if (refl) { - sf_warning("reflecting boundary conditions"); - str->diag[0] = str->diag[str->nt-1] = - str->eps*(2.*str->lam+7.*(1.-str->lam)/6.); - str->offd[0][0] = str->offd[0][str->nt-2] = - -str->eps*(3.*str->lam+1.25*(1.-str->lam)); - } - - for (id = 0; id < str->nd; id++) { - rx = (coord[id] - str->t0)/str->dt; - ix = floor(rx); - rx = rx - ix; - if (ix < 0 || ix > str->nt - 2) { - str->m[id] = true; - continue; - } - str->x[id] = ix; - str->m[id] = false; - str->w[id] = rx; - - r1 = 1. - rx; - - str->diag[ix] += r1 * r1; - str->diag[ix+1] += rx * rx; - str->offd[0][ix] += r1 * rx; - } - - banded_define (str->slv, str->diag, str->offd); -} - -void stretch2_apply (map2 str, float* ord, float* mod) -{ - int id, i1, i2; - float w1, w2; - - for (i1 = 0; i1 < str->nt; i1++) { - mod[i1] = 0.; - } - - for (id = 0; id < str->nd; id++) { - if (str->m[id]) continue; - - i1 = str->x[id]; i2 = i1+1; - w2 = str->w[id]; w1 = 1.-w2; - - mod[i1] += w1 * ord[id]; - mod[i2] += w2 * ord[id]; - } - - banded_solve (str->slv, mod); -} - -void stretch2_invert (map2 str, float* ord, float* mod) -{ - int id, i1, i2; - float w1, w2; - - for (id = 0; id < str->nd; id++) { - if (str->m[id]) continue; - - i1 = str->x[id]; i2 = i1+1; - w2 = str->w[id]; w1 = 1.-w2; - - ord[id] = w1*mod[i1] + w2*mod[i2]; - } -} - -void stretch2_close (map2 str) -{ - free (str->x); - free (str->m); - free (str->w); - free (str->diag); - free (str->offd[0]); - free (str->offd); - - banded_close (str->slv); - free (str); -} - -/* $Id$ */ - diff --git a/user/nobody/su_or_segy_to_rsf.c b/user/nobody/su_or_segy_to_rsf.c deleted file mode 100644 index 2e8656d5eb..0000000000 --- a/user/nobody/su_or_segy_to_rsf.c +++ /dev/null @@ -1,228 +0,0 @@ -/* Procedures used by segy2rsf and su2rsf. Excerpted from the code of segyread. -*/ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef _LARGEFILE_SOURCE -#define _LARGEFILE_SOURCE -#endif -#include -#include -#include -#include - -#include "segy.h" -/*^*/ - -off_t -readfilesize (FILE * file) -/*< Returns file size in bytes. Cannot be used on stdin. >*/ -{ - off_t pos; - extern int fseeko (FILE * stream, off_t offset, int whence); - extern off_t ftello (FILE * stream); - - fseeko (file, 0, SEEK_END); - pos = ftello (file); /* pos is the filesize in bytes */ - fseeko (file, 0, SEEK_SET); - - return pos; -} - -void -su_or_segy_to_rsf (bool verb, bool su, int ntr, int format, int ns, - int itrace[SF_NKEYS], off_t nsegy, FILE * file, float dt) -/*< Common block of code for both segy2rsf and su2rsf >*/ -{ - /* - ntr = number of traces in input file - format = input parameter for SEG-Y data (1=IBM float, 5=IEEE float, etc) - ns = number of samples in one trace - nsegy = number of bytes in an input trace plus its header - file = handle to input - dt = time sampling of traces - */ - - const char *headname; /* holds name of file with trace headers */ - char *trace; - const char *read; /* for similarly-named input parameter */ - sf_file out; /* tag for stdout */ - sf_file hdr; /* tag for file with trace headers */ - sf_file msk = NULL; /* tag of mask file */ - int itr; /* index to count of traces */ - int n2; /* number of traces that pass through mask */ - int *mask; /* array holding mask values */ - float *ftrace; /* for writing out data coming from SEG-Y file */ - - /* Why declare it by hand? It is included in stdio.h */ - extern int fseeko (FILE * stream, off_t offset, int whence); - - if (verb) - sf_warning ("Expect %d traces", ntr); - - if (NULL == (read = sf_getstring ("read"))) - read = "b"; - /* what to read: h - header, d - data, b - both (default) */ - - if (NULL != sf_getstring ("mask")) - { - /* optional header mask for reading only selected traces */ - msk = sf_input ("mask"); - if (SF_INT != sf_gettype (msk)) - sf_error ("Need integer mask"); - - mask = sf_intalloc (ntr); - sf_intread (mask, ntr, msk); - sf_fileclose (msk); - - for (n2 = itr = 0; itr < ntr; itr++) - { - if (mask[itr]) - n2++; - } - } - else - { - mask = NULL; - n2 = ntr; - } - - if (read[0] != 'h') - { /* not only header */ - out = sf_output ("out"); - sf_putint (out, "n1", ns); - sf_putint (out, "n2", n2); - sf_putfloat (out, "d1", dt); - sf_putfloat (out, "o1", 0.); - sf_setformat (out, "native_float"); - ftrace = su ? NULL : sf_floatalloc (ns); - } - else - { - out = NULL; - ftrace = NULL; - } - - if (read[0] != 'd') - { /* not only data */ - hdr = sf_output ("tfile"); - sf_putint (hdr, "n1", SF_NKEYS); - sf_putint (hdr, "n2", n2); - sf_setformat (hdr, "native_int"); - - if (NULL == (headname = sf_getstring ("tfile"))) - headname = "tfile"; - /* output trace header file */ - if (NULL != out) - sf_putstring (out, "head", headname); - } - else - { - hdr = NULL; - } - - if (NULL != out) - sf_fileflush (out, NULL); - - switch (read[0]) - { - case 'h': /* header only */ - trace = sf_charalloc (SF_HDRBYTES); - nsegy -= SF_HDRBYTES; - - for (itr = 0; itr < ntr; itr++) - { - if (NULL != mask && !mask[itr]) - { - fseeko (file, SF_HDRBYTES, SEEK_CUR); - continue; - } - else if (SF_HDRBYTES != fread (trace, 1, SF_HDRBYTES, file)) - { - sf_error ("Error reading trace header %d", itr + 1); - } - fseeko (file, nsegy, SEEK_CUR); - - segy2head (trace, itrace, SF_NKEYS); - sf_intwrite (itrace, SF_NKEYS, hdr); - } - - break; - case 'd': /* data only */ - nsegy -= SF_HDRBYTES; - trace = sf_charalloc (nsegy); - - for (itr = 0; itr < ntr; itr++) - { - fseek (file, SF_HDRBYTES, SEEK_CUR); - if (NULL != mask && !mask[itr]) - { - fseeko (file, nsegy, SEEK_CUR); - continue; - } - else if (nsegy != fread (trace, 1, nsegy, file)) - { - sf_error ("Error reading trace data %d", itr + 1); - } - - if (su) - { - sf_charwrite (trace, ns * sizeof (float), out); - } - else - { - segy2trace (trace, ftrace, ns, format); - sf_floatwrite (ftrace, ns, out); - } - } - - break; - default: /* both header and data */ - trace = sf_charalloc (nsegy); - - for (itr = 0; itr < ntr; itr++) - { - if (NULL != mask && !mask[itr]) - { - fseeko (file, nsegy, SEEK_CUR); - continue; - } - else if (nsegy != fread (trace, 1, nsegy, file)) - { - sf_error ("Error reading trace header %d", itr + 1); - } - - segy2head (trace, itrace, SF_NKEYS); - sf_intwrite (itrace, SF_NKEYS, hdr); - - if (su) - { - sf_charwrite (trace + SF_HDRBYTES, ns * sizeof (float), out); - } - else - { - segy2trace (trace + SF_HDRBYTES, ftrace, ns, format); - sf_floatwrite (ftrace, ns, out); - } - } - break; - } - - - exit (0); -} diff --git a/user/nobody/svdutil.c b/user/nobody/svdutil.c deleted file mode 100644 index 7e1e79d5c8..0000000000 --- a/user/nobody/svdutil.c +++ /dev/null @@ -1,411 +0,0 @@ -/* matrix SVD decomposition */ -/* - Copyright (C) 2013 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include -#include "svdutil.h" - -static int m, n; -static float *s, *e, *w; - -void svdinit( int n2, int n1, int ka) -/*< initiate svd and allocate memory >*/ -{ - m=n2; - n=n1; - s = sf_floatalloc(ka); - e = sf_floatalloc(ka); - w = sf_floatalloc(ka); - -} - -void svdclose( void ) -/*< release memory >*/ -{ - free(s); - free(e); - free(w); -} - -void ppp(float *a,float *e,float *s,float *v,int m, int n) -{ - int i,j,p,q; - float d; - if (m>=n) i=n; - else i=m; - for (j=1; j<=i-1; j++) { - a[(j-1)*n+j-1]=s[j-1]; - a[(j-1)*n+j]=e[j-1]; - } - a[(i-1)*n+i-1]=s[i-1]; - if (mfabsf(fg[1])) { - d=fabsf(d); - if (fg[0]<0.0) d=-d; - } - if (fabsf(fg[1])>=fabsf(fg[0])) { - d=fabsf(d); - if (fg[1]<0.0) d=-d; - } - cs[0]=fg[0]/d; cs[1]=fg[1]/d; - } - r=1.0; - if (fabsf(fg[0])>fabsf(fg[1])) r=cs[1]; - else - if (cs[0]!=0.0) r=1.0/cs[0]; - fg[0]=d; fg[1]=r; - return; -} - -int svduov(float *a, float *u,float *o, float *v,double eps,int ka) -/*< SVD decomposition, A->UOV , borrow from Yang Liu (2007) >*/ -{ - int i,j,k,l,it,ll,kk,ix,iy,mm,nn,iz,m1,ks; - float d,dd,t,sm,sm1,em1,sk,ek,b,c,shh,fg[2],cs[2]; - it=60; k=n; - if (m-1k) ll=l; - if (ll>=1) { - for (kk=1; kk<=ll; kk++) { - if (kk<=k) { - d=0.0; - for (i=kk; i<=m; i++) { - ix=(i-1)*n+kk-1; d=d+a[ix]*a[ix]; - } - s[kk-1]=sqrtf(d); - if (s[kk-1]!=0.0) { - ix=(kk-1)*n+kk-1; - if (a[ix]!=0.0) { - s[kk-1]=fabsf(s[kk-1]); - if (a[ix]<0.0) s[kk-1]=-s[kk-1]; - } - for (i=kk; i<=m; i++) { - iy=(i-1)*n+kk-1; - a[iy]=a[iy]/s[kk-1]; - } - a[ix]=1.0+a[ix]; - } - s[kk-1]=-s[kk-1]; - } - if (n>=kk+1) { - for (j=kk+1; j<=n; j++) { - if ((kk<=k)&&(s[kk-1]!=0.0)) { - d=0.0; - for (i=kk; i<=m; i++) { - ix=(i-1)*n+kk-1; - iy=(i-1)*n+j-1; - d=d+a[ix]*a[iy]; - } - d=-d/a[(kk-1)*n+kk-1]; - for (i=kk; i<=m; i++) { - ix=(i-1)*n+j-1; - iy=(i-1)*n+kk-1; - a[ix]=a[ix]+d*a[iy]; - } - } - e[j-1]=a[(kk-1)*n+j-1]; - } - } - if (kk<=k) { - for (i=kk; i<=m; i++) { - ix=(i-1)*m+kk-1; iy=(i-1)*n+kk-1; - u[ix]=a[iy]; - } - } - if (kk<=l) { - d=0.0; - for (i=kk+1; i<=n; i++) - d=d+e[i-1]*e[i-1]; - e[kk-1]=sqrtf(d); - if (e[kk-1]!=0.0) { - if (e[kk]!=0.0) { - e[kk-1]=fabsf(e[kk-1]); - if (e[kk]<0.0) e[kk-1]=-e[kk-1]; - } - for (i=kk+1; i<=n; i++) - e[i-1]=e[i-1]/e[kk-1]; - e[kk]=1.0+e[kk]; - } - e[kk-1]=-e[kk-1]; - if ((kk+1<=m)&&(e[kk-1]!=0.0)) { - for (i=kk+1; i<=m; i++) w[i-1]=0.0; - for (j=kk+1; j<=n; j++) - for (i=kk+1; i<=m; i++) - w[i-1]=w[i-1]+e[j-1]*a[(i-1)*n+j-1]; - for (j=kk+1; j<=n; j++) - for (i=kk+1; i<=m; i++) { - ix=(i-1)*n+j-1; - a[ix]=a[ix]-w[i-1]*e[j-1]/e[kk]; - } - } - for (i=kk+1; i<=n; i++) - v[(i-1)*n+kk-1]=e[i-1]; - } - } - } - mm=n; - if (m+1n) nn=n; - if (nn>=k+1) { - for (j=k+1; j<=nn; j++) { - for (i=1; i<=m; i++) - u[(i-1)*m+j-1]=0.0; - u[(j-1)*m+j-1]=1.0; - } - } - if (k>=1) { - for (ll=1; ll<=k; ll++) { - kk=k-ll+1; iz=(kk-1)*m+kk-1; - if (s[kk-1]!=0.0) { - if (nn>=kk+1) - for (j=kk+1; j<=nn; j++) { - d=0.0; - for (i=kk; i<=m; i++) { - ix=(i-1)*m+kk-1; - iy=(i-1)*m+j-1; - d=d+u[ix]*u[iy]/u[iz]; - } - d=-d; - for (i=kk; i<=m; i++) { - ix=(i-1)*m+j-1; - iy=(i-1)*m+kk-1; - u[ix]=u[ix]+d*u[iy]; - } - } - for (i=kk; i<=m; i++) { - ix=(i-1)*m+kk-1; u[ix]=-u[ix]; - } - u[iz]=1.0+u[iz]; - if (kk-1>=1) - for (i=1; i<=kk-1; i++) - u[(i-1)*m+kk-1]=0.0; - } - else { - for (i=1; i<=m; i++) - u[(i-1)*m+kk-1]=0.0; - u[(kk-1)*m+kk-1]=1.0; - } - } - } - for (ll=1; ll<=n; ll++) { - kk=n-ll+1; iz=kk*n+kk-1; - if ((kk<=l)&&(e[kk-1]!=0.0)) { - for (j=kk+1; j<=n; j++) { - d=0.0; - for (i=kk+1; i<=n; i++) { - ix=(i-1)*n+kk-1; iy=(i-1)*n+j-1; - d=d+v[ix]*v[iy]/v[iz]; - } - d=-d; - for (i=kk+1; i<=n; i++) { - ix=(i-1)*n+j-1; iy=(i-1)*n+kk-1; - v[ix]=v[ix]+d*v[iy]; - } - } - } - for (i=1; i<=n; i++) - v[(i-1)*n+kk-1]=0.0; - v[iz-n]=1.0; - } - for (i=1; i<=m; i++) - for (j=1; j<=n; j++) - a[(i-1)*n+j-1]=0.0; - m1=mm; it=60; - while (1==1) { - if (mm==0) { - ppp(a,e,s,v,m,n); - memcpy(o,a,m*n*sizeof(float)); - return(1); - } - if (it==0) { - ppp(a,e,s,v,m,n); - memcpy(o,a,m*n*sizeof(float)); - return(-1); - } - kk=mm-1; - while ((kk!=0)&&(fabsf(e[kk-1])!=0.0)) { - d=fabsf(s[kk-1])+fabsf(s[kk]); - dd=fabsf(e[kk-1]); - if (dd>eps*d) kk=kk-1; - else e[kk-1]=0.0; - } - if (kk==mm-1) { - kk=kk+1; - if (s[kk-1]<0.0) { - s[kk-1]=-s[kk-1]; - for (i=1; i<=n; i++) { - ix=(i-1)*n+kk-1; v[ix]=-v[ix];} - } - while ((kk!=m1)&&(s[kk-1]kk)&&(fabsf(s[ks-1])!=0.0)) { - d=0.0; - if (ks!=mm) d=d+fabsf(e[ks-1]); - if (ks!=kk+1) d=d+fabsf(e[ks-2]); - dd=fabsf(s[ks-1]); - if (dd>eps*d) ks=ks-1; - else s[ks-1]=0.0; - } - if (ks==kk) { - kk=kk+1; - d=fabsf(s[mm-1]); - t=fabsf(s[mm-2]); - if (t>d) d=t; - t=fabsf(e[mm-2]); - if (t>d) d=t; - t=fabsf(s[kk-1]); - if (t>d) d=t; - t=fabsf(e[kk-1]); - if (t>d) d=t; - sm=s[mm-1]/d; sm1=s[mm-2]/d; - em1=e[mm-2]/d; - sk=s[kk-1]/d; ek=e[kk-1]/d; - b=((sm1+sm)*(sm1-sm)+em1*em1)/2.0; - c=sm*em1; c=c*c; shh=0.0; - if ((b!=0.0)||(c!=0.0)) { - shh=sqrtf(b*b+c); - if (b<0.0) shh=-shh; - shh=c/(b+shh); - } - fg[0]=(sk+sm)*(sk-sm)-shh; - fg[1]=sk*ek; - for (i=kk; i<=mm-1; i++) { - sss(fg,cs); - if (i!=kk) e[i-2]=fg[0]; - fg[0]=cs[0]*s[i-1]+cs[1]*e[i-1]; - e[i-1]=cs[0]*e[i-1]-cs[1]*s[i-1]; - fg[1]=cs[1]*s[i]; - s[i]=cs[0]*s[i]; - if ((cs[0]!=1.0)||(cs[1]!=0.0)) - for (j=1; j<=n; j++) { - ix=(j-1)*n+i-1; - iy=(j-1)*n+i; - d=cs[0]*v[ix]+cs[1]*v[iy]; - v[iy]=-cs[1]*v[ix]+cs[0]*v[iy]; - v[ix]=d; - } - sss(fg,cs); - s[i-1]=fg[0]; - fg[0]=cs[0]*e[i-1]+cs[1]*s[i]; - s[i]=-cs[1]*e[i-1]+cs[0]*s[i]; - fg[1]=cs[1]*e[i]; - e[i]=cs[0]*e[i]; - if (i -/*^*/ - -#include "sweeping.h" - -void sweep (int niter /* maximum number of iterations */, - float* time /* time */, - float* v /* slowness squared */, - int n3, int n2, int n1 /* dimensions */, - float o3,float o2,float o1 /* origin */, - float d3,float d2,float d1 /* sampling */, - float s3,float s2,float s1 /* source */, - int b3, int b2, int b1 /* box around the source */) -/*< Run fast sweeping >*/ -{ - int iter, sw, j1, j2, j3; - - - for(iter=0; iter < niter; iter++) { - sf_warning("iter=%d",iter); - - for (sw=0; sw < 8; sw++) { - j1 = (sw & 1)? -1:1; - j2 = (sw & 2)? -1:1; - j3 = (sw & 4)? -1:1; - } - } -} diff --git a/user/nobody/symes.c b/user/nobody/symes.c deleted file mode 100644 index 1bd6c37e39..0000000000 --- a/user/nobody/symes.c +++ /dev/null @@ -1,25 +0,0 @@ -#include - -#include - -#include "symes.h" - -float symes_vel(void* par, float* x) -{ - float v; - v = 1. + 0.2*sinf(3.*SF_PI*x[1])*sinf(0.5*SF_PI*x[0]); - v = 1./(v*v); - return v; -} - -void symes_vgrad(void* par, float* x, float* grad) { - int i; - grad[1] = 0.6*SF_PI*cosf(3.*SF_PI*x[1])*sinf(0.5*SF_PI*x[0]); - grad[0] = 0.1*SF_PI*sinf(3.*SF_PI*x[1])*cosf(0.5*SF_PI*x[0]); - for (i=0; i < 2; i++) { - grad[i] *= -symes_vel(par, x)/ - (1. + 0.2*sinf(3.*SF_PI*x[1])*sinf(0.5*SF_PI*x[0])); - } -} - -/* $Id$ */ diff --git a/user/nobody/taper3.c b/user/nobody/taper3.c deleted file mode 100644 index 7c1592f1af..0000000000 --- a/user/nobody/taper3.c +++ /dev/null @@ -1,204 +0,0 @@ -/* Tapering (2d and 3d) */ -/* - Copyright (C) 2007 Colorado School of Mines - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include - -#include "taper3.h" - -#include "weutil.h" -/*^*/ - -/*------------------------------------------------------------*/ -tap3d taper_init(int n1_, - int n2_, - int n3_, - int nt1_, - int nt2_, - int nt3_ /* taper lengths */, - bool b1_, - bool b2_, - bool b3_) -/*< 3-D initialize >*/ -{ - int it; - float gain; - - tap3d tap; - tap = (tap3d) sf_alloc(1,sizeof(*tap)); - - tap->n1 =n1_; - tap->n2 =n2_; - tap->n3 =n3_; - - tap->nt1=nt1_; - tap->nt2=nt2_; - tap->nt3=nt3_; - - tap->b1 =b1_; - tap->b2 =b2_; - tap->b3 =b3_; - - if (tap->nt1 > 0) { - tap->tap1 = sf_floatalloc(tap->nt1); - for (it=0; it < tap->nt1; it++) { - gain = sinf(0.5*SF_PI*it/tap->nt1); - tap->tap1[it]=(1+gain)/2.; - } - } - if (tap->nt2 > 0) { - tap->tap2 = sf_floatalloc(tap->nt2); - for (it=0; it < tap->nt2; it++) { - gain = sinf(0.5*SF_PI*it/tap->nt2); - tap->tap2[it]=(1+gain)/2.; - } - } - if (tap->nt3 > 0) { - tap->tap3 = sf_floatalloc(tap->nt3); - for (it=0; it < tap->nt3; it++) { - gain = sinf(0.5*SF_PI*it/tap->nt3); - tap->tap3[it]=(1+gain)/2.; - } - } - - return tap; -} - -/*------------------------------------------------------------*/ -void taper_report(tap3d tap) -/*< report taper parameters >*/ -{ - - sf_warning("TAPER REPORT"); - sf_warning(" n1=%d n2=%d n3=%d ",tap->n1, tap->n2, tap->n3); - sf_warning("nt1=%d nt2=%d nt3=%d",tap->nt1,tap->nt2,tap->nt3); - sf_warning(" b1=%d b2=%d b3=%b ",tap->b1, tap->b2, tap->b3); - -} - -/*------------------------------------------------------------*/ -void taper2d_close(tap3d tap) -/*< 2-D free allocated storage >*/ -{ - if (tap->nt1 > 0) free(tap->tap1); - if (tap->nt2 > 0) free(tap->tap2); -} - -/*------------------------------------------------------------*/ -void taper3d_close(tap3d tap) -/*< 3-D free allocated storage >*/ -{ - if (tap->nt1 > 0) free(tap->tap1); - if (tap->nt2 > 0) free(tap->tap2); - if (tap->nt3 > 0) free(tap->tap3); -} - -/*------------------------------------------------------------*/ -void taper2d(sf_complex **tt /* [n2][n1] tapered array (in and out) */, - tap3d tap) -/*< 2-D taper >*/ -{ - int it,i2,i1; - float gain; - - for (it=0; it < tap->nt2; it++) { - gain = tap->tap2[it]; - for (i1=0; i1 < tap->n1; i1++) { -#ifdef SF_HAS_COMPLEX_H - if (tap->b2) tt[ it ][i1] *= gain; - ; tt[tap->n2-it-1][i1] *= gain; -#else - if (tap->b2) tt[ it ][i1] = sf_crmul(tt[ it ][i1],gain); - ; tt[tap->n2-it-1][i1] = sf_crmul(tt[tap->n2-it-1][i1],gain); -#endif - } - } - - for (it=0; it < tap->nt1; it++) { - gain = tap->tap1[it]; - for (i2=0; i2 < tap->n2; i2++) { -#ifdef SF_HAS_COMPLEX_H - if (tap->b1) tt[i2][ it ] *= gain; - ; tt[i2][tap->n1-it-1] *= gain; -#else - if (tap->b1) tt[i2][ it ] = sf_crmul(tt[i2][ it ],gain); - ; tt[i2][tap->n1-it-1] = sf_crmul(tt[i2][tap->n1-it-1],gain); -#endif - } - } -} - -/*------------------------------------------------------------*/ -void taper3d(sf_complex*** tt /* [n3][n2][n1] tapered array (inout) */, - tap3d tap) -/*< 3-D taper >*/ -{ - int it,i1,i2,i3; - float gain; - - for (it=0; it < tap->nt3; it++) { - gain = tap->tap3[it]; - for (i2=0; i2 < tap->n2; i2++) { - for (i1=0; i1 < tap->n1; i1++) { -#ifdef SF_HAS_COMPLEX_H - if(tap->b3) tt[ it ][i2][i1] *= gain; - ; tt[tap->n3-it-1][i2][i1] *= gain; -#else - if(tap->b3) tt[ it ][i2][i1] = - sf_crmul(tt[ it ][i2][i1],gain); - ; tt[tap->n3-it-1][i2][i1] = - sf_crmul(tt[tap->n3-it-1][i2][i1],gain); -#endif - } - } - } - - for (it=0; it < tap->nt2; it++) { - gain = tap->tap2[it]; - for (i3=0; i3 < tap->n3; i3++) { - for (i1=0; i1 < tap->n1; i1++) { -#ifdef SF_HAS_COMPLEX_H - if(tap->b2) tt[i3][ it ][i1] *= gain; - ; tt[i3][tap->n2-it-1][i1] *= gain; -#else - if(tap->b2) tt[i3][ it ][i1] = - sf_crmul(tt[i3][ it ][i1],gain); - ; tt[i3][tap->n2-it-1][i1] = - sf_crmul(tt[i3][tap->n2-it-1][i1],gain); -#endif - } - } - } - - for (it=0; it < tap->nt1; it++) { - gain = tap->tap1[it]; - for (i3=0; i3 < tap->n3; i3++) { - for (i2=0; i2 < tap->n2; i2++) { -#ifdef SF_HAS_COMPLEX_H - if(tap->b1) tt[i3][i2][ it ] *= gain; - ; tt[i3][i2][tap->n1-it-1] *= gain; -#else - if(tap->b1) tt[i3][i2][ it ] = - sf_crmul(tt[i3][i2][ it ],gain); - ; tt[i3][i2][tap->n1-it-1] = - sf_crmul(tt[i3][i2][tap->n1-it-1],gain); -#endif - } - } - } -} diff --git a/user/nobody/tent2.c b/user/nobody/tent2.c deleted file mode 100644 index 2ea765c9c3..0000000000 --- a/user/nobody/tent2.c +++ /dev/null @@ -1,42 +0,0 @@ -#include - -#include "cartesian.h" -#include "tent2.h" - -/* tent2 - ----- - cosine window weighting function - an alternative to tent - dim - window dimensionality - nwind[dim] - window size - windwt[product(nwind)] - window weight (output) */ -void tent2 (int dim, const int* nwind, float* windwt) -{ - int i, j, nw, x[MAX_DIM]; - double w, pi; - - /* compute window size */ - nw = 1; - for (j=0; j < dim; j++) { - nw *= nwind[j]; - } - - pi = acos(-1.); - /* loop inside the windoe */ - for (i=0; i < nw; i++) { - line2cart(dim, nwind, i, x); - - windwt[i] = 1.; - for (j=0; j < dim; j++) { - if (nwind[j] > 1) { - w = cos(2.*pi*(x[j]+1.)/(nwind[j] + 1.)); - w = 0.5*(1.-w); - if (w > 0.) - windwt[i] *= w; - else - windwt[i] = 0.; - } - } - } -} - - diff --git a/user/nobody/tomo2.c b/user/nobody/tomo2.c deleted file mode 100644 index c36542714b..0000000000 --- a/user/nobody/tomo2.c +++ /dev/null @@ -1,116 +0,0 @@ -#include - -#include - -#include "tomo2.h" - -#ifndef MAX -#define MAX(x,y) ((x) > (y) ? (x) : (y)) -#endif - -#ifndef MIN -#define MIN(x,y) ((x) < (y) ? (x) : (y)) -#endif - -static int nd, nf, m1, m2, ***nxy, nr, *rl; -static bool **mask; -static float ***w1, ***w2; - -void tomo2_init (float*** rays, int *raylen, int nrays, - float o1, float o2, float d1, float d2, - int n1, int n2, - interpolator interp, int nf_in) -{ - int ir, id, i1, i2, nd; - float x1, x2, rx; - - nf = nf_in; - m1 = n1; - m2 = n2; - nr = nrays; - rl = raylen; - - nxy = (int***) sf_alloc(nr,sizeof(int**)); - mask = (bool**) sf_alloc(nr,sizeof(bool*)); - w1 = (float***) sf_alloc(nr,sizeof(float**)); - w2 = (float***) sf_alloc(nr,sizeof(float**)); - - for (ir = 0; ir < nr; ir++) { - nd = rl[ir]; - nxy[ir] = sf_intalloc2(2,nd); - mask[ir] = sf_boolalloc(nd); - w1[ir] = sf_floatalloc2(nf,nd); - w2[ir] = sf_floatalloc2(nf,nd); - for (id = 0; id < nd; id++) { - rx = (rays[ir][id][0] - o1)/d1; - i1 = (int) floor(rx + 1. - 0.5*nf); - x1 = rx - floor(rx); - - rx = (rays[ir][id][1] - o2)/d2; - i2 = (int) floor(rx + 1. - 0.5*nf); - x2 = rx - floor(rx); - - if (i1 > - nf && i1 < n1 && - i2 > - nf && i2 < n2) { - mask[ir][id] = false; - interp (x1, nf, w1[ir][id]); - interp (x2, nf, w2[ir][id]); - nxy[ir][id][0] = i1; - nxy[ir][id][1] = i2; - } else { - mask[ir][id] = true; - } - } - } -} - -void tomo2_lop (bool adj, bool add, int nm, int ny, float* x, float* ord) -{ - int ir, id, i0, j0, i, j, im; - float w; - - if (ny != nr) sf_error("%s: wrong dimensions: %d != %d",__FILE__,ny,nr); - - sf_adjnull (adj,add,nm,nd,x,ord); - - for (ir = 0; ir < nr; ir++) { - nd = rl[ir]; - for (id=0; id < nd; id++) { - if (mask[ir][id]) continue; - i0 = nxy[ir][id][0]; - j0 = nxy[ir][id][1]; - for (j = MAX(0,-j0); j < MIN(nf,m2-j0); j++) { - w = w2[ir][id][j]; - for (i = MAX(0,-i0); i < MIN(nf,m1-i0); i++) { - im = (i+i0) + (j+j0)*m1; - if( adj) { - x[im] += ord[ir] * w * w1[ir][id][i]; - } else { - ord[ir] += x[im] * w * w1[ir][id][i]; - } - } - } - } - } -} - -void tomo2_close (void) -{ - int ir; - - for (ir = 0; ir < nr; ir++) { - free (**nxy); - free (*nxy); - free (*mask); - free (**w1); - free (**w2); - free (*w1); - free (*w2); - } - free (nxy); - free (mask); - free (w1); - free (w2); -} - -/* $Id$ */ diff --git a/user/nobody/wefic.c b/user/nobody/wefic.c deleted file mode 100644 index a4df8e3b54..0000000000 --- a/user/nobody/wefic.c +++ /dev/null @@ -1,157 +0,0 @@ -#include - -#include -/*^*/ - -#include "wefic.h" - -#include "slice.h" -/*^*/ - -static bool verb; -static axa am,aw,ah; - -static float *qq; /* image */ -static float complex **us; /* wavefield */ -static float complex **ur; - -static float complex **tt; /* phase shift */ -/*static float complex **ts;*/ -/*static float complex **tr;*/ - -/*------------------------------------------------------------*/ - -void wefic_init(bool verb_, - axa amx_ /* i-line (data) */, - axa amy_ /* x-line (data) */, - axa amz_ /* depth */, - axa aw_ /* frequency */ -) -/*< initialize WE IC >*/ -{ - verb=verb_; - - aw = aw_; - - am.n = amx_.n*amy_.n*amz_.n; - - /* allocate wavefield storage */ - us = sf_complexalloc2(am.n,aw.n); - ur = sf_complexalloc2(am.n,aw.n); - qq = sf_floatalloc (am.n); - - /* from hertz to radian */ - aw.d *= 2.*SF_PI; - aw.o *= 2.*SF_PI; -} - -void hhfic_init(axa ah_) -/*< initialize prestack IC >*/ -{ - int iw,ih; - float w; - float h; - - ah = ah_; - - tt = sf_complexalloc2(aw.n,ah.n); -/* ts = sf_complexalloc2(aw.n,ah.n);*/ -/* tr = sf_complexalloc2(aw.n,ah.n);*/ - - for (ih=0; ih*/ -{ - free( *us); free( us); - free( *ur); free( ur); - ; free( qq); -} - -void hhfic_close(void) -/*< free allocated storage >*/ -{ - free( *tt); free( tt); -} - -/*------------------------------------------------------------*/ - -void zofic(fslice sdat /* source data [nw][nz][ny][nx] */, - fslice rdat /* receiver data [nw][nz][ny][nx] */, - fslice imag /* image [nz][ny][nx] */ - ) -/*< apply imaging condition >*/ -{ - int im,iw; - - fslice_get(sdat,0,us[0]); - fslice_get(rdat,0,ur[0]); - - for(im=0; im*/ -{ - int im,ih,iw; - - /* read wavefields */ - fslice_get(sdat,0,us[0]); - fslice_get(rdat,0,ur[0]); - - for(ih=0; ih - -#include -/*^*/ - -#include "weimc.h" - -#include "slice.h" -/*^*/ - - -#define MLOOP(a) for(imz=0; imz*/ -{ - verb=verb_; - - amz = amz_; - amx = amx_; - amy = amy_; - aw = aw_; - - /* allocate wavefield storage */ - us = sf_complexalloc3(amx.n,amy.n,amz.n); - ur = sf_complexalloc3(amx.n,amy.n,amz.n); - qq = sf_floatalloc3 (amx.n,amy.n,amz.n); -} - -void hhimc_init(axa ahx_, - axa ahy_, - axa ahz_ -) -/*< initialize prestack IC >*/ -{ - ahx = ahx_; - ahy = ahy_; - ahz = ahz_; - - LOx = floor(ahx.o/ahx.d); HIx = LOx + ahx.n; - LOy = floor(ahy.o/ahy.d); HIy = LOy + ahy.n; - LOz = floor(ahz.o/ahz.d); HIz = LOz + ahz.n; - - sf_warning("LOx=%d HIx=%d",LOx,HIx); - sf_warning("LOy=%d HIy=%d",LOy,HIy); - sf_warning("LOz=%d HIz=%d",LOz,HIz); - -} -/*------------------------------------------------------------*/ - -void weimc_close(void) -/*< free allocated storage >*/ -{ - free(**us); free( *us); free( us); - free(**ur); free( *ur); free( ur); - free(**qq); free( *qq); free( qq); -} - -/*------------------------------------------------------------*/ - -void zoimc(fslice sdat /* source data [nw][nz][ny][nx] */, - fslice rdat /* receiver data [nw][nz][ny][nx] */, - fslice imag /* image [nz][ny][nx] */ - ) -/*< apply imaging condition >*/ -{ - int imx,imy,imz,iw; - - MLOOP( qq[imz][imy][imx] = 0.0; ); - fslice_put(imag,0,qq[0][0]); - - for (iw=0; iw*/ -{ - int iw,ih; - int imx, imy, imz; - int ihx, ihy, ihz; - int imxs,imys,imzs; - int imxr,imyr,imzr; - - MLOOP( qq[imz][imy][imx] = 0.0; ); - HLOOP( ih = IND(ihx,ihy,ihz); - fslice_put(imag,ih,qq[0][0]); - ); - - for (iw=0; iw - -#include "slice.h" -/*^*/ - -#include "weutil.h" -/*^*/ - -#ifndef _weutil_h - -/*------------------------------------------------------------*/ -typedef struct cub *cub3d; -/*^*/ - -struct cub{ - bool verb; - sf_axa amx,amy,amz; - sf_axa ahx,ahy; - sf_axa alx,aly; - sf_axa aw; - sf_axa ae; - float eps; - int ompnth; - int ompchunk; -}; -/*^*/ -/*------------------------------------------------------------*/ -typedef struct f2d *fft2d; -/*^*/ - -struct f2d{ - int n1,n2; - kiss_fft_cfg *forw1; /* FFT on axis 1 */ - kiss_fft_cfg *invs1; - kiss_fft_cfg *forw2; /* FFT on axis 2 */ - kiss_fft_cfg *invs2; - sf_complex *shf1; /* shift on axis 1 */ - sf_complex *shf2; /* shift on axis 2 */ - kiss_fft_cpx**ctrace; /* temp array */ - float fftscale; /* FFT scale */ -}; -/*^*/ - -/*------------------------------------------------------------*/ -typedef struct f3d *fft3d; -/*^*/ - -struct f3d{ - int n1,n2,n3; - kiss_fft_cfg *forw1; /* FFT on axis 1 */ - kiss_fft_cfg *invs1; - kiss_fft_cfg *forw2; /* FFT on axis 2 */ - kiss_fft_cfg *invs2; - kiss_fft_cfg *forw3; /* FFT on axis 3 */ - kiss_fft_cfg *invs3; - sf_complex *shf1; /* shift on axis 1 */ - sf_complex *shf2; /* shift on axis 2 */ - sf_complex *shf3; /* shift on axis 3 */ - kiss_fft_cpx**ctrace2; /* temp array */ - kiss_fft_cpx**ctrace3; /* temp array */ - float fftscale; /* FFT scale */ -}; -/*^*/ - -/*------------------------------------------------------------*/ -typedef struct ssr *ssr3d; -/*^*/ - -struct ssr{ - sf_axa bxx,byy; - float **kk; - int *lx,*ly; - sf_complex ***pk; - sf_complex ***wk; - float ***wt; - float dsmax2; - fft2d f2d; -}; -/*^*/ - -/*------------------------------------------------------------*/ -typedef struct lsr *lsr3d; -/*^*/ - -struct lsr{ - sf_axa bxx,byy; - float **kk; - float **kw; - int *lx,*ly; - sf_complex ***wk; - sf_complex ***wt; - float dsmax2; - fft2d f2d; -}; -/*^*/ - -/*------------------------------------------------------------*/ -typedef struct cam *cam3d; -/*^*/ - -struct cam{ - sf_axa bmx,bmy,bhx; - float **ksx,**krx; - int **is,**ir; - int *jx,*jy; - sf_complex ****pk; - sf_complex ****wk; - float ****wt; - float dsmax2; - fft3d f3d; -}; -/*^*/ - -/*------------------------------------------------------------*/ -typedef struct tap *tap3d; -/*^*/ - -struct tap{ - int nt1, nt2, nt3; - int n1, n2, n3; - bool b1, b2, b3; - float *tap1; - float *tap2; - float *tap3; -}; -/*^*/ - -/*------------------------------------------------------------*/ -typedef struct slo *slo3d; -/*^*/ - -struct slo{ - fslice slice; /* slowness slice */ - int *nr; /* number of references */ - float **sm; /* ref slo squared */ - float ***ss; /* slowness */ - float ***so; /* slowness */ - int nrmax; - float dsmax; - float twoway; /* two-way traveltime */ -}; -/*^*/ - -/*------------------------------------------------------------*/ -typedef struct img *img3d; -/*^*/ - -struct img{ - fslice imag; - fslice cigs; - sf_complex ****qs; /* source wavefield */ - sf_complex ****qr; /* receiver wavefield */ - float ****qi; /* image */ - float ****qc; /* cigs */ - float ****qt; - sf_axa acx,acy,acz; - int jcx,jcy,jcz; - sf_axa ahx,ahy,ahz,aht; - sf_axa ahh,aha,ahb; - sf_complex **tt; /* time-lag I.C. weight */ - int LOx,HIx; - int LOy,HIy; - int LOz,HIz; /* space-lags I.C. */ - float vpvs; /* abs-lag I.C. */ -}; -/*^*/ - -/*------------------------------------------------------------*/ -typedef struct ssroperator *ssroperator3d; -/*^*/ - -struct ssroperator{ - sf_complex ***ww_s; /* source wavefield */ - sf_complex ***ww_r; /* receiver wavefield */ - sf_complex ***ww ; /* wavefield */ - fslice wtmp; /* tmp wavefield (for SR modeling) */ - float ***rr; /* reflectivity (for SR modeling) */ - sf_complex **qq; /* image (for ZO modeling/migration) */ -}; -/*^*/ - -/*------------------------------------------------------------*/ -typedef struct ssrmvaoperator *ssrmvaoperator3d; -/*^*/ - -struct ssrmvaoperator{ - sf_complex ***bw; /* wavefield */ - sf_complex ***dw; /* wavefield */ - sf_complex ***pw; - sf_complex ***pwsum; - sf_complex ***ds; /* slowness */ - sf_complex ***ps; - sf_complex ***pssum; -}; -/*^*/ - -/*------------------------------------------------------------*/ -typedef struct camoperator *camoperator3d; -/*^*/ - -struct camoperator{ - sf_complex ****ww; /* wavefield */ - sf_complex ***qq; /* image */ -}; -/*^*/ - -#endif diff --git a/user/nobody/window1.c b/user/nobody/window1.c deleted file mode 100644 index 163d7652c3..0000000000 --- a/user/nobody/window1.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Splitting data into windows, 1-D */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include -/*^*/ - -#include "window1.h" - -static float h,dw; - -void window1_init (float h_in /* window overlap */, - float dw_in /* window size */) -/*< initialize >*/ -{ - h = h_in; - dw = dw_in; -} - -int window1_apply (int iw /* window number */, - int w /* window size */, - const float* dat /* input data */, - bool left /* taper on the left */, - bool right /* taper on the right */, - float *win /* output window */) -/*< extract window >*/ -{ - int i, i0; - float gain; - - i0 = 0.5+iw*dw; - for (i=0; i < w; i++) { - if (left && i < h) { - gain = sinf(0.5*SF_PI*i/h); - win[i] = gain*gain*dat[i0+i]; - } else if (right && i >= w-h) { - gain = sinf(0.5*SF_PI*(w-i-1)/h); - win[i] = gain*gain*dat[i0+i]; - } else { - win[i] = dat[i0+i]; - } - } - - return i0; -} - -/* $Id$ */ diff --git a/user/nobody/window2.c b/user/nobody/window2.c deleted file mode 100644 index 2379e9182f..0000000000 --- a/user/nobody/window2.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Extract window from data, 2-D */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include -/*^*/ - -#include "window2.h" - -static int *w, *nw, *n; -static float *h; - -void window2_init (int* w_in /* window size [2] */, - int* nw_in /* number of windows [2] */, - int* n_in /* data size [2] */, - float* h_in /* window overlap [2] */) -/*< initialize >*/ -{ - w = w_in; - nw = nw_in; - n = n_in; - h = h_in; -} - -void window2_apply (const int* i /* window number [2] */, - float** dat /* input data */, - bool left /* left taper */, - bool right /* right taper */, - bool top /* top taper */, - bool bottom /* bottom taper */, - int* i0 /* window start [2] */, - float** win /* output window */) -/*< extract window >*/ -{ - int i1, i2, j; - float gain1, gain2; - - for (j=0; j < 2; j++) { - i0[j] = 0.5+(n[j]-w[j])*i[j]/(nw[j]-1.); - } - - for (i2=0; i2 < w[1]; i2++) { - if (left && i2+1 <= h[1]) { - gain2 = sinf(0.5*SF_PI*i2/h[1]); - } else if (right && i2 >= w[1]-h[1]) { - gain2 = sinf(0.5*SF_PI*(w[1]-i2-1)/h[1]); - } else { - gain2 = 1.; - } - for (i1=0; i1 < w[0]; i1++) { - if (top && i1+1 <= h[0]) { - gain1 = sinf(0.5*SF_PI*i1/h[0]); - } else if (bottom && i1 >= w[0]-h[0]) { - gain1 = sinf(0.5*SF_PI*(w[0]-i1-1)/h[0]); - } else { - gain1 = 1.; - } - - gain1 *= gain2; - gain1 *= gain1; - - win[i2][i1] = gain1*dat[i0[1]+i2][i0[0]+i1]; - } - } -} - -/* $Id$ */ diff --git a/user/nobody/window3.c b/user/nobody/window3.c deleted file mode 100644 index 9284ad2156..0000000000 --- a/user/nobody/window3.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Extract window from data, 3-D */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include -/*^*/ - -#include "window3.h" - -static int *w, *nw, *n; -static float *h; - -void window3_init (int* w_in /* window size [3] */, - int* nw_in /* number of windows [3] */, - int* n_in /* data size [3] */, - float* h_in /* overlap [3] */) -/*< initialize >*/ -{ - w = w_in; - nw = nw_in; - n = n_in; - h = h_in; -} - -void window3_apply (const int* i /* window number [3] */, - float*** dat /* input data */, - bool near, bool far, - bool left, bool right, - bool top, bool bottom /* tapering */, - int* i0 /* window start [3] */, - float*** win /* output window */) -/*< extract window >*/ -{ - int i1, i2, i3, j; - float gain1, gain2, gain3; - - for (j=0; j < 3; j++) { - i0[j] = 0.5+(n[j]-w[j])*i[j]/(nw[j]-1.); - } - - for (i3=0; i3 < w[2]; i3++) { - if (near && i3+1 <= h[2]) { - gain3 = sinf(0.5*SF_PI*i3/h[2]); - } else if (far && i3 >= w[2]-h[2]) { - gain3 = sinf(0.5*SF_PI*(w[2]-i3-1)/h[2]); - } else { - gain3 = 1.; - } - for (i2=0; i2 < w[1]; i2++) { - if (left && i2+1 <= h[1]) { - gain2 = sinf(0.5*SF_PI*i2/h[1]); - } else if (right && i2 >= w[1]-h[1]) { - gain2 = sinf(0.5*SF_PI*(w[1]-i2-1)/h[1]); - } else { - gain2 = 1.; - } - - gain2 *= gain3; - - for (i1=0; i1 < w[0]; i1++) { - if (top && i1+1 <= h[0]) { - gain1 = sinf(0.5*SF_PI*i1/h[0]); - } else if (bottom && i1 >= w[0]-h[0]) { - gain1 = sinf(0.5*SF_PI*(w[0]-i1-1)/h[0]); - } else { - gain1 = 1.; - } - - gain1 *= gain2; - gain1 *= gain1; - - win[i3][i2][i1] = gain1*dat[i0[2]+i3][i0[1]+i2][i0[0]+i1]; - } - } - } -} - -/* $Id$ */ diff --git a/user/nobody/xcorr.c b/user/nobody/xcorr.c deleted file mode 100644 index d7d39a6cfe..0000000000 --- a/user/nobody/xcorr.c +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include - -#include - -#include "xcorr.h" - -float xcorr (int n1, int n2, const float *x1, const float *x2, - int nc, float *xc) -{ - int is, ix, iy, imax, i2; - float xmax, xp, xm, num, den, ds, shift, a1, a2; - - for (is = 0; is < nc; is++) { - xc[is] = 0.; - a1 = 0.; - a2 = 0.; - for (i2=0; i2 < n2; i2++) { - for (ix=0; ix < n1; ix++) { - iy = ix + (nc+1)/2 - is -1; - if (iy >= 0 && iy < n1) { - xc[is] += x1[ix+i2*n1]*x2[iy+i2*n1]; - a1 += x1[ix+i2*n1]*x1[ix+i2*n1]; - a2 += x2[iy+i2*n1]*x2[iy+i2*n1]; - } - } - } - /* normalize */ - xc[is] /= sqrtf(a1*a2+FLT_EPSILON); - } - - imax=(nc+1)/2; - xmax=xc[imax]; - for (is = 0; is < nc; is++) { - if (xc[is] > xmax) { - imax = is; - xmax = xc[is]; - } - } - - shift = imax - (nc+1)/2; - - /* quadratic interpolation for sub-sample accuracy */ - if (imax > 0 && imax < nc-1) { - xp = xc[imax+1]; - xm = xc[imax-1]; - num = 0.5*(xp-xm); - den = xm+xp-2.*xmax; - ds = num*den/(den*den+FLT_EPSILON); - if (fabsf(ds) < 1.) shift -= ds; - } - - return shift; -} - -/* $Id$ */ - diff --git a/user/nobody/zomig3.c b/user/nobody/zomig3.c deleted file mode 100644 index 296128e855..0000000000 --- a/user/nobody/zomig3.c +++ /dev/null @@ -1,483 +0,0 @@ -/* 3-D SSR migration/modeling using extended split-step */ - -/* - Copyright (C) 2007 Colorado School of Mines - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include -/*^*/ - -#ifdef _OPENMP -#include -#endif - -#include "zomig3.h" -#include "taper3.h" -#include "slow3.h" -#include "ssr3.h" - -#include "slice.h" -/*^*/ - -#include "weutil.h" -/*^*/ - -#define LOOP(a) for(imy=0;imyamy.n;imy++){ \ - for(imx=0;imxamx.n;imx++){ \ - {a} \ - }} /* loop in x-domain */ - -/*------------------------------------------------------------*/ -cub3d zomig3_cube(bool verb_, - sf_axis amx_, - sf_axis amy_, - sf_axis amz_, - sf_axis alx_, - sf_axis aly_, - sf_axis aw_, - sf_axis ae_, - float eps_, - int ompnth_, - int ompchunk_ - ) -/*< initialize SR migration space >*/ -{ - cub3d cub; - cub = (cub3d) sf_alloc(1,sizeof(*cub)); - - cub->verb=verb_; - cub->amx = sf_nod(amx_); - cub->amy = sf_nod(amy_); - cub->amz = sf_nod(amz_); - - cub->alx = sf_nod(alx_); - cub->aly = sf_nod(aly_); - cub->ae = sf_nod(ae_); - - cub->aw = sf_nod(aw_); - cub->aw.d *= 2.*SF_PI; /* from hertz to radians */ - cub->aw.o *= 2.*SF_PI; - - cub->eps = eps_; - - cub->ompnth = ompnth_; - cub->ompchunk = ompchunk_; - - return cub; -} - -/*------------------------------------------------------------*/ -ssroperator3d zomig3_init(cub3d cub) -/*< initialize >*/ -{ - ssroperator3d weop; - weop = (ssroperator3d) sf_alloc(1,sizeof(*weop)); - - weop->ww = sf_complexalloc3(cub->amx.n,cub->amy.n,cub->ompnth); - weop->qq = sf_complexalloc2(cub->amx.n,cub->amy.n); - - return weop; -} - -/*------------------------------------------------------------*/ -void zomig3_close(ssroperator3d weop) -/*< free allocated storage >*/ -{ - free( **weop->ww);free( *weop->ww); free( weop->ww); - ; free( *weop->qq); free( weop->qq); -} - -/*------------------------------------------------------------*/ -void zomig3(ssroperator3d weop, - cub3d cub, - ssr3d ssr, - tap3d tap, - slo3d slo, - bool inv /* forward/adjoint flag */, - fslice data /* data [nw][nmy][nmx] */, - fslice imag /* image [nz][nmy][nmx] */) -/*< Apply migration/modeling >*/ -{ - int imz,iw,imy,imx; - sf_complex w; - int ompith=0; - - if(!inv) { /* prepare image for migration */ - LOOP( weop->qq[imy][imx] = sf_cmplx(0.,0.); ); - for (imz=0; imzamz.n; imz++) { - fslice_put(imag,imz,weop->qq[0]); - } - } - -#ifdef _OPENMP -#pragma omp parallel for schedule(static) \ - private(ompith,iw,w,imx,imy,imz) \ - shared(data,weop,cub,ssr,tap,slo) -#endif - for (iw=0; iwaw.n; iw++) { -#ifdef _OPENMP - ompith=omp_get_thread_num(); -#pragma omp critical -#endif - if(cub->verb) sf_warning ("(ith=%d) ... ", - ompith,iw+1,cub->aw.n); - - if(inv) { /* MODELING */ - w = sf_cmplx(cub->eps*cub->aw.d, - cub->aw.o+iw*cub->aw.d); /* causal */ - - LOOP( weop->ww[ompith][imy][imx] = sf_cmplx(0.,0.); ); - - /* upward continuation */ -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(slo->slice,cub->amz.n-1,slo->so[ompith][0]); - slow3_twoway(cub,slo,slo->so,ompith); /* 2way time */ - for (imz=cub->amz.n-1; imz>0; imz--) { - -#ifdef _OPENMP -#pragma omp critical -#endif - { - fslice_get(imag,imz,weop->qq[0]); /* I.C. */ -#ifdef SF_HAS_COMPLEX_H - LOOP( weop->ww[ompith][imy][imx] += - weop->qq [imy][imx]; ); -#else - LOOP( weop->ww[ompith][imy][imx] = sf_cadd( - weop->ww[ompith][imy][imx], - weop->qq [imy][imx]); ); -#endif - } -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(slo->slice,imz-1,slo->ss[ompith][0]); - slow3_twoway(cub,slo,slo->ss,ompith); /* 2way time */ - - ssr3_ssf(w,weop->ww[ompith],cub,ssr,tap,slo,imz,ompith); - slow3_advance(cub,slo,ompith); - } - - /* imaging at z=0 */ -#ifdef _OPENMP -#pragma omp critical -#endif - { - fslice_get(imag,0,weop->qq[0]); -#ifdef SF_HAS_COMPLEX_H - LOOP( weop->ww[ompith][imy][imx] += - weop->qq[imy][imx]; ); -#else - LOOP( weop->ww[ompith][imy][imx] = sf_cadd( - weop->ww[ompith][imy][imx], - weop->qq[imy][imx]); ); -#endif - } - - taper2d(weop->ww[ompith],tap); -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_put(data,iw,weop->ww[ompith][0]); /* output data @ iz=0 */ - - } else { /* MIGRATION */ - w = sf_cmplx(cub->eps*cub->aw.d, - -(cub->aw.o+iw*cub->aw.d)); /* anti-causal */ - - /* imaging at z=0 */ -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(data,iw,weop->ww[ompith][0]); - taper2d(weop->ww[ompith],tap); - -#ifdef _OPENMP -#pragma omp critical -#endif - { - fslice_get(imag,0,weop->qq[0]); -#ifdef SF_HAS_COMPLEX_H - LOOP(; weop->qq[imy][imx] += - weop->ww[ompith][imy][imx]; ); -#else - LOOP(; weop->qq[imy][imx] = sf_cadd( - weop->qq[imy][imx], - weop->ww[ompith][imy][imx]); ); -#endif - fslice_put(imag,0,weop->qq[0]); - } - - /* downward continuation */ -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(slo->slice,0,slo->so[ompith][0]); - slow3_twoway(cub,slo,slo->so,ompith); /* 2way time */ - for (imz=0; imzamz.n-1; imz++) { - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(slo->slice,imz+1,slo->ss[ompith][0]); - slow3_twoway(cub,slo,slo->ss,ompith); /* 2way time */ - - ssr3_ssf(w,weop->ww[ompith],cub,ssr,tap,slo,imz,ompith); - slow3_advance(cub,slo,ompith); - -#ifdef _OPENMP -#pragma omp critical -#endif - { - fslice_get(imag,imz+1,weop->qq[0]); /* I.C. */ -#ifdef SF_HAS_COMPLEX_H - LOOP(; weop->qq[imy][imx] += - weop->ww[ompith][imy][imx]; ); -#else - LOOP(; weop->qq[imy][imx] = sf_cadd( - weop->qq[imy][imx], - weop->ww[ompith][imy][imx]); ); -#endif - fslice_put(imag,imz+1,weop->qq[0]); - } - } /* z */ - } /* else */ - } /* w */ -} - -/*------------------------------------------------------------*/ -void zodtm3(ssroperator3d weop, - cub3d cub, - ssr3d ssr, - tap3d tap, - slo3d slo, - bool inv /* forward/adjoint flag */, - bool causal, - fslice data /* data [nw][nmy][nmx] */, - fslice wfld /* wfld [nw][nmy][nmx] */) -/*< Apply upward/downward datuming >*/ -{ - int imz,iw,ie; - sf_complex w; - int ompith=0; - - for(ie=0; ieae.n; ie++) { -#ifdef _OPENMP -#pragma omp parallel for schedule(static) \ - private(ompith,iw,w,imz) \ - shared(data,wfld,weop,cub,ssr,tap,slo,ie) -#endif - for (iw=0; iwaw.n; iw++) { -#ifdef _OPENMP - ompith=omp_get_thread_num(); -#pragma omp critical -#endif - if(cub->verb) sf_warning ("(ith=%d) ... ... ", - ompith,iw+1,cub->aw.n,ie+1,cub->ae.n); - - if(inv) { /* UPWARD DATUMING */ - if(causal) { - w = sf_cmplx(cub->eps*cub->aw.d,-(cub->aw.o+iw*cub->aw.d)); - } else { - w = sf_cmplx(cub->eps*cub->aw.d, cub->aw.o+iw*cub->aw.d ); - } - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(wfld,iw+ie*cub->aw.n,weop->ww[ompith][0]); - taper2d(weop->ww[ompith],tap); - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(slo->slice,cub->amz.n-1,slo->so[ompith][0]); - slow3_twoway(cub,slo,slo->so,ompith); /* 2way time */ - - for (imz=cub->amz.n-1; imz>0; imz--) { - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(slo->slice,imz-1,slo->ss[ompith][0]); - slow3_twoway(cub,slo,slo->ss,ompith); /* 2way time */ - - ssr3_ssf(w,weop->ww[ompith],cub,ssr,tap,slo,imz,ompith); - slow3_advance(cub,slo,ompith); - } - - taper2d(weop->ww[ompith],tap); -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_put(data,iw+ie*cub->aw.n,weop->ww[ompith][0]); - } else { /* DOWNWARD DATUMING */ - if(causal) { - w = sf_cmplx(cub->eps*cub->aw.d, cub->aw.o+iw*cub->aw.d ); - } else { - w = sf_cmplx(cub->eps*cub->aw.d,-(cub->aw.o+iw*cub->aw.d)); - } - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(data,iw+ie*cub->aw.n,weop->ww[ompith][0]); - taper2d(weop->ww[ompith],tap); - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(slo->slice,0,slo->so[ompith][0]); - slow3_twoway(cub,slo,slo->so,ompith); /* 2way time */ - - for (imz=0; imzamz.n-1; imz++) { -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(slo->slice,imz+1,slo->ss[ompith][0]); - slow3_twoway(cub,slo,slo->ss,ompith); /* 2way time */ - - ssr3_ssf(w,weop->ww[ompith],cub,ssr,tap,slo,imz,ompith); - slow3_advance(cub,slo,ompith); - } - - taper2d(weop->ww[ompith],tap); -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_put(wfld,iw+ie*cub->aw.n,weop->ww[ompith][0]); - } /* else */ - } /* w */ - } /* e */ -} - -/*------------------------------------------------------------*/ -void zowfl3(ssroperator3d weop, - cub3d cub, - ssr3d ssr, - tap3d tap, - slo3d slo, - bool inv /* forward/adjoint flag */, - bool causal, - fslice data /* data [nw][nmy][nmx] */, - fslice wfld /* wavefield [nw][nmy][nmx] */) -/*< Save wavefield from downward continuation >*/ -{ - int imz,iw; - sf_complex w; - int ompith=0; - -#ifdef _OPENMP -#pragma omp parallel for schedule(static) \ - private(ompith,iw,w,imz) \ - shared(data,wfld,weop,cub,ssr,tap,slo) -#endif - for (iw=0; iwaw.n; iw++) { -#ifdef _OPENMP - ompith=omp_get_thread_num(); -#pragma omp critical -#endif - if(cub->verb) sf_warning ("(ith=%d) ... ", - ompith,iw+1,cub->aw.n); - - if(inv) { /* UPWARD EXTRAPOLATION */ - if(causal) { - w = sf_cmplx(cub->eps*cub->aw.d,-(cub->aw.o+iw*cub->aw.d)); - } else { - w = sf_cmplx(cub->eps*cub->aw.d, cub->aw.o+iw*cub->aw.d ); - } - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(data,iw,weop->ww[ompith][0]); - taper2d(weop->ww[ompith],tap); -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_put(wfld,iw*cub->amz.n+cub->amz.n-1,weop->ww[ompith][0]); - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(slo->slice,cub->amz.n-1,slo->so[ompith][0]); - slow3_twoway(cub,slo,slo->so,ompith); /* 2way time */ - - for (imz=cub->amz.n-1; imz>0; imz--) { - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(slo->slice,imz-1,slo->ss[ompith][0]); - slow3_twoway(cub,slo,slo->ss,ompith); /* 2way time */ - - ssr3_ssf(w,weop->ww[ompith],cub,ssr,tap,slo,imz,ompith); - slow3_advance(cub,slo,ompith); - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_put(wfld,iw*cub->amz.n+imz-1,weop->ww[ompith][0]); - } - - } else { /* DOWNWARD EXTRAPOLATION */ - if(causal) { - w = sf_cmplx(cub->eps*cub->aw.d, cub->aw.o+iw*cub->aw.d ); - } else { - w = sf_cmplx(cub->eps*cub->aw.d,-(cub->aw.o+iw*cub->aw.d)); - } - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(data,iw,weop->ww[ompith][0]); - taper2d(weop->ww[ompith],tap); -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_put(wfld,iw*cub->amz.n,weop->ww[ompith][0]); - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(slo->slice,0,slo->so[ompith][0]); - slow3_twoway(cub,slo,slo->so,ompith); /* 2way time */ - - for (imz=0; imzamz.n-1; imz++) { - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_get(slo->slice,imz+1,slo->ss[ompith][0]); - slow3_twoway(cub,slo,slo->ss,ompith); /* 2way time */ - - ssr3_ssf(w,weop->ww[ompith],cub,ssr,tap,slo,imz,ompith); - slow3_advance(cub,slo,ompith); - -#ifdef _OPENMP -#pragma omp critical -#endif - fslice_put(wfld,iw*cub->amz.n+imz+1,weop->ww[ompith][0]); - } /* z */ - } /* else */ - } /* w */ -} -/*------------------------------------------------------------*/ - diff --git a/user/nobody/ztrace2.c b/user/nobody/ztrace2.c deleted file mode 100644 index 7d3ed96347..0000000000 --- a/user/nobody/ztrace2.c +++ /dev/null @@ -1,218 +0,0 @@ -/* Multiple arrivals by marching down. */ -/* - Copyright (C) 2004 University of Texas at Austin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include - -#include - -#include "ztrace2.h" - -#include "enogrid.h" -#include "grid1.h" - -#ifndef _ztrace_h - -#define NS 4 /* number of outputs */ -/*^*/ - -#endif - -static int nx, nz, na, nax; -static float dx,dz,da, x0,z0,a0, xm,zm,am, r2a; -static sf_eno2 cvel; -static enogrid slice; -static grid1 *prev, *curr; - -static int snap(float *f, int n); - -void ztrace2_init (int order /* interpolation order for velocity */, - int iorder /* interpolation order for values */, - float** vel /* slowness [nx][nz] */, - int nx1 /* lateral samples */, - int nz1 /* depth samples */, - int na1 /* angle samples */, - float dx1 /* lateral sampling */, - float dz1 /* depth sampling */, - float da1 /* angle sampling */, - float x01 /* lateral origin */, - float z01 /* depth origin */, - float a01 /* angle origin */) -/*< Initialize >*/ -{ - int ix, kx, ka; - float a, f[NS]; - - nx = nx1; nz = nz1; na = na1; - dx = dx1; dz = dz1; da = da1; - x0 = x01; z0 = z01; a0 = a01; - nax = na*nx; - xm = x0 + (nx-1)*dx; - zm = z0 + (nz-1)*dz; - am = a0 + (na-1)*da; - - cvel = sf_eno2_init (order, nz, nx); - sf_eno2_set (cvel, vel); - - prev = (grid1*) sf_alloc(nx,sizeof(grid1)); - curr = (grid1*) sf_alloc(nx,sizeof(grid1)); - for (ix=0; ix < nx; ix++) { - prev[ix] = grid1_init(); - curr[ix] = grid1_init(); - } - - r2a = 180./SF_PI; /* radian to degree */ - - for (kx=0; kx < nx; kx++) { /* loop in x */ - for (ka=0; ka < na; ka++) { /* loop in angle */ - a = a0+ka*da; - - f[0] = 0.; - f[1] = x0+kx*dx; - f[2] = z0; - f[3] = a*r2a; - - grid1_insert(curr[kx],a,4,f); - } - } - - slice = enogrid_init (iorder, nx, NS, prev); -} - -void ztrace2_close (void) -/*< Free allocated storage >*/ -{ - sf_eno2_close (cvel); - enogrid_close(slice); - - /* close grid */ - free(prev); - free(curr); -} - -void ztrace2_write (sf_file out) -/*< Write it out >*/ -{ - int ix; - for (ix=0; ix < nx; ix++) { - grid1_write(curr[ix],NS,out); - } -} - -void ztrace2_step (int kz) -/*< Step in depth >*/ -{ - float v, g[2], t, z1, x1, x2, a1, a2, delz, tn, cs, f[4], s, fx; - int kx, ka, k, ix; - - /* assign the previous slice for interpolation */ - for (ix=0; ix < nx; ix++) { - grid1_close(prev[ix]); - prev[ix] = curr[ix]; - curr[ix] = grid1_init(); - } - - for (kx=0; kx < nx; kx++) { /* loop in x */ - - /* get slowness squared and gradient */ - sf_eno2_apply(cvel,kz,kx,0.,0.,&v,g,BOTH); - g[0] /= dz; - g[1] /= dx; - - for (ka=0; ka < na; ka++) { /* loop in angle */ - k = ka + kx*na; /* index in a slice */ - a1 = a0+ka*da; - - tn = tanf(a1); - cs = cosf(a1); - - x1 = x0+kx*dx; - z1 = z0+kz*dz; - - /* decide if we are out already */ - if ((kz == 0 && cs > 0.) || - (kz == nz-1 && cs < 0.) || - (kx == 0 && tn < 0.) || - (kx == nx-1 && tn > 0.)) { - f[0] = 0.; - f[1] = x1; - f[2] = z1; - f[3] = a1*r2a; - } else { - x2 = x1+tn*dz; - if (x2 < x0) { - /* exit from the left side */ - delz = (x0-x1)/tn; - t = s*delz/cs; - a2 = a1 + (g[1]-g[0]*tn)*delz/v; - - enogrid_apply(slice,0,0.,a2,f); - f[1]=x0; - f[2]=z1-delz; - } else if (x2 > xm) { - /* exit from the right side */ - delz = (xm-x1)/tn; - t = s*delz/cs; - a2 = a1 + (g[1]-g[0]*tn)*delz/v; - - enogrid_apply(slice,nx-1,0.,a2,f); - f[1]=xm; - f[2]=z1-delz; - } else { - /* exit on previous level */ - t = s*dz/cs; - a2 = a1 + (g[1]-g[0]*tn)*dz/v; - - fx = (x2-x0)/dx; - ix = snap(&x2,nx); - enogrid_apply(slice,ix,fx,a2,f); - - if (f[1] < x0) f[1]=x0; - if (f[1] > xm) f[1]=xm; - if (f[2] < z0) f[2]=z0; - if (f[2] > zm) f[2]=zm; - } - - if (f[0] < 0.) f[0]=0.; - f[0] += t; - if (f[3] < a0*r2a) f[3]=a0*r2a; - if (f[3] > am*r2a) f[3]=am*r2a; - } - - grid1_insert(curr[kx],a1,4,f); - } /* ka */ - } /* kx */ -} - -static int snap(float *f, int n) -{ - int i; - - i = floorf(*f); - if (i < 0) { - i=0; - *f=0.; - } else if (i >= n-1) { - i=n-1; - *f=0.; - } else { - *f -= i; - } - - return i; -}