io.fits, hdu_index=0)[source]

Return the image array contained in the given HDU of the given FITS file.

  • input_file_path (str) – The path of the FITS file to load
  • hdu_index (int) – The HDU to load within the FITS file (one FITS file can contain several images stored in different HDU)

The loaded image

Return type:


  • WrongHDUError – If input_file_path doesn’t contain the HDU hdu_index
  • NotAnImageError – If input_file_path doesn’t contain a valid image in the HDU hdu_index, output_file_path)[source]

Save the image_array image (array_like) to the output_file_path FITS file.

  • image_array (array_like) – The image to save (should be a 2D or a 3D numpy array)
  • output_file_path (str) – The path of the FITS file where to save the image_array

WrongDimensionError – If image_array has more than 3 dimensions or less than 2 dimensions.