-
Notifications
You must be signed in to change notification settings - Fork 16
FIREFLY-116:Evaluate the wavelength readouts from various types of FITS and fix any Errors #827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, almost there!
I've tested most of the files attached and i can see now the wavelength in the toolbar when is a cube.
Unfortunately, the Spherex sample are not showing the wavelength in the readout. Unless i'm wrong, i thought the Spherex files are following pretty much the standard of spectral coordinates (spectral image).
Could you look at those sample and see why is not showing up in the readout? Thanks!
@ejoliet |
Ok, i'll take a look but just for the records here, i did tested 'test' and 'testLinear' files and wavelength is shown inn the display! Yay!!
|
@ejoliet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've looked at all the tickets with 'cubes' label in it and seems all ok now!
Pretty neat!!!
Only the Spherex case above but it's minor and it shouldn't block the merge of the PR.
I'll mark it as approved, waiting for @robyww to comment. Thanks!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good. There is some code clean up I would like you to do. After that I think it is ready to go.
@@ -129,7 +128,8 @@ export function makeDoubleHeaderParse(header,zeroHeader,altWcs) { | |||
getDoubleAry(keyRoot,altWcs, startIdx,endIdx,def=undefined) { | |||
if (startIdx>endIdx) return def; | |||
const retAry= hp.getDoubleAry(keyRoot,altWcs,startIdx,endIdx); | |||
if (retAry) return retAry; | |||
let arrNaN = retAry.filter( (v)=> isNaN(v) ); | |||
if (arrNaN.length!==retAry.length) return retAry; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two getDoubleAry
functions has different behaviors. the first never passes the default back (unless the parameters are wrong) the other check to see if every elements is null. They really should have the same behavior. If you want failure (therefore default) to be that every element is null then the first should do that as well. If you want this current hybrid behavior you probably should have another function name in makeDoubleHeaderParse
getDoubleAry
in makeHeaderParse
should to the check to determine if if should return the default or it is not that useful in other context.
} | ||
|
||
} | ||
function assignDefault(inArr, keyRoot, which, N){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would be better to name this routine more clearly. It look like a general reusable name to it has a specific purpose.
Also you might want to document it. I am having trouble understanding what it is doing.
*/ | ||
function getPC_ijKey(header, zeroHeader,which){ | ||
|
||
var key; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be let
hasPC = true; | ||
break; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably need to make a new routine in FitsHeaderUtil
, makeHeaderParse
call something like hasKeyStartingWith()
and add one to makeDoubleHeaderParse
as well.
} | ||
} | ||
if (hasPC && hasCD){ | ||
throw Error('The FITs header contains both PC_ij and CD_ij'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to throw exceptions here, That has the potential to break all the new image processing. Just return a a false
or something and return an undefined
in the calling function.
|
||
//We only support the standard format in the FITs header. The standard means the CTYPEka='WAVE-ccc" where | ||
//ccc can be 'F2W', 'V2W', 'LOG', 'TAB' or empty that means linear. If the header does not have this kind | ||
// CTYPEka defined, we check if the it is a spectra cube. If it is a spectra cube, we display the wavelength |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good docs.
@@ -2,12 +2,14 @@ | |||
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt | |||
*/ | |||
|
|||
import {makeDoubleHeaderParse} from '../FitsHeaderUtil.js'; | |||
import {makeDoubleHeaderParse,getHeader} from '../FitsHeaderUtil.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove getHeader
it is not used
@@ -7,7 +7,9 @@ import {AWAV, F2W, LINEAR, LOG, PLANE, TAB, V2W, WAVE} from './Wavelength.js'; | |||
|
|||
export function parseWavelengthHeaderInfo(header, altWcs='', zeroHeader, wlTable) { | |||
const parse= makeDoubleHeaderParse(header, zeroHeader, altWcs); | |||
return calculateWavelengthParams(parse,altWcs, wlTable); | |||
const which= altWcs?'1':getWCSAXES(parse); | |||
const mijMatrixKeyRoot = getPC_ijKey(parse,which); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check and return if this value is undefined
1. Fixed the 0 wavelength at the first plane bug 2. Fixed the wrong read out in _data_SOFIA_FIFI-LS_L4_2016-07-05_FI_F316_p3993_g10_F0316_FI_IFS_04015210_BLU_WXY_600284-700065.fits 3. Disable the wavelength read out if the header is not the standard header for wavelength
The wavelength implementation is carefully evaluated based on algorithm described in three reference papers. Default values are enforced. Three bugs are fixed. Please see ticket https://jira.ipac.caltech.edu/browse/FIREFLY-116 for more information.
Test URL: https://irsawebdev9.ipac.caltech.edu/FIREFLY-116/firefly/