lib/App/SeismicUnixGui/big_streams/iSelect_tr_Sumute.pm untested

filter: Statementstmt 0.0% 0 / 116 Branchbran 0.0% 0 / 28 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 24 Podpod 0.0% 0 / 13 totaltotal 0.0% 0 / 190 CC 15 SCAR 17.4
CC
15
Cov
0%
file_in
12.0
offset_type
12.0
gather_num
6.0
CRAP 5.7
1 package App::SeismicUnixGui::big_streams::iSelect_tr_Sumute;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: iSelect_tr_Sumute.pm
8 AUTHOR: Juan Lorenzo
9 DATE: January 29, 2017
10
11 Based on iSelect_tr_Sumute_top3.pm
12 from August 2016, V 3.1
13  
14 DESCRIPTION:
15 plot data to select mute values
16 top or bottom
17  
18 =head2 USE
19  
20 =head3 NOTES
21  
22 =head4
23  
24 Examples
25  
26 =cut
27  
28 use Moose;
29 our $VERSION = '0.0.1';
30 use aliased 'App::SeismicUnixGui::misc::message';
31 use aliased 'App::SeismicUnixGui::misc::flow';
32 use aliased 'App::SeismicUnixGui::sunix::filter::sufilter';
33 use aliased 'App::SeismicUnixGui::sunix::shapeNcut::suwind';
34 use aliased 'App::SeismicUnixGui::sunix::plot::suxwigb';
35 use aliased 'App::SeismicUnixGui::sunix::plot::suximage';
36 use aliased 'App::SeismicUnixGui::sunix::shapeNcut::sugain';
37 use aliased 'App::SeismicUnixGui::messages::SuMessages';
38 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
39  
40 use App::SeismicUnixGui::misc::SeismicUnix qw($on $off $go $in $true
41 $false $itemp_top_mute_picks_
42 $itemp_top_mute_picks_sorted_par_
43 $itop_mute_par_ $itop_mute_check_pickfile_
44 $suffix_su $to);
45  
46 =head2 Instantiate
47  
48 other packages
49 1. Instantiate classes
50 Create a new version of the package
51 Personalize to give it a new name if you wish
52 Use the following classes:
53  
54 =cut
55  
56 my $log = message->new();
57 my $run = flow->new();
58 my $sufilter = sufilter->new();
59 my $sugain = sugain->new();
60 my $suwind = suwind->new();
61 my $suxwigb = suxwigb->new();
62 my $suximage = suximage->new();
63 my $SuMessages = SuMessages->new();
64 my $Project = Project_config->new();
65  
66 my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU();
67  
68 =head2 Establish
69
70 just the localally scoped variables
71  
72 =cut
73  
74 my ( @parfile_in, @file_in, @suffix, @inbound );
75 my ( @suwind_min, @suwind_max );
76 my ( @items, @flow, @sugain, @sufilter, @suwind );
77 my ( @suximage, @suxwigb );
78 my ( @windowtitle, @base_caption );
79  
80 =head2 hash array
81  
82 of important variables used within
83 this package
84  
85 =cut
86  
87 my $iSelect_tr_Sumute = {
88 _TX_outbound => '',
89 _bottom => '',
90 _gather_num => '',
91 _file_in => '',
92 _freq => '',
93 _inbound => '',
94 _message_type => '',
95 _purpose => '',
96 _gather_header => '',
97 _offset_type => '',
98 _gather_type => '',
99 _number_of_tries => '',
100 _textfile_in => ''
101 };
102  
103 =head2 sub clear
104  
105 to blank out hash array values
106  
107 =cut
108  
109 sub clear {
110 $iSelect_tr_Sumute->{_TX_outbound} = '';
111 $iSelect_tr_Sumute->{_bottom} = '';
112 $iSelect_tr_Sumute->{_gather_num} = '';
113 $iSelect_tr_Sumute->{_file_in} = '';
114 $iSelect_tr_Sumute->{_freq} = '';
115 $iSelect_tr_Sumute->{_inbound} = '';
116 $iSelect_tr_Sumute->{_message_type} = '';
117 $iSelect_tr_Sumute->{_purpose} = '';
118 $iSelect_tr_Sumute->{_gather_type} = '';
119 $iSelect_tr_Sumute->{_offset_type} = '';
120 $iSelect_tr_Sumute->{_gather_header} = '';
121 $iSelect_tr_Sumute->{_number_of_tries} = '';
122 $iSelect_tr_Sumute->{_file_in} = '';
123 $iSelect_tr_Sumute->{_textfile_in} = '';
124 }
125  
126 =head2 sub file_in
127  
128 Required file name
129 on which to pick mute values
130 print("$iSelect_tr_Sumute->{_inbound}\n\n");
131
132  
133 =cut
134  
135 sub file_in {
136  
137 my ( $variable, $file_in ) = @_;
138 if ( defined($file_in)
139 && $iSelect_tr_Sumute->{_gather_type}
140 && $iSelect_tr_Sumute->{_gather_num} )
141 {
142 $iSelect_tr_Sumute->{_file_in} = $file_in if defined($file_in);
143 $iSelect_tr_Sumute->{_inbound} =
144 $DATA_SEISMIC_SU . '/'
145 . $iSelect_tr_Sumute->{_file_in} . '_'
146 . $iSelect_tr_Sumute->{_gather_type}
147 . $iSelect_tr_Sumute->{_gather_num}
148 . $suffix_su;
149 }
150 else {
151  
152 print("Error: add gather_type, and gather_num before file_in\n\n");
153  
154 }
155 }
156  
157 =head2 subroutine gather
158  
159 sets gather number to consider
160  
161 =cut
162  
163 sub gather_num {
164 my ( $variable, $gather_num ) = @_;
165 $iSelect_tr_Sumute->{_gather_num} = $gather_num if defined($gather_num);
166 }
167  
168 =head2 sub gather_header
169  
170 define the message family to use
171  
172 =cut
173  
174 sub gather_header {
175 my ( $variable, $type ) = @_;
176 if ( defined($type) ) {
177 $iSelect_tr_Sumute->{_gather_header} = $type;
178 }
179 }
180  
181 =head2 sub purpose
182  
183 define the type of mute to use
184 =cut
185  
186 sub purpose {
187 my ( $variable, $type ) = @_;
188 if ( defined($type) ) {
189 $iSelect_tr_Sumute->{_purpose} = $type;
190 }
191 }
192  
193 =head2 sub gather_type
194  
195 define the message family to use
196  
197 =cut
198  
199 sub gather_type {
200 my ( $variable, $type ) = @_;
201 $iSelect_tr_Sumute->{_gather_type} = $type if defined($type);
202 }
203  
204 =head2 sub offset_type
205  
206 define the message family to use
207  
208 =cut
209  
210 sub offset_type {
211 my ( $variable, $type ) = @_;
212 $iSelect_tr_Sumute->{_offset_type} = $type if defined($type);
213 if ( $iSelect_tr_Sumute->{_offset_type} eq 'p' ) {
214 $iSelect_tr_Sumute->{_offset_type} = 'tracl';
215 }
216 }
217  
218 =head2 sub freq
219  
220 creates the bandpass frequencies to filter data before
221 conducting semblance analysis
222 e.g., "3,6,40,50"
223
224 =cut
225  
226 sub freq {
227 my ( $variable, $freq ) = @_;
228 $iSelect_tr_Sumute->{_freq} = $freq if defined($freq);
229  
230 #print("freq is $iSelect_tr_Sumute->{_freq}\n\n");
231 }
232  
233 =head3 sub min_amplitude
234  
235 minumum amplitude to plot
236  
237 =cut
238  
239 sub min_amplitude {
240 my ( $variable, $min_amplitude ) = @_;
241 $iSelect_tr_Sumute->{_min_amplitude} = $min_amplitude
242 if defined($min_amplitude);
243  
244 #print("min_amplitude is $iSelect_tr_Sumute->{_min_amplitude}\n\n");
245 }
246  
247 =head2 sub max_amplitude
248  
249 maximum amplitude to plot
250  
251 =cut
252  
253 sub max_amplitude {
254 my ( $variable, $max_amplitude ) = @_;
255 $iSelect_tr_Sumute->{_max_amplitude} = $max_amplitude
256 if defined($max_amplitude);
257  
258 #print("max_amplitude is $iSelect_tr_Sumute->{_max_amplitude}\n\n");
259 }
260  
261 =head2 sub number_of_tries
262  
263 keep track of the number of attempts
264 at picking top mute
265  
266 =cut
267  
268 sub number_of_tries {
269 my ( $variable, $number_of_tries ) = @_;
270 $iSelect_tr_Sumute->{_number_of_tries} = $number_of_tries
271 if defined($number_of_tries);
272  
273 #print("num of tries is $iSelect_tr_Sumute->{_number_of_tries}\n\n");
274  
275 }
276  
277 =head2 sub suxwigb_defaults
278  
279 selecting if there are appropriate suxwigb defaults
280  
281 =cut
282  
283 sub suxwigb_defaults {
284 my ( $variable, $suxwigb_defaults ) = @_;
285 $iSelect_tr_Sumute->{_suxwigb_defaults} = $suxwigb_defaults
286 if defined($suxwigb_defaults);
287  
288 #print("num of tries is $iSelect_tr_Sumute->{_suxwigb_defaults}\n\n");
289  
290 }
291  
292 =head2 subroutine calcNdisplay
293  
294 main processing flow
295 calculate mute and display results
296  
297 =cut
298  
299 sub calcNdisplay {
300  
301 =head2 GAIN
302  
303 DATA
304  
305 =cut
306  
307 $sugain->clear();
308 $sugain->pbal($on);
309 $sugain[1] = $sugain->Step();
310  
311 $sugain->clear();
312 $sugain->agc($on);
313 $sugain->width(0.1);
314  
315 # $sugain -> setdt(1000);
316 $sugain[2] = $sugain->Step();
317  
318 $sugain->clear();
319 $sugain->tpower(3);
320 $sugain[3] = $sugain->Step();
321  
322 =head2 DISPLAY
323  
324 DATA
325  
326 =cut
327  
328 =head2 Set wiggle plot
329
330 for tau-p data
331 if num_tries > 0 then you can save the mute picks
332 to a picking file
333 =cut
334  
335 $suxwigb->clear();
336 $suxwigb->defaults( 'iSurf4', 'top_middle' );
337 $suxwigb->key('tracl');
338 $suxwigb->title( $iSelect_tr_Sumute->{_file_in} );
339  
340 # $suxwigb-> pmin($CFG->{sutaup}{1}{pmin});
341 # $suxwigb-> dp($dp);
342 # $suxwigb-> picks($sutaup_outbound_pickfile[1]);
343 #$suxwigb-> percent(99.9);
344 $suxwigb->clip(1);
345  
346 if ( $iSelect_tr_Sumute->{_number_of_tries} > 0 ) {
347 $iSelect_tr_Sumute->{_TX_outbound} =
348 'itemp_'
349 . $iSelect_tr_Sumute->{_purpose}
350 . '_picks_'
351 . $iSelect_tr_Sumute->{_file_in} . '_'
352 . $iSelect_tr_Sumute->{_gather_type}
353 . $iSelect_tr_Sumute->{_gather_num};
354  
355 $suxwigb->picks( $iSelect_tr_Sumute->{_TX_outbound} );
356 print("num tries > 0 $iSelect_tr_Sumute->{_TX_outbound}\n\n");
357 }
358  
359 $suxwigb[1] = $suxwigb->Step();
360  
361 =head2 DEFINE FLOW(S)
362
363 in interactive mode:
364 first time you see the image, number_of_tries =0
365 second, third, etc. times number_of_tries >0
366 The pick file can be saved
367  
368 =cut
369  
370 @items = ( $suxwigb[1], $in, $iSelect_tr_Sumute->{_inbound}, $go );
371 $flow[1] = $run->modules( \@items );
372  
373 =head2 RUN FLOW(S)
374  
375 output copy of picked data points
376 only occurs after the number of tries
377 is updated
378  
379 =cut
380  
381 $run->flow( \$flow[1] );
382  
383 =head2 LOG FLOW(S)
384  
385 TO SCREEN AND FILE
386  
387 =cut
388  
389 #print "$flow[1]\n";
390 #$log->file($flow[1]);
391  
392 } # end calcNdisplay subroutine
393  
394 1;
395