Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion FilterReview/FilterReview.js
Original file line number Diff line number Diff line change
Expand Up @@ -1835,6 +1835,50 @@ function update_hidden(source) {

}

// Get estimated post filter checkboxes that can be selected
function get_estimate_checkboxes() {
let ret = []
for (let i = 0; i < 3; i++) {
// Estimate needs pre-filter data for this gyro
if (find_instance(i, false) == null) {
continue
}
for (let j = 0; j < axis.length; j++) {
const checkbox = document.getElementById("Gyro" + i + "PostEst" + axis[j])
if (!checkbox.disabled) {
ret.push({ checkbox, gyro: i, axis: axis[j], axis_index: j })
}
}
}
return ret
}

// Show the estimated post filter if none is shown. Only for gyros with some pre-filter shown, for the axes the logged
// post filter is shown for, or all axes if that is none
function show_estimated() {
let estimates = get_estimate_checkboxes()
if (estimates.some((estimate) => estimate.checkbox.checked)) {
return
}
const pre_shown = (gyro) => axis.some((name) => document.getElementById("Gyro" + gyro + "Pre" + name).checked)
estimates = estimates.filter((estimate) => pre_shown(estimate.gyro))
let shown = estimates.filter((estimate) => document.getElementById("Gyro" + estimate.gyro + "Post" + estimate.axis).checked)
if (shown.length == 0) {
shown = estimates
}
for (const estimate of shown) {
estimate.checkbox.checked = true
fft_plot.data[get_FFT_data_index(estimate.gyro, 2, estimate.axis_index)].visible = true
}
Plotly.redraw("FFTPlot")
}

// Recalculate after filter parameter change and show the estimated post filter
function recalculate_filters() {
re_calc()
show_estimated()
}

function get_HNotch_param_names() {
let prefix = ["INS_HNTCH_", "INS_HNTC2_"]
let ret = []
Expand Down Expand Up @@ -2032,7 +2076,7 @@ async function load_parameters(file) {
}

filter_param_read()
re_calc()
recalculate_filters()
}

// Get selected filter version
Expand Down
10 changes: 5 additions & 5 deletions FilterReview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ <h1 style="text-align:center; margin-block-end: 0.25em;"><a href="" style="color
data-tippy-maxWidth='750px'/>
</legend>
<div style="display:grid;grid-template-columns:1fr 1fr;grid-template-rows:repeat(3,auto);grid-auto-flow:column;row-gap:2px">
<span title="Original filter implementation."><input type="radio" id="filter_version_1" name="filter_version" onchange="loading_call(re_calc)"><label for="filter_version_1">1.0</label></span>
<span title="New strategy when tracking frequencies under the minimum limit. Adds multi-source throttle notch and minimum frequency ratio."><input type="radio" id="filter_version_2" name="filter_version" onchange="loading_call(re_calc)"><label for="filter_version_2">2.0</label></span>
<span title="Quintuple (5) notch added but not functional."><input type="radio" id="filter_version_3" name="filter_version" onchange="loading_call(re_calc)"><label for="filter_version_3">3.0</label></span>
<span title="Quintuple (5) notch fully functional."><input type="radio" id="filter_version_4" name="filter_version" onchange="loading_call(re_calc)"><label for="filter_version_4">4.0</label></span>
<span title="Original filter implementation."><input type="radio" id="filter_version_1" name="filter_version" onchange="loading_call(recalculate_filters)"><label for="filter_version_1">1.0</label></span>
<span title="New strategy when tracking frequencies under the minimum limit. Adds multi-source throttle notch and minimum frequency ratio."><input type="radio" id="filter_version_2" name="filter_version" onchange="loading_call(recalculate_filters)"><label for="filter_version_2">2.0</label></span>
<span title="Quintuple (5) notch added but not functional."><input type="radio" id="filter_version_3" name="filter_version" onchange="loading_call(recalculate_filters)"><label for="filter_version_3">3.0</label></span>
<span title="Quintuple (5) notch fully functional."><input type="radio" id="filter_version_4" name="filter_version" onchange="loading_call(recalculate_filters)"><label for="filter_version_4">4.0</label></span>
</div>
</fieldset>
</td>
Expand Down Expand Up @@ -452,7 +452,7 @@ <h2 style="text-align:center">Filter Configuration
data-tippy-maxWidth='750px'/>
</legend>
<p>
<input type="button" id="calculate_filters" value="Recalculate filters" onclick="loading_call(re_calc)">
<input type="button" id="calculate_filters" value="Recalculate filters" onclick="loading_call(recalculate_filters)">
<input type="button" id="SaveParams" value="Save Parameters" onclick="save_parameters();">
<button class="styleClass" id="LoadParams" onclick="document.getElementById('LoadParamsbase').click()">Load Parameters</button>
<input type='file' id="LoadParamsbase" style="display:none" onchange="load_parameters(this.files[0]);">
Expand Down
Loading