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

filter: Statementstmt 0.0% 0 / 62 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 90 CC 5 SCAR 13.9
CC
5
Cov
0%
filter
6.0
min
6.0
panel
6.0
CRAP 4.0
1 package App::SeismicUnixGui::sunix::statsMath::suconv;
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 SUCONV - convolution with user-supplied filter
25  
26  
27  
28 suconv <stdin >stdout filter= [optional parameters]
29  
30  
31  
32 Required parameters: ONE of
33  
34 sufile= file containing SU trace to use as filter
35  
36 filter= user-supplied convolution filter (ascii)
37  
38  
39  
40 Optional parameters:
41  
42 panel=0 use only the first trace of sufile
43  
44 =1 convolve corresponding trace in sufile with
45  
46 trace in input data
47  
48  
49  
50 Trace header fields accessed: ns
51  
52 Trace header fields modified: ns
53  
54  
55  
56 Notes: It is quietly assumed that the time sampling interval on the
57  
58 single trace and the output traces is the same as that on the traces
59  
60 in the input file. The sufile may actually have more than one trace,
61  
62 but only the first trace is used in panel=0. In panel=1 the corresponding
63  
64 trace from the sufile are convolved with its counterpart in the data.
65  
66 Caveat, in panel=1 there have to be at least as many traces in sufile
67  
68 as in the input data. If not, a warning is returned, and later traces
69  
70 in the dataset are returned unchanged.
71  
72  
73  
74 Examples:
75  
76 suplane | suwind min=12 max=12 >TRACE
77  
78 suconv<DATA sufile=TRACE | ...
79  
80 Here, the su data file, "DATA", is convolved trace by trace with the
81  
82 the single su trace, "TRACE".
83  
84  
85  
86 suconv<DATA filter=1,2,1 | ...
87  
88 Here, the su data file, "DATA", is convolved trace by trace with the
89  
90 the filter shown.
91  
92  
93  
94  
95  
96 Credits:
97  
98 CWP: Jack K. Cohen, Michel Dietrich
99  
100  
101  
102 CAVEATS: no space-variable or time-variable capacity.
103  
104 The more than one trace allowed in sufile is the
105  
106 beginning of a hook to handle the spatially variant case.
107  
108  
109  
110 Trace header fields accessed: ns
111  
112 Trace header fields modified: ns
113  
114  
115  
116 =head2 User's notes (Juan Lorenzo)
117 untested
118 =cut
119  
120  
121 =head2 CHANGES and their DATES
122  
123 =cut
124  
125 use Moose;
126 our $VERSION = '0.0.1';
127  
128  
129 =head2 Import packages
130  
131 =cut
132  
133 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
134  
135 use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin);
136 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
137  
138  
139 =head2 instantiation of packages
140  
141 =cut
142  
143 my $get = L_SU_global_constants->new();
144 my $Project = Project_config->new();
145 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
146 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
147 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
148  
149 my $var = $get->var();
150 my $on = $var->{_on};
151 my $off = $var->{_off};
152 my $true = $var->{_true};
153 my $false = $var->{_false};
154 my $empty_string = $var->{_empty_string};
155  
156 =head2 Encapsulated
157 hash of private variables
158  
159 =cut
160  
161 my $suconv = {
162 _filter => '',
163 _min => '',
164 _panel => '',
165 _sufile => '',
166 _Step => '',
167 _note => '',
168  
169 };
170  
171 =head2 sub Step
172  
173 collects switches and assembles bash instructions
174 by adding the program name
175  
176 =cut
177  
178 sub Step {
179  
180 $suconv->{_Step} = 'suconv'.$suconv->{_Step};
181 return ( $suconv->{_Step} );
182  
183 }
184  
185  
186 =head2 sub note
187  
188 collects switches and assembles bash instructions
189 by adding the program name
190  
191 =cut
192  
193 sub note {
194  
195 $suconv->{_note} = 'suconv'.$suconv->{_note};
196 return ( $suconv->{_note} );
197  
198 }
199  
200  
201  
202 =head2 sub clear
203  
204 =cut
205  
206 sub clear {
207  
208 $suconv->{_filter} = '';
209 $suconv->{_min} = '';
210 $suconv->{_panel} = '';
211 $suconv->{_sufile} = '';
212 $suconv->{_Step} = '';
213 $suconv->{_note} = '';
214 }
215  
216  
217 =head2 sub filter
218  
219  
220 =cut
221  
222 sub filter {
223  
224 my ( $self,$filter ) = @_;
225 if ( $filter ne $empty_string ) {
226  
227 $suconv->{_filter} = $filter;
228 $suconv->{_note} = $suconv->{_note}.' filter='.$suconv->{_filter};
229 $suconv->{_Step} = $suconv->{_Step}.' filter='.$suconv->{_filter};
230  
231 } else {
232 print("suconv, filter, missing filter,\n");
233 }
234 }
235  
236  
237 =head2 sub min
238  
239  
240 =cut
241  
242 sub min {
243  
244 my ( $self,$min ) = @_;
245 if ( $min ne $empty_string ) {
246  
247 $suconv->{_min} = $min;
248 $suconv->{_note} = $suconv->{_note}.' min='.$suconv->{_min};
249 $suconv->{_Step} = $suconv->{_Step}.' min='.$suconv->{_min};
250  
251 } else {
252 print("suconv, min, missing min,\n");
253 }
254 }
255  
256  
257 =head2 sub panel
258  
259  
260 =cut
261  
262 sub panel {
263  
264 my ( $self,$panel ) = @_;
265 if ( $panel ne $empty_string ) {
266  
267 $suconv->{_panel} = $panel;
268 $suconv->{_note} = $suconv->{_note}.' panel='.$suconv->{_panel};
269 $suconv->{_Step} = $suconv->{_Step}.' panel='.$suconv->{_panel};
270  
271 } else {
272 print("suconv, panel, missing panel,\n");
273 }
274 }
275  
276  
277 =head2 sub sufile
278  
279  
280 =cut
281  
282 sub sufile {
283  
284 my ( $self,$sufile ) = @_;
285 if ( $sufile ne $empty_string ) {
286  
287 $suconv->{_sufile} = $sufile;
288 $suconv->{_note} = $suconv->{_note}.' sufile='.$suconv->{_sufile};
289 $suconv->{_Step} = $suconv->{_Step}.' sufile='.$suconv->{_sufile};
290  
291 } else {
292 print("suconv, sufile, missing sufile,\n");
293 }
294 }
295  
296  
297 =head2 sub get_max_index
298  
299 max index = number of input variables -1
300
301 =cut
302
303 sub get_max_index {
304 my ($self) = @_;
305 my $max_index = 2;
306  
307 return($max_index);
308 }
309
310
311 1;