Create multiple frames with fits file

Hi,
I am trying to create a single fits file with multiple frames. I have attached the Coding. At the end, i need to get a single fits file with 26 frames, but my code is producing just a single frame. Can someone please help? TIA

9 个评论

In your previous question https://www.mathworks.com/matlabcentral/answers/456817-select-multiple-frames-from-a-single-fits-file (which is waiting for a response from you), you were not dealing with multiple frames: you were dealing with a multidimensional array. Are you now trying to create multiple frames, or are you trying to create a multidimensional array?
Your previous question dealt with image frames, but the current one deals with primary data. Which one are you wanting to use?
That was a different code and this is a different code. I need to select 20 frames from 2700 frames of a single fits file, and create another fits file with the 20 frames.
That code looks like it should work. Did you try the second example at https://www.mathworks.com/help/matlab/ref/fitswrite.html to see whether it generally works?
What shows up when you fitsdisp() the output file?
I do notice that fitswrite() seems to create the first array as primary instead of Image, so the maximum index using fitsread(filename, 'image', index) format is one less than expected.
fitsdisp() output:
HDU : 1(Primary HDU)
%some values%
HDU : 2
%some values%
:
:
:
HDU: 76
%some values%
Do HDU 2 to 76 all show up with XTENSION = 'IMAGE '
If so then 2 through 76 are all frames that can be indexed with fitsread(filename, 'image', index) by using the HDU number minus one as the index (so index 1 to 75 in this case.). The first frame would have to be read with fitsread(filename, 'primary', 1) it appears.
I ran it now it is displaying upto HDU : 184
Yes . it is showing XTENSION = 'IMAGE' for 2 to 184 now!
Remember you are not deleting the file before you append to it, so the more you run the code, the longer the file is going to get.
Sorry.. I cant get what you are asking me to do.
if exist('new.fits', 'file'); delete('new.fits'); end
before you start writing data to it.

请先登录,再进行评论。

回答(0 个)

类别

产品

版本

R2019a

标签

Community Treasure Hunt

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

Start Hunting!

Translated by