diff options
| author | wukong <wukong@longaeva> | 2026-04-10 23:46:12 -0700 |
|---|---|---|
| committer | wukong <wukong@longaeva> | 2026-04-10 23:46:12 -0700 |
| commit | 4c4eb1bd8f003b3b57707badd2dd089ed193a896 (patch) | |
| tree | 15b62907fffd70c46a9b4369df93ab33c6aa88ac /lpf.awk | |
| parent | e7d1781578e846a7b1d634cd43c8fab00a67b883 (diff) | |
renamed fir window generators;
minor edits to whitespace and comments for more consistent style;
Diffstat (limited to '')
| -rw-r--r-- | lpf.awk | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -1,7 +1,8 @@ #!/usr/bin/awk -f
### lpf.awk
-# Low Pass Filter with Hardcoded FIR Window
+# low pass filter with hardcoded FIR window
+
BEGIN {
OFS = FS
@@ -20,19 +21,22 @@ BEGIN { window_size = split(H, H_arr, "[ ]*")
}
+
+# column headers
NR == 1 {
for (y=1; y<=NF; y++)
($y ~ number) ? header[y] = "col" y : header[y] = $y
}
+
+# read input data
NF > 0 {
- if (NF > nf_max)
- nf_max = NF
+ (NF > nf_max) ? nf_max = NF : nf_max = nf_max
input_size = window_size
output_size = (input_size + window_size - 1)
- ### columns
+ # columns
for (y=1; y<=nf_max; y++) {
if ($y == header[y])
printf(header[y] OFS header[y] "_lpf")
@@ -75,15 +79,13 @@ NF > 0 { printf(ORS)
}
-
-
-
}
+
END {
- ### rows
+ # rows
for (x=1; x<=window_size; x++) {
- ### columns
+ # columns
for (y=1; y<=nf_max; y++) {
# rotate input buffer
for (n=1; n<=input_size; n++) {
@@ -93,7 +95,7 @@ END { #delete X_arr[y,input_size]
#input_size = length(X_arr)
#print length(X_arr)
-
+
Y[y] = 0
for (n=1; n<=window_size; n++) {
for (m=1; m<=input_size; m++) {
@@ -120,7 +122,7 @@ END { printf(OFS)
else
printf(ORS)
- X_arr[input_size] = 0
+ X_arr[input_size] = 0
}
}
}
|
