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

filter: Statementstmt 0.0% 0 / 104 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 36 MC/DCmcdc 0.0% 0 / 24 Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 16 totaltotal 0.0% 0 / 222 CC 13 SCAR 16.5
CC
13
Cov
0%
c
6.0
df
6.0
dt
6.0
CRAP 5.2
1 package App::SeismicUnixGui::sunix::transform::succwt;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: SUCCWT - Complex continuous wavelet transform of seismic traces
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 SUCCWT - Complex continuous wavelet transform of seismic traces
22  
23 succwt < tdata.su > tfdata.su [optional parameters]
24  
25 Required Parameters:
26 None
27  
28 Optional Parameters:
29 noct=5 Number of octaves (int)
30 nv=10 Number of voices per octave (int)
31 fmax=Nyq Highest frequency in transform
32 p=-0.5 Power of scale value normalizing CWT
33 =0 for amp-preserved spec. decomp.
34 c=1/(2*fmax) Time-domain inverse gaussian damping parameter
35 (bigger c means more wavelet oscillations,
36 default gives minimal oscillations)
37 k=1 Use complex Morlet as wavelet transform kernel
38 =2 use Fourier kernel ... Exp[i 2 pi f t]
39 fs=1 Use dyadic freq sampling (CWT standard, 36honors
40 noct, nv)
41 =2 use linear freq sampling (Fourier standard)
42 df=1 Frequency sample interval in Hz (used only for fs=2)
43 NOTE: not yet implimented (hardwired to df=1)
44 dt=(from tr.dt) Sample interval override (in secs, if time data)
45 verbose=0 Run silent, except echo c value. (=1 for more info)
46  
47 Examples:
48 This generates amplitude spec of the CWT impulse response (IR).
49 suspike ntr=1 ix1=1 nt=125 | succwt | suamp | suximage &
50 Real part of Fourier IR with linear freq sampling:
51 suspike ntr=1 ix1=1 nt=125 | succwt k=2 fs=2 | suamp mode=real | suximage &
52 Real part of Fourier IR with dyadic freq sampling:
53 suspike ntr=1 ix1=1 nt=125 | succwt k=2 | suamp mode=real | suximage &
54  
55 Inverse CWT: (within a constant scale factor)
56 ... | succwt p=-1 | suamp mode=real | sustack key=cdp > inv.su
57  
58 Notes:
59 1. Total number of scales: nscale = noct*nv
60 2. Each input trace spawns nscale complex output traces
61 3. Lowest frequency in the transform is fmax/( 2^(noct-1/nv) )
62 4. Header field (cdp) used as cwt spectrum counter
63 5. Header field (cdpt) used as scale counter within cwt spectrum
64 6. Header field (gut) holds number of cwt scales `na'
65 7. Header field (unscale) holds CWT scale `a'
66  
67 Header fields set: tracl, cdp, cdpt, unscale, gut
68  
69  
70  
71 Copyright (c) University of Tulsa, 2003-4.
72 All rights reserved.
73 Author: UTulsa: Chris Liner, SEP: Bob Clapp
74  
75 todo:
76 fix fs=2 case to allow df not equal to 1
77 History:36
78 6/18/04
79 major overhaul by Clapp, including fourier implementation.
80 Speedup ~ 41 times (4100 %)
81 2/20/04
82 made p=-0.5 default
83 2/16/04
84 added p option to experiment with CWT normalization
85 2/12/04
86 replace fb (bandwidth parameter) with c (t-domain gaussian damping const.)
87 2/10/04 --- in sync with EAS paper in prep
88 changed morlet scaling (c = 1) to preserve time-domain peak amplitude
89 changed morlet exp sign to std CWT definition (conjugate) and
90 mathematica result that only gives positive freq gaussian with neg exp
91 1/26/04
92 added linear frequency sampling option36
93 1/23/04
94 figured out fb and made it a getpar
95 key: Look at real ccwt output and determine fb by number of
96 oscillations desired: Default gives -+-+-+-
97 1/20/04
98 beefed up verbose output
99 dimension wavelet to length 2*nt and change correlation call
100 ... this is done to avoid conv edge effects
101 1/19/04
102 added fourier wavlet option for comparison with Fourier Transform action
103 1/17/04
104 complex morlet amp scaling now set to preserve first scale amp with IR
105 1/16/04
106 added dt getpar to handle depth input properly
107 preserves first tracl so tracl is ok after spice
108 11/11/03
109 initial version
110  
111 Trace header fields set: tracl, cdp, cdpt, unscale, gut
112  
113 =head2 CHANGES and their DATES
114  
115 =cut
116  
117 use Moose;
118 our $VERSION = '0.0.1';
119 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
120  
121 my $get = L_SU_global_constants->new();
122  
123 my $var = $get->var();
124 my $empty_string = $var->{_empty_string};
125  
126 my $succwt = {
127 _c => '',
128 _df => '',
129 _dt => '',
130 _fmax => '',
131 _fs => '',
132 _k => '',
133 _noct => '',
134 _nscale => '',
135 _ntr => '',
136 _nv => '',
137 _p => '',
138 _verbose => '',
139 _Step => '',
140 _note => '',
141 };
142  
143 =head2 sub Step
144  
145 collects switches and assembles bash instructions
146 by adding the program name
147  
148 =cut
149  
150 sub Step {
151  
152 $succwt->{_Step} = 'succwt' . $succwt->{_Step};
153 return ( $succwt->{_Step} );
154  
155 }
156  
157 =head2 sub note
158  
159 collects switches and assembles bash instructions
160 by adding the program name
161  
162 =cut
163  
164 sub note {
165  
166 $succwt->{_note} = 'succwt' . $succwt->{_note};
167 return ( $succwt->{_note} );
168  
169 }
170  
171 =head2 sub clear
172  
173 =cut
174  
175 sub clear {
176  
177 $succwt->{_c} = '';
178 $succwt->{_df} = '';
179 $succwt->{_dt} = '';
180 $succwt->{_fmax} = '';
181 $succwt->{_fs} = '';
182 $succwt->{_k} = '';
183 $succwt->{_noct} = '';
184 $succwt->{_nscale} = '';
185 $succwt->{_ntr} = '';
186 $succwt->{_nv} = '';
187 $succwt->{_p} = '';
188 $succwt->{_verbose} = '';
189 $succwt->{_Step} = '';
190 $succwt->{_note} = '';
191 }
192  
193 =head2 sub c
194  
195  
196 =cut
197  
198 sub c {
199  
200 my ( $self, $c ) = @_;
201 if ( defined $c
202 && $c ne $empty_string )
203 {
204  
205 $succwt->{_c} = $c;
206 $succwt->{_note} = $succwt->{_note} . ' c=' . $succwt->{_c};
207 $succwt->{_Step} = $succwt->{_Step} . ' c=' . $succwt->{_c};
208  
209 }
210 else {
211 print("succwt, c, missing c,\n");
212 }
213 }
214  
215 =head2 sub df
216  
217  
218 =cut
219  
220 sub df {
221  
222 my ( $self, $df ) = @_;
223 if ( defined $df
224 && $df ne $empty_string )
225 {
226  
227 $succwt->{_df} = $df;
228 $succwt->{_note} = $succwt->{_note} . ' df=' . $succwt->{_df};
229 $succwt->{_Step} = $succwt->{_Step} . ' df=' . $succwt->{_df};
230  
231 }
232 else {
233 print("succwt, df, missing df,\n");
234 }
235 }
236  
237 =head2 sub dt
238  
239  
240 =cut
241  
242 sub dt {
243  
244 my ( $self, $dt ) = @_;
245 if ( defined $dt
246 && $dt ne $empty_string )
247 {
248  
249 $succwt->{_dt} = $dt;
250 $succwt->{_note} = $succwt->{_note} . ' dt=' . $succwt->{_dt};
251 $succwt->{_Step} = $succwt->{_Step} . ' dt=' . $succwt->{_dt};
252  
253 }
254 else {
255 print("succwt, dt, missing dt,\n");
256 }
257 }
258  
259 =head2 sub fmax
260  
261  
262 =cut
263  
264 sub fmax {
265  
266 my ( $self, $fmax ) = @_;
267 if ( defined $fmax
268 && $fmax ne $empty_string )
269 {
270  
271 $succwt->{_fmax} = $fmax;
272 $succwt->{_note} = $succwt->{_note} . ' fmax=' . $succwt->{_fmax};
273 $succwt->{_Step} = $succwt->{_Step} . ' fmax=' . $succwt->{_fmax};
274  
275 }
276 else {
277 print("succwt, fmax, missing fmax,\n");
278 }
279 }
280  
281 =head2 sub fs
282  
283  
284 =cut
285  
286 sub fs {
287  
288 my ( $self, $fs ) = @_;
289 if ( defined $fs
290 && $fs ne $empty_string )
291 {
292  
293 $succwt->{_fs} = $fs;
294 $succwt->{_note} = $succwt->{_note} . ' fs=' . $succwt->{_fs};
295 $succwt->{_Step} = $succwt->{_Step} . ' fs=' . $succwt->{_fs};
296  
297 }
298 else {
299 print("succwt, fs, missing fs,\n");
300 }
301 }
302  
303 =head2 sub k
304  
305  
306 =cut
307  
308 sub k {
309  
310 my ( $self, $k ) = @_;
311 if ( defined $k
312 && $k ne $empty_string )
313 {
314  
315 $succwt->{_k} = $k;
316 $succwt->{_note} = $succwt->{_note} . ' k=' . $succwt->{_k};
317 $succwt->{_Step} = $succwt->{_Step} . ' k=' . $succwt->{_k};
318  
319 }
320 else {
321 print("succwt, k, missing k,\n");
322 }
323 }
324  
325 =head2 sub noct
326  
327  
328 =cut
329  
330 sub noct {
331  
332 my ( $self, $noct ) = @_;
333 if ( defined $noct
334 && $noct ne $empty_string )
335 {
336  
337 $succwt->{_noct} = $noct;
338 $succwt->{_note} = $succwt->{_note} . ' noct=' . $succwt->{_noct};
339 $succwt->{_Step} = $succwt->{_Step} . ' noct=' . $succwt->{_noct};
340  
341 }
342 else {
343 print("succwt, noct, missing noct,\n");
344 }
345 }
346  
347 =head2 sub nscale
348  
349  
350 =cut
351  
352 sub nscale {
353  
354 my ( $self, $nscale ) = @_;
355 if ( defined $nscale
356 && $nscale ne $empty_string )
357 {
358  
359 $succwt->{_nscale} = $nscale;
360 $succwt->{_note} = $succwt->{_note} . ' nscale=' . $succwt->{_nscale};
361 $succwt->{_Step} = $succwt->{_Step} . ' nscale=' . $succwt->{_nscale};
362  
363 }
364 else {
365 print("succwt, nscale, missing nscale,\n");
366 }
367 }
368  
369 =head2 sub ntr
370  
371  
372 =cut
373  
374 sub ntr {
375  
376 my ( $self, $ntr ) = @_;
377 if ( defined $ntr
378 && $ntr ne $empty_string )
379 {
380  
381 $succwt->{_ntr} = $ntr;
382 $succwt->{_note} = $succwt->{_note} . ' ntr=' . $succwt->{_ntr};
383 $succwt->{_Step} = $succwt->{_Step} . ' ntr=' . $succwt->{_ntr};
384  
385 }
386 else {
387 print("succwt, ntr, missing ntr,\n");
388 }
389 }
390  
391 =head2 sub nv
392  
393  
394 =cut
395  
396 sub nv {
397  
398 my ( $self, $nv ) = @_;
399 if ( defined $nv
400 && $nv ne $empty_string )
401 {
402  
403 $succwt->{_nv} = $nv;
404 $succwt->{_note} = $succwt->{_note} . ' nv=' . $succwt->{_nv};
405 $succwt->{_Step} = $succwt->{_Step} . ' nv=' . $succwt->{_nv};
406  
407 }
408 else {
409 print("succwt, nv, missing nv,\n");
410 }
411 }
412  
413 =head2 sub p
414  
415  
416 =cut
417  
418 sub p {
419  
420 my ( $self, $p ) = @_;
421 if ( defined $p
422 && $p ne $empty_string )
423 {
424  
425 $succwt->{_p} = $p;
426 $succwt->{_note} = $succwt->{_note} . ' p=' . $succwt->{_p};
427 $succwt->{_Step} = $succwt->{_Step} . ' p=' . $succwt->{_p};
428  
429 }
430 else {
431 print("succwt, p, missing p,\n");
432 }
433 }
434  
435 =head2 sub verbose
436  
437  
438 =cut
439  
440 sub verbose {
441  
442 my ( $self, $verbose ) = @_;
443 if ( defined $verbose
444 && $verbose ne $empty_string )
445 {
446  
447 $succwt->{_verbose} = $verbose;
448 $succwt->{_note} =
449 $succwt->{_note} . ' verbose=' . $succwt->{_verbose};
450 $succwt->{_Step} =
451 $succwt->{_Step} . ' verbose=' . $succwt->{_verbose};
452  
453 }
454 else {
455 print("succwt, verbose, missing verbose,\n");
456 }
457 }
458  
459 =head2 sub get_max_index
460
461 max index = number of input variables -1
462
463 =cut
464  
465 sub get_max_index {
466 my ($self) = @_;
467 my $max_index = 11;
468  
469 return ($max_index);
470 }
471  
472 1;