read FITS header keyword using IDL Astronomy users's library [message #73210] |
Mon, 01 November 2010 09:47  |
Truong Le
Messages: 42 Registered: September 2010
|
Member |
|
|
All,
Does anyone know if one can use the IDL astronomy users's library to
obtain just the header
keyword (in other word, I want to check if a header keyword exist in
the FITS file)?
I checked the library but could really see any procedure that actually
does what I really wanted.
Thanks
|
|
|
Re: read FITS header keyword using IDL Astronomy users's library [message #73344 is a reply to message #73210] |
Tue, 02 November 2010 07:57  |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
On Nov 1, 1:08 pm, polystethylene <polystethyl...@hotmail.com> wrote:
> On Nov 1, 4:47 pm, Truong Le <truong...@gmail.com> wrote:
>
>> All,
>
>> Does anyone know if one can use the IDL astronomy users's library to
>> obtain just the header
>> keyword (in other word, I want to check if a header keyword exist in
>> the FITS file)?
>
>> I checked the library but could really see any procedure that actually
>> does what I really wanted.
>
>> Thanks
>
> SXPAR will do this for you...
>
> i.e...
>
> fits = READFITS('data',header)
> result = SXPAR(header,'keyword',COUNT=A)
>
> I think if you then do
>
> print,COUNT
>
> and zero is returned, the keyword isn't present...
Also note that if you only want to read in the header and not the rest
of the file, you can use HEADFITS instead of READFITS.
-Jeremy.
|
|
|
Re: read FITS header keyword using IDL Astronomy users's library [message #73355 is a reply to message #73210] |
Mon, 01 November 2010 10:26  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
On Nov 1, 1:08 pm, polystethylene <polystethyl...@hotmail.com> wrote:
> On Nov 1, 4:47 pm, Truong Le <truong...@gmail.com> wrote:
>
>> All,
>
>> Does anyone know if one can use the IDL astronomy users's library to
>> obtain just the header
>> keyword (in other word, I want to check if a header keyword exist in
>> the FITS file)?
>
>> I checked the library but could really see any procedure that actually
>> does what I really wanted.
>
>> Thanks
>
> SXPAR will do this for you...
>
>
Yes, and here's a little function if you want it..
function fits_keyword_exist,file,keyword,exten=exten
;return 1 if specified keyword exists in FITS file header. Primary
header
;is searched unless EXTEN keyword is set.
hdr = headfits(file,exten=exten)
dum = sxpar(hdr,keyword,count=count)
return,count<1
end
IDL> print,fits_keyword_exist('test.fits','bitpix')
1
|
|
|
Re: read FITS header keyword using IDL Astronomy users's library [message #73356 is a reply to message #73210] |
Mon, 01 November 2010 10:26  |
Truong Le
Messages: 42 Registered: September 2010
|
Member |
|
|
On Nov 1, 1:08 pm, polystethylene <polystethyl...@hotmail.com> wrote:
> On Nov 1, 4:47 pm, Truong Le <truong...@gmail.com> wrote:
>
>> All,
>
>> Does anyone know if one can use the IDL astronomy users's library to
>> obtain just the header
>> keyword (in other word, I want to check if a header keyword exist in
>> the FITS file)?
>
>> I checked the library but could really see any procedure that actually
>> does what I really wanted.
>
>> Thanks
>
> SXPAR will do this for you...
>
> i.e...
>
> fits = READFITS('data',header)
> result = SXPAR(header,'keyword',COUNT=A)
>
> I think if you then do
>
> print,COUNT
>
> and zero is returned, the keyword isn't present...
Great, thanks!
|
|
|
Re: read FITS header keyword using IDL Astronomy users's library [message #73359 is a reply to message #73210] |
Mon, 01 November 2010 10:08  |
polystethylene
Messages: 28 Registered: February 2009
|
Junior Member |
|
|
On Nov 1, 4:47 pm, Truong Le <truong...@gmail.com> wrote:
> All,
>
> Does anyone know if one can use the IDL astronomy users's library to
> obtain just the header
> keyword (in other word, I want to check if a header keyword exist in
> the FITS file)?
>
> I checked the library but could really see any procedure that actually
> does what I really wanted.
>
> Thanks
SXPAR will do this for you...
i.e...
fits = READFITS('data',header)
result = SXPAR(header,'keyword',COUNT=A)
I think if you then do
print,COUNT
and zero is returned, the keyword isn't present...
|
|
|