Yes, the FITS standard allows these particular special case duplicate fields, 
but the PDL FITS readers has never supported them. It was done by hashes and of 
course hashes can only have one key. I imagine to get what you want you would 
have to modify Astro::FITS::Header either with special code our to use  
Tie::DxHash (which is probably overkill)

Karl


> On 29 Apr 2017, at 3:20 am, ejm <[email protected]> wrote:
> 
> Hi all,
> 
> I have a question about PDL::IO::FITS and in particular the methods hdr & 
> gethdr.
> 
> I've got a Moose script that works fine with PDL::IO::FITS and adds fine the 
> usual FITS fields to a FITS 
> header. The resulting FITS file is read fine by SAOImage and the FITS fields 
> are in the order I want.
> 
> The problem is with fields that are potential duplicates such as COMMENT and 
> HISTORY.
> 
> I noticed that PDL::IO::FITS doesn't make use of Tie::DxHash which 
> specifically handles duplicate keys in tied hashes. Nor does 
> Astro::FITS::Header.
> 
> I also don't see exported in PDL::IO::FITS the methods insert or index from 
> Astro::FITS::Header which might be the right methods to call for adding 
> COMMENT fields.
> 
> When I create a tied hash using Tie::DxHash and copy over the data returned 
> by gethdr, I get a tied hash with duplicate COMMENT fields in the order I 
> want.
> 
> I then save the resultant updated FITS header hash using sethdr.
> 
> But when I view the FITS file in SAOImage for example I see the added fields 
> in alphabetical order, not the tied order they were saved in. I also don't 
> see any COMMENT fields.
> 
> If I don't use Tie::DxHash, but just add the COMMENT field directly to the 
> tied hash returned by gethdr, I get only 1 COMMENT field in the header, with 
> the last value assigned to it, which makes sense since Tie::DxHash isn't 
> being used. Hence no duplicate keys allowed.
> 
> What is the recommended way to add multiple COMMENT fields using 
> PDL::IO::FITS ?
> 
> Thanks, 
> 
> --Ed
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> pdl-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pdl-general


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to