lib/App/SeismicUnixGui/sunix/statsMath/suattributes.pm untested

filter: Statementstmt 0.0% 0 / 91 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 16 Podpod 0.0% 0 / 12 totaltotal 0.0% 0 / 135 CC 9 SCAR 15.4
CC
9
Cov
0%
default
6.0
dphase_min
6.0
f1
6.0
CRAP 4.7
1 package App::SeismicUnixGui::sunix::statsMath::suattributes;
2  
3 =head2 SYNOPSIS
4  
5 PERL PROGRAM NAME:
6  
7 AUTHOR: Juan Lorenzo (Perl module only)
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 SUATTRIBUTES - instantaneous trace ATTRIBUTES
25  
26  
27  
28 suattributes <stdin >stdout mode=amp
29  
30  
31  
32 Required parameters:
33  
34 none
35  
36  
37  
38 Optional parameter:
39  
40 mode=amp output flag
41  
42 =amp envelope traces
43  
44 =phase phase traces
45  
46 =freq frequency traces
47  
48 =bandwith Instantaneous bandwidth
49  
50 =normamp Normalized Phase (Cosine Phase)
51  
52 =fdenv 1st envelope traces derivative
53  
54 =sdenv 2nd envelope traces derivative
55  
56 =q Ins. Q Factor
57  
58 ... unwrapping related options ....
59  
60 unwrap= default unwrap=0 for mode=phase
61  
62 default unwrap=1 for freq, uphase, freqw, Q
63  
64 dphase_min=PI/unwrap
65  
66 trend=0 =1 remove the linear trend of the inst. phase
67  
68 zeromean=0 =1 assume instantaneous phase is zero mean
69  
70  
71  
72 =freqw Frequency Weighted Envelope
73  
74 =thin Thin-Bed (inst. freq - average freq)
75  
76 wint= windowing for freqw
77  
78 windowing for thin
79  
80 default=1
81  
82 o--------o--------o
83  
84 data-1 data data+1
85  
86  
87  
88 Notes:
89  
90 This program performs complex trace attribute analysis. The first three
91  
92 attributes, amp,phase,freq are the classical Taner, Kohler, and
93  
94 Sheriff, 1979.
95  
96  
97  
98 The unwrapping algorithm is the "simple" unwrapping algorithm that
99  
100 searches for jumps in phase.
101  
102  
103  
104 The quantity dphase_min is the minimum change in the phase angle taken
105  
106 to be the result of phase wrapping, rather than natural phase
107  
108 variation in the data. Setting unwrap=0 turns off phase-unwrapping
109  
110 alltogether. Choosing unwrap > 1 makes the unwrapping function more
111  
112 sensitive to instantaneous phase changes.
113  
114 Setting unwrap > 1 may be necessary to resolve higher frequencies in
115  
116 data (or sample data more finely).
117  
118  
119  
120 Examples:
121  
122 suvibro f1=10 f2=50 t1=0 t2=0 tv=1 | suattributes2 mode=amp | ...
123  
124 suvibro f1=10 f2=50 t1=0 t2=0 tv=1 | suattributes2 mode=phase | ...
125  
126 suvibro f1=10 f2=50 t1=0 t2=0 tv=1 | suattributes2 mode=freq | ...
127  
128 suplane | suattributes mode=... | supswigb |...
129  
130  
131  
132  
133  
134 Credits:
135  
136 CWP: Jack K. Cohen
137  
138 CWP: John Stockwell (added freq and unwrap features)
139  
140 UGM (Geophysics Students): Agung Wiyono
141  
142 email:aakanjas@gmail.com (others) added more attributes
143  
144
145  
146  
147  
148 Algorithm:
149  
150 c(t) = hilbert_tranform_kernel(t) convolved with data(t)
151  
152  
153  
154 amp(t) = sqrt( c.re^2(t) + c.im^2(t))
155  
156 phase(t) = arctan( c.im(t)/c.re(t))
157  
158 freq(t) = d(phase)/dt
159  
160  
161  
162 Reference: Taner, M. T., Koehler, A. F., and Sheriff R. E.
163  
164 "Complex seismic trace analysis", Geophysics, vol.44, p. 1041-1063, 1979
165  
166  
167  
168 Trace header fields accessed: ns, trid
169  
170 Trace header fields modified: d1, trid
171  
172  
173  
174  
175  
176 =head2 User's notes (Juan Lorenzo)
177 untested
178  
179 =cut
180  
181  
182 =head2 CHANGES and their DATES
183  
184 =cut
185  
186 use Moose;
187 our $VERSION = '0.0.1';
188  
189  
190 =head2 Import packages
191  
192 =cut
193  
194 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
195  
196 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
197 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
198  
199  
200 =head2 instantiation of packages
201  
202 =cut
203  
204 my $get = L_SU_global_constants->new();
205 my $Project = Project_config->new();
206 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
207 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
208 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
209  
210 my $PS_SEISMIC = $Project->PS_SEISMIC();
211  
212 my $var = $get->var();
213 my $on = $var->{_on};
214 my $off = $var->{_off};
215 my $true = $var->{_true};
216 my $false = $var->{_false};
217 my $empty_string = $var->{_empty_string};
218  
219 =head2 Encapsulated
220 hash of private variables
221  
222 =cut
223  
224 my $suattributes = {
225 _default => '',
226 _dphase_min => '',
227 _f1 => '',
228 _mode => '',
229 _trend => '',
230 _unwrap => '',
231 _wint => '',
232 _zeromean => '',
233 _Step => '',
234 _note => '',
235  
236 };
237  
238 =head2 sub Step
239  
240 collects switches and assembles bash instructions
241 by adding the program name
242  
243 =cut
244  
245 sub Step {
246  
247 $suattributes->{_Step} = 'suattributes'.$suattributes->{_Step};
248 return ( $suattributes->{_Step} );
249  
250 }
251  
252  
253 =head2 sub note
254  
255 collects switches and assembles bash instructions
256 by adding the program name
257  
258 =cut
259  
260 sub note {
261  
262 $suattributes->{_note} = 'suattributes'.$suattributes->{_note};
263 return ( $suattributes->{_note} );
264  
265 }
266  
267  
268  
269 =head2 sub clear
270  
271 =cut
272  
273 sub clear {
274  
275 $suattributes->{_default} = '';
276 $suattributes->{_dphase_min} = '';
277 $suattributes->{_f1} = '';
278 $suattributes->{_mode} = '';
279 $suattributes->{_trend} = '';
280 $suattributes->{_unwrap} = '';
281 $suattributes->{_wint} = '';
282 $suattributes->{_zeromean} = '';
283 $suattributes->{_Step} = '';
284 $suattributes->{_note} = '';
285 }
286  
287  
288 =head2 sub default
289  
290  
291 =cut
292  
293 sub default {
294  
295 my ( $self,$default ) = @_;
296 if ( $default ne $empty_string ) {
297  
298 $suattributes->{_default} = $default;
299 $suattributes->{_note} = $suattributes->{_note}.' default='.$suattributes->{_default};
300 $suattributes->{_Step} = $suattributes->{_Step}.' default='.$suattributes->{_default};
301  
302 } else {
303 print("suattributes, default, missing default,\n");
304 }
305 }
306  
307  
308 =head2 sub dphase_min
309  
310  
311 =cut
312  
313 sub dphase_min {
314  
315 my ( $self,$dphase_min ) = @_;
316 if ( $dphase_min ne $empty_string ) {
317  
318 $suattributes->{_dphase_min} = $dphase_min;
319 $suattributes->{_note} = $suattributes->{_note}.' dphase_min='.$suattributes->{_dphase_min};
320 $suattributes->{_Step} = $suattributes->{_Step}.' dphase_min='.$suattributes->{_dphase_min};
321  
322 } else {
323 print("suattributes, dphase_min, missing dphase_min,\n");
324 }
325 }
326  
327  
328 =head2 sub f1
329  
330  
331 =cut
332  
333 sub f1 {
334  
335 my ( $self,$f1 ) = @_;
336 if ( $f1 ne $empty_string ) {
337  
338 $suattributes->{_f1} = $f1;
339 $suattributes->{_note} = $suattributes->{_note}.' f1='.$suattributes->{_f1};
340 $suattributes->{_Step} = $suattributes->{_Step}.' f1='.$suattributes->{_f1};
341  
342 } else {
343 print("suattributes, f1, missing f1,\n");
344 }
345 }
346  
347  
348 =head2 sub mode
349  
350  
351 =cut
352  
353 sub mode {
354  
355 my ( $self,$mode ) = @_;
356 if ( $mode ne $empty_string ) {
357  
358 $suattributes->{_mode} = $mode;
359 $suattributes->{_note} = $suattributes->{_note}.' mode='.$suattributes->{_mode};
360 $suattributes->{_Step} = $suattributes->{_Step}.' mode='.$suattributes->{_mode};
361  
362 } else {
363 print("suattributes, mode, missing mode,\n");
364 }
365 }
366  
367  
368 =head2 sub trend
369  
370  
371 =cut
372  
373 sub trend {
374  
375 my ( $self,$trend ) = @_;
376 if ( $trend ne $empty_string ) {
377  
378 $suattributes->{_trend} = $trend;
379 $suattributes->{_note} = $suattributes->{_note}.' trend='.$suattributes->{_trend};
380 $suattributes->{_Step} = $suattributes->{_Step}.' trend='.$suattributes->{_trend};
381  
382 } else {
383 print("suattributes, trend, missing trend,\n");
384 }
385 }
386  
387  
388 =head2 sub unwrap
389  
390  
391 =cut
392  
393 sub unwrap {
394  
395 my ( $self,$unwrap ) = @_;
396 if ( $unwrap ne $empty_string ) {
397  
398 $suattributes->{_unwrap} = $unwrap;
399 $suattributes->{_note} = $suattributes->{_note}.' unwrap='.$suattributes->{_unwrap};
400 $suattributes->{_Step} = $suattributes->{_Step}.' unwrap='.$suattributes->{_unwrap};
401  
402 } else {
403 print("suattributes, unwrap, missing unwrap,\n");
404 }
405 }
406  
407  
408 =head2 sub wint
409  
410  
411 =cut
412  
413 sub wint {
414  
415 my ( $self,$wint ) = @_;
416 if ( $wint ne $empty_string ) {
417  
418 $suattributes->{_wint} = $wint;
419 $suattributes->{_note} = $suattributes->{_note}.' wint='.$suattributes->{_wint};
420 $suattributes->{_Step} = $suattributes->{_Step}.' wint='.$suattributes->{_wint};
421  
422 } else {
423 print("suattributes, wint, missing wint,\n");
424 }
425 }
426  
427  
428 =head2 sub zeromean
429  
430  
431 =cut
432  
433 sub zeromean {
434  
435 my ( $self,$zeromean ) = @_;
436 if ( $zeromean ne $empty_string ) {
437  
438 $suattributes->{_zeromean} = $zeromean;
439 $suattributes->{_note} = $suattributes->{_note}.' zeromean='.$suattributes->{_zeromean};
440 $suattributes->{_Step} = $suattributes->{_Step}.' zeromean='.$suattributes->{_zeromean};
441  
442 } else {
443 print("suattributes, zeromean, missing zeromean,\n");
444 }
445 }
446  
447  
448 =head2 sub get_max_index
449  
450 max index = number of input variables -1
451
452 =cut
453
454 sub get_max_index {
455 my ($self) = @_;
456 my $max_index = 7;
457  
458 return($max_index);
459 }
460
461
462 1;