Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 88 additions & 4 deletions test_autolens/imaging/plot/test_fit_imaging_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
from autolens.imaging.plot.fit_imaging_plots import (
subplot_fit,
subplot_fit_log10,
subplot_fit_x1_plane,
subplot_fit_log10_x1_plane,
subplot_of_planes,
subplot_tracer_from_fit,
subplot_fit_combined,
subplot_fit_combined_log10,
)

directory = path.dirname(path.realpath(__file__))
Expand All @@ -18,7 +23,7 @@ def make_fit_imaging_plotter_setup():
)


def test_subplot_fit_is_output(
def test__subplot_fit__two_plane_tracer__output_file_created(
fit_imaging_x2_plane_7x7, plot_path, plot_patch
):
subplot_fit(
Expand All @@ -29,7 +34,29 @@ def test_subplot_fit_is_output(
assert path.join(plot_path, "subplot_fit.png") in plot_patch.paths


def test_subplot_fit_log10_is_output(
def test__subplot_fit__single_plane_tracer__delegates_to_x1_plane_and_creates_file(
fit_imaging_x1_plane_7x7, plot_path, plot_patch
):
subplot_fit(
fit=fit_imaging_x1_plane_7x7,
output_path=plot_path,
output_format="png",
)
assert path.join(plot_path, "subplot_fit_x1_plane.png") in plot_patch.paths


def test__subplot_fit_x1_plane__single_plane_tracer__output_file_created(
fit_imaging_x1_plane_7x7, plot_path, plot_patch
):
subplot_fit_x1_plane(
fit=fit_imaging_x1_plane_7x7,
output_path=plot_path,
output_format="png",
)
assert path.join(plot_path, "subplot_fit_x1_plane.png") in plot_patch.paths


def test__subplot_fit_log10__two_plane_tracer__output_file_created(
fit_imaging_x2_plane_7x7, plot_path, plot_patch
):
subplot_fit_log10(
Expand All @@ -40,7 +67,29 @@ def test_subplot_fit_log10_is_output(
assert path.join(plot_path, "subplot_fit_log10.png") in plot_patch.paths


def test__subplot_of_planes(
def test__subplot_fit_log10__single_plane_tracer__delegates_to_x1_plane_and_creates_file(
fit_imaging_x1_plane_7x7, plot_path, plot_patch
):
subplot_fit_log10(
fit=fit_imaging_x1_plane_7x7,
output_path=plot_path,
output_format="png",
)
assert path.join(plot_path, "subplot_fit_log10.png") in plot_patch.paths


def test__subplot_fit_log10_x1_plane__single_plane_tracer__output_file_created(
fit_imaging_x1_plane_7x7, plot_path, plot_patch
):
subplot_fit_log10_x1_plane(
fit=fit_imaging_x1_plane_7x7,
output_path=plot_path,
output_format="png",
)
assert path.join(plot_path, "subplot_fit_log10.png") in plot_patch.paths


def test__subplot_of_planes__no_plane_index_specified__all_plane_files_created(
fit_imaging_x2_plane_7x7, plot_path, plot_patch
):
subplot_of_planes(
Expand All @@ -52,8 +101,10 @@ def test__subplot_of_planes(
assert path.join(plot_path, "subplot_of_plane_0.png") in plot_patch.paths
assert path.join(plot_path, "subplot_of_plane_1.png") in plot_patch.paths

plot_patch.paths = []

def test__subplot_of_planes__plane_index_0_specified__only_plane_0_file_created(
fit_imaging_x2_plane_7x7, plot_path, plot_patch
):
subplot_of_planes(
fit=fit_imaging_x2_plane_7x7,
output_path=plot_path,
Expand All @@ -63,3 +114,36 @@ def test__subplot_of_planes(

assert path.join(plot_path, "subplot_of_plane_0.png") in plot_patch.paths
assert path.join(plot_path, "subplot_of_plane_1.png") not in plot_patch.paths


def test__subplot_tracer_from_fit__two_plane_tracer__output_file_created(
fit_imaging_x2_plane_7x7, plot_path, plot_patch
):
subplot_tracer_from_fit(
fit=fit_imaging_x2_plane_7x7,
output_path=plot_path,
output_format="png",
)
assert path.join(plot_path, "subplot_tracer.png") in plot_patch.paths


def test__subplot_fit_combined__list_of_two_fits__output_file_created(
fit_imaging_x1_plane_7x7, fit_imaging_x2_plane_7x7, plot_path, plot_patch
):
subplot_fit_combined(
fit_list=[fit_imaging_x1_plane_7x7, fit_imaging_x2_plane_7x7],
output_path=plot_path,
output_format="png",
)
assert path.join(plot_path, "subplot_fit_combined.png") in plot_patch.paths


def test__subplot_fit_combined_log10__list_of_two_fits__output_file_created(
fit_imaging_x1_plane_7x7, fit_imaging_x2_plane_7x7, plot_path, plot_patch
):
subplot_fit_combined_log10(
fit_list=[fit_imaging_x1_plane_7x7, fit_imaging_x2_plane_7x7],
output_path=plot_path,
output_format="png",
)
assert path.join(plot_path, "fit_combined_log10.png") in plot_patch.paths
Loading
Loading