« lib/App/SeismicUnixGui/specs/shapeNcut/sugain_spec.pm
↑ Summary
lib/App/SeismicUnixGui/big_streams/iSave_mute_picks.pm »
| 1 | package App::SeismicUnixGui::specs::shell::xk_spec; | ||
| 2 | use Moose; | ||
| 3 | our $VERSION = '0.0.1'; | ||
| 4 | |||
| 5 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 6 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 7 | use aliased 'App::SeismicUnixGui::sunix::shell::xk'; | ||
| 8 | use App::SeismicUnixGui::misc::SeismicUnix qw($su $suffix_su); | ||
| 9 | |||
| 10 | my $get = L_SU_global_constants->new(); | ||
| 11 | my $var = $get->var(); | ||
| 12 | my $file_dialog_type = $get->file_dialog_type_href(); | ||
| 13 | my $flow_type = $get->flow_type_href(); | ||
| 14 | |||
| 15 | my $empty_string = $var->{_empty_string}; | ||
| 16 | my $true = $var->{_true}; | ||
| 17 | my $false = $var->{_false}; | ||
| 18 | |||
| 19 | my $Project = Project_config->new(); | ||
| 20 | my $xk = xk->new(); | ||
| 21 | |||
| 22 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); # output data directory | ||
| 23 | my $PL_SEISMIC = $Project->PL_SEISMIC(); | ||
| 24 | my $max_index = 0; | ||
| 25 | |||
| 26 | my $xk_spec = { | ||
| 27 | _CONFIG => $PL_SEISMIC, | ||
| 28 | _DATA_DIR_IN => $DATA_SEISMIC_SU, | ||
| 29 | _DATA_DIR_OUT => $DATA_SEISMIC_SU, | ||
| 30 | _binding_index_aref => '', | ||
| 31 | _suffix_type_in => $su, | ||
| 32 | _data_suffix_in => $suffix_su, | ||
| 33 | _suffix_type_out => $su, | ||
| 34 | _data_suffix_out => $suffix_su, | ||
| 35 | _file_dialog_type_aref => '', | ||
| 36 | _flow_type_aref => '', | ||
| 37 | _has_infile => $false, | ||
| 38 | _has_pipe_in => $false, | ||
| 39 | _has_pipe_out => $false, | ||
| 40 | _has_redirect_in => $false, | ||
| 41 | _has_redirect_out => $false, | ||
| 42 | _has_subin_in => $false, | ||
| 43 | _has_subin_out => $false, | ||
| 44 | _is_data => $false, | ||
| 45 | _is_first_of_2 => $false, | ||
| 46 | _is_first_of_3or_more => $false, | ||
| 47 | _is_first_of_4or_more => $false, | ||
| 48 | _is_last_of_2 => $false, | ||
| 49 | _is_last_of_3or_more => $false, | ||
| 50 | _is_last_of_4or_more => $false, | ||
| 51 | _is_suprog => $false, | ||
| 52 | _is_superflow => $false, | ||
| 53 | _max_index => $max_index, | ||
| 54 | }; | ||
| 55 | |||
| 56 | =head2 sub binding_index_aref | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | sub binding_index_aref { | ||
| 61 | my ($self) = @_; | ||
| 62 | my @index; | ||
| 63 | |||
| 64 | $index[0] = 0; | ||
| 65 | |||
| 66 | $xk_spec->{_binding_index_aref} = \@index; | ||
| 67 | |||
| 68 | return (); | ||
| 69 | } | ||
| 70 | |||
| 71 | =head2 sub get_binding_index_aref | ||
| 72 | |||
| 73 | =cut | ||
| 74 | |||
| 75 | sub get_binding_index_aref { | ||
| 76 | my ($self) = @_; | ||
| 77 | my @index; | ||
| 78 | |||
| 79 | if ( $xk_spec->{_binding_index_aref} ) { | ||
| 80 | my $index_aref = $xk_spec->{_binding_index_aref}; | ||
| 81 | return ($index_aref); | ||
| 82 | |||
| 83 | } | ||
| 84 | else { | ||
| 85 | print( | ||
| 86 | "xk_spec, get_binding_index_aref, missing binding_index_aref\n" | ||
| 87 | ); | ||
| 88 | return (); | ||
| 89 | } | ||
| 90 | |||
| 91 | my $index_aref = $xk_spec->{_binding_index_aref}; | ||
| 92 | |||
| 93 | } | ||
| 94 | |||
| 95 | =head2 sub file_dialog_type_aref | ||
| 96 | |||
| 97 | =cut | ||
| 98 | |||
| 99 | sub file_dialog_type_aref { | ||
| 100 | my ($self) = @_; | ||
| 101 | |||
| 102 | my @type; | ||
| 103 | |||
| 104 | $type[0] = ''; | ||
| 105 | |||
| 106 | $xk_spec->{_file_dialog_type_aref} = \@type; | ||
| 107 | |||
| 108 | return (); | ||
| 109 | |||
| 110 | } | ||
| 111 | |||
| 112 | =head2 sub get_file_dialog_type_aref | ||
| 113 | |||
| 114 | =cut | ||
| 115 | |||
| 116 | sub get_file_dialog_type_aref { | ||
| 117 | my ($self) = @_; | ||
| 118 | |||
| 119 | if ( $xk_spec->{_file_dialog_type_aref} ) { | ||
| 120 | my @type = @{ $xk_spec->{_file_dialog_type_aref} }; | ||
| 121 | return ( \@type ); | ||
| 122 | } | ||
| 123 | else { | ||
| 124 | print( | ||
| 125 | "xk_spec,get_file_dialog_type_aref, missing file_dialog_type_aref\n" | ||
| 126 | ); | ||
| 127 | return (); | ||
| 128 | } | ||
| 129 | } | ||
| 130 | |||
| 131 | =head2 sub get_max_index | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | sub get_max_index { | ||
| 136 | my ($self) = @_; | ||
| 137 | |||
| 138 | if ( $xk_spec->{_max_index} ) { | ||
| 139 | |||
| 140 | my $max_idx = $max_index; | ||
| 141 | return ($max_idx); | ||
| 142 | |||
| 143 | } | ||
| 144 | else { | ||
| 145 | print("xk_spec, get_max_index, missing max_index\n"); | ||
| 146 | return (); | ||
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 | =head2 sub flow_type_aref | ||
| 151 | |||
| 152 | =cut | ||
| 153 | |||
| 154 | sub flow_type_aref { | ||
| 155 | my ($self) = @_; | ||
| 156 | |||
| 157 | my @type; | ||
| 158 | |||
| 159 | $type[0] = $flow_type->{_user_built}; | ||
| 160 | |||
| 161 | $xk_spec->{_flow_type_aref} = \@type; | ||
| 162 | |||
| 163 | return (); | ||
| 164 | |||
| 165 | } | ||
| 166 | |||
| 167 | =head2 sub get_binding_length | ||
| 168 | |||
| 169 | =cut | ||
| 170 | |||
| 171 | sub get_binding_length { | ||
| 172 | my ($self) = @_; | ||
| 173 | |||
| 174 | if ( $xk_spec->{_binding_index_aref} ) { | ||
| 175 | my $length; | ||
| 176 | $length = scalar @{ $xk_spec->{_binding_index_aref} }; | ||
| 177 | return ($length); | ||
| 178 | |||
| 179 | } | ||
| 180 | else { | ||
| 181 | |||
| 182 | print("xk_spec, get_binding_length, missing length \n"); | ||
| 183 | return (); | ||
| 184 | } | ||
| 185 | |||
| 186 | } | ||
| 187 | |||
| 188 | =head2 sub get_flow_type_aref | ||
| 189 | |||
| 190 | =cut | ||
| 191 | |||
| 192 | sub get_flow_type_aref { | ||
| 193 | my ($self) = @_; | ||
| 194 | |||
| 195 | if ( $xk_spec->{_flow_type_aref} ) { | ||
| 196 | my $type_aref = $xk_spec->{_flow_type_aref}; | ||
| 197 | return ($type_aref); | ||
| 198 | } | ||
| 199 | else { | ||
| 200 | |||
| 201 | print("xk_spec, get_flow_type_aref, missing flow_type_aref \n"); | ||
| 202 | return (); | ||
| 203 | } | ||
| 204 | } | ||
| 205 | |||
| 206 | =head2 sub get_incompatibles | ||
| 207 | |||
| 208 | parameters | ||
| 209 | |||
| 210 | =cut | ||
| 211 | |||
| 212 | sub get_incompatibles { | ||
| 213 | my ($self) = @_; | ||
| 214 | |||
| 215 | my (@needed); | ||
| 216 | my @_need_both = (); | ||
| 217 | my @_need_only_1 = (); | ||
| 218 | my @_none_needed = (); | ||
| 219 | my @_all_needed = (); | ||
| 220 | |||
| 221 | my $params = { | ||
| 222 | _need_both => \@_need_both, | ||
| 223 | _need_only_1 => \@_need_only_1, | ||
| 224 | _none_needed => \@_none_needed, | ||
| 225 | _all_needed => \@_all_needed, | ||
| 226 | }; | ||
| 227 | |||
| 228 | #my $number_groups = 6; | ||
| 229 | |||
| 230 | my @of_seven = ( 'pbal', 'mbal', 'agc', 'tpow', 'epow', 'etpow', 'gpow' ); | ||
| 231 | push @{ $params->{_need_only_1} }, \@of_seven; | ||
| 232 | |||
| 233 | my @of_two = ( 'tpow', 'jon' ); | ||
| 234 | push @{ $params->{_need_only_1} }, \@of_two; | ||
| 235 | |||
| 236 | my @of_two_2 = ( 'gpow', 'jon' ); | ||
| 237 | push @{ $params->{_need_only_1} }, \@of_two_2; | ||
| 238 | |||
| 239 | my @of_two_3 = ( 'qclip', 'jon' ); | ||
| 240 | push @{ $params->{_need_only_1} }, \@of_two_3; | ||
| 241 | |||
| 242 | my @of_two_4 = ( 'agc', 'wagc' ); | ||
| 243 | push @{ $params->{_need_both} }, \@of_two_4; | ||
| 244 | |||
| 245 | my @of_two_5 = ( 'agc', 'gagc' ); | ||
| 246 | push @{ $params->{_need_both} }, \@of_two_5; | ||
| 247 | |||
| 248 | # print("xk, get_incomatpibles $length \n"); | ||
| 249 | |||
| 250 | my $len_1_needed = scalar @{ $params->{_need_only_1} }; | ||
| 251 | |||
| 252 | for ( my $i = 0 ; $i < $len_1_needed ; $i++ ) { | ||
| 253 | |||
| 254 | print( | ||
| 255 | "xk, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n" | ||
| 256 | ); | ||
| 257 | |||
| 258 | } | ||
| 259 | |||
| 260 | my $len_2_needed = scalar @{ $params->{_need_both} }; | ||
| 261 | |||
| 262 | for ( my $i = 0 ; $i < $len_2_needed ; $i++ ) { | ||
| 263 | |||
| 264 | print( | ||
| 265 | "xk, get_incompatibles,need_both: @{@{$params->{_need_both}}[$i]}\n" | ||
| 266 | ); | ||
| 267 | |||
| 268 | } | ||
| 269 | |||
| 270 | # print("xk, get_incomatpibles only_one: @only_one\n"); | ||
| 271 | |||
| 272 | return ($params); | ||
| 273 | |||
| 274 | } | ||
| 275 | |||
| 276 | =head2 sub get_prefix_aref | ||
| 277 | |||
| 278 | =cut | ||
| 279 | |||
| 280 | sub get_prefix_aref { | ||
| 281 | |||
| 282 | my ($self) = @_; | ||
| 283 | |||
| 284 | if ( $xk_spec->{_prefix_aref} ) { | ||
| 285 | |||
| 286 | my $prefix_aref = $xk_spec->{_prefix_aref}; | ||
| 287 | return ($prefix_aref); | ||
| 288 | |||
| 289 | } | ||
| 290 | else { | ||
| 291 | print("xk_spec, get_prefix_aref, missing prefix_aref\n"); | ||
| 292 | return (); | ||
| 293 | } | ||
| 294 | |||
| 295 | return (); | ||
| 296 | } | ||
| 297 | |||
| 298 | =head2 sub get_suffix_aref | ||
| 299 | |||
| 300 | =cut | ||
| 301 | |||
| 302 | sub get_suffix_aref { | ||
| 303 | |||
| 304 | my ($self) = @_; | ||
| 305 | |||
| 306 | if ( $xk_spec->{_suffix_aref} ) { | ||
| 307 | |||
| 308 | my $suffix_aref = $xk_spec->{_suffix_aref}; | ||
| 309 | return ($suffix_aref); | ||
| 310 | |||
| 311 | } | ||
| 312 | else { | ||
| 313 | print("xk_spec, get_suffix_aref, missing suffix_aref\n"); | ||
| 314 | return (); | ||
| 315 | } | ||
| 316 | |||
| 317 | return (); | ||
| 318 | } | ||
| 319 | |||
| 320 | =head2 sub prefix_aref | ||
| 321 | |||
| 322 | Include in the Set up | ||
| 323 | sections of an output Poop flow. | ||
| 324 | |||
| 325 | prefixes and suffixes to parameter labels | ||
| 326 | are filtered by sunix_pl | ||
| 327 | |||
| 328 | =cut | ||
| 329 | |||
| 330 | sub prefix_aref { | ||
| 331 | |||
| 332 | my ($self) = @_; | ||
| 333 | |||
| 334 | my @prefix; | ||
| 335 | |||
| 336 | for ( my $i = 0 ; $i < $max_index ; $i++ ) { | ||
| 337 | |||
| 338 | $prefix[$i] = $empty_string; | ||
| 339 | |||
| 340 | } | ||
| 341 | $xk_spec->{_prefix_aref} = \@prefix; | ||
| 342 | return (); | ||
| 343 | |||
| 344 | } | ||
| 345 | |||
| 346 | =head2 sub suffix_aref | ||
| 347 | |||
| 348 | Initialize suffixes as empty | ||
| 349 | Assign specific suffixes to parameter | ||
| 350 | values | ||
| 351 | |||
| 352 | =cut | ||
| 353 | |||
| 354 | sub suffix_aref { | ||
| 355 | |||
| 356 | my ($self) = @_; | ||
| 357 | |||
| 358 | my @suffix; | ||
| 359 | |||
| 360 | for ( my $i = 0 ; $i < $max_index ; $i++ ) { | ||
| 361 | |||
| 362 | $suffix[$i] = $empty_string; | ||
| 363 | |||
| 364 | } | ||
| 365 | $xk_spec->{_suffix_aref} = \@suffix; | ||
| 366 | return (); | ||
| 367 | |||
| 368 | } | ||
| 369 | |||
| 370 | =head2 sub variables | ||
| 371 | |||
| 372 | return a hash array | ||
| 373 | with definitions | ||
| 374 | |||
| 375 | =cut | ||
| 376 | |||
| 377 | sub variables { | ||
| 378 | my $self = @_; | ||
| 379 | my $hash_ref = $xk_spec; | ||
| 380 | return ($hash_ref); | ||
| 381 | } | ||
| 382 | |||
| 383 | 1; |