Commit d58e51be authored by Tom Dwelly's avatar Tom Dwelly
Browse files

added flux-model residual curves to speccy

parent 4ee0c99a
......@@ -204,6 +204,8 @@
<span style="color: #aaaaaa;">Noise</span></label>
<label><input type="checkbox" onclick="plotData();" value="ToggleModel" id="ToggleModel" checked>
<span style="color: #dd0000;">Model</span></label>
<label><input type="checkbox" onclick="plotData();" value="ToggleResidual" id="ToggleResidual">
<span style="color: #ff8c00;">Residual</span></label>
<br>
<label><input type="checkbox" onclick="plotData();" value="ToggleLines" id="ToggleLines" checked>
<span style="color: #008800;">Lines</span></label>
......
......@@ -40,7 +40,9 @@ var fluxArray = [];
var fluxerrArray= [];
var skyArray = [];
var modelArray = [];
var residualArray = [];
var smoothedArray = [];
var smoothedresidualArray = [];
var templatelambdaArray = [];
var templatefluxArray = [];
var templateLength = 0;
......@@ -310,6 +312,7 @@ function readSpecFileASCII()
fluxerrArray[j] = Number(data[2]);
skyArray[j] = Number(data[3]);
modelArray[j] = Number(data[4]);
residualArray[j] = Number(fluxArray[j] - modelArray[j]);
if ( modelArray[j] > 1.0 * fluxerrArray[j] )
{ // the numeric value is the number of sigmas to accept
if ( fluxArray[j] < y0 ) y0 = fluxArray[j];
......@@ -357,7 +360,8 @@ function readSpecFileASCII()
//calc the smoothed flux array
var boxsize = $("input[type='radio'][name='smoothing']:checked").val();
smoothArray(fluxArray, smoothedArray, boxsize)
smoothArray(fluxArray, smoothedArray, boxsize);
smoothArray(residualArray, smoothedresidualArray, boxsize);
plotData();
writePipeInfo();
......@@ -749,6 +753,25 @@ function plotData() {
ctx.closePath();
}
//draw the residual flux curve
if ( document.getElementById("ToggleResidual").checked )
{
ctx.strokeStyle = "#ff8c00";
ctx.beginPath();
for(var i=0;i<lambdaArray.length;i++){
var x = padx1 + (lambdaArray[i]-x0)*dx_inv;
if ( x >= padx1 && x <= xsize-padx2 )
{
var y = ysize - pady - (smoothedresidualArray[i]-y0)*dy_inv;
var clip_y = Math.max(Math.min(y,ysize-pady),pady);
if ( i>=1) { ctx.lineTo(x,clip_y);}
else { ctx.moveTo(x,clip_y);}
}
}
ctx.stroke();
ctx.closePath();
}
//draw the model curve
if ( document.getElementById("ToggleModel").checked )
{
......@@ -850,6 +873,7 @@ function updateSmoothing(){
//re-calc the smoothed flux array
var boxsize = $("input[type='radio'][name='smoothing']:checked").val();
smoothArray(fluxArray, smoothedArray, boxsize);
smoothArray(residualArray, smoothedresidualArray, boxsize);
plotData();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment