« lib/App/SeismicUnixGui/sunix/filter/subfilt.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/header/suresstat.pm »
| 1 | package App::SeismicUnixGui::sunix::filter::supef; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | =head2 SYNOPSIS | ||
| 6 | |||
| 7 | PERL PROGRAM NAME: SUPEF - Wiener predictive error filtering | ||
| 8 | |||
| 9 | AUTHOR: Juan Lorenzo (Perl module only) | ||
| 10 | |||
| 11 | DATE: | ||
| 12 | |||
| 13 | DESCRIPTION: | ||
| 14 | |||
| 15 | Version: | ||
| 16 | |||
| 17 | =head2 USE | ||
| 18 | |||
| 19 | =head3 NOTES | ||
| 20 | |||
| 21 | =head4 Examples | ||
| 22 | |||
| 23 | =head3 SEISMIC UNIX NOTES | ||
| 24 | |||
| 25 | SUPEF - Wiener predictive error filtering | ||
| 26 | |||
| 27 | supef <stdin >stdout [optional parameters] | ||
| 28 | |||
| 29 | Required parameters: | ||
| 30 | dt is mandatory if not set in header | ||
| 31 | |||
| 32 | Optional parameters: | ||
| 33 | cdp= CDPs for which minlag, maxlag, pnoise, mincorr, | ||
| 34 | maxcorr are set (see Notes) | ||
| 35 | minlag=dt first lag of prediction filter (sec) | ||
| 36 | maxlag=last lag default is (tmax-tmin)/20 | ||
| 37 | pnoise=0.001 relative additive noise level | ||
| 38 | mincorr=tmin start of autocorrelation window (sec) | ||
| 39 | maxcorr=tmax end of autocorrelation window (sec) | ||
| 40 | showwiener=0 =1 to show Wiener filter on each trace | ||
| 41 | mix=1,... array of weights (floats) for moving | ||
| 42 | average of the autocorrelations | ||
| 43 | outpar=/dev/null output parameter file, contains the Wiener filter | ||
| 44 | if showwiener=1 is set | ||
| 45 | method=linear for linear interpolation of cdp values | ||
| 46 | =mono for monotonic cubic interpolation of cdps | ||
| 47 | =akima for Akima's cubic interpolation of cdps | ||
| 48 | =spline for cubic spline interpolation of cdps | ||
| 49 | |||
| 50 | Trace header fields accessed: ns, dt | ||
| 51 | Trace header fields modified: none | ||
| 52 | |||
| 53 | Notes: | ||
| 54 | |||
| 55 | 1) To apply spiking decon (Wiener filtering with no gap): | ||
| 56 | |||
| 57 | Run the following command | ||
| 58 | |||
| 59 | suacor < data.su | suximage perc=95 | ||
| 60 | |||
| 61 | You will see horizontal strip running across the center of your plot. | ||
| 62 | This is the autocorrelation wavelet for each trace. The idea of spiking | ||
| 63 | decon is to apply a Wiener filter with no gap to the data to collapse | ||
| 64 | the waveform into a spike. The idea is to pick the width of the | ||
| 65 | autocorrelation waveform _from beginning to end_ (not trough to trough) | ||
| 66 | and use this time for MAXLAG_SPIKING: | ||
| 67 | |||
| 68 | supef < data.su maxlag=MAXLAG_SPIKING > dataspiked.su | ||
| 69 | |||
| 70 | 2) Prediction Error Filter (i.e. gapped Wiener filtering) | ||
| 71 | The purpose of gapped decon is to suppress repetitions in the data | ||
| 72 | such as those caused by water bottom multiples. | ||
| 73 | |||
| 74 | To look for the period of the repetitions | ||
| 75 | |||
| 76 | suacor ntout=1000 < dataspiked.su | suximage perc=95 | ||
| 77 | |||
| 78 | The value of ntout must be larger than the default 100. The idea is | ||
| 79 | to look for repetitions in the autocorrelation. These repetitions will | ||
| 80 | appear as a family of parallel stripes above and below the main | ||
| 81 | autocorrelation waveform. Set MAXLAG_PEF to the period of the repetitions | ||
| 82 | Set MINLAG_PEF to be slightly larger than the value of MAXLAG_SPIKING | ||
| 83 | that you used to spike the data. In general, the periodicity of the | ||
| 84 | repetitions in the autocorrelation will be the GAP_SIZE | ||
| 85 | with MAXLAG_PEF = GAP_SIZE + MINLAG_PEF | ||
| 86 | some experimentation may be necessary to see sensitivity to choices | ||
| 87 | of MAXLAG_PEF. | ||
| 88 | |||
| 89 | supef < dataspiked.su minlag=MINLAG_PEF maxlag=MAXLAG_PEF > datapef.su | ||
| 90 | |||
| 91 | Some experimentation may be required to get a satisfactory result. | ||
| 92 | |||
| 93 | 3) It may be effective to sort your data into cdp gathers with susort, | ||
| 94 | and perform sunmo correction to the water speed with sunmo, prior to | ||
| 95 | attempts to suppress water bottom multiples. After applying supef, the | ||
| 96 | user should apply inverse nmo to undo the nmo to water speed prior to | ||
| 97 | further processing. Or, do the predictive decon on fully nmo-corrected | ||
| 98 | gathers. | ||
| 99 | |||
| 100 | For a filter expressed as a function of cdp, specify the array | ||
| 101 | cdp=cdp1,cdp2,... | ||
| 102 | and for each cdp specified, specify the minlag and maxlag arrays as | ||
| 103 | minlag=min1,min2,... maxlag=max1,max2,... | ||
| 104 | |||
| 105 | It is required that the number of minlag and maxlag values be equal to | ||
| 106 | the number of cdp's specified. If the number of | ||
| 107 | values in these arrays does not equal the number of cdp's, only the first | ||
| 108 | value will be used. | ||
| 109 | |||
| 110 | Caveat: | ||
| 111 | The showwiener=1 option writes out the wiener filter to outpar, and | ||
| 112 | the prediction error filter to stdout, which is ", | ||
| 113 | 1,0,0,...,-wiener[0],...,-wiener[imaxlag-1] | ||
| 114 | where the sample value of -wiener[0], is iminlag in the pe-filter. | ||
| 115 | The pe-filter is output as a SU format datafile, one pe-filter for each | ||
| 116 | trace input. | ||
| 117 | |||
| 118 | |||
| 119 | Credits: | ||
| 120 | CWP: Shuki Ronen, Jack K. Cohen, Ken Larner | ||
| 121 | CWP: John Stockwell, added mixing feature (April 1998) | ||
| 122 | CSM: Tanya Slota (September 2005) added cdp feature | ||
| 123 | |||
| 124 | Technical Reference: | ||
| 125 | A. Ziolkowski, "Deconvolution", for value of maxlag default: | ||
| 126 | page 91: imaxlag < nt/10. I took nt/20. | ||
| 127 | |||
| 128 | Notes: | ||
| 129 | The prediction error filter is 1,0,0...,0,-wiener[0], ..., | ||
| 130 | so no point in explicitly forming it. | ||
| 131 | |||
| 132 | If imaxlag < 2*iminlag - 1, then we don't need to compute the | ||
| 133 | autocorrelation for lags: | ||
| 134 | imaxlag-iminlag+1, ..., iminlag-1 | ||
| 135 | It doesn't seem worth the duplicated code to implement this. | ||
| 136 | |||
| 137 | Trace header fields accessed: ns | ||
| 138 | |||
| 139 | =head2 CHANGES and their DATES | ||
| 140 | |||
| 141 | =cut | ||
| 142 | |||
| 143 | use Moose; | ||
| 144 | our $VERSION = '1.0.1'; | ||
| 145 | |||
| 146 | my $supef = { | ||
| 147 | _cdp => '', | ||
| 148 | _minlag => '', | ||
| 149 | _maxlag => '', | ||
| 150 | _pnoise => '', | ||
| 151 | _mincorr => '', | ||
| 152 | _maxcorr => '', | ||
| 153 | _mix => '', | ||
| 154 | _note => '', | ||
| 155 | _Step => '', | ||
| 156 | _outpar => '', | ||
| 157 | _method => '', | ||
| 158 | _ntout => '', | ||
| 159 | _showwiener => '', | ||
| 160 | }; | ||
| 161 | |||
| 162 | =head2 sub Step | ||
| 163 | |||
| 164 | collects switches and assembles bash instructions | ||
| 165 | by adding the program name | ||
| 166 | |||
| 167 | =cut | ||
| 168 | |||
| 169 | sub Step { | ||
| 170 | |||
| 171 | $supef->{_Step} = 'supef ' . $supef->{_Step}; | ||
| 172 | return ( $supef->{_Step} ); | ||
| 173 | |||
| 174 | } | ||
| 175 | |||
| 176 | =head2 sub note | ||
| 177 | |||
| 178 | collects switches and assembles bash instructions | ||
| 179 | by adding the program name | ||
| 180 | |||
| 181 | =cut | ||
| 182 | |||
| 183 | sub note { | ||
| 184 | |||
| 185 | $supef->{_note} = 'supef=' . $supef->{_note}; | ||
| 186 | return ( $supef->{_note} ); | ||
| 187 | |||
| 188 | } | ||
| 189 | |||
| 190 | =head2 sub clear | ||
| 191 | |||
| 192 | =cut | ||
| 193 | |||
| 194 | sub clear { | ||
| 195 | |||
| 196 | $supef->{_cdp} = ''; | ||
| 197 | $supef->{_minlag} = ''; | ||
| 198 | $supef->{_maxlag} = ''; | ||
| 199 | $supef->{_pnoise} = ''; | ||
| 200 | $supef->{_mincorr} = ''; | ||
| 201 | $supef->{_maxcorr} = ''; | ||
| 202 | $supef->{_mix} = ''; | ||
| 203 | $supef->{_note} = ''; | ||
| 204 | $supef->{_Step} = ''; | ||
| 205 | $supef->{_outpar} = ''; | ||
| 206 | $supef->{_method} = ''; | ||
| 207 | $supef->{_ntout} = ''; | ||
| 208 | $supef->{_MAXLAG_PEF} = ''; | ||
| 209 | $supef->{_showwiener} = ''; | ||
| 210 | } | ||
| 211 | |||
| 212 | =head2 sub cdp | ||
| 213 | |||
| 214 | |||
| 215 | =cut | ||
| 216 | |||
| 217 | sub cdp { | ||
| 218 | my ( $self, $cdp ) = @_; | ||
| 219 | if ($cdp) { | ||
| 220 | $supef->{_cdp} = $cdp; | ||
| 221 | $supef->{_note} = $supef->{_note} . ' cdp=' . $supef->{_cdp}; | ||
| 222 | $supef->{_Step} = $supef->{_Step} . ' cdp=' . $supef->{_cdp}; | ||
| 223 | } | ||
| 224 | } | ||
| 225 | |||
| 226 | =head2 sub minlag | ||
| 227 | |||
| 228 | |||
| 229 | =cut | ||
| 230 | |||
| 231 | sub minlag { | ||
| 232 | my ( $self, $minlag ) = @_; | ||
| 233 | if ($minlag) { | ||
| 234 | $supef->{_minlag} = $minlag; | ||
| 235 | $supef->{_note} = $supef->{_note} . ' minlag=' . $supef->{_minlag}; | ||
| 236 | $supef->{_Step} = $supef->{_Step} . ' minlag=' . $supef->{_minlag}; | ||
| 237 | } | ||
| 238 | } | ||
| 239 | |||
| 240 | =head2 sub maxlag | ||
| 241 | |||
| 242 | |||
| 243 | =cut | ||
| 244 | |||
| 245 | sub maxlag { | ||
| 246 | my ( $self, $maxlag ) = @_; | ||
| 247 | if ($maxlag) { | ||
| 248 | $supef->{_maxlag} = $maxlag; | ||
| 249 | $supef->{_note} = $supef->{_note} . ' maxlag=' . $supef->{_maxlag}; | ||
| 250 | $supef->{_Step} = $supef->{_Step} . ' maxlag=' . $supef->{_maxlag}; | ||
| 251 | } | ||
| 252 | } | ||
| 253 | |||
| 254 | =head2 sub pnoise | ||
| 255 | |||
| 256 | |||
| 257 | =cut | ||
| 258 | |||
| 259 | sub pnoise { | ||
| 260 | my ( $self, $pnoise ) = @_; | ||
| 261 | if ($pnoise) { | ||
| 262 | $supef->{_pnoise} = $pnoise; | ||
| 263 | $supef->{_note} = $supef->{_note} . ' pnoise=' . $supef->{_pnoise}; | ||
| 264 | $supef->{_Step} = $supef->{_Step} . ' pnoise=' . $supef->{_pnoise}; | ||
| 265 | } | ||
| 266 | } | ||
| 267 | |||
| 268 | =head2 sub mincorr | ||
| 269 | |||
| 270 | |||
| 271 | =cut | ||
| 272 | |||
| 273 | sub mincorr { | ||
| 274 | my ( $self, $mincorr ) = @_; | ||
| 275 | if ($mincorr) { | ||
| 276 | $supef->{_mincorr} = $mincorr; | ||
| 277 | $supef->{_note} = $supef->{_note} . ' mincorr=' . $supef->{_mincorr}; | ||
| 278 | $supef->{_Step} = $supef->{_Step} . ' mincorr=' . $supef->{_mincorr}; | ||
| 279 | } | ||
| 280 | } | ||
| 281 | |||
| 282 | =head2 sub maxcorr | ||
| 283 | |||
| 284 | |||
| 285 | =cut | ||
| 286 | |||
| 287 | sub maxcorr { | ||
| 288 | my ( $self, $maxcorr ) = @_; | ||
| 289 | if ($maxcorr) { | ||
| 290 | $supef->{_maxcorr} = $maxcorr; | ||
| 291 | $supef->{_note} = $supef->{_note} . ' maxcorr=' . $supef->{_maxcorr}; | ||
| 292 | $supef->{_Step} = $supef->{_Step} . ' maxcorr=' . $supef->{_maxcorr}; | ||
| 293 | } | ||
| 294 | } | ||
| 295 | |||
| 296 | =head2 sub showwiener | ||
| 297 | |||
| 298 | |||
| 299 | =cut | ||
| 300 | |||
| 301 | sub showwiener { | ||
| 302 | my ( $self, $showwiener ) = @_; | ||
| 303 | if ($showwiener) { | ||
| 304 | $supef->{_showwiener} = $showwiener; | ||
| 305 | $supef->{_note} = | ||
| 306 | $supef->{_note} . ' wienerout=' . $supef->{_showwiener}; | ||
| 307 | $supef->{_Step} = | ||
| 308 | $supef->{_Step} . ' wienerout=' . $supef->{_showwiener}; | ||
| 309 | } | ||
| 310 | } | ||
| 311 | |||
| 312 | =head2 sub mix | ||
| 313 | |||
| 314 | |||
| 315 | =cut | ||
| 316 | |||
| 317 | sub mix { | ||
| 318 | my ( $self, $mix ) = @_; | ||
| 319 | if ($mix) { | ||
| 320 | $supef->{_mix} = $mix; | ||
| 321 | $supef->{_note} = $supef->{_note} . ' mix=' . $supef->{_mix}; | ||
| 322 | $supef->{_Step} = $supef->{_Step} . ' mix=' . $supef->{_mix}; | ||
| 323 | } | ||
| 324 | } | ||
| 325 | |||
| 326 | =head2 sub outpar | ||
| 327 | |||
| 328 | |||
| 329 | =cut | ||
| 330 | |||
| 331 | sub outpar { | ||
| 332 | my ( $self, $outpar ) = @_; | ||
| 333 | if ($outpar) { | ||
| 334 | $supef->{_outpar} = $outpar; | ||
| 335 | $supef->{_note} = $supef->{_note} . ' outpar=' . $supef->{_outpar}; | ||
| 336 | $supef->{_Step} = $supef->{_Step} . ' outpar=' . $supef->{_outpar}; | ||
| 337 | } | ||
| 338 | } | ||
| 339 | |||
| 340 | =head2 sub method | ||
| 341 | |||
| 342 | |||
| 343 | =cut | ||
| 344 | |||
| 345 | sub method { | ||
| 346 | my ( $self, $method ) = @_; | ||
| 347 | if ($method) { | ||
| 348 | $supef->{_method} = $method; | ||
| 349 | $supef->{_note} = $supef->{_note} . ' method=' . $supef->{_method}; | ||
| 350 | $supef->{_Step} = $supef->{_Step} . ' method=' . $supef->{_method}; | ||
| 351 | } | ||
| 352 | } | ||
| 353 | |||
| 354 | =head2 sub ntout | ||
| 355 | |||
| 356 | |||
| 357 | =cut | ||
| 358 | |||
| 359 | sub ntout { | ||
| 360 | my ( $self, $ntout ) = @_; | ||
| 361 | if ($ntout) { | ||
| 362 | $supef->{_ntout} = $ntout; | ||
| 363 | $supef->{_note} = $supef->{_note} . ' ntout=' . $supef->{_ntout}; | ||
| 364 | $supef->{_Step} = $supef->{_Step} . ' ntout=' . $supef->{_ntout}; | ||
| 365 | } | ||
| 366 | } | ||
| 367 | |||
| 368 | |||
| 369 | =head2 sub get_max_index | ||
| 370 | |||
| 371 | max index = number of input variables -1 | ||
| 372 | |||
| 373 | =cut | ||
| 374 | |||
| 375 | sub get_max_index { | ||
| 376 | my ($self) = @_; | ||
| 377 | my $max_index = 9; | ||
| 378 | |||
| 379 | return ($max_index); | ||
| 380 | } | ||
| 381 | |||
| 382 | 1; |