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

filter: Statementstmt 0.0% 0 / 142 Branchbran 0.0% 0 / 22 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 22 Podpod 0.0% 0 / 11 totaltotal 0.0% 0 / 197 CC 12 SCAR 16.3
CC
12
Cov
0%
calcNdisplay
12.0
gather_num
6.0
gather_header
6.0
CRAP 5.1
1 package App::SeismicUnixGui::big_streams::iSelect_tr_Sumute_bottom;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: iSelect_tr_Sumute_bottom.pm
8 AUTHOR: Juan Lorenzo
9 DATE: April 2 2009 V1.
10 Aug 9, 2011 V1.2
11 Sept. 2015, V 3
12 August 2016, V 3.1
13 June 12, 2017 V 3.1
14 adapted from iSelect_tr_Sumute_top3.pm
15  
16 DESCRIPTION:
17 plot data to select bottom mute values
18  
19 =head2 USE
20  
21 =head3 NOTES
22  
23 =head4
24  
25 Examples
26  
27 =cut
28  
29 use Moose;
30 our $VERSION = '1.0.3';
31  
32 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
33 use App::SeismicUnixGui::misc::SeismicUnix
34 qw($on $off $go $in $true $false $itemp_bot_mute_picks_
35 $itemp_bot_mute_picks_sorted_par_ $itop_mute_par_
36 $itop_mute_check_pickfile_ $suffix_su $to);
37 use aliased 'App::SeismicUnixGui::misc::message';
38 use aliased 'App::SeismicUnixGui::misc::flow';
39 use aliased 'App::SeismicUnixGui::sunix::filter::sufilter';
40 use aliased 'App::SeismicUnixGui::sunix::shapeNcut::sugain';
41 use aliased 'App::SeismicUnixGui::sunix::shapeNcut::suwind';
42 use aliased 'App::SeismicUnixGui::sunix::plot::suximage';
43 use aliased 'App::SeismicUnixGui::sunix::plot::suxwigb';
44 use aliased 'App::SeismicUnixGui::messages::SuMessages';
45  
46 =head2 Instantiate
47  
48 other packages
49 Create a new version of the package
50 Personalize to give it a new name if you wish
51 Use the following classes:
52  
53 =cut
54  
55 my $log = message->new();
56 my $run = flow->new();
57 my $sufilter = sufilter->new();
58 my $sugain = sugain->new();
59 my $suwind = suwind->new();
60 my $suxwigb = suxwigb->new();
61 my $suximage = suximage->new();
62 my $SuMessages = SuMessages->new();
63 my $Project = Project_config->new();
64  
65 my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU();
66 my ($DATA_SEISMIC_TXT) = $Project->DATA_SEISMIC_TXT();
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_bottom = {
88 _TX_outbound => '',
89 _gather_num => '',
90 _file_in => '',
91 _freq => '',
92 _inbound => '',
93 _message_type => '',
94 _gather_header => '',
95 _offset_type => '',
96 _gather_type => '',
97 _number_of_tries => '',
98 _textfile_in => ''
99 };
100  
101 =head2 sub clear
102  
103 to blank out hash array values
104  
105 =cut
106  
107 sub clear {
108 $iSelect_tr_Sumute_bottom->{_TX_outbound} = '';
109 $iSelect_tr_Sumute_bottom->{_gather_num} = '';
110 $iSelect_tr_Sumute_bottom->{_file_in} = '';
111 $iSelect_tr_Sumute_bottom->{_freq} = '';
112 $iSelect_tr_Sumute_bottom->{_inbound} = '';
113 $iSelect_tr_Sumute_bottom->{_message_type} = '';
114 $iSelect_tr_Sumute_bottom->{_gather_type} = '';
115 $iSelect_tr_Sumute_bottom->{_offset_type} = '';
116 $iSelect_tr_Sumute_bottom->{_gather_header} = '';
117 $iSelect_tr_Sumute_bottom->{_number_of_tries} = '';
118 $iSelect_tr_Sumute_bottom->{_file_in} = '';
119 $iSelect_tr_Sumute_bottom->{_textfile_in} = '';
120 }
121  
122 =head2 subroutine gather
123  
124 sets gather number to consider
125  
126 =cut
127  
128 sub gather_num {
129 my ( $variable, $gather_num ) = @_;
130 $iSelect_tr_Sumute_bottom->{_gather_num} = $gather_num
131 if defined($gather_num);
132 }
133  
134 =head2 sub gather_header
135  
136 define the message family to use
137  
138 =cut
139  
140 sub gather_header {
141 my ( $variable, $type ) = @_;
142 $iSelect_tr_Sumute_bottom->{_gather_header} = $type if defined($type);
143 }
144  
145 =head2 sub gather_type
146  
147 define the message family to use
148  
149 =cut
150  
151 sub gather_type {
152 my ( $variable, $type ) = @_;
153 $iSelect_tr_Sumute_bottom->{_gather_type} = $type if defined($type);
154 }
155  
156 =head2 sub offset_type
157  
158 define the message family to use
159  
160 =cut
161  
162 sub offset_type {
163 my ( $variable, $type ) = @_;
164 $iSelect_tr_Sumute_bottom->{_offset_type} = $type if defined($type);
165 }
166  
167 =head2 sub file_in
168  
169 Required file name
170 on which to pick top mute values
171  
172 =cut
173  
174 sub file_in {
175 my ( $variable, $file_in ) = @_;
176 $iSelect_tr_Sumute_bottom->{_file_in} = $file_in if defined($file_in);
177  
178 #$file_out[$N] = $iSelect_tr_Sumute_bottom->{_file_in}.$itop_mute_par_;
179 $iSelect_tr_Sumute_bottom->{_inbound} =
180 $DATA_SEISMIC_SU . '/'
181 . $iSelect_tr_Sumute_bottom->{_file_in}
182 . $suffix_su;
183  
184 #print("file name is $iSelect_tr_Sumute_bottom->{_file_in} \n\n");
185 }
186  
187 =head2 sub freq
188  
189 creates the bandpass frequencies to filter data before
190 conducting semblance analysis
191 e.g., "3,6,40,50"
192
193 =cut
194  
195 sub freq {
196 my ( $variable, $freq ) = @_;
197 $iSelect_tr_Sumute_bottom->{_freq} = $freq if defined($freq);
198  
199 #print("freq is $iSelect_tr_Sumute_bottom->{_freq}\n\n");
200 }
201  
202 =head3 sub min_amplitude
203  
204 minumum amplitude to plot
205  
206 =cut
207  
208 sub min_amplitude {
209 my ( $variable, $min_amplitude ) = @_;
210 $iSelect_tr_Sumute_bottom->{_min_amplitude} = $min_amplitude
211 if defined($min_amplitude);
212  
213 #print("min_amplitude is $iSelect_tr_Sumute_bottom->{_min_amplitude}\n\n");
214 }
215  
216 =head2 sub max_amplitude
217  
218 maximum amplitude to plot
219  
220 =cut
221  
222 sub max_amplitude {
223 my ( $variable, $max_amplitude ) = @_;
224 $iSelect_tr_Sumute_bottom->{_max_amplitude} = $max_amplitude
225 if defined($max_amplitude);
226  
227 #print("max_amplitude is $iSelect_tr_Sumute_bottom->{_max_amplitude}\n\n");
228 }
229  
230 =head2 sub number_of_tries
231  
232 keep track of the number of attempts
233 at picking top mute
234  
235 =cut
236  
237 sub number_of_tries {
238 my ( $variable, $number_of_tries ) = @_;
239 $iSelect_tr_Sumute_bottom->{_number_of_tries} = $number_of_tries
240 if defined($number_of_tries);
241  
242 #print("num of tries is $iSelect_tr_Sumute_bottom->{_number_of_tries}\n\n");
243  
244 }
245  
246 =head2 subroutine calcNdisplay
247  
248 main processing flow
249 calculate mute and display results
250  
251 =cut
252  
253 sub calcNdisplay {
254  
255 =head2 GAIN
256  
257 DATA
258  
259 =cut
260  
261 $sugain->clear();
262 $sugain->pbal($on);
263 $sugain[1] = $sugain->Step();
264  
265 $sugain->clear();
266  
267 # $sugain->agc($on);
268 # $sugain->width(0.1);
269 $sugain[2] = $sugain->Step();
270  
271 $sugain->clear();
272  
273 # $sugain->tpower(3);
274 $sugain[3] = $sugain->Step();
275  
276 =head2 WINDOW DATA
277  
278 by
279  
280 =cut
281  
282 $suwind->clear();
283 $suwind->setheaderword( $iSelect_tr_Sumute_bottom->{_gather_header} );
284 $suwind->min( $iSelect_tr_Sumute_bottom->{_gather_num} );
285 $suwind->max( $iSelect_tr_Sumute_bottom->{_gather_num} );
286  
287 #print("gather num is $iSelect_tr_Sumute_bottom->{_gather_num}\n\n");
288 $suwind[1] = $suwind->Step();
289  
290 $suwind->clear();
291  
292 #$suwind -> setheaderword('time');
293 # $suwind->tmin(0);
294 # $suwind->tmax(1);
295 $suwind[2] = $suwind->Step();
296  
297 =head2 Set
298  
299 filtering parameters
300  
301 use lib "./libAll";
302 use iTop_Mute_config qw( $href_sufilter);
303
304  
305 =cut
306  
307 #use iTop_Mute_config qw($href_sufilter);
308  
309 =head2
310 print has reference value
311 =cut
312  
313 #print("sufilter is $href_sufilter->{freq}\n\n");
314 $sufilter->clear();
315 $sufilter->freq( $iSelect_tr_Sumute_bottom->{_freq} );
316 $sufilter[1] = $sufilter->Step();
317  
318 =head2 DISPLAY
319  
320 DATA
321  
322 =cut
323  
324 $base_caption[1] =
325 $iSelect_tr_Sumute_bottom->{_file_in}
326 . quotemeta(' ')
327 . quotemeta('f=')
328 . $iSelect_tr_Sumute_bottom->{_freq};
329  
330 $windowtitle[1] =
331 quotemeta('GATHER = ') . $iSelect_tr_Sumute_bottom->{_gather_num};
332  
333 $suximage->clear();
334 $suximage->box_width(300);
335 $suximage->box_height(700);
336 $suximage->box_X0(70);
337 $suximage->box_Y0(120);
338 $suximage->title( $base_caption[1] );
339 $suximage->windowtitle( $windowtitle[1] );
340 $suximage->ylabel( quotemeta('TWTT s') );
341 $suximage->xlabel( $iSelect_tr_Sumute_bottom->{_offset_type} );
342 $suximage->legend($on);
343 $suximage->cmap('rgb0');
344 $suximage->loclip( $iSelect_tr_Sumute_bottom->{_min_amplitude} );
345 $suximage->hiclip( $iSelect_tr_Sumute_bottom->{_max_amplitude} );
346 $suximage->verbose($off);
347  
348 if ( $iSelect_tr_Sumute_bottom->{_number_of_tries} > 0 ) {
349  
350 $iSelect_tr_Sumute_bottom->{_TX_outbound} =
351 $itemp_bot_mute_picks_ . $iSelect_tr_Sumute_bottom->{_file_in};
352 $suximage->picks(
353 $DATA_SEISMIC_TXT . '/' . $iSelect_tr_Sumute_bottom->{_TX_outbound} );
354  
355 # print("iSelect_tr_Sumute_bottom, suximage, Writing picks to $itemp_bot_mute_picks_ $iSelect_tr_Sumute_bottom->{_file_in} \n\n");
356 # print("number of tries is $iSelect_tr_Sumute_bottom -> {_number_of_tries}\n\n");
357  
358 }
359 $suximage[1] = $suximage->Step();
360  
361 =head2 Set suxwigb
362  
363 =cut
364  
365 #plotting with suxwigb
366 $base_caption[2] =
367 $iSelect_tr_Sumute_bottom->{_file_in}
368 . quotemeta(' ')
369 . quotemeta('f=')
370 . $iSelect_tr_Sumute_bottom->{_freq};
371  
372 $windowtitle[2] =
373 quotemeta('GATHER = ') . $iSelect_tr_Sumute_bottom->{_gather_num};
374  
375 $suxwigb->clear();
376 $suxwigb->box_width( quotemeta(400) );
377 $suxwigb->box_height( quotemeta(600) );
378 $suxwigb->box_X0( quotemeta(750) );
379 $suxwigb->box_Y0( quotemeta(150) );
380  
381 #$suxwigb->f2(quotemeta(60));
382 $suxwigb->title( quotemeta( $base_caption[2] ) );
383 $suxwigb->windowtitle( $windowtitle[2] );
384 $suxwigb->ylabel( quotemeta('TWTT s') );
385 $suxwigb->xlabel( $iSelect_tr_Sumute_bottom->{_offset_type} );
386 $suxwigb->clip('1.5'); # clip/perc set manually
387 $suxwigb->verbose($off);
388  
389 if ( $iSelect_tr_Sumute_bottom->{_number_of_tries} > 0 ) {
390  
391 $iSelect_tr_Sumute_bottom->{_TX_outbound} =
392 $itemp_bot_mute_picks_ . $iSelect_tr_Sumute_bottom->{_file_in};
393 $suxwigb->picks(
394 $DATA_SEISMIC_TXT . '/' . $iSelect_tr_Sumute_bottom->{_TX_outbound} );
395  
396 # print("iSelect_tr_Sumute_bottom, suxwigb, writing picks to $itemp_bot_mute_picks_$iSelect_tr_Sumute_bottom->{_file_in} \n\n");
397 # print("number of tries is $iSelect_tr_Sumute_bottom->{_number_of_tries} \n\n");
398  
399 }
400  
401 $suxwigb[1] = $suxwigb->Step();
402  
403 =head2 DEFINE FLOW(S)
404
405 in interactive mode:
406 first time you see the image, number_of_tries =0
407 second, third, etc. times number_of_tries >0
408 The pick file can be saved
409  
410 =cut
411  
412 #for suximage
413 @items = (
414 $suwind[1],
415 $in, $iSelect_tr_Sumute_bottom->{_inbound},
416 $to, $suwind[2],
417 $to, $sufilter[1],
418 $to, $sugain[2],
419 $to, $suximage[1],
420 $go
421 );
422  
423 $flow[1] = $run->modules( \@items );
424  
425 #for suxwigb
426 @items = (
427 $suwind[1], $in, $iSelect_tr_Sumute_bottom->{_inbound},
428 $to, $suwind[2], $to, $sufilter[1], $to, $sugain[2], $to, $suxwigb[1],
429 $go
430 );
431 $flow[2] = $run->modules( \@items );
432  
433 =head2 RUN FLOW(S)
434  
435 output copy of picked data points
436 only occurs after the number of tries
437 is updated
438  
439 =cut
440  
441 #for suximage
442 $run->flow( \$flow[1] );
443  
444 #for suxwigb
445 $run->flow( \$flow[2] );
446  
447 =head2 LOG FLOW(S)
448  
449 TO SCREEN AND FILE
450  
451 =cut
452  
453 #$log->file($flow[1]);
454  
455 # print( "iSelect_tr_Sumute_bottom $flow[2]\n");
456  
457 #$log->file($flow[2);
458  
459 } # end calcNdisplay subroutine
460  
461 1;
462