I have a bunch of fits files that can be read using the below script
from astropy.io import fits
hdu = fits.open('file.fits')
data = hdu[0].data
I am trying to make an image cube using the data read from multiple fits files. (An image cube is a 3D image that contains data from multiple fits file where the x and y axis is the 2D image dimension and the 3rd axis is time or frequency)
I believe it can be done usin spectral _cube module, however most of the documentation only talks about how to read an image cube and not how to make one using individual fits files.
So far I have tried the following script.
#In the below script data is a 3D numpy array
from spectral_cube import SpectralCube
cube = SpectralCube(data=data)
cube.write('new_cube.fits', format='fits')
However, the above script gives an error saying 3 arguments required while only 2 given.