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

filter: Statementstmt 0.0% 0 / 126 Branchbran 0.0% 0 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 21 Podpod 0.0% 0 / 17 totaltotal 0.0% 0 / 190 CC 14 SCAR 16.2
CC
14
Cov
0%
base
6.0
divisor
6.0
expinc
6.0
CRAP 5.1
1 package App::SeismicUnixGui::sunix::transform::sucwt;
2  
3 =head2 SYNOPSIS
4  
5 PERL PROGRAM NAME:
6  
7 AUTHOR:
8  
9 DATE:
10  
11 DESCRIPTION:
12  
13 Version:
14  
15 =head2 USE
16  
17 =head3 NOTES
18  
19 =head4 Examples
20  
21 =head2 SYNOPSIS
22  
23 =head3 SEISMIC UNIX NOTES
24 SUCWT - generates Continous Wavelet Transform amplitude, regularity
25  
26 analysis in the wavelet basis
27  
28  
29  
30 sucwt < stdin [Optional parameters ] > stdout
31  
32  
33  
34 Required Parameters:
35  
36 none
37  
38  
39  
40 Optional Parameters:
41  
42 base=10 Base value for wavelet transform scales
43  
44 first=-1 First exponent value for wavelet transform scales
45  
46 expinc=0.01 Exponent increment for wavelet transform scales
47  
48 last=1.5 Last exponent value for wavelet transform scales
49  
50  
51  
52 Wavelet Parameters:
53  
54 wtype=0 2nd derivative of Gaussian (Mexican hat)
55  
56 =1 4th derivative of Gaussian (witch's hat)
57  
58 =2 6th derivative of Gaussian (wizard's hat)
59  
60 nwavelet=1024 number of samples in the wavelet
61  
62 xmin=-20 minimum x value wavelet is computed
63  
64 xcenter=0 center x value wavelet is computed
65  
66 xmax=20 maximum x value wavelet is computed
67  
68 sigma=1 sharpness parameter ( sigma > 1 sharper)
69  
70  
71  
72 verbose=0 silent, =1 chatty
73  
74 holder=0 =1 compute Holder regularity estimate
75  
76 divisor=1.0 a floating point number >= 1.0 (see notes)
77  
78  
79  
80 Notes:
81  
82 This is the CWT version of the time frequency analysis notion that is
83  
84 applied in sugabor.
85  
86 The parameter base is the base of the power that is applied to scale
87  
88 the wavelet. Some mathematical literature assume base 2. Base 10 works
89  
90 well here.
91  
92  
93  
94 Default option yields an output similar to that of sugabor. With the
95  
96 parameter holder=1 an estimate of the instantaneous Holder regularity
97  
98 (the Holder exponent) is output for each input data value. The result
99  
100 is a Holder exponent trace for each corresponding input data trace.
101  
102  
103  
104 The strict definition of the Holder exponent is the maximum slope of
105  
106 the rise of the spectrum in the log(amplitude) versus log(scale) domain:
107  
108  
109  
110 divisor=1.0 means the exponent is computed simply by fitting a line
111  
112 through all of the values in the transform. A value of divisor>1.0
113  
114 indicates that the Holder exponent is determined as the max of slopes
115  
116 found in (total scales)/divisor length segments.
117  
118  
119  
120 Some experimentation with the parameters nwavelet, first, last, and
121  
122 expinc may be necessary before a desirable output is obtained. The
123  
124 most effective way to proceed is to perform a number of tests with
125  
126 holder=0 to determine the range of first, last, and expinc that best
127  
128 represents the data in the wavelet domain. Then experimentation with
129  
130 holder=1 and values of divisor>=1.0 may proceed.
131  
132  
133  
134  
135  
136  
137  
138 Credits:
139  
140 CWP: John Stockwell, Nov 2004
141  
142 inspired in part by "bhpcwt" in the BHP_SU package, code written by
143  
144 BHP: Michael Glinsky, c. 2002, based loosely on a Matlab CWT function
145  
146  
147  
148 References:
149  
150
151  
152 Li C.H., (2004), Information passage from acoustic impedence to
153  
154 seismogram: Perspectives from wavelet-based multiscale analysis,
155  
156 Journal of Geophysical Research, vol. 109, B07301, p.1-10.
157  
158
159  
160 Mallat, S. and W. L. Hwang, (1992), Singularity detection and
161  
162 processing with wavelets, IEEE Transactions on information, v 38,
163  
164 March 1992, p.617 - 643.
165  
166
167  
168  
169  
170  
171  
172 =head2 User's notes (Juan Lorenzo)
173 untested
174  
175 =cut
176  
177  
178 =head2 CHANGES and their DATES
179  
180 =cut
181  
182 use Moose;
183 our $VERSION = '0.0.1';
184  
185  
186 =head2 Import packages
187  
188 =cut
189  
190 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
191  
192 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
193 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
194  
195  
196 =head2 instantiation of packages
197  
198 =cut
199  
200 my $get = L_SU_global_constants->new();
201 my $Project = Project_config->new();
202 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
203 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
204 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
205  
206 my $PS_SEISMIC = $Project->PS_SEISMIC();
207  
208 my $var = $get->var();
209 my $on = $var->{_on};
210 my $off = $var->{_off};
211 my $true = $var->{_true};
212 my $false = $var->{_false};
213 my $empty_string = $var->{_empty_string};
214  
215 =head2 Encapsulated
216 hash of private variables
217  
218 =cut
219  
220 my $sucwt = {
221 _base => '',
222 _divisor => '',
223 _expinc => '',
224 _first => '',
225 _holder => '',
226 _last => '',
227 _nwavelet => '',
228 _sigma => '',
229 _verbose => '',
230 _wtype => '',
231 _xcenter => '',
232 _xmax => '',
233 _xmin => '',
234 _Step => '',
235 _note => '',
236  
237 };
238  
239 =head2 sub Step
240  
241 collects switches and assembles bash instructions
242 by adding the program name
243  
244 =cut
245  
246 sub Step {
247  
248 $sucwt->{_Step} = 'sucwt'.$sucwt->{_Step};
249 return ( $sucwt->{_Step} );
250  
251 }
252  
253  
254 =head2 sub note
255  
256 collects switches and assembles bash instructions
257 by adding the program name
258  
259 =cut
260  
261 sub note {
262  
263 $sucwt->{_note} = 'sucwt'.$sucwt->{_note};
264 return ( $sucwt->{_note} );
265  
266 }
267  
268  
269  
270 =head2 sub clear
271  
272 =cut
273  
274 sub clear {
275  
276 $sucwt->{_base} = '';
277 $sucwt->{_divisor} = '';
278 $sucwt->{_expinc} = '';
279 $sucwt->{_first} = '';
280 $sucwt->{_holder} = '';
281 $sucwt->{_last} = '';
282 $sucwt->{_nwavelet} = '';
283 $sucwt->{_sigma} = '';
284 $sucwt->{_verbose} = '';
285 $sucwt->{_wtype} = '';
286 $sucwt->{_xcenter} = '';
287 $sucwt->{_xmax} = '';
288 $sucwt->{_xmin} = '';
289 $sucwt->{_Step} = '';
290 $sucwt->{_note} = '';
291 }
292  
293  
294 =head2 sub base
295  
296  
297 =cut
298  
299 sub base {
300  
301 my ( $self,$base ) = @_;
302 if ( $base ne $empty_string ) {
303  
304 $sucwt->{_base} = $base;
305 $sucwt->{_note} = $sucwt->{_note}.' base='.$sucwt->{_base};
306 $sucwt->{_Step} = $sucwt->{_Step}.' base='.$sucwt->{_base};
307  
308 } else {
309 print("sucwt, base, missing base,\n");
310 }
311 }
312  
313  
314 =head2 sub divisor
315  
316  
317 =cut
318  
319 sub divisor {
320  
321 my ( $self,$divisor ) = @_;
322 if ( $divisor ne $empty_string ) {
323  
324 $sucwt->{_divisor} = $divisor;
325 $sucwt->{_note} = $sucwt->{_note}.' divisor='.$sucwt->{_divisor};
326 $sucwt->{_Step} = $sucwt->{_Step}.' divisor='.$sucwt->{_divisor};
327  
328 } else {
329 print("sucwt, divisor, missing divisor,\n");
330 }
331 }
332  
333  
334 =head2 sub expinc
335  
336  
337 =cut
338  
339 sub expinc {
340  
341 my ( $self,$expinc ) = @_;
342 if ( $expinc ne $empty_string ) {
343  
344 $sucwt->{_expinc} = $expinc;
345 $sucwt->{_note} = $sucwt->{_note}.' expinc='.$sucwt->{_expinc};
346 $sucwt->{_Step} = $sucwt->{_Step}.' expinc='.$sucwt->{_expinc};
347  
348 } else {
349 print("sucwt, expinc, missing expinc,\n");
350 }
351 }
352  
353  
354 =head2 sub first
355  
356  
357 =cut
358  
359 sub first {
360  
361 my ( $self,$first ) = @_;
362 if ( $first ne $empty_string ) {
363  
364 $sucwt->{_first} = $first;
365 $sucwt->{_note} = $sucwt->{_note}.' first='.$sucwt->{_first};
366 $sucwt->{_Step} = $sucwt->{_Step}.' first='.$sucwt->{_first};
367  
368 } else {
369 print("sucwt, first, missing first,\n");
370 }
371 }
372  
373  
374 =head2 sub holder
375  
376  
377 =cut
378  
379 sub holder {
380  
381 my ( $self,$holder ) = @_;
382 if ( $holder ne $empty_string ) {
383  
384 $sucwt->{_holder} = $holder;
385 $sucwt->{_note} = $sucwt->{_note}.' holder='.$sucwt->{_holder};
386 $sucwt->{_Step} = $sucwt->{_Step}.' holder='.$sucwt->{_holder};
387  
388 } else {
389 print("sucwt, holder, missing holder,\n");
390 }
391 }
392  
393  
394 =head2 sub last
395  
396  
397 =cut
398  
399 sub last {
400  
401 my ( $self,$last ) = @_;
402 if ( $last ne $empty_string ) {
403  
404 $sucwt->{_last} = $last;
405 $sucwt->{_note} = $sucwt->{_note}.' last='.$sucwt->{_last};
406 $sucwt->{_Step} = $sucwt->{_Step}.' last='.$sucwt->{_last};
407  
408 } else {
409 print("sucwt, last, missing last,\n");
410 }
411 }
412  
413  
414 =head2 sub nwavelet
415  
416  
417 =cut
418  
419 sub nwavelet {
420  
421 my ( $self,$nwavelet ) = @_;
422 if ( $nwavelet ne $empty_string ) {
423  
424 $sucwt->{_nwavelet} = $nwavelet;
425 $sucwt->{_note} = $sucwt->{_note}.' nwavelet='.$sucwt->{_nwavelet};
426 $sucwt->{_Step} = $sucwt->{_Step}.' nwavelet='.$sucwt->{_nwavelet};
427  
428 } else {
429 print("sucwt, nwavelet, missing nwavelet,\n");
430 }
431 }
432  
433  
434 =head2 sub sigma
435  
436  
437 =cut
438  
439 sub sigma {
440  
441 my ( $self,$sigma ) = @_;
442 if ( $sigma ne $empty_string ) {
443  
444 $sucwt->{_sigma} = $sigma;
445 $sucwt->{_note} = $sucwt->{_note}.' sigma='.$sucwt->{_sigma};
446 $sucwt->{_Step} = $sucwt->{_Step}.' sigma='.$sucwt->{_sigma};
447  
448 } else {
449 print("sucwt, sigma, missing sigma,\n");
450 }
451 }
452  
453  
454 =head2 sub verbose
455  
456  
457 =cut
458  
459 sub verbose {
460  
461 my ( $self,$verbose ) = @_;
462 if ( $verbose ne $empty_string ) {
463  
464 $sucwt->{_verbose} = $verbose;
465 $sucwt->{_note} = $sucwt->{_note}.' verbose='.$sucwt->{_verbose};
466 $sucwt->{_Step} = $sucwt->{_Step}.' verbose='.$sucwt->{_verbose};
467  
468 } else {
469 print("sucwt, verbose, missing verbose,\n");
470 }
471 }
472  
473  
474 =head2 sub wtype
475  
476  
477 =cut
478  
479 sub wtype {
480  
481 my ( $self,$wtype ) = @_;
482 if ( $wtype ne $empty_string ) {
483  
484 $sucwt->{_wtype} = $wtype;
485 $sucwt->{_note} = $sucwt->{_note}.' wtype='.$sucwt->{_wtype};
486 $sucwt->{_Step} = $sucwt->{_Step}.' wtype='.$sucwt->{_wtype};
487  
488 } else {
489 print("sucwt, wtype, missing wtype,\n");
490 }
491 }
492  
493  
494 =head2 sub xcenter
495  
496  
497 =cut
498  
499 sub xcenter {
500  
501 my ( $self,$xcenter ) = @_;
502 if ( $xcenter ne $empty_string ) {
503  
504 $sucwt->{_xcenter} = $xcenter;
505 $sucwt->{_note} = $sucwt->{_note}.' xcenter='.$sucwt->{_xcenter};
506 $sucwt->{_Step} = $sucwt->{_Step}.' xcenter='.$sucwt->{_xcenter};
507  
508 } else {
509 print("sucwt, xcenter, missing xcenter,\n");
510 }
511 }
512  
513  
514 =head2 sub xmax
515  
516  
517 =cut
518  
519 sub xmax {
520  
521 my ( $self,$xmax ) = @_;
522 if ( $xmax ne $empty_string ) {
523  
524 $sucwt->{_xmax} = $xmax;
525 $sucwt->{_note} = $sucwt->{_note}.' xmax='.$sucwt->{_xmax};
526 $sucwt->{_Step} = $sucwt->{_Step}.' xmax='.$sucwt->{_xmax};
527  
528 } else {
529 print("sucwt, xmax, missing xmax,\n");
530 }
531 }
532  
533  
534 =head2 sub xmin
535  
536  
537 =cut
538  
539 sub xmin {
540  
541 my ( $self,$xmin ) = @_;
542 if ( $xmin ne $empty_string ) {
543  
544 $sucwt->{_xmin} = $xmin;
545 $sucwt->{_note} = $sucwt->{_note}.' xmin='.$sucwt->{_xmin};
546 $sucwt->{_Step} = $sucwt->{_Step}.' xmin='.$sucwt->{_xmin};
547  
548 } else {
549 print("sucwt, xmin, missing xmin,\n");
550 }
551 }
552  
553  
554 =head2 sub get_max_index
555  
556 max index = number of input variables -1
557
558 =cut
559
560 sub get_max_index {
561 my ($self) = @_;
562 my $max_index = 12;
563  
564 return($max_index);
565 }
566
567
568 1;