Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Feb 21, 2025
1 parent b5c80d0 commit b8a6397
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
23 changes: 11 additions & 12 deletions autoarray/plot/multi_plotters.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from astropy.io import fits
import numpy as np
import os
from pathlib import Path
from typing import List, Optional, Tuple

from autoconf import conf

from autoarray.plot.wrap.base.ticks import YTicks
from autoarray.plot.wrap.base.ticks import XTicks

Expand Down Expand Up @@ -261,15 +258,17 @@ def output_subplot(self, filename_suffix: str = ""):
The suffix of the filename that the subplot is output to.
"""

if self.plotter_list[0].mat_plot_1d is not None:
self.plotter_list[0].mat_plot_1d.output.subplot_to_figure(
plotter = self.plotter_list[0]

if plotter.mat_plot_1d is not None:
plotter.mat_plot_1d.output.subplot_to_figure(
auto_filename=f"subplot_{filename_suffix}"
)
if self.plotter_list[0].mat_plot_2d is not None:
self.plotter_list[0].mat_plot_2d.output.subplot_to_figure(
if plotter.mat_plot_2d is not None:
plotter.mat_plot_2d.output.subplot_to_figure(
auto_filename=f"subplot_{filename_suffix}"
)
self.plotter_list[0].close_subplot_figure()
plotter.close_subplot_figure()

def output_to_fits(
self,
Expand Down Expand Up @@ -316,10 +315,10 @@ def output_to_fits(
output_path = self.plotter_list[0].mat_plot_2d.output.output_path_from(
format="fits_multi"
)
output_fits_file = os.path.join(output_path, f"{filename}.fits")
output_fits_file = Path(output_path)/ f"{filename}.fits"

if remove_fits_first and os.path.exists(output_fits_file):
os.remove(output_fits_file)
if remove_fits_first:
output_fits_file.unlink(missing_ok=True)

for i, plotter in enumerate(self.plotter_list):
plotter.mat_plot_2d.output._format = "fits_multi"
Expand Down
5 changes: 3 additions & 2 deletions autoarray/structures/arrays/array_2d_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,9 @@ def update_fits_file(
header = fits.Header()

try:
header["PIXSCAY"] = str(arr.pixel_scales[0])
header["PIXSCAX"] = str(arr.pixel_scales[1])
y, x = map(str, arr.pixel_scales)
header["PIXSCAY"] = y
header["PIXSCAX"] = x
except AttributeError:
pass

Expand Down

0 comments on commit b8a6397

Please sign in to comment.