I have a set of fits images: about 32000 images with resolution (256,256). The dataset that i've to build is matrix like, so the output shape is (32000, 256*256).
The simple solution is a for
loop, samething like:
#file_names is a list of paths
samples=[]
for file_name in file_names:
hdu=pyfits.open(file_name)
samples.append(hdu[0].data.flatten())
hdu.close()
#then i can use numpy.concatenate to have a numpy ndarray
This solution is very, very slow. So what is the best solution to build a so big data set?