-
Notifications
You must be signed in to change notification settings - Fork 9
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
wavelength slider has a bad range #763 #206
Comments
this.wavelengthProperty = new Property( solutionProperty.get().molarAbsorptivityData.lambdaMax /*nm*/, {
tandem: tandem.createTandem( 'wavelengthProperty' ),
phetioValueType: TNumber( { units: 'nanometers' } )
} ); The above description seems to imply that the proxy slider doesn't change this value. You should confirm that first, because I don't believe it. The animated gif shows that the wavelength slider doesn't update. The wavelength slider is scenery-phet |
If I remember correctly (and this issue was from a long time ago, so please forgive me if this is incorrect), once I begin moving the tandem slider manually, the page becomes largely unresponsive due to an extreme amount of error reporting. So no, the slider would update under normal circumstances (like if it had the correct range) and only doesn't update here due to the page seizing up. |
@phet-steele said:
Do you recall (or can your reproduce) the error reporting? |
I remembered only slightly correctly. You do get a bunch of errors, but they just cause the sim/wrapper to become unresponsive, not the browser page: The errors (though they probably wouldn't happen if the range was fixed):
|
The assertion that's failing is in MolarAbsorptivityData.wavelengthToMolarAbsorptivity: /*
* Maps a visible wavelength to its corresponding molar absorptivity.
* @param {number} wavelength
* @returns {number}
*/
MolarAbsorptivityData.prototype.wavelengthToMolarAbsorptivity = function( wavelength ) {
36 assert && assert( wavelength >= VisibleColor.MIN_WAVELENGTH && wavelength <= VisibleColor.MAX_WAVELENGTH );
var index = Math.floor( wavelength - VisibleColor.MIN_WAVELENGTH );
return this.molarAbsorptivity[ index ];
}; So something (instance-proxies?) is providing a wavelength that is outside the visible spectrum, and is therefore invalid. |
How do I determine the range of the sliders in the instance-proxies wrapper? Specifically the range of the slider associated with |
Yes, that slider has a range of 0 - 1 inclusive. All tandem sliders have this range as a default until overridden with a custom range (hence this issue). |
Ranges ARE shown when customized, but perhaps they could be shown always. |
I have no idea what "when customized" means. |
Sounds like you knew that this was the issue? If that's the case, wish someone had said so, would have save me like 45 minutes. |
Something like this from FAMB: // @public - force applied to the stack of items by the pusher
this.appliedForceProperty = new Property( 0, {
tandem: tandem.createTandem( 'appliedForceProperty' ),
phetioValueType: TNumber( { units: 'newtons', range: new Range( -500, 500 ) } )
} );
When this issue was logged a LONG time ago, custom ranges were not supported. Now they are, and this slider should be changed, |
That's not true, they were! |
I changed this.wavelengthProperty = new NumberProperty( solutionProperty.get().molarAbsorptivityData.lambdaMax /*nm*/, {
range: new Range( VisibleColor.MIN_WAVELENGTH, VisibleColor.MAX_WAVELENGTH ),
tandem: tandem.createTandem( 'wavelengthProperty' ),
phetioValueType: TNumber( {
units: 'nanometers'
} )
} ); And the problem persists. Apparently PhET-iO doesn't know about NumberProperty So I'm stuck using Property for now, like this: this.wavelengthProperty = new Property( solutionProperty.get().molarAbsorptivityData.lambdaMax /*nm*/, {
tandem: tandem.createTandem( 'wavelengthProperty' ),
phetioValueType: TNumber( {
units: 'nanometers',
range: new Range( VisibleColor.MIN_WAVELENGTH, VisibleColor.MAX_WAVELENGTH )
} )
} ); |
Fixed in above commit. @phet-steele please confirm in instance-proxies, feel free to close. |
Looks beautiful. |
This is a good example of why sim-specific phet-io issues belong in sim-specific repositories. This issue was created as phetsims/phet-io#763 in October 2016. And because it wasn't in beers-law-lab, I had no idea it existed. It was moved here 1 day ago, and now it's fixed. |
From https://github.com/phetsims/phet-io/issues/763
beersLawLab.beersLawScreen.model.light.wavelengthProperty: TProperty
seems to do nothing good. Sliding it does not change the wavelength, and only serves to cause the probe to report NaN. Sliding without the light emitter turned on reveals the slider has a range of 0 to 1:For phetsims/tasks/issues/718.
Edit: now also for phetsims/tasks/issues/724.
@zepumph can you please check on this?
The text was updated successfully, but these errors were encountered: