A Space & astronomy forum. SpaceBanter.com

Go Back   Home » SpaceBanter.com forum » Astronomy and Astrophysics » FITS
Site Map Home Authors List Search Today's Posts Mark Forums Read Web Partners

reading a single value



 
 
Thread Tools Display Modes
  #1  
Old July 25th 03, 07:35 AM
Nico Vermaas
external usenet poster
 
Posts: n/a
Default reading a single value

Hi,

Would this be the right way to read a single value from a fits file?
(I add [x:x,y:y,z:z] to the filename and then read one float).

Nico

--
sprintf(filter,"%s[%d:%d,%d:%d,%d:%d]",this-filename,point[X],point[X],point[Y],point[Y],point[Z],point[Z]);
if (!fits_open_file(&fptr, filter, READONLY, &status)) {
fits_read_img(fptr,TFLOAT,1,1,0,buffer,0,&status);
} // if

================================================== ==
Nico Vermaas
ASTRON - Westerbork Radio Observatory
The Netherlands
================================================== ==
  #2  
Old July 28th 03, 07:14 PM
William Pence
external usenet poster
 
Posts: n/a
Default [fitsbits] reading a single value

Nico Vermaas wrote:

Would this be the right way to read a single value from a fits file?
(I add [x:x,y:y,z:z] to the filename and then read one float).

--
sprintf(filter,"%s[%d:%d,%d:%d,%d:%d]",this-filename,point[X],point[X],point[Y],point[Y],point[Z],point[Z]);
if (!fits_open_file(&fptr, filter, READONLY, &status)) {
fits_read_img(fptr,TFLOAT,1,1,0,buffer,0,&status);
} // if


Note that it would be better to send questions that are specific to CFITSIO
directly to me at the HEASARC, rather than posting them to this newsgroup.
To answer your question though, the above method of reading a single pixel
in an image will work, but it is rather unorthodox. (Also, the 7th parameter
in the fits_read_img call must be a pointer to an int, not 0). The more
direct way would be to first open the image (without any image section
filters) then:

long fpixel[3];
fpixel[0]=point[X];
fpixel[1]=point[Y];
fpixel[2]=point[Z];
fits_read_pix(fptr,TFLOAT,fpixel,1,0,buffer,&anynu l,&status);


-Bill Pence
--
__________________________________________________ __________________
Dr. William Pence William.D.Pence @ nasa.gov
NASA/GSFC Code 662 HEASARC +1-301-286-4599 (voice)
Greenbelt MD 20771 +1-301-286-1684 (fax)

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASTRONOMERS MEASURE MASS OF A SINGLE STAR -- FIRST SINCE THE SUN (STScI-PR04-24) INBOX ASTRONOMY: NEWS ALERT Astronomy Misc 0 July 15th 04 03:08 PM
FAQ-2-B: sci.space.tech reading list dave schneider Technology 11 June 10th 04 03:54 AM
multiple launch moon mission vs. Single Launch moon missions Fred K. Policy 2 March 20th 04 03:29 PM
Single stage to orbit, Atlas Jan Philips History 79 October 14th 03 07:05 AM


All times are GMT +1. The time now is 04:28 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 SpaceBanter.com.
The comments are property of their posters.