« lib/App/SeismicUnixGui/sunix/model/sudgwaveform.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/plot/pslabel.pm »
| 1 | package App::SeismicUnixGui::sunix::model::surandspike; | ||
| 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 | SURANDSPIKE - make a small data set of RANDom SPIKEs | ||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | surandspike [optional parameters] > out_data_file | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | Creates a common offset su data file with random spikes | ||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | Optional parameters: | ||
| 37 | |||
| 38 | n1=500 number of time samples | ||
| 39 | |||
| 40 | n2=200 number of traces | ||
| 41 | |||
| 42 | dt=0.002 time sample rate in seconds | ||
| 43 | |||
| 44 | nspk=20 number of spikes per trace | ||
| 45 | |||
| 46 | amax=0.2 abs(max) spike value | ||
| 47 | |||
| 48 | mode=1 different spikes on each trace | ||
| 49 | |||
| 50 | =2 same spikes on each trace | ||
| 51 | |||
| 52 | seed=from_clock random number seed (integer) | ||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | Credits: | ||
| 59 | |||
| 60 | ARAMCO: Chris Liner | ||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | Trace header fields set: ns, dt, offset | ||
| 65 | |||
| 66 | |||
| 67 | |||
| 68 | =head2 User's notes (Juan Lorenzo) | ||
| 69 | untested | ||
| 70 | |||
| 71 | =cut | ||
| 72 | |||
| 73 | |||
| 74 | =head2 CHANGES and their DATES | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | use Moose; | ||
| 79 | our $VERSION = '0.0.1'; | ||
| 80 | |||
| 81 | |||
| 82 | =head2 Import packages | ||
| 83 | |||
| 84 | =cut | ||
| 85 | |||
| 86 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 87 | |||
| 88 | use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin); | ||
| 89 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 90 | |||
| 91 | |||
| 92 | =head2 instantiation of packages | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | my $get = L_SU_global_constants->new(); | ||
| 97 | my $Project = Project_config->new(); | ||
| 98 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 99 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 100 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 101 | |||
| 102 | my $var = $get->var(); | ||
| 103 | my $on = $var->{_on}; | ||
| 104 | my $off = $var->{_off}; | ||
| 105 | my $true = $var->{_true}; | ||
| 106 | my $false = $var->{_false}; | ||
| 107 | my $empty_string = $var->{_empty_string}; | ||
| 108 | |||
| 109 | =head2 Encapsulated | ||
| 110 | hash of private variables | ||
| 111 | |||
| 112 | =cut | ||
| 113 | |||
| 114 | my $surandspike = { | ||
| 115 | _amax => '', | ||
| 116 | _dt => '', | ||
| 117 | _mode => '', | ||
| 118 | _n1 => '', | ||
| 119 | _n2 => '', | ||
| 120 | _nspk => '', | ||
| 121 | _seed => '', | ||
| 122 | _Step => '', | ||
| 123 | _note => '', | ||
| 124 | |||
| 125 | }; | ||
| 126 | |||
| 127 | =head2 sub Step | ||
| 128 | |||
| 129 | collects switches and assembles bash instructions | ||
| 130 | by adding the program name | ||
| 131 | |||
| 132 | =cut | ||
| 133 | |||
| 134 | sub Step { | ||
| 135 | |||
| 136 | $surandspike->{_Step} = 'surandspike'.$surandspike->{_Step}; | ||
| 137 | return ( $surandspike->{_Step} ); | ||
| 138 | |||
| 139 | } | ||
| 140 | |||
| 141 | |||
| 142 | =head2 sub note | ||
| 143 | |||
| 144 | collects switches and assembles bash instructions | ||
| 145 | by adding the program name | ||
| 146 | |||
| 147 | =cut | ||
| 148 | |||
| 149 | sub note { | ||
| 150 | |||
| 151 | $surandspike->{_note} = 'surandspike'.$surandspike->{_note}; | ||
| 152 | return ( $surandspike->{_note} ); | ||
| 153 | |||
| 154 | } | ||
| 155 | |||
| 156 | |||
| 157 | |||
| 158 | =head2 sub clear | ||
| 159 | |||
| 160 | =cut | ||
| 161 | |||
| 162 | sub clear { | ||
| 163 | |||
| 164 | $surandspike->{_amax} = ''; | ||
| 165 | $surandspike->{_dt} = ''; | ||
| 166 | $surandspike->{_mode} = ''; | ||
| 167 | $surandspike->{_n1} = ''; | ||
| 168 | $surandspike->{_n2} = ''; | ||
| 169 | $surandspike->{_nspk} = ''; | ||
| 170 | $surandspike->{_seed} = ''; | ||
| 171 | $surandspike->{_Step} = ''; | ||
| 172 | $surandspike->{_note} = ''; | ||
| 173 | } | ||
| 174 | |||
| 175 | |||
| 176 | =head2 sub amax | ||
| 177 | |||
| 178 | |||
| 179 | =cut | ||
| 180 | |||
| 181 | sub amax { | ||
| 182 | |||
| 183 | my ( $self,$amax ) = @_; | ||
| 184 | if ( $amax ne $empty_string ) { | ||
| 185 | |||
| 186 | $surandspike->{_amax} = $amax; | ||
| 187 | $surandspike->{_note} = $surandspike->{_note}.' amax='.$surandspike->{_amax}; | ||
| 188 | $surandspike->{_Step} = $surandspike->{_Step}.' amax='.$surandspike->{_amax}; | ||
| 189 | |||
| 190 | } else { | ||
| 191 | print("surandspike, amax, missing amax,\n"); | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | |||
| 196 | =head2 sub dt | ||
| 197 | |||
| 198 | |||
| 199 | =cut | ||
| 200 | |||
| 201 | sub dt { | ||
| 202 | |||
| 203 | my ( $self,$dt ) = @_; | ||
| 204 | if ( $dt ne $empty_string ) { | ||
| 205 | |||
| 206 | $surandspike->{_dt} = $dt; | ||
| 207 | $surandspike->{_note} = $surandspike->{_note}.' dt='.$surandspike->{_dt}; | ||
| 208 | $surandspike->{_Step} = $surandspike->{_Step}.' dt='.$surandspike->{_dt}; | ||
| 209 | |||
| 210 | } else { | ||
| 211 | print("surandspike, dt, missing dt,\n"); | ||
| 212 | } | ||
| 213 | } | ||
| 214 | |||
| 215 | |||
| 216 | =head2 sub mode | ||
| 217 | |||
| 218 | |||
| 219 | =cut | ||
| 220 | |||
| 221 | sub mode { | ||
| 222 | |||
| 223 | my ( $self,$mode ) = @_; | ||
| 224 | if ( $mode ne $empty_string ) { | ||
| 225 | |||
| 226 | $surandspike->{_mode} = $mode; | ||
| 227 | $surandspike->{_note} = $surandspike->{_note}.' mode='.$surandspike->{_mode}; | ||
| 228 | $surandspike->{_Step} = $surandspike->{_Step}.' mode='.$surandspike->{_mode}; | ||
| 229 | |||
| 230 | } else { | ||
| 231 | print("surandspike, mode, missing mode,\n"); | ||
| 232 | } | ||
| 233 | } | ||
| 234 | |||
| 235 | |||
| 236 | =head2 sub n1 | ||
| 237 | |||
| 238 | |||
| 239 | =cut | ||
| 240 | |||
| 241 | sub n1 { | ||
| 242 | |||
| 243 | my ( $self,$n1 ) = @_; | ||
| 244 | if ( $n1 ne $empty_string ) { | ||
| 245 | |||
| 246 | $surandspike->{_n1} = $n1; | ||
| 247 | $surandspike->{_note} = $surandspike->{_note}.' n1='.$surandspike->{_n1}; | ||
| 248 | $surandspike->{_Step} = $surandspike->{_Step}.' n1='.$surandspike->{_n1}; | ||
| 249 | |||
| 250 | } else { | ||
| 251 | print("surandspike, n1, missing n1,\n"); | ||
| 252 | } | ||
| 253 | } | ||
| 254 | |||
| 255 | |||
| 256 | =head2 sub n2 | ||
| 257 | |||
| 258 | |||
| 259 | =cut | ||
| 260 | |||
| 261 | sub n2 { | ||
| 262 | |||
| 263 | my ( $self,$n2 ) = @_; | ||
| 264 | if ( $n2 ne $empty_string ) { | ||
| 265 | |||
| 266 | $surandspike->{_n2} = $n2; | ||
| 267 | $surandspike->{_note} = $surandspike->{_note}.' n2='.$surandspike->{_n2}; | ||
| 268 | $surandspike->{_Step} = $surandspike->{_Step}.' n2='.$surandspike->{_n2}; | ||
| 269 | |||
| 270 | } else { | ||
| 271 | print("surandspike, n2, missing n2,\n"); | ||
| 272 | } | ||
| 273 | } | ||
| 274 | |||
| 275 | |||
| 276 | =head2 sub nspk | ||
| 277 | |||
| 278 | |||
| 279 | =cut | ||
| 280 | |||
| 281 | sub nspk { | ||
| 282 | |||
| 283 | my ( $self,$nspk ) = @_; | ||
| 284 | if ( $nspk ne $empty_string ) { | ||
| 285 | |||
| 286 | $surandspike->{_nspk} = $nspk; | ||
| 287 | $surandspike->{_note} = $surandspike->{_note}.' nspk='.$surandspike->{_nspk}; | ||
| 288 | $surandspike->{_Step} = $surandspike->{_Step}.' nspk='.$surandspike->{_nspk}; | ||
| 289 | |||
| 290 | } else { | ||
| 291 | print("surandspike, nspk, missing nspk,\n"); | ||
| 292 | } | ||
| 293 | } | ||
| 294 | |||
| 295 | |||
| 296 | =head2 sub seed | ||
| 297 | |||
| 298 | |||
| 299 | =cut | ||
| 300 | |||
| 301 | sub seed { | ||
| 302 | |||
| 303 | my ( $self,$seed ) = @_; | ||
| 304 | if ( $seed ne $empty_string ) { | ||
| 305 | |||
| 306 | $surandspike->{_seed} = $seed; | ||
| 307 | $surandspike->{_note} = $surandspike->{_note}.' seed='.$surandspike->{_seed}; | ||
| 308 | $surandspike->{_Step} = $surandspike->{_Step}.' seed='.$surandspike->{_seed}; | ||
| 309 | |||
| 310 | } else { | ||
| 311 | print("surandspike, seed, missing seed,\n"); | ||
| 312 | } | ||
| 313 | } | ||
| 314 | |||
| 315 | |||
| 316 | =head2 sub get_max_index | ||
| 317 | |||
| 318 | max index = number of input variables -1 | ||
| 319 | |||
| 320 | =cut | ||
| 321 | |||
| 322 | sub get_max_index { | ||
| 323 | my ($self) = @_; | ||
| 324 | my $max_index = 6; | ||
| 325 | |||
| 326 | return($max_index); | ||
| 327 | } | ||
| 328 | |||
| 329 | |||
| 330 | 1; |