lib/App/SeismicUnixGui/sunix/transform/suminphase.pm untested

filter: Statementstmt 0.0% 0 / 63 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 91 CC 5 SCAR 13.9
CC
5
Cov
0%
pnoise
6.0
sign1
6.0
sign2
6.0
CRAP 4.0
1 package App::SeismicUnixGui::sunix::transform::suminphase;
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 SUMINPHASE - convert input to minimum phase
25  
26  
27  
28 suminphase <stdin >stdout [optional parameters]
29  
30  
31  
32 Required parameters:
33  
34 if dt is not set in header, then dt is mandatory
35  
36  
37  
38 Optional parameters:
39  
40 sign1=1 sign of first transform (1 or -1)
41  
42 sign2=-1 sign of second transform (-1 or 1)
43  
44 pnoise=1.e-9 white noise in spectral routine
45  
46 verbose=0 =1 for advisory messages
47  
48  
49  
50  
51  
52 Credits:
53  
54 SEAM Project: Bruce VerWest c. 2013
55  
56
57  
58 Trace header fields accessed: ns, dt, d1
59  
60  
61  
62 =head2 User's notes (Juan Lorenzo)
63 untested
64  
65 =cut
66  
67  
68 =head2 CHANGES and their DATES
69  
70 =cut
71  
72 use Moose;
73 our $VERSION = '0.0.1';
74  
75  
76 =head2 Import packages
77  
78 =cut
79  
80 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
81  
82 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
83 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
84  
85  
86 =head2 instantiation of packages
87  
88 =cut
89  
90 my $get = L_SU_global_constants->new();
91 my $Project = Project_config->new();
92 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
93 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
94 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
95  
96 my $PS_SEISMIC = $Project->PS_SEISMIC();
97  
98 my $var = $get->var();
99 my $on = $var->{_on};
100 my $off = $var->{_off};
101 my $true = $var->{_true};
102 my $false = $var->{_false};
103 my $empty_string = $var->{_empty_string};
104  
105 =head2 Encapsulated
106 hash of private variables
107  
108 =cut
109  
110 my $suminphase = {
111 _pnoise => '',
112 _sign1 => '',
113 _sign2 => '',
114 _verbose => '',
115 _Step => '',
116 _note => '',
117  
118 };
119  
120 =head2 sub Step
121  
122 collects switches and assembles bash instructions
123 by adding the program name
124  
125 =cut
126  
127 sub Step {
128  
129 $suminphase->{_Step} = 'suminphase'.$suminphase->{_Step};
130 return ( $suminphase->{_Step} );
131  
132 }
133  
134  
135 =head2 sub note
136  
137 collects switches and assembles bash instructions
138 by adding the program name
139  
140 =cut
141  
142 sub note {
143  
144 $suminphase->{_note} = 'suminphase'.$suminphase->{_note};
145 return ( $suminphase->{_note} );
146  
147 }
148  
149  
150  
151 =head2 sub clear
152  
153 =cut
154  
155 sub clear {
156  
157 $suminphase->{_pnoise} = '';
158 $suminphase->{_sign1} = '';
159 $suminphase->{_sign2} = '';
160 $suminphase->{_verbose} = '';
161 $suminphase->{_Step} = '';
162 $suminphase->{_note} = '';
163 }
164  
165  
166 =head2 sub pnoise
167  
168  
169 =cut
170  
171 sub pnoise {
172  
173 my ( $self,$pnoise ) = @_;
174 if ( $pnoise ne $empty_string ) {
175  
176 $suminphase->{_pnoise} = $pnoise;
177 $suminphase->{_note} = $suminphase->{_note}.' pnoise='.$suminphase->{_pnoise};
178 $suminphase->{_Step} = $suminphase->{_Step}.' pnoise='.$suminphase->{_pnoise};
179  
180 } else {
181 print("suminphase, pnoise, missing pnoise,\n");
182 }
183 }
184  
185  
186 =head2 sub sign1
187  
188  
189 =cut
190  
191 sub sign1 {
192  
193 my ( $self,$sign1 ) = @_;
194 if ( $sign1 ne $empty_string ) {
195  
196 $suminphase->{_sign1} = $sign1;
197 $suminphase->{_note} = $suminphase->{_note}.' sign1='.$suminphase->{_sign1};
198 $suminphase->{_Step} = $suminphase->{_Step}.' sign1='.$suminphase->{_sign1};
199  
200 } else {
201 print("suminphase, sign1, missing sign1,\n");
202 }
203 }
204  
205  
206 =head2 sub sign2
207  
208  
209 =cut
210  
211 sub sign2 {
212  
213 my ( $self,$sign2 ) = @_;
214 if ( $sign2 ne $empty_string ) {
215  
216 $suminphase->{_sign2} = $sign2;
217 $suminphase->{_note} = $suminphase->{_note}.' sign2='.$suminphase->{_sign2};
218 $suminphase->{_Step} = $suminphase->{_Step}.' sign2='.$suminphase->{_sign2};
219  
220 } else {
221 print("suminphase, sign2, missing sign2,\n");
222 }
223 }
224  
225  
226 =head2 sub verbose
227  
228  
229 =cut
230  
231 sub verbose {
232  
233 my ( $self,$verbose ) = @_;
234 if ( $verbose ne $empty_string ) {
235  
236 $suminphase->{_verbose} = $verbose;
237 $suminphase->{_note} = $suminphase->{_note}.' verbose='.$suminphase->{_verbose};
238 $suminphase->{_Step} = $suminphase->{_Step}.' verbose='.$suminphase->{_verbose};
239  
240 } else {
241 print("suminphase, verbose, missing verbose,\n");
242 }
243 }
244  
245  
246 =head2 sub get_max_index
247  
248 max index = number of input variables -1
249
250 =cut
251
252 sub get_max_index {
253 my ($self) = @_;
254 my $max_index = 3;
255  
256 return($max_index);
257 }
258
259
260 1;