lib/App/SeismicUnixGui/sunix/transform/sugabor.pm untested

filter: Statementstmt 0.0% 0 / 78 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 12 totaltotal 0.0% 0 / 120 CC 9 SCAR 15.9
CC
9
Cov
0%
alpha
6.0
band
6.0
beta
6.0
CRAP 4.9
1 package App::SeismicUnixGui::sunix::transform::sugabor;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: SUGABOR - Outputs a time-frequency representation of seismic data via
8 AUTHOR: Juan Lorenzo (Perl module only)
9 DATE:
10 DESCRIPTION:
11 Version:
12  
13 =head2 USE
14  
15 =head3 NOTES
16  
17 =head4 Examples
18  
19 =head3 SEISMIC UNIX NOTES
20  
21 SUGABOR - Outputs a time-frequency representation of seismic data via
22 the Gabor transform-like multifilter analysis technique
23 presented by Dziewonski, Bloch and Landisman, 1969.
24  
25 sugabor <stdin >stdout [optional parameters]
26  
27 Required parameters:
28 if dt is not set in header, then dt is mandatory
29  
30 Optional parameters:
31 dt=(from header) time sampling interval (sec)
32 fmin=0 minimum frequency of filter array (hz)
33 fmax=NYQUIST maximum frequency of filter array (hz)
34 beta=3.0 ln[filter peak amp/filter endpoint amp]
35 band=.05*NYQUIST filter bandwidth (hz)
36 alpha=beta/band^2 filter width parameter
37 verbose=0 =1 supply additional info
38 holder=0 =1 output Holder regularity estimate
39 =2 output linear regularity estimate
40  
41 Notes: This program produces a muiltifilter (as opposed to moving window)
42 representation of the instantaneous amplitude of seismic data in the
43 time-frequency domain. (With Gaussian filters, moving window and multi-
44 filter analysis can be shown to be equivalent.)
45  
46 An input trace is passed through a collection of Gaussian filters
47 to produce a collection of traces, each representing a discrete frequency
48 range in the input data. For each of these narrow bandwidth traces, a
49 quadrature trace is computed via the Hilbert transform. Treating the narrow
50 bandwidth trace and its quadrature trace as the real and imaginary parts
51 of a "complex" trace permits the "instantaneous" amplitude of each
52 narrow bandwidth trace to be compute. The output is thus a representation
53 of instantaneous amplitude as a function of time and frequency.
54  
55 Some experimentation with the "band" parameter may necessary to produce
56 the desired time-frequency resolution. A good rule of thumb is to run
57 sugabor with the default value for band and view the image. If band is
58 too big, then the t-f plot will consist of stripes parallel to the frequency
59 axis. Conversely, if band is too small, then the stripes will be parallel
60 to the time axis.
61  
62 Caveat:
63 The Gabor transform is not a wavelet transform, but rather are sharp
64 frame basis. However, it is nearly a Morlet continuous wavelet transform
65 so the concept of Holder regularity may have some meaning. If you are
66 computing Holder regularity of, say, a migrated seismic section, then
67 set band to 1/3 of the frequency band of your data.
68  
69 Examples:
70 suvibro | sugabor | suximage
71 suvibro | sugabor | suxmovie n1= n2= n3=
72 (because suxmovie scales it's amplitudes off of the first panel,
73 may have to experiment with the wclip and bclip parameters
74 suvibro | sugabor | supsimage | ... ( your local PostScript utility)
75  
76  
77 Credits:
78  
79 CWP: John Stockwell, Oct 1994
80 CWP: John Stockwell Oct 2004, added holder=1 option
81 Algorithm:
82  
83 This programs takes an input seismic trace and passes it
84 through a collection of truncated Gaussian filters in the frequency
85 domain.
86  
87 The bandwidth of each filter is given by the parameter "band". The
88 decay of these filters is given by "alpha", and the number of filters
89 is given by nfilt = (fmax - fmin)/band. The result, upon inverse
90 Fourier transforming, is that nfilt traces are created, with each
91 trace representing a different frequency band in the original data.
92  
93 For each of the resulting bandlimited traces, a quadrature (i.e. pi/2
94 phase shifted) trace is computed via the Hilbert transform. The
95 bandlimited trace constitutes a "complex trace", with the bandlimited
96 trace being the "real part" and the quadrature trace being the
97 "imaginary part". The instantaneous amplitude of each bandlimited
98 trace is then computed by computing the modulus of each complex trace.
99 (See Taner, Koehler, and Sheriff, 1979, for a discussion of complex
100 trace analysis.
101  
102 The final output for a given input trace is a map of instantaneous
103 amplitude as a function of time and frequency.
104  
105 This is not a wavelet transform, but rather a redundant frame
106 representation.
107  
108 References: Dziewonski, Bloch, and Landisman, 1969, A technique
109 for the analysis of transient seismic signals,
110 Bull. Seism. Soc. Am., 1969, vol. 59, no.1, pp.427-444.
111  
112 Taner, M., T., Koehler, F., and Sheriff, R., E., 1979,
113 Complex seismic trace analysis, Geophysics, vol. 44,
114 pp.1041-1063.
115  
116 Chui, C., K.,1992, Introduction to Wavelets, Academic
117 Press, New York.
118  
119 Trace header fields accessed: ns, dt, trid, ntr
120 Trace header fields modified: tracl, tracr, d1, f2, d2, trid, ntr
121  
122 =head2 CHANGES and their DATES
123  
124 =cut
125  
126 use Moose;
127 our $VERSION = '0.0.1';
128 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
129  
130 my $get = L_SU_global_constants->new();
131  
132 my $var = $get->var();
133 my $empty_string = $var->{_empty_string};
134  
135 my $sugabor = {
136 _alpha => '',
137 _band => '',
138 _beta => '',
139 _dt => '',
140 _fmax => '',
141 _fmin => '',
142 _holder => '',
143 _verbose => '',
144 _Step => '',
145 _note => '',
146 };
147  
148 =head2 sub Step
149  
150 collects switches and assembles bash instructions
151 by adding the program name
152  
153 =cut
154  
155 sub Step {
156  
157 $sugabor->{_Step} = 'sugabor' . $sugabor->{_Step};
158 return ( $sugabor->{_Step} );
159  
160 }
161  
162 =head2 sub note
163  
164 collects switches and assembles bash instructions
165 by adding the program name
166  
167 =cut
168  
169 sub note {
170  
171 $sugabor->{_note} = 'sugabor' . $sugabor->{_note};
172 return ( $sugabor->{_note} );
173  
174 }
175  
176 =head2 sub clear
177  
178 =cut
179  
180 sub clear {
181  
182 $sugabor->{_alpha} = '';
183 $sugabor->{_band} = '';
184 $sugabor->{_beta} = '';
185 $sugabor->{_dt} = '';
186 $sugabor->{_fmax} = '';
187 $sugabor->{_fmin} = '';
188 $sugabor->{_holder} = '';
189 $sugabor->{_n1} = '';
190 $sugabor->{_nfilt} = '';
191 $sugabor->{_verbose} = '';
192 $sugabor->{_Step} = '';
193 $sugabor->{_note} = '';
194 }
195  
196 =head2 sub alpha
197  
198  
199 =cut
200  
201 sub alpha {
202  
203 my ( $self, $alpha ) = @_;
204 if ( $alpha ne $empty_string ) {
205  
206 $sugabor->{_alpha} = $alpha;
207 $sugabor->{_note} =
208 $sugabor->{_note} . ' alpha=' . $sugabor->{_alpha};
209 $sugabor->{_Step} =
210 $sugabor->{_Step} . ' alpha=' . $sugabor->{_alpha};
211  
212 }
213 else {
214 print("sugabor, alpha, missing alpha,\n");
215 }
216 }
217  
218 =head2 sub band
219  
220  
221 =cut
222  
223 sub band {
224  
225 my ( $self, $band ) = @_;
226 if ( $band ne $empty_string ) {
227  
228 $sugabor->{_band} = $band;
229 $sugabor->{_note} = $sugabor->{_note} . ' band=' . $sugabor->{_band};
230 $sugabor->{_Step} = $sugabor->{_Step} . ' band=' . $sugabor->{_band};
231  
232 }
233 else {
234 print("sugabor, band, missing band,\n");
235 }
236 }
237  
238 =head2 sub beta
239  
240  
241 =cut
242  
243 sub beta {
244  
245 my ( $self, $beta ) = @_;
246 if ( $beta ne $empty_string ) {
247  
248 $sugabor->{_beta} = $beta;
249 $sugabor->{_note} = $sugabor->{_note} . ' beta=' . $sugabor->{_beta};
250 $sugabor->{_Step} = $sugabor->{_Step} . ' beta=' . $sugabor->{_beta};
251  
252 }
253 else {
254 print("sugabor, beta, missing beta,\n");
255 }
256 }
257  
258 =head2 sub dt
259  
260  
261 =cut
262  
263 sub dt {
264  
265 my ( $self, $dt ) = @_;
266 if ( $dt ne $empty_string ) {
267  
268 $sugabor->{_dt} = $dt;
269 $sugabor->{_note} = $sugabor->{_note} . ' dt=' . $sugabor->{_dt};
270 $sugabor->{_Step} = $sugabor->{_Step} . ' dt=' . $sugabor->{_dt};
271  
272 }
273 else {
274 print("sugabor, dt, missing dt,\n");
275 }
276 }
277  
278 =head2 sub fmax
279  
280  
281 =cut
282  
283 sub fmax {
284  
285 my ( $self, $fmax ) = @_;
286 if ( $fmax ne $empty_string ) {
287  
288 $sugabor->{_fmax} = $fmax;
289 $sugabor->{_note} = $sugabor->{_note} . ' fmax=' . $sugabor->{_fmax};
290 $sugabor->{_Step} = $sugabor->{_Step} . ' fmax=' . $sugabor->{_fmax};
291  
292 }
293 else {
294 print("sugabor, fmax, missing fmax,\n");
295 }
296 }
297  
298 =head2 sub fmin
299  
300  
301 =cut
302  
303 sub fmin {
304  
305 my ( $self, $fmin ) = @_;
306 if ( $fmin ne $empty_string ) {
307  
308 $sugabor->{_fmin} = $fmin;
309 $sugabor->{_note} = $sugabor->{_note} . ' fmin=' . $sugabor->{_fmin};
310 $sugabor->{_Step} = $sugabor->{_Step} . ' fmin=' . $sugabor->{_fmin};
311  
312 }
313 else {
314 print("sugabor, fmin, missing fmin,\n");
315 }
316 }
317  
318 =head2 sub holder
319  
320  
321 =cut
322  
323 sub holder {
324  
325 my ( $self, $holder ) = @_;
326 if ( $holder ne $empty_string ) {
327  
328 $sugabor->{_holder} = $holder;
329 $sugabor->{_note} =
330 $sugabor->{_note} . ' holder=' . $sugabor->{_holder};
331 $sugabor->{_Step} =
332 $sugabor->{_Step} . ' holder=' . $sugabor->{_holder};
333  
334 }
335 else {
336 print("sugabor, holder, missing holder,\n");
337 }
338 }
339  
340 =head2 sub verbose
341  
342  
343 =cut
344  
345 sub verbose {
346  
347 my ( $self, $verbose ) = @_;
348 if ( $verbose ne $empty_string ) {
349  
350 $sugabor->{_verbose} = $verbose;
351 $sugabor->{_note} =
352 $sugabor->{_note} . ' verbose=' . $sugabor->{_verbose};
353 $sugabor->{_Step} =
354 $sugabor->{_Step} . ' verbose=' . $sugabor->{_verbose};
355  
356 }
357 else {
358 print("sugabor, verbose, missing verbose,\n");
359 }
360 }
361  
362 =head2 sub get_max_index
363
364 max index = number of input variables -1
365
366 =cut
367  
368 sub get_max_index {
369 my ($self) = @_;
370 my $max_index = 7;
371  
372 return ($max_index);
373 }
374  
375 1;