| 1 | package App::SeismicUnixGui::big_streams::iSuvelan; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PCKAGE NAME: iSuvelan | ||
| 8 | |||
| 9 | Purpose: interactive suvelan | ||
| 10 | AUTHOR: Juan M. Lorenzo | ||
| 11 | DEPENDS: Seismic Unix modules from CSM | ||
| 12 | DATE: April 1 2009 | ||
| 13 | DESCRIPTION: Generate Velocity Analysis | ||
| 14 | MODIFIED Nov. 11, 2013 | ||
| 15 | July 24 2015 uses oop | ||
| 16 | |||
| 17 | |||
| 18 | =head2 NOTES | ||
| 19 | |||
| 20 | We recommend that you prepare the balance the | ||
| 21 | amplitudes in the data before you hand them | ||
| 22 | over to iSuvelan, which DOES not GAIN | ||
| 23 | its data. The resulting semblances may | ||
| 24 | suffer if you do not pay attention | ||
| 25 | |||
| 26 | =head2 USES | ||
| 27 | |||
| 28 | =head2 STEPS IN THE PROGRAM | ||
| 29 | |||
| 30 | =cut | ||
| 31 | |||
| 32 | =head2 inherit and Instantiate | ||
| 33 | |||
| 34 | classes | ||
| 35 | Create a new version of the package | ||
| 36 | Personalize to give it a new name if you wish | ||
| 37 | Use classes: | ||
| 38 | suvelan | ||
| 39 | |||
| 40 | =cut | ||
| 41 | |||
| 42 | use Moose; | ||
| 43 | our $VERSION = '0.0.1'; | ||
| 44 | use aliased 'App::SeismicUnixGui::misc::flow'; | ||
| 45 | use aliased 'App::SeismicUnixGui::misc::manage_files_by'; | ||
| 46 | use aliased 'App::SeismicUnixGui::sunix::filter::sufilter'; | ||
| 47 | use aliased 'App::SeismicUnixGui::sunix::shapeNcut::sugain'; | ||
| 48 | use aliased 'App::SeismicUnixGui::sunix::shapeNcut::susort'; | ||
| 49 | use aliased 'App::SeismicUnixGui::sunix::NMO_Vel_Stk::suvelan'; | ||
| 50 | use aliased 'App::SeismicUnixGui::sunix::shapeNcut::suwind'; | ||
| 51 | use aliased 'App::SeismicUnixGui::sunix::plot::suximage'; | ||
| 52 | use aliased 'App::SeismicUnixGui::sunix::plot::suxwigb'; | ||
| 53 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 54 | use aliased 'App::SeismicUnixGui::misc::message'; | ||
| 55 | use aliased 'App::SeismicUnixGui::sunix::header::header_values'; | ||
| 56 | use App::SeismicUnixGui::misc::SeismicUnix qw($on $off $in $to $go); | ||
| 57 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 58 | |||
| 59 | my $log = message->new(); | ||
| 60 | my $manage_files_by = manage_files_by->new(); | ||
| 61 | my $run = flow->new(); | ||
| 62 | my $sufilter = sufilter->new(); | ||
| 63 | my $sugain = sugain->new(); | ||
| 64 | my $susort = susort->new(); | ||
| 65 | my $suvelan = suvelan->new(); | ||
| 66 | my $suwind = suwind->new(); | ||
| 67 | my $suximage = suximage->new(); | ||
| 68 | my $suxwigb = suxwigb->new(); | ||
| 69 | my $Project = Project_config->new(); | ||
| 70 | my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU(); | ||
| 71 | my ($PL_SEISMIC) = $Project->PL_SEISMIC(); | ||
| 72 | my $get = L_SU_global_constants->new(); | ||
| 73 | |||
| 74 | =head2 Import Special Variables | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | my $var = $get->var(); | ||
| 79 | my $empty_string = $var->{_empty_string}; | ||
| 80 | my $us2s = $var->{_us2s}; | ||
| 81 | |||
| 82 | =head2 | ||
| 83 | |||
| 84 | establish just the locally scoped variables | ||
| 85 | |||
| 86 | =cut | ||
| 87 | |||
| 88 | my ( @suwind_min, @suwind_max ); | ||
| 89 | my ( @sufilter, @suvelan, @suximage, @suxwigb ); | ||
| 90 | my ( @susort, @sugain, @suwind, @wgagc, @bandpass ); | ||
| 91 | my (@cp); | ||
| 92 | my ( @suximage_col_bar_max, @suximage_col_bar_min ); | ||
| 93 | my (@windowtitle); | ||
| 94 | my ($N); | ||
| 95 | my ( @suximage_first_vel, @suximage_vel_inc ); | ||
| 96 | my ( @first_velocity_tick, @suximage_vel_tick_inc ); | ||
| 97 | my ( @base_caption, @tlabel, @xlabel, @X0, @Y0, @max_abs ); | ||
| 98 | my ( @flow, @items ); | ||
| 99 | |||
| 100 | =head2 hash array of important variables | ||
| 101 | |||
| 102 | used within | ||
| 103 | this package | ||
| 104 | |||
| 105 | =cut | ||
| 106 | |||
| 107 | my $iSuvelan = { | ||
| 108 | _anis1 => '', | ||
| 109 | _anis2 => '', | ||
| 110 | _cdp_num => '', | ||
| 111 | _cdp_num_suffix => '', | ||
| 112 | _dtratio => '', | ||
| 113 | _data_scale => 1, | ||
| 114 | _dt_s => '', | ||
| 115 | _file_in => '', | ||
| 116 | _first_velocity => '', | ||
| 117 | _freq => '', | ||
| 118 | _inbound => '', | ||
| 119 | _max_semblance => '', | ||
| 120 | _min_semblance => '', | ||
| 121 | _nsmooth => '', | ||
| 122 | _number_of_tries => '', | ||
| 123 | _number_of_velocities => '', | ||
| 124 | _pwr => '', | ||
| 125 | _smute => '', | ||
| 126 | _sufile_in => '', | ||
| 127 | _tmax_s => '', | ||
| 128 | _textfile_in => '', | ||
| 129 | _textfile_out => '', | ||
| 130 | _Tvel_inbound => '', | ||
| 131 | _Tvel_outbound => '', | ||
| 132 | _velocity_increment => '', | ||
| 133 | |||
| 134 | # _verbose => '', | ||
| 135 | }; | ||
| 136 | |||
| 137 | =head2 subroutine clear | ||
| 138 | |||
| 139 | to blank out hash array values | ||
| 140 | |||
| 141 | =cut | ||
| 142 | |||
| 143 | sub clear { | ||
| 144 | $iSuvelan->{_anis1} = ''; | ||
| 145 | $iSuvelan->{_anis2} = ''; | ||
| 146 | $iSuvelan->{_cdp_num} = ''; | ||
| 147 | $iSuvelan->{_cdp_num_suffix} = ''; | ||
| 148 | $iSuvelan->{_data_scale} = ''; | ||
| 149 | $iSuvelan->{_dtratio} = ''; | ||
| 150 | $iSuvelan->{_dt_s} = ''; | ||
| 151 | $iSuvelan->{_file_in} = ''; | ||
| 152 | $iSuvelan->{_first_velocity} = ''; | ||
| 153 | $iSuvelan->{_freq} = ''; | ||
| 154 | $iSuvelan->{_inbound} = ''; | ||
| 155 | $iSuvelan->{_max_semblance} = ''; | ||
| 156 | $iSuvelan->{_min_semblance} = ''; | ||
| 157 | $iSuvelan->{_nsmooth} = ''; | ||
| 158 | $iSuvelan->{_number_of_tries} = ''; | ||
| 159 | $iSuvelan->{_number_of_velocities} = ''; | ||
| 160 | $iSuvelan->{_velocity_increment} = ''; | ||
| 161 | $iSuvelan->{_smute} = ''; | ||
| 162 | $iSuvelan->{_pwr} = ''; | ||
| 163 | $iSuvelan->{_sufile_in} = ''; | ||
| 164 | $iSuvelan->{_textfile_in} = ''; | ||
| 165 | $iSuvelan->{_textfile_out} = ''; | ||
| 166 | $iSuvelan->{_Tvel_inbound} = ''; | ||
| 167 | $iSuvelan->{_Tvel_outbound} = ''; | ||
| 168 | $iSuvelan->{_tmax_s} = ''; | ||
| 169 | |||
| 170 | # $iSuvelan->{_verbose} = ''; | ||
| 171 | } | ||
| 172 | |||
| 173 | =head2 subroutine cdp_num | ||
| 174 | |||
| 175 | |||
| 176 | establishes the CDP number being worked | ||
| 177 | Also establishes'cdp'# as a recognizable suffix | ||
| 178 | for file names | ||
| 179 | |||
| 180 | =cut | ||
| 181 | |||
| 182 | sub cdp_num { | ||
| 183 | my ( $variable, $cdp_num ) = @_; | ||
| 184 | if ($cdp_num) { | ||
| 185 | $iSuvelan->{_cdp_num} = $cdp_num; | ||
| 186 | |||
| 187 | #print("cdp_num in iSuvelan is $iSuvelan->{_cdp_num}\n\n"); | ||
| 188 | } | ||
| 189 | } | ||
| 190 | |||
| 191 | =head2 subroutine cdp_num_suffix | ||
| 192 | |||
| 193 | |||
| 194 | establishes the CDP number suffix | ||
| 195 | that is being worked | ||
| 196 | |||
| 197 | =cut | ||
| 198 | |||
| 199 | sub cdp_num_suffix { | ||
| 200 | my ( $variable, $cdp_num ) = @_; | ||
| 201 | if ($cdp_num) { | ||
| 202 | $iSuvelan->{_cdp_num_suffix} = '_cdp' . $cdp_num; | ||
| 203 | |||
| 204 | #print("suffix in iSuvelan is $iSuvelan->{_cdp_num_suffix}\n\n"); | ||
| 205 | } | ||
| 206 | } | ||
| 207 | |||
| 208 | =head2 subroutine dt_s | ||
| 209 | |||
| 210 | |||
| 211 | =cut | ||
| 212 | |||
| 213 | sub dt_s { | ||
| 214 | my ( $variable, $dt_s ) = @_; | ||
| 215 | |||
| 216 | if ($dt_s) { | ||
| 217 | |||
| 218 | $iSuvelan->{_dt_s} = $dt_s; | ||
| 219 | |||
| 220 | } | ||
| 221 | } | ||
| 222 | |||
| 223 | =head2 subroutine file_in | ||
| 224 | |||
| 225 | gets the file name | ||
| 226 | creates the sufile name to read | ||
| 227 | creates the full path for reading the sufile | ||
| 228 | |||
| 229 | print("iSuvelan_inbound is $iSuvelan->{_inbound}\n\n"); | ||
| 230 | |||
| 231 | =cut | ||
| 232 | |||
| 233 | sub file_in { | ||
| 234 | my ( $variable, $file_in ) = @_; | ||
| 235 | if ($file_in) { | ||
| 236 | $iSuvelan->{_file_in} = $file_in; | ||
| 237 | $iSuvelan->{_sufile_in} = $file_in . '.su'; | ||
| 238 | } | ||
| 239 | $iSuvelan->{_inbound} = $DATA_SEISMIC_SU . '/' . $iSuvelan->{_sufile_in}; | ||
| 240 | } | ||
| 241 | |||
| 242 | =head2 subroutine first_velocity | ||
| 243 | |||
| 244 | print("first velocity is $iSuvelan->{_first_velocity} \n\n"); | ||
| 245 | |||
| 246 | =cut | ||
| 247 | |||
| 248 | sub first_velocity { | ||
| 249 | my ( $variable, $first_velocity ) = @_; | ||
| 250 | if ($first_velocity) { | ||
| 251 | $iSuvelan->{_first_velocity} = $first_velocity; | ||
| 252 | } | ||
| 253 | } | ||
| 254 | |||
| 255 | =head2 subroutine freq | ||
| 256 | |||
| 257 | creates the bandpass frequencies to filter data before | ||
| 258 | conducting semblance analysis | ||
| 259 | e.g., "3,6,40,50" | ||
| 260 | |||
| 261 | =cut | ||
| 262 | |||
| 263 | sub freq { | ||
| 264 | my ( $variable, $freq ) = @_; | ||
| 265 | $iSuvelan->{_freq} = $freq if defined($freq); | ||
| 266 | |||
| 267 | # print("iSuvelan,freq= $iSuvelan->{_freq}\n"); | ||
| 268 | } | ||
| 269 | |||
| 270 | =head2 subroutine number_of_tries | ||
| 271 | |||
| 272 | keep track of the number of attempts | ||
| 273 | at picking velocities | ||
| 274 | |||
| 275 | =cut | ||
| 276 | |||
| 277 | sub number_of_tries { | ||
| 278 | my ( $variable, $number_of_tries ) = @_; | ||
| 279 | $iSuvelan->{_number_of_tries} = $number_of_tries | ||
| 280 | if defined($number_of_tries); | ||
| 281 | |||
| 282 | #print("num of tries is $iSuvelan->{_number_of_tries}\n\n"); | ||
| 283 | #print("\nReading: $Tvel_iSuvelan->{_inbound} \nTime=$$ref_T_nmo[1],Vel=$$ref_Vnmo[1],npairs=$num_tvel_pairs \n"); | ||
| 284 | |||
| 285 | } | ||
| 286 | |||
| 287 | =head2 subroutine set_anis1 | ||
| 288 | |||
| 289 | |||
| 290 | =cut | ||
| 291 | |||
| 292 | sub set_anis1 { | ||
| 293 | my ( $variable, $anis1 ) = @_; | ||
| 294 | |||
| 295 | if ( defined $anis1 && $anis1 ne $empty_string ) { | ||
| 296 | $iSuvelan->{_anis1} = $anis1; | ||
| 297 | } | ||
| 298 | else { | ||
| 299 | print("iSuvelan, unexpected anis1\n"); | ||
| 300 | } | ||
| 301 | |||
| 302 | } | ||
| 303 | |||
| 304 | =head2 subroutine set_anis2 | ||
| 305 | |||
| 306 | |||
| 307 | =cut | ||
| 308 | |||
| 309 | sub set_anis2 { | ||
| 310 | my ( $variable, $anis2 ) = @_; | ||
| 311 | |||
| 312 | if ( defined $anis2 && $anis2 ne $empty_string ) { | ||
| 313 | $iSuvelan->{_anis2} = $anis2; | ||
| 314 | } | ||
| 315 | else { | ||
| 316 | print("iSuvelan, unexpected anis2\n"); | ||
| 317 | } | ||
| 318 | |||
| 319 | } | ||
| 320 | |||
| 321 | =head2 subroutine set_data_scale | ||
| 322 | |||
| 323 | suvelan does not consider scalco or scalel header values | ||
| 324 | automatically | ||
| 325 | |||
| 326 | =cut | ||
| 327 | |||
| 328 | sub set_data_scale { | ||
| 329 | my ( $variable, $data_scale ) = @_; | ||
| 330 | |||
| 331 | if ( defined $data_scale && $data_scale ne $empty_string ) { | ||
| 332 | $iSuvelan->{_data_scale} = $data_scale; | ||
| 333 | } | ||
| 334 | else { | ||
| 335 | print("iSuvelan, unexpected data_scale\n"); | ||
| 336 | } | ||
| 337 | |||
| 338 | } | ||
| 339 | |||
| 340 | =head2 subroutine set_dtratio | ||
| 341 | |||
| 342 | |||
| 343 | =cut | ||
| 344 | |||
| 345 | sub set_dtratio { | ||
| 346 | my ( $variable, $dtratio ) = @_; | ||
| 347 | |||
| 348 | if ( defined $dtratio && $dtratio ne $empty_string ) { | ||
| 349 | |||
| 350 | $iSuvelan->{_dtratio} = $dtratio; | ||
| 351 | |||
| 352 | } | ||
| 353 | else { | ||
| 354 | print("iSuvelan, unexpected dtratio\n"); | ||
| 355 | } | ||
| 356 | |||
| 357 | } | ||
| 358 | |||
| 359 | =head2 subroutine set_nsmooth | ||
| 360 | |||
| 361 | |||
| 362 | =cut | ||
| 363 | |||
| 364 | sub set_nsmooth { | ||
| 365 | my ( $variable, $nsmooth ) = @_; | ||
| 366 | |||
| 367 | if ( length $nsmooth | ||
| 368 | and length $iSuvelan->{_dtratio} ) | ||
| 369 | { | ||
| 370 | |||
| 371 | $iSuvelan->{_nsmooth} = $nsmooth; | ||
| 372 | |||
| 373 | } | ||
| 374 | elsif ( length $iSuvelan->{_dtratio} ) { | ||
| 375 | |||
| 376 | $iSuvelan->{_nsmooth} = $iSuvelan->{_dtratio} * 2 + 1; # from suvelan | ||
| 377 | |||
| 378 | } | ||
| 379 | else { | ||
| 380 | print("iSuvelan, a value for dtratio may be missing\n"); | ||
| 381 | } | ||
| 382 | |||
| 383 | } | ||
| 384 | |||
| 385 | =head2 subroutine set_pwr | ||
| 386 | |||
| 387 | |||
| 388 | =cut | ||
| 389 | |||
| 390 | sub set_pwr { | ||
| 391 | my ( $variable, $pwr ) = @_; | ||
| 392 | |||
| 393 | if ( defined $pwr && $pwr ne $empty_string ) { | ||
| 394 | $iSuvelan->{_pwr} = $pwr; | ||
| 395 | } | ||
| 396 | else { | ||
| 397 | print("iSuvelan, unexpected pwr\n"); | ||
| 398 | } | ||
| 399 | |||
| 400 | } | ||
| 401 | |||
| 402 | =head2 subroutine set_smute | ||
| 403 | |||
| 404 | |||
| 405 | =cut | ||
| 406 | |||
| 407 | sub set_smute { | ||
| 408 | my ( $variable, $smute ) = @_; | ||
| 409 | |||
| 410 | if ( defined $smute && $smute ne $empty_string ) { | ||
| 411 | $iSuvelan->{_smute} = $smute; | ||
| 412 | } | ||
| 413 | else { | ||
| 414 | print("iSuvelan, unexpected smute\n"); | ||
| 415 | } | ||
| 416 | |||
| 417 | } | ||
| 418 | |||
| 419 | #=head2 subroutine set_verbose | ||
| 420 | # | ||
| 421 | # | ||
| 422 | #=cut | ||
| 423 | # | ||
| 424 | #sub set_verbose { | ||
| 425 | # my ( $variable, $verbose ) = @_; | ||
| 426 | # | ||
| 427 | # if ( defined $verbose && $verbose ne $empty_string ) { | ||
| 428 | # $iSuvelan->{_verbose} = $verbose; | ||
| 429 | # } | ||
| 430 | # else { | ||
| 431 | # print("iSuvelan, unexpected verbose\n"); | ||
| 432 | # } | ||
| 433 | # | ||
| 434 | #} | ||
| 435 | |||
| 436 | =head2 subroutine tmax_s | ||
| 437 | |||
| 438 | |||
| 439 | =cut | ||
| 440 | |||
| 441 | sub tmax_s { | ||
| 442 | my ( $self, $tmax_s ) = @_; | ||
| 443 | if ($tmax_s) { | ||
| 444 | $iSuvelan->{_tmax_s} = $tmax_s; | ||
| 445 | } | ||
| 446 | } | ||
| 447 | |||
| 448 | =head2 subroutine velocity increment | ||
| 449 | |||
| 450 | |||
| 451 | =cut | ||
| 452 | |||
| 453 | sub velocity_increment { | ||
| 454 | my ( $variable, $velocity_increment ) = @_; | ||
| 455 | $iSuvelan->{_velocity_increment} = $velocity_increment | ||
| 456 | if defined($velocity_increment); | ||
| 457 | |||
| 458 | #print("velocity_increment is $iSuvelan->{_velocity_increment} \n\n"); | ||
| 459 | } | ||
| 460 | |||
| 461 | =head2 | ||
| 462 | |||
| 463 | subroutine number_of_velocities | ||
| 464 | |||
| 465 | =cut | ||
| 466 | |||
| 467 | sub number_of_velocities { | ||
| 468 | my ( $variable, $number_of_velocities ) = @_; | ||
| 469 | |||
| 470 | $iSuvelan->{_number_of_velocities} = $number_of_velocities | ||
| 471 | if defined $number_of_velocities; | ||
| 472 | |||
| 473 | # print(" iSuvelan,number_of_velocities:$iSuvelan->{_number_of_velocities} \n\n"); | ||
| 474 | } | ||
| 475 | |||
| 476 | =head2 subroutine calcNdisplay | ||
| 477 | |||
| 478 | calculate semblance and display results | ||
| 479 | |||
| 480 | =cut | ||
| 481 | |||
| 482 | sub calcNdisplay { | ||
| 483 | |||
| 484 | my ($self) = @_; | ||
| 485 | |||
| 486 | if ( | ||
| 487 | length $iSuvelan->{_file_in} | ||
| 488 | and $iSuvelan->{_dtratio} | ||
| 489 | and $iSuvelan->{_cdp_num} | ||
| 490 | and $iSuvelan->{_tmax_s} | ||
| 491 | and $iSuvelan->{_number_of_velocities} | ||
| 492 | and $iSuvelan->{_number_of_velocities} | ||
| 493 | and $iSuvelan->{_velocity_increment} | ||
| 494 | and $iSuvelan->{_data_scale} | ||
| 495 | ) | ||
| 496 | { | ||
| 497 | |||
| 498 | print(" iSuvelan, calcNdisplay\n\n"); | ||
| 499 | |||
| 500 | my $header = header_values->new(); | ||
| 501 | |||
| 502 | my $new_dt_s; | ||
| 503 | |||
| 504 | if ( length $iSuvelan->{_file_in} ) { | ||
| 505 | |||
| 506 | $header->set_base_file_name( $iSuvelan->{_file_in} ); | ||
| 507 | $header->set_header_name('dt'); | ||
| 508 | my $dt_us = $header->get_number(); | ||
| 509 | my $dt_s = $dt_us * $us2s; | ||
| 510 | $new_dt_s = $dt_s * $iSuvelan->{_dtratio}; | ||
| 511 | |||
| 512 | # print("iSuvelan,calcNdisplay, dt_s = $dt_s \n"); | ||
| 513 | |||
| 514 | } | ||
| 515 | else { | ||
| 516 | print("iSuvelan, calcNdisplay, missing base file name\n"); | ||
| 517 | } | ||
| 518 | |||
| 519 | =head2 WINDOW DATA | ||
| 520 | |||
| 521 | by cdp | ||
| 522 | |||
| 523 | =cut | ||
| 524 | |||
| 525 | $suwind_min[1] = $iSuvelan->{_cdp_num}; | ||
| 526 | $suwind_max[1] = $iSuvelan->{_cdp_num}; | ||
| 527 | |||
| 528 | $suwind->clear(); | ||
| 529 | $suwind->setheaderword( quotemeta('cdp') ); | ||
| 530 | $suwind->min( quotemeta( $suwind_min[1] ) ); | ||
| 531 | $suwind->max( quotemeta( $suwind_max[1] ) ); | ||
| 532 | $suwind[1] = $suwind->Step(); | ||
| 533 | |||
| 534 | =head2 WINDOW DATA | ||
| 535 | |||
| 536 | by time | ||
| 537 | |||
| 538 | =cut | ||
| 539 | |||
| 540 | $suwind->clear(); | ||
| 541 | $suwind->tmin( quotemeta(0) ); | ||
| 542 | $suwind->tmax( quotemeta( $iSuvelan->{_tmax_s} ) ); | ||
| 543 | $suwind[2] = $suwind->Step(); | ||
| 544 | |||
| 545 | # SORT data into CDP before calculating semblance | ||
| 546 | $susort->clear(); | ||
| 547 | $susort->headerword( quotemeta('cdp') ); | ||
| 548 | $susort->headerword( quotemeta('offset') ); | ||
| 549 | $susort[1] = $susort->Step(); | ||
| 550 | |||
| 551 | #=head2 GAIN DATA | ||
| 552 | # | ||
| 553 | # print("iSuvelan,calculated wagc = $width\n"); | ||
| 554 | # ROT 10% window length | ||
| 555 | # data in velan is not gained | ||
| 556 | # | ||
| 557 | #=cut | ||
| 558 | # | ||
| 559 | # $sugain->clear(); | ||
| 560 | # $sugain->pbal( quotemeta($on) ); | ||
| 561 | # $sugain[1] = $sugain->Step(); | ||
| 562 | # | ||
| 563 | # $sugain->clear(); | ||
| 564 | # $sugain->agc( quotemeta($on) ); | ||
| 565 | # my $width = 0.1 * $iSuvelan->{_tmax_s}; | ||
| 566 | # $sugain->width( quotemeta($width) ); | ||
| 567 | # | ||
| 568 | # $sugain[2] = $sugain->Step(); | ||
| 569 | |||
| 570 | =head2 | ||
| 571 | |||
| 572 | set filtering parameters | ||
| 573 | |||
| 574 | =cut | ||
| 575 | |||
| 576 | $sufilter->clear(); | ||
| 577 | $sufilter->freq( quotemeta( $iSuvelan->{_freq} ) ); | ||
| 578 | $sufilter[1] = $sufilter->Step(); | ||
| 579 | |||
| 580 | =head2 semblance analysis | ||
| 581 | |||
| 582 | a scaling factor is needed to match | ||
| 583 | scalel found in data headers | ||
| 584 | suvelan DOES not take scaleco or scalel into consdieration | ||
| 585 | automatically | ||
| 586 | |||
| 587 | =cut | ||
| 588 | |||
| 589 | $suvelan->clear(); | ||
| 590 | |||
| 591 | $suvelan->number_of_velocities( | ||
| 592 | quotemeta( $iSuvelan->{_number_of_velocities} ) ); | ||
| 593 | |||
| 594 | $suvelan->velocity_increment( | ||
| 595 | quotemeta( | ||
| 596 | ( $iSuvelan->{_velocity_increment} * $iSuvelan->{_data_scale} ) | ||
| 597 | ) | ||
| 598 | ); | ||
| 599 | $suvelan->first_velocity( | ||
| 600 | quotemeta( | ||
| 601 | ( $iSuvelan->{_first_velocity} * $iSuvelan->{_data_scale} ) | ||
| 602 | ) | ||
| 603 | ); | ||
| 604 | $suvelan->anis1( quotemeta( ( $iSuvelan->{_anis1} ) ) ); | ||
| 605 | $suvelan->anis2( quotemeta( ( $iSuvelan->{_anis2} ) ) ); | ||
| 606 | $suvelan->smute( quotemeta( ( $iSuvelan->{_smute} ) ) ); | ||
| 607 | $suvelan->dtratio( quotemeta( ( $iSuvelan->{_dtratio} ) ) ); | ||
| 608 | $suvelan->nsmooth( quotemeta( ( $iSuvelan->{_nsmooth} ) ) ); | ||
| 609 | |||
| 610 | # $suvelan->verbose( | ||
| 611 | # quotemeta( | ||
| 612 | # ( $iSuvelan->{_verbose} ) | ||
| 613 | # ) | ||
| 614 | # ); | ||
| 615 | $suvelan->pwr( quotemeta( ( $iSuvelan->{_pwr} ) ) ); | ||
| 616 | |||
| 617 | $suvelan[1] = suvelan->Step(); | ||
| 618 | |||
| 619 | =head2 DISPLAY DATA | ||
| 620 | |||
| 621 | new dx_major_divisions 1-14-20 | ||
| 622 | |||
| 623 | =cut | ||
| 624 | |||
| 625 | my $time_inc_major = $iSuvelan->{_tmax_s} / 10; | ||
| 626 | |||
| 627 | my $number_minor_time_divisions = 5; | ||
| 628 | |||
| 629 | # to make Jorge Reyes' data work | ||
| 630 | # my $new_dt_s = $iSuvelan->{_tmax_s} * $iSuvelan->{_dt_s}; | ||
| 631 | |||
| 632 | # to make Daniel Lopez's data work | ||
| 633 | # my $s2ms = 1000; | ||
| 634 | # my $new_dt_s = $s2ms * $iSuvelan->{_dt_s}; | ||
| 635 | |||
| 636 | my $dx_major_divisions = ( | ||
| 637 | $iSuvelan->{_first_velocity} + ( | ||
| 638 | $iSuvelan->{_number_of_velocities} * | ||
| 639 | $iSuvelan->{_velocity_increment} | ||
| 640 | ) | ||
| 641 | ) / 10; | ||
| 642 | |||
| 643 | # print("iSuvelan,dx_major_divisions:$dx_major_divisions\n"); | ||
| 644 | # print("iSuvelan,time_inc_major: $time_inc_major\n"); | ||
| 645 | # print("iSuvelan,number_minor_time_divisions:$number_minor_time_divisions \n"); | ||
| 646 | # print("iSuvelan,tmax_s $iSuvelan->{_tmax_s}\n"); | ||
| 647 | # print("iSuvelan,new_dt_s $new_dt_s (ms)\n"); | ||
| 648 | |||
| 649 | $N = 2; | ||
| 650 | $windowtitle[1] = '\(' | ||
| 651 | . $N . '\)\ ' | ||
| 652 | . $iSuvelan->{_sufile_in} | ||
| 653 | . '\ CDP=\ ' | ||
| 654 | . $iSuvelan->{_cdp_num}; | ||
| 655 | |||
| 656 | #units=Semblance \\ | ||
| 657 | $suximage->clear(); | ||
| 658 | $suximage->box_width( quotemeta(300) ); | ||
| 659 | $suximage->box_height( quotemeta(450) ); | ||
| 660 | $suximage->box_X0( quotemeta(600) ); | ||
| 661 | $suximage->box_Y0( quotemeta(0) ); | ||
| 662 | $suximage->title( quotemeta( $iSuvelan->{_cdp_num_suffix} ) ); | ||
| 663 | $suximage->windowtitle( quotemeta('Semblance') ); | ||
| 664 | $suximage->ylabel( quotemeta('TWTT (s)') ); | ||
| 665 | $suximage->xlabel( quotemeta('Velocity (m/s)') ); | ||
| 666 | $suximage->legend( quotemeta($on) ); | ||
| 667 | $suximage->cmap( quotemeta('hsv1') ); | ||
| 668 | $suximage->first_x( quotemeta( $iSuvelan->{_first_velocity} ) ); | ||
| 669 | $suximage->dx( quotemeta( $iSuvelan->{_velocity_increment} ) ); | ||
| 670 | $suximage->dt_s(quotemeta($new_dt_s)); | ||
| 671 | $suximage->loclip( quotemeta( $iSuvelan->{_min_semblance} ) ); | ||
| 672 | $suximage->hiclip( quotemeta( $iSuvelan->{_max_semblance} ) ); | ||
| 673 | $suximage->verbose( quotemeta($off) ); | ||
| 674 | |||
| 675 | #print ("d2num is ($iSuvelan->{_velocity_increment})\n\n"); | ||
| 676 | $suximage->dx_major_divisions( quotemeta($dx_major_divisions) ); | ||
| 677 | $suximage->dy_minor_divisions( | ||
| 678 | quotemeta($number_minor_time_divisions) ); | ||
| 679 | $suximage->dy_major_divisions( quotemeta($time_inc_major) ); | ||
| 680 | |||
| 681 | $suximage->tend_s( quotemeta( $iSuvelan->{_tmax_s} ) ); | ||
| 682 | |||
| 683 | #$suximage -> percent4clip(quotemeta(95.0); | ||
| 684 | $suximage->first_tick_number_x( | ||
| 685 | quotemeta( $iSuvelan->{_first_velocity} ) ); | ||
| 686 | $suximage->picks( $iSuvelan->{_Tvel_outbound} ); | ||
| 687 | |||
| 688 | print("iSuvelan, calcNdisplay: Writing picks to $iSuvelan->{_Tvel_outbound}\n\n"); | ||
| 689 | |||
| 690 | =head2 conditions | ||
| 691 | |||
| 692 | when number_of_tries is >=2 | ||
| 693 | there should be a pre-exisiting digitized | ||
| 694 | overlay curve to plot as well | ||
| 695 | |||
| 696 | =cut | ||
| 697 | |||
| 698 | if ( $iSuvelan->{_number_of_tries} >= 2 ) { | ||
| 699 | |||
| 700 | print("using a curve file:\n"); | ||
| 701 | print("\t$iSuvelan->{_Tvel_inbound}\n\n"); | ||
| 702 | $suximage->curvefile( quotemeta( $iSuvelan->{_Tvel_inbound} ) ) | ||
| 703 | ; | ||
| 704 | my ( $ref_T_nmo, $ref_Vnmo, $num_tvel_pairs ) = | ||
| 705 | $manage_files_by->read_2cols( \$iSuvelan->{_Tvel_inbound} ); | ||
| 706 | $suximage->npair( quotemeta($num_tvel_pairs) ); | ||
| 707 | $suximage->curvecolor( quotemeta(2) ); | ||
| 708 | } | ||
| 709 | |||
| 710 | $suximage[1] = $suximage->Step(); | ||
| 711 | |||
| 712 | # print("$suximage[1]\n\n"); | ||
| 713 | |||
| 714 | $N = 1; | ||
| 715 | |||
| 716 | =head2 set suxwigb parameters | ||
| 717 | |||
| 718 | In the perl module for suxwigb we should | ||
| 719 | have (but we do not yet) an explanation of each of | ||
| 720 | these parameters | ||
| 721 | |||
| 722 | =cut | ||
| 723 | |||
| 724 | $suxwigb->clear(); | ||
| 725 | $suxwigb->title( quotemeta( $iSuvelan->{_sufile_in} ) ); | ||
| 726 | $suxwigb->ylabel( quotemeta('Time s') ); | ||
| 727 | $suxwigb->xlabel( quotemeta('Offset m') ); | ||
| 728 | $suxwigb->box_width( quotemeta(300) ); | ||
| 729 | $suxwigb->box_height( quotemeta(450) ); | ||
| 730 | $suxwigb->box_X0( quotemeta(875) ); | ||
| 731 | $suxwigb->box_Y0( quotemeta(0) ); | ||
| 732 | $suxwigb->absclip( quotemeta(1) ); | ||
| 733 | $suxwigb->headerword( quotemeta('offset') ); | ||
| 734 | $suxwigb->xcur( quotemeta(2) ); | ||
| 735 | $suxwigb->windowtitle( quotemeta( $iSuvelan->{_cdp_num_suffix} ) ); | ||
| 736 | |||
| 737 | # $suxwigb->shading( quotemeta(1) ); | ||
| 738 | $suxwigb[1] = $suxwigb->Step(); | ||
| 739 | |||
| 740 | =head2 DEFINE FLOW(S) | ||
| 741 | |||
| 742 | in interactive mode: | ||
| 743 | First time you see the image number_of_tries =0 | ||
| 744 | the suximage is not interactive ( uses '&') | ||
| 745 | Second, third, etc. times (number_of_tries >= 1) | ||
| 746 | The image will halt the flow ('wait'), to allow user to | ||
| 747 | make new picks | ||
| 748 | |||
| 749 | On the other hand suxwigb does not change between the first | ||
| 750 | and last attempt | ||
| 751 | $sufilter[1], $to, $sugain[2], $to, | ||
| 752 | suwind has currently no gain | ||
| 753 | =cut | ||
| 754 | |||
| 755 | @items = ( | ||
| 756 | $susort[1], $in, $iSuvelan->{_inbound}, $to, | ||
| 757 | $suwind[1], $to, $suwind[2], $to, | ||
| 758 | $sufilter[1], $to, $suxwigb[1], $go | ||
| 759 | ); | ||
| 760 | $flow[1] = $run->modules( \@items ); | ||
| 761 | |||
| 762 | =head2 do not halt flow | ||
| 763 | |||
| 764 | print(" suximage NO HALT with num tries $iSuvelan->{_number_of_tries}\n\n"); | ||
| 765 | |||
| 766 | =cut | ||
| 767 | |||
| 768 | if ( $iSuvelan->{_number_of_tries} == 0 ) { | ||
| 769 | @items = ( | ||
| 770 | $susort[1], $in, $iSuvelan->{_inbound}, $to, | ||
| 771 | $suwind[1], $to, $suwind[2], $to, | ||
| 772 | $sufilter[1], $to, $suvelan[1], $to, | ||
| 773 | $suximage[1], $go | ||
| 774 | ); | ||
| 775 | $flow[2] = $run->modules( \@items ); | ||
| 776 | } | ||
| 777 | |||
| 778 | =head2 do not halt flow either | ||
| 779 | |||
| 780 | DB | ||
| 781 | |||
| 782 | print("2.suximage WITH HALT \n"); | ||
| 783 | print("2. number of tries is $iSuvelan->{_number_of_tries}\n\n"); | ||
| 784 | |||
| 785 | #,';',' wait'); | ||
| 786 | #$to,$sufilter[1],$to,$suvelan[1],$to,$suximage[1],$go); | ||
| 787 | =cut | ||
| 788 | |||
| 789 | if ( $iSuvelan->{_number_of_tries} >= 1 ) { | ||
| 790 | @items = ( | ||
| 791 | $susort[1], $in, $iSuvelan->{_inbound}, $to, | ||
| 792 | $suwind[1], $to, $suwind[2], $to, | ||
| 793 | $sufilter[1], $to, $suvelan[1], $to, | ||
| 794 | $suximage[1], $go | ||
| 795 | ); | ||
| 796 | $flow[2] = $run->modules( \@items ); | ||
| 797 | } | ||
| 798 | |||
| 799 | =head2 | ||
| 800 | RUN FLOW(S) | ||
| 801 | output copy of picked data points | ||
| 802 | only occurs after the number of tries | ||
| 803 | is updated | ||
| 804 | |||
| 805 | =cut | ||
| 806 | |||
| 807 | $run->flow( \$flow[1] ); | ||
| 808 | $run->flow( \$flow[2] ); | ||
| 809 | |||
| 810 | =head2 LOG FLOW(S) | ||
| 811 | |||
| 812 | TO SCREEN AND FILE | ||
| 813 | |||
| 814 | =cut | ||
| 815 | |||
| 816 | # print "iSuvelan, $flow[1]\n"; | ||
| 817 | # print "iSuvelan, $flow[2]\n"; | ||
| 818 | # $log->file($flow[1]); | ||
| 819 | # $log->file($flow[2]); | ||
| 820 | # | ||
| 821 | |||
| 822 | } | ||
| 823 | else { | ||
| 824 | print("iSuvelan, calcNdisplay, missing variables\n"); | ||
| 825 | } | ||
| 826 | |||
| 827 | } | ||
| 828 | |||
| 829 | # end of calc_display subroutine | ||
| 830 | |||
| 831 | =head2 subroutine maximum semblance to plot | ||
| 832 | |||
| 833 | |||
| 834 | =cut | ||
| 835 | |||
| 836 | sub max_semblance { | ||
| 837 | my ( $variable, $max_semblance ) = @_; | ||
| 838 | $iSuvelan->{_max_semblance} = $max_semblance if defined $max_semblance; | ||
| 839 | } | ||
| 840 | |||
| 841 | =head2 subroutine minimum semblance to plot | ||
| 842 | |||
| 843 | |||
| 844 | =cut | ||
| 845 | |||
| 846 | sub min_semblance { | ||
| 847 | my ( $variable, $min_semblance ) = @_; | ||
| 848 | $iSuvelan->{_min_semblance} = $min_semblance if defined $min_semblance; | ||
| 849 | } | ||
| 850 | |||
| 851 | =head2 subroutine TV pick file in | ||
| 852 | |||
| 853 | |||
| 854 | =cut | ||
| 855 | |||
| 856 | sub Tvel_inbound { | ||
| 857 | my ( $variable, $Tvel_inbound ) = @_; | ||
| 858 | $iSuvelan->{_Tvel_inbound} = $Tvel_inbound if defined $Tvel_inbound; | ||
| 859 | } | ||
| 860 | |||
| 861 | =head2 | ||
| 862 | |||
| 863 | subroutine TV pick file out | ||
| 864 | |||
| 865 | =cut | ||
| 866 | |||
| 867 | sub Tvel_outbound { | ||
| 868 | my ( $variable, $Tvel_outbound ) = @_; | ||
| 869 | $iSuvelan->{_Tvel_outbound} = $Tvel_outbound if defined $Tvel_outbound; | ||
| 870 | } | ||
| 871 | |||
| 872 | #end of iSuvelan | ||
| 873 |