write_fits

hcipy.util.write_fits(data, filename, shape=None, overwrite=True)

Write the data to a fits-file.

If the data is a Field with SeparatedCoords, the shaped field will be written to the fits-file, to allow for easier viewing with external tools.

Parameters
datandarray or Field

The ndarray or Field to write to the fits file.

filenamestring

The filename of the newly created file. This can include a path.

shapendarray or None

The shape to which to reshape the data. If this is given, it will override a potential shape from the grid accompaning the field.

overwriteboolean

Whether to overwrite the fits-file if it already exists.