Closed pixelzoom closed 10 months ago
Reproducable locally with http://localhost:8080/fourier-making-waves/fourier-making-waves_en.html?brand=phet&ea&debugger&audio=disabled&fuzz&listenerOrder=random(341952)
That provides this more useful stack trace:
Assertion failed: viewValue should be finite: NaN
window.assertions.assertFunction @assert.js:24
modelToView @ChartTransform.ts:130
forEachSpacing @ChartTransform.ts:106
update @TickLabelSet.ts:135
changedListener @TickLabelSet.ts:113
emit @TinyEmitter.ts:123
emit @Emitter.ts:62
setModelYRange @ChartTransform.ts:264
(anonymous) @WavePacketComponentsChartNode.ts:145
At WavePacketComponentsChartNode lines 144 & 145:
const maxY = 1.1 * peakAmplitude;
this.chartTransform.setModelYRange( new Range( -maxY, maxY ) );
If there are no components (see #241), then peakAmplitude
will be zero, resulting in Range( 0, 0 ). That causes this assertion to fail in ChartTransform, because Utils.linear
with Range( 0, 0 ) returns Infinity
.
const viewValue = axisOrientation === Orientation.HORIZONTAL ?
Utils.linear( transform.evaluate( modelRange.min ), transform.evaluate( modelRange.max ), lowSide, highSide, transformedValue ) :
Utils.linear( transform.evaluate( modelRange.max ), transform.evaluate( modelRange.min ), lowSide, highSide, transformedValue );
assert && assert( Number.isFinite( viewValue ), `viewValue should be finite: ${viewValue}` );
The failure in WavePacketComponentsChartNode is in a listener for componentDataSetsProperty
:
componentDataSetsProperty.link( componentDataSets => {
...
const maxY = 1.1 * peakAmplitude;
145 this.chartTransform.setModelYRange( new Range( -maxY, maxY ) );
componentDataSetsProperty
is defined in WavePacketComponentsChart:
this.componentDataSetsProperty = new DerivedProperty(
[ wavePacket.componentsProperty, wavePacket.componentSpacingProperty, domainProperty, seriesTypeProperty, xAxisDescriptionProperty ],
( components, componentSpacing, domain, seriesType, xAxisDescription ) => {
let dataSets: Vector2[][] = EMPTY_DATA_SET;
if ( components.length > 0 ) {
dataSets = WavePacketComponentsChart.createComponentsDataSets( components, componentSpacing, domain,
seriesType, xAxisDescription.range );
}
return dataSets;
} );
With the Wave Packet screen only (&screens=3
), the sim will fail on startup using URL:
http://localhost:8080/fourier-making-waves/fourier-making-waves_en.html?brand=phet&ea&debugger&audio=disabled&screens=3&fuzz&listenerOrder=random(341952)
Adding an assertion to WavePacketComponentsChartNode:
+ assert && assert( peakAmplitude !== 0, `peakAmplitude=${peakAmplitude} numberOfComponents=${numberOfComponents}` );
const maxY = 1.1 * peakAmplitude;
this.chartTransform.setModelYRange( new Range( -maxY, maxY ) );
Results in this console output:
Assertion failed: peakAmplitude=0 numberOfComponents=25
I'm giving up on this and opting out of listOrderRandom
tests for CT. See https://github.com/phetsims/fourier-making-waves/issues/240#issuecomment-1876091788.
Related to https://github.com/phetsims/fourier-making-waves/issues/240, moved to its own issue.