« lib/App/SeismicUnixGui/misc/param_flow_neutral.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/model/sufdmod1.pm »
| 1 | package App::SeismicUnixGui::big_streams::iPick; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PROGRAM NAME: iPick.pm | ||
| 8 | AUTHOR: Juan Lorenzo | ||
| 9 | DATE: Sept. 14 2015 | ||
| 10 | |||
| 11 | |||
| 12 | DESCRIPTION: | ||
| 13 | Version: 0.0.1 | ||
| 14 | Package used for interactive picking of points | ||
| 15 | |||
| 16 | =head2 USE | ||
| 17 | |||
| 18 | When "purpose" is 'geopsy', the processing | ||
| 19 | is slightly different and | ||
| 20 | the output directories and files have a unique format | ||
| 21 | |||
| 22 | ep is an appropriated gather header. | ||
| 23 | If you do not want to have ep defined as a gather header | ||
| 24 | variable, then the following is allowed: | ||
| 25 | ep =0 | ||
| 26 | ep max=0 | ||
| 27 | ep min=0 | ||
| 28 | |||
| 29 | ??JML TODO | ||
| 30 | |||
| 31 | Examples: | ||
| 32 | |||
| 33 | base_file_name = 30Hz_All_geom_geom; | ||
| 34 | gather_header = fldr; (single gather type for picking) | ||
| 35 | offset_type = tracl; (or, e.g., offset but only affects the label *) | ||
| 36 | first_gather = 1; | ||
| 37 | gather_inc = 1; | ||
| 38 | last_gather = 100; | ||
| 39 | freq = 0,3,100,200; (Hz; can be left empty without any values as well) | ||
| 40 | **gather_type = fldr; | ||
| 41 | min_amplitude = .0; | ||
| 42 | max_amplitude = .75; | ||
| 43 | min_x1 = 15.873015 (Hz, for geopsy) | ||
| 44 | max_x1 = 999.999 (Hz, for geopsy) | ||
| 45 | purpose = geopsy | ||
| 46 | |||
| 47 | * if you want offset to be considered when plotting data | ||
| 48 | then modify the d2 and f2 values prior to picking. | ||
| 49 | |||
| 50 | ** Define family of interactive user messages to use | ||
| 51 | SP or CDP | ||
| 52 | |||
| 53 | =head2 Examples | ||
| 54 | |||
| 55 | =head2 SEISMIC UNIX NOTES | ||
| 56 | |||
| 57 | =head2 STEPS | ||
| 58 | |||
| 59 | =head2 Perl NOTES | ||
| 60 | |||
| 61 | We are using Moose | ||
| 62 | Moose already declares that you need debuggers turned on | ||
| 63 | so you don't need a line like the following: | ||
| 64 | use warnings; | ||
| 65 | |||
| 66 | For the iPick tool and in order to prevent redefining subroutines | ||
| 67 | we implement new modulesB,C,D ... | ||
| 68 | |||
| 69 | Both of the following instantiate iPick_spec.pm | ||
| 70 | --iPick_config | ||
| 71 | calls | ||
| 72 | config_superflows | ||
| 73 | calls | ||
| 74 | big_streams_param | ||
| 75 | which requires and instantiates iPick_spec | ||
| 76 | --iPick.pm | ||
| 77 | uses and instantiates iPick_specB.pm | ||
| 78 | uses iShowNselect_picks | ||
| 79 | which instantiates iPick_specC | ||
| 80 | uses iSelect_xt | ||
| 81 | which instantiates iPick_specD | ||
| 82 | |||
| 83 | =cut | ||
| 84 | |||
| 85 | =head2 STEPS | ||
| 86 | |||
| 87 | |||
| 88 | =cut | ||
| 89 | |||
| 90 | =head2 Import | ||
| 91 | |||
| 92 | packages | ||
| 93 | directory definitions | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||
| 97 | use Moose; | ||
| 98 | our $VERSION = '0.0.1'; | ||
| 99 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 100 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 101 | |||
| 102 | use App::SeismicUnixGui::misc::control '0.0.3'; | ||
| 103 | use aliased 'App::SeismicUnixGui::misc::control'; | ||
| 104 | |||
| 105 | use aliased 'App::SeismicUnixGui::misc::message'; | ||
| 106 | use aliased 'App::SeismicUnixGui::sunix::shell::cp'; | ||
| 107 | use aliased 'App::SeismicUnixGui::misc::flow'; | ||
| 108 | |||
| 109 | use aliased 'App::SeismicUnixGui::big_streams::iPicks2par'; | ||
| 110 | use aliased 'App::SeismicUnixGui::big_streams::iPicks2sort'; | ||
| 111 | use aliased 'App::SeismicUnixGui::big_streams::iSave_picks'; | ||
| 112 | |||
| 113 | use aliased 'App::SeismicUnixGui::specs::big_streams::iPick_specB'; | ||
| 114 | use aliased 'App::SeismicUnixGui::big_streams::iShowNselect_picks'; | ||
| 115 | use aliased 'App::SeismicUnixGui::big_streams::iSelect_xt'; | ||
| 116 | |||
| 117 | use aliased 'App::SeismicUnixGui::misc::manage_files_by2'; | ||
| 118 | use aliased 'App::SeismicUnixGui::misc::old_data'; | ||
| 119 | |||
| 120 | use aliased 'App::SeismicUnixGui::messages::SuMessages'; | ||
| 121 | use App::SeismicUnixGui::misc::SeismicUnix qw($on $off $in $to $go $ipicks_par_ | ||
| 122 | $ipick_check_pickfile_ $false $true | ||
| 123 | $itemp_picks_ $itemp_picks_sorted_); | ||
| 124 | |||
| 125 | my $Project = Project_config->new(); | ||
| 126 | my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU(); | ||
| 127 | my ($DATA_SEISMIC_TXT) = $Project->DATA_SEISMIC_TXT(); | ||
| 128 | my ($date) = $Project->date(); | ||
| 129 | |||
| 130 | =head2 instantiate | ||
| 131 | |||
| 132 | programs | ||
| 133 | |||
| 134 | =cut | ||
| 135 | |||
| 136 | my $control = control->new(); | ||
| 137 | my $cp = cp->new(); | ||
| 138 | my $test = manage_files_by2->new(); | ||
| 139 | my $log = message->new(); | ||
| 140 | my $run = flow->new(); | ||
| 141 | my $iPick_specB = iPick_specB->new(); | ||
| 142 | my $iShowNselect_picks = iShowNselect_picks->new(); | ||
| 143 | my $iSelect_xt = iSelect_xt->new(); | ||
| 144 | my $iPicks2par = iPicks2par->new(); | ||
| 145 | my $iPicks2sort = iPicks2sort->new(); | ||
| 146 | my $check4old_data = old_data->new(); | ||
| 147 | my $iSave_picks = iSave_picks->new(); | ||
| 148 | my $SuMessages = SuMessages->new(); | ||
| 149 | my $get = L_SU_global_constants->new(); | ||
| 150 | |||
| 151 | my $variables = $iPick_specB->variables(); | ||
| 152 | my $DATA_DIR_IN = $variables->{_DATA_DIR_IN}; | ||
| 153 | my $DATA_DIR_OUT = $variables->{_DATA_DIR_OUT}; | ||
| 154 | my $data_suffix_in = $variables->{_data_suffix_in}; | ||
| 155 | my $data_suffix_out = $variables->{_data_suffix_out}; | ||
| 156 | my $var = $get->var(); | ||
| 157 | my $empty_string = $var->{_empty_string}; | ||
| 158 | |||
| 159 | =head2 private hash | ||
| 160 | |||
| 161 | =cut | ||
| 162 | |||
| 163 | my $iPick = { | ||
| 164 | _gather_header => '', | ||
| 165 | _offset_type => '', | ||
| 166 | _gather_num => '', | ||
| 167 | _gather_num_suffix => '', | ||
| 168 | _exists => '', | ||
| 169 | _file_in => '', | ||
| 170 | _freq => '', | ||
| 171 | _gather_type => '', | ||
| 172 | _inbound => '', | ||
| 173 | _inbound_curve => '', | ||
| 174 | _max_amplitude => '', | ||
| 175 | _max_x1 => '', | ||
| 176 | _min_amplitude => '', | ||
| 177 | _min_x1 => '', | ||
| 178 | _next_step => '', | ||
| 179 | _number_of_tries => '', | ||
| 180 | _purpose => '', | ||
| 181 | _textfile_in => '', | ||
| 182 | _textfile_out => '' | ||
| 183 | }; | ||
| 184 | |||
| 185 | =head2 | ||
| 186 | |||
| 187 | declare variables types | ||
| 188 | establish just the locally scoped variables | ||
| 189 | |||
| 190 | =cut | ||
| 191 | |||
| 192 | my ( @flow, @cp, @items ); | ||
| 193 | |||
| 194 | =head2 sub clear | ||
| 195 | |||
| 196 | sets all variable strings to '' | ||
| 197 | |||
| 198 | =cut | ||
| 199 | |||
| 200 | sub clear { | ||
| 201 | $iPick->{_gather_num} = ''; | ||
| 202 | $iPick->{_gather_type} = ''; | ||
| 203 | $iPick->{_gather_header} = ''; | ||
| 204 | $iPick->{_offset_type} = ''; | ||
| 205 | $iPick->{_gather_num_suffix} = ''; | ||
| 206 | $iPick->{_exists} = ''; | ||
| 207 | $iPick->{_file_in} = ''; | ||
| 208 | $iPick->{_freq} = ''; | ||
| 209 | $iPick->{_inbound} = ''; | ||
| 210 | $iPick->{_inbound_curve} = ''; | ||
| 211 | $iPick->{_max_amplitude} = ''; | ||
| 212 | $iPick->{_max_x1} = ''; | ||
| 213 | $iPick->{_min_amplitude} = ''; | ||
| 214 | $iPick->{_min_x1} = ''; | ||
| 215 | $iPick->{_next_step} = ''; | ||
| 216 | $iPick->{_number_of_tries} = ''; | ||
| 217 | $iPick->{_purpose} = ''; | ||
| 218 | $iPick->{_textfile_in} = ''; | ||
| 219 | $iPick->{_textfile_out} = ''; | ||
| 220 | |||
| 221 | } | ||
| 222 | |||
| 223 | =head2 sub icp_sorted_2_old_picks | ||
| 224 | |||
| 225 | When user wants to rreview old data | ||
| 226 | this sub allows the user to | ||
| 227 | use a prior sorted file | ||
| 228 | Juan M. Lorenzo | ||
| 229 | Jan 10 2010 | ||
| 230 | |||
| 231 | ted_inbound = $DATA_DIR_OUT.'/'.$iPick->{_inbound_curve_file}; | ||
| 232 | my $outbound = $DATA_DIR_OUT.'/'.$itemp_picks_.$iPick->{_file_in}; | ||
| 233 | |||
| 234 | $cp ->from($inbound); | ||
| 235 | $cp ->to($outbound); | ||
| 236 | $cp[1] = $cp->Step(); | ||
| 237 | input file is ipicks_sorted | ||
| 238 | output pick file | ||
| 239 | text file out: ipicks_old | ||
| 240 | |||
| 241 | |||
| 242 | =cut | ||
| 243 | |||
| 244 | sub _icp_sorted2temp_picks { | ||
| 245 | |||
| 246 | my ( $inbound_sorted, $outbound ); | ||
| 247 | my ($writefile_out); | ||
| 248 | my ($flow); | ||
| 249 | my ( $XTpicks_out, $XTpicks_in ); | ||
| 250 | |||
| 251 | &_inbound_curve(); | ||
| 252 | |||
| 253 | $inbound_sorted = $iPick->{_inbound_curve}; | ||
| 254 | $outbound = $DATA_DIR_OUT . '/' . $itemp_picks_ . $iPick->{_file_in}; | ||
| 255 | |||
| 256 | $cp->clear(); | ||
| 257 | $cp->from($inbound_sorted); | ||
| 258 | $cp->to($outbound); | ||
| 259 | $cp[1] = $cp->Step(); | ||
| 260 | |||
| 261 | =head2 | ||
| 262 | |||
| 263 | DEFINE FLOW(S) | ||
| 264 | |||
| 265 | =cut | ||
| 266 | |||
| 267 | @items = ( $cp[1] ); | ||
| 268 | $flow[1] = $run->modules( \@items ); | ||
| 269 | |||
| 270 | =head2 | ||
| 271 | |||
| 272 | RUN FLOW(S) | ||
| 273 | |||
| 274 | =cut | ||
| 275 | |||
| 276 | $run->flow( \$flow[1] ); | ||
| 277 | |||
| 278 | =head2 | ||
| 279 | |||
| 280 | LOG FLOW(S)TO SCREEN AND FILE | ||
| 281 | |||
| 282 | =cut | ||
| 283 | |||
| 284 | # print "$flow[1]\n"; | ||
| 285 | # $log->file($flow[1]); | ||
| 286 | |||
| 287 | #end of copy of XT old picks sorted to iXTpicks_old | ||
| 288 | } | ||
| 289 | |||
| 290 | =head2 sub _inbound_curve | ||
| 291 | |||
| 292 | Required text file with x,t pairs | ||
| 293 | |||
| 294 | =cut | ||
| 295 | |||
| 296 | sub _inbound_curve { | ||
| 297 | |||
| 298 | my ($self) = @_; | ||
| 299 | |||
| 300 | if ( defined $iPick->{_file_in} ) { | ||
| 301 | |||
| 302 | my $file_in = $iPick->{_file_in}; | ||
| 303 | $iPick->{_inbound_curve} = $DATA_DIR_OUT . '/' . $itemp_picks_sorted_ . $file_in; | ||
| 304 | |||
| 305 | # print("iPick, _inbound_curve: $iPick->{_inbound_curve} \n\n"); | ||
| 306 | |||
| 307 | } else { | ||
| 308 | print("iPick, _inbound_curve: unexpected file_in \n\n"); | ||
| 309 | } | ||
| 310 | } | ||
| 311 | |||
| 312 | =head2 sub gather_header | ||
| 313 | |||
| 314 | define header on which to search or run suwindow | ||
| 315 | For example, when you have a string of shotpoint | ||
| 316 | gathers in a single file and you want to examine | ||
| 317 | one at a time. In this case the binheader type can | ||
| 318 | be ep | ||
| 319 | |||
| 320 | =cut | ||
| 321 | |||
| 322 | sub gather_header { | ||
| 323 | my ( $self, $gather_header ) = @_; | ||
| 324 | |||
| 325 | if ( defined($gather_header) | ||
| 326 | || $gather_header eq $empty_string ) { | ||
| 327 | |||
| 328 | $iPick->{_gather_header} = $gather_header; | ||
| 329 | |||
| 330 | } else { | ||
| 331 | print("iPick,gather_header, unexpected gather_header"); | ||
| 332 | } | ||
| 333 | return (); | ||
| 334 | } | ||
| 335 | |||
| 336 | =head2 sub data_scale | ||
| 337 | |||
| 338 | Required data plotting scale | ||
| 339 | |||
| 340 | =cut | ||
| 341 | |||
| 342 | sub data_scale { | ||
| 343 | my ( $self, $data_scale ) = @_; | ||
| 344 | |||
| 345 | if ( defined($data_scale) | ||
| 346 | || $data_scale eq $empty_string ) { | ||
| 347 | |||
| 348 | $iPick->{_data_scale} = $data_scale; | ||
| 349 | |||
| 350 | } else { | ||
| 351 | print("iPick,data_scale, unexpected data_scale"); | ||
| 352 | } | ||
| 353 | return (); | ||
| 354 | } | ||
| 355 | |||
| 356 | =head2 sub file_in | ||
| 357 | |||
| 358 | Required file name | ||
| 359 | on which to pick top mute values | ||
| 360 | |||
| 361 | =cut | ||
| 362 | |||
| 363 | sub file_in { | ||
| 364 | my ( $self, $file_in ) = @_; | ||
| 365 | |||
| 366 | if ( $file_in && $file_in ne $empty_string ) { | ||
| 367 | |||
| 368 | # e.g. 'sp1' becomes sp1 | ||
| 369 | $control->set_infection($file_in); | ||
| 370 | $file_in = $control->get_ticksBgone(); | ||
| 371 | $iPick->{_file_in} = $file_in; | ||
| 372 | |||
| 373 | # print("iPick,file_in,file is $iPick->{_file_in} \n"); | ||
| 374 | |||
| 375 | } else { | ||
| 376 | print("iPick,file_in,file does not exist\n"); | ||
| 377 | } | ||
| 378 | return (); | ||
| 379 | } | ||
| 380 | |||
| 381 | =head2 sub freq | ||
| 382 | Bandpass filter frequencies before | ||
| 383 | conducting amplitude analysis | ||
| 384 | e.g., "3,6,40,50" | ||
| 385 | |||
| 386 | =cut | ||
| 387 | |||
| 388 | sub freq { | ||
| 389 | my ( $self, $freq ) = @_; | ||
| 390 | |||
| 391 | $iPick->{_freq} = $freq if defined($freq); | ||
| 392 | |||
| 393 | # print("iPick,freq,freq is$iPick->{_freq}\n\n"); | ||
| 394 | } | ||
| 395 | |||
| 396 | =head2 sub gather_num | ||
| 397 | |||
| 398 | sets gather number to consider | ||
| 399 | |||
| 400 | =cut | ||
| 401 | |||
| 402 | sub gather_num { | ||
| 403 | my ( $self, $gather_num ) = @_; | ||
| 404 | |||
| 405 | if ( defined $gather_num && $gather_num ne $empty_string ) { | ||
| 406 | $iPick->{_gather_num} = $gather_num; | ||
| 407 | $iPick->{_gather_num_suffix} = '_gather' . $iPick->{_gather_num}; | ||
| 408 | |||
| 409 | # print("iPick,gather_num: $gather_num\n"); | ||
| 410 | |||
| 411 | } else { | ||
| 412 | print("iPick,gather_num, unexpected gather_num\n"); | ||
| 413 | } | ||
| 414 | |||
| 415 | } | ||
| 416 | |||
| 417 | =head2 sub gather_type | ||
| 418 | Define which family of | ||
| 419 | interactive user messages to use | ||
| 420 | SP or CDP | ||
| 421 | |||
| 422 | =cut | ||
| 423 | |||
| 424 | sub gather_type { | ||
| 425 | my ( $self, $gather_type ) = @_; | ||
| 426 | |||
| 427 | if ( defined($gather_type) | ||
| 428 | || $gather_type eq $empty_string ) { | ||
| 429 | |||
| 430 | $iPick->{_gather_type} = $gather_type; | ||
| 431 | |||
| 432 | # print("iPick,gather_type: $gather_type\n"); | ||
| 433 | |||
| 434 | } else { | ||
| 435 | print("iPick,gather_type, unexpected gather_type"); | ||
| 436 | } | ||
| 437 | return (); | ||
| 438 | } | ||
| 439 | |||
| 440 | =head2 sub get4data_type | ||
| 441 | |||
| 442 | look for old data | ||
| 443 | |||
| 444 | Are there old picks to read? | ||
| 445 | These old picks are of a type e.g., | ||
| 446 | velan, | ||
| 447 | gather | ||
| 448 | general Pick_xt | ||
| 449 | |||
| 450 | =cut | ||
| 451 | |||
| 452 | sub get4data_type { | ||
| 453 | |||
| 454 | my ($self) = @_; | ||
| 455 | |||
| 456 | if ( defined( $iPick->{_type} ) | ||
| 457 | && defined( $iPick->{_gather_num} ) | ||
| 458 | && defined( $iPick->{_file_in} ) | ||
| 459 | && $iPick->{_file_in} ne $empty_string | ||
| 460 | && $iPick->{_type} ne $empty_string | ||
| 461 | && $iPick->{_gather_num} ne $empty_string ) { | ||
| 462 | |||
| 463 | $check4old_data->gather_num( $iPick->{_gather_num} ); | ||
| 464 | $check4old_data->file_in( $iPick->{_file_in} ); | ||
| 465 | $iPick->{_exists} = $check4old_data->type( $iPick->{_type} ); | ||
| 466 | my $result = $iPick->{_exists}; | ||
| 467 | |||
| 468 | return ($result); | ||
| 469 | |||
| 470 | } else { | ||
| 471 | print("iPick,type,missing type or gather_num\n"); | ||
| 472 | } | ||
| 473 | |||
| 474 | } | ||
| 475 | |||
| 476 | =head2 sub iPicks_par | ||
| 477 | Convert format of pick files for use later | ||
| 478 | into "par" format | ||
| 479 | |||
| 480 | =cut | ||
| 481 | |||
| 482 | sub iPicks_par { | ||
| 483 | |||
| 484 | my ($self) = @_; | ||
| 485 | my $ans; | ||
| 486 | |||
| 487 | if ( defined $iPick->{_file_in} | ||
| 488 | && $iPick->{_file_in} ne $empty_string ) { | ||
| 489 | |||
| 490 | $iPick->{_inbound} = $DATA_DIR_IN . '/' . $iPick->{_file_in} . $data_suffix_in; | ||
| 491 | $ans = $test->does_file_exist( \$iPick->{_inbound} ); | ||
| 492 | |||
| 493 | # print("iPick, iPicks_par, Does file exist? $ans \n"); | ||
| 494 | # print("iPick, iPicks_par, file: $iPick->{_inbound}\n"); | ||
| 495 | } | ||
| 496 | |||
| 497 | if ($ans) { | ||
| 498 | |||
| 499 | $iPicks2par->file_in( $iPick->{_file_in} ); | ||
| 500 | $iPicks2par->calc(); | ||
| 501 | |||
| 502 | } else { | ||
| 503 | print("iPick, iPicks_par, file does not exist\n"); | ||
| 504 | } | ||
| 505 | |||
| 506 | return (); | ||
| 507 | } | ||
| 508 | |||
| 509 | =head2 sub iPicks_sort | ||
| 510 | |||
| 511 | convert format of pick files for use later | ||
| 512 | into "par" format | ||
| 513 | |||
| 514 | =cut | ||
| 515 | |||
| 516 | sub iPicks_sort { | ||
| 517 | |||
| 518 | my ($self) = @_; | ||
| 519 | my $ans; | ||
| 520 | |||
| 521 | if ( defined $iPick->{_file_in} | ||
| 522 | && $iPick->{_file_in} ne $empty_string ) { | ||
| 523 | |||
| 524 | # print("iPick, iPicks_sort, file :$iPick->{_file_in}\n"); | ||
| 525 | $iPick->{_inbound} = $DATA_DIR_OUT . '/' . $itemp_picks_ . $iPick->{_file_in}; | ||
| 526 | |||
| 527 | # print("iPick, iPicks_sort, file :$iPick->{_inbound}\n"); | ||
| 528 | $ans = $test->does_file_exist( \$iPick->{_inbound} ); | ||
| 529 | } | ||
| 530 | |||
| 531 | if ($ans) { | ||
| 532 | |||
| 533 | if ( $iPick->{_number_of_tries} > 0 ) { | ||
| 534 | |||
| 535 | # print("iPick,iPicks_sort,file, file_in: $iPick->{_file_in}\n"); | ||
| 536 | $iPicks2sort->file_in( $iPick->{_file_in} ); | ||
| 537 | $iPicks2sort->calc(); | ||
| 538 | |||
| 539 | } else { | ||
| 540 | |||
| 541 | # print("iPick,iPicks_sort,NADA\n"); | ||
| 542 | } | ||
| 543 | |||
| 544 | } else { | ||
| 545 | print("iPick, iPicks_sort, file does not exist\n"); | ||
| 546 | } | ||
| 547 | |||
| 548 | return (); | ||
| 549 | } | ||
| 550 | |||
| 551 | =head2 sub iPicks_save | ||
| 552 | |||
| 553 | save pick files for later use | ||
| 554 | |||
| 555 | =cut | ||
| 556 | |||
| 557 | sub iPicks_save { | ||
| 558 | my ($self) = @_; | ||
| 559 | $iSave_picks->gather_num( $iPick->{_gather_num} ); | ||
| 560 | $iSave_picks->gather_header( $iPick->{_gather_header} ); | ||
| 561 | $iSave_picks->gather_type( $iPick->{_gather_type} ); | ||
| 562 | $iSave_picks->file_in( $iPick->{_file_in} ); | ||
| 563 | $iSave_picks->set_purpose( $iPick->{_purpose} ); | ||
| 564 | $iSave_picks->calc(); | ||
| 565 | return (); | ||
| 566 | } | ||
| 567 | |||
| 568 | =head2 sub iPicks_select_xt | ||
| 569 | |||
| 570 | Select point co-ordinates from traces | ||
| 571 | provide file name | ||
| 572 | |||
| 573 | =cut | ||
| 574 | |||
| 575 | sub iPicks_select_xt { | ||
| 576 | |||
| 577 | my ($self) = @_; | ||
| 578 | |||
| 579 | if ( defined $iPick->{_file_in} | ||
| 580 | && $iPick->{_file_in} ne $empty_string ) { | ||
| 581 | |||
| 582 | $iPick->{_inbound} = $DATA_DIR_IN . '/' . $iPick->{_file_in} . $data_suffix_in; | ||
| 583 | my $ans = $test->does_file_exist( \$iPick->{_inbound} ); | ||
| 584 | |||
| 585 | # print("iPick,iPicks_select_xt, file: $iPick->{_file_in} exists?:$ans\n"); | ||
| 586 | |||
| 587 | if ($ans) { | ||
| 588 | |||
| 589 | # update a possible previous pick and save to a new file name for | ||
| 590 | # later use in ShowNselect | ||
| 591 | if ( $iPick->{_number_of_tries} >= 2 ) { | ||
| 592 | |||
| 593 | &iPicks_sort(); | ||
| 594 | |||
| 595 | # will not wait for sunix programs to stop so must be done here | ||
| 596 | # and at the start of picking | ||
| 597 | |||
| 598 | } else { | ||
| 599 | |||
| 600 | # print("iPick, iPicks_select_xt, NADA\n"); | ||
| 601 | } | ||
| 602 | |||
| 603 | $iSelect_xt->gather_type( $iPick->{_gather_type} ); | ||
| 604 | $iSelect_xt->offset_type( $iPick->{_offset_type} ); | ||
| 605 | $iSelect_xt->gather_header( $iPick->{_gather_header} ); | ||
| 606 | $iSelect_xt->file_in( $iPick->{_file_in} ); | ||
| 607 | $iSelect_xt->freq( $iPick->{_freq} ); | ||
| 608 | $iSelect_xt->gather_num( $iPick->{_gather_num} ); | ||
| 609 | $iSelect_xt->max_amplitude( $iPick->{_max_amplitude} ); | ||
| 610 | $iSelect_xt->max_x1( $iPick->{_max_x1} ); | ||
| 611 | $iSelect_xt->min_amplitude( $iPick->{_min_amplitude} ); | ||
| 612 | $iSelect_xt->min_x1( $iPick->{_min_x1} ); | ||
| 613 | $iSelect_xt->number_of_tries( $iPick->{_number_of_tries} ); | ||
| 614 | $iSelect_xt->set_purpose( $iPick->{_purpose} ); | ||
| 615 | $iSelect_xt->calcNdisplay(); | ||
| 616 | |||
| 617 | } else { | ||
| 618 | print("iPick,iPicks_select_xt, file does not exist. ans=$ans\n"); | ||
| 619 | } | ||
| 620 | |||
| 621 | } | ||
| 622 | |||
| 623 | } | ||
| 624 | |||
| 625 | =head2 sub iPicks_shownNselect | ||
| 626 | |||
| 627 | Update a possible previous pick and save to a new file name for | ||
| 628 | later use in ShowNselect | ||
| 629 | num_tries >1, is a condition already imposed in Pick.pl | ||
| 630 | |||
| 631 | =cut | ||
| 632 | |||
| 633 | sub iPicks_shownNselect { | ||
| 634 | my (@self) = @_; | ||
| 635 | |||
| 636 | &_icp_sorted2temp_picks; | ||
| 637 | $iShowNselect_picks->file_in( $iPick->{_file_in} ); | ||
| 638 | $iShowNselect_picks->gather_header( $iPick->{_gather_header} ); | ||
| 639 | $iShowNselect_picks->offset_type( $iPick->{_offset_type} ); | ||
| 640 | $iShowNselect_picks->freq( $iPick->{_freq} ); | ||
| 641 | $iShowNselect_picks->gather_num( $iPick->{_gather_num} ); | ||
| 642 | $iShowNselect_picks->max_amplitude( $iPick->{_max_amplitude} ); | ||
| 643 | $iShowNselect_picks->min_x1( $iPick->{_min_x1} ); | ||
| 644 | $iShowNselect_picks->max_x1( $iPick->{_max_x1} ); | ||
| 645 | $iShowNselect_picks->min_amplitude( $iPick->{_min_amplitude} ); | ||
| 646 | $iShowNselect_picks->number_of_tries( $iPick->{_number_of_tries} ); | ||
| 647 | $iShowNselect_picks->set_purpose( $iPick->{_purpose} ); | ||
| 648 | $iShowNselect_picks->calcNdisplay(); | ||
| 649 | return (); | ||
| 650 | } | ||
| 651 | |||
| 652 | =head2 | ||
| 653 | |||
| 654 | sub maximum amplitude to plot | ||
| 655 | |||
| 656 | =cut | ||
| 657 | |||
| 658 | sub max_amplitude { | ||
| 659 | |||
| 660 | my ( $self, $max_amplitude ) = @_; | ||
| 661 | |||
| 662 | if ( defined($max_amplitude) ) { | ||
| 663 | |||
| 664 | $iPick->{_max_amplitude} = $max_amplitude; | ||
| 665 | |||
| 666 | # print("max_amplitude is $iPick->{_max_amplitude}\n\n"); | ||
| 667 | |||
| 668 | } else { | ||
| 669 | print("iPick,max_amplitude, unexpected max amplitude\n"); | ||
| 670 | } | ||
| 671 | } | ||
| 672 | |||
| 673 | =head2 | ||
| 674 | |||
| 675 | sub maximum time/Hz to plot | ||
| 676 | |||
| 677 | =cut | ||
| 678 | |||
| 679 | sub max_x1 { | ||
| 680 | my ( $self, $max_x1 ) = @_; | ||
| 681 | |||
| 682 | if ( length $max_x1 ) { | ||
| 683 | |||
| 684 | $iPick->{_max_x1} = $max_x1; | ||
| 685 | |||
| 686 | # print("max_x1 is $iPick->{_max_x1}\n\n"); | ||
| 687 | |||
| 688 | } else { | ||
| 689 | print("iPick,max_x1, unexpected max time-s\n"); | ||
| 690 | } | ||
| 691 | } | ||
| 692 | |||
| 693 | =head2 sub iPicks_message | ||
| 694 | |||
| 695 | instructions | ||
| 696 | |||
| 697 | =cut | ||
| 698 | |||
| 699 | sub iPicks_message { | ||
| 700 | |||
| 701 | my ( $self, $message ) = @_; | ||
| 702 | |||
| 703 | if ( defined($message) ) { | ||
| 704 | $iPick->{_message} = $message; | ||
| 705 | |||
| 706 | # print("message is $iPick->{_message}\n\n"); | ||
| 707 | |||
| 708 | } else { | ||
| 709 | print("iPick,iPicks_message, unexpected message\n"); | ||
| 710 | } | ||
| 711 | } | ||
| 712 | |||
| 713 | =head2 | ||
| 714 | |||
| 715 | sub minumum amplitude to plot | ||
| 716 | |||
| 717 | =cut | ||
| 718 | |||
| 719 | sub min_amplitude { | ||
| 720 | my ( $self, $min_amplitude ) = @_; | ||
| 721 | |||
| 722 | if ( defined $min_amplitude && $min_amplitude ne $empty_string ) { | ||
| 723 | $iPick->{_min_amplitude} = $min_amplitude; | ||
| 724 | |||
| 725 | # print("min_amplitude is $iPick->{_min_amplitude}\n\n"); | ||
| 726 | } else { | ||
| 727 | print("iPick,min_amplitude, unexpected min amplitude\n"); | ||
| 728 | } | ||
| 729 | } | ||
| 730 | |||
| 731 | =head2 | ||
| 732 | |||
| 733 | sub minimum time/Hzto plot | ||
| 734 | |||
| 735 | =cut | ||
| 736 | |||
| 737 | sub min_x1 { | ||
| 738 | my ( $self, $min_x1 ) = @_; | ||
| 739 | |||
| 740 | if ( length $min_x1 ) { | ||
| 741 | |||
| 742 | $iPick->{_min_x1} = $min_x1; | ||
| 743 | |||
| 744 | # print("min_x1 is $iPick->{_min_x1}\n\n"); | ||
| 745 | |||
| 746 | } else { | ||
| 747 | print("iPick,min_x1, unexpected min time-s\n"); | ||
| 748 | } | ||
| 749 | } | ||
| 750 | |||
| 751 | =head2 | ||
| 752 | |||
| 753 | sub number_of_tries | ||
| 754 | required count of the number of attempts | ||
| 755 | at estimating the velocity | ||
| 756 | |||
| 757 | =cut | ||
| 758 | |||
| 759 | sub number_of_tries { | ||
| 760 | |||
| 761 | my ( $self, $number_of_tries ) = @_; | ||
| 762 | |||
| 763 | if ( $number_of_tries ne $empty_string ) { | ||
| 764 | |||
| 765 | $iPick->{_number_of_tries} = $number_of_tries | ||
| 766 | if defined($number_of_tries); | ||
| 767 | |||
| 768 | # print("iPick, number_of_tries,$iPick->{_number_of_tries} \n\n"); | ||
| 769 | |||
| 770 | } else { | ||
| 771 | print("iPick, number_of_tries, unexpected number_of_tries} \n\n"); | ||
| 772 | } | ||
| 773 | } | ||
| 774 | |||
| 775 | =head2 sub offset_type | ||
| 776 | |||
| 777 | define which values to use in the x axis | ||
| 778 | |||
| 779 | =cut | ||
| 780 | |||
| 781 | sub offset_type { | ||
| 782 | |||
| 783 | my ( $self, $offset_type ) = @_; | ||
| 784 | $iPick->{_offset_type} = $offset_type if defined($offset_type); | ||
| 785 | |||
| 786 | # print("offset type -2 $offset_type\n\n"); | ||
| 787 | } | ||
| 788 | |||
| 789 | =head2 sub set_message | ||
| 790 | |||
| 791 | define the message family (type) to use | ||
| 792 | also set the gather number (TODO: move option elsewhere) | ||
| 793 | |||
| 794 | =cut | ||
| 795 | |||
| 796 | sub set_message_type { | ||
| 797 | |||
| 798 | my ( $self, $type ) = @_; | ||
| 799 | |||
| 800 | if ( $type ne $empty_string ) { | ||
| 801 | |||
| 802 | $iPick->{_message_type} = $type; | ||
| 803 | $SuMessages->set( $iPick->{_message_type} ); | ||
| 804 | |||
| 805 | # print("iPick, type,$iPick->{_type} \n\n"); | ||
| 806 | |||
| 807 | #=head3 | ||
| 808 | # | ||
| 809 | # update gather number for messages | ||
| 810 | # | ||
| 811 | #=cut | ||
| 812 | |||
| 813 | # $SuMessages->gather_num($iPick->{_gather_num}); | ||
| 814 | # $SuMessages->instructions($iPick->{_instructions}); | ||
| 815 | # $SuMessages->gather_header($iPick->{_gather_header}); | ||
| 816 | # $SuMessages->gather_type($iPick->{_gather_type}); | ||
| 817 | |||
| 818 | } else { | ||
| 819 | print("iPick, type, unexpected type} \n\n"); | ||
| 820 | } | ||
| 821 | } | ||
| 822 | |||
| 823 | =head2 sub set_data_type | ||
| 824 | |||
| 825 | set what type of old data | ||
| 826 | we are looking for | ||
| 827 | velan, | ||
| 828 | gather | ||
| 829 | general Pick_xt | ||
| 830 | |||
| 831 | =cut | ||
| 832 | |||
| 833 | sub set_data_type { | ||
| 834 | my ( $self, $type ) = @_; | ||
| 835 | |||
| 836 | if ( $type && $type ne $empty_string ) { | ||
| 837 | |||
| 838 | $iPick->{_type} = $type; | ||
| 839 | |||
| 840 | } else { | ||
| 841 | print("iPick,set_data_type,missing data type\n"); | ||
| 842 | } | ||
| 843 | return (); | ||
| 844 | } | ||
| 845 | |||
| 846 | =head2 sub set_purpose | ||
| 847 | |||
| 848 | define where the data will need to go | ||
| 849 | define the type of behavior | ||
| 850 | |||
| 851 | =cut | ||
| 852 | |||
| 853 | sub set_purpose { | ||
| 854 | |||
| 855 | my ( $self, $type ) = @_; | ||
| 856 | |||
| 857 | if ( defined $type | ||
| 858 | && $type ne $empty_string ) { | ||
| 859 | |||
| 860 | $iPick->{_purpose} = $type; | ||
| 861 | |||
| 862 | # print("iPick,set_purpose: $iPick->{_purpose}\n"); | ||
| 863 | |||
| 864 | } else { | ||
| 865 | |||
| 866 | # print("iPick,set_purpose is unavailable, NADA\n"); | ||
| 867 | } | ||
| 868 | } | ||
| 869 | |||
| 870 | 1; |