« lib/App/SeismicUnixGui/sunix/model/gbbeam.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/statsMath/suxmax.pm »
| 1 | package App::SeismicUnixGui::sunix::par::unisam2; | ||
| 2 | |||
| 3 | =head2 SYNOPSIS | ||
| 4 | |||
| 5 | PERL PROGRAM NAME: | ||
| 6 | |||
| 7 | AUTHOR: | ||
| 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 | UNISAM2 - UNIformly SAMple a 2-D function f(x1,x2) | ||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | unisam2 [optional parameters] <inputfile >outputfile | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | Required Parameters: | ||
| 33 | |||
| 34 | none | ||
| 35 | |||
| 36 | Optional Parameters: | ||
| 37 | |||
| 38 | x1= array of x1 values at which input f(x1,x2) is sampled | ||
| 39 | |||
| 40 | ... Or specify a unform linear set of values for x1 via: | ||
| 41 | |||
| 42 | nx1=1 number of input samples in 1st dimension | ||
| 43 | |||
| 44 | dx1=1 input sampling interval in 1st dimension | ||
| 45 | |||
| 46 | fx1=0 first input sample in 1st dimension | ||
| 47 | |||
| 48 | ... | ||
| 49 | |||
| 50 | n1=1 number of output samples in 1st dimension | ||
| 51 | |||
| 52 | d1= output sampling interval in 1st dimension | ||
| 53 | |||
| 54 | f1= first output sample in 1st dimension | ||
| 55 | |||
| 56 | x2= array of x2 values at which input f(x1,x2) is sampled | ||
| 57 | |||
| 58 | ... Or specify a unform linear set of values for x2 via: | ||
| 59 | |||
| 60 | nx2=1 number of input samples in 2nd dimension | ||
| 61 | |||
| 62 | dx2=1 input sampling interval in 2nd dimension | ||
| 63 | |||
| 64 | fx2=0 first input sample in 2nd dimension | ||
| 65 | |||
| 66 | ... | ||
| 67 | |||
| 68 | n2=1 number of output samples in 2nd dimension | ||
| 69 | |||
| 70 | d2= output sampling interval in 2nd dimension | ||
| 71 | |||
| 72 | f2= first output sample in 2nd dimension | ||
| 73 | |||
| 74 | ... | ||
| 75 | |||
| 76 | method1=linear =linear for linear interpolation | ||
| 77 | |||
| 78 | =mono for monotonic bicubic interpolation | ||
| 79 | |||
| 80 | =akima for Akima bicubic interpolation | ||
| 81 | |||
| 82 | =spline for bicubic spline interpolation | ||
| 83 | |||
| 84 | method2=linear =linear for linear interpolation | ||
| 85 | |||
| 86 | =mono for monotonic bicubic interpolation | ||
| 87 | |||
| 88 | =akima for Akima bicubic interpolation | ||
| 89 | |||
| 90 | =spline for bicubic spline interpolation | ||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | NOTES: | ||
| 95 | |||
| 96 | The number of input samples is the number of x1 values times the | ||
| 97 | |||
| 98 | number of x2 values. The number of output samples is n1 times n2. | ||
| 99 | |||
| 100 | The output sampling intervals (d1 and d2) and first samples (f1 and f2) | ||
| 101 | |||
| 102 | default to span the range of input x1 and x2 values. In other words, | ||
| 103 | |||
| 104 | d1=(x1max-x1min)/(n1-1) and f1=x1min; likewise for d2 and f2. | ||
| 105 | |||
| 106 | |||
| 107 | |||
| 108 | Interpolation is first performed along the 2nd dimension for each | ||
| 109 | |||
| 110 | value of x1 specified. Interpolation is then performed along the | ||
| 111 | |||
| 112 | 1st dimension. | ||
| 113 | |||
| 114 | |||
| 115 | |||
| 116 | |||
| 117 | |||
| 118 | |||
| 119 | |||
| 120 | Author: Dave Hale, Colorado School of Mines, 01/12/91\n" | ||
| 121 | |||
| 122 | |||
| 123 | |||
| 124 | =head2 User's notes (Juan Lorenzo) | ||
| 125 | untested | ||
| 126 | |||
| 127 | =cut | ||
| 128 | |||
| 129 | |||
| 130 | =head2 CHANGES and their DATES | ||
| 131 | |||
| 132 | =cut | ||
| 133 | |||
| 134 | use Moose; | ||
| 135 | our $VERSION = '0.0.1'; | ||
| 136 | |||
| 137 | |||
| 138 | =head2 Import packages | ||
| 139 | |||
| 140 | =cut | ||
| 141 | |||
| 142 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 143 | |||
| 144 | use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su); | ||
| 145 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 146 | |||
| 147 | |||
| 148 | =head2 instantiation of packages | ||
| 149 | |||
| 150 | =cut | ||
| 151 | |||
| 152 | my $get = L_SU_global_constants->new(); | ||
| 153 | my $Project = Project_config->new(); | ||
| 154 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 155 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 156 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 157 | |||
| 158 | my $PS_SEISMIC = $Project->PS_SEISMIC(); | ||
| 159 | |||
| 160 | my $var = $get->var(); | ||
| 161 | my $on = $var->{_on}; | ||
| 162 | my $off = $var->{_off}; | ||
| 163 | my $true = $var->{_true}; | ||
| 164 | my $false = $var->{_false}; | ||
| 165 | my $empty_string = $var->{_empty_string}; | ||
| 166 | |||
| 167 | =head2 Encapsulated | ||
| 168 | hash of private variables | ||
| 169 | |||
| 170 | =cut | ||
| 171 | |||
| 172 | my $unisam2 = { | ||
| 173 | _d1 => '', | ||
| 174 | _d2 => '', | ||
| 175 | _dx1 => '', | ||
| 176 | _dx2 => '', | ||
| 177 | _f1 => '', | ||
| 178 | _f2 => '', | ||
| 179 | _fx1 => '', | ||
| 180 | _fx2 => '', | ||
| 181 | _method1 => '', | ||
| 182 | _method2 => '', | ||
| 183 | _n1 => '', | ||
| 184 | _n2 => '', | ||
| 185 | _nx1 => '', | ||
| 186 | _nx2 => '', | ||
| 187 | _x1 => '', | ||
| 188 | _x2 => '', | ||
| 189 | _Step => '', | ||
| 190 | _note => '', | ||
| 191 | |||
| 192 | }; | ||
| 193 | |||
| 194 | =head2 sub Step | ||
| 195 | |||
| 196 | collects switches and assembles bash instructions | ||
| 197 | by adding the program name | ||
| 198 | |||
| 199 | =cut | ||
| 200 | |||
| 201 | sub Step { | ||
| 202 | |||
| 203 | $unisam2->{_Step} = 'unisam2'.$unisam2->{_Step}; | ||
| 204 | return ( $unisam2->{_Step} ); | ||
| 205 | |||
| 206 | } | ||
| 207 | |||
| 208 | |||
| 209 | =head2 sub note | ||
| 210 | |||
| 211 | collects switches and assembles bash instructions | ||
| 212 | by adding the program name | ||
| 213 | |||
| 214 | =cut | ||
| 215 | |||
| 216 | sub note { | ||
| 217 | |||
| 218 | $unisam2->{_note} = 'unisam2'.$unisam2->{_note}; | ||
| 219 | return ( $unisam2->{_note} ); | ||
| 220 | |||
| 221 | } | ||
| 222 | |||
| 223 | |||
| 224 | |||
| 225 | =head2 sub clear | ||
| 226 | |||
| 227 | =cut | ||
| 228 | |||
| 229 | sub clear { | ||
| 230 | |||
| 231 | $unisam2->{_d1} = ''; | ||
| 232 | $unisam2->{_d2} = ''; | ||
| 233 | $unisam2->{_dx1} = ''; | ||
| 234 | $unisam2->{_dx2} = ''; | ||
| 235 | $unisam2->{_f1} = ''; | ||
| 236 | $unisam2->{_f2} = ''; | ||
| 237 | $unisam2->{_fx1} = ''; | ||
| 238 | $unisam2->{_fx2} = ''; | ||
| 239 | $unisam2->{_method1} = ''; | ||
| 240 | $unisam2->{_method2} = ''; | ||
| 241 | $unisam2->{_n1} = ''; | ||
| 242 | $unisam2->{_n2} = ''; | ||
| 243 | $unisam2->{_nx1} = ''; | ||
| 244 | $unisam2->{_nx2} = ''; | ||
| 245 | $unisam2->{_x1} = ''; | ||
| 246 | $unisam2->{_x2} = ''; | ||
| 247 | $unisam2->{_Step} = ''; | ||
| 248 | $unisam2->{_note} = ''; | ||
| 249 | } | ||
| 250 | |||
| 251 | |||
| 252 | =head2 sub d1 | ||
| 253 | |||
| 254 | |||
| 255 | =cut | ||
| 256 | |||
| 257 | sub d1 { | ||
| 258 | |||
| 259 | my ( $self,$d1 ) = @_; | ||
| 260 | if ( $d1 ne $empty_string ) { | ||
| 261 | |||
| 262 | $unisam2->{_d1} = $d1; | ||
| 263 | $unisam2->{_note} = $unisam2->{_note}.' d1='.$unisam2->{_d1}; | ||
| 264 | $unisam2->{_Step} = $unisam2->{_Step}.' d1='.$unisam2->{_d1}; | ||
| 265 | |||
| 266 | } else { | ||
| 267 | print("unisam2, d1, missing d1,\n"); | ||
| 268 | } | ||
| 269 | } | ||
| 270 | |||
| 271 | |||
| 272 | =head2 sub d2 | ||
| 273 | |||
| 274 | |||
| 275 | =cut | ||
| 276 | |||
| 277 | sub d2 { | ||
| 278 | |||
| 279 | my ( $self,$d2 ) = @_; | ||
| 280 | if ( $d2 ne $empty_string ) { | ||
| 281 | |||
| 282 | $unisam2->{_d2} = $d2; | ||
| 283 | $unisam2->{_note} = $unisam2->{_note}.' d2='.$unisam2->{_d2}; | ||
| 284 | $unisam2->{_Step} = $unisam2->{_Step}.' d2='.$unisam2->{_d2}; | ||
| 285 | |||
| 286 | } else { | ||
| 287 | print("unisam2, d2, missing d2,\n"); | ||
| 288 | } | ||
| 289 | } | ||
| 290 | |||
| 291 | |||
| 292 | =head2 sub dx1 | ||
| 293 | |||
| 294 | |||
| 295 | =cut | ||
| 296 | |||
| 297 | sub dx1 { | ||
| 298 | |||
| 299 | my ( $self,$dx1 ) = @_; | ||
| 300 | if ( $dx1 ne $empty_string ) { | ||
| 301 | |||
| 302 | $unisam2->{_dx1} = $dx1; | ||
| 303 | $unisam2->{_note} = $unisam2->{_note}.' dx1='.$unisam2->{_dx1}; | ||
| 304 | $unisam2->{_Step} = $unisam2->{_Step}.' dx1='.$unisam2->{_dx1}; | ||
| 305 | |||
| 306 | } else { | ||
| 307 | print("unisam2, dx1, missing dx1,\n"); | ||
| 308 | } | ||
| 309 | } | ||
| 310 | |||
| 311 | |||
| 312 | =head2 sub dx2 | ||
| 313 | |||
| 314 | |||
| 315 | =cut | ||
| 316 | |||
| 317 | sub dx2 { | ||
| 318 | |||
| 319 | my ( $self,$dx2 ) = @_; | ||
| 320 | if ( $dx2 ne $empty_string ) { | ||
| 321 | |||
| 322 | $unisam2->{_dx2} = $dx2; | ||
| 323 | $unisam2->{_note} = $unisam2->{_note}.' dx2='.$unisam2->{_dx2}; | ||
| 324 | $unisam2->{_Step} = $unisam2->{_Step}.' dx2='.$unisam2->{_dx2}; | ||
| 325 | |||
| 326 | } else { | ||
| 327 | print("unisam2, dx2, missing dx2,\n"); | ||
| 328 | } | ||
| 329 | } | ||
| 330 | |||
| 331 | |||
| 332 | =head2 sub f1 | ||
| 333 | |||
| 334 | |||
| 335 | =cut | ||
| 336 | |||
| 337 | sub f1 { | ||
| 338 | |||
| 339 | my ( $self,$f1 ) = @_; | ||
| 340 | if ( $f1 ne $empty_string ) { | ||
| 341 | |||
| 342 | $unisam2->{_f1} = $f1; | ||
| 343 | $unisam2->{_note} = $unisam2->{_note}.' f1='.$unisam2->{_f1}; | ||
| 344 | $unisam2->{_Step} = $unisam2->{_Step}.' f1='.$unisam2->{_f1}; | ||
| 345 | |||
| 346 | } else { | ||
| 347 | print("unisam2, f1, missing f1,\n"); | ||
| 348 | } | ||
| 349 | } | ||
| 350 | |||
| 351 | |||
| 352 | =head2 sub f2 | ||
| 353 | |||
| 354 | |||
| 355 | =cut | ||
| 356 | |||
| 357 | sub f2 { | ||
| 358 | |||
| 359 | my ( $self,$f2 ) = @_; | ||
| 360 | if ( $f2 ne $empty_string ) { | ||
| 361 | |||
| 362 | $unisam2->{_f2} = $f2; | ||
| 363 | $unisam2->{_note} = $unisam2->{_note}.' f2='.$unisam2->{_f2}; | ||
| 364 | $unisam2->{_Step} = $unisam2->{_Step}.' f2='.$unisam2->{_f2}; | ||
| 365 | |||
| 366 | } else { | ||
| 367 | print("unisam2, f2, missing f2,\n"); | ||
| 368 | } | ||
| 369 | } | ||
| 370 | |||
| 371 | |||
| 372 | =head2 sub fx1 | ||
| 373 | |||
| 374 | |||
| 375 | =cut | ||
| 376 | |||
| 377 | sub fx1 { | ||
| 378 | |||
| 379 | my ( $self,$fx1 ) = @_; | ||
| 380 | if ( $fx1 ne $empty_string ) { | ||
| 381 | |||
| 382 | $unisam2->{_fx1} = $fx1; | ||
| 383 | $unisam2->{_note} = $unisam2->{_note}.' fx1='.$unisam2->{_fx1}; | ||
| 384 | $unisam2->{_Step} = $unisam2->{_Step}.' fx1='.$unisam2->{_fx1}; | ||
| 385 | |||
| 386 | } else { | ||
| 387 | print("unisam2, fx1, missing fx1,\n"); | ||
| 388 | } | ||
| 389 | } | ||
| 390 | |||
| 391 | |||
| 392 | =head2 sub fx2 | ||
| 393 | |||
| 394 | |||
| 395 | =cut | ||
| 396 | |||
| 397 | sub fx2 { | ||
| 398 | |||
| 399 | my ( $self,$fx2 ) = @_; | ||
| 400 | if ( $fx2 ne $empty_string ) { | ||
| 401 | |||
| 402 | $unisam2->{_fx2} = $fx2; | ||
| 403 | $unisam2->{_note} = $unisam2->{_note}.' fx2='.$unisam2->{_fx2}; | ||
| 404 | $unisam2->{_Step} = $unisam2->{_Step}.' fx2='.$unisam2->{_fx2}; | ||
| 405 | |||
| 406 | } else { | ||
| 407 | print("unisam2, fx2, missing fx2,\n"); | ||
| 408 | } | ||
| 409 | } | ||
| 410 | |||
| 411 | |||
| 412 | =head2 sub method1 | ||
| 413 | |||
| 414 | |||
| 415 | =cut | ||
| 416 | |||
| 417 | sub method1 { | ||
| 418 | |||
| 419 | my ( $self,$method1 ) = @_; | ||
| 420 | if ( $method1 ne $empty_string ) { | ||
| 421 | |||
| 422 | $unisam2->{_method1} = $method1; | ||
| 423 | $unisam2->{_note} = $unisam2->{_note}.' method1='.$unisam2->{_method1}; | ||
| 424 | $unisam2->{_Step} = $unisam2->{_Step}.' method1='.$unisam2->{_method1}; | ||
| 425 | |||
| 426 | } else { | ||
| 427 | print("unisam2, method1, missing method1,\n"); | ||
| 428 | } | ||
| 429 | } | ||
| 430 | |||
| 431 | |||
| 432 | =head2 sub method2 | ||
| 433 | |||
| 434 | |||
| 435 | =cut | ||
| 436 | |||
| 437 | sub method2 { | ||
| 438 | |||
| 439 | my ( $self,$method2 ) = @_; | ||
| 440 | if ( $method2 ne $empty_string ) { | ||
| 441 | |||
| 442 | $unisam2->{_method2} = $method2; | ||
| 443 | $unisam2->{_note} = $unisam2->{_note}.' method2='.$unisam2->{_method2}; | ||
| 444 | $unisam2->{_Step} = $unisam2->{_Step}.' method2='.$unisam2->{_method2}; | ||
| 445 | |||
| 446 | } else { | ||
| 447 | print("unisam2, method2, missing method2,\n"); | ||
| 448 | } | ||
| 449 | } | ||
| 450 | |||
| 451 | |||
| 452 | =head2 sub n1 | ||
| 453 | |||
| 454 | |||
| 455 | =cut | ||
| 456 | |||
| 457 | sub n1 { | ||
| 458 | |||
| 459 | my ( $self,$n1 ) = @_; | ||
| 460 | if ( $n1 ne $empty_string ) { | ||
| 461 | |||
| 462 | $unisam2->{_n1} = $n1; | ||
| 463 | $unisam2->{_note} = $unisam2->{_note}.' n1='.$unisam2->{_n1}; | ||
| 464 | $unisam2->{_Step} = $unisam2->{_Step}.' n1='.$unisam2->{_n1}; | ||
| 465 | |||
| 466 | } else { | ||
| 467 | print("unisam2, n1, missing n1,\n"); | ||
| 468 | } | ||
| 469 | } | ||
| 470 | |||
| 471 | |||
| 472 | =head2 sub n2 | ||
| 473 | |||
| 474 | |||
| 475 | =cut | ||
| 476 | |||
| 477 | sub n2 { | ||
| 478 | |||
| 479 | my ( $self,$n2 ) = @_; | ||
| 480 | if ( $n2 ne $empty_string ) { | ||
| 481 | |||
| 482 | $unisam2->{_n2} = $n2; | ||
| 483 | $unisam2->{_note} = $unisam2->{_note}.' n2='.$unisam2->{_n2}; | ||
| 484 | $unisam2->{_Step} = $unisam2->{_Step}.' n2='.$unisam2->{_n2}; | ||
| 485 | |||
| 486 | } else { | ||
| 487 | print("unisam2, n2, missing n2,\n"); | ||
| 488 | } | ||
| 489 | } | ||
| 490 | |||
| 491 | |||
| 492 | =head2 sub nx1 | ||
| 493 | |||
| 494 | |||
| 495 | =cut | ||
| 496 | |||
| 497 | sub nx1 { | ||
| 498 | |||
| 499 | my ( $self,$nx1 ) = @_; | ||
| 500 | if ( $nx1 ne $empty_string ) { | ||
| 501 | |||
| 502 | $unisam2->{_nx1} = $nx1; | ||
| 503 | $unisam2->{_note} = $unisam2->{_note}.' nx1='.$unisam2->{_nx1}; | ||
| 504 | $unisam2->{_Step} = $unisam2->{_Step}.' nx1='.$unisam2->{_nx1}; | ||
| 505 | |||
| 506 | } else { | ||
| 507 | print("unisam2, nx1, missing nx1,\n"); | ||
| 508 | } | ||
| 509 | } | ||
| 510 | |||
| 511 | |||
| 512 | =head2 sub nx2 | ||
| 513 | |||
| 514 | |||
| 515 | =cut | ||
| 516 | |||
| 517 | sub nx2 { | ||
| 518 | |||
| 519 | my ( $self,$nx2 ) = @_; | ||
| 520 | if ( $nx2 ne $empty_string ) { | ||
| 521 | |||
| 522 | $unisam2->{_nx2} = $nx2; | ||
| 523 | $unisam2->{_note} = $unisam2->{_note}.' nx2='.$unisam2->{_nx2}; | ||
| 524 | $unisam2->{_Step} = $unisam2->{_Step}.' nx2='.$unisam2->{_nx2}; | ||
| 525 | |||
| 526 | } else { | ||
| 527 | print("unisam2, nx2, missing nx2,\n"); | ||
| 528 | } | ||
| 529 | } | ||
| 530 | |||
| 531 | |||
| 532 | =head2 sub x1 | ||
| 533 | |||
| 534 | |||
| 535 | =cut | ||
| 536 | |||
| 537 | sub x1 { | ||
| 538 | |||
| 539 | my ( $self,$x1 ) = @_; | ||
| 540 | if ( $x1 ne $empty_string ) { | ||
| 541 | |||
| 542 | $unisam2->{_x1} = $x1; | ||
| 543 | $unisam2->{_note} = $unisam2->{_note}.' x1='.$unisam2->{_x1}; | ||
| 544 | $unisam2->{_Step} = $unisam2->{_Step}.' x1='.$unisam2->{_x1}; | ||
| 545 | |||
| 546 | } else { | ||
| 547 | print("unisam2, x1, missing x1,\n"); | ||
| 548 | } | ||
| 549 | } | ||
| 550 | |||
| 551 | |||
| 552 | =head2 sub x2 | ||
| 553 | |||
| 554 | |||
| 555 | =cut | ||
| 556 | |||
| 557 | sub x2 { | ||
| 558 | |||
| 559 | my ( $self,$x2 ) = @_; | ||
| 560 | if ( $x2 ne $empty_string ) { | ||
| 561 | |||
| 562 | $unisam2->{_x2} = $x2; | ||
| 563 | $unisam2->{_note} = $unisam2->{_note}.' x2='.$unisam2->{_x2}; | ||
| 564 | $unisam2->{_Step} = $unisam2->{_Step}.' x2='.$unisam2->{_x2}; | ||
| 565 | |||
| 566 | } else { | ||
| 567 | print("unisam2, x2, missing x2,\n"); | ||
| 568 | } | ||
| 569 | } | ||
| 570 | |||
| 571 | |||
| 572 | =head2 sub get_max_index | ||
| 573 | |||
| 574 | max index = number of input variables -1 | ||
| 575 | |||
| 576 | =cut | ||
| 577 | |||
| 578 | sub get_max_index { | ||
| 579 | my ($self) = @_; | ||
| 580 | my $max_index = 15; | ||
| 581 | |||
| 582 | return($max_index); | ||
| 583 | } | ||
| 584 | |||
| 585 | |||
| 586 | 1; |