Create multiple frames with fits file
Show older comments
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 Comments
Walter Roberson
on 17 Apr 2019
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?
Kiruthiga Sekar
on 17 Apr 2019
Walter Roberson
on 17 Apr 2019
Edited: Walter Roberson
on 17 Apr 2019
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.
Kiruthiga Sekar
on 17 Apr 2019
Walter Roberson
on 17 Apr 2019
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.
Kiruthiga Sekar
on 17 Apr 2019
Walter Roberson
on 17 Apr 2019
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.
Kiruthiga Sekar
on 17 Apr 2019
Walter Roberson
on 17 Apr 2019
if exist('new.fits', 'file'); delete('new.fits'); end
before you start writing data to it.
Answers (0)
Categories
Find more on Point Cloud Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!