« lib/App/SeismicUnixGui/sunix/migration/sumigps.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/transform/sucepstrum.pm »
| 1 | package App::SeismicUnixGui::sunix::model::cellauto; | ||
| 2 | |||
| 3 | =head2 SYNOPSIS | ||
| 4 | |||
| 5 | PERL PROGRAM NAME: | ||
| 6 | |||
| 7 | AUTHOR: Juan Lorenzo (Perl module only) | ||
| 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 | CELLAUTO - Two-dimensional CELLular AUTOmata | ||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | cellauto > stdout [optional params] | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | Optional Parameters: | ||
| 33 | |||
| 34 | n1=500 output dimensions of image (n1 x n1 pixels) | ||
| 35 | |||
| 36 | rule=30 CA rule (Wolfram classification) | ||
| 37 | |||
| 38 | Others: 54,60,62,90,94,102,110,122,126 | ||
| 39 | |||
| 40 | 150,158,182,188,190,220,222,225,226,250 | ||
| 41 | |||
| 42 | fill=0 Don't fill image (=1 fill image) | ||
| 43 | |||
| 44 | f0=330 fill zero values with f0 | ||
| 45 | |||
| 46 | f1=3000 fill non-zero values with f1 | ||
| 47 | |||
| 48 | ic=1 initial condition for centered unit value at t=0 | ||
| 49 | |||
| 50 | = 2 for multiple random units | ||
| 51 | |||
| 52 | nc=20 number of random units (if ic=2) | ||
| 53 | |||
| 54 | tc=1 random initial units at t=0 (if ic=2) | ||
| 55 | |||
| 56 | = 2 for initial units at random (t,x) | ||
| 57 | |||
| 58 | verbose=0 silent operation | ||
| 59 | |||
| 60 | = 1 echos 'porosity' of the CA in bottom half of image | ||
| 61 | |||
| 62 | seed=from_clock random number seed (integer) | ||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | Notes: | ||
| 67 | |||
| 68 | This program generates a select set of Wolframs fundamental cellular | ||
| 69 | |||
| 70 | automata. This may be useful for constructing rough, vuggy wavespeed | ||
| 71 | |||
| 72 | profiles. The numbering scheme follows Stephen Wolfram's. | ||
| 73 | |||
| 74 | |||
| 75 | |||
| 76 | Example: | ||
| 77 | |||
| 78 | cellauto rule=110 ic=2 nc=100 fill=1 f1=3000 | ximage n1=500 nx=500 & | ||
| 79 | |||
| 80 | |||
| 81 | |||
| 82 | Here we simulate a complex near surface with air-filled | ||
| 83 | |||
| 84 | vugs in hard country rock, with smoothing applied via smooth2 | ||
| 85 | |||
| 86 | |||
| 87 | |||
| 88 | cellauto rule=110 ic=2 nc=100 fill=1 f1=3000 n1=500 | | ||
| 89 | |||
| 90 | smooth2 n1=500 n2=500 r1=5 r2=5 > vfile.bin | ||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | |||
| 95 | |||
| 96 | Credits: | ||
| 97 | |||
| 98 | UHouston: Chris Liner | ||
| 99 | |||
| 100 | |||
| 101 | |||
| 102 | Trace header fields accessed: ns | ||
| 103 | |||
| 104 | Trace header fields modified: ns and delrt | ||
| 105 | |||
| 106 | |||
| 107 | |||
| 108 | =head2 User's notes (Juan Lorenzo) | ||
| 109 | untested | ||
| 110 | |||
| 111 | =cut | ||
| 112 | |||
| 113 | |||
| 114 | =head2 CHANGES and their DATES | ||
| 115 | |||
| 116 | =cut | ||
| 117 | |||
| 118 | use Moose; | ||
| 119 | our $VERSION = '0.0.1'; | ||
| 120 | |||
| 121 | |||
| 122 | =head2 Import packages | ||
| 123 | |||
| 124 | =cut | ||
| 125 | |||
| 126 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 127 | |||
| 128 | use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su); | ||
| 129 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 130 | |||
| 131 | |||
| 132 | =head2 instantiation of packages | ||
| 133 | |||
| 134 | =cut | ||
| 135 | |||
| 136 | my $get = L_SU_global_constants->new(); | ||
| 137 | my $Project = Project_config->new(); | ||
| 138 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 139 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 140 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 141 | |||
| 142 | my $PS_SEISMIC = $Project->PS_SEISMIC(); | ||
| 143 | |||
| 144 | my $var = $get->var(); | ||
| 145 | my $on = $var->{_on}; | ||
| 146 | my $off = $var->{_off}; | ||
| 147 | my $true = $var->{_true}; | ||
| 148 | my $false = $var->{_false}; | ||
| 149 | my $empty_string = $var->{_empty_string}; | ||
| 150 | |||
| 151 | =head2 Encapsulated | ||
| 152 | hash of private variables | ||
| 153 | |||
| 154 | =cut | ||
| 155 | |||
| 156 | my $cellauto = { | ||
| 157 | _f0 => '', | ||
| 158 | _f1 => '', | ||
| 159 | _fill => '', | ||
| 160 | _ic => '', | ||
| 161 | _n1 => '', | ||
| 162 | _nc => '', | ||
| 163 | _rule => '', | ||
| 164 | _seed => '', | ||
| 165 | _tc => '', | ||
| 166 | _verbose => '', | ||
| 167 | _Step => '', | ||
| 168 | _note => '', | ||
| 169 | |||
| 170 | }; | ||
| 171 | |||
| 172 | =head2 sub Step | ||
| 173 | |||
| 174 | collects switches and assembles bash instructions | ||
| 175 | by adding the program name | ||
| 176 | |||
| 177 | =cut | ||
| 178 | |||
| 179 | sub Step { | ||
| 180 | |||
| 181 | $cellauto->{_Step} = 'cellauto'.$cellauto->{_Step}; | ||
| 182 | return ( $cellauto->{_Step} ); | ||
| 183 | |||
| 184 | } | ||
| 185 | |||
| 186 | |||
| 187 | =head2 sub note | ||
| 188 | |||
| 189 | collects switches and assembles bash instructions | ||
| 190 | by adding the program name | ||
| 191 | |||
| 192 | =cut | ||
| 193 | |||
| 194 | sub note { | ||
| 195 | |||
| 196 | $cellauto->{_note} = 'cellauto'.$cellauto->{_note}; | ||
| 197 | return ( $cellauto->{_note} ); | ||
| 198 | |||
| 199 | } | ||
| 200 | |||
| 201 | |||
| 202 | |||
| 203 | =head2 sub clear | ||
| 204 | |||
| 205 | =cut | ||
| 206 | |||
| 207 | sub clear { | ||
| 208 | |||
| 209 | $cellauto->{_f0} = ''; | ||
| 210 | $cellauto->{_f1} = ''; | ||
| 211 | $cellauto->{_fill} = ''; | ||
| 212 | $cellauto->{_ic} = ''; | ||
| 213 | $cellauto->{_n1} = ''; | ||
| 214 | $cellauto->{_nc} = ''; | ||
| 215 | $cellauto->{_rule} = ''; | ||
| 216 | $cellauto->{_seed} = ''; | ||
| 217 | $cellauto->{_tc} = ''; | ||
| 218 | $cellauto->{_verbose} = ''; | ||
| 219 | $cellauto->{_Step} = ''; | ||
| 220 | $cellauto->{_note} = ''; | ||
| 221 | } | ||
| 222 | |||
| 223 | |||
| 224 | =head2 sub f0 | ||
| 225 | |||
| 226 | |||
| 227 | =cut | ||
| 228 | |||
| 229 | sub f0 { | ||
| 230 | |||
| 231 | my ( $self,$f0 ) = @_; | ||
| 232 | if ( $f0 ne $empty_string ) { | ||
| 233 | |||
| 234 | $cellauto->{_f0} = $f0; | ||
| 235 | $cellauto->{_note} = $cellauto->{_note}.' f0='.$cellauto->{_f0}; | ||
| 236 | $cellauto->{_Step} = $cellauto->{_Step}.' f0='.$cellauto->{_f0}; | ||
| 237 | |||
| 238 | } else { | ||
| 239 | print("cellauto, f0, missing f0,\n"); | ||
| 240 | } | ||
| 241 | } | ||
| 242 | |||
| 243 | |||
| 244 | =head2 sub f1 | ||
| 245 | |||
| 246 | |||
| 247 | =cut | ||
| 248 | |||
| 249 | sub f1 { | ||
| 250 | |||
| 251 | my ( $self,$f1 ) = @_; | ||
| 252 | if ( $f1 ne $empty_string ) { | ||
| 253 | |||
| 254 | $cellauto->{_f1} = $f1; | ||
| 255 | $cellauto->{_note} = $cellauto->{_note}.' f1='.$cellauto->{_f1}; | ||
| 256 | $cellauto->{_Step} = $cellauto->{_Step}.' f1='.$cellauto->{_f1}; | ||
| 257 | |||
| 258 | } else { | ||
| 259 | print("cellauto, f1, missing f1,\n"); | ||
| 260 | } | ||
| 261 | } | ||
| 262 | |||
| 263 | |||
| 264 | =head2 sub fill | ||
| 265 | |||
| 266 | |||
| 267 | =cut | ||
| 268 | |||
| 269 | sub fill { | ||
| 270 | |||
| 271 | my ( $self,$fill ) = @_; | ||
| 272 | if ( $fill ne $empty_string ) { | ||
| 273 | |||
| 274 | $cellauto->{_fill} = $fill; | ||
| 275 | $cellauto->{_note} = $cellauto->{_note}.' fill='.$cellauto->{_fill}; | ||
| 276 | $cellauto->{_Step} = $cellauto->{_Step}.' fill='.$cellauto->{_fill}; | ||
| 277 | |||
| 278 | } else { | ||
| 279 | print("cellauto, fill, missing fill,\n"); | ||
| 280 | } | ||
| 281 | } | ||
| 282 | |||
| 283 | |||
| 284 | =head2 sub ic | ||
| 285 | |||
| 286 | |||
| 287 | =cut | ||
| 288 | |||
| 289 | sub ic { | ||
| 290 | |||
| 291 | my ( $self,$ic ) = @_; | ||
| 292 | if ( $ic ne $empty_string ) { | ||
| 293 | |||
| 294 | $cellauto->{_ic} = $ic; | ||
| 295 | $cellauto->{_note} = $cellauto->{_note}.' ic='.$cellauto->{_ic}; | ||
| 296 | $cellauto->{_Step} = $cellauto->{_Step}.' ic='.$cellauto->{_ic}; | ||
| 297 | |||
| 298 | } else { | ||
| 299 | print("cellauto, ic, missing ic,\n"); | ||
| 300 | } | ||
| 301 | } | ||
| 302 | |||
| 303 | |||
| 304 | =head2 sub n1 | ||
| 305 | |||
| 306 | |||
| 307 | =cut | ||
| 308 | |||
| 309 | sub n1 { | ||
| 310 | |||
| 311 | my ( $self,$n1 ) = @_; | ||
| 312 | if ( $n1 ne $empty_string ) { | ||
| 313 | |||
| 314 | $cellauto->{_n1} = $n1; | ||
| 315 | $cellauto->{_note} = $cellauto->{_note}.' n1='.$cellauto->{_n1}; | ||
| 316 | $cellauto->{_Step} = $cellauto->{_Step}.' n1='.$cellauto->{_n1}; | ||
| 317 | |||
| 318 | } else { | ||
| 319 | print("cellauto, n1, missing n1,\n"); | ||
| 320 | } | ||
| 321 | } | ||
| 322 | |||
| 323 | |||
| 324 | =head2 sub nc | ||
| 325 | |||
| 326 | |||
| 327 | =cut | ||
| 328 | |||
| 329 | sub nc { | ||
| 330 | |||
| 331 | my ( $self,$nc ) = @_; | ||
| 332 | if ( $nc ne $empty_string ) { | ||
| 333 | |||
| 334 | $cellauto->{_nc} = $nc; | ||
| 335 | $cellauto->{_note} = $cellauto->{_note}.' nc='.$cellauto->{_nc}; | ||
| 336 | $cellauto->{_Step} = $cellauto->{_Step}.' nc='.$cellauto->{_nc}; | ||
| 337 | |||
| 338 | } else { | ||
| 339 | print("cellauto, nc, missing nc,\n"); | ||
| 340 | } | ||
| 341 | } | ||
| 342 | |||
| 343 | |||
| 344 | =head2 sub rule | ||
| 345 | |||
| 346 | |||
| 347 | =cut | ||
| 348 | |||
| 349 | sub rule { | ||
| 350 | |||
| 351 | my ( $self,$rule ) = @_; | ||
| 352 | if ( $rule ne $empty_string ) { | ||
| 353 | |||
| 354 | $cellauto->{_rule} = $rule; | ||
| 355 | $cellauto->{_note} = $cellauto->{_note}.' rule='.$cellauto->{_rule}; | ||
| 356 | $cellauto->{_Step} = $cellauto->{_Step}.' rule='.$cellauto->{_rule}; | ||
| 357 | |||
| 358 | } else { | ||
| 359 | print("cellauto, rule, missing rule,\n"); | ||
| 360 | } | ||
| 361 | } | ||
| 362 | |||
| 363 | |||
| 364 | =head2 sub seed | ||
| 365 | |||
| 366 | |||
| 367 | =cut | ||
| 368 | |||
| 369 | sub seed { | ||
| 370 | |||
| 371 | my ( $self,$seed ) = @_; | ||
| 372 | if ( $seed ne $empty_string ) { | ||
| 373 | |||
| 374 | $cellauto->{_seed} = $seed; | ||
| 375 | $cellauto->{_note} = $cellauto->{_note}.' seed='.$cellauto->{_seed}; | ||
| 376 | $cellauto->{_Step} = $cellauto->{_Step}.' seed='.$cellauto->{_seed}; | ||
| 377 | |||
| 378 | } else { | ||
| 379 | print("cellauto, seed, missing seed,\n"); | ||
| 380 | } | ||
| 381 | } | ||
| 382 | |||
| 383 | |||
| 384 | =head2 sub tc | ||
| 385 | |||
| 386 | |||
| 387 | =cut | ||
| 388 | |||
| 389 | sub tc { | ||
| 390 | |||
| 391 | my ( $self,$tc ) = @_; | ||
| 392 | if ( $tc ne $empty_string ) { | ||
| 393 | |||
| 394 | $cellauto->{_tc} = $tc; | ||
| 395 | $cellauto->{_note} = $cellauto->{_note}.' tc='.$cellauto->{_tc}; | ||
| 396 | $cellauto->{_Step} = $cellauto->{_Step}.' tc='.$cellauto->{_tc}; | ||
| 397 | |||
| 398 | } else { | ||
| 399 | print("cellauto, tc, missing tc,\n"); | ||
| 400 | } | ||
| 401 | } | ||
| 402 | |||
| 403 | |||
| 404 | =head2 sub verbose | ||
| 405 | |||
| 406 | |||
| 407 | =cut | ||
| 408 | |||
| 409 | sub verbose { | ||
| 410 | |||
| 411 | my ( $self,$verbose ) = @_; | ||
| 412 | if ( $verbose ne $empty_string ) { | ||
| 413 | |||
| 414 | $cellauto->{_verbose} = $verbose; | ||
| 415 | $cellauto->{_note} = $cellauto->{_note}.' verbose='.$cellauto->{_verbose}; | ||
| 416 | $cellauto->{_Step} = $cellauto->{_Step}.' verbose='.$cellauto->{_verbose}; | ||
| 417 | |||
| 418 | } else { | ||
| 419 | print("cellauto, verbose, missing verbose,\n"); | ||
| 420 | } | ||
| 421 | } | ||
| 422 | |||
| 423 | |||
| 424 | =head2 sub get_max_index | ||
| 425 | |||
| 426 | max index = number of input variables -1 | ||
| 427 | |||
| 428 | =cut | ||
| 429 | |||
| 430 | sub get_max_index { | ||
| 431 | my ($self) = @_; | ||
| 432 | my $max_index = 9; | ||
| 433 | |||
| 434 | return($max_index); | ||
| 435 | } | ||
| 436 | |||
| 437 | |||
| 438 | 1; |