« lib/App/SeismicUnixGui/sunix/shell/cp.pm
↑ Summary
lib/App/SeismicUnixGui/misc/su_spectral_analysis.pm »
| 1 | package App::SeismicUnixGui::sunix::transform::suicepstrum; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PROGRAM NAME: SUICEPSTRUM - fft of complex log frequency traces to real time traces | ||
| 8 | AUTHOR: Juan Lorenzo (Perl module only) | ||
| 9 | DATE: | ||
| 10 | DESCRIPTION: | ||
| 11 | Version: | ||
| 12 | |||
| 13 | =head2 USE | ||
| 14 | |||
| 15 | =head3 NOTES | ||
| 16 | |||
| 17 | =head4 Examples | ||
| 18 | |||
| 19 | =head3 SEISMIC UNIX NOTES | ||
| 20 | |||
| 21 | SUICEPSTRUM - fft of complex log frequency traces to real time traces | ||
| 22 | |||
| 23 | suicepstrum <stdin >sdout sign2=-1 | ||
| 24 | |||
| 25 | Required parameters: | ||
| 26 | none | ||
| 27 | |||
| 28 | Optional parameter: | ||
| 29 | sign1=1 sign in exponent of first fft | ||
| 30 | sign2=-1 sign in exponent of inverse fft | ||
| 31 | sym=0 =1 center output | ||
| 32 | dt=tr.dt time sampling interval (s) from header | ||
| 33 | if not set assumed to be .004s | ||
| 34 | Output traces are normalized by 1/N where N is the fft size. | ||
| 35 | |||
| 36 | Note: | ||
| 37 | The forward cepstral transform is the | ||
| 38 | F(t_c) = InvFFT[ln[FFT(F(t))]] | ||
| 39 | The inverse cepstral transform is the | ||
| 40 | F(t) = InvFFT[exp[FFT(F(t_c))]] | ||
| 41 | |||
| 42 | Here t_c is the cepstral time (quefrency) domain | ||
| 43 | |||
| 44 | Credits: | ||
| 45 | |||
| 46 | CWP: John Stockwell, Dec 2010 based on | ||
| 47 | suifft.c by: | ||
| 48 | CWP: Shuki Ronen, Chris Liner, Jack K. Cohen, c. 1989 | ||
| 49 | |||
| 50 | Trace header fields accessed: ns, trid | ||
| 51 | Trace header fields modified: ns, trid | ||
| 52 | |||
| 53 | =head2 CHANGES and their DATES | ||
| 54 | |||
| 55 | =cut | ||
| 56 | |||
| 57 | use Moose; | ||
| 58 | our $VERSION = '0.0.1'; | ||
| 59 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 60 | |||
| 61 | my $get = L_SU_global_constants->new(); | ||
| 62 | |||
| 63 | my $var = $get->var(); | ||
| 64 | my $empty_string = $var->{_empty_string}; | ||
| 65 | |||
| 66 | my $suicepstrum = { | ||
| 67 | _dt => '', | ||
| 68 | _sign1 => '', | ||
| 69 | _sign2 => '', | ||
| 70 | _sym => '', | ||
| 71 | _Step => '', | ||
| 72 | _note => '', | ||
| 73 | }; | ||
| 74 | |||
| 75 | =head2 sub Step | ||
| 76 | |||
| 77 | collects switches and assembles bash instructions | ||
| 78 | by adding the program name | ||
| 79 | |||
| 80 | =cut | ||
| 81 | |||
| 82 | sub Step { | ||
| 83 | |||
| 84 | $suicepstrum->{_Step} = 'suicepstrum' . $suicepstrum->{_Step}; | ||
| 85 | return ( $suicepstrum->{_Step} ); | ||
| 86 | |||
| 87 | } | ||
| 88 | |||
| 89 | =head2 sub note | ||
| 90 | |||
| 91 | collects switches and assembles bash instructions | ||
| 92 | by adding the program name | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | sub note { | ||
| 97 | |||
| 98 | $suicepstrum->{_note} = 'suicepstrum' . $suicepstrum->{_note}; | ||
| 99 | return ( $suicepstrum->{_note} ); | ||
| 100 | |||
| 101 | } | ||
| 102 | |||
| 103 | =head2 sub clear | ||
| 104 | |||
| 105 | =cut | ||
| 106 | |||
| 107 | sub clear { | ||
| 108 | |||
| 109 | $suicepstrum->{_dt} = ''; | ||
| 110 | $suicepstrum->{_sign1} = ''; | ||
| 111 | $suicepstrum->{_sign2} = ''; | ||
| 112 | $suicepstrum->{_sym} = ''; | ||
| 113 | $suicepstrum->{_Step} = ''; | ||
| 114 | $suicepstrum->{_note} = ''; | ||
| 115 | } | ||
| 116 | |||
| 117 | =head2 sub dt | ||
| 118 | |||
| 119 | |||
| 120 | =cut | ||
| 121 | |||
| 122 | sub dt { | ||
| 123 | |||
| 124 | my ( $self, $dt ) = @_; | ||
| 125 | if ( $dt ne $empty_string ) { | ||
| 126 | |||
| 127 | $suicepstrum->{_dt} = $dt; | ||
| 128 | $suicepstrum->{_note} = | ||
| 129 | $suicepstrum->{_note} . ' dt=' . $suicepstrum->{_dt}; | ||
| 130 | $suicepstrum->{_Step} = | ||
| 131 | $suicepstrum->{_Step} . ' dt=' . $suicepstrum->{_dt}; | ||
| 132 | |||
| 133 | } | ||
| 134 | else { | ||
| 135 | print("suicepstrum, dt, missing dt,\n"); | ||
| 136 | } | ||
| 137 | } | ||
| 138 | |||
| 139 | =head2 sub sign1 | ||
| 140 | |||
| 141 | |||
| 142 | =cut | ||
| 143 | |||
| 144 | sub sign1 { | ||
| 145 | |||
| 146 | my ( $self, $sign1 ) = @_; | ||
| 147 | if ( $sign1 ne $empty_string ) { | ||
| 148 | |||
| 149 | $suicepstrum->{_sign1} = $sign1; | ||
| 150 | $suicepstrum->{_note} = | ||
| 151 | $suicepstrum->{_note} . ' sign1=' . $suicepstrum->{_sign1}; | ||
| 152 | $suicepstrum->{_Step} = | ||
| 153 | $suicepstrum->{_Step} . ' sign1=' . $suicepstrum->{_sign1}; | ||
| 154 | |||
| 155 | } | ||
| 156 | else { | ||
| 157 | print("suicepstrum, sign1, missing sign1,\n"); | ||
| 158 | } | ||
| 159 | } | ||
| 160 | |||
| 161 | =head2 sub sign2 | ||
| 162 | |||
| 163 | |||
| 164 | =cut | ||
| 165 | |||
| 166 | sub sign2 { | ||
| 167 | |||
| 168 | my ( $self, $sign2 ) = @_; | ||
| 169 | if ( $sign2 ne $empty_string ) { | ||
| 170 | |||
| 171 | $suicepstrum->{_sign2} = $sign2; | ||
| 172 | $suicepstrum->{_note} = | ||
| 173 | $suicepstrum->{_note} . ' sign2=' . $suicepstrum->{_sign2}; | ||
| 174 | $suicepstrum->{_Step} = | ||
| 175 | $suicepstrum->{_Step} . ' sign2=' . $suicepstrum->{_sign2}; | ||
| 176 | |||
| 177 | } | ||
| 178 | else { | ||
| 179 | print("suicepstrum, sign2, missing sign2,\n"); | ||
| 180 | } | ||
| 181 | } | ||
| 182 | |||
| 183 | =head2 sub sym | ||
| 184 | |||
| 185 | |||
| 186 | =cut | ||
| 187 | |||
| 188 | sub sym { | ||
| 189 | |||
| 190 | my ( $self, $sym ) = @_; | ||
| 191 | if ( $sym ne $empty_string ) { | ||
| 192 | |||
| 193 | $suicepstrum->{_sym} = $sym; | ||
| 194 | $suicepstrum->{_note} = | ||
| 195 | $suicepstrum->{_note} . ' sym=' . $suicepstrum->{_sym}; | ||
| 196 | $suicepstrum->{_Step} = | ||
| 197 | $suicepstrum->{_Step} . ' sym=' . $suicepstrum->{_sym}; | ||
| 198 | |||
| 199 | } | ||
| 200 | else { | ||
| 201 | print("suicepstrum, sym, missing sym,\n"); | ||
| 202 | } | ||
| 203 | } | ||
| 204 | |||
| 205 | =head2 sub get_max_index | ||
| 206 | |||
| 207 | max index = number of input variables -1 | ||
| 208 | |||
| 209 | =cut | ||
| 210 | |||
| 211 | sub get_max_index { | ||
| 212 | my ($self) = @_; | ||
| 213 | my $max_index = 3; | ||
| 214 | |||
| 215 | return ($max_index); | ||
| 216 | } | ||
| 217 | |||
| 218 | 1; |