Commit 0c6913ee authored by Tom Dwelly's avatar Tom Dwelly
Browse files

add sky transmission vector

parent 72f2dede
......@@ -43,6 +43,8 @@ var fluxerrArray= [];
var skyArray = [];
var modelArray = [];
var residualArray = [];
var skyTransLambdaArray = [];
var skyTransFluxArray = [];
var smoothedArray = [];
var smoothedresidualArray = [];
var templatelambdaArray = [];
......@@ -214,6 +216,7 @@ function startUpTasks()
readSpecFile(); //the get is asynchronous, so don't put anything after this that depends on the read
changeTemplate();
}
readSkyTrans();
}
......@@ -546,7 +549,22 @@ function changeTemplate() {
}
function readSkyTrans() {
var templateURL = "templates/eso_skycalc_transmission_R3000.txt";
//read in the file
var jQResult = jQuery.get(templateURL, function(data) {
var lines = [];
lines = data.split("\n");
//file format: lambda(A),flux
var templateLength = 0;
for(var i=0;i<lines.length;i++) {
var data = [];
data = lines[i].split(",");
skyTransLambdaArray[i] = Number(data[0]);
skyTransFluxArray[i] = Number(data[1]);
};
})
}
function plotData() {
ctx.canvas.width = Math.max(1000, window.innerWidth * 0.96);
......@@ -854,6 +872,27 @@ function plotData() {
ctx.stroke();
ctx.closePath();
}
//draw the sky transmission curve
if ( document.getElementById("ToggleTrans").checked )
{
var skytransmult = Math.max(0.0,y0) + 0.5*(y1 -Math.max(0,y0));
ctx.strokeStyle = "#0000aa";
ctx.beginPath();
for(var i=0;i<skyTransLambdaArray.length;i++){
var x = padx1 + (skyTransLambdaArray[i]-x0)*dx_inv;
if ( x >= padx1 && x <= xsize-padx2 )
{
var y = ysize - pady - (skyTransFluxArray[i]*skytransmult-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 )
......
......@@ -242,7 +242,9 @@
<span style="color: #008800;">Lines</span></label>
<label><input type="checkbox" onclick="plotData();" value="ToggleSky" id="ToggleSky" >
<span style="color: #00dddd;">Sky</span>&nbsp;&#215;</label>
<input id="skyMult" type="text" value="0.05" onchange="plotData();" size="5" title="Sky flux multiplier">
<input id="skyMult" type="text" value="0.05" onchange="plotData();" size="5" width="6" title="Sky flux multiplier">
<label><input type="checkbox" onclick="plotData();" value="ToggleTrans" id="ToggleTrans" title="Show a generic model of the sky transmission vector (ESO skycalc, AM=1.3, Paranal)">
<span style="color: #0000aa;">Sky Trans.</span></label>
</td>
</tr>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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