lib/App/SeismicUnixGui/sunix/model/suimpedance.pm untested

filter: Statementstmt 0.0% 0 / 48 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 68 CC 3 SCAR 12.0
CC
3
Cov
0%
rho0
6.0
v0
6.0
Step
2.0
CRAP 3.3
1 package App::SeismicUnixGui::sunix::model::suimpedance;
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 SUIMPEDANCE - Convert reflection coefficients to impedances.
25  
26  
27  
28 suimpedance <stdin >stdout [optional parameters]
29  
30  
31  
32 Optional Parameters:
33  
34 v0=1500. Velocity at first sample (m/sec)
35  
36 rho0=1.0e6 Density at first sample (g/m^3)
37  
38  
39  
40 Notes:
41  
42 Implements recursion [1-R(k)]Z(k) = [1+R(k)]Z(k-1).
43  
44 The input traces are assumed to be reflectivities, and thus are
45  
46 expected to have amplitude values between -1.0 and 1.0.
47  
48  
49  
50  
51  
52 Credits:
53  
54 SEP: Stew Levin
55  
56  
57  
58 Trace header fields accessed: ns
59  
60
61  
62  
63  
64 =head2 User's notes (Juan Lorenzo)
65 untested
66  
67 =cut
68  
69  
70 =head2 CHANGES and their DATES
71  
72 =cut
73  
74 use Moose;
75 our $VERSION = '0.0.1';
76  
77  
78 =head2 Import packages
79  
80 =cut
81  
82 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
83  
84 use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin);
85 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
86  
87  
88 =head2 instantiation of packages
89  
90 =cut
91  
92 my $get = L_SU_global_constants->new();
93 my $Project = Project_config->new();
94 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
95 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
96 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
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 $suimpedance = {
111 _rho0 => '',
112 _v0 => '',
113 _Step => '',
114 _note => '',
115  
116 };
117  
118 =head2 sub Step
119  
120 collects switches and assembles bash instructions
121 by adding the program name
122  
123 =cut
124  
125 sub Step {
126  
127 $suimpedance->{_Step} = 'suimpedance'.$suimpedance->{_Step};
128 return ( $suimpedance->{_Step} );
129  
130 }
131  
132  
133 =head2 sub note
134  
135 collects switches and assembles bash instructions
136 by adding the program name
137  
138 =cut
139  
140 sub note {
141  
142 $suimpedance->{_note} = 'suimpedance'.$suimpedance->{_note};
143 return ( $suimpedance->{_note} );
144  
145 }
146  
147  
148  
149 =head2 sub clear
150  
151 =cut
152  
153 sub clear {
154  
155 $suimpedance->{_rho0} = '';
156 $suimpedance->{_v0} = '';
157 $suimpedance->{_Step} = '';
158 $suimpedance->{_note} = '';
159 }
160  
161  
162 =head2 sub rho0
163  
164  
165 =cut
166  
167 sub rho0 {
168  
169 my ( $self,$rho0 ) = @_;
170 if ( $rho0 ne $empty_string ) {
171  
172 $suimpedance->{_rho0} = $rho0;
173 $suimpedance->{_note} = $suimpedance->{_note}.' rho0='.$suimpedance->{_rho0};
174 $suimpedance->{_Step} = $suimpedance->{_Step}.' rho0='.$suimpedance->{_rho0};
175  
176 } else {
177 print("suimpedance, rho0, missing rho0,\n");
178 }
179 }
180  
181  
182 =head2 sub v0
183  
184  
185 =cut
186  
187 sub v0 {
188  
189 my ( $self,$v0 ) = @_;
190 if ( $v0 ne $empty_string ) {
191  
192 $suimpedance->{_v0} = $v0;
193 $suimpedance->{_note} = $suimpedance->{_note}.' v0='.$suimpedance->{_v0};
194 $suimpedance->{_Step} = $suimpedance->{_Step}.' v0='.$suimpedance->{_v0};
195  
196 } else {
197 print("suimpedance, v0, missing v0,\n");
198 }
199 }
200  
201  
202 =head2 sub get_max_index
203  
204 max index = number of input variables -1
205
206 =cut
207
208 sub get_max_index {
209 my ($self) = @_;
210 my $max_index = 1;
211  
212 return($max_index);
213 }
214
215
216 1;