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 #70929] Fri, 21 May 2010 12:37 Go to previous message
sid is currently offline  sid
Messages: 50
Registered: January 1995
Member
On May 16, 9:13 pm, Gray <grayliketheco...@gmail.com> wrote:
> On May 16, 10:31 am, sid <gunvicsi...@gmail.com> wrote:
>
>
>
>> On May 15, 9:21 pm, Craig Markwardt <craig.markwa...@gmail.com> wrote:
>
>>> 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
>
>> Thank you this works now i could able to read the size of ccd as a
>> variable.
>> In my data header I have a line like the one below,
>
>> COMMENT = 090222 Lat=40N exp=50s seeing 3",
>
>> in this line I need to read the lat=40N that is the value 40 as a idl
>> variable which I need use for further analysis,
>> but if I do the same process like,img = mrdfits(filename,0,header) and
>> value = fxpar(header, comment),
>> then it prints the whole sentence '090222 Lat=40N exp=50s seeing
>> 3"' .
>> So can anyone suggest is there any way to read only the desired part
>> of the string.
>
>> regards
>> sid
>
> STRSPLIT will split the comment into multiple elements, then
> WHERE(STREGEX(/Boolean)) will tell you which one you want, then GETTOK
> or STRSPLIT will extract the value.

Thank you everyone, i could do the job with
strsplit(variable,'string',/extract)
regards
sid
[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: Wed Oct 08 18:16:36 PDT 2025

Total time taken to generate the page: 0.00243 seconds