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

filter: Statementstmt 0.0% 0 / 100 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 14 totaltotal 0.0% 0 / 157 CC 11 SCAR 15.8
CC
11
Cov
0%
dt
6.0
mode
6.0
r
6.0
CRAP 4.9
1 package App::SeismicUnixGui::sunix::transform::sucepstrum;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: SUCEPSTRUM - transform to the CEPSTRal domain
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 SUCEPSTRUM - transform to the CEPSTRal domain
22  
23 sucepstrum <stdin >sdout sign1=1
24  
25 Required parameters:
26 none
27  
28 Optional parameters:
29 sign1=1 sign in exponent of fft
30 sign2=-1 sign in exponent of ifft
31 dt=from header sampling interval
32 verbose=1 =0 to stop advisory messages
33  
34 .... phase unwrapping options .....
35 mode=ouphase Oppenheim's phase unwrapping
36 =suphase simple jump detecting phase unwrapping
37 unwrap=1 |dphase| > pi/unwrap constitutes a phase wrapping
38 =0 no phase unwrapping (in mode=suphase only)
39 trend=1 remove linear trend from the unwrapped phase
40 zeromean=0 assume phase(0)=0.0, else assume phase is zero mean
41 smooth=0 apply damped least squares smoothing to unwrapped phase
42 r=10 ... damping coefficient, only active when smooth=1
43  
44 Notes:
45 The complex log fft of a function F(t) is given by:
46 clogfft(F(t)) = log(FFT(F(t)) = log|F(omega)| + iphi(omega)
47 where phi(omega) is the unwrapped phase. Note that 0< unwrap<= 1.0
48 allows phase unwrapping to be tuned, if desired.
49  
50 The ceptrum is the inverse Fourier transform of the log fft of F(t)
51 F(t_c) =cepstrum(F(t)) = INVFFT[log(FFT(F(t))]
52 =INVFFT[log|F(omega)| + iphi(omega)]
53 Here t_c is the cepstral time domain.
54  
55 To facilitate further processing, the sampling interval
56 in quefrency and first quefrency (0) are set in the
57 output header.
58  
59 Caveats:
60 No check is made that the data ARE real time traces!
61  
62 Use suminphase to make minimum phase representations of signals
63  
64 Credits:
65 CWP: John Stockwell, June 2013 based on
66 sufft by:
67 CWP: Shuki Ronen, Chris Liner, Jack K. Cohen
68 CENPET: Werner M. Heigl - added well log support
69 U Montana: Bob Lankston - added m_unwrap_phase feature
70  
71 Note: leave dt set for later inversion
72  
73 Trace header fields accessed: ns, dt, d1, f1
74 Trace header fields modified: ns, d1, f1, trid
75  
76 =head2 CHANGES and their DATES
77  
78 =cut
79  
80 use Moose;
81 our $VERSION = '0.0.1';
82 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
83  
84 my $get = L_SU_global_constants->new();
85  
86 my $var = $get->var();
87 my $empty_string = $var->{_empty_string};
88  
89 my $sucepstrum = {
90 _dt => '',
91 _mode => '',
92 _r => '',
93 _sign1 => '',
94 _sign2 => '',
95 _smooth => '',
96 _trend => '',
97 _unwrap => '',
98 _verbose => '',
99 _zeromean => '',
100 _Step => '',
101 _note => '',
102 };
103  
104 =head2 sub Step
105  
106 collects switches and assembles bash instructions
107 by adding the program name
108  
109 =cut
110  
111 sub Step {
112  
113 $sucepstrum->{_Step} = 'sucepstrum' . $sucepstrum->{_Step};
114 return ( $sucepstrum->{_Step} );
115  
116 }
117  
118 =head2 sub note
119  
120 collects switches and assembles bash instructions
121 by adding the program name
122  
123 =cut
124  
125 sub note {
126  
127 $sucepstrum->{_note} = 'sucepstrum' . $sucepstrum->{_note};
128 return ( $sucepstrum->{_note} );
129  
130 }
131  
132 =head2 sub clear
133  
134 =cut
135  
136 sub clear {
137  
138 $sucepstrum->{_dt} = '';
139 $sucepstrum->{_mode} = '';
140 $sucepstrum->{_r} = '';
141 $sucepstrum->{_sign1} = '';
142 $sucepstrum->{_sign2} = '';
143 $sucepstrum->{_smooth} = '';
144 $sucepstrum->{_trend} = '';
145 $sucepstrum->{_unwrap} = '';
146 $sucepstrum->{_verbose} = '';
147 $sucepstrum->{_zeromean} = '';
148 $sucepstrum->{_Step} = '';
149 $sucepstrum->{_note} = '';
150 }
151  
152 =head2 sub dt
153  
154  
155 =cut
156  
157 sub dt {
158  
159 my ( $self, $dt ) = @_;
160 if ( $dt ne $empty_string ) {
161  
162 $sucepstrum->{_dt} = $dt;
163 $sucepstrum->{_note} =
164 $sucepstrum->{_note} . ' dt=' . $sucepstrum->{_dt};
165 $sucepstrum->{_Step} =
166 $sucepstrum->{_Step} . ' dt=' . $sucepstrum->{_dt};
167  
168 }
169 else {
170 print("sucepstrum, dt, missing dt,\n");
171 }
172 }
173  
174 =head2 sub mode
175  
176  
177 =cut
178  
179 sub mode {
180  
181 my ( $self, $mode ) = @_;
182 if ( $mode ne $empty_string ) {
183  
184 $sucepstrum->{_mode} = $mode;
185 $sucepstrum->{_note} =
186 $sucepstrum->{_note} . ' mode=' . $sucepstrum->{_mode};
187 $sucepstrum->{_Step} =
188 $sucepstrum->{_Step} . ' mode=' . $sucepstrum->{_mode};
189  
190 }
191 else {
192 print("sucepstrum, mode, missing mode,\n");
193 }
194 }
195  
196 =head2 sub r
197  
198  
199 =cut
200  
201 sub r {
202  
203 my ( $self, $r ) = @_;
204 if ( $r ne $empty_string ) {
205  
206 $sucepstrum->{_r} = $r;
207 $sucepstrum->{_note} =
208 $sucepstrum->{_note} . ' r=' . $sucepstrum->{_r};
209 $sucepstrum->{_Step} =
210 $sucepstrum->{_Step} . ' r=' . $sucepstrum->{_r};
211  
212 }
213 else {
214 print("sucepstrum, r, missing r,\n");
215 }
216 }
217  
218 =head2 sub sign1
219  
220  
221 =cut
222  
223 sub sign1 {
224  
225 my ( $self, $sign1 ) = @_;
226 if ( $sign1 ne $empty_string ) {
227  
228 $sucepstrum->{_sign1} = $sign1;
229 $sucepstrum->{_note} =
230 $sucepstrum->{_note} . ' sign1=' . $sucepstrum->{_sign1};
231 $sucepstrum->{_Step} =
232 $sucepstrum->{_Step} . ' sign1=' . $sucepstrum->{_sign1};
233  
234 }
235 else {
236 print("sucepstrum, sign1, missing sign1,\n");
237 }
238 }
239  
240 =head2 sub sign2
241  
242  
243 =cut
244  
245 sub sign2 {
246  
247 my ( $self, $sign2 ) = @_;
248 print("sucepstrum,sign2: $sign2\n");
249 if ( defined $sign2 && $sign2 ne $empty_string ) {
250  
251 use App::SeismicUnixGui::misc::control '0.0.3';
252 use aliased 'App::SeismicUnixGui::misc::control';
253 my $control = control->new();
254 $control->set_back_slashBgone($sign2);
255 $sign2 = $control->get_back_slashBgone();
256  
257 $sucepstrum->{_sign2} = $sign2;
258 $sucepstrum->{_note} =
259 $sucepstrum->{_note} . ' sign2=' . $sucepstrum->{_sign2};
260 $sucepstrum->{_Step} =
261 $sucepstrum->{_Step} . ' sign2=' . $sucepstrum->{_sign2};
262  
263 }
264 else {
265 print("sucepstrum, sign2, missing sign2,\n");
266 }
267 }
268  
269 =head2 sub smooth
270  
271  
272 =cut
273  
274 sub smooth {
275  
276 my ( $self, $smooth ) = @_;
277 if ( $smooth ne $empty_string ) {
278  
279 $sucepstrum->{_smooth} = $smooth;
280 $sucepstrum->{_note} =
281 $sucepstrum->{_note} . ' smooth=' . $sucepstrum->{_smooth};
282 $sucepstrum->{_Step} =
283 $sucepstrum->{_Step} . ' smooth=' . $sucepstrum->{_smooth};
284  
285 }
286 else {
287 print("sucepstrum, smooth, missing smooth,\n");
288 }
289 }
290  
291 =head2 sub trend
292  
293  
294 =cut
295  
296 sub trend {
297  
298 my ( $self, $trend ) = @_;
299 if ( $trend ne $empty_string ) {
300  
301 $sucepstrum->{_trend} = $trend;
302 $sucepstrum->{_note} =
303 $sucepstrum->{_note} . ' trend=' . $sucepstrum->{_trend};
304 $sucepstrum->{_Step} =
305 $sucepstrum->{_Step} . ' trend=' . $sucepstrum->{_trend};
306  
307 }
308 else {
309 print("sucepstrum, trend, missing trend,\n");
310 }
311 }
312  
313 =head2 sub unwrap
314  
315  
316 =cut
317  
318 sub unwrap {
319  
320 my ( $self, $unwrap ) = @_;
321 if ( $unwrap ne $empty_string ) {
322  
323 $sucepstrum->{_unwrap} = $unwrap;
324 $sucepstrum->{_note} =
325 $sucepstrum->{_note} . ' unwrap=' . $sucepstrum->{_unwrap};
326 $sucepstrum->{_Step} =
327 $sucepstrum->{_Step} . ' unwrap=' . $sucepstrum->{_unwrap};
328  
329 }
330 else {
331 print("sucepstrum, unwrap, missing unwrap,\n");
332 }
333 }
334  
335 =head2 sub verbose
336  
337  
338 =cut
339  
340 sub verbose {
341  
342 my ( $self, $verbose ) = @_;
343 if ( $verbose ne $empty_string ) {
344  
345 $sucepstrum->{_verbose} = $verbose;
346 $sucepstrum->{_note} =
347 $sucepstrum->{_note} . ' verbose=' . $sucepstrum->{_verbose};
348 $sucepstrum->{_Step} =
349 $sucepstrum->{_Step} . ' verbose=' . $sucepstrum->{_verbose};
350  
351 }
352 else {
353 print("sucepstrum, verbose, missing verbose,\n");
354 }
355 }
356  
357 =head2 sub zeromean
358  
359  
360 =cut
361  
362 sub zeromean {
363  
364 my ( $self, $zeromean ) = @_;
365 if ( $zeromean ne $empty_string ) {
366  
367 $sucepstrum->{_zeromean} = $zeromean;
368 $sucepstrum->{_note} =
369 $sucepstrum->{_note} . ' zeromean=' . $sucepstrum->{_zeromean};
370 $sucepstrum->{_Step} =
371 $sucepstrum->{_Step} . ' zeromean=' . $sucepstrum->{_zeromean};
372  
373 }
374 else {
375 print("sucepstrum, zeromean, missing zeromean,\n");
376 }
377 }
378  
379 =head2 sub get_max_index
380
381 max index = number of input variables -1
382
383 =cut
384  
385 sub get_max_index {
386 my ($self) = @_;
387 my $max_index = 9;
388  
389 return ($max_index);
390 }
391  
392 1;