Commit 598c01df authored by Caillat Michel's avatar Caillat Michel
Browse files

correction in forula used to display summed graph title

parent 99cfd200
...@@ -372,7 +372,6 @@ ...@@ -372,7 +372,6 @@
*/ */
function getSummedSpectrumTitle(avgSpectrum, imin, imax, cdelt3prim){ function getSummedSpectrumTitle(avgSpectrum, imin, imax, cdelt3prim){
let result = 0; let result = 0;
console.log(" ###getSummedSpectrumTitle");
if (_ctype3 === 'VRAD' && _cdelt3 < 0){ if (_ctype3 === 'VRAD' && _cdelt3 < 0){
let copy = (x) => x; let copy = (x) => x;
let arraycopy = avgSpectrum.map(copy); let arraycopy = avgSpectrum.map(copy);
...@@ -380,13 +379,20 @@ ...@@ -380,13 +379,20 @@
}else{ }else{
result = sumArr(avgSpectrum, imin, imax, cdelt3prim); result = sumArr(avgSpectrum, imin, imax, cdelt3prim);
} }
return result/unitRescale(summedPixelsSpectrumUnit(_bunit)); return result/unitRescale(summedPixelsSpectrumUnit(_bunit));
} }
function getCalculatedIndex(value){ function getCalculatedIndex(value){
let val1 = (unitFactor[defaultOutputUnit[_ctype3]]/unitFactor[getCunit3()]) / _cdelt3; let result = 0;
let result = Math.abs(value * val1) - _crval3 + _crpix3 -1; if(_ctype3 === 'VRAD'){
let step1 = (unitFactor[defaultOutputUnit[_ctype3]]/unitFactor[getCunit3()]) / _cdelt3;
result = Math.abs(value * step1) - _crval3 + _crpix3 -1;
}else if(_ctype3 === 'FREQ'){
// if ctype is FREQ we have to read defaultOutputUnit['VRAD']
let step1 = v2f(value * unitFactor[defaultOutputUnit['VRAD']] , _restfreq);
let step2 = (step1 - _crval3) / _cdelt3;
result = step2 + _crpix3 -1;
}
return Math.round(result); return Math.round(result);
} }
......
Supports Markdown
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