Commit 858bb76e authored by Tom Dwelly's avatar Tom Dwelly
Browse files

added calculation of AB mag at cursor position

parent ffe45b23
......@@ -1141,13 +1141,16 @@ document.body.addEventListener('mousedown', function (evt){
var dflux_dy = (y1-y0)/(ysize-2.*pady);
var lobs = (mousePos.x - padx1)*dl_dx + x0;
var flux = (ysize - mousePos.y - pady)*dflux_dy + y0;
//https://en.wikipedia.org/wiki/AB_magnitude
var Jy = 3.34e4*(lobs*lobs)*flux*1e-17;
var AB = -2.5*Math.log10(Jy/3631.);
var lrest = lobs / (znow + 1.);
var str = sprintf("(%s,%s,F%s)=(%.2f%s, %.2f%s, %.2f%s)",
var str = sprintf("(%s,%s,F%s,AB)=(%.2f%s, %.2f%s, %.2f%s, %.2f)",
String.fromCharCode(955,8338), String.fromCharCode(955,7523), String.fromCharCode(955),
lobs,String.fromCharCode(8491),lrest,String.fromCharCode(8491),flux,
String.fromCharCode(215)+"10"+String.fromCharCode(8315,185,8311)+" erg cm"+String.fromCharCode(8315,178) +" s"+ String.fromCharCode(8315,185) + " " + String.fromCharCode(8491,8315,185));
ctx.clearRect (xsize-44.*padx2, ysize-0.6*pady, xsize, ysize);
ctx.fillText(str, xsize-22.*padx2, ysize-0.2*pady);
String.fromCharCode(215)+"10"+String.fromCharCode(8315,185,8311)+" erg cm"+String.fromCharCode(8315,178) +" s"+ String.fromCharCode(8315,185) + " " + String.fromCharCode(8491,8315,185), AB);
ctx.clearRect (xsize-47.*padx2, ysize-0.6*pady, xsize, ysize);
ctx.fillText(str, xsize-23.*padx2, ysize-0.2*pady);
}
}
else
......
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