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

filter: Statementstmt 0.0% 0 / 70 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 11 totaltotal 0.0% 0 / 108 CC 8 SCAR 15.7
CC
8
Cov
0%
mode
6.0
phase
6.0
sign1
6.0
CRAP 4.8
1 package App::SeismicUnixGui::sunix::transform::succepstrum;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: SUCCEPSTRUM - Compute the complex CEPSTRUM of a seismic trace "
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 SUCCEPSTRUM - Compute the complex CEPSTRUM of a seismic trace "
22  
23 sucepstrum < stdin > stdout
24  
25 Required parameters:
26 none
27 Optional parameters:
28 sign1=1 sign of real to complex transform
29 sign2=-1 sign of complex to complex (inverse) transform
30  
31 ...phase unwrapping .....
32 mode=ouphase Oppenheim's algorithm for phase unwrapping
33 =suphase simple unwrap phase
34 unwrap=1 |dphase| > pi/unwrap constitutes a phase wrapping
35 (operative only for mode=suphase)
36  
37 trend=1 deramp the phase, =0 do not deramp the phase
38 zeromean=0 assume phase starts at 0, =1 phase is zero mean
39  
40 Notes:
41 The cepstrum is defined as the fourier transform of the the decibel
42 spectrum, as though it were a time domain signal.
43  
44 CC(t) = FT[ln[T(omega)] ] = FT[ ln|T(omega)| + i phi(omega) ]
45 T(omega) = |T(omega)| exp(i phi(omega))
46 phi(omega) = unwrapped phase of T(omega)
47  
48 Phase unwrapping:
49 The mode=ouphase uses the phase unwrapping method of Oppenheim and
50 Schaffer, 1975, which operates integrating the derivative of the phase
51  
52 The mode=suphase generates unwrapped phase assuming that jumps
53 in phase larger than dphase=pi/unwrap constitute a phase wrapping. In this case
54 the jump in phase is replaced with the average of the jumps in phase
55 on either side of the location where the suspected phase wrapping occurs.
56  
57 In either mode, the user has the option of de-ramping the phase, by
58 removing its linear trend via trend=1 and of deciding whether the
59 phase starts at phase=0 or is of zero mean via zeromean=1.
60  
61  
62 Author: John Stockwell, Dec 2010
63 based on sucepstrum.c by:
64  
65 Credits:
66 Balazs Nemeth of Potash Corporation of Saskatchewan Inc.
67 given to CWP in 2008
68  
69  
70 =head2 CHANGES and their DATES
71  
72 =cut
73  
74 use Moose;
75 our $VERSION = '0.0.1';
76 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
77  
78 my $get = L_SU_global_constants->new();
79  
80 my $var = $get->var();
81 my $empty_string = $var->{_empty_string};
82  
83 my $succepstrum = {
84 _mode => '',
85 _phase => '',
86 _sign1 => '',
87 _sign2 => '',
88 _trend => '',
89 _unwrap => '',
90 _zeromean => '',
91 _Step => '',
92 _note => '',
93 };
94  
95 =head2 sub Step
96  
97 collects switches and assembles bash instructions
98 by adding the program name
99  
100 =cut
101  
102 sub Step {
103  
104 $succepstrum->{_Step} = 'succepstrum' . $succepstrum->{_Step};
105 return ( $succepstrum->{_Step} );
106  
107 }
108  
109 =head2 sub note
110  
111 collects switches and assembles bash instructions
112 by adding the program name
113  
114 =cut
115  
116 sub note {
117  
118 $succepstrum->{_note} = 'succepstrum' . $succepstrum->{_note};
119 return ( $succepstrum->{_note} );
120  
121 }
122  
123 =head2 sub clear
124  
125 =cut
126  
127 sub clear {
128  
129 $succepstrum->{_dphase} = '';
130 $succepstrum->{_mode} = '';
131 $succepstrum->{_phase} = '';
132 $succepstrum->{_sign1} = '';
133 $succepstrum->{_sign2} = '';
134 $succepstrum->{_trend} = '';
135 $succepstrum->{_unwrap} = '';
136 $succepstrum->{_zeromean} = '';
137 $succepstrum->{_Step} = '';
138 $succepstrum->{_note} = '';
139 }
140  
141 =head2 sub mode
142  
143  
144 =cut
145  
146 sub mode {
147  
148 my ( $self, $mode ) = @_;
149 if ( $mode ne $empty_string ) {
150  
151 $succepstrum->{_mode} = $mode;
152 $succepstrum->{_note} =
153 $succepstrum->{_note} . ' mode=' . $succepstrum->{_mode};
154 $succepstrum->{_Step} =
155 $succepstrum->{_Step} . ' mode=' . $succepstrum->{_mode};
156  
157 }
158 else {
159 print("succepstrum, mode, missing mode,\n");
160 }
161 }
162  
163 =head2 sub phase
164  
165  
166 =cut
167  
168 sub phase {
169  
170 my ( $self, $phase ) = @_;
171 if ( $phase ne $empty_string ) {
172  
173 $succepstrum->{_phase} = $phase;
174 $succepstrum->{_note} =
175 $succepstrum->{_note} . ' phase=' . $succepstrum->{_phase};
176 $succepstrum->{_Step} =
177 $succepstrum->{_Step} . ' phase=' . $succepstrum->{_phase};
178  
179 }
180 else {
181 print("succepstrum, phase, missing phase,\n");
182 }
183 }
184  
185 =head2 sub sign1
186  
187  
188 =cut
189  
190 sub sign1 {
191  
192 my ( $self, $sign1 ) = @_;
193 if ( $sign1 ne $empty_string ) {
194  
195 $succepstrum->{_sign1} = $sign1;
196 $succepstrum->{_note} =
197 $succepstrum->{_note} . ' sign1=' . $succepstrum->{_sign1};
198 $succepstrum->{_Step} =
199 $succepstrum->{_Step} . ' sign1=' . $succepstrum->{_sign1};
200  
201 }
202 else {
203 print("succepstrum, sign1, missing sign1,\n");
204 }
205 }
206  
207 =head2 sub sign2
208  
209  
210 =cut
211  
212 sub sign2 {
213  
214 my ( $self, $sign2 ) = @_;
215 if ( $sign2 ne $empty_string ) {
216  
217 $succepstrum->{_sign2} = $sign2;
218 $succepstrum->{_note} =
219 $succepstrum->{_note} . ' sign2=' . $succepstrum->{_sign2};
220 $succepstrum->{_Step} =
221 $succepstrum->{_Step} . ' sign2=' . $succepstrum->{_sign2};
222  
223 }
224 else {
225 print("succepstrum, sign2, missing sign2,\n");
226 }
227 }
228  
229 =head2 sub trend
230  
231  
232 =cut
233  
234 sub trend {
235  
236 my ( $self, $trend ) = @_;
237 if ( $trend ne $empty_string ) {
238  
239 $succepstrum->{_trend} = $trend;
240 $succepstrum->{_note} =
241 $succepstrum->{_note} . ' trend=' . $succepstrum->{_trend};
242 $succepstrum->{_Step} =
243 $succepstrum->{_Step} . ' trend=' . $succepstrum->{_trend};
244  
245 }
246 else {
247 print("succepstrum, trend, missing trend,\n");
248 }
249 }
250  
251 =head2 sub unwrap
252  
253  
254 =cut
255  
256 sub unwrap {
257  
258 my ( $self, $unwrap ) = @_;
259 if ( $unwrap ne $empty_string ) {
260  
261 $succepstrum->{_unwrap} = $unwrap;
262 $succepstrum->{_note} =
263 $succepstrum->{_note} . ' unwrap=' . $succepstrum->{_unwrap};
264 $succepstrum->{_Step} =
265 $succepstrum->{_Step} . ' unwrap=' . $succepstrum->{_unwrap};
266  
267 }
268 else {
269 print("succepstrum, unwrap, missing unwrap,\n");
270 }
271 }
272  
273 =head2 sub zeromean
274  
275  
276 =cut
277  
278 sub zeromean {
279  
280 my ( $self, $zeromean ) = @_;
281 if ( $zeromean ne $empty_string ) {
282  
283 $succepstrum->{_zeromean} = $zeromean;
284 $succepstrum->{_note} =
285 $succepstrum->{_note} . ' zeromean=' . $succepstrum->{_zeromean};
286 $succepstrum->{_Step} =
287 $succepstrum->{_Step} . ' zeromean=' . $succepstrum->{_zeromean};
288  
289 }
290 else {
291 print("succepstrum, zeromean, missing zeromean,\n");
292 }
293 }
294  
295 =head2 sub get_max_index
296
297 max index = number of input variables -1
298
299 =cut
300  
301 sub get_max_index {
302 my ($self) = @_;
303 my $max_index = 6;
304  
305 return ($max_index);
306 }
307  
308 1;