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
50 changes: 50 additions & 0 deletions FilterReview/FilterReview.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ function reset() {
document.getElementById("filter_version_1").checked = true
document.getElementById("calculate").disabled = true
document.getElementById("calculate_filters").disabled = true
document.getElementById("EstimateHint").hidden = true
document.getElementById("OpenFilterTool").disabled = true
document.getElementById("SaveParams").disabled = true
document.getElementById("LoadParams").disabled = true
Expand Down Expand Up @@ -1833,6 +1834,55 @@ function update_hidden(source) {

Plotly.redraw("FFTPlot")

// Hide estimate hint once any estimate is shown
if (!document.getElementById("EstimateHint").hidden) {
update_estimate_hint()
}

}

// Get estimated post filter checkboxes that can be selected
function get_estimate_checkboxes() {
let ret = []
for (let i = 0; i < 3; i++) {
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] })
}
}
}
return ret
}

// Prompt to show the estimated post filter lines if they are all hidden
function update_estimate_hint() {
const estimates = get_estimate_checkboxes()
const hidden = (estimates.length > 0) && !estimates.some((estimate) => estimate.checkbox.checked)
document.getElementById("EstimateHint").hidden = !hidden
}

// Show estimated post filter lines for the axes that are shown, or all if none are shown
function show_estimated() {
const estimates = get_estimate_checkboxes()
let shown = estimates.filter((estimate) => {
const pre = document.getElementById("Gyro" + estimate.gyro + "Pre" + estimate.axis)
const post = document.getElementById("Gyro" + estimate.gyro + "Post" + estimate.axis)
return pre.checked || post.checked
})
if (shown.length == 0) {
shown = estimates
}
for (const estimate of shown) {
estimate.checkbox.checked = true
update_hidden(estimate.checkbox)
}
}

// Recalculate after filter parameter change
function recalculate_filters() {
re_calc()
update_estimate_hint()
}

function get_HNotch_param_names() {
Expand Down
7 changes: 5 additions & 2 deletions FilterReview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -445,18 +445,21 @@ <h2 style="text-align:center">Filter Configuration
</fieldset>
</td>
<td>
<fieldset style="width:428px;height:70px">
<fieldset style="width:428px;min-height:70px">
<legend>Setup
<img id="TT" src="../images/question-circle.svg" style="width: 1em; vertical-align: bottom"
data-tippy-content='Recalculate filters after changing any parameters to update the estimated post filter spectrum. Save or load parameters to/from a param file.',
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]);">
</p>
<p id="EstimateHint" style="margin-block-start: 0" hidden>
Estimated post-filter lines are hidden. <input type="button" value="Show estimated" onclick="show_estimated()">
</p>
</fieldset>
</td>
</tr>
Expand Down
Loading