[fitsbits] [Fwd: cfitisio/wcslib inheritance]

Peter Bunclark psb at ast.cam.ac.uk
Fri Jun 2 03:10:44 EDT 2006


Mark Calabretta wrote:
> On Wed 2006/05/31 14:43:55 -0400, William Pence wrote
> in a message to: FITSBITS <fitsbits at nrao.edu>
> 
>>forwarded from the sci.astro.fits newsgroup....
>>
>>-------- Original Message --------
>>Subject: cfitisio/wcslib inheritance
>>Date: Thu, 25 May 2006 10:01:11 +0100
>>From: Peter Bunclark <psb at ast.cam.ac.uk>
>>Organization: University of Cambridge, England
>>Newsgroups: sci.astro.fits
>>
>>Is there a simple way to inherit the primary header when using
>>fits_hdr2str and wcspih ?  The particular case being, EQUINOX and
>>RADESYS are in the primary (which has NAXIS  = 0) and the rest
>>of the WCS in the extesions of a MEF.
> 
> 
> Dear Peter,
> 
> wcspih() doesn't pay all that much attention to NAXIS (and ignores
> NAXISi).  The number of axes it infers for each of the 27 possible
> coordinate descriptions is the maximum of NAXIS, WCSAXESa, and the
> maximum value of i or j in the CTYPEia, CRPIXia, PCi_ja, etc. cards;
> the number may vary for each description 'a'.  (It counts axes on a
> first pass through the header, allocates memory, then constructs the
> coordinate descriptions on a second pass.)
> 
> 
>>If I concatenate the strings from hdr2str for the primary and
>>each extension, will wcspih skim past the initial dataless
>>header?
> 
> 
> I'm reasonably confident that it will work, but the proof would simply
> be to try it!
> 
> Of course, such inheritance between HDUs is non-standard.  I would also
> add that these keywords have an alternate version code, i.e. EQUINOXa
> and RADESYSa; if unqualified they apply only to the primary description
> and are not inherited by any secondaries.  (The only exceptions in this
> regard are OBSGEO-X/Y/Z, DATE-OBS, DATE-AVG, MJD-OBS, and MJD-AVG.)
> 
> Regards,
> Mark Calabretta
> ATNF
> 
Thanks chaps.  I had used NAXIS as an example where a parser might get
confused, rather than the one and only central issue.
Perhaps inheritance isn't in the standard, but I'd say it's becoming
common practice. In the case of VISTA (4m IR telescope at ESO/Paranal 
end of 2006) there are 16 extensions so inheritance is a real
efficiency.
I did the experiment and by concatenating each successive data header
to the primary and parsing the whole lot, it all seems to work fine.
But if I could add to the wish list, it would be good if wcspih could
inherit - so you would parse the primary, then when parsing each
extension, flag that you remember old stuff and overwrite if there
happens to be replacements in the inheriting header.

Also, I was glad to see there was a technical reason why my original
post was ignored for a week!

Cheers
	Pete.



More information about the fitsbits mailing list