From 97a9af63e506100b7eadc6a768b82a5f7f0ede6d Mon Sep 17 00:00:00 2001 From: Thibault Barnouin Date: Wed, 30 Jul 2025 18:16:32 +0200 Subject: [PATCH] align_map.write_to write all images in fits --- package/lib/plots.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/package/lib/plots.py b/package/lib/plots.py index b5cae9f..2e468c7 100755 --- a/package/lib/plots.py +++ b/package/lib/plots.py @@ -373,7 +373,7 @@ def polarization_map( ax.set_ylabel("Declination (J2000)", labelpad=-1) vmin, vmax = 0.0, stkI.max() * convert_flux - for key, value in [["cmap", [["cmap", "inferno"]]], ["width", [["width", 0.3]]], ["linewidth", [["linewidth", 0.5]]]]: + for key, value in [["cmap", [["cmap", "inferno"]]], ["width", [["width", 0.4]]], ["linewidth", [["linewidth", 0.6]]]]: try: _ = kwargs[key] except KeyError: @@ -925,14 +925,22 @@ class align_maps(object): def write_map_to(self, path="map.fits", suffix="aligned", data_dir="."): new_head = deepcopy(self.map_header) new_head.update(self.map_wcs.to_header()) - new_hdul = fits.HDUList(fits.PrimaryHDU(self.map_data, new_head)) + new_hdul = fits.HDUList([fits.PrimaryHDU(self.map_data, new_head)]) + for i in range(1, len(self.map)): + new_head = deepcopy(self.map[i].header) + new_head.update(self.map_wcs.to_header()) + new_hdul.append(fits.ImageHDU(self.map[i].data, new_head)) new_hdul.writeto("_".join([path[:-5], suffix]) + ".fits", overwrite=True) return 0 def write_other_to(self, path="other_map.fits", suffix="aligned", data_dir="."): new_head = deepcopy(self.other_header) new_head.update(self.other_wcs.to_header()) - new_hdul = fits.HDUList(fits.PrimaryHDU(self.other_data, new_head)) + new_hdul = fits.HDUList([fits.PrimaryHDU(self.other_data, new_head)]) + for i in range(1, len(self.other)): + new_head = deepcopy(self.other[i].header) + new_head.update(self.other_wcs.to_header()) + new_hdul.append(fits.ImageHDU(self.other[i].data, new_head)) new_hdul.writeto("_".join([path[:-5], suffix]) + ".fits", overwrite=True) return 0