lib/App/SeismicUnixGui/sunix/filter/sucddecon.pm untested

filter: Statementstmt 0.0% 0 / 77 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 113 CC 7 SCAR 14.8
CC
7
Cov
0%
filter
6.0
panel
6.0
pnoise
6.0
CRAP 4.4
1 package App::SeismicUnixGui::sunix::filter::sucddecon;
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 SUCDDECON - DECONvolution with user-supplied filter by straightforward
25  
26 Complex Division in the frequency domain
27  
28  
29  
30 sucddecon <stdin >stdout [optional parameters]
31  
32  
33  
34 Required parameters:
35  
36 filter= ascii filter values separated by commas
37  
38 ...or...
39  
40 sufile= file containing SU traces to use as filter
41  
42 (must have same number of traces as input data
43  
44 for panel=1)
45  
46 Optional parameters:
47  
48 panel=0 use only the first trace of sufile as filter
49  
50 =1 decon trace by trace an entire gather
51  
52 pnoise=0.001 white noise factor for stabilizing results
53  
54 (see below)
55  
56 sym=0 not centered, =1 center the output on each trace
57  
58 verbose=0 silent, =1 chatty
59  
60  
61  
62 Notes:
63  
64 For given time-domain input data I(t) (stdin) and deconvolution
65  
66 filter F(t), the frequency-domain deconvolved trace can be written as:
67  
68  
69  
70 I(f) I(f) * complex_conjugate[F(f)]
71  
72 D(f) = ----- ===> D(f) = ------------------------
73  
74 F(f) |F(f)|^2 + delta
75  
76  
77  
78 The real scalar delta is introduced to prevent the resulting deconvolved
79  
80 trace to be dominated by frequencies at which the filter power is close
81  
82 to zero. As described above, delta is set to some fraction (pnoise) of
83  
84 the mean of the filter power spectra. Time sampling rate must be the
85  
86 same in the input data and filter traces. If panel=1 the two input files
87  
88 must have the same number of traces. Data and filter traces don't need to
89  
90 necessarily have the same number of samples, but the filter trace length
91  
92 length be always equal or shorter than the data traces.
93  
94  
95  
96 Trace header fields accessed: ns, dt
97  
98 Trace header fields modified: none
99  
100  
101  
102  
103  
104 Credits:
105  
106 CWP: Ivan Vasconcelos
107  
108 some changes by John Stockwell
109  
110 CAVEATS:
111  
112 In the option, panel=1 the number of traces in the sufile must be
113  
114 the same as the number of traces on the input.
115  
116  
117  
118 Trace header fields accessed: ns,dt
119  
120 Trace header fields modified: none
121  
122  
123  
124 =head2 User's notes (Juan Lorenzo)
125 untested
126  
127 =cut
128  
129  
130 =head2 CHANGES and their DATES
131  
132 =cut
133  
134 use Moose;
135 our $VERSION = '0.0.1';
136  
137  
138 =head2 Import packages
139  
140 =cut
141  
142 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
143  
144 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
145 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
146  
147  
148 =head2 instantiation of packages
149  
150 =cut
151  
152 my $get = L_SU_global_constants->new();
153 my $Project = Project_config->new();
154 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
155 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
156 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
157  
158 my $PS_SEISMIC = $Project->PS_SEISMIC();
159  
160 my $var = $get->var();
161 my $on = $var->{_on};
162 my $off = $var->{_off};
163 my $true = $var->{_true};
164 my $false = $var->{_false};
165 my $empty_string = $var->{_empty_string};
166  
167 =head2 Encapsulated
168 hash of private variables
169  
170 =cut
171  
172 my $sucddecon = {
173 _filter => '',
174 _panel => '',
175 _pnoise => '',
176 _sufile => '',
177 _sym => '',
178 _verbose => '',
179 _Step => '',
180 _note => '',
181  
182 };
183  
184 =head2 sub Step
185  
186 collects switches and assembles bash instructions
187 by adding the program name
188  
189 =cut
190  
191 sub Step {
192  
193 $sucddecon->{_Step} = 'sucddecon'.$sucddecon->{_Step};
194 return ( $sucddecon->{_Step} );
195  
196 }
197  
198  
199 =head2 sub note
200  
201 collects switches and assembles bash instructions
202 by adding the program name
203  
204 =cut
205  
206 sub note {
207  
208 $sucddecon->{_note} = 'sucddecon'.$sucddecon->{_note};
209 return ( $sucddecon->{_note} );
210  
211 }
212  
213  
214  
215 =head2 sub clear
216  
217 =cut
218  
219 sub clear {
220  
221 $sucddecon->{_filter} = '';
222 $sucddecon->{_panel} = '';
223 $sucddecon->{_pnoise} = '';
224 $sucddecon->{_sufile} = '';
225 $sucddecon->{_sym} = '';
226 $sucddecon->{_verbose} = '';
227 $sucddecon->{_Step} = '';
228 $sucddecon->{_note} = '';
229 }
230  
231  
232 =head2 sub filter
233  
234  
235 =cut
236  
237 sub filter {
238  
239 my ( $self,$filter ) = @_;
240 if ( $filter ne $empty_string ) {
241  
242 $sucddecon->{_filter} = $filter;
243 $sucddecon->{_note} = $sucddecon->{_note}.' filter='.$sucddecon->{_filter};
244 $sucddecon->{_Step} = $sucddecon->{_Step}.' filter='.$sucddecon->{_filter};
245  
246 } else {
247 print("sucddecon, filter, missing filter,\n");
248 }
249 }
250  
251  
252 =head2 sub panel
253  
254  
255 =cut
256  
257 sub panel {
258  
259 my ( $self,$panel ) = @_;
260 if ( $panel ne $empty_string ) {
261  
262 $sucddecon->{_panel} = $panel;
263 $sucddecon->{_note} = $sucddecon->{_note}.' panel='.$sucddecon->{_panel};
264 $sucddecon->{_Step} = $sucddecon->{_Step}.' panel='.$sucddecon->{_panel};
265  
266 } else {
267 print("sucddecon, panel, missing panel,\n");
268 }
269 }
270  
271  
272 =head2 sub pnoise
273  
274  
275 =cut
276  
277 sub pnoise {
278  
279 my ( $self,$pnoise ) = @_;
280 if ( $pnoise ne $empty_string ) {
281  
282 $sucddecon->{_pnoise} = $pnoise;
283 $sucddecon->{_note} = $sucddecon->{_note}.' pnoise='.$sucddecon->{_pnoise};
284 $sucddecon->{_Step} = $sucddecon->{_Step}.' pnoise='.$sucddecon->{_pnoise};
285  
286 } else {
287 print("sucddecon, pnoise, missing pnoise,\n");
288 }
289 }
290  
291  
292 =head2 sub sufile
293  
294  
295 =cut
296  
297 sub sufile {
298  
299 my ( $self,$sufile ) = @_;
300 if ( $sufile ne $empty_string ) {
301  
302 $sucddecon->{_sufile} = $sufile;
303 $sucddecon->{_note} = $sucddecon->{_note}.' sufile='.$sucddecon->{_sufile};
304 $sucddecon->{_Step} = $sucddecon->{_Step}.' sufile='.$sucddecon->{_sufile};
305  
306 } else {
307 print("sucddecon, sufile, missing sufile,\n");
308 }
309 }
310  
311  
312 =head2 sub sym
313  
314  
315 =cut
316  
317 sub sym {
318  
319 my ( $self,$sym ) = @_;
320 if ( $sym ne $empty_string ) {
321  
322 $sucddecon->{_sym} = $sym;
323 $sucddecon->{_note} = $sucddecon->{_note}.' sym='.$sucddecon->{_sym};
324 $sucddecon->{_Step} = $sucddecon->{_Step}.' sym='.$sucddecon->{_sym};
325  
326 } else {
327 print("sucddecon, sym, missing sym,\n");
328 }
329 }
330  
331  
332 =head2 sub verbose
333  
334  
335 =cut
336  
337 sub verbose {
338  
339 my ( $self,$verbose ) = @_;
340 if ( $verbose ne $empty_string ) {
341  
342 $sucddecon->{_verbose} = $verbose;
343 $sucddecon->{_note} = $sucddecon->{_note}.' verbose='.$sucddecon->{_verbose};
344 $sucddecon->{_Step} = $sucddecon->{_Step}.' verbose='.$sucddecon->{_verbose};
345  
346 } else {
347 print("sucddecon, verbose, missing verbose,\n");
348 }
349 }
350  
351  
352 =head2 sub get_max_index
353  
354 max index = number of input variables -1
355
356 =cut
357
358 sub get_max_index {
359 my ($self) = @_;
360 my $max_index = 5;
361  
362 return($max_index);
363 }
364
365
366 1;