0

This is my code and it only opens one fits image, I don't know why if I'm reading all the images inside my folder (there are 10). Does anyone know how to solve it? Thank you.

 f_name = sorted(glob.glob('/home/citlali/img_servicio/*.fits'))


for location in f_name:
    with fits.open(location) as image:
        DATOS = image["FLUX_ELINES"].data

        img = DATOS[45, :, :]
        plt.imshow(img)
        image.close()
Iguananaut
  • 21,810
  • 5
  • 50
  • 63
Hache 99
  • 47
  • 4
  • 1
    Not able to reproduce, please provide a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example). Like some sample data and specify from which library are you importing the `fits` function. – skt7 Sep 03 '22 at 00:25
  • What does `print(f_name)` return? Are you sure you're looping over all the files ? – Iguananaut Sep 11 '22 at 12:42
  • Maybe a duplicate of https://stackoverflow.com/questions/41210823/using-plt-imshow-to-display-multiple-images ? – Iguananaut Sep 11 '22 at 12:43

0 Answers0