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

tweaks to make estimation of meanFlux and x,y limits more robust

parent 4ee0c99a
......@@ -75,6 +75,7 @@ var x0=1e10; //will derive values of these params from spectrum
var x1=0.0;//
var y0=0.0; //
var y1=0.0; //
//var y1=1e-19; //
var orig_x0;
var orig_x1;
var orig_y0;
......@@ -310,8 +311,9 @@ function readSpecFileASCII()
fluxerrArray[j] = Number(data[2]);
skyArray[j] = Number(data[3]);
modelArray[j] = Number(data[4]);
if ( modelArray[j] > 1.0 * fluxerrArray[j] )
{ // the numeric value is the number of sigmas to accept
//calculate a clipped version of the mean of the flux
if ( Math.abs(fluxerrArray[j] - modelArray[j]) < 1.0 * Math.abs(modelArray[j] ))
{ // the numeric value is the number of multiples of model flux to accept
if ( fluxArray[j] < y0 ) y0 = fluxArray[j];
if ( fluxArray[j] > y1 ) y1 = fluxArray[j];
if ( fluxArray[j] > -1e10) {
......@@ -327,7 +329,10 @@ function readSpecFileASCII()
var str = "There was a problem with the specified specfile='"+specfile+"' (lambdaArray.length="+lambdaArray.length+")";
alert(str);
}else{
dy = (y1-Math.max(y0,0.0))*0.02; //only expand the range a little
if ( y1 <= y0 ) { y1 = y0 + 1.0; fluxMean = 0.5*(y0+y1);} //catch cases where no valid points
// console.log(y0);
// console.log(y1);
dy = (y1-Math.max(y0,0.0))*0.02; //expand the range a little
y1 = y1 + dy;
if(y0>=0.0) {
y0 = y0 - dy;
......@@ -369,7 +374,7 @@ function readSpecFileASCII()
function readSpecFile()
{
var extension = specfile.split('.').pop();
console.log(extension);
// console.log(extension);
if ( extension === "fits" ) {
readSpecFileFITS();
} 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