save_map#
- mufasa.master_fitter.save_map(map, header, savename, overwrite=True)[source]#
Save a 2D map as a FITS file.
- Parameters:
map (numpy.ndarray) – The 2D array containing the map data to be saved.
header (astropy.io.fits.Header) – The FITS header to include with the saved map.
savename (str) – The file path where the FITS file will be saved.
overwrite (bool, optional) – Whether to overwrite an existing file with the same name. Defaults to True.
- Return type:
None
Notes
This function creates a Primary HDU with the given data and header and writes it to the specified file.
If overwrite is set to False and a file with the same name exists, an OSError will be raised.
Examples
>>> from astropy.io import fits >>> import numpy as np >>> data = np.random.random((100, 100)) >>> hdr = fits.Header() >>> hdr['BUNIT'] = 'K' # Example header keyword >>> save_map(data, hdr, 'output_map.fits') >>> # Saves `data` with the specified header to 'output_map.fits'.