lib/App/SeismicUnixGui/sunix/filter/sufrac.pm untested

filter: Statementstmt 0.0% 0 / 70 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 9 totaltotal 0.0% 0 / 102 CC 6 SCAR 14.4
CC
6
Cov
0%
dt
6.0
phasefac
6.0
power
6.0
CRAP 4.2
1 package App::SeismicUnixGui::sunix::filter::sufrac;
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 SUFRAC -- take general (fractional) time derivative or integral of
25  
26 data, plus a phase shift. Input is CAUSAL time-indexed
27  
28 or depth-indexed data.
29  
30  
31  
32 sufrac power= [optional parameters] <indata >outdata
33  
34  
35  
36 Optional parameters:
37  
38 power=0 exponent of (-i*omega)
39  
40 =0 ==> phase shift only
41  
42 >0 ==> differentiation
43  
44 <0 ==> integration
45  
46  
47  
48 sign=-1 sign in front of i * omega
49  
50 dt=(from header) time sample interval (in seconds)
51  
52 phasefac=0 phase shift by phase=phasefac*PI
53  
54 verbose=0 =1 for advisory messages
55  
56  
57  
58 Examples:
59  
60 preprocess to correct 3D data for 2.5D migration
61  
62 sufrac < sudata power=.5 sign=1 | ...
63  
64 preprocess to correct susynlv, susynvxz, etc. (2D data) for 2D migration
65  
66 sufrac < sudata phasefac=.25 | ...
67  
68 The filter is applied in frequency domain.
69  
70 if dt is not set in header, then dt is mandatory
71  
72  
73  
74 Algorithm:
75  
76 g(t) = Re[INVFTT{ ( (sign) iw)^power FFT(f)}]
77  
78 Caveat:
79  
80 Large amplitude errors will result if the data set has too few points.
81  
82  
83  
84 Good numerical integration routine needed!
85  
86 For example, see Gnu Scientific Library.
87  
88  
89  
90  
91  
92 Credits:
93  
94 CWP: Chris Liner, Jack K. Cohen, Dave Hale (pfas)
95  
96 CWP: Zhenyue Liu and John Stockwell added phase shift option
97  
98 CENPET: Werner M. Heigl - added well log support
99  
100  
101  
102 Trace header fields accessed: ns, dt, trid, d1
103  
104 /
105  
106 =head2 User's notes (Juan Lorenzo)
107 untested
108  
109 =cut
110  
111  
112 =head2 CHANGES and their DATES
113  
114 =cut
115  
116 use Moose;
117 our $VERSION = '0.0.1';
118  
119  
120 =head2 Import packages
121  
122 =cut
123  
124 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
125  
126 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
127 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
128  
129  
130 =head2 instantiation of packages
131  
132 =cut
133  
134 my $get = L_SU_global_constants->new();
135 my $Project = Project_config->new();
136 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
137 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
138 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
139  
140 my $PS_SEISMIC = $Project->PS_SEISMIC();
141  
142 my $var = $get->var();
143 my $on = $var->{_on};
144 my $off = $var->{_off};
145 my $true = $var->{_true};
146 my $false = $var->{_false};
147 my $empty_string = $var->{_empty_string};
148  
149 =head2 Encapsulated
150 hash of private variables
151  
152 =cut
153  
154 my $sufrac = {
155 _dt => '',
156 _phasefac => '',
157 _power => '',
158 _sign => '',
159 _verbose => '',
160 _Step => '',
161 _note => '',
162  
163 };
164  
165 =head2 sub Step
166  
167 collects switches and assembles bash instructions
168 by adding the program name
169  
170 =cut
171  
172 sub Step {
173  
174 $sufrac->{_Step} = 'sufrac'.$sufrac->{_Step};
175 return ( $sufrac->{_Step} );
176  
177 }
178  
179  
180 =head2 sub note
181  
182 collects switches and assembles bash instructions
183 by adding the program name
184  
185 =cut
186  
187 sub note {
188  
189 $sufrac->{_note} = 'sufrac'.$sufrac->{_note};
190 return ( $sufrac->{_note} );
191  
192 }
193  
194  
195  
196 =head2 sub clear
197  
198 =cut
199  
200 sub clear {
201  
202 $sufrac->{_dt} = '';
203 $sufrac->{_phasefac} = '';
204 $sufrac->{_power} = '';
205 $sufrac->{_sign} = '';
206 $sufrac->{_verbose} = '';
207 $sufrac->{_Step} = '';
208 $sufrac->{_note} = '';
209 }
210  
211  
212 =head2 sub dt
213  
214  
215 =cut
216  
217 sub dt {
218  
219 my ( $self,$dt ) = @_;
220 if ( $dt ne $empty_string ) {
221  
222 $sufrac->{_dt} = $dt;
223 $sufrac->{_note} = $sufrac->{_note}.' dt='.$sufrac->{_dt};
224 $sufrac->{_Step} = $sufrac->{_Step}.' dt='.$sufrac->{_dt};
225  
226 } else {
227 print("sufrac, dt, missing dt,\n");
228 }
229 }
230  
231  
232 =head2 sub phasefac
233  
234  
235 =cut
236  
237 sub phasefac {
238  
239 my ( $self,$phasefac ) = @_;
240 if ( $phasefac ne $empty_string ) {
241  
242 $sufrac->{_phasefac} = $phasefac;
243 $sufrac->{_note} = $sufrac->{_note}.' phasefac='.$sufrac->{_phasefac};
244 $sufrac->{_Step} = $sufrac->{_Step}.' phasefac='.$sufrac->{_phasefac};
245  
246 } else {
247 print("sufrac, phasefac, missing phasefac,\n");
248 }
249 }
250  
251  
252 =head2 sub power
253  
254  
255 =cut
256  
257 sub power {
258  
259 my ( $self,$power ) = @_;
260 if ( $power ne $empty_string ) {
261  
262 $sufrac->{_power} = $power;
263 $sufrac->{_note} = $sufrac->{_note}.' power='.$sufrac->{_power};
264 $sufrac->{_Step} = $sufrac->{_Step}.' power='.$sufrac->{_power};
265  
266 } else {
267 print("sufrac, power, missing power,\n");
268 }
269 }
270  
271  
272 =head2 sub sign
273  
274  
275 =cut
276  
277 sub sign {
278  
279 my ( $self,$sign ) = @_;
280 if ( $sign ne $empty_string ) {
281  
282 $sufrac->{_sign} = $sign;
283 $sufrac->{_note} = $sufrac->{_note}.' sign='.$sufrac->{_sign};
284 $sufrac->{_Step} = $sufrac->{_Step}.' sign='.$sufrac->{_sign};
285  
286 } else {
287 print("sufrac, sign, missing sign,\n");
288 }
289 }
290  
291  
292 =head2 sub verbose
293  
294  
295 =cut
296  
297 sub verbose {
298  
299 my ( $self,$verbose ) = @_;
300 if ( $verbose ne $empty_string ) {
301  
302 $sufrac->{_verbose} = $verbose;
303 $sufrac->{_note} = $sufrac->{_note}.' verbose='.$sufrac->{_verbose};
304 $sufrac->{_Step} = $sufrac->{_Step}.' verbose='.$sufrac->{_verbose};
305  
306 } else {
307 print("sufrac, verbose, missing verbose,\n");
308 }
309 }
310  
311  
312 =head2 sub get_max_index
313  
314 max index = number of input variables -1
315
316 =cut
317
318 sub get_max_index {
319 my ($self) = @_;
320 my $max_index = 4;
321  
322 return($max_index);
323 }
324
325
326 1;