-
Notifications
You must be signed in to change notification settings - Fork 1
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
Colour the source output levels #1
Comments
I'll write an algorithm for you to implement. |
I would like a function that maps a decibel value to a value between 0 and 1, as in: var heat = calcHeat(dBValue); // -> 0.667 That way we can define and modify the colour gradient separately. |
Sure - no problem. I will do this Saturday. It's going to need the array of noise levels at the receptor passed into it along with the noise level that we will colour. On 6 Mar 2013, at 04:02, stephband [email protected] wrote: I would like a function that maps a decibel value to a value between 0 and 1, as in: var heat = calcHeat(dBValue); // -> 0.667 That way we can define and modify the colour gradient separately. — |
This will need to be recalculated for each noise value whenever there is a change as it will be relative to the maximum noise level. The total noise level at the receptor we won't colour at all because to be meaningful that one would have to be an absolute heat depending on time of day and baseline noise levels, which the user doesn't define. On 6 Mar 2013, at 07:13, Daniel Goodhand [email protected] wrote: Sure - no problem. I will do this Saturday. It's going to need the array of noise levels at the receptor passed into it along with the noise level that we will colour. On 6 Mar 2013, at 04:02, stephband [email protected] wrote: I would like a function that maps a decibel value to a value between 0 and 1, as in: var heat = calcHeat(dBValue); // -> 0.667 That way we can define and modify the colour gradient separately. — |
We may need 3 colours as part of the gradient. 1 being one colour. 0 being another. 0.5 being another. 0.5 is going to be neutralish. On 6 Mar 2013, at 07:24, Daniel Goodhand [email protected] wrote: This will need to be recalculated for each noise value whenever there is a change as it will be relative to the maximum noise level. The total noise level at the receptor we won't colour at all because to be meaningful that one would have to be an absolute heat depending on time of day and baseline noise levels, which the user doesn't define. On 6 Mar 2013, at 07:13, Daniel Goodhand [email protected] wrote: Sure - no problem. I will do this Saturday. It's going to need the array of noise levels at the receptor passed into it along with the noise level that we will colour. On 6 Mar 2013, at 04:02, stephband [email protected] wrote: I would like a function that maps a decibel value to a value between 0 and 1, as in: var heat = calcHeat(dBValue); // -> 0.667 That way we can define and modify the colour gradient separately. — |
OK. I've written the function in AcousticFunctions.js. Writing the function is the easy part. The hard part is using it. The heat will be calculated as a relative thing so each sourcemodel heat will be impacted by changes to other sourcemodels. Basically, we need to define a global variable called dBmax or something similar. dBmax needs to be passed by reference (not by value!) to each source model object. Every time the calcTotal fires, we need the calculation dBmax = math.max(//array of all the sourcemodel outputs) to fire. Inside the source model object, the heat function fires whenever dBmax changes or the sourcemodel 'output' changes. |
Now what's all this about? I'm going to declare dbMax (and yes, I'm going to camelCase properly, I think, unless you have any objections) in the private 'class' part of noiseapp.views.source. That way that same variable is accessible to all instances... |
My only objection is that B in dB is capitalised. But that’s probably Yeah. It needs to be available to all sourcemodel objects and all the |
So is d in Daniel, but we wouldn't camelCase to DanielsAnIdiot. It would be danielsAnIdiot. However, I'm persuadable, as long as we stick to a convention, because these things can be a source of really annoying, needless bugs. You wrote dBmax, and to my mind that should at least be dBMax. How does it cased if it's on the end of a word? maxDB? maxdB? |
You are the professional. Don’t let me persuade you. dbMax is acceptable |
Stephen - I think this is low priority compared to two other issues that I'm about to add that would add a lot more value to the website with equivalent or less effort to implement. |
Higher numbers should be 'hotter'. Hotter colours need to get hotter on a logarithmic, rather than linear scale.
The text was updated successfully, but these errors were encountered: