« lib/App/SeismicUnixGui/sunix/par/unisam.pm
↑ Summary
lib/App/SeismicUnixGui/geopsy/gpdcreport.pm »
| 1 | package App::SeismicUnixGui::geopsy::dinver; | ||
| 2 | use Moose; | ||
| 3 | our $VERSION = '0.0.1'; | ||
| 4 | |||
| 5 | =pod | ||
| 6 | |||
| 7 | =head1 DOCUMENTATION | ||
| 8 | |||
| 9 | =head2 SYNOPSIS | ||
| 10 | |||
| 11 | PROGRAM NAME: Dinver | ||
| 12 | AUTHOR: Derek Goff | ||
| 13 | DATE: May 1 2015 | ||
| 14 | DESCRIPTION: A package to use geopsy's dinver surface wave inversion program | ||
| 15 | VERSION: 0.1 | ||
| 16 | |||
| 17 | =head2 Use | ||
| 18 | |||
| 19 | =head2 Notes | ||
| 20 | |||
| 21 | This Program derives from dinver in Geopsy | ||
| 22 | '_note' keeps track of actions for use in graphics | ||
| 23 | '_Step' keeps track of actions for execution in the system | ||
| 24 | |||
| 25 | =head2 Example | ||
| 26 | |||
| 27 | =head2 Dinver Notes | ||
| 28 | |||
| 29 | Usage: dinver [OPTIONS] | ||
| 30 | |||
| 31 | Graphical user interface for Conditional Neighbourhood Algorithm | ||
| 32 | (Inversion/Optimization). | ||
| 33 | |||
| 34 | Dinver options: | ||
| 35 | -i <PLUGIN_TAG> Select inversion plugin with tag PLUGIN_TAG, skip | ||
| 36 | first dialog box. See option '-plugin-list', to get | ||
| 37 | the list of available plugins and their tags. | ||
| 38 | -env <FILE> Load Dinver environment file .dinver. With option | ||
| 39 | '-run', only the current target and | ||
| 40 | parameterization are considered, the run | ||
| 41 | description is ignored. It replaces former options | ||
| 42 | '-target' and '-param'. | ||
| 43 | -optimization Starts one inversion run with target and | ||
| 44 | parameterization specified by options '-param' and | ||
| 45 | '-target'. No graphical user interface is started. | ||
| 46 | See '-h optimization' for all options. | ||
| 47 | -importance-sampling <REPORT> | ||
| 48 | Starts one resampling run with parameterization | ||
| 49 | specified by options '-param'. REPORT is an | ||
| 50 | inversion report produced by option '-optimization' | ||
| 51 | or by graphical interface. No graphical user | ||
| 52 | interface is started. See '-h importanceSampling' | ||
| 53 | for all options. | ||
| 54 | |||
| 55 | Optimization options: | ||
| 56 | -target <TARGET> Set targets from file TARGET. It can be a .target | ||
| 57 | or a .dinver file. A .dinver file contains both | ||
| 58 | parameters and targets. Provide it to both options | ||
| 59 | '-param' and '-target'. | ||
| 60 | -param <PARAM> Set parameters from file PARAM. It can be a .param | ||
| 61 | or a .dinver file. A .dinver file contains both | ||
| 62 | parameters and targets. Provide it to both options | ||
| 63 | '-param' and '-target'. | ||
| 64 | -itmax <ITMAX> Number of iterations started by option -run | ||
| 65 | (default=50). | ||
| 66 | -ns0 <NS0> Number of initial models (default=50). | ||
| 67 | -ns <NS> Number of models generated (default=50). | ||
| 68 | -nr <NR> Number of best cells (default=50). | ||
| 69 | -seed <SEED> Set random seed to SEED. This option is for debug | ||
| 70 | only. | ||
| 71 | -o <REPORT> Ouput report (default='run.report'). To suppress | ||
| 72 | output to .report file, set option '-o' to "". | ||
| 73 | -f Force overwrite if output report already exists. | ||
| 74 | -resume If the output report file already exists, it is | ||
| 75 | imported into the parameter space before starting | ||
| 76 | the inversion. Better to set NS0 to zero in this | ||
| 77 | case. This way, it is possible to continue an | ||
| 78 | existing inversion adding new iterations. | ||
| 79 | |||
| 80 | Importance sampling options: | ||
| 81 | -dof <DOF> Set degrees of freedom for conversion from misfit | ||
| 82 | to a posteriori probability function. | ||
| 83 | -param <PARAM> Set parameters from file PARAM. It can be a .param | ||
| 84 | or a .dinver file. A .dinver file contains both | ||
| 85 | parameters and targets. Provide it to both options | ||
| 86 | '-param' and '-target'. | ||
| 87 | -ns <NS> Number of models generated (default=5000). | ||
| 88 | -seed <SEED> Set random seed to SEED. This option is for debug | ||
| 89 | only. | ||
| 90 | -o <REPORT> Ouput report (default='run.report'). To suppress | ||
| 91 | output to .report file, set option '-o' to "". | ||
| 92 | -f Force overwrite if output report already exists. | ||
| 93 | -resume If the output report file already exists, add | ||
| 94 | generated models without warning. | ||
| 95 | |||
| 96 | Debug options: | ||
| 97 | -debug-stream Debug mode (redirect all logs to stdout) | ||
| 98 | -plugin-list Print the list of a available plugins | ||
| 99 | -clear-plugins Reset the list of a available plugins | ||
| 100 | |||
| 101 | Qt options: | ||
| 102 | -nograb Tells Qt that it must never grab the mouse or the | ||
| 103 | keyboard | ||
| 104 | -dograb Running under a debugger can cause an implicit | ||
| 105 | -nograb, use -dograb to override | ||
| 106 | -sync Switches to synchronous mode for debugging | ||
| 107 | -style <style> Sets the application GUI style. Possible values are | ||
| 108 | motif | ||
| 109 | windows | ||
| 110 | platinum | ||
| 111 | If you compiled Qt with additional styles or have | ||
| 112 | additional styles as plugins these will be | ||
| 113 | available to the -style command line option | ||
| 114 | -session <session> Restore the application from an earlier session | ||
| 115 | -reverse Sets the application's layout direction to right to | ||
| 116 | left | ||
| 117 | -display <display> Sets the X display (default is $DISPLAY) | ||
| 118 | -geometry <geometry> Sets the client geometry of the first window that | ||
| 119 | is shown | ||
| 120 | -fn, -font <font> Defines the application font. The font should be | ||
| 121 | specified using an X logical font description | ||
| 122 | -bg, -background <color> Sets the default background color and an | ||
| 123 | application palette (light and dark shades are | ||
| 124 | calculated) | ||
| 125 | -fg, -foreground <color> Sets the default foreground color | ||
| 126 | -btn, -button <color> Sets the default button color | ||
| 127 | -name <name> Sets the application name | ||
| 128 | -title <title> Sets the application title | ||
| 129 | -visual TrueColor Forces the application to use a TrueColor visual on | ||
| 130 | an 8-bit display | ||
| 131 | -ncols <count> Limits the number of colors allocated in the color | ||
| 132 | cube on an 8-bit display, if the application is | ||
| 133 | using the QApplication::ManyColor color | ||
| 134 | specification. If count is 216 then a 6x6x6 color | ||
| 135 | cube is used (i.e. 6 levels of red, 6 of green, and | ||
| 136 | 6 of blue); for other values, a cube approximately | ||
| 137 | proportional to a 2x3x1 cube is used | ||
| 138 | -cmap <count> Causes the application to install a private color | ||
| 139 | map on an 8-bit display | ||
| 140 | -im <XIM server> Sets the input method server (equivalent to setting | ||
| 141 | the XMODIFIERS environment variable) | ||
| 142 | -noxim Disables the input method framework ("no X input | ||
| 143 | method") | ||
| 144 | -inputstyle <inputstyle> Defines how the input is inserted into the given | ||
| 145 | widget. Possible values are: | ||
| 146 | onTheSpot makes the input appear directly in the | ||
| 147 | widget | ||
| 148 | offTheSpot | ||
| 149 | overTheSpot makes the input appear in a box | ||
| 150 | floating over the widget | ||
| 151 | |||
| 152 | Generic options: | ||
| 153 | -h, -help [<SECTION>] Shows help. SECTION may be empty or: all, html, | ||
| 154 | latex, generic, debug, debug, dinver, | ||
| 155 | importanceSampling, optimization, qt | ||
| 156 | -version Shows version information | ||
| 157 | -app-version Shows short version information | ||
| 158 | -j, -jobs <N> Allows a maximum of N simulteneous jobs for | ||
| 159 | parallel computations (default=8). | ||
| 160 | |||
| 161 | Debug options: | ||
| 162 | -nobugreport Does not generate bug reports in case of error. | ||
| 163 | -reportbug Starts bug report dialog, information about bug is | ||
| 164 | passed through stdin. This option is used | ||
| 165 | internally to report bugs if option -nobugreportreport is | ||
| 166 | not specified. | ||
| 167 | -reportint Starts bug report dialog, information about | ||
| 168 | interruption is passed through stdin. This option | ||
| 169 | is used internally to report interruptions if | ||
| 170 | option -nobugreport is not specified. | ||
| 171 | |||
| 172 | See also: | ||
| 173 | More information at http://www.geopsy.org | ||
| 174 | |||
| 175 | Authors: | ||
| 176 | Marc Wathelet | ||
| 177 | Marc Wathelet (LGIT, Grenoble, France) | ||
| 178 | Marc Wathelet (ULg, Liège, Belgium) | ||
| 179 | |||
| 180 | =cut | ||
| 181 | |||
| 182 | my $Dinver = { | ||
| 183 | _Step => '', | ||
| 184 | _note => '', | ||
| 185 | _nobugreport => '', | ||
| 186 | _plug => '', | ||
| 187 | _target => '', | ||
| 188 | _param => '', | ||
| 189 | _itmax => '', | ||
| 190 | _ns0 => '', | ||
| 191 | _ns => '', | ||
| 192 | _nr => '', | ||
| 193 | _output => '', | ||
| 194 | _force => '', | ||
| 195 | _resume => '', | ||
| 196 | }; | ||
| 197 | |||
| 198 | =pod | ||
| 199 | |||
| 200 | =head1 Description of Subroutines | ||
| 201 | |||
| 202 | =head2 Subroutine clear | ||
| 203 | |||
| 204 | Sets all variable strings to '' (nothing) | ||
| 205 | |||
| 206 | =cut | ||
| 207 | |||
| 208 | sub clear { | ||
| 209 | $Dinver->{_Step} = ''; | ||
| 210 | $Dinver->{_nobugreport} = ''; | ||
| 211 | $Dinver->{_note} = ''; | ||
| 212 | $Dinver->{_plug} = ''; | ||
| 213 | $Dinver->{_target} = ''; | ||
| 214 | $Dinver->{_param} = ''; | ||
| 215 | $Dinver->{_itmax} = ''; | ||
| 216 | $Dinver->{_ns0} = ''; | ||
| 217 | $Dinver->{_ns} = ''; | ||
| 218 | $Dinver->{_nr} = ''; | ||
| 219 | $Dinver->{_output} = ''; | ||
| 220 | $Dinver->{_force} = ''; | ||
| 221 | $Dinver->{_resume} = ''; | ||
| 222 | } | ||
| 223 | |||
| 224 | =head2 Subroutine nobugreport | ||
| 225 | |||
| 226 | no error messages out during running | ||
| 227 | |||
| 228 | =cut | ||
| 229 | |||
| 230 | sub nobugreport { | ||
| 231 | my ( $sub, $nobugreport ) = @_; | ||
| 232 | $Dinver->{_nobugreport} = $nobugreport if defined($nobugreport); | ||
| 233 | $Dinver->{_note} = | ||
| 234 | $Dinver->{_note} . ' -nobugreport ' . $Dinver->{_nobugreport}; | ||
| 235 | $Dinver->{_Step} = | ||
| 236 | $Dinver->{_Step} . ' -nobugreport ' . $Dinver->{_nobugreport}; | ||
| 237 | } | ||
| 238 | |||
| 239 | =pod | ||
| 240 | |||
| 241 | =head2 Subroutine Plug | ||
| 242 | |||
| 243 | Designates one inversion to run: | ||
| 244 | -optimization | ||
| 245 | Select Dinver plugin to use | ||
| 246 | Options are: | ||
| 247 | Surface Wave Inversion (tag = DispersionCurve) | ||
| 248 | External Forward Computation (tag = DinverExt) | ||
| 249 | Matlab Forward Computation (tag = DinverMatlab) | ||
| 250 | |||
| 251 | =cut | ||
| 252 | |||
| 253 | sub plug { | ||
| 254 | my ( $sub, $plug ) = @_; | ||
| 255 | $Dinver->{_plug} = $plug if defined($plug); | ||
| 256 | $Dinver->{_note} = | ||
| 257 | $Dinver->{_note} . ' -i ' . $Dinver->{_plug} . ' -optimization '; | ||
| 258 | $Dinver->{_Step} = | ||
| 259 | $Dinver->{_Step} . ' -i ' . $Dinver->{_plug} . ' -optimization '; | ||
| 260 | } | ||
| 261 | |||
| 262 | #### | ||
| 263 | |||
| 264 | =pod | ||
| 265 | |||
| 266 | =head2 Subroutine target | ||
| 267 | |||
| 268 | Filename of Dispersion Curve to be inverted | ||
| 269 | |||
| 270 | =cut | ||
| 271 | |||
| 272 | sub target { | ||
| 273 | my ( $sub, $target ) = @_; | ||
| 274 | $Dinver->{_target} = $target if defined($target); | ||
| 275 | $Dinver->{_note} = $Dinver->{_note} . ' -target ' . $Dinver->{_target}; | ||
| 276 | $Dinver->{_Step} = $Dinver->{_Step} . ' -target ' . $Dinver->{_target}; | ||
| 277 | } | ||
| 278 | |||
| 279 | #### | ||
| 280 | |||
| 281 | =pod | ||
| 282 | |||
| 283 | =head2 Subroutine Param | ||
| 284 | |||
| 285 | Choose parameter file to constrain inversion | ||
| 286 | Constrained variables consist of thickness, Vs, Vp, | ||
| 287 | poisson's ratio, & density | ||
| 288 | |||
| 289 | =cut | ||
| 290 | |||
| 291 | sub param { | ||
| 292 | my ( $sub, $param ) = @_; | ||
| 293 | $Dinver->{_param} = $param if defined($param); | ||
| 294 | $Dinver->{_note} = $Dinver->{_note} . ' -param ' . $Dinver->{_param}; | ||
| 295 | $Dinver->{_Step} = $Dinver->{_Step} . ' -param ' . $Dinver->{_param}; | ||
| 296 | } | ||
| 297 | |||
| 298 | #### | ||
| 299 | |||
| 300 | =pod | ||
| 301 | |||
| 302 | =head2 Subroutine itmax | ||
| 303 | |||
| 304 | Number of iterations for inversion to run | ||
| 305 | 0 iterations = Pure Monte Carlo | ||
| 306 | |||
| 307 | =cut | ||
| 308 | |||
| 309 | sub itmax { | ||
| 310 | my ( $sub, $itmax ) = @_; | ||
| 311 | $Dinver->{_itmax} = $itmax if defined($itmax); | ||
| 312 | $Dinver->{_note} = $Dinver->{_note} . ' -itmax ' . $Dinver->{_itmax}; | ||
| 313 | $Dinver->{_Step} = $Dinver->{_Step} . ' -itmax ' . $Dinver->{_itmax}; | ||
| 314 | } | ||
| 315 | |||
| 316 | #### | ||
| 317 | |||
| 318 | =pod | ||
| 319 | |||
| 320 | =head2 Subroutine ns0 | ||
| 321 | |||
| 322 | Number of random initial models | ||
| 323 | created before first iteration. | ||
| 324 | Default = 50 | ||
| 325 | |||
| 326 | =cut | ||
| 327 | |||
| 328 | sub ns0 { | ||
| 329 | my ( $sub, $ns0 ) = @_; | ||
| 330 | $Dinver->{_ns0} = $ns0 if defined($ns0); | ||
| 331 | $Dinver->{_note} = $Dinver->{_note} . ' -ns0 ' . $Dinver->{_ns0}; | ||
| 332 | $Dinver->{_Step} = $Dinver->{_Step} . ' -ns0 ' . $Dinver->{_ns0}; | ||
| 333 | } | ||
| 334 | |||
| 335 | #### | ||
| 336 | |||
| 337 | =pod | ||
| 338 | |||
| 339 | =head2 Subroutine ns | ||
| 340 | |||
| 341 | Number of models generated for each iteration. | ||
| 342 | Default = 50 | ||
| 343 | |||
| 344 | =cut | ||
| 345 | |||
| 346 | sub ns { | ||
| 347 | my ( $sub, $ns ) = @_; | ||
| 348 | $Dinver->{_ns} = $ns if defined($ns); | ||
| 349 | $Dinver->{_note} = $Dinver->{_note} . ' -ns ' . $Dinver->{_ns}; | ||
| 350 | $Dinver->{_Step} = $Dinver->{_Step} . ' -ns ' . $Dinver->{_ns}; | ||
| 351 | } | ||
| 352 | |||
| 353 | #### | ||
| 354 | |||
| 355 | =pod | ||
| 356 | |||
| 357 | =head2 Subroutine nr | ||
| 358 | |||
| 359 | Number of best solution models to consider when resampling | ||
| 360 | (higher is more explorative) | ||
| 361 | Default = 50 | ||
| 362 | |||
| 363 | =cut | ||
| 364 | |||
| 365 | sub nr { | ||
| 366 | my ( $sub, $nr ) = @_; | ||
| 367 | $Dinver->{_nr} = $nr if defined($nr); | ||
| 368 | $Dinver->{_note} = $Dinver->{_note} . ' -nr ' . $Dinver->{_nr}; | ||
| 369 | $Dinver->{_Step} = $Dinver->{_Step} . ' -nr ' . $Dinver->{_nr}; | ||
| 370 | } | ||
| 371 | |||
| 372 | =pod | ||
| 373 | |||
| 374 | =head2 Subroutine output | ||
| 375 | |||
| 376 | Filename for inversion report | ||
| 377 | Default = 'run.report' (may add run #) | ||
| 378 | set option -o to "" (nothing) to suppress report | ||
| 379 | |||
| 380 | =cut | ||
| 381 | |||
| 382 | sub output { | ||
| 383 | my ( $sub, $output ) = @_; | ||
| 384 | $Dinver->{_output} = $output if defined($output); | ||
| 385 | $Dinver->{_note} = $Dinver->{_note} . ' -o ' . $Dinver->{_output}; | ||
| 386 | $Dinver->{_Step} = $Dinver->{_Step} . ' -o ' . $Dinver->{_output}; | ||
| 387 | } | ||
| 388 | |||
| 389 | =pod | ||
| 390 | |||
| 391 | =head2 Subroutine force | ||
| 392 | |||
| 393 | If output file already exists, overwrite | ||
| 394 | |||
| 395 | =cut | ||
| 396 | |||
| 397 | sub force { | ||
| 398 | my ( $sub, $force ) = @_; | ||
| 399 | $Dinver->{_force} = ' -f ' if defined($force); | ||
| 400 | $Dinver->{_note} = $Dinver->{_note} . $Dinver->{_force}; | ||
| 401 | $Dinver->{_Step} = $Dinver->{_Step} . $Dinver->{_force}; | ||
| 402 | } | ||
| 403 | |||
| 404 | =pod | ||
| 405 | |||
| 406 | =head2 Subroutine resume | ||
| 407 | |||
| 408 | If output file already exists, it is improted before starting inversion | ||
| 409 | Safer to set ns0 -> 0 for this case | ||
| 410 | Adds new iterations to existing inversion | ||
| 411 | |||
| 412 | =cut | ||
| 413 | |||
| 414 | sub resume { | ||
| 415 | my ( $sub, $resume ) = @_; | ||
| 416 | $Dinver->{_resume} = $resume if defined($resume); | ||
| 417 | $Dinver->{_note} = $Dinver->{_note} . ' -resume ' . $Dinver->{_resume}; | ||
| 418 | $Dinver->{_Step} = $Dinver->{_Step} . ' -resume ' . $Dinver->{_resume}; | ||
| 419 | } | ||
| 420 | |||
| 421 | =pod | ||
| 422 | |||
| 423 | =head2 Subroutine Step | ||
| 424 | |||
| 425 | Keeps track of actions for execution in the system | ||
| 426 | |||
| 427 | =cut | ||
| 428 | |||
| 429 | sub Step { | ||
| 430 | $Dinver->{_Step} = 'dinver' . $Dinver->{_Step}; | ||
| 431 | return $Dinver->{_Step}; | ||
| 432 | } | ||
| 433 | |||
| 434 | =pod | ||
| 435 | |||
| 436 | =head2 Subroutine note | ||
| 437 | |||
| 438 | Keeps track of actions for possible use in graphics | ||
| 439 | |||
| 440 | =cut | ||
| 441 | |||
| 442 | sub note { | ||
| 443 | $Dinver->{_note} = $Dinver->{_note}; | ||
| 444 | return $Dinver->{_note}; | ||
| 445 | } | ||
| 446 | |||
| 447 | =pod | ||
| 448 | |||
| 449 | =head3 Warnings for programmers | ||
| 450 | |||
| 451 | packages must end with | ||
| 452 | 1; | ||
| 453 | |||
| 454 | =cut | ||
| 455 | |||
| 456 | 1; |