« lib/App/SeismicUnixGui/sunix/statsMath/sualford.pm
↑ Summary
lib/App/SeismicUnixGui/misc/pm_io.pm »
| 1 | package App::SeismicUnixGui::big_streams::iSunmo; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PROGRAM NAME: iSunmo | ||
| 8 | |||
| 9 | Purpose: interactive sunmo | ||
| 10 | AUTHOR: Juan M. Lorenzo | ||
| 11 | DEPENDS: Seismic Unix modules from CSM | ||
| 12 | DATE: April 2 2009 | ||
| 13 | DESCRIPTION: Moveout data | ||
| 14 | MODIFIED | ||
| 15 | July 24 2015 now uses oop | ||
| 16 | |||
| 17 | |||
| 18 | =head2 NOTES | ||
| 19 | |||
| 20 | =head2 INSTANTIATE PACKAGES | ||
| 21 | |||
| 22 | |||
| 23 | =cut | ||
| 24 | |||
| 25 | use Moose; | ||
| 26 | our $VERSION = '0.0.1'; | ||
| 27 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 28 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 29 | use App::SeismicUnixGui::misc::SeismicUnix qw($on $off $in $to $go); | ||
| 30 | use aliased 'App::SeismicUnixGui::misc::flow'; | ||
| 31 | use aliased 'App::SeismicUnixGui::sunix::filter::sufilter'; | ||
| 32 | use aliased 'App::SeismicUnixGui::sunix::shapeNcut::sugain'; | ||
| 33 | use aliased 'App::SeismicUnixGui::sunix::shapeNcut::susort'; | ||
| 34 | use aliased 'App::SeismicUnixGui::sunix::NMO_Vel_Stk::sunmo'; | ||
| 35 | use aliased 'App::SeismicUnixGui::sunix::shapeNcut::suwind'; | ||
| 36 | use aliased 'App::SeismicUnixGui::sunix::plot::suxwigb'; | ||
| 37 | use aliased 'App::SeismicUnixGui::sunix::plot::suximage'; | ||
| 38 | |||
| 39 | =head2 | ||
| 40 | |||
| 41 | inherit other packages | ||
| 42 | 1. Instantiate classes | ||
| 43 | Create a new version of the package | ||
| 44 | Personalize to give it a new name if you wish | ||
| 45 | Use the following classes: | ||
| 46 | |||
| 47 | =cut | ||
| 48 | |||
| 49 | my $run = flow->new(); | ||
| 50 | my $sufilter = sufilter->new(); | ||
| 51 | my $sugain = sugain->new(); | ||
| 52 | my $susort = susort->new(); | ||
| 53 | my $sunmo = sunmo->new(); | ||
| 54 | my $suwind = suwind->new(); | ||
| 55 | my $suxwigb = suxwigb->new(); | ||
| 56 | my $suximage = suximage->new(); | ||
| 57 | my $Project = Project_config->new(); | ||
| 58 | my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU(); | ||
| 59 | my ($PL_SEISMIC) = $Project->PL_SEISMIC(); | ||
| 60 | |||
| 61 | |||
| 62 | my $get = L_SU_global_constants->new(); | ||
| 63 | my $var = $get->var(); | ||
| 64 | my $empty_string = $var->{_empty_string}; | ||
| 65 | |||
| 66 | =head2 | ||
| 67 | |||
| 68 | establish just the localally scoped variables | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | my ( @parfile_in, @sufile_in, @suffix, @inbound, @cdp_num ); | ||
| 73 | my ( @suwind_min, @suwind_max, @vel_in ); | ||
| 74 | my ( @items, @flow, @sugain, @sufilter, @suwind, @susort ); | ||
| 75 | my ( @sunmo, @suximage ); | ||
| 76 | my ( @windowtitle, @mute_picks_file, @base_caption ); | ||
| 77 | my $time_inc_minor; | ||
| 78 | my $time_inc_major; | ||
| 79 | my $number_minor_time_divisions; | ||
| 80 | my @suximage_col_bar_max; | ||
| 81 | my @suximage_col_bar_min; | ||
| 82 | my $N; | ||
| 83 | |||
| 84 | =head2 | ||
| 85 | |||
| 86 | |||
| 87 | hash array of important variables used within | ||
| 88 | this package | ||
| 89 | |||
| 90 | =cut | ||
| 91 | |||
| 92 | my $iSunmo = { | ||
| 93 | _base_file_name => '', | ||
| 94 | _cdp_num => '', | ||
| 95 | _file_in => '', | ||
| 96 | _freq => '', | ||
| 97 | _inbound => '', | ||
| 98 | _sufile_in => '', | ||
| 99 | _textfile_in => '', | ||
| 100 | _textfile_out => '', | ||
| 101 | _tmax_s => '', | ||
| 102 | }; | ||
| 103 | |||
| 104 | =head2 | ||
| 105 | |||
| 106 | subroutine clear | ||
| 107 | to blank out hash array values | ||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | sub clear | ||
| 112 | { | ||
| 113 | $iSunmo->{_base_file_name} = ''; | ||
| 114 | $iSunmo->{_cdp_num} = ''; | ||
| 115 | $iSunmo->{_file_in} = ''; | ||
| 116 | $iSunmo->{_freq} = ''; | ||
| 117 | $iSunmo->{_inbound} = ''; | ||
| 118 | $iSunmo->{_sufile_in} = ''; | ||
| 119 | $iSunmo->{_textfile_in} = ''; | ||
| 120 | $iSunmo->{_tmax_s} = ''; | ||
| 121 | } | ||
| 122 | |||
| 123 | |||
| 124 | |||
| 125 | |||
| 126 | =head2 | ||
| 127 | |||
| 128 | subroutine cdp_num | ||
| 129 | establishes the CDP number being worked | ||
| 130 | Also establishes'cdp'# as a recognizable suffix | ||
| 131 | for file names | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | sub cdp_num { | ||
| 136 | my ( $variable, $cdp_num ) = @_; | ||
| 137 | $iSunmo->{_cdp_num_suffix} = '_cdp' . $cdp_num if defined($cdp_num); | ||
| 138 | $iSunmo->{_cdp_num} = $cdp_num if defined($cdp_num); | ||
| 139 | } | ||
| 140 | |||
| 141 | =head2 | ||
| 142 | |||
| 143 | subroutine file_in | ||
| 144 | gets the file name | ||
| 145 | creates the sufile name to read | ||
| 146 | creates the full path for reading the sufile | ||
| 147 | |||
| 148 | =cut | ||
| 149 | |||
| 150 | sub file_in { | ||
| 151 | my ( $variable, $file_in ) = @_; | ||
| 152 | $iSunmo->{_file_in} = $file_in if defined($file_in); | ||
| 153 | $iSunmo->{_sufile_in} = $file_in . '.su' if defined($file_in); | ||
| 154 | $iSunmo->{_inbound} = $DATA_SEISMIC_SU . '/' . $iSunmo->{_sufile_in}; | ||
| 155 | |||
| 156 | #print("iSunmo_inbound is $iSunmo->{_inbound}\n\n"); | ||
| 157 | } | ||
| 158 | |||
| 159 | =head2 | ||
| 160 | |||
| 161 | subroutine freq | ||
| 162 | creates the bandpass frequencies to filter data before | ||
| 163 | conducting semblance analysis | ||
| 164 | e.g., "3,6,40,50" | ||
| 165 | |||
| 166 | =cut | ||
| 167 | |||
| 168 | sub freq { | ||
| 169 | my ( $variable, $freq ) = @_; | ||
| 170 | $iSunmo->{_freq} = $freq if defined($freq); | ||
| 171 | } | ||
| 172 | |||
| 173 | =head2 subroutine calcNdisplay | ||
| 174 | |||
| 175 | calculate semblance and display results | ||
| 176 | |||
| 177 | =cut | ||
| 178 | |||
| 179 | sub calcNdisplay { | ||
| 180 | |||
| 181 | print(" calc and display\n\n"); | ||
| 182 | # suffixes | ||
| 183 | $suffix[1] = '_cdp' . $iSunmo->{_cdp_num}; | ||
| 184 | |||
| 185 | # su file names | ||
| 186 | $sufile_in[1] = $iSunmo->{_file_in}; | ||
| 187 | $parfile_in[1] = 'ivpicks_sorted_par_' . $sufile_in[1] . $suffix[1]; | ||
| 188 | $inbound[1] = $DATA_SEISMIC_SU . '/' . $sufile_in[1] . '.su'; | ||
| 189 | |||
| 190 | # SUWIND data cdp | ||
| 191 | $suwind_min[1] = $iSunmo->{_cdp_num}; | ||
| 192 | $suwind_max[1] = $iSunmo->{_cdp_num}; | ||
| 193 | |||
| 194 | # par file names | ||
| 195 | $vel_in[1] = $parfile_in[1]; | ||
| 196 | |||
| 197 | # print("iSunmo, calcNDisplay, par file names= $vel_in[1]\n"); | ||
| 198 | |||
| 199 | =head2 | ||
| 200 | |||
| 201 | WINDOW DATA by shot point | ||
| 202 | |||
| 203 | =cut | ||
| 204 | |||
| 205 | $suwind_min[1] = $iSunmo->{_cdp_num}; | ||
| 206 | $suwind_max[1] = $iSunmo->{_cdp_num}; | ||
| 207 | |||
| 208 | $suwind->clear(); | ||
| 209 | $suwind->setheaderword( quotemeta('cdp') ); | ||
| 210 | $suwind->min( quotemeta( $suwind_min[1] ) ); | ||
| 211 | $suwind->max( quotemeta( $suwind_max[1] ) ); | ||
| 212 | $suwind[1] = $suwind->Step(); | ||
| 213 | |||
| 214 | =head2 | ||
| 215 | |||
| 216 | WINDOW DATA by time | ||
| 217 | |||
| 218 | =cut | ||
| 219 | |||
| 220 | $suwind->clear(); | ||
| 221 | $suwind->tmin( quotemeta(0) ); | ||
| 222 | $suwind->tmax( quotemeta( $iSunmo->{_tmax_s} ) ); | ||
| 223 | $suwind[2] = $suwind->Step(); | ||
| 224 | |||
| 225 | # SORT data into CDP before calcualting semblance | ||
| 226 | $susort->clear(); | ||
| 227 | $susort->headerword( quotemeta('cdp') ); | ||
| 228 | $susort->headerword( quotemeta('offset') ); | ||
| 229 | $susort[1] = $susort->Step(); | ||
| 230 | |||
| 231 | =head2 | ||
| 232 | |||
| 233 | GAIN DATA | ||
| 234 | |||
| 235 | =cut | ||
| 236 | |||
| 237 | $sugain->clear(); | ||
| 238 | $sugain->pbal( quotemeta($on) ); | ||
| 239 | $sugain[1] = $sugain->Step(); | ||
| 240 | |||
| 241 | $sugain->clear(); | ||
| 242 | $sugain->agc( quotemeta($on) ); | ||
| 243 | $sugain->width( quotemeta(0.1) ); | ||
| 244 | |||
| 245 | # $sugain -> setdt(1000); | ||
| 246 | $sugain[2] = $sugain->Step(); | ||
| 247 | |||
| 248 | $sugain->clear(); | ||
| 249 | $sugain->tpower( quotemeta(3) ); | ||
| 250 | $sugain[3] = $sugain->Step(); | ||
| 251 | |||
| 252 | =head2 | ||
| 253 | |||
| 254 | set filtering parameters | ||
| 255 | |||
| 256 | =cut | ||
| 257 | |||
| 258 | $sufilter->clear(); | ||
| 259 | $sufilter->freq( quotemeta( $iSunmo->{_freq} ) ); | ||
| 260 | $sufilter[1] = $sufilter->Step(); | ||
| 261 | |||
| 262 | =head2 | ||
| 263 | |||
| 264 | sub sunmo | ||
| 265 | moves out the data | ||
| 266 | |||
| 267 | =cut | ||
| 268 | |||
| 269 | $sunmo->clear(); | ||
| 270 | $sunmo->par( quotemeta( $vel_in[1] ) ); | ||
| 271 | $sunmo->smute( quotemeta(3) ); #300% max. stretch allowed | ||
| 272 | $sunmo[1] = $sunmo->Step(); | ||
| 273 | |||
| 274 | =head2 | ||
| 275 | |||
| 276 | DISPLAY DATA | ||
| 277 | |||
| 278 | =cut | ||
| 279 | |||
| 280 | $time_inc_minor = 0.1; | ||
| 281 | $time_inc_major = 0.2; | ||
| 282 | $number_minor_time_divisions = $time_inc_major / $time_inc_minor; | ||
| 283 | $suximage_col_bar_max[1] = .5; | ||
| 284 | $suximage_col_bar_min[1] = 0; | ||
| 285 | $base_caption[1] = "f = $iSunmo->{_freq}"; | ||
| 286 | $mute_picks_file[1] = '.itemp_mute_picks_' . $sufile_in[1]; | ||
| 287 | |||
| 288 | $N = 3; | ||
| 289 | $windowtitle[1] = "$N $iSunmo->{_sufile_in} CDP=$iSunmo->{_cdp_num}"; | ||
| 290 | |||
| 291 | $suximage->clear(); | ||
| 292 | $suximage->box_width( quotemeta(300) ); | ||
| 293 | $suximage->box_height( quotemeta(450) ); | ||
| 294 | $suximage->box_X0( quotemeta(1200) ); | ||
| 295 | $suximage->box_Y0( quotemeta(0) ); | ||
| 296 | $suximage->title( quotemeta( $base_caption[1] ) ); | ||
| 297 | $suximage->windowtitle( quotemeta( $windowtitle[1] ) ); | ||
| 298 | $suximage->ylabel( quotemeta('TWTT (s)') ); | ||
| 299 | $suximage->xlabel( quotemeta('tracl') ); | ||
| 300 | $suximage->legend( quotemeta($on) ); | ||
| 301 | $suximage->cmap( quotemeta('hsv2') ); | ||
| 302 | $suximage->first_x( quotemeta(1) ); #d2=1,f2=1 | ||
| 303 | $suximage->dx( quotemeta(1) ); | ||
| 304 | $suximage->loclip( quotemeta( $suximage_col_bar_min[1] ) ); | ||
| 305 | $suximage->hiclip( quotemeta( $suximage_col_bar_max[1] ) ); | ||
| 306 | $suximage->verbose( quotemeta($off) ); | ||
| 307 | |||
| 308 | #$suximage -> dx_major_divisions(quotemeta($iSunmo->{_velocity_increment}*10)); | ||
| 309 | #$suximage -> dy_minor_divisions(quotemeta($number_minor_time_divisions); | ||
| 310 | #$suximage -> dy_major_divisions(quotemeta($time_inc_major); | ||
| 311 | #$suximage -> percent4clip(95.0); | ||
| 312 | #$suximage -> first_tick_number_x($iSunmo->{_first_velocity}); | ||
| 313 | # $suximage -> picks(\$iSunmo->{_Tvel_outbound}); | ||
| 314 | #print("Writing picks to $iSunmo->{_Tvel_outbound}\n\n"); | ||
| 315 | |||
| 316 | $suximage[1] = $suximage->Step(); | ||
| 317 | |||
| 318 | =head2 | ||
| 319 | |||
| 320 | DEFINE FLOW(S) | ||
| 321 | in interactive mode: | ||
| 322 | first time you see the image number_of_tries =0 | ||
| 323 | The image is not connected to flow | ||
| 324 | second, third, etc. times number_of_tries >0 | ||
| 325 | The image halts the flow | ||
| 326 | |||
| 327 | =cut | ||
| 328 | |||
| 329 | @items = ( | ||
| 330 | $susort[1], $in, $iSunmo->{_inbound}, $to, | ||
| 331 | $suwind[1], $to, $suwind[2], $to, | ||
| 332 | $sunmo[1], $to, $sufilter[1], $to, | ||
| 333 | $sugain[1], $to, $sugain[2], $to, | ||
| 334 | $suximage[1], $go | ||
| 335 | ); | ||
| 336 | $flow[1] = $run->modules( \@items ); | ||
| 337 | |||
| 338 | =head2 | ||
| 339 | |||
| 340 | RUN FLOW(S) | ||
| 341 | output copy of picked data points | ||
| 342 | only occurs after the number of tries | ||
| 343 | is updated | ||
| 344 | |||
| 345 | =cut | ||
| 346 | |||
| 347 | $run->flow( \$flow[1] ); | ||
| 348 | |||
| 349 | =head2 | ||
| 350 | |||
| 351 | LOG FLOW(S)TO SCREEN AND FILE | ||
| 352 | |||
| 353 | =cut | ||
| 354 | |||
| 355 | # print "$flow[1]\n"; | ||
| 356 | #$log->file($flow[1]); | ||
| 357 | } | ||
| 358 | |||
| 359 | # end of calc_display subroutine | ||
| 360 | |||
| 361 | =head2 subroutine tmax_s | ||
| 362 | |||
| 363 | |||
| 364 | =cut | ||
| 365 | |||
| 366 | sub tmax_s { | ||
| 367 | my ( $self, $tmax_s ) = @_; | ||
| 368 | if ($tmax_s) { | ||
| 369 | $iSunmo->{_tmax_s} = $tmax_s; | ||
| 370 | } | ||
| 371 | } | ||
| 372 | |||
| 373 | =head2 | ||
| 374 | |||
| 375 | subroutine TV pick file in | ||
| 376 | |||
| 377 | =cut | ||
| 378 | |||
| 379 | sub Tvel_inbound { | ||
| 380 | my ( $variable, $Tvel_inbound ) = @_; | ||
| 381 | $iSunmo->{_Tvel_inbound} = $Tvel_inbound if defined $Tvel_inbound; | ||
| 382 | } | ||
| 383 | |||
| 384 | #end of iSunmo | ||
| 385 | 1; | ||
| 386 |