comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » MWRFITS not writing header
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
MWRFITS not writing header [message #93285] Mon, 06 June 2016 04:28 Go to next message
tho.siegert is currently offline  tho.siegert
Messages: 6
Registered: April 2014
Junior Member
Hi,

I am trying to write a struct to a fits file and want to put a header into the header of the fits file.
Writing the struct is fine but the header is not present at all after the file has been created or an extension has been added.

For the header I am reading another fits file's header and simply want to use this one. Doesn't work either.

Even the minimal example

a=lonarr(10,10,10)
hdr='COMMENT This is a comment line to put in the header''
mwrfits,a,'test.fits',hdr

does not include the head in the "test.fits" file.
I get no errors.

I cannot use writefits because the input struct is not accepted by the program.

Any suggestions?

Thomas
Re: MWRFITS not writing header [message #93287 is a reply to message #93285] Mon, 06 June 2016 08:23 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Monday, June 6, 2016 at 7:28:07 AM UTC-4, Thomas Siegert wrote:

>
> Even the minimal example
>
> a=lonarr(10,10,10)
> hdr='COMMENT This is a comment line to put in the header''
> mwrfits,a,'test.fits',hdr
>
> does not include the head in the "test.fits" file.

You have to include a real FITS header not just a string. There are rules for a FITS header: for example the second line must start with BITPIX and say how many bits per pixel are in the data. You can use
http://idlastro.gsfc.nasa.gov/ftp/pro/fits/mkhdr.pro
to create a minimal FITS header given an array

Now two caveats:
1. The documentation for MWRFITS was incorrect (though it is now fixed
http://idlastro.gsfc.nasa.gov/ftp/pro/fits/mwrfits.pro ) which is what probably what led you to think you could supply a string rather than a FITS header.

2. I am not sure why using a FITS header from another file didn't work. Note that this FITS header must be written at the same time as the structure, or else it will be put in a different FITS extension.

--Wayne
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: anyone using "an introduction to programmin g with IDL, by Kenneth P Bowman ?
Next Topic: contour problem (Triangle not in counterclockwise order)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:05:41 PDT 2025

Total time taken to generate the page: 0.12245 seconds