« lib/App/SeismicUnixGui/sunix/model/susynvxzcs.pm
↑ Summary
lib/App/SeismicUnixGui/geopsy/gpviewdcreport.pm »
| 1 | package App::SeismicUnixGui::geopsy::gphistogram; | ||
| 2 | use Moose; | ||
| 3 | our $VERSION = '0.0.1'; | ||
| 4 | |||
| 5 | =pod | ||
| 6 | |||
| 7 | =head1 DOCUMENTATION | ||
| 8 | |||
| 9 | =head2 SYNOPSIS | ||
| 10 | |||
| 11 | PROGRAM NAME: Gphistogram | ||
| 12 | AUTHOR: Derek Goff | ||
| 13 | DATE: May 5 2015 | ||
| 14 | DESCRIPTION: A package to use geopsy's gphistogram function | ||
| 15 | to calculate average Vs curve and standard | ||
| 16 | deviation. | ||
| 17 | VERSION: 0.1 | ||
| 18 | |||
| 19 | =head2 Use | ||
| 20 | |||
| 21 | =head2 Notes | ||
| 22 | |||
| 23 | This Program derives from dinver in Geopsy | ||
| 24 | '_note' keeps track of actions for use in graphics | ||
| 25 | '_Step' keeps track of actions for execution in the system | ||
| 26 | |||
| 27 | =head2 Example | ||
| 28 | |||
| 29 | =head2 Gphistogram Notes | ||
| 30 | |||
| 31 | Usage: gphistogram [OPTIONS] | ||
| 32 | |||
| 33 | From two columns (x, y) provided through stdin, it produces a grid and count the number of hits in each | ||
| 34 | cell. A median or mean curve can be directly computed or the histogram is plotted. Editing and | ||
| 35 | filtering is then possible. | ||
| 36 | |||
| 37 | gphistogram options: | ||
| 38 | -mean Output mean curve and exit. | ||
| 39 | -median Output median curve and exit. | ||
| 40 | -grid Output grid values and exit. | ||
| 41 | -x-sampling <SAMPLING> Defines the X sampling type: | ||
| 42 | linear regular sampling (default) | ||
| 43 | log regular sampling on a log scale | ||
| 44 | inversed regular sampling on an inversed | ||
| 45 | -x-min <MIN> Minimum of range for X axis (default=deduced from data) | ||
| 46 | -x-max <MAX> Maximum of range for X axis (default=deduced from data) | ||
| 47 | -x-count <COUNT> Number of samples along X (default=100) | ||
| 48 | -y-sampling <SAMPLING> Defines the Y sampling type: | ||
| 49 | linear regular sampling (default) | ||
| 50 | log regular sampling on a log scale | ||
| 51 | inversed regular sampling on an inversed | ||
| 52 | -y-min <MIN> Minimum of range for Y axis (default=deduced from data) | ||
| 53 | -y-max <MAX> Maximum of range for Y axis (default=deduced from data) | ||
| 54 | -y-count <COUNT> Number of samples along Y (default=100) | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | my $Gphistogram = { | ||
| 59 | _Step => '', | ||
| 60 | _note => '', | ||
| 61 | _mean => '', | ||
| 62 | _median => '', | ||
| 63 | _grid => '', | ||
| 64 | _xsample => '', | ||
| 65 | _xmin => '', | ||
| 66 | _xmax => '', | ||
| 67 | _xcount => '', | ||
| 68 | _ysample => '', | ||
| 69 | _ymin => '', | ||
| 70 | _ymax => '', | ||
| 71 | _ycount => '', | ||
| 72 | _file => '', | ||
| 73 | }; | ||
| 74 | |||
| 75 | =pod | ||
| 76 | |||
| 77 | =head1 Description of Subroutines | ||
| 78 | |||
| 79 | =head2 Subroutine clear | ||
| 80 | |||
| 81 | Sets all variable strings to '' (nothing) | ||
| 82 | |||
| 83 | =cut | ||
| 84 | |||
| 85 | sub clear { | ||
| 86 | $Gphistogram->{_Step} = ''; | ||
| 87 | $Gphistogram->{_note} = ''; | ||
| 88 | $Gphistogram->{_mean} = ''; | ||
| 89 | $Gphistogram->{_median} = ''; | ||
| 90 | $Gphistogram->{_grid} = ''; | ||
| 91 | $Gphistogram->{_xsample} = ''; | ||
| 92 | $Gphistogram->{_xmin} = ''; | ||
| 93 | $Gphistogram->{_xmax} = ''; | ||
| 94 | $Gphistogram->{_xcount} = ''; | ||
| 95 | $Gphistogram->{_ysample} = ''; | ||
| 96 | $Gphistogram->{_ymin} = ''; | ||
| 97 | $Gphistogram->{_ymax} = ''; | ||
| 98 | $Gphistogram->{_ycount} = ''; | ||
| 99 | $Gphistogram->{_file} = ''; | ||
| 100 | } | ||
| 101 | |||
| 102 | #### | ||
| 103 | |||
| 104 | =pod | ||
| 105 | |||
| 106 | =head2 Subroutine mean | ||
| 107 | |||
| 108 | Output mean curve and exit | ||
| 109 | |||
| 110 | =cut | ||
| 111 | |||
| 112 | sub mean { | ||
| 113 | my ( $sub, $mean ) = @_; | ||
| 114 | $Gphistogram->{_mean} = $mean if defined($mean); | ||
| 115 | $Gphistogram->{_note} = | ||
| 116 | $Gphistogram->{_note} . ' -mean ' . $Gphistogram->{_mean}; | ||
| 117 | $Gphistogram->{_Step} = | ||
| 118 | $Gphistogram->{_Step} . ' -mean ' . $Gphistogram->{_mean}; | ||
| 119 | } | ||
| 120 | |||
| 121 | #### | ||
| 122 | |||
| 123 | =pod | ||
| 124 | |||
| 125 | =head2 Subroutine median | ||
| 126 | |||
| 127 | Output median curve and exit | ||
| 128 | |||
| 129 | =cut | ||
| 130 | |||
| 131 | sub median { | ||
| 132 | my ( $sub, $median ) = @_; | ||
| 133 | $Gphistogram->{_median} = $median if defined($median); | ||
| 134 | $Gphistogram->{_note} = | ||
| 135 | $Gphistogram->{_note} . ' -median ' . $Gphistogram->{_median}; | ||
| 136 | $Gphistogram->{_Step} = | ||
| 137 | $Gphistogram->{_Step} . ' -median ' . $Gphistogram->{_median}; | ||
| 138 | } | ||
| 139 | |||
| 140 | #### | ||
| 141 | |||
| 142 | =pod | ||
| 143 | |||
| 144 | =head2 Subroutine grid | ||
| 145 | |||
| 146 | Output grid values and exit | ||
| 147 | |||
| 148 | =cut | ||
| 149 | |||
| 150 | sub grid { | ||
| 151 | my ( $sub, $grid ) = @_; | ||
| 152 | $Gphistogram->{_grid} = $grid if defined($grid); | ||
| 153 | $Gphistogram->{_note} = | ||
| 154 | $Gphistogram->{_note} . ' -grid ' . $Gphistogram->{_grid}; | ||
| 155 | $Gphistogram->{_Step} = | ||
| 156 | $Gphistogram->{_Step} . ' -grid ' . $Gphistogram->{_grid}; | ||
| 157 | } | ||
| 158 | |||
| 159 | #### | ||
| 160 | |||
| 161 | =pod | ||
| 162 | |||
| 163 | =head2 Subroutine xsample | ||
| 164 | |||
| 165 | Define X sampling type: | ||
| 166 | linear (default), log, or inversed | ||
| 167 | |||
| 168 | =cut | ||
| 169 | |||
| 170 | sub xsample { | ||
| 171 | my ( $sub, $xsample ) = @_; | ||
| 172 | $Gphistogram->{_xsample} = $xsample if defined($xsample); | ||
| 173 | $Gphistogram->{_note} = | ||
| 174 | $Gphistogram->{_note} . ' -x-sampling ' . $Gphistogram->{_xsample}; | ||
| 175 | $Gphistogram->{_Step} = | ||
| 176 | $Gphistogram->{_Step} . ' -x-sampling ' . $Gphistogram->{_xsample}; | ||
| 177 | } | ||
| 178 | |||
| 179 | #### | ||
| 180 | |||
| 181 | =pod | ||
| 182 | |||
| 183 | =head2 Subroutine xmin | ||
| 184 | |||
| 185 | Minimum range for X axis (default from data) | ||
| 186 | |||
| 187 | =cut | ||
| 188 | |||
| 189 | sub xmin { | ||
| 190 | my ( $sub, $xmin ) = @_; | ||
| 191 | $Gphistogram->{_xmin} = $xmin if defined($xmin); | ||
| 192 | $Gphistogram->{_note} = | ||
| 193 | $Gphistogram->{_note} . ' -x-min ' . $Gphistogram->{_xmin}; | ||
| 194 | $Gphistogram->{_Step} = | ||
| 195 | $Gphistogram->{_Step} . ' -x-min ' . $Gphistogram->{_xmin}; | ||
| 196 | } | ||
| 197 | |||
| 198 | #### | ||
| 199 | |||
| 200 | =pod | ||
| 201 | |||
| 202 | =head2 Subroutine xmax | ||
| 203 | |||
| 204 | Maximum range for X axis (default from data) | ||
| 205 | |||
| 206 | =cut | ||
| 207 | |||
| 208 | sub xmax { | ||
| 209 | my ( $sub, $xmax ) = @_; | ||
| 210 | $Gphistogram->{_xmax} = $xmax if defined($xmax); | ||
| 211 | $Gphistogram->{_note} = | ||
| 212 | $Gphistogram->{_note} . ' -x-max ' . $Gphistogram->{_xmax}; | ||
| 213 | $Gphistogram->{_Step} = | ||
| 214 | $Gphistogram->{_Step} . ' -x-max ' . $Gphistogram->{_xmax}; | ||
| 215 | } | ||
| 216 | |||
| 217 | #### | ||
| 218 | |||
| 219 | =pod | ||
| 220 | |||
| 221 | =head2 Subroutine xcount | ||
| 222 | |||
| 223 | Number of samples along X (default=100) | ||
| 224 | |||
| 225 | =cut | ||
| 226 | |||
| 227 | sub xcount { | ||
| 228 | my ( $sub, $xcount ) = @_; | ||
| 229 | $Gphistogram->{_xcount} = $xcount if defined($xcount); | ||
| 230 | $Gphistogram->{_note} = | ||
| 231 | $Gphistogram->{_note} . ' -x-count ' . $Gphistogram->{_xcount}; | ||
| 232 | $Gphistogram->{_Step} = | ||
| 233 | $Gphistogram->{_Step} . ' -x-count ' . $Gphistogram->{_xcount}; | ||
| 234 | } | ||
| 235 | |||
| 236 | #### | ||
| 237 | |||
| 238 | =pod | ||
| 239 | |||
| 240 | =head2 Subroutine ysample | ||
| 241 | |||
| 242 | Define Y sampling type: | ||
| 243 | linear (default), log, or inversed | ||
| 244 | |||
| 245 | |||
| 246 | =cut | ||
| 247 | |||
| 248 | sub ysample { | ||
| 249 | my ( $sub, $ysample ) = @_; | ||
| 250 | $Gphistogram->{_ysample} = $ysample if defined($ysample); | ||
| 251 | $Gphistogram->{_note} = | ||
| 252 | $Gphistogram->{_note} . ' -y-sampling ' . $Gphistogram->{_ysample}; | ||
| 253 | $Gphistogram->{_Step} = | ||
| 254 | $Gphistogram->{_Step} . ' -y-sampling ' . $Gphistogram->{_ysample}; | ||
| 255 | } | ||
| 256 | |||
| 257 | #### | ||
| 258 | |||
| 259 | =pod | ||
| 260 | |||
| 261 | =head2 Subroutine ymin | ||
| 262 | |||
| 263 | Minimum range for Y axis (default from data) | ||
| 264 | |||
| 265 | =cut | ||
| 266 | |||
| 267 | sub ymin { | ||
| 268 | my ( $sub, $ymin ) = @_; | ||
| 269 | $Gphistogram->{_ymin} = $ymin if defined($ymin); | ||
| 270 | $Gphistogram->{_note} = | ||
| 271 | $Gphistogram->{_note} . ' -y-min ' . $Gphistogram->{_ymin}; | ||
| 272 | $Gphistogram->{_Step} = | ||
| 273 | $Gphistogram->{_Step} . ' -y-min ' . $Gphistogram->{_ymin}; | ||
| 274 | } | ||
| 275 | |||
| 276 | #### | ||
| 277 | |||
| 278 | =pod | ||
| 279 | |||
| 280 | =head2 Subroutine ymax | ||
| 281 | |||
| 282 | Maximum range for Y axis (default from data) | ||
| 283 | |||
| 284 | =cut | ||
| 285 | |||
| 286 | sub ymax { | ||
| 287 | my ( $sub, $ymax ) = @_; | ||
| 288 | $Gphistogram->{_ymax} = $ymax if defined($ymax); | ||
| 289 | $Gphistogram->{_note} = | ||
| 290 | $Gphistogram->{_note} . ' -y-max ' . $Gphistogram->{_ymax}; | ||
| 291 | $Gphistogram->{_Step} = | ||
| 292 | $Gphistogram->{_Step} . ' -y-max ' . $Gphistogram->{_ymax}; | ||
| 293 | } | ||
| 294 | |||
| 295 | #### | ||
| 296 | |||
| 297 | =pod | ||
| 298 | |||
| 299 | =head2 Subroutine ycount | ||
| 300 | |||
| 301 | Number of samples along Y (default=100) | ||
| 302 | |||
| 303 | =cut | ||
| 304 | |||
| 305 | sub ycount { | ||
| 306 | my ( $sub, $ycount ) = @_; | ||
| 307 | $Gphistogram->{_ycount} = $ycount if defined($ycount); | ||
| 308 | $Gphistogram->{_note} = | ||
| 309 | $Gphistogram->{_note} . ' -y-count ' . $Gphistogram->{_ycount}; | ||
| 310 | $Gphistogram->{_Step} = | ||
| 311 | $Gphistogram->{_Step} . ' -y-count ' . $Gphistogram->{_ycount}; | ||
| 312 | } | ||
| 313 | |||
| 314 | #### | ||
| 315 | |||
| 316 | =pod | ||
| 317 | |||
| 318 | =head2 Subroutine file | ||
| 319 | |||
| 320 | Define Input file | ||
| 321 | |||
| 322 | =cut | ||
| 323 | |||
| 324 | sub file { | ||
| 325 | my ( $sub, $file ) = @_; | ||
| 326 | $Gphistogram->{_file} = $file if defined($file); | ||
| 327 | $Gphistogram->{_note} = | ||
| 328 | $Gphistogram->{_note} . ' ' . $Gphistogram->{_file}; | ||
| 329 | $Gphistogram->{_Step} = | ||
| 330 | $Gphistogram->{_Step} . ' ' . $Gphistogram->{_file}; | ||
| 331 | } | ||
| 332 | |||
| 333 | #### | ||
| 334 | |||
| 335 | =pod | ||
| 336 | |||
| 337 | =head2 Subroutine Step | ||
| 338 | |||
| 339 | Keeps track of actions for execution in the system | ||
| 340 | |||
| 341 | =cut | ||
| 342 | |||
| 343 | sub Step { | ||
| 344 | $Gphistogram->{_Step} = 'gphistogram' . $Gphistogram->{_Step}; | ||
| 345 | return $Gphistogram->{_Step}; | ||
| 346 | } | ||
| 347 | |||
| 348 | #### | ||
| 349 | |||
| 350 | =pod | ||
| 351 | |||
| 352 | =head2 Subroutine note | ||
| 353 | |||
| 354 | Keeps track of actions for possible use in graphics | ||
| 355 | |||
| 356 | =cut | ||
| 357 | |||
| 358 | sub note { | ||
| 359 | $Gphistogram->{_note} = $Gphistogram->{_note}; | ||
| 360 | return $Gphistogram->{_note}; | ||
| 361 | } | ||
| 362 | |||
| 363 | =pod | ||
| 364 | |||
| 365 | =head3 Warnings for programmers | ||
| 366 | |||
| 367 | packages must end with | ||
| 368 | 1; | ||
| 369 | |||
| 370 | =cut | ||
| 371 | |||
| 372 | 1; |