@@ -183,8 +183,8 @@ function IntroPopup({ onDataLoad, onLoadingStart, closePopup, isLoading, isDark
183183
184184 // Per-run accumulators (indexed arrays)
185185 const compFigures = Array . from ( { length : N } , ( ) => [ ] ) ;
186- const carpetFigures = [ ] ; // flat — already multi-run tolerant
187- const diagnosticFigures = [ ] ; // flat — already multi-run tolerant
186+ const carpetFigures = Array . from ( { length : N } , ( ) => [ ] ) ;
187+ const diagnosticFigures = Array . from ( { length : N } , ( ) => [ ] ) ;
188188 const info = new Array ( N ) . fill ( "" ) ;
189189 const components = new Array ( N ) . fill ( null ) . map ( ( ) => [ ] ) ;
190190 const originalData = new Array ( N ) . fill ( null ) . map ( ( ) => [ ] ) ;
@@ -223,11 +223,11 @@ function IntroPopup({ onDataLoad, onLoadingStart, closePopup, isLoading, isDark
223223 const blob = await response . blob ( ) ;
224224 const dataUrl = await blobToDataURL ( blob ) ;
225225 if ( filename . includes ( "carpet_" ) ) {
226- carpetFigures . push ( { name : filename , img : dataUrl } ) ;
226+ for ( const i of targets ) carpetFigures [ i ] . push ( { name : filename , img : dataUrl } ) ;
227227 } else if ( filename . includes ( "confound_correlations" ) ) {
228228 for ( const i of targets ) externalRegressorsFigure [ i ] = dataUrl ;
229229 } else {
230- diagnosticFigures . push ( { name : filename , img : dataUrl } ) ;
230+ for ( const i of targets ) diagnosticFigures [ i ] . push ( { name : filename , img : dataUrl } ) ;
231231 }
232232 setLoadingProgress ( ( prev ) => ( { ...prev , current : prev . current + 1 } ) ) ;
233233 }
@@ -414,13 +414,13 @@ function IntroPopup({ onDataLoad, onLoadingStart, closePopup, isLoading, isDark
414414 } ) ;
415415 await Promise . all ( filePromises ) ;
416416
417- // Sort component figures by name per run
417+ // Sort figures by name per run, apply manual classifications
418418 for ( let i = 0 ; i < N ; i ++ ) {
419419 compFigures [ i ] . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
420+ carpetFigures [ i ] . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
421+ diagnosticFigures [ i ] . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
420422 applyManualClassifications ( components [ i ] , manualClassificationData [ i ] ) ;
421423 }
422- carpetFigures . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
423- diagnosticFigures . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
424424
425425 trackDatasetLoaded ( ) ;
426426
@@ -553,8 +553,8 @@ function IntroPopup({ onDataLoad, onLoadingStart, closePopup, isLoading, isDark
553553
554554 // Per-run accumulators (indexed arrays)
555555 const compFigures = Array . from ( { length : N } , ( ) => [ ] ) ;
556- const carpetFigures = [ ] ; // flat — already multi-run tolerant
557- const diagnosticFigures = [ ] ; // flat — already multi-run tolerant
556+ const carpetFigures = Array . from ( { length : N } , ( ) => [ ] ) ;
557+ const diagnosticFigures = Array . from ( { length : N } , ( ) => [ ] ) ;
558558 const info = new Array ( N ) . fill ( "" ) ;
559559 const components = new Array ( N ) . fill ( null ) . map ( ( ) => [ ] ) ;
560560 const originalData = new Array ( N ) . fill ( null ) . map ( ( ) => [ ] ) ;
@@ -588,11 +588,11 @@ function IntroPopup({ onDataLoad, onLoadingStart, closePopup, isLoading, isDark
588588 if ( filename . endsWith ( ".svg" ) ) {
589589 const dataUrl = await readFileAsDataURL ( file ) ;
590590 if ( filename . includes ( "carpet_" ) ) {
591- carpetFigures . push ( { name : filename , img : dataUrl } ) ;
591+ for ( const i of targets ) carpetFigures [ i ] . push ( { name : filename , img : dataUrl } ) ;
592592 } else if ( filename . includes ( "confound_correlations" ) ) {
593593 for ( const i of targets ) externalRegressorsFigure [ i ] = dataUrl ;
594594 } else {
595- diagnosticFigures . push ( { name : filename , img : dataUrl } ) ;
595+ for ( const i of targets ) diagnosticFigures [ i ] . push ( { name : filename , img : dataUrl } ) ;
596596 }
597597 setLoadingProgress ( ( prev ) => ( { ...prev , current : prev . current + 1 } ) ) ;
598598 }
@@ -763,13 +763,13 @@ function IntroPopup({ onDataLoad, onLoadingStart, closePopup, isLoading, isDark
763763 // Wait for all files to be processed
764764 await Promise . all ( filePromises ) ;
765765
766- // Sort component figures by name per run, apply manual classifications
766+ // Sort figures by name per run, apply manual classifications
767767 for ( let i = 0 ; i < N ; i ++ ) {
768768 compFigures [ i ] . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
769+ carpetFigures [ i ] . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
770+ diagnosticFigures [ i ] . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
769771 applyManualClassifications ( components [ i ] , manualClassificationData [ i ] ) ;
770772 }
771- carpetFigures . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
772- diagnosticFigures . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
773773
774774 trackDatasetLoaded ( ) ;
775775
0 commit comments