Error reading raw int16 FITS file with fitsread

조회 수: 2 (최근 30일)
Robert Farley
Robert Farley 2023년 6월 6일
댓글: Robert Farley 2023년 6월 9일
The command, "KAF = fitsread(fnami2);" imports the fits file data. However, the command,
"KAF=fitsread(fnami2,'raw');" returns the errors:
Error in matlab.io.fits.readImg (line 85)
imgdata = matlab.internal.imagesci.fitsiolib('read_subset',fptr,fpixel,lpixel,inc);
Error in fitsread>read_image_hdu (line 449)
data = fits.readImg(fptr);
Error in fitsread (line 140)
data = read_image_hdu(info,1,raw,pixelRegion);
Error in Read_KAF2 (line 27)
KAF=fitsread(fnami2,'raw');
The fits file is [3056, 3056] uint16 data that we want to use as raw digital numbers without the default scaling.
Thank you for any assisstance you may provide.

답변 (1개)

Nikhil
Nikhil 2023년 6월 6일
Hi Robert,
You maybe getting this error due to different version of MATLAB.
Or try this:
% Obtain information about the FITS file
info = fitsinfo(fnami2);
% Get the primary HDU (Header Data Unit) index
primaryHDU = info.PrimaryData.Key;
% Open the FITS file
fitsFile = fits.openFile(fnami2);
% Read the image data from the primary HDU as raw digital numbers
imageData = fits.readImg(fitsFile, primaryHDU);
% Close the FITS file
fits.closeFile(fitsFile);
% Assign the data to the variable KAF
KAF = imageData;
  댓글 수: 1
Robert Farley
Robert Farley 2023년 6월 9일
Hi Nikhil,
Thanks for the answer, but info.PrimaryData.Key doesn't exist so that command returns an error. There is an info.PrimaryData.Keywords structure with the following variables:
Field Value
imfo.PrimaryData.Keywords 'int16'
imfo.PrimaryData.Offset [3056,3056]
imfo.PrimaryData.Slope 18678272
imfo.PrimaryData.Intercept [ ]
imfo.PrimaryData.MissingDataValue 32768
imfo.PrimaryData.DataSize 1
imfo.PrimaryData.Size 5760
imfo.PrimaryData.DataType 39x3 cell
I read the fitsread.html webpage that indicates KAF=fitsread(fnami2,'raw'); should work.
Thanks for trying, but the only command provided to read raw fits data appears not to work.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by