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

Colour the source output levels #1

Open
stephband opened this issue Mar 3, 2013 · 11 comments
Open

Colour the source output levels #1

stephband opened this issue Mar 3, 2013 · 11 comments
Assignees

Comments

@stephband
Copy link
Member

Higher numbers should be 'hotter'. Hotter colours need to get hotter on a logarithmic, rather than linear scale.

@ghost ghost assigned stephband Mar 3, 2013
@goodhandd
Copy link
Contributor

I'll write an algorithm for you to implement.

@stephband
Copy link
Member Author

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.

@goodhandd
Copy link
Contributor

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.


Reply to this email directly or view it on GitHub.

@goodhandd
Copy link
Contributor

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.


Reply to this email directly or view it on GitHub.

@goodhandd
Copy link
Contributor

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.


Reply to this email directly or view it on GitHub.

@goodhandd
Copy link
Contributor

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.

@stephband
Copy link
Member Author

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...

@goodhandd
Copy link
Contributor

My only objection is that B in dB is capitalised. But that’s probably
irrelevant.

Yeah. It needs to be available to all sourcemodel objects and all the
source model objects need to fire an event when it changes.

@stephband
Copy link
Member Author

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?

@goodhandd
Copy link
Contributor

You are the professional. Don’t let me persuade you. dbMax is acceptable
and it is me that will change.

@goodhandd
Copy link
Contributor

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.

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

No branches or pull requests

2 participants