« lib/App/SeismicUnixGui/sunix/transform/suifft.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/data/suunpack2.pm »
| 1 | |||
| 2 | =head1 DOCUMENTATION | ||
| 3 | |||
| 4 | =head2 SYNOPSIS | ||
| 5 | |||
| 6 | PROGRAM NAME: iSA (interactive Spectral Analysis) | ||
| 7 | AUTHOR: Juan Lorenzo | ||
| 8 | |||
| 9 | =head2 CHANGES and their DATES | ||
| 10 | |||
| 11 | DATE: August 1 2016 | ||
| 12 | Version 1.0 | ||
| 13 | read iSpectralAnalysis.config text file | ||
| 14 | Version 1.1 Nov 8 2020use Moose; | ||
| 15 | accepts NaN as undeclared gather number | ||
| 16 | |||
| 17 | =head2 DESCRIPTION | ||
| 18 | |||
| 19 | Interactively pick muting parameters | ||
| 20 | |||
| 21 | =head2 USE | ||
| 22 | |||
| 23 | =head2 Examples | ||
| 24 | |||
| 25 | =head2 SEISMIC UNIX NOTES | ||
| 26 | |||
| 27 | =head2 STEPS | ||
| 28 | |||
| 29 | 1. use the local library of the user | ||
| 30 | 1.1 bring is user variables from a local file | ||
| 31 | 2. create instances of the needed subroutines | ||
| 32 | |||
| 33 | =head2 NOTES | ||
| 34 | |||
| 35 | We are using Moose. | ||
| 36 | Moose already declares that you need debuggers turned on | ||
| 37 | so you don't need a linewlike the following: | ||
| 38 | use warnings; | ||
| 39 | |||
| 40 | USES the following classes: | ||
| 41 | sucat | ||
| 42 | and packages of subroutines | ||
| 43 | System_Variables | ||
| 44 | SeismicUnix | ||
| 45 | |||
| 46 | =cut | ||
| 47 | |||
| 48 | use Moose; | ||
| 49 | our $VERSION = '1.1.0'; | ||
| 50 | use Tk; | ||
| 51 | use Tk::Pretty; | ||
| 52 | use aliased 'App::SeismicUnixGui::big_streams::iSpectralAnalysis'; | ||
| 53 | use aliased 'App::SeismicUnixGui::sunix::shell::xk'; | ||
| 54 | use aliased 'App::SeismicUnixGui::messages::SuMessages'; | ||
| 55 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 56 | |||
| 57 | my $iSA_Tk = {_prompt => ''}; | ||
| 58 | |||
| 59 | |||
| 60 | =head2 Instantiate classes: | ||
| 61 | |||
| 62 | Create a new version of the package | ||
| 63 | with a unique name | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
| 67 | my $iSA = iSpectralAnalysis->new(); | ||
| 68 | my $xk = xk->new(); | ||
| 69 | my $message = SuMessages->new(); | ||
| 70 | my $get = L_SU_global_constants->new(); | ||
| 71 | my $var = $get->var(); | ||
| 72 | |||
| 73 | =head2 Declare variables | ||
| 74 | |||
| 75 | in local memory space | ||
| 76 | |||
| 77 | =cut | ||
| 78 | |||
| 79 | my ( $calc_rb, $exit_rb, $pick_rb, $next_rb, $saveNcont_rb ); | ||
| 80 | my $rb_value = "red"; | ||
| 81 | our $mw; | ||
| 82 | my $NaN = $var->{_NaN}; | ||
| 83 | |||
| 84 | |||
| 85 | =head2 Create Main Window | ||
| 86 | |||
| 87 | Start event-driven loop | ||
| 88 | Interaction with user | ||
| 89 | initialize values | ||
| 90 | If picks are new, show | ||
| 91 | message on how to pick data | ||
| 92 | |||
| 93 | set Message type to iSpectralAnalysis | ||
| 94 | Show instructions for first SpectralAnalysis | ||
| 95 | |||
| 96 | =cut | ||
| 97 | |||
| 98 | =head2 Decide whether to | ||
| 99 | |||
| 100 | PICK or move on to NEXT CDP | ||
| 101 | Place window near the upper left corner | ||
| 102 | of the screen | ||
| 103 | Changing geometry of the toplevel window | ||
| 104 | my $h = $mw->screenheight(); | ||
| 105 | my $w = $mw->screenwidth(); | ||
| 106 | print("width and height of screen are $w,$h\n\n"); | ||
| 107 | print("geometry of screen is $geom\n\n"); | ||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | $mw = MainWindow->new; | ||
| 112 | $mw->geometry("200x50+40+0"); | ||
| 113 | $mw->title("Spectra"); | ||
| 114 | $mw->configure( | ||
| 115 | -highlightcolor => 'blue', | ||
| 116 | |||
| 117 | #-borderwidth => $var->{_no_borderwidth}, | ||
| 118 | -background => $var->{_my_purple}, | ||
| 119 | ); | ||
| 120 | |||
| 121 | |||
| 122 | =head2 Display | ||
| 123 | |||
| 124 | data first time | ||
| 125 | |||
| 126 | =cut | ||
| 127 | |||
| 128 | print("NEW PICKS\n"); | ||
| 129 | $message->set('iSpectralAnalysis'); | ||
| 130 | $message->gather_num($NaN); | ||
| 131 | $message->instructions('firstSpectralAnalysis'); | ||
| 132 | |||
| 133 | =head2 Print | ||
| 134 | |||
| 135 | configuration | ||
| 136 | my @config = $mw->configure(); | ||
| 137 | print Pretty @config; | ||
| 138 | |||
| 139 | |||
| 140 | =cut | ||
| 141 | |||
| 142 | $calc_rb = $mw->Radiobutton( | ||
| 143 | -text => 'CALC', | ||
| 144 | -background =>, | ||
| 145 | $var->{_my_yellow}, | ||
| 146 | -value => 'calc', | ||
| 147 | -variable => \$rb_value, | ||
| 148 | -command => [ \&set_calc ] | ||
| 149 | )->pack( -side => 'left' ); | ||
| 150 | |||
| 151 | $pick_rb = $mw->Radiobutton( | ||
| 152 | -text => 'PICK', | ||
| 153 | -background => $var->{_my_yellow}, | ||
| 154 | -value => 'pick', | ||
| 155 | -variable => \$rb_value, | ||
| 156 | -command => [ \&set_pick ] | ||
| 157 | )->pack( -side => 'left' ); | ||
| 158 | |||
| 159 | |||
| 160 | $exit_rb = $mw->Radiobutton( | ||
| 161 | -text => 'EXIT', | ||
| 162 | -background =>, | ||
| 163 | $var->{_my_yellow}, | ||
| 164 | -value => 'pick', | ||
| 165 | -variable => \$rb_value, | ||
| 166 | -command => [ \&set_exit ] | ||
| 167 | )->pack( -side => 'left' ); | ||
| 168 | |||
| 169 | MainLoop; # for Tk widgets | ||
| 170 | |||
| 171 | |||
| 172 | =head2 Set the prompt | ||
| 173 | |||
| 174 | value according | ||
| 175 | to which button is pressed | ||
| 176 | then exit the MainLoop | ||
| 177 | destroy the main window after the prompt | ||
| 178 | is properly set | ||
| 179 | |||
| 180 | =cut | ||
| 181 | |||
| 182 | =head2 sub set_pick | ||
| 183 | |||
| 184 | callbacks | ||
| 185 | |||
| 186 | send gather number to $iSA | ||
| 187 | delete output of previous semblance | ||
| 188 | plus more callbacks following... | ||
| 189 | |||
| 190 | |||
| 191 | =cut | ||
| 192 | |||
| 193 | sub set_pick { | ||
| 194 | my $pick = 'pick'; | ||
| 195 | $pick_rb->configure( -state => 'normal' ); | ||
| 196 | $iSA_Tk->{_prompt} = $pick; | ||
| 197 | print("Picking...\n"); | ||
| 198 | $iSA->select(); | ||
| 199 | } | ||
| 200 | |||
| 201 | =head2 sub set_calc | ||
| 202 | |||
| 203 | -PRESS the CALC button | ||
| 204 | =cut | ||
| 205 | |||
| 206 | sub set_calc { | ||
| 207 | my $calc = 'calc'; | ||
| 208 | $calc_rb->configure( -state => 'normal' ); | ||
| 209 | $iSA_Tk->{_prompt} = $calc; | ||
| 210 | print("Calculating...\n"); | ||
| 211 | |||
| 212 | =head2 Delete | ||
| 213 | |||
| 214 | the previous display | ||
| 215 | |||
| 216 | =cut | ||
| 217 | |||
| 218 | #$xk->kill_this('suximage'); | ||
| 219 | #$xk->kill_this('suxwigb'); | ||
| 220 | |||
| 221 | $iSA->xtract(); | ||
| 222 | $iSA->analyze(); | ||
| 223 | |||
| 224 | } | ||
| 225 | |||
| 226 | =head2 sub set_exit | ||
| 227 | |||
| 228 | saying goodbye | ||
| 229 | clear old images | ||
| 230 | kill window | ||
| 231 | stop script | ||
| 232 | |||
| 233 | =cut | ||
| 234 | |||
| 235 | sub set_exit { | ||
| 236 | my $exit = 'exit'; | ||
| 237 | $exit_rb->configure( -state => 'normal' ); | ||
| 238 | $iSA_Tk->{_prompt} = $exit; | ||
| 239 | print("Good bye.\n"); | ||
| 240 | $xk->kill_this('suximage'); | ||
| 241 | $xk->kill_this('suxwigb'); | ||
| 242 | $mw->destroy() if Tk::Exists($mw); | ||
| 243 | exit 1; | ||
| 244 | } |