« lib/App/SeismicUnixGui/sunix/statsMath/suattributes.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/NMO_Vel_Stk/surelan.pm »
| 1 | package App::SeismicUnixGui::sunix::statsMath::suhistogram; | ||
| 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 | SUHISTOGRAM - create histogram of input amplitudes | ||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | suhistogram <in.su >out.dat | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | Required parameters: | ||
| 33 | |||
| 34 | min= minimum bin | ||
| 35 | |||
| 36 | max= maximum bin | ||
| 37 | |||
| 38 | bins= number of bins | ||
| 39 | |||
| 40 | |||
| 41 | |||
| 42 | Optional parameters | ||
| 43 | |||
| 44 | trend=0 =0 1-D histogram | ||
| 45 | |||
| 46 | =1 2-D histogram picks on cumulate | ||
| 47 | |||
| 48 | =2 2-D histogram in trace format | ||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | clip= threshold value to drop outliers | ||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | dt= sample rate in feet or milliseconds. Defaults to | ||
| 57 | |||
| 58 | tr.dt*1e-3 | ||
| 59 | |||
| 60 | datum= header key to get datum shift if desired (e.g. to | ||
| 61 | |||
| 62 | hang from water bottom) | ||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | Notes: | ||
| 67 | |||
| 68 | trend=0 produces a two column ASCII output for use w/ gnuplot. | ||
| 69 | |||
| 70 | Extreme values are counted in the end bins. | ||
| 71 | |||
| 72 | |||
| 73 | |||
| 74 | trend=1 produces a 6 column ASCII output for use w/ gnuplot | ||
| 75 | |||
| 76 | The columns are time/depth and picks on the cumulate | ||
| 77 | |||
| 78 | at 2.28%, 15.87%, 50%, 84.13% & 97.72 of the total points | ||
| 79 | |||
| 80 | corresponding to the median and +- 1 or 2 standard deviations | ||
| 81 | |||
| 82 | for a Gaussian distribution. | ||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | trend=2 produces an SU trace panel w/ one trace per bin that | ||
| 87 | |||
| 88 | can be displayed w/ suximage, etc. | ||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | Example for plotting with xgraph: | ||
| 93 | |||
| 94 | suhistogram < data.su min=MIN max=MAX bins=BINS | | ||
| 95 | |||
| 96 | a2b n1=2 | xgraph n=BINS nplot=1 | ||
| 97 | |||
| 98 | |||
| 99 | |||
| 100 | |||
| 101 | |||
| 102 | Author: Reginald H. Beardsley 2006 rhb@acm.org | ||
| 103 | |||
| 104 | |||
| 105 | |||
| 106 | |||
| 107 | |||
| 108 | |||
| 109 | |||
| 110 | =head2 User's notes (Juan Lorenzo) | ||
| 111 | untested | ||
| 112 | |||
| 113 | =cut | ||
| 114 | |||
| 115 | |||
| 116 | =head2 CHANGES and their DATES | ||
| 117 | |||
| 118 | =cut | ||
| 119 | |||
| 120 | use Moose; | ||
| 121 | our $VERSION = '0.0.1'; | ||
| 122 | |||
| 123 | |||
| 124 | =head2 Import packages | ||
| 125 | |||
| 126 | =cut | ||
| 127 | |||
| 128 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 129 | |||
| 130 | use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin); | ||
| 131 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 132 | |||
| 133 | |||
| 134 | =head2 instantiation of packages | ||
| 135 | |||
| 136 | =cut | ||
| 137 | |||
| 138 | my $get = L_SU_global_constants->new(); | ||
| 139 | my $Project = Project_config->new(); | ||
| 140 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 141 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 142 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 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 $suhistogram = { | ||
| 157 | _bins => '', | ||
| 158 | _clip => '', | ||
| 159 | _datum => '', | ||
| 160 | _dt => '', | ||
| 161 | _max => '', | ||
| 162 | _min => '', | ||
| 163 | _n1 => '', | ||
| 164 | _trend => '', | ||
| 165 | _Step => '', | ||
| 166 | _note => '', | ||
| 167 | |||
| 168 | }; | ||
| 169 | |||
| 170 | =head2 sub Step | ||
| 171 | |||
| 172 | collects switches and assembles bash instructions | ||
| 173 | by adding the program name | ||
| 174 | |||
| 175 | =cut | ||
| 176 | |||
| 177 | sub Step { | ||
| 178 | |||
| 179 | $suhistogram->{_Step} = 'suhistogram'.$suhistogram->{_Step}; | ||
| 180 | return ( $suhistogram->{_Step} ); | ||
| 181 | |||
| 182 | } | ||
| 183 | |||
| 184 | |||
| 185 | =head2 sub note | ||
| 186 | |||
| 187 | collects switches and assembles bash instructions | ||
| 188 | by adding the program name | ||
| 189 | |||
| 190 | =cut | ||
| 191 | |||
| 192 | sub note { | ||
| 193 | |||
| 194 | $suhistogram->{_note} = 'suhistogram'.$suhistogram->{_note}; | ||
| 195 | return ( $suhistogram->{_note} ); | ||
| 196 | |||
| 197 | } | ||
| 198 | |||
| 199 | |||
| 200 | |||
| 201 | =head2 sub clear | ||
| 202 | |||
| 203 | =cut | ||
| 204 | |||
| 205 | sub clear { | ||
| 206 | |||
| 207 | $suhistogram->{_bins} = ''; | ||
| 208 | $suhistogram->{_clip} = ''; | ||
| 209 | $suhistogram->{_datum} = ''; | ||
| 210 | $suhistogram->{_dt} = ''; | ||
| 211 | $suhistogram->{_max} = ''; | ||
| 212 | $suhistogram->{_min} = ''; | ||
| 213 | $suhistogram->{_n1} = ''; | ||
| 214 | $suhistogram->{_trend} = ''; | ||
| 215 | $suhistogram->{_Step} = ''; | ||
| 216 | $suhistogram->{_note} = ''; | ||
| 217 | } | ||
| 218 | |||
| 219 | |||
| 220 | =head2 sub bins | ||
| 221 | |||
| 222 | |||
| 223 | =cut | ||
| 224 | |||
| 225 | sub bins { | ||
| 226 | |||
| 227 | my ( $self,$bins ) = @_; | ||
| 228 | if ( $bins ne $empty_string ) { | ||
| 229 | |||
| 230 | $suhistogram->{_bins} = $bins; | ||
| 231 | $suhistogram->{_note} = $suhistogram->{_note}.' bins='.$suhistogram->{_bins}; | ||
| 232 | $suhistogram->{_Step} = $suhistogram->{_Step}.' bins='.$suhistogram->{_bins}; | ||
| 233 | |||
| 234 | } else { | ||
| 235 | print("suhistogram, bins, missing bins,\n"); | ||
| 236 | } | ||
| 237 | } | ||
| 238 | |||
| 239 | |||
| 240 | =head2 sub clip | ||
| 241 | |||
| 242 | |||
| 243 | =cut | ||
| 244 | |||
| 245 | sub clip { | ||
| 246 | |||
| 247 | my ( $self,$clip ) = @_; | ||
| 248 | if ( $clip ne $empty_string ) { | ||
| 249 | |||
| 250 | $suhistogram->{_clip} = $clip; | ||
| 251 | $suhistogram->{_note} = $suhistogram->{_note}.' clip='.$suhistogram->{_clip}; | ||
| 252 | $suhistogram->{_Step} = $suhistogram->{_Step}.' clip='.$suhistogram->{_clip}; | ||
| 253 | |||
| 254 | } else { | ||
| 255 | print("suhistogram, clip, missing clip,\n"); | ||
| 256 | } | ||
| 257 | } | ||
| 258 | |||
| 259 | |||
| 260 | =head2 sub datum | ||
| 261 | |||
| 262 | |||
| 263 | =cut | ||
| 264 | |||
| 265 | sub datum { | ||
| 266 | |||
| 267 | my ( $self,$datum ) = @_; | ||
| 268 | if ( $datum ne $empty_string ) { | ||
| 269 | |||
| 270 | $suhistogram->{_datum} = $datum; | ||
| 271 | $suhistogram->{_note} = $suhistogram->{_note}.' datum='.$suhistogram->{_datum}; | ||
| 272 | $suhistogram->{_Step} = $suhistogram->{_Step}.' datum='.$suhistogram->{_datum}; | ||
| 273 | |||
| 274 | } else { | ||
| 275 | print("suhistogram, datum, missing datum,\n"); | ||
| 276 | } | ||
| 277 | } | ||
| 278 | |||
| 279 | |||
| 280 | =head2 sub dt | ||
| 281 | |||
| 282 | |||
| 283 | =cut | ||
| 284 | |||
| 285 | sub dt { | ||
| 286 | |||
| 287 | my ( $self,$dt ) = @_; | ||
| 288 | if ( $dt ne $empty_string ) { | ||
| 289 | |||
| 290 | $suhistogram->{_dt} = $dt; | ||
| 291 | $suhistogram->{_note} = $suhistogram->{_note}.' dt='.$suhistogram->{_dt}; | ||
| 292 | $suhistogram->{_Step} = $suhistogram->{_Step}.' dt='.$suhistogram->{_dt}; | ||
| 293 | |||
| 294 | } else { | ||
| 295 | print("suhistogram, dt, missing dt,\n"); | ||
| 296 | } | ||
| 297 | } | ||
| 298 | |||
| 299 | |||
| 300 | =head2 sub max | ||
| 301 | |||
| 302 | |||
| 303 | =cut | ||
| 304 | |||
| 305 | sub max { | ||
| 306 | |||
| 307 | my ( $self,$max ) = @_; | ||
| 308 | if ( $max ne $empty_string ) { | ||
| 309 | |||
| 310 | $suhistogram->{_max} = $max; | ||
| 311 | $suhistogram->{_note} = $suhistogram->{_note}.' max='.$suhistogram->{_max}; | ||
| 312 | $suhistogram->{_Step} = $suhistogram->{_Step}.' max='.$suhistogram->{_max}; | ||
| 313 | |||
| 314 | } else { | ||
| 315 | print("suhistogram, max, missing max,\n"); | ||
| 316 | } | ||
| 317 | } | ||
| 318 | |||
| 319 | |||
| 320 | =head2 sub min | ||
| 321 | |||
| 322 | |||
| 323 | =cut | ||
| 324 | |||
| 325 | sub min { | ||
| 326 | |||
| 327 | my ( $self,$min ) = @_; | ||
| 328 | if ( $min ne $empty_string ) { | ||
| 329 | |||
| 330 | $suhistogram->{_min} = $min; | ||
| 331 | $suhistogram->{_note} = $suhistogram->{_note}.' min='.$suhistogram->{_min}; | ||
| 332 | $suhistogram->{_Step} = $suhistogram->{_Step}.' min='.$suhistogram->{_min}; | ||
| 333 | |||
| 334 | } else { | ||
| 335 | print("suhistogram, min, missing min,\n"); | ||
| 336 | } | ||
| 337 | } | ||
| 338 | |||
| 339 | |||
| 340 | =head2 sub n1 | ||
| 341 | |||
| 342 | |||
| 343 | =cut | ||
| 344 | |||
| 345 | sub n1 { | ||
| 346 | |||
| 347 | my ( $self,$n1 ) = @_; | ||
| 348 | if ( $n1 ne $empty_string ) { | ||
| 349 | |||
| 350 | $suhistogram->{_n1} = $n1; | ||
| 351 | $suhistogram->{_note} = $suhistogram->{_note}.' n1='.$suhistogram->{_n1}; | ||
| 352 | $suhistogram->{_Step} = $suhistogram->{_Step}.' n1='.$suhistogram->{_n1}; | ||
| 353 | |||
| 354 | } else { | ||
| 355 | print("suhistogram, n1, missing n1,\n"); | ||
| 356 | } | ||
| 357 | } | ||
| 358 | |||
| 359 | |||
| 360 | =head2 sub trend | ||
| 361 | |||
| 362 | |||
| 363 | =cut | ||
| 364 | |||
| 365 | sub trend { | ||
| 366 | |||
| 367 | my ( $self,$trend ) = @_; | ||
| 368 | if ( $trend ne $empty_string ) { | ||
| 369 | |||
| 370 | $suhistogram->{_trend} = $trend; | ||
| 371 | $suhistogram->{_note} = $suhistogram->{_note}.' trend='.$suhistogram->{_trend}; | ||
| 372 | $suhistogram->{_Step} = $suhistogram->{_Step}.' trend='.$suhistogram->{_trend}; | ||
| 373 | |||
| 374 | } else { | ||
| 375 | print("suhistogram, trend, missing trend,\n"); | ||
| 376 | } | ||
| 377 | } | ||
| 378 | |||
| 379 | |||
| 380 | =head2 sub get_max_index | ||
| 381 | |||
| 382 | max index = number of input variables -1 | ||
| 383 | |||
| 384 | =cut | ||
| 385 | |||
| 386 | sub get_max_index { | ||
| 387 | my ($self) = @_; | ||
| 388 | my $max_index = 7; | ||
| 389 | |||
| 390 | return($max_index); | ||
| 391 | } | ||
| 392 | |||
| 393 | |||
| 394 | 1; |