author | A.M. Thurnherr <athurnherr@yahoo.com> |
Tue, 06 Dec 2022 12:47:21 -0500 | |
changeset 64 | 58ef697c01ae |
parent 49 | 5006e9158207 |
permissions | -rwxr-xr-x |
29 | 1 |
#!/usr/bin/perl |
2 |
#====================================================================== |
|
3 |
# L A D C P _ W S P E C |
|
4 |
# doc: Thu Jun 11 12:02:49 2015 |
|
49 | 5 |
# dlm: Thu Nov 1 10:09:48 2018 |
29 | 6 |
# (c) 2012 A.M. Thurnherr |
49 | 7 |
# uE-Info: 39 29 NIL 0 0 72 10 2 4 NIL ofnI |
29 | 8 |
#====================================================================== |
9 |
||
10 |
$antsSummary = 'calculate VKE window spectra from LADCP profiles'; |
|
11 |
||
12 |
# HISTORY: |
|
42 | 13 |
# Jun 11, 2015: - adapted from [binpgrams] |
14 |
# Jun 12, 2015: - renamed %PARAM prefixes |
|
15 |
# Jun 15, 2015: - BUG: de-meaning did not respect _gap variables |
|
16 |
# - added %output_depth_resolution |
|
17 |
# - reversed semantics of -d/-u |
|
18 |
# Jun 16, 2015: - reversed semantics of -t |
|
19 |
# - re-added pwrdens.0 to make output consistent with [binpgrams] |
|
20 |
# Oct 12, 2015: - require ANTSlibs V6.2 for release |
|
21 |
# Oct 13, 2015: - adapted to [version.pl] |
|
34 | 22 |
# Jan 25, 2016: - added software version %PARAM |
42 | 23 |
# Mar 1, 2016: - made trailing message much less frequent |
24 |
# - BUG: program croaked gracelessly or entered infinite loop |
|
25 |
# when presented with insufficient (no valid) input |
|
26 |
# data |
|
27 |
# Mar 27, 2016: - added -z)ap |
|
43 | 28 |
# Mar 28, 2016: - removed -z |
42 | 29 |
# - renamed nsamp to nspec |
30 |
# - added w.nsamp.avg |
|
43 | 31 |
# Mar 31, 2016: - changed version %PARAM |
32 |
# - BUG: nspec was nan insted of 0 |
|
33 |
# - replaced wspec:: %PARAM-prefix with LADCP_wspec:: |
|
48 | 34 |
# Mar 12, 2017: - removed ANTSBIN (which is not public) |
49 | 35 |
# Dec 9, 2017: - added $antsSuppressCommonOptions = 1; |
36 |
# Dec 14, 2017: - added w.rms to output |
|
37 |
# May 13, 2018: - BUG: Removal of higher order polynomials (-o > 0) did not work |
|
38 |
# May 16, 2018: - modified depth.{min,max} to respect input resolution |
|
39 |
# Nov 1, 2018: - cosmetics |
|
29 | 40 |
|
41 |
($ANTSLIB) = (`which ANTSlib` =~ m{^(.*)/[^/]*$}); |
|
33 | 42 |
($WCALC) = ($0 =~ m{^(.*)/[^/]*$}); |
43 |
$WCALC = '.' if ($WCALC eq ''); |
|
29 | 44 |
|
33 | 45 |
require "$WCALC/version.pl"; |
29 | 46 |
require "$ANTSLIB/ants.pl"; |
47 |
require "$ANTSLIB/antsfilters.pl"; |
|
48 |
require "$ANTSLIB/libstats.pl"; |
|
49 |
require "$ANTSLIB/fft.pl"; |
|
50 |
require "$ANTSLIB/lfit.pl"; |
|
51 |
require "$ANTSLIB/nrutil.pl"; |
|
48 | 52 |
require "$ANTSLIB/.lsfit.poly"; |
53 |
require "$ANTSLIB/.nminterp.linear"; |
|
43 | 54 |
&antsAddParams('LADCP_wspec::version',$VERSION); |
29 | 55 |
|
56 |
#---------------------------------------------------------------------- |
|
57 |
# Usage |
|
58 |
#---------------------------------------------------------------------- |
|
59 |
||
49 | 60 |
$antsSuppressCommonOptions = 1; |
29 | 61 |
&antsUsage('bc:dg:o:s:tuw:',0, |
42 | 62 |
'[poly-o)rder <n[0]> to de-mean data; -1 to disable>] [suppress cosine-t)aper]', |
63 |
'[-d)own/-u)pcast-only] [exclude -b)ottom window]', |
|
64 |
'[shortwave -c)utoff <kz or lambda>]', |
|
65 |
'[-s)urface <layer depth to exclude[150m]>', |
|
66 |
'[-g)ap <max depth layer to fill with interpolation[40m]>]', |
|
49 | 67 |
'[-w)indow <power-of-two input-records>]', |
42 | 68 |
'[LADCP-profile(s)]'); |
29 | 69 |
|
42 | 70 |
&antsIntOpt(\$opt_o,0); # polynomial order to remove |
71 |
if ($opt_o >= 0) { # init model |
|
72 |
&modelUsage(); |
|
73 |
matrix(\@covar,1,$modelNFit,1,$modelNFit); |
|
74 |
vector(\@afunc,1,$modelNFit); |
|
43 | 75 |
&antsAddParams('LADCP_wspec::demean_poly_order',$opt_o); |
29 | 76 |
} |
77 |
||
78 |
croak("$0: cannot ignore both down- and upcast\n") |
|
42 | 79 |
unless ($opt_d+$opt_u < 2); |
29 | 80 |
if ($opt_d) { |
43 | 81 |
&antsAddParams('LADCP_wspec::input_data','dc'); |
29 | 82 |
} elsif ($opt_u) { |
43 | 83 |
&antsAddParams('LADCP_wspec::input_data','uc'); |
29 | 84 |
} else { |
43 | 85 |
&antsAddParams('LADCP_wspec::input_data','dc/uc'); |
29 | 86 |
} |
43 | 87 |
&antsAddParams('LADCP_wspec::cos_taper_applied',$opt_t ? 'no' : 'yes'); |
88 |
&antsAddParams('LADCP_wspec::btm_window_included',$opt_b ? 'no' : 'yes'); |
|
29 | 89 |
|
42 | 90 |
if (defined($opt_c)) { # shortwave cutoff |
91 |
$kzlim = ($opt_c < 1) ? $opt_c : 2*$PI/$opt_c; |
|
43 | 92 |
&antsAddParams('LADCP_wspec::shortwave_cutoff',$kzlim); |
29 | 93 |
} else { |
42 | 94 |
$kzlim = 9e99; |
29 | 95 |
} |
96 |
||
42 | 97 |
&antsCardOpt($opt_w); # window size |
29 | 98 |
|
42 | 99 |
&antsCardOpt(\$opt_g,40); # gap length [m] |
43 | 100 |
&antsAddParams('LADCP_wspec::min_gap_thickness',$opt_g); |
29 | 101 |
|
42 | 102 |
&antsCardOpt(\$opt_s,150); # surface layer |
43 | 103 |
&antsAddParams('LADCP_wspec::surface_layer',$opt_s); |
29 | 104 |
|
42 | 105 |
&ISUsage; # interpolation model |
29 | 106 |
|
107 |
#---------------------------------------------------------------------- |
|
108 |
# Read Data & Define Layout |
|
109 |
#---------------------------------------------------------------------- |
|
110 |
||
111 |
croak("LADCP_VKE: spectral-input mode must be selected manually (-f)\n") |
|
42 | 112 |
if defined(fnrNoErr('pwrdens.0')) && !defined(fnrNoErr('dc_w')); |
29 | 113 |
|
42 | 114 |
$zfnr = fnr('depth'); # required fields |
115 |
$dcwfnr = fnr('dc_w'); $dcsfnr = fnr('dc_w.nsamp'); |
|
116 |
$ucwfnr = fnr('uc_w'); $ucsfnr = fnr('uc_w.nsamp'); |
|
117 |
$habfnr = fnrNoErr('hab'); # optional fields |
|
29 | 118 |
|
42 | 119 |
&antsInstallBufFull(0); # read entire file |
29 | 120 |
&antsIn(); |
121 |
||
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
122 |
while (@ants_ && $ants_[0][$zfnr] < $opt_s) { # remove surface layer |
29 | 123 |
shift(@ants_); |
124 |
} |
|
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
125 |
croak("$0: insufficient data (no valid records found)\n") |
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
126 |
unless (@ants_); |
29 | 127 |
|
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
128 |
for ($trimmed=0; @ants_ && !numberp($ants_[$#ants_][$dcwfnr]) && !numberp($ants_[$#ants_][$ucwfnr]); $trimmed++) { |
29 | 129 |
pop(@ants_); |
130 |
} |
|
131 |
&antsInfo("$trimmed trailing non-numeric records trimmed") |
|
35
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
132 |
if ($trimmed > 1); # 1 is very common |
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
133 |
croak("$0: insufficient data (no valid records found)\n") |
54b8bb450e5f
Version 1.2 finished. Out for testing to Jay Hooper.
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
34
diff
changeset
|
134 |
unless (@ants_); |
29 | 135 |
|
136 |
$dz = &antsXCheck($zfnr,0,$#ants_,1.01); # calc dT; 1% jitter |
|
43 | 137 |
&antsAddParams("LADCP_wspec::input_depth_resolution",$dz); |
29 | 138 |
|
139 |
$opt_g = int(($opt_g - 1) / $dz); # [m] -> [records] |
|
140 |
||
49 | 141 |
unless (defined($opt_w)) { # default window size: largest pwr-of-two <= 600m |
29 | 142 |
for ($opt_w=32; $opt_w*$dz>600; $opt_w/=2) {} |
49 | 143 |
&antsInfo("%d-m windows ($opt_w samples)",$opt_w*$dz); |
29 | 144 |
} |
43 | 145 |
&antsAddParams('LADCP_wspec::window_size',$opt_w,'LADCP_wspec::output_depth_resolution',$dz*$opt_w); |
29 | 146 |
|
147 |
croak(sprintf("$0: insufficient data (%d records found, %d required)\n",scalar(@ants_),$opt_w)) |
|
148 |
unless (@ants_ >= $opt_w); |
|
149 |
||
150 |
$zrange = $opt_w * $dz; # NB: not equal to max-min!!! |
|
151 |
$resolution_bandwidth = 1 / $zrange; |
|
152 |
$resolution_bandwidth *= 2*$PI; |
|
43 | 153 |
&antsAddParams('LADCP_wspec::resolution_bandwidth',$resolution_bandwidth); |
29 | 154 |
|
49 | 155 |
push(@antsNewLayout,'widx','depth','depth.min','depth.max','hab','w.rms','nspec','w.nsamp.avg'); |
29 | 156 |
for (my($i)=0; $i<$opt_w/2+1; $i++) { |
157 |
my($kz) = 2*$PI*$i/$zrange; |
|
158 |
last if ($kz > $kzlim); |
|
43 | 159 |
&antsAddParams(sprintf('LADCP_wspec::k.%d',$i),$kz); |
160 |
&antsAddParams(sprintf('LADCP_wspec::lambda.%d',$i),$i ? $zrange/$i : inf); |
|
29 | 161 |
push(@antsNewLayout,sprintf('pwrdens.%d',$i)); |
162 |
} |
|
163 |
push(@antsNewLayout,'pwr.tot'); |
|
164 |
||
165 |
&antsActivateOut(); |
|
166 |
||
167 |
#---------------------------------------------------------------------- |
|
168 |
# interpolate short gaps |
|
169 |
#---------------------------------------------------------------------- |
|
170 |
||
171 |
&ISInit($dcwfnr,$zfnr); |
|
172 |
&ISInit($ucwfnr,$zfnr); |
|
173 |
||
174 |
my($dcLastValid,$ucLastValid,$interp); |
|
175 |
for (my($r)=0; $r<=$#ants_; $r++) { |
|
176 |
if (numberp($ants_[$r][$dcwfnr])) { # number => no interp. |
|
177 |
$dcLastValid = $r; |
|
178 |
} elsif (defined($dcLastValid)) { |
|
179 |
$ants_[$r][$dcwfnr] = &interpolate($zfnr,$opt_g,$dcwfnr,$dcLastValid,$r); |
|
180 |
$interp++ if numberp($ants_[$r][$dcwfnr]); |
|
181 |
} |
|
182 |
if (numberp($ants_[$r][$ucwfnr])) { # number => no interp. |
|
183 |
$ucLastValid = $r; |
|
184 |
} elsif (defined($ucLastValid)) { |
|
185 |
$ants_[$r][$ucwfnr] = &interpolate($zfnr,$opt_g,$ucwfnr,$ucLastValid,$r); |
|
186 |
$interp++ if numberp($ants_[$r][$ucwfnr]); |
|
187 |
} |
|
188 |
} |
|
189 |
||
190 |
&antsInfo("$interp non-numeric values interpolated") |
|
191 |
if ($interp); |
|
192 |
||
193 |
#---------------------------------------------------------------------- |
|
194 |
# loop over windows |
|
195 |
#---------------------------------------------------------------------- |
|
196 |
||
197 |
sub avgF($$) # average field over window |
|
198 |
{ |
|
199 |
my($f,$r) = @_; |
|
200 |
my(@vals); |
|
201 |
||
202 |
push(@vals,$ants_[$r++][$f]) |
|
203 |
while (@vals < $opt_w); |
|
204 |
return avg(@vals); |
|
205 |
} |
|
206 |
||
42 | 207 |
sub medianF($$) # average field over window |
208 |
{ |
|
209 |
my($f,$r) = @_; |
|
210 |
my(@vals); |
|
211 |
||
212 |
push(@vals,$ants_[$r++][$f]) |
|
213 |
while (@vals < $opt_w); |
|
214 |
return median(@vals); |
|
215 |
} |
|
216 |
||
29 | 217 |
unless ($opt_t) { # compile taper function only if needed |
218 |
sub cosTaperWeight($) |
|
219 |
{ |
|
220 |
my($z) = $_[0] - $ants_[$fromR][$zfnr]; # elapsed time |
|
221 |
return ($z<0.1*$zrange || $z>0.9*$zrange) ? |
|
222 |
0.5*(1+cos(10*$PI*$z/$zrange-$PI)) : 1; |
|
223 |
} |
|
224 |
} |
|
225 |
||
226 |
WINDOW: for (my($widx)=1; 1; $widx++) { |
|
227 |
undef(@out); |
|
228 |
$out[0] = $widx; |
|
229 |
local($fromR) = round(($widx-1)*($opt_w/2)); # local, cuz it's used in cosTaperWeight |
|
230 |
||
231 |
#---------------------- |
|
232 |
# partial bottom window |
|
233 |
#---------------------- |
|
234 |
||
235 |
if ($fromR+$opt_w-1 > $#ants_) { |
|
236 |
last if ($opt_b); |
|
237 |
$out[0] = -1; |
|
238 |
$fromR = @ants_ - $opt_w; |
|
239 |
$opt_b = 1; |
|
240 |
} |
|
241 |
||
49 | 242 |
#-------------------------------------------------- |
243 |
# calculate rms w in window |
|
244 |
# - also determines if there are missing y values |
|
245 |
#-------------------------------------------------- |
|
246 |
||
247 |
my($dc_gap) = $opt_u; # exclude dc with -d, uc with -u |
|
248 |
my($uc_gap) = $opt_d; |
|
249 |
my($sumsq,$n) = (0,0); |
|
250 |
for (my($r)=$fromR; $r<$fromR+$opt_w; $r++) { |
|
251 |
if (numberp($ants_[$r][$dcwfnr])) { |
|
252 |
$sumsq += $ants_[$r][$dcwfnr]**2; |
|
253 |
$n++; |
|
254 |
} else { |
|
255 |
$dc_gap = 1; |
|
256 |
} |
|
257 |
if (numberp($ants_[$r][$ucwfnr])) { |
|
258 |
$sumsq += $ants_[$r][$ucwfnr]**2; |
|
259 |
$n++; |
|
260 |
} else { |
|
261 |
$uc_gap = 1; |
|
262 |
} |
|
263 |
} |
|
264 |
my($wrms) = ($n > 0) ? sqrt($sumsq/$n) : nan; |
|
265 |
||
29 | 266 |
#----------------------------------- |
267 |
# output nan on non-numeric y values |
|
268 |
#----------------------------------- |
|
269 |
||
270 |
if ($dc_gap && $uc_gap) { |
|
271 |
push(@out,$ants_[$fromR+$opt_w/2][$zfnr]); |
|
272 |
if ($ants_[0][$zfnr] > $ants_[1][$zfnr]) { |
|
273 |
push(@out,$ants_[$fromR+$opt_w-1][$zfnr]); |
|
274 |
push(@out,$ants_[$fromR][$zfnr]); |
|
275 |
} else { |
|
276 |
push(@out,$ants_[$fromR][$zfnr]); |
|
277 |
push(@out,$ants_[$fromR+$opt_w-1][$zfnr]); |
|
278 |
} |
|
42 | 279 |
push(@out,defined($habfnr) ? # hab |
29 | 280 |
avgF($habfnr,$fromR) : nan); |
49 | 281 |
push(@out,$wrms); # rms w |
43 | 282 |
push(@out,0); # nspec |
42 | 283 |
push(@out,nan); # w.nsamp.avg |
284 |
for ($i=0; $i<=$opt_w/2; $i++) { # power |
|
29 | 285 |
push(@out,nan); |
286 |
} |
|
287 |
&antsOut(@out); # output nan record and go to next window |
|
288 |
next WINDOW; |
|
289 |
} |
|
290 |
||
291 |
#-------------------- |
|
292 |
# save current values |
|
293 |
#-------------------- |
|
294 |
||
295 |
for (my($i)=0; $i<$opt_w; $i++) { |
|
296 |
$dcwbuf[$i] = $ants_[$fromR+$i][$dcwfnr]; |
|
297 |
$ucwbuf[$i] = $ants_[$fromR+$i][$ucwfnr]; |
|
298 |
} |
|
299 |
||
300 |
#------------------------ |
|
301 |
# polynomial de-"mean"ing |
|
302 |
#------------------------ |
|
303 |
||
304 |
if ($opt_o >= 0) { |
|
305 |
my($calc); |
|
306 |
unless ($dc_gap) { |
|
307 |
&modelInit(); # dc |
|
308 |
for (my($a)=1; $a<=$modelNFit; $a++) { $iA[$a] = 1; } |
|
309 |
&lfit($zfnr,$dcwfnr,-1,\@A,\@iA,\@covar,\&modelEvaluate,$fromR,$fromR+$opt_w-1); |
|
310 |
&modelCleanup(); |
|
311 |
for (my($i)=0; $i<$opt_w; $i++) { |
|
49 | 312 |
modelEvaluate($fromR+$i,$zfnr,\@afunc); |
29 | 313 |
for ($calc=0,my($p)=1; $p<=$modelNFit; $p++) { |
314 |
$calc += $A[$p] * $afunc[$p]; |
|
315 |
} |
|
316 |
$ants_[$fromR+$i][$dcwfnr] -= $calc; |
|
317 |
} |
|
318 |
} |
|
319 |
unless ($uc_gap) { |
|
320 |
&modelInit(); # uc |
|
321 |
for (my($a)=1; $a<=$modelNFit; $a++) { $iA[$a] = 1; } |
|
322 |
&lfit($zfnr,$ucwfnr,-1,\@A,\@iA,\@covar,\&modelEvaluate,$fromR,$fromR+$opt_w-1); |
|
323 |
&modelCleanup(); |
|
324 |
for (my($i)=0; $i<$opt_w; $i++) { |
|
49 | 325 |
modelEvaluate($fromR+$i,$zfnr,\@afunc); |
29 | 326 |
for ($calc=0,my($p)=1; $p<=$modelNFit; $p++) { |
327 |
$calc += $A[$p] * $afunc[$p]; |
|
328 |
} |
|
329 |
$ants_[$fromR+$i][$ucwfnr] -= $calc; |
|
330 |
} |
|
331 |
} |
|
332 |
} |
|
333 |
||
334 |
#----------- |
|
335 |
# taper data |
|
336 |
#----------- |
|
337 |
||
338 |
unless ($opt_t) { |
|
339 |
for (my($i)=0; $i<$opt_w; $i++) { |
|
340 |
$ants_[$fromR+$i][$dcwfnr] *= &cosTaperWeight($ants_[$fromR+$i][$zfnr]); |
|
341 |
$ants_[$fromR+$i][$ucwfnr] *= &cosTaperWeight($ants_[$fromR+$i][$zfnr]); |
|
342 |
} |
|
343 |
$taper_correction = 1/0.875; |
|
344 |
} else { |
|
345 |
$taper_correction = 1; |
|
346 |
} |
|
347 |
||
348 |
#------------- |
|
349 |
# PSD Estimate |
|
350 |
#------------- |
|
351 |
||
352 |
# for (my($r)=0; $r<$opt_w; $r++) { |
|
353 |
# print(STDERR "$ants_[$fromR+$r][$dcwfnr], $ants_[$fromR+$r][$ucwfnr]\n"); |
|
354 |
# } |
|
355 |
||
356 |
@dc_coeff = &cFFT($dcwfnr,nan,$opt_w,$fromR) # FFT |
|
357 |
unless ($dc_gap); |
|
358 |
@uc_coeff = &cFFT($ucwfnr,nan,$opt_w,$fromR) |
|
359 |
unless ($uc_gap); |
|
360 |
croak("$0: -n $opt_w not a power-of-two\n") |
|
361 |
unless (@dc_coeff/2==$opt_w || @uc_coeff/2==$opt_w); |
|
362 |
||
363 |
@dc_pwr = &pgram_onesided($opt_w,@dc_coeff) # total power |
|
364 |
unless ($dc_gap); |
|
365 |
@uc_pwr = &pgram_onesided($opt_w,@uc_coeff) |
|
366 |
unless ($uc_gap); |
|
367 |
||
49 | 368 |
# push(@out,$ants_[$fromR+$opt_w/2][$zfnr]); # middle z |
369 |
push(@out,avgF($zfnr,$fromR)); # average z |
|
29 | 370 |
if ($ants_[0][$zfnr] > $ants_[1][$zfnr]) { # input descending |
49 | 371 |
push(@out,$ants_[$fromR+$opt_w-1][$zfnr]-$dz/2); # z.min |
372 |
push(@out,$ants_[$fromR][$zfnr]+$dz/2); # z.max |
|
29 | 373 |
} else { # input ascending |
49 | 374 |
push(@out,$ants_[$fromR][$zfnr]-$dz/2); # z.min |
375 |
push(@out,$ants_[$fromR+$opt_w-1][$zfnr]+$dz/2); # z.max |
|
29 | 376 |
} |
377 |
push(@out,defined($habfnr) ? # hab |
|
378 |
avgF($habfnr,$fromR) : nan); |
|
49 | 379 |
push(@out,$wrms); # w.rms |
42 | 380 |
my($nspec) = !$dc_gap + !$uc_gap; # nspec |
381 |
push(@out,$nspec); |
|
382 |
my($nsamp_sum) = my($nsn) = 0; # w.nsamp.avg |
|
383 |
$nsamp_sum+=medianF($dcsfnr,$fromR),$nsn++ unless ($dc_gap); # median to avoid biasing by short bottle stops |
|
384 |
$nsamp_sum+=medianF($ucsfnr,$fromR),$nsn++ unless ($uc_gap); |
|
385 |
push(@out,$nsamp_sum/$nsn); |
|
29 | 386 |
|
387 |
my($totP) = 0; # power |
|
388 |
my($i); |
|
389 |
for ($i=0; $i<$opt_w/2+1; $i++) { |
|
390 |
my($sumP) = 0; |
|
391 |
$sumP += $dc_pwr[$i] * $taper_correction unless ($dc_gap); |
|
392 |
$sumP += $uc_pwr[$i] * $taper_correction unless ($uc_gap); |
|
42 | 393 |
push(@out,$sumP/$nspec/$resolution_bandwidth) |
29 | 394 |
unless (antsParam("k.$i") > $kzlim); |
395 |
$totP += $sumP; |
|
396 |
} |
|
397 |
push(@out,$totP); # total power |
|
398 |
||
399 |
&antsOut(@out); |
|
400 |
||
401 |
#-------------------------------- |
|
402 |
# undo tapering and/or de-meaning |
|
403 |
#-------------------------------- |
|
404 |
||
405 |
for ($i=0; $i<$opt_w; $i++) { |
|
406 |
$ants_[$fromR+$i][$dcwfnr] = $dcwbuf[$i]; |
|
407 |
$ants_[$fromR+$i][$ucwfnr] = $ucwbuf[$i]; |
|
408 |
} |
|
409 |
} |
|
410 |
||
411 |
&antsInfo("$skipped windows with non-numeric values skipped") |
|
412 |
if ($skipped); |
|
413 |
||
414 |
antsExit(); |