Skip to content

Commit 5a846f3

Browse files
committed
Interferometer stuff implemented.
1 parent 185ad0f commit 5a846f3

2 files changed

Lines changed: 38 additions & 3 deletions

File tree

autoarray/plotters/grid_plotters.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import numpy as np
88
import itertools
99

10+
from autoarray.util import array_util
1011
from autoarray.plotters import plotter_util
1112

1213

@@ -125,7 +126,7 @@ def plot_grid(
125126
plotter_util.plot_lines(line_lists=lines)
126127

127128
plt.tick_params(labelsize=xyticksize)
128-
plotter_util.output_figure(
129+
output_figure(
129130
array=None,
130131
as_subplot=as_subplot,
131132
output_path=output_path,
@@ -250,3 +251,37 @@ def plot_points(grid, points, pointcolor):
250251
s=8,
251252
color=pointcolor,
252253
)
254+
255+
256+
def output_figure(array, as_subplot, output_path, output_filename, output_format):
257+
"""Output the figure, either as an image on the screen or to the hard-disk as a .png or .fits file.
258+
259+
Parameters
260+
-----------
261+
array : ndarray
262+
The 2D array of image to be output, required for outputting the image as a fits file.
263+
as_subplot : bool
264+
Whether the figure is part of subplot, in which case the figure is not output so that the entire subplot can \
265+
be output instead using the *output_subplot_array* function.
266+
output_path : str
267+
The path on the hard-disk where the figure is output.
268+
output_filename : str
269+
The filename of the figure that is output.
270+
output_format : str
271+
The format the figue is output:
272+
'show' - display on computer screen.
273+
'png' - output to hard-disk as a png.
274+
'fits' - output to hard-disk as a fits file.'
275+
"""
276+
if not as_subplot:
277+
278+
if output_format is "show":
279+
plt.show()
280+
elif output_format is "png":
281+
plt.savefig(output_path + output_filename + ".png", bbox_inches="tight")
282+
elif output_format is "fits":
283+
array_util.numpy_array_1d_to_fits(
284+
array_1d=array,
285+
file_path=output_path + output_filename + ".fits",
286+
overwrite=True,
287+
)

test_autoarray/unit/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ def make_masked_interferometer_7(
290290
def make_masked_imaging_fit_x1_plane_7x7(masked_imaging_7x7):
291291
return fit.ImagingFit(
292292
mask=masked_imaging_7x7.mask,
293-
data=masked_imaging_7x7.image,
293+
image=masked_imaging_7x7.image,
294294
noise_map=masked_imaging_7x7.noise_map,
295-
model_data=5.0 * masked_imaging_7x7.image,
295+
model_image=5.0 * masked_imaging_7x7.image,
296296
)
297297

298298
@pytest.fixture(name="fit_interferometer_7")

0 commit comments

Comments
 (0)