code: def save_image(imager, grid_data, grid_norm, output_file):
      
      # Make the image (take the FFT, normalise, and apply grid correction).
      imager.finalise_plane(grid_data, grid_norm)
      grid_data = numpy.real(grid_data)
  
      # Trim the image if required.
      border = (imager.plane_size - imager.image_size) // 2
      if border > 0:
          end = border + imager.image_size
          grid_data = grid_data[border:end, border:end]
  
      # Write the FITS file.
      hdr = fits.header.Header()
      fits.writeto(output_file, grid_data, hdr, clobber=True)
docs: Makes an image from gridded visibilities and saves it to a FITS file.
  
      Args:
          imager (oskar.Imager):          Handle to configured imager.
          grid_data (numpy.ndarray):      Final visibility grid.
          grid_norm (float):              Grid normalisation to apply.
          output_file (str):              Name of output FITS file to write.