Here's a link to the source code for FITS.pm. The code you want is lines 2066ff.
https://metacpan.org/source/CHM/PDL-2.006/IO/FITS/FITS.pm On Oct 1, 2013, at 5:28 PM, Craig DeForest <[email protected]> wrote: > Ah. You don't want Astro::FITS::Header, you want this page: > http://fits.gsfc.nasa.gov/fits_standard.html > > It's at GSFC so you may or may not be able to get it today! > > The main things that may trip you up are: > > -all keywords are case-insensitive - if you're making a FITS header from a > perl hash that isn't tied to Astro::FITS::Header, you should make them ALL > CAPS > -non-alphanumeric characters are mostly not allowed (hyphens and underscores > *are* allowed) > -8 characters is the max length of a keyword. > -FITS headers come in increments of 24 80-character fixed-length Hollerith > card images WITH NO RETURN-CARRIAGE AT THE END. That's because FITS was > invented when Hollerith cards were commonly found around computers. > -69 characters is the max length of a string value (80 per card image; 8 of > them are for the keyword, 1 for the '=', and 2 for the quotes around the > string). > > A basic minimum header for an image is: > > $h = {SIMPLE=>T, > NAXIS=>2, > NAXIS1=> $im->dim(0), > NAXIS2=> $im->dim(1), > DATATYPE => -32, # for float type; use -64 for double > END => ' ' > } > > Keyword order matters, so if you're using a Perl hash you need to write > particular keywords in a particular order into the FITS file. Have a look at > PDL::IO::FITS - the wfits method contains some contingency code in case > Astro::FITS::Header isn't available. > > > On Oct 1, 2013, at 4:24 PM, duckyphysics <[email protected]> wrote: > >> Thanks. I gave the referring URL in my initial message: >> http://pdl.perl.org/PDLdocs/Core.html >> >> The Astro package is referenced several times on that page. I'm actually >> trying to obtain (or at least read the documentation for) >> Astro::FITS::Header because I want to create a valid FITS header from >> scratch that will behave correctly in SAODS9. When I try to set keywords in >> a perl hash, not all of them are propagated through to the final image that >> DS9 sees. >> >> >> >>> You'll have to give the URL of the page referring to the dead >>> link for it to be removed or fixed. Astro::FITS::Header is not >>> in the PDL distribution so maybe that is why the link doesn't go >>> anywhere. The docs are available via perldoc if you have the >>> module installed, or http://search.cpan.org or http://metacpan.org >>> if needed. >>> >>> --Chris >>> >>> >>> On Mon, Sep 30, 2013 at 8:00 PM, duckyphysics <[email protected]> >>> wrote: >>>> Hello, >>>> >>>> I was following a link from http://pdl.perl.org/PDLdocs/Core.html to >>>> http://pdl.perl.org/Astro/FITS/Header.html, but the latter is dead. Upon >>>> further investigation, everything under /Astro gives 404. The page >>>> provides the following error text: >>>> >>>> -- >>>> An error has been encountered in accessing this page. >>>> >>>> 1. Server: pdl.perl.org >>>> 2. URL path: /Astro/FITS/Header.html >>>> 3. Error notes: NONE >>>> 4. Error type: 404 >>>> 5. Request method: GET >>>> 6. Request query string: NONE >>>> 7. Time: 2013-09-30 23:47:36 UTC (1380584856) >>>> -- >>>> >>>> Thanks. >>>> _______________________________________________ >>>> Perldl mailing list >>>> [email protected] >>>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl >> >> >> _______________________________________________ >> Perldl mailing list >> [email protected] >> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl >> > > _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
