FOURIER METHODS 119

4.4. FOURIER METHODS 119

Figure 4.54: The result of the f -k migration of Figure 4.55: The result of the f -k migration of the data of Figure 4.31.

the data of Figure 4.34.

the non-negative temporal frequencies is more efficient because less memory and fewer calculations are required. Also, it requires more care to formulate an algorithm correctly to process both positive and negative frequencies. If the processed spectrum does not have the correct conjugate symmetry then its inverse transform will will result in a complex-valued seismic matrix. It is easier to process only the non-negative frequencies and calculate the negative ones as needed from the symmetry condition. The function fktran has a companion inverse ifktran (invoked on line 34) that creates the negative temporal frequencies from the non-negative ones and then calls fft2.

Continuing with Code Snippet 4.4.2, line 3 calculates the exploding reflector velocity that is required in the theory. The major computation loop is over k x (the columns of fkspec) and extends from line 9 to line 32. Each iteration through the loop converts one column of fkspec, representing

φ 0 of equation (4.53), into a column vector representing φ m . Prior to the loop, lines 5-6 compute the vertical coordinate vector, kz, for the matrix representing φ m (df is the frequency sample rate). On line 7, k 2 z is pre-computed as this is needed in every loop. The first action in the loop (line 11) is to apply frequency and dip masks to the relevant column of fkspec and the result is stored in the temporary vector tmp. The calculation of these masks is not shown in this example. They are simply vectors of the same size as a column of fkspec whose entries range between zero and one. The frequency mask, fmask, is pre-computed outside the loop but the dip mask, dipmask must be recalculated with every iteration. These masks are designed to attenuate the frequencies and dips that are not of interest. For example, it is customary to migrate only frequencies below a certain maximum, f max . Thus a simple fmask could could be unity for f ≤ f max and zero for f > f max . However, from a signal processing perspective, such an abrupt cutoff is not desirable so a better fmask might be

 1, f ≤ f max −f wid

f ! mask = 1 2 + 1 2 cos π f −f max +f wid f wid ,f max −f wid <f≤f max . (4.55)

   0, f > f max

This defines a raised-cosine ramp of width f wid from unity at f = f max −f wid to zero at f = f max . The dip mask must be recomputed at every loop iteration because the frequency corresponding to

120 CHAPTER 4. ELEMENTARY MIGRATION METHODS

a given dip changes as k x changes according to f = k x v/ sin θ. Like the frequency mask, the dip ˆ mask should use a raised-cosine ramp from zero at θ max to unity at θ max −θ wid . Thus dipmask attenuates low frequencies while fmask attenuates high frequencies.

Next, on line 13 in Code Snippet 4.4.2, the frequencies that map to each output k z called fmap , are calculated via equation (4.51). Since the spectral mapping generally lowers frequencies (see Figure 4.49) many of these frequencies will, in general, be greater than the maximum desired frequency to migrate. Thus, on line 14, MATLAB’s powerful find command is used to identify the entries in the vector fmap that are lower than the maximum frequency to migrate, fmapmig. (fmapmig corresponds to f max in equation (4.55).) At this stage, the vector ind is a vector of indices into fmap that points to those frequencies that will be migrated.

On line 16 the current column of fkspec is set to zero in preparation for the actual migration that happens in the if-block from line 17 to line 28. Lines 18-25 compute the cosine scale factor that occurs in equation (4.53) with a special case for f = 0 to avoid division by zero. Line 27 does the actual spectral mapping and applies the cosine scale factor. The spectral mapping is accomplished by

a sinc-function interpolation, that is optimized for complex-valued spectra, by the function csinci . On lines 29-31, a progress message is printed. Though not strictly necessary, this is considered

good form because there are few things more disconcerting than waiting for a computer to finish a long calculation without any indication that progress is occurring. A message is printed only after every kpflag wavenumbers have been processed. This is controllable through the input params vector.

Finally, after the completion of the loop on line 34, the migrated spectrum is inverse transformed. Generally, the zero pads are then removed though this is not shown.

Code Snippet 4.4.2. This is an excerpt from the code of fkmig that shows the steps of major importance. The actual fkmig source code contains 319 lines that handle the manynon-technical details required for a useful code.

1 %forward fk transform

2 [fkspec,f,kx] = fktran(seis,tnew,xnew,nsampnew,ntrnew,0,0);