Skip to content

Commit

Permalink
unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Nov 6, 2024
1 parent 2f6cae3 commit b9b373f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autolens/point/plot/fit_point_plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def figures_2d(self, positions: bool = False, fluxes: bool = False):
visuals_2d=visuals_2d,
auto_labels=aplt.AutoLabels(
title=f"{self.fit.dataset.name} Fit Positions",
filename="fit_point_dataset_positions",
filename="fit_point_positions",
),
buffer=0.1,
)
Expand Down Expand Up @@ -101,7 +101,7 @@ def figures_2d(self, positions: bool = False, fluxes: bool = False):
visuals_1d=visuals_1d,
auto_labels=aplt.AutoLabels(
title=f" {self.fit.dataset.name} Fit Fluxes",
filename="fit_point_dataset_fluxes",
filename="fit_point_fluxes",
xlabel="Point Number",
),
plot_axis_type_override="errorbar",
Expand Down
3 changes: 3 additions & 0 deletions test_autolens/config/visualize.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ plots:
dirty_signal_to_noise_map: false
phases_vs_uv_distances: false
uv_wavelengths: false
fit_point_dataset: # Settings for plots of fits to point source datasets (e.g. FitPointDatasetPlotter).
positions: true # Plot the positions of th multiple images of the point source in the image plane?
fluxes: true # Plot the fluxes of the multiple images of the point source in the image plane?
fit_quantity:
all_at_end_fits: true
all_at_end_png: true
Expand Down
32 changes: 32 additions & 0 deletions test_autolens/point/model/test_plotter_interface_point.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os
import shutil
from os import path

import pytest
from autolens.point.model.plotter_interface import PlotterInterfacePoint

directory = path.dirname(path.realpath(__file__))


@pytest.fixture(name="plot_path")
def make_plotter_interface_plotter_setup():
return path.join("{}".format(directory), "files")


def test__fit_point(
fit_point_dataset_x2_plane, include_2d_all, plot_path, plot_patch
):
if os.path.exists(plot_path):
shutil.rmtree(plot_path)

plotter_interface = PlotterInterfacePoint(image_path=plot_path)

plotter_interface.fit_point(
fit=fit_point_dataset_x2_plane, during_analysis=False
)

assert path.join(plot_path, "subplot_fit.png") in plot_patch.paths

plot_path = path.join(plot_path, "fit_dataset")

assert path.join(plot_path, "fit_point_positions.png") in plot_patch.paths

0 comments on commit b9b373f

Please sign in to comment.