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

Home » Public Forums » archive » Re: reading header and manipulating according to the header information
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: reading header and manipulating according to the header information [message #71005 is a reply to message #71003] Sat, 15 May 2010 09:21 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On May 15, 12:02 pm, Craig Markwardt <craig.markwa...@gmail.com>
wrote:
> On May 15, 10:21 am, sid <gunvicsi...@gmail.com> wrote:> Hi,
>>     Since I am using huge data of several years, different kind of
>> ccds are used on different days. I need to trim the data to a size
>> which depends on ccd size, is there any method to read the header
>> information and take the ccd size from there and then to proceed
>> further, instead of giving the ccd size manually. Because it is really
>> very tedious to check for the ccd size each time and then to proceed.
>> Please help out.
>> For example,
>> in one of my data the ccd size that is 1K by 1k is given in header as,
>
> ...
>
> Anything you can do "manually," you can do in a program.  The hard
> part is usually to make it robust.
>
> Based on the headers you provided, it looks like you have FITS image
> files.  If you don't already have it, get the IDL Astronomy Library.
> It has many routines for reading FITS images and tables.  The easiest
> one to use is MRDFITS().  MRDFITS() returns the image array which you
> can query using SIZE() and then trim as needed.
>
> Simple example:
> filename = 'myfile.fits'
> img = mrdfits(filename) ;; Read image
> sz = size(img, /dim)    ;; Determine size of image
> szx = sz(0) ;; Number of columns
> szy = sz(1) ;; Number of rows
> img = img( (0+2):(szx-3) , (0+2):(szy-3) ) ;; Remove outermost two
> rows and columns

Oh, and if you need other header keywords, then you need to read the
header with a slightly different call to MRDFITS().
img = mrdfits(filename,0,header)
and then retrieve the keyword KEYNAME with FXPAR()
value = fxpar(header, keyname)

Craig
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to retain header info even after writefits
Next Topic: Re: color plot over greyscale image - postscript

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

Current Time: Fri Oct 10 14:14:47 PDT 2025

Total time taken to generate the page: 0.64356 seconds