diff options
-rw-r--r-- | fg21sim/webui/static/js/configs.js | 24 | ||||
-rw-r--r-- | fg21sim/webui/templates/configs.html | 15 |
2 files changed, 33 insertions, 6 deletions
diff --git a/fg21sim/webui/static/js/configs.js b/fg21sim/webui/static/js/configs.js index e1e9a93..f7e3731 100644 --- a/fg21sim/webui/static/js/configs.js +++ b/fg21sim/webui/static/js/configs.js @@ -597,4 +597,28 @@ $(document).ready(function () { .then(function () { return validateServerConfigs(ajax_url); }) .done(function () { updateFormConfigStatus(); }); }); + + // When field "common/nside" changed, update the resolution note, as well + // as the maximum multiple "common/lmax" + $("#conf-form input[name='common/nside']").on("change", function (e) { + var nside = parseInt($(this).val()); + // Update the resolution note (unit: arcmin) + var resolution = Math.sqrt(3/Math.PI) * 3600 / nside; + $(this).closest(".form-group").find(".note > .value") + .text(resolution.toFixed(2)); + // Also update the maximum multipole "common/lmax" + if (! isNaN(nside)) { + var lmax = 3 * nside - 1; + $("#conf-form input[name='common/lmax']").val(lmax).trigger("change"); + } + }); + $("#conf-form input[name='common/nside']").keypress(function (e) { + if (e.which === 13) { + var nside = parseInt($(this).val()); + // Update the resolution note (unit: arcmin) + var resolution = Math.sqrt(3/Math.PI) * 3600 / nside; + $(this).closest(".form-group").find(".note > .value") + .text(resolution.toFixed(2)); + } + }); }); diff --git a/fg21sim/webui/templates/configs.html b/fg21sim/webui/templates/configs.html index 8a8a251..fc97e91 100644 --- a/fg21sim/webui/templates/configs.html +++ b/fg21sim/webui/templates/configs.html @@ -60,16 +60,19 @@ <div class="body"> <hr class="hr-thin hr-condensed hr-dashed" /> <div class="row"> - <div class="column column-30 form-group"> - <label for="conf-common-nside"><i>N</i><sub>side</sub>:</label> + <div class="column form-group"> + <label for="conf-common-nside">HEALPix <i>N</i><sub>side</sub>:</label> <input class="form-control" type="number" id="conf-common-nside" name="common/nside" min="1" required /> + <span class="note">(resolution: <span class="value">?</span> arcmin/pixel)</span> </div> - <div class="column column-30 form-group"> - <label for="conf-common-lmin"><i>l</i><sub>min</sub>:</label> + </div> + <div class="row"> + <div class="column column-50 form-group"> + <label for="conf-common-lmin">Multipole <i>l</i><sub>min</sub>:</label> <input class="form-control" type="number" id="conf-common-lmin" name="common/lmin" min="0" required /> </div> - <div class="column column-30 form-group"> - <label for="conf-common-lmax"><i>l</i><sub>max</sub>:</label> + <div class="column column-50 form-group"> + <label for="conf-common-lmax">Multipole <i>l</i><sub>max</sub>:</label> <input class="form-control" type="number" id="conf-common-lmax" name="common/lmax" min="1" required /> </div> </div> |