« lib/App/SeismicUnixGui/sunix/model/elacheck.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/transform/suhilb.pm »
| 1 | package App::SeismicUnixGui::sunix::statsMath::entropy; | ||
| 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 | ENTROPY - compute the ENTROPY of a signal | ||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | entropy < stdin n= > stdout | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | Required Parameter: | ||
| 33 | |||
| 34 | n number of values in data set | ||
| 35 | |||
| 36 | |||
| 37 | |||
| 38 | Optional Parameters: | ||
| 39 | |||
| 40 | none | ||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | Author: CWP: Tong Chen, 1995. | ||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | =head2 User's notes (Juan Lorenzo) | ||
| 55 | untested | ||
| 56 | |||
| 57 | =cut | ||
| 58 | |||
| 59 | |||
| 60 | =head2 CHANGES and their DATES | ||
| 61 | |||
| 62 | =cut | ||
| 63 | |||
| 64 | use Moose; | ||
| 65 | our $VERSION = '0.0.1'; | ||
| 66 | |||
| 67 | |||
| 68 | =head2 Import packages | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 73 | use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin); | ||
| 74 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 75 | |||
| 76 | |||
| 77 | =head2 instantiation of packages | ||
| 78 | |||
| 79 | =cut | ||
| 80 | |||
| 81 | my $get = L_SU_global_constants->new(); | ||
| 82 | my $Project = Project_config->new(); | ||
| 83 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 84 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 85 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 86 | |||
| 87 | my $var = $get->var(); | ||
| 88 | my $on = $var->{_on}; | ||
| 89 | my $off = $var->{_off}; | ||
| 90 | my $true = $var->{_true}; | ||
| 91 | my $false = $var->{_false}; | ||
| 92 | my $empty_string = $var->{_empty_string}; | ||
| 93 | |||
| 94 | =head2 Encapsulated | ||
| 95 | hash of private variables | ||
| 96 | |||
| 97 | =cut | ||
| 98 | |||
| 99 | my $entropy = { | ||
| 100 | _n => '', | ||
| 101 | _Step => '', | ||
| 102 | _note => '', | ||
| 103 | |||
| 104 | }; | ||
| 105 | |||
| 106 | =head2 sub Step | ||
| 107 | |||
| 108 | collects switches and assembles bash instructions | ||
| 109 | by adding the program name | ||
| 110 | |||
| 111 | =cut | ||
| 112 | |||
| 113 | sub Step { | ||
| 114 | |||
| 115 | $entropy->{_Step} = 'entropy'.$entropy->{_Step}; | ||
| 116 | return ( $entropy->{_Step} ); | ||
| 117 | |||
| 118 | } | ||
| 119 | |||
| 120 | |||
| 121 | =head2 sub note | ||
| 122 | |||
| 123 | collects switches and assembles bash instructions | ||
| 124 | by adding the program name | ||
| 125 | |||
| 126 | =cut | ||
| 127 | |||
| 128 | sub note { | ||
| 129 | |||
| 130 | $entropy->{_note} = 'entropy'.$entropy->{_note}; | ||
| 131 | return ( $entropy->{_note} ); | ||
| 132 | |||
| 133 | } | ||
| 134 | |||
| 135 | |||
| 136 | |||
| 137 | =head2 sub clear | ||
| 138 | |||
| 139 | =cut | ||
| 140 | |||
| 141 | sub clear { | ||
| 142 | |||
| 143 | $entropy->{_n} = ''; | ||
| 144 | $entropy->{_Step} = ''; | ||
| 145 | $entropy->{_note} = ''; | ||
| 146 | } | ||
| 147 | |||
| 148 | |||
| 149 | =head2 sub n | ||
| 150 | |||
| 151 | |||
| 152 | =cut | ||
| 153 | |||
| 154 | sub n { | ||
| 155 | |||
| 156 | my ( $self,$n ) = @_; | ||
| 157 | if ( $n ne $empty_string ) { | ||
| 158 | |||
| 159 | $entropy->{_n} = $n; | ||
| 160 | $entropy->{_note} = $entropy->{_note}.' n='.$entropy->{_n}; | ||
| 161 | $entropy->{_Step} = $entropy->{_Step}.' n='.$entropy->{_n}; | ||
| 162 | |||
| 163 | } else { | ||
| 164 | print("entropy, n, missing n,\n"); | ||
| 165 | } | ||
| 166 | } | ||
| 167 | |||
| 168 | |||
| 169 | =head2 sub get_max_index | ||
| 170 | |||
| 171 | max index = number of input variables -1 | ||
| 172 | |||
| 173 | =cut | ||
| 174 | |||
| 175 | sub get_max_index { | ||
| 176 | my ($self) = @_; | ||
| 177 | my $max_index = 0; | ||
| 178 | |||
| 179 | return($max_index); | ||
| 180 | } | ||
| 181 | |||
| 182 | |||
| 183 | 1; |