From e2a6770d1d8cdf299ab2dd0bbe965b96c99e3746 Mon Sep 17 00:00:00 2001
From: j-w9 <295470691+j-w9@users.noreply.github.com>
Date: Sat, 24 Oct 2026 12:13:06 -0400
Subject: [PATCH 1/6] FilterReview: warn if raw IMU data is missing for much of
the analysis time
---
FilterReview/FilterReview.js | 43 ++++++++++++++++++++++++++++++++++++
FilterReview/index.html | 3 +++
2 files changed, 46 insertions(+)
diff --git a/FilterReview/FilterReview.js b/FilterReview/FilterReview.js
index 9f0bdea5..e2ab6104 100644
--- a/FilterReview/FilterReview.js
+++ b/FilterReview/FilterReview.js
@@ -274,6 +274,42 @@ function HarmonicNotchFilter(params) {
return this
}
+// Warn if raw data is missing for a large part of the analysis time
+function update_missing_data_warning() {
+ for (let i = 0; i < 3; i++) {
+ let missing = 0
+ if (Gyro_batch.type == "raw") {
+ for (let j = 0; j < Gyro_batch.length; j++) {
+ if ((Gyro_batch[j] == null) || (Gyro_batch[j].sensor_num != i)) {
+ continue
+ }
+ missing = Math.max(missing, get_missing_fraction(Gyro_batch[j]))
+ }
+ }
+ let missing_label = document.getElementById("Gyro" + i + "_missing")
+ missing_label.hidden = missing < missing_data_warn_fraction
+ missing_label.lastElementChild.textContent = "Missing data: " + Math.round(missing * 100) + "% of analysis time"
+ }
+}
+
+// Fraction of analysis time that has no raw data, batches are split where data is missing
+const missing_data_warn_fraction = 0.1
+function get_missing_fraction(batches) {
+ const first = batches[0]
+ const last = batches[batches.length - 1]
+ const start = Math.max(parseFloat(document.getElementById("TimeStart").value), first.sample_time)
+ const end = Math.min(parseFloat(document.getElementById("TimeEnd").value), last.sample_time + (last.x.length / last.sample_rate))
+ if (!(end > start)) {
+ return 0
+ }
+ let covered = 0
+ for (const batch of batches) {
+ const batch_end = batch.sample_time + (batch.x.length / batch.sample_rate)
+ covered += Math.max(0, Math.min(end, batch_end) - Math.max(start, batch.sample_time))
+ }
+ return Math.max(0, 1 - (covered / (end - start)))
+}
+
function run_batch_fft(data_set) {
const num_batch = data_set.length
const num_points = data_set[0].x.length
@@ -378,6 +414,9 @@ function reset() {
document.getElementById("filter_version_1").checked = true
document.getElementById("calculate").disabled = true
document.getElementById("calculate_filters").disabled = true
+ for (let i = 0; i < 3; i++) {
+ document.getElementById("Gyro" + i + "_missing").hidden = true
+ }
document.getElementById("OpenFilterTool").disabled = true
document.getElementById("SaveParams").disabled = true
document.getElementById("LoadParams").disabled = true
@@ -763,6 +802,8 @@ function re_calc() {
calculate()
+ update_missing_data_warning()
+
load_filters()
calculate_transfer_function()
@@ -2690,6 +2731,8 @@ async function load(log_file) {
// Calculate FFT
calculate()
+ update_missing_data_warning()
+
// Update transfer function from filter setting
calculate_transfer_function()
diff --git a/FilterReview/index.html b/FilterReview/index.html
index caec117a..986a62b0 100644
--- a/FilterReview/index.html
+++ b/FilterReview/index.html
@@ -231,6 +231,7 @@
IMU Spectrum
Logging rate: Hz
Frequency resolution: Hz
+
@@ -284,6 +285,7 @@
IMU Spectrum
Logging rate: Hz
Frequency resolution: Hz
+
@@ -337,6 +339,7 @@
IMU Spectrum
Logging rate: Hz
Frequency resolution: Hz
+
From 2a4ff1588726e7a9b5bfd202672c96e300d7939c Mon Sep 17 00:00:00 2001
From: j-w9 <295470691+j-w9@users.noreply.github.com>
Date: Sat, 24 Oct 2026 12:13:40 -0400
Subject: [PATCH 2/6] FilterReview: move missing data reset into per gyro loop
---
FilterReview/FilterReview.js | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/FilterReview/FilterReview.js b/FilterReview/FilterReview.js
index e2ab6104..5462d257 100644
--- a/FilterReview/FilterReview.js
+++ b/FilterReview/FilterReview.js
@@ -414,9 +414,6 @@ function reset() {
document.getElementById("filter_version_1").checked = true
document.getElementById("calculate").disabled = true
document.getElementById("calculate_filters").disabled = true
- for (let i = 0; i < 3; i++) {
- document.getElementById("Gyro" + i + "_missing").hidden = true
- }
document.getElementById("OpenFilterTool").disabled = true
document.getElementById("SaveParams").disabled = true
document.getElementById("LoadParams").disabled = true
@@ -433,6 +430,7 @@ function reset() {
}
document.getElementById("SpecGyroInst" + i).disabled = true
document.getElementById("BodeGyroInst" + i).disabled = true
+ document.getElementById("Gyro" + i + "_missing").hidden = true
let fieldset = document.getElementById("Gyro" + i)
fieldset.style["border-color"] = "rgb(192, 192, 192)"
From 34bde32cf179f052f16ba4677bec457bc47c40ce Mon Sep 17 00:00:00 2001
From: j-w9 <295470691+j-w9@users.noreply.github.com>
Date: Sun, 8 Nov 2026 23:11:39 -0500
Subject: [PATCH 3/6] FilterReview: count missing data at the edges of the
analysis time
Clip to the time covered by all IMUs rather than this IMU's own data, so
an IMU that starts late, stops early or has no data in the window is
counted as missing.
---
FilterReview/FilterReview.js | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/FilterReview/FilterReview.js b/FilterReview/FilterReview.js
index 5462d257..c970cfda 100644
--- a/FilterReview/FilterReview.js
+++ b/FilterReview/FilterReview.js
@@ -295,10 +295,9 @@ function update_missing_data_warning() {
// Fraction of analysis time that has no raw data, batches are split where data is missing
const missing_data_warn_fraction = 0.1
function get_missing_fraction(batches) {
- const first = batches[0]
- const last = batches[batches.length - 1]
- const start = Math.max(parseFloat(document.getElementById("TimeStart").value), first.sample_time)
- const end = Math.min(parseFloat(document.getElementById("TimeEnd").value), last.sample_time + (last.x.length / last.sample_rate))
+ // Clip to the time covered by all IMUs, so an IMU that starts late or stops early is counted as missing
+ const start = Math.max(parseFloat(document.getElementById("TimeStart").value), Gyro_batch.start_time)
+ const end = Math.min(parseFloat(document.getElementById("TimeEnd").value), Gyro_batch.end_time)
if (!(end > start)) {
return 0
}
From f6d04e8f5cf93a35941539fdf9615488e59e1849 Mon Sep 17 00:00:00 2001
From: j-w9 <295470691+j-w9@users.noreply.github.com>
Date: Thu, 19 Nov 2026 18:23:58 -0500
Subject: [PATCH 4/6] FilterReview: show usable raw data from the FFT windows
The share of the analysis time used is now taken from the FFT windows rather
than the raw data sections, so it includes the data lost at the end of each
section that is too short for another whole window, and changes with the
window size. It is always shown for raw logs and turns red below 90%, the
gyro boxes keep the same height.
---
FilterReview/FilterReview.js | 56 ++++++++++++++++++++++++------------
FilterReview/index.html | 9 ++++--
2 files changed, 43 insertions(+), 22 deletions(-)
diff --git a/FilterReview/FilterReview.js b/FilterReview/FilterReview.js
index c970cfda..32fc12be 100644
--- a/FilterReview/FilterReview.js
+++ b/FilterReview/FilterReview.js
@@ -274,39 +274,57 @@ function HarmonicNotchFilter(params) {
return this
}
-// Warn if raw data is missing for a large part of the analysis time
-function update_missing_data_warning() {
+// Show how much of the analysis time is used for raw data, highlight if a lot is lost
+function update_usable_data() {
for (let i = 0; i < 3; i++) {
- let missing = 0
+ let usable = null
if (Gyro_batch.type == "raw") {
for (let j = 0; j < Gyro_batch.length; j++) {
- if ((Gyro_batch[j] == null) || (Gyro_batch[j].sensor_num != i)) {
+ if ((Gyro_batch[j] == null) || (Gyro_batch[j].sensor_num != i) || (Gyro_batch[j].FFT == null)) {
continue
}
- missing = Math.max(missing, get_missing_fraction(Gyro_batch[j]))
+ const fraction = get_usable_fraction(Gyro_batch[j].FFT)
+ if ((fraction != null) && ((usable == null) || (fraction < usable))) {
+ usable = fraction
+ }
}
}
- let missing_label = document.getElementById("Gyro" + i + "_missing")
- missing_label.hidden = missing < missing_data_warn_fraction
- missing_label.lastElementChild.textContent = "Missing data: " + Math.round(missing * 100) + "% of analysis time"
+ // Space is kept when there is no value so the gyro boxes stay the same height
+ let label = document.getElementById("Gyro" + i + "_usable")
+ label.style.visibility = (usable == null) ? "hidden" : ""
+ label.style.color = ((usable != null) && (usable < usable_data_warn_fraction)) ? "#c00000" : ""
+ label.textContent = "Usable data: " + Math.round((usable ?? 0) * 100) + "% of analysis time"
}
}
-// Fraction of analysis time that has no raw data, batches are split where data is missing
-const missing_data_warn_fraction = 0.1
-function get_missing_fraction(batches) {
- // Clip to the time covered by all IMUs, so an IMU that starts late or stops early is counted as missing
+// Fraction of the analysis time covered by the FFT windows used. Data is lost where it is missing from the
+// log, and at the end of each continuous section where there is not enough left for another whole window,
+// so this depends on the window size.
+const usable_data_warn_fraction = 0.9
+function get_usable_fraction(FFT) {
+ // Clip to the time covered by all IMUs, so an IMU that starts late or stops early counts as lost data
const start = Math.max(parseFloat(document.getElementById("TimeStart").value), Gyro_batch.start_time)
const end = Math.min(parseFloat(document.getElementById("TimeEnd").value), Gyro_batch.end_time)
if (!(end > start)) {
+ return null
+ }
+ if (FFT.time.length == 0) {
return 0
}
+
+ // Windows are in time order and overlap, count the time covered by any window once
+ const half_window = FFT.window_size / FFT.average_sample_rate / 2
let covered = 0
- for (const batch of batches) {
- const batch_end = batch.sample_time + (batch.x.length / batch.sample_rate)
- covered += Math.max(0, Math.min(end, batch_end) - Math.max(start, batch.sample_time))
+ let covered_to = start
+ for (let j = find_start_index(FFT.time); j <= find_end_index(FFT.time); j++) {
+ const window_start = Math.max(FFT.time[j] - half_window, covered_to)
+ const window_end = Math.min(FFT.time[j] + half_window, end)
+ if (window_end > window_start) {
+ covered += window_end - window_start
+ covered_to = window_end
+ }
}
- return Math.max(0, 1 - (covered / (end - start)))
+ return covered / (end - start)
}
function run_batch_fft(data_set) {
@@ -429,7 +447,7 @@ function reset() {
}
document.getElementById("SpecGyroInst" + i).disabled = true
document.getElementById("BodeGyroInst" + i).disabled = true
- document.getElementById("Gyro" + i + "_missing").hidden = true
+ document.getElementById("Gyro" + i + "_usable").style.visibility = "hidden"
let fieldset = document.getElementById("Gyro" + i)
fieldset.style["border-color"] = "rgb(192, 192, 192)"
@@ -799,7 +817,7 @@ function re_calc() {
calculate()
- update_missing_data_warning()
+ update_usable_data()
load_filters()
@@ -2728,7 +2746,7 @@ async function load(log_file) {
// Calculate FFT
calculate()
- update_missing_data_warning()
+ update_usable_data()
// Update transfer function from filter setting
calculate_transfer_function()
diff --git a/FilterReview/index.html b/FilterReview/index.html
index 986a62b0..19294958 100644
--- a/FilterReview/index.html
+++ b/FilterReview/index.html
@@ -231,7 +231,8 @@
IMU Spectrum
Logging rate: Hz
Frequency resolution: Hz
-
+
+
@@ -285,7 +286,8 @@
IMU Spectrum
Logging rate: Hz
Frequency resolution: Hz
-
+
+
@@ -339,7 +341,8 @@
IMU Spectrum
Logging rate: Hz
Frequency resolution: Hz
-
+
+
From cd2dde5054f29b49dfb03a6ae0f121a17abf2f11 Mon Sep 17 00:00:00 2001
From: j-w9 <295470691+j-w9@users.noreply.github.com>
Date: Thu, 19 Nov 2026 19:28:53 -0500
Subject: [PATCH 5/6] FilterReview: find the usable data window range once,
round before colouring
---
FilterReview/FilterReview.js | 9 ++++++---
FilterReview/index.html | 9 +++------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/FilterReview/FilterReview.js b/FilterReview/FilterReview.js
index 32fc12be..57d53af9 100644
--- a/FilterReview/FilterReview.js
+++ b/FilterReview/FilterReview.js
@@ -290,10 +290,11 @@ function update_usable_data() {
}
}
// Space is kept when there is no value so the gyro boxes stay the same height
+ const percent = Math.round((usable ?? 0) * 100)
let label = document.getElementById("Gyro" + i + "_usable")
label.style.visibility = (usable == null) ? "hidden" : ""
- label.style.color = ((usable != null) && (usable < usable_data_warn_fraction)) ? "#c00000" : ""
- label.textContent = "Usable data: " + Math.round((usable ?? 0) * 100) + "% of analysis time"
+ label.style.color = ((usable != null) && (percent < usable_data_warn_fraction * 100)) ? "#c00000" : ""
+ label.textContent = "Usable data: " + percent + "% of analysis time"
}
}
@@ -316,7 +317,9 @@ function get_usable_fraction(FFT) {
const half_window = FFT.window_size / FFT.average_sample_rate / 2
let covered = 0
let covered_to = start
- for (let j = find_start_index(FFT.time); j <= find_end_index(FFT.time); j++) {
+ const start_index = find_start_index(FFT.time)
+ const end_index = find_end_index(FFT.time)
+ for (let j = start_index; j <= end_index; j++) {
const window_start = Math.max(FFT.time[j] - half_window, covered_to)
const window_end = Math.min(FFT.time[j] + half_window, end)
if (window_end > window_start) {
diff --git a/FilterReview/index.html b/FilterReview/index.html
index 19294958..f28cf2e6 100644
--- a/FilterReview/index.html
+++ b/FilterReview/index.html
@@ -230,8 +230,7 @@
IMU Spectrum
Logging rate: Hz
- Frequency resolution: Hz
-
+ Frequency resolution: Hz
@@ -285,8 +284,7 @@
IMU Spectrum
Logging rate: Hz
- Frequency resolution: Hz
-
+ Frequency resolution: Hz
@@ -340,8 +338,7 @@
IMU Spectrum
Logging rate: Hz
- Frequency resolution: Hz
-
+ Frequency resolution: Hz
From f32f794668b0e7d71983bcecd2d61b52a30a1d6a Mon Sep 17 00:00:00 2001
From: j-w9 <295470691+j-w9@users.noreply.github.com>
Date: Fri, 20 Nov 2026 20:27:03 -0500
Subject: [PATCH 6/6] FilterReview: hide the usable data line until it has a
value
Hidden rather than invisible, so batch logs don't get a blank line.
---
FilterReview/FilterReview.js | 6 +++---
FilterReview/index.html | 12 ++++++------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/FilterReview/FilterReview.js b/FilterReview/FilterReview.js
index 57d53af9..6b9c91d4 100644
--- a/FilterReview/FilterReview.js
+++ b/FilterReview/FilterReview.js
@@ -289,10 +289,10 @@ function update_usable_data() {
}
}
}
- // Space is kept when there is no value so the gyro boxes stay the same height
+ // Only shown when there is a value
+ document.getElementById("Gyro" + i + "_usable_line").style.display = (usable == null) ? "none" : ""
const percent = Math.round((usable ?? 0) * 100)
let label = document.getElementById("Gyro" + i + "_usable")
- label.style.visibility = (usable == null) ? "hidden" : ""
label.style.color = ((usable != null) && (percent < usable_data_warn_fraction * 100)) ? "#c00000" : ""
label.textContent = "Usable data: " + percent + "% of analysis time"
}
@@ -450,7 +450,7 @@ function reset() {
}
document.getElementById("SpecGyroInst" + i).disabled = true
document.getElementById("BodeGyroInst" + i).disabled = true
- document.getElementById("Gyro" + i + "_usable").style.visibility = "hidden"
+ document.getElementById("Gyro" + i + "_usable_line").style.display = "none"
let fieldset = document.getElementById("Gyro" + i)
fieldset.style["border-color"] = "rgb(192, 192, 192)"
diff --git a/FilterReview/index.html b/FilterReview/index.html
index f28cf2e6..32496a27 100644
--- a/FilterReview/index.html
+++ b/FilterReview/index.html
@@ -230,8 +230,8 @@