« lib/App/SeismicUnixGui/sunix/filter/sugroll.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/header/su3dchart.pm »
| 1 | package App::SeismicUnixGui::sunix::filter::sukfilter; | ||
| 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 | SUKFILTER - radially symmetric K-domain, sin^2-tapered, polygonal | ||
| 25 | |||
| 26 | filter | ||
| 27 | |||
| 28 | |||
| 29 | |||
| 30 | sukfilter <infile >outfile [optional parameters] | ||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | Optional parameters: | ||
| 35 | |||
| 36 | k=val1,val2,... array of K filter wavenumbers | ||
| 37 | |||
| 38 | amps=a1,a2,... array of K filter amplitudes | ||
| 39 | |||
| 40 | d1=tr.d1 or 1.0 sampling interval in first (fast) dimension | ||
| 41 | |||
| 42 | d2=tr.d1 or 1.0 sampling interval in second (slow) dimension | ||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | Defaults: | ||
| 47 | |||
| 48 | k=.10*(nyq),.15*(nyq),.45*(nyq),.50*(nyq) | ||
| 49 | |||
| 50 | amps=0.,1.,...,1.,0. trapezoid-like bandpass filter | ||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | The nyquist wavenumbers, nyq=sqrt(nyq1^2 + nyq2^2) is computed | ||
| 55 | |||
| 56 | internally. | ||
| 57 | |||
| 58 | |||
| 59 | |||
| 60 | Notes: | ||
| 61 | |||
| 62 | The filter is assumed to be symmetric, to yield real output. | ||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | Because the data are assumed to be purely spatial (i.e. non-seismic), | ||
| 67 | |||
| 68 | the data are assumed to have trace id (30), corresponding to (z,x) data | ||
| 69 | |||
| 70 | |||
| 71 | |||
| 72 | The relation: w = 2 pi F is well known for frequency, but there | ||
| 73 | |||
| 74 | doesn't seem to be a commonly used letter corresponding to F for the | ||
| 75 | |||
| 76 | spatial conjugate transform variables. We use K1 and K2 for this. | ||
| 77 | |||
| 78 | More specifically we assume a phase: | ||
| 79 | |||
| 80 | -i(k1 x1 + k2 x2) = -2 pi i(K1 x1 + K2 x2). | ||
| 81 | |||
| 82 | and K1, K2 define our respective wavenumbers. | ||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | |||
| 87 | |||
| 88 | Credits: | ||
| 89 | |||
| 90 | CWP: John Stockwell, June 1997. | ||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | Trace header fields accessed: ns, d1, d2 | ||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | =head2 User's notes (Juan Lorenzo) | ||
| 99 | untested | ||
| 100 | |||
| 101 | =cut | ||
| 102 | |||
| 103 | |||
| 104 | =head2 CHANGES and their DATES | ||
| 105 | |||
| 106 | =cut | ||
| 107 | |||
| 108 | use Moose; | ||
| 109 | our $VERSION = '0.0.1'; | ||
| 110 | |||
| 111 | |||
| 112 | =head2 Import packages | ||
| 113 | |||
| 114 | =cut | ||
| 115 | |||
| 116 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 117 | |||
| 118 | use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su); | ||
| 119 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 120 | |||
| 121 | |||
| 122 | =head2 instantiation of packages | ||
| 123 | |||
| 124 | =cut | ||
| 125 | |||
| 126 | my $get = L_SU_global_constants->new(); | ||
| 127 | my $Project = Project_config->new(); | ||
| 128 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 129 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 130 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 131 | |||
| 132 | my $PS_SEISMIC = $Project->PS_SEISMIC(); | ||
| 133 | |||
| 134 | my $var = $get->var(); | ||
| 135 | my $on = $var->{_on}; | ||
| 136 | my $off = $var->{_off}; | ||
| 137 | my $true = $var->{_true}; | ||
| 138 | my $false = $var->{_false}; | ||
| 139 | my $empty_string = $var->{_empty_string}; | ||
| 140 | |||
| 141 | =head2 Encapsulated | ||
| 142 | hash of private variables | ||
| 143 | |||
| 144 | =cut | ||
| 145 | |||
| 146 | my $sukfilter = { | ||
| 147 | _amps => '', | ||
| 148 | _d1 => '', | ||
| 149 | _d2 => '', | ||
| 150 | _k => '', | ||
| 151 | _nyq => '', | ||
| 152 | _w => '', | ||
| 153 | _Step => '', | ||
| 154 | _note => '', | ||
| 155 | |||
| 156 | }; | ||
| 157 | |||
| 158 | =head2 sub Step | ||
| 159 | |||
| 160 | collects switches and assembles bash instructions | ||
| 161 | by adding the program name | ||
| 162 | |||
| 163 | =cut | ||
| 164 | |||
| 165 | sub Step { | ||
| 166 | |||
| 167 | $sukfilter->{_Step} = 'sukfilter'.$sukfilter->{_Step}; | ||
| 168 | return ( $sukfilter->{_Step} ); | ||
| 169 | |||
| 170 | } | ||
| 171 | |||
| 172 | |||
| 173 | =head2 sub note | ||
| 174 | |||
| 175 | collects switches and assembles bash instructions | ||
| 176 | by adding the program name | ||
| 177 | |||
| 178 | =cut | ||
| 179 | |||
| 180 | sub note { | ||
| 181 | |||
| 182 | $sukfilter->{_note} = 'sukfilter'.$sukfilter->{_note}; | ||
| 183 | return ( $sukfilter->{_note} ); | ||
| 184 | |||
| 185 | } | ||
| 186 | |||
| 187 | |||
| 188 | |||
| 189 | =head2 sub clear | ||
| 190 | |||
| 191 | =cut | ||
| 192 | |||
| 193 | sub clear { | ||
| 194 | |||
| 195 | $sukfilter->{_amps} = ''; | ||
| 196 | $sukfilter->{_d1} = ''; | ||
| 197 | $sukfilter->{_d2} = ''; | ||
| 198 | $sukfilter->{_k} = ''; | ||
| 199 | $sukfilter->{_nyq} = ''; | ||
| 200 | $sukfilter->{_w} = ''; | ||
| 201 | $sukfilter->{_Step} = ''; | ||
| 202 | $sukfilter->{_note} = ''; | ||
| 203 | } | ||
| 204 | |||
| 205 | |||
| 206 | =head2 sub amps | ||
| 207 | |||
| 208 | |||
| 209 | =cut | ||
| 210 | |||
| 211 | sub amps { | ||
| 212 | |||
| 213 | my ( $self,$amps ) = @_; | ||
| 214 | if ( $amps ne $empty_string ) { | ||
| 215 | |||
| 216 | $sukfilter->{_amps} = $amps; | ||
| 217 | $sukfilter->{_note} = $sukfilter->{_note}.' amps='.$sukfilter->{_amps}; | ||
| 218 | $sukfilter->{_Step} = $sukfilter->{_Step}.' amps='.$sukfilter->{_amps}; | ||
| 219 | |||
| 220 | } else { | ||
| 221 | print("sukfilter, amps, missing amps,\n"); | ||
| 222 | } | ||
| 223 | } | ||
| 224 | |||
| 225 | |||
| 226 | =head2 sub d1 | ||
| 227 | |||
| 228 | |||
| 229 | =cut | ||
| 230 | |||
| 231 | sub d1 { | ||
| 232 | |||
| 233 | my ( $self,$d1 ) = @_; | ||
| 234 | if ( $d1 ne $empty_string ) { | ||
| 235 | |||
| 236 | $sukfilter->{_d1} = $d1; | ||
| 237 | $sukfilter->{_note} = $sukfilter->{_note}.' d1='.$sukfilter->{_d1}; | ||
| 238 | $sukfilter->{_Step} = $sukfilter->{_Step}.' d1='.$sukfilter->{_d1}; | ||
| 239 | |||
| 240 | } else { | ||
| 241 | print("sukfilter, d1, missing d1,\n"); | ||
| 242 | } | ||
| 243 | } | ||
| 244 | |||
| 245 | |||
| 246 | =head2 sub d2 | ||
| 247 | |||
| 248 | |||
| 249 | =cut | ||
| 250 | |||
| 251 | sub d2 { | ||
| 252 | |||
| 253 | my ( $self,$d2 ) = @_; | ||
| 254 | if ( $d2 ne $empty_string ) { | ||
| 255 | |||
| 256 | $sukfilter->{_d2} = $d2; | ||
| 257 | $sukfilter->{_note} = $sukfilter->{_note}.' d2='.$sukfilter->{_d2}; | ||
| 258 | $sukfilter->{_Step} = $sukfilter->{_Step}.' d2='.$sukfilter->{_d2}; | ||
| 259 | |||
| 260 | } else { | ||
| 261 | print("sukfilter, d2, missing d2,\n"); | ||
| 262 | } | ||
| 263 | } | ||
| 264 | |||
| 265 | |||
| 266 | =head2 sub k | ||
| 267 | |||
| 268 | |||
| 269 | =cut | ||
| 270 | |||
| 271 | sub k { | ||
| 272 | |||
| 273 | my ( $self,$k ) = @_; | ||
| 274 | if ( $k ne $empty_string ) { | ||
| 275 | |||
| 276 | $sukfilter->{_k} = $k; | ||
| 277 | $sukfilter->{_note} = $sukfilter->{_note}.' k='.$sukfilter->{_k}; | ||
| 278 | $sukfilter->{_Step} = $sukfilter->{_Step}.' k='.$sukfilter->{_k}; | ||
| 279 | |||
| 280 | } else { | ||
| 281 | print("sukfilter, k, missing k,\n"); | ||
| 282 | } | ||
| 283 | } | ||
| 284 | |||
| 285 | |||
| 286 | =head2 sub nyq | ||
| 287 | |||
| 288 | |||
| 289 | =cut | ||
| 290 | |||
| 291 | sub nyq { | ||
| 292 | |||
| 293 | my ( $self,$nyq ) = @_; | ||
| 294 | if ( $nyq ne $empty_string ) { | ||
| 295 | |||
| 296 | $sukfilter->{_nyq} = $nyq; | ||
| 297 | $sukfilter->{_note} = $sukfilter->{_note}.' nyq='.$sukfilter->{_nyq}; | ||
| 298 | $sukfilter->{_Step} = $sukfilter->{_Step}.' nyq='.$sukfilter->{_nyq}; | ||
| 299 | |||
| 300 | } else { | ||
| 301 | print("sukfilter, nyq, missing nyq,\n"); | ||
| 302 | } | ||
| 303 | } | ||
| 304 | |||
| 305 | |||
| 306 | =head2 sub w | ||
| 307 | |||
| 308 | |||
| 309 | =cut | ||
| 310 | |||
| 311 | sub w { | ||
| 312 | |||
| 313 | my ( $self,$w ) = @_; | ||
| 314 | if ( $w ne $empty_string ) { | ||
| 315 | |||
| 316 | $sukfilter->{_w} = $w; | ||
| 317 | $sukfilter->{_note} = $sukfilter->{_note}.' w='.$sukfilter->{_w}; | ||
| 318 | $sukfilter->{_Step} = $sukfilter->{_Step}.' w='.$sukfilter->{_w}; | ||
| 319 | |||
| 320 | } else { | ||
| 321 | print("sukfilter, w, missing w,\n"); | ||
| 322 | } | ||
| 323 | } | ||
| 324 | |||
| 325 | |||
| 326 | =head2 sub get_max_index | ||
| 327 | |||
| 328 | max index = number of input variables -1 | ||
| 329 | |||
| 330 | =cut | ||
| 331 | |||
| 332 | sub get_max_index { | ||
| 333 | my ($self) = @_; | ||
| 334 | my $max_index = 5; | ||
| 335 | |||
| 336 | return($max_index); | ||
| 337 | } | ||
| 338 | |||
| 339 | |||
| 340 | 1; |