|
1 | 1 | from __future__ import annotations |
2 | | -from astropy.io import fits |
3 | 2 | import logging |
4 | 3 | import numpy as np |
5 | 4 | from pathlib import Path |
|
11 | 10 | from autoarray.structures.arrays.uniform_2d import Array2D |
12 | 11 |
|
13 | 12 | from autoconf import cached_property |
14 | | -from autoconf.fitsable import ndarray_via_fits_from, output_to_fits |
| 13 | +from autoconf.fitsable import ndarray_via_fits_from |
15 | 14 |
|
16 | 15 | from autoarray.mask.abstract_mask import Mask |
17 | 16 |
|
@@ -722,57 +721,6 @@ def pixel_scale_header(self) -> Dict: |
722 | 721 | "PIXSCAX": self.pixel_scales[1], |
723 | 722 | } |
724 | 723 |
|
725 | | - @property |
726 | | - def hdu_for_output(self) -> fits.PrimaryHDU: |
727 | | - """ |
728 | | - The mask as a HDU object, which can be output to a .fits file. |
729 | | -
|
730 | | - The header of the HDU is used to store the `pixel_scale` of the array, which is used by the `Array2D.from_hdu`. |
731 | | -
|
732 | | - This method is used in other projects (E.g. PyAutoGalaxy, PyAutoLens) to conveniently output the array to .fits |
733 | | - files. |
734 | | -
|
735 | | - Returns |
736 | | - ------- |
737 | | - The HDU containing the data and its header which can then be written to .fits. |
738 | | - """ |
739 | | - return array_2d_util.hdu_for_output_from( |
740 | | - array_2d=self.astype("float"), header_dict=self.pixel_scale_header |
741 | | - ) |
742 | | - |
743 | | - def output_to_fits(self, file_path, overwrite=False): |
744 | | - """ |
745 | | - Write the 2D Mask to a .fits file. |
746 | | -
|
747 | | - Before outputting a NumPy array, the array may be flipped upside-down using np.flipud depending on the project |
748 | | - config files. This is for Astronomy projects so that structures appear the same orientation as `.fits` files |
749 | | - loaded in DS9. |
750 | | -
|
751 | | - Parameters |
752 | | - ---------- |
753 | | - file_path |
754 | | - The full path of the file that is output, including the file name and `.fits` extension. |
755 | | - overwrite |
756 | | - If `True` and a file already exists with the input file_path the .fits file is overwritten. If `False`, an |
757 | | - error is raised. |
758 | | -
|
759 | | - Returns |
760 | | - ------- |
761 | | - None |
762 | | -
|
763 | | - Examples |
764 | | - -------- |
765 | | - mask = Mask2D(mask=np.full(shape=(5,5), fill_value=False)) |
766 | | - mask.output_to_fits(file_path='/path/to/file/filename.fits', overwrite=True) |
767 | | - """ |
768 | | - output_to_fits( |
769 | | - values=self.astype("float"), |
770 | | - file_path=file_path, |
771 | | - overwrite=overwrite, |
772 | | - header_dict=self.pixel_scale_header, |
773 | | - ext_name="mask" |
774 | | - ) |
775 | | - |
776 | 724 | @property |
777 | 725 | def mask_centre(self) -> Tuple[float, float]: |
778 | 726 | grid = grid_2d_util.grid_2d_slim_via_mask_from( |
|
0 commit comments