@@ -28,6 +28,7 @@ export default function LightCurvePlot() {
2828 dataType, dataSelection, xAxis, errorBars, noOfBins, noOfDataPoint,
2929 plotType, pointSize, lineWidth, legendFontSize, labelFontSize, tooltipFontSize,
3030 figure, rawFigure, avgPointRawMap, filterPercent, isRawFilterInside, selectedSeries, rawFilterMode, sigmaK,
31+ uploadedDatasets, viewType,
3132 setSettings
3233 } = usePlotSettings ( ) ;
3334
@@ -131,14 +132,43 @@ function applyRawFilter(
131132
132133 for ( const sel of dataSelection ) {
133134 const [ epoch , r1 , r2 ] = sel . split ( '_' ) ;
134- // const makePath = (wave: 'sw' | 'lw') => `https://raw.githubusercontent.com/iDataVisualizationLab/jwst-data/main/data/json/ZTF_J1539/rawdata/${epoch}/${wave}/${r1}/${r2}.json`;
135- const makePath = ( wave : 'sw' | 'lw' ) => `${ process . env . DATA_PATH } /data/json/${ selectedSeries } /rawdata/${ epoch } /${ wave } /${ r1 } /${ r2 } .json` ;
135+
136+ // // const makePath = (wave: 'sw' | 'lw') => `https://raw.githubusercontent.com/iDataVisualizationLab/jwst-data/main/data/json/ZTF_J1539/rawdata/${epoch}/${wave}/${r1}/${r2}.json`;
137+ // const makePath = (wave: 'sw' | 'lw') => `${process.env.DATA_PATH}/data/json/${selectedSeries}/rawdata/${epoch}/${wave}/${r1}/${r2}.json`;
136138
137139 try {
138- const [ swJson , lwJson ] = await Promise . all ( [
139- fetch ( makePath ( 'sw' ) ) . then ( r => r . json ( ) ) ,
140- fetch ( makePath ( 'lw' ) ) . then ( r => r . json ( ) )
141- ] ) ;
140+ let swJson ;
141+ let lwJson ;
142+
143+ if ( selectedSeries === 'local' ) {
144+ const dataset = uploadedDatasets [ sel ] ;
145+
146+ if ( ! dataset ) {
147+ console . warn ( "Missing local dataset:" , sel ) ;
148+ continue ;
149+ }
150+
151+ if ( dataset . type === 'raw' ) {
152+ swJson = dataset . sw ;
153+ lwJson = dataset . lw ;
154+ } else {
155+ console . warn ( "Matrix dataset used in LightCurvePlot:" , sel ) ;
156+ continue ;
157+ }
158+
159+ } else {
160+ const makePath = ( wave : 'sw' | 'lw' ) =>
161+ `${ process . env . DATA_PATH } /data/json/${ selectedSeries } /rawdata/${ epoch } /${ wave } /${ r1 } /${ r2 } .json` ;
162+
163+ [ swJson , lwJson ] = await Promise . all ( [
164+ fetch ( makePath ( 'sw' ) ) . then ( r => r . json ( ) ) ,
165+ fetch ( makePath ( 'lw' ) ) . then ( r => r . json ( ) )
166+ ] ) ;
167+ }
168+ // const [swJson, lwJson] = await Promise.all([
169+ // fetch(makePath('sw')).then(r => r.json()),
170+ // fetch(makePath('lw')).then(r => r.json())
171+ // ]);
142172
143173 const timeKey = xKeyMap [ xAxis ] ;
144174 for ( const dType of dataTypeSorted ) {
@@ -161,7 +191,7 @@ function applyRawFilter(
161191 // markerBorderColor = '#000000';
162192 // lineColor = '#000000';
163193 }
164- const { traces : traceSW , patch : patchSW } = addTrace ( { wave : 'SW' , json : swJson , axis : xAxis , mode : dType , noOfBins, noOfDataPoint, timeKey, epoch, r_in : r1 , r_out : r2 , avgPointRawMap, markerFillColor, markerBorderColor, lineColor, plotType : plotType as 'lines' | 'markers' | 'lines+markers' , errorBars : errorBars as 'bar' | 'hide' | 'separate' | undefined , pointSize, lineWidth, dataMode } ) ;
194+ const { traces : traceSW , patch : patchSW } = addTrace ( { wave : 'SW' , json : swJson , axis : xAxis , mode : dType , viewType : viewType , noOfBins, noOfDataPoint, timeKey, epoch, r_in : r1 , r_out : r2 , avgPointRawMap, markerFillColor, markerBorderColor, lineColor, plotType : plotType as 'lines' | 'markers' | 'lines+markers' , errorBars : errorBars as 'bar' | 'hide' | 'separate' | undefined , pointSize, lineWidth, dataMode } ) ;
165195 rawTracesSW . push ( ...traceSW ) ;
166196 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
167197 // @ts -expect-error
@@ -185,7 +215,7 @@ function applyRawFilter(
185215 )
186216 }
187217 } ) ) ;
188- const { traces : traceLW , patch : patchLW } = addTrace ( { wave : 'LW' , json : lwJson , axis : xAxis , mode : dType , noOfBins, noOfDataPoint, timeKey, epoch, r_in : r1 , r_out : r2 , avgPointRawMap, markerFillColor, markerBorderColor, lineColor, plotType : plotType as 'lines' | 'markers' | 'lines+markers' , errorBars : errorBars as 'bar' | 'hide' | 'separate' | undefined , pointSize, lineWidth, dataMode } ) ;
218+ const { traces : traceLW , patch : patchLW } = addTrace ( { wave : 'LW' , json : lwJson , axis : xAxis , mode : dType , viewType : viewType , noOfBins, noOfDataPoint, timeKey, epoch, r_in : r1 , r_out : r2 , avgPointRawMap, markerFillColor, markerBorderColor, lineColor, plotType : plotType as 'lines' | 'markers' | 'lines+markers' , errorBars : errorBars as 'bar' | 'hide' | 'separate' | undefined , pointSize, lineWidth, dataMode } ) ;
189219 rawTracesLW . push ( ...traceLW ) ;
190220
191221 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -773,9 +803,14 @@ function applyRawFilter(
773803 // const imgThumbnailsSrc = `https://raw.githubusercontent.com/iDataVisualizationLab/jwst-data/main/img/thumbnails/ZTF_J1539/${first.cd.filename}`;
774804 // const imgThumbnailsSrc = `https://raw.githubusercontent.com/iDataVisualizationLab/jwst-data/main/img/full-size/ZTF_J1539/${first.cd.filename}`;
775805 // const imgSrc = `https://raw.githubusercontent.com/iDataVisualizationLab/jwst-data/main/img/full-size/ZTF_J1539/${first.cd.filename}`;
776- const imgThumbnailsSrc = `${ process . env . DATA_PATH } /img/full-size/${ selectedSeries } /${ first . cd . filename } ` ;
777- const imgSrc = `${ process . env . DATA_PATH } /img/full-size/${ selectedSeries } /${ first . cd . filename } ` ;
778-
806+
807+
808+ // const imgThumbnailsSrc = `${process.env.DATA_PATH}/img/full-size/${selectedSeries}/${first.cd.filename}`;
809+ // const imgSrc = `${process.env.DATA_PATH}/img/full-size/${selectedSeries}/${first.cd.filename}`;
810+
811+ // TODO: fix hard code on selected series here
812+ const imgThumbnailsSrc = `${ process . env . DATA_PATH } /img/full-size/ZTF_J1539/${ first . cd . filename } ` ;
813+ const imgSrc = `${ process . env . DATA_PATH } /img/full-size/ZTF_J1539/${ first . cd . filename } ` ;
779814 setSelectedImages ( prev =>
780815 prev . map ( p => ( {
781816 ...p ,
0 commit comments