Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI: update interval fails for "with add" #99

Open
PrometheusPi opened this issue Sep 4, 2019 · 3 comments
Open

GUI: update interval fails for "with add" #99

PrometheusPi opened this issue Sep 4, 2019 · 3 comments

Comments

@PrometheusPi
Copy link
Member

I tested isaac using the default KHI example (with gamma=3).

In order to plot the particle momentum according to the min max range, I used the "With add" option to automatically optimize the range. However, the new range did not stick to the plotable range of [0-1] but went outside the plotable range. There seems to be an issue with this new range. I will provide screen shots below.

@PrometheusPi
Copy link
Member Author

Range set manual:

grafik

grafik
(not ideal setting - since it is slightly below zero)

Range set automatically:
starting from mul(1,0,0) (only x-component of momentum) then pressing (with "With add")
grafik

grafik

starting from idem (also x-component of momentum only) then pressing (with "With add")
it looks better but does not give useful ranges
grafik

grafik

@PrometheusPi
Copy link
Member Author

One part of the issue seems to come from that fact that adding add(0.5) on a vector quantity actually means add( 0.5, 0.5, 0.5), which of course, if you just rescaled values with mul(x) to ( [-1,+1], ~0, ~0 ) - that you now end up with ( [-0.5,+1.5], ~0.5, ~0.5 ) - which is exactly what one gets one optimizing automatically with "With add".

@PrometheusPi
Copy link
Member Author

The relevant code is here:

function createOptimizedFunction(i, minmax, with_add) {
return function () {
var mul = 1 / (minmax["max"] - minmax["min"]);
var function_string = document.getElementById("f_" + i + "_string");
if (function_string.value == "idem" || function_string.value == "")
functions[i] = "mul(" + mul.toFixed(5) + ")";
else
functions[i] = function_string.value + " | mul(" + mul.toFixed(5) + ")";
if (with_add)
functions[i] += " | add(0.5)";
function_string.value = functions[i];
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant