« lib/App/SeismicUnixGui/sunix/migration/sumigfd.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/model/surandspike.pm »
| 1 | package App::SeismicUnixGui::sunix::model::sudgwaveform; | ||
| 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 | SUDGWAVEFORM - make Gaussian derivative waveform in SU format | ||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | sudgwaveform >stdout [optional parameters] | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | Optional parameters: | ||
| 35 | |||
| 36 | n=2 order of derivative (n>=1) | ||
| 37 | |||
| 38 | fpeak=35 peak frequency | ||
| 39 | |||
| 40 | nfpeak=n*n max. frequency = nfpeak * fpeak | ||
| 41 | |||
| 42 | nt=128 length of waveform | ||
| 43 | |||
| 44 | shift=0 additional time shift in s (used for plotting) | ||
| 45 | |||
| 46 | sign=1 use =-1 to change sign | ||
| 47 | |||
| 48 | verbose=0 =0 don't display diagnostic messages | ||
| 49 | |||
| 50 | =1 display diagnostic messages | ||
| 51 | |||
| 52 | Notes: | ||
| 53 | |||
| 54 | This code computes a waveform that is the n-th order derivative of a | ||
| 55 | |||
| 56 | Gaussian. The variance of the Gaussian is specified through its peak | ||
| 57 | |||
| 58 | frequency, i.e. the frequency at which the amplitude spectrum of the | ||
| 59 | |||
| 60 | Gaussian has a maximum. nfpeak is used to compute maximum frequency, | ||
| 61 | |||
| 62 | which in turn is used to compute the sampling interval. Increasing | ||
| 63 | |||
| 64 | nfpeak gives smoother plots. In order to have a (pseudo-) causal | ||
| 65 | |||
| 66 | pulse, the program computes a time shift equal to sqrt(n)/fpeak. An | ||
| 67 | |||
| 68 | additional shift can be applied with the parameter shift. A positive | ||
| 69 | |||
| 70 | value shifts the waveform to the right. | ||
| 71 | |||
| 72 | |||
| 73 | |||
| 74 | Examples: | ||
| 75 | |||
| 76 | 2-loop Ricker: dgwaveform n=1 >ricker2.su | ||
| 77 | |||
| 78 | 3-loop Ricker: dgwaveform n=2 >ricker3.su | ||
| 79 | |||
| 80 | Sonic transducer pulse: dgwaveform n=10 fpeak=300 >sonic.su | ||
| 81 | |||
| 82 | |||
| 83 | |||
| 84 | To display use suxgraph. For example: | ||
| 85 | |||
| 86 | dgwaveform n=10 fpeak=300 | suxgraph style=normal & | ||
| 87 | |||
| 88 | |||
| 89 | |||
| 90 | For other seismic waveforms, please use "suwaveform". | ||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | |||
| 95 | |||
| 96 | Credits: | ||
| 97 | |||
| 98 | |||
| 99 | |||
| 100 | Werner M. Heigl, February 2007 | ||
| 101 | |||
| 102 | |||
| 103 | |||
| 104 | This copyright covers parts that are not part of the original | ||
| 105 | |||
| 106 | CWP/SU: Seismic Un*x codes called by this program: | ||
| 107 | |||
| 108 | |||
| 109 | |||
| 110 | Copyright (c) 2007 by the Society of Exploration Geophysicists. | ||
| 111 | |||
| 112 | For more information, go to http://software.seg.org/2007/0004 . | ||
| 113 | |||
| 114 | You must read and accept usage terms at: | ||
| 115 | |||
| 116 | http://software.seg.org/disclaimer.txt before use. | ||
| 117 | |||
| 118 | |||
| 119 | |||
| 120 | Revision history: | ||
| 121 | |||
| 122 | Original SEG version by Werner M. Heigl, Apache E&P Technology, | ||
| 123 | |||
| 124 | February 2007. | ||
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | Jan 2010 - subroutines deriv_n_gauss and hermite_n_polynomial moved | ||
| 129 | |||
| 130 | to libcwp.a | ||
| 131 | |||
| 132 | / | ||
| 133 | |||
| 134 | =head2 User's notes (Juan Lorenzo) | ||
| 135 | untested | ||
| 136 | |||
| 137 | =cut | ||
| 138 | |||
| 139 | |||
| 140 | =head2 CHANGES and their DATES | ||
| 141 | |||
| 142 | =cut | ||
| 143 | |||
| 144 | use Moose; | ||
| 145 | our $VERSION = '0.0.1'; | ||
| 146 | |||
| 147 | |||
| 148 | =head2 Import packages | ||
| 149 | |||
| 150 | =cut | ||
| 151 | |||
| 152 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 153 | |||
| 154 | use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin); | ||
| 155 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 156 | |||
| 157 | |||
| 158 | =head2 instantiation of packages | ||
| 159 | |||
| 160 | =cut | ||
| 161 | |||
| 162 | my $get = L_SU_global_constants->new(); | ||
| 163 | my $Project = Project_config->new(); | ||
| 164 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 165 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 166 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 167 | |||
| 168 | my $var = $get->var(); | ||
| 169 | my $on = $var->{_on}; | ||
| 170 | my $off = $var->{_off}; | ||
| 171 | my $true = $var->{_true}; | ||
| 172 | my $false = $var->{_false}; | ||
| 173 | my $empty_string = $var->{_empty_string}; | ||
| 174 | |||
| 175 | =head2 Encapsulated | ||
| 176 | hash of private variables | ||
| 177 | |||
| 178 | =cut | ||
| 179 | |||
| 180 | my $sudgwaveform = { | ||
| 181 | _fpeak => '', | ||
| 182 | _n => '', | ||
| 183 | _nfpeak => '', | ||
| 184 | _nt => '', | ||
| 185 | _shift => '', | ||
| 186 | _sign => '', | ||
| 187 | _verbose => '', | ||
| 188 | _Step => '', | ||
| 189 | _note => '', | ||
| 190 | |||
| 191 | }; | ||
| 192 | |||
| 193 | =head2 sub Step | ||
| 194 | |||
| 195 | collects switches and assembles bash instructions | ||
| 196 | by adding the program name | ||
| 197 | |||
| 198 | =cut | ||
| 199 | |||
| 200 | sub Step { | ||
| 201 | |||
| 202 | $sudgwaveform->{_Step} = 'sudgwaveform'.$sudgwaveform->{_Step}; | ||
| 203 | return ( $sudgwaveform->{_Step} ); | ||
| 204 | |||
| 205 | } | ||
| 206 | |||
| 207 | |||
| 208 | =head2 sub note | ||
| 209 | |||
| 210 | collects switches and assembles bash instructions | ||
| 211 | by adding the program name | ||
| 212 | |||
| 213 | =cut | ||
| 214 | |||
| 215 | sub note { | ||
| 216 | |||
| 217 | $sudgwaveform->{_note} = 'sudgwaveform'.$sudgwaveform->{_note}; | ||
| 218 | return ( $sudgwaveform->{_note} ); | ||
| 219 | |||
| 220 | } | ||
| 221 | |||
| 222 | |||
| 223 | |||
| 224 | =head2 sub clear | ||
| 225 | |||
| 226 | =cut | ||
| 227 | |||
| 228 | sub clear { | ||
| 229 | |||
| 230 | $sudgwaveform->{_fpeak} = ''; | ||
| 231 | $sudgwaveform->{_n} = ''; | ||
| 232 | $sudgwaveform->{_nfpeak} = ''; | ||
| 233 | $sudgwaveform->{_nt} = ''; | ||
| 234 | $sudgwaveform->{_shift} = ''; | ||
| 235 | $sudgwaveform->{_sign} = ''; | ||
| 236 | $sudgwaveform->{_verbose} = ''; | ||
| 237 | $sudgwaveform->{_Step} = ''; | ||
| 238 | $sudgwaveform->{_note} = ''; | ||
| 239 | } | ||
| 240 | |||
| 241 | |||
| 242 | =head2 sub fpeak | ||
| 243 | |||
| 244 | |||
| 245 | =cut | ||
| 246 | |||
| 247 | sub fpeak { | ||
| 248 | |||
| 249 | my ( $self,$fpeak ) = @_; | ||
| 250 | if ( $fpeak ne $empty_string ) { | ||
| 251 | |||
| 252 | $sudgwaveform->{_fpeak} = $fpeak; | ||
| 253 | $sudgwaveform->{_note} = $sudgwaveform->{_note}.' fpeak='.$sudgwaveform->{_fpeak}; | ||
| 254 | $sudgwaveform->{_Step} = $sudgwaveform->{_Step}.' fpeak='.$sudgwaveform->{_fpeak}; | ||
| 255 | |||
| 256 | } else { | ||
| 257 | print("sudgwaveform, fpeak, missing fpeak,\n"); | ||
| 258 | } | ||
| 259 | } | ||
| 260 | |||
| 261 | |||
| 262 | =head2 sub n | ||
| 263 | |||
| 264 | |||
| 265 | =cut | ||
| 266 | |||
| 267 | sub n { | ||
| 268 | |||
| 269 | my ( $self,$n ) = @_; | ||
| 270 | if ( $n ne $empty_string ) { | ||
| 271 | |||
| 272 | $sudgwaveform->{_n} = $n; | ||
| 273 | $sudgwaveform->{_note} = $sudgwaveform->{_note}.' n='.$sudgwaveform->{_n}; | ||
| 274 | $sudgwaveform->{_Step} = $sudgwaveform->{_Step}.' n='.$sudgwaveform->{_n}; | ||
| 275 | |||
| 276 | } else { | ||
| 277 | print("sudgwaveform, n, missing n,\n"); | ||
| 278 | } | ||
| 279 | } | ||
| 280 | |||
| 281 | |||
| 282 | =head2 sub nfpeak | ||
| 283 | |||
| 284 | |||
| 285 | =cut | ||
| 286 | |||
| 287 | sub nfpeak { | ||
| 288 | |||
| 289 | my ( $self,$nfpeak ) = @_; | ||
| 290 | if ( $nfpeak ne $empty_string ) { | ||
| 291 | |||
| 292 | $sudgwaveform->{_nfpeak} = $nfpeak; | ||
| 293 | $sudgwaveform->{_note} = $sudgwaveform->{_note}.' nfpeak='.$sudgwaveform->{_nfpeak}; | ||
| 294 | $sudgwaveform->{_Step} = $sudgwaveform->{_Step}.' nfpeak='.$sudgwaveform->{_nfpeak}; | ||
| 295 | |||
| 296 | } else { | ||
| 297 | print("sudgwaveform, nfpeak, missing nfpeak,\n"); | ||
| 298 | } | ||
| 299 | } | ||
| 300 | |||
| 301 | |||
| 302 | =head2 sub nt | ||
| 303 | |||
| 304 | |||
| 305 | =cut | ||
| 306 | |||
| 307 | sub nt { | ||
| 308 | |||
| 309 | my ( $self,$nt ) = @_; | ||
| 310 | if ( $nt ne $empty_string ) { | ||
| 311 | |||
| 312 | $sudgwaveform->{_nt} = $nt; | ||
| 313 | $sudgwaveform->{_note} = $sudgwaveform->{_note}.' nt='.$sudgwaveform->{_nt}; | ||
| 314 | $sudgwaveform->{_Step} = $sudgwaveform->{_Step}.' nt='.$sudgwaveform->{_nt}; | ||
| 315 | |||
| 316 | } else { | ||
| 317 | print("sudgwaveform, nt, missing nt,\n"); | ||
| 318 | } | ||
| 319 | } | ||
| 320 | |||
| 321 | |||
| 322 | =head2 sub shift | ||
| 323 | |||
| 324 | |||
| 325 | =cut | ||
| 326 | |||
| 327 | sub shift { | ||
| 328 | |||
| 329 | my ( $self,$shift ) = @_; | ||
| 330 | if ( $shift ne $empty_string ) { | ||
| 331 | |||
| 332 | $sudgwaveform->{_shift} = $shift; | ||
| 333 | $sudgwaveform->{_note} = $sudgwaveform->{_note}.' shift='.$sudgwaveform->{_shift}; | ||
| 334 | $sudgwaveform->{_Step} = $sudgwaveform->{_Step}.' shift='.$sudgwaveform->{_shift}; | ||
| 335 | |||
| 336 | } else { | ||
| 337 | print("sudgwaveform, shift, missing shift,\n"); | ||
| 338 | } | ||
| 339 | } | ||
| 340 | |||
| 341 | |||
| 342 | =head2 sub sign | ||
| 343 | |||
| 344 | |||
| 345 | =cut | ||
| 346 | |||
| 347 | sub sign { | ||
| 348 | |||
| 349 | my ( $self,$sign ) = @_; | ||
| 350 | if ( $sign ne $empty_string ) { | ||
| 351 | |||
| 352 | $sudgwaveform->{_sign} = $sign; | ||
| 353 | $sudgwaveform->{_note} = $sudgwaveform->{_note}.' sign='.$sudgwaveform->{_sign}; | ||
| 354 | $sudgwaveform->{_Step} = $sudgwaveform->{_Step}.' sign='.$sudgwaveform->{_sign}; | ||
| 355 | |||
| 356 | } else { | ||
| 357 | print("sudgwaveform, sign, missing sign,\n"); | ||
| 358 | } | ||
| 359 | } | ||
| 360 | |||
| 361 | |||
| 362 | =head2 sub verbose | ||
| 363 | |||
| 364 | |||
| 365 | =cut | ||
| 366 | |||
| 367 | sub verbose { | ||
| 368 | |||
| 369 | my ( $self,$verbose ) = @_; | ||
| 370 | if ( $verbose ne $empty_string ) { | ||
| 371 | |||
| 372 | $sudgwaveform->{_verbose} = $verbose; | ||
| 373 | $sudgwaveform->{_note} = $sudgwaveform->{_note}.' verbose='.$sudgwaveform->{_verbose}; | ||
| 374 | $sudgwaveform->{_Step} = $sudgwaveform->{_Step}.' verbose='.$sudgwaveform->{_verbose}; | ||
| 375 | |||
| 376 | } else { | ||
| 377 | print("sudgwaveform, verbose, missing verbose,\n"); | ||
| 378 | } | ||
| 379 | } | ||
| 380 | |||
| 381 | |||
| 382 | =head2 sub get_max_index | ||
| 383 | |||
| 384 | max index = number of input variables -1 | ||
| 385 | |||
| 386 | =cut | ||
| 387 | |||
| 388 | sub get_max_index { | ||
| 389 | my ($self) = @_; | ||
| 390 | my $max_index = 6; | ||
| 391 | |||
| 392 | return($max_index); | ||
| 393 | } | ||
| 394 | |||
| 395 | |||
| 396 | 1; |