def test__individual_attributes_are_output(imaging_7x7, positions_7x7, mask_7x7, plot_path, plot_patch): aplt.imaging.image( imaging=imaging_7x7, positions=positions_7x7, mask=mask_7x7, include=aplt.Include(mask=True), plotter=aplt.Plotter(output=aplt.Output(plot_path, format="png")), ) assert plot_path + "image.png" in plot_patch.paths aplt.imaging.noise_map( imaging=imaging_7x7, mask=mask_7x7, plotter=aplt.Plotter(output=aplt.Output(plot_path, format="png")), ) assert plot_path + "noise_map.png" in plot_patch.paths aplt.imaging.psf( imaging=imaging_7x7, plotter=aplt.Plotter(output=aplt.Output(plot_path, format="png")), ) assert plot_path + "psf.png" in plot_patch.paths aplt.imaging.signal_to_noise_map( imaging=imaging_7x7, mask=mask_7x7, plotter=aplt.Plotter(output=aplt.Output(plot_path, format="png")), ) assert plot_path + "signal_to_noise_map.png" in plot_patch.paths
def test__image_and_mapper_subplot_is_output_for_all_mappers( imaging_7x7, rectangular_mapper_7x7_3x3, voronoi_mapper_9_3x3, plot_path, plot_patch): aplt.mapper.subplot_image_and_mapper( image=imaging_7x7.image, mapper=rectangular_mapper_7x7_3x3, include=aplt.Include(inversion_pixelization_grid=True, inversion_grid=True, inversion_border=True), image_pixel_indexes=[[0, 1, 2], [3]], source_pixel_indexes=[[1, 2], [0]], sub_plotter=aplt.SubPlotter( output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "subplot_image_and_mapper.png" in plot_patch.paths aplt.mapper.subplot_image_and_mapper( image=imaging_7x7.image, mapper=voronoi_mapper_9_3x3, include=aplt.Include(inversion_pixelization_grid=True, inversion_grid=True, inversion_border=True), image_pixel_indexes=[[0, 1, 2], [3]], source_pixel_indexes=[[1, 2], [0]], sub_plotter=aplt.SubPlotter( output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "subplot_image_and_mapper.png" in plot_patch.paths
def test__output__correctly(self): plotter = aplt.Plotter() assert plotter.output.path == None assert plotter.output._format == None assert plotter.output.format == "show" assert plotter.output.filename == None plotter = aplt.Plotter( output=aplt.Output(path="Path", format="png", filename="file")) assert plotter.output.path == "Path" assert plotter.output._format == "png" assert plotter.output.format == "png" assert plotter.output.filename == "file" sub_plotter = aplt.SubPlotter() assert sub_plotter.output.path == None assert sub_plotter.output._format == None assert sub_plotter.output.format == "show" assert sub_plotter.output.filename == None sub_plotter = aplt.SubPlotter( output=aplt.Output(path="Path", format="png", filename="file")) assert sub_plotter.output.path == "Path" assert sub_plotter.output._format == "png" assert sub_plotter.output.format == "png" assert sub_plotter.output.filename == "file"
def test__plot_array__works_with_all_extras_included( self, plot_path, plot_patch): array = aa.array.ones(shape_2d=(31, 31), pixel_scales=(1.0, 1.0), sub_size=2) mask = aa.mask.circular( shape_2d=array.shape_2d, pixel_scales=array.pixel_scales, radius=5.0, centre=(2.0, 2.0), ) grid = aa.grid.uniform(shape_2d=(11, 11), pixel_scales=0.5) plotter = aplt.Plotter(output=aplt.Output( path=plot_path, filename="array1", format="png")) plotter.plot_array( array=array, mask=mask, grid=grid, positions=[(-1.0, -1.0)], lines=[(1.0, 1.0), (2.0, 2.0)], include_origin=True, include_border=True, ) assert plot_path + "array1.png" in plot_patch.paths plotter = aplt.Plotter(output=aplt.Output( path=plot_path, filename="array2", format="png")) plotter.plot_array( array=array, mask=mask, grid=grid, positions=[[(1.0, 1.0), (2.0, 2.0)], [(-1.0, -1.0)]], lines=[[(1.0, 1.0), (2.0, 2.0)], [(2.0, 4.0), (5.0, 6.0)]], include_origin=True, include_border=True, ) assert plot_path + "array2.png" in plot_patch.paths aplt.array( array=array, mask=mask, grid=grid, positions=[(-1.0, -1.0)], lines=[(1.0, 1.0), (2.0, 2.0)], include=aplt.Include(origin=True, border=True), plotter=aplt.Plotter(output=aplt.Output( path=plot_path, filename="array3", format="png")), ) assert plot_path + "array3.png" in plot_patch.paths
def test__works_with_all_extras_included( self, array_2d_7x7, grid_2d_7x7, mask_2d_7x7, grid_2d_irregular_7x7_list, plot_path, plot_patch, ): grid_plotter = aplt.Grid2DPlotter( grid=grid_2d_7x7, visuals_2d=aplt.Visuals2D(indexes=[0, 1, 2]), mat_plot_2d=aplt.MatPlot2D(output=aplt.Output( path=plot_path, filename="grid1", format="png")), ) color_array = np.linspace(start=0.0, stop=1.0, num=grid_2d_7x7.shape_slim) grid_plotter.figure_2d(color_array=color_array) assert path.join(plot_path, "grid1.png") in plot_patch.paths grid_plotter = aplt.Grid2DPlotter( grid=grid_2d_7x7, visuals_2d=aplt.Visuals2D(indexes=[0, 1, 2]), mat_plot_2d=aplt.MatPlot2D(output=aplt.Output( path=plot_path, filename="grid2", format="png")), include_2d=aplt.Include2D(origin=True, mask=True, border=True), ) grid_plotter.figure_2d(color_array=color_array) assert path.join(plot_path, "grid2.png") in plot_patch.paths visuals_2d = aplt.Visuals2D( origin=grid_2d_irregular_7x7_list, mask=mask_2d_7x7, border=mask_2d_7x7.border_grid_sub_1.binned, grid=grid_2d_7x7, positions=grid_2d_irregular_7x7_list, lines=grid_2d_irregular_7x7_list, array_overlay=array_2d_7x7, indexes=[0, 1, 2], ) grid_plotter = aplt.Grid2DPlotter( grid=grid_2d_7x7, mat_plot_2d=aplt.MatPlot2D(output=aplt.Output( path=plot_path, filename="grid3", format="png")), visuals_2d=visuals_2d, ) grid_plotter.figure_2d(color_array=color_array) assert path.join(plot_path, "grid3.png") in plot_patch.paths
def test__individual_attributes_are_output(interferometer_7, plot_path, plot_patch): interferometer_plotter = aplt.InterferometerPlotter( interferometer=interferometer_7, mat_plot_1d=aplt.MatPlot1D( output=aplt.Output(path=plot_path, format="png")), mat_plot_2d=aplt.MatPlot2D( output=aplt.Output(path=plot_path, format="png")), ) interferometer_plotter.figures_2d( visibilities=True, noise_map=True, u_wavelengths=True, v_wavelengths=True, uv_wavelengths=True, amplitudes_vs_uv_distances=True, phases_vs_uv_distances=True, dirty_image=True, dirty_noise_map=True, dirty_signal_to_noise_map=True, dirty_inverse_noise_map=True, ) assert path.join(plot_path, "visibilities.png") in plot_patch.paths assert path.join(plot_path, "noise_map.png") in plot_patch.paths assert path.join(plot_path, "u_wavelengths.png") in plot_patch.paths assert path.join(plot_path, "v_wavelengths.png") in plot_patch.paths assert path.join(plot_path, "uv_wavelengths.png") in plot_patch.paths assert path.join(plot_path, "amplitudes_vs_uv_distances.png") in plot_patch.paths assert path.join(plot_path, "phases_vs_uv_distances.png") in plot_patch.paths assert path.join(plot_path, "dirty_image_2d.png") in plot_patch.paths assert path.join(plot_path, "dirty_noise_map_2d.png") in plot_patch.paths assert path.join(plot_path, "dirty_signal_to_noise_map_2d.png") in plot_patch.paths assert path.join(plot_path, "dirty_inverse_noise_map_2d.png") in plot_patch.paths plot_patch.paths = [] interferometer_plotter.figures_2d( visibilities=True, u_wavelengths=False, v_wavelengths=True, amplitudes_vs_uv_distances=True, ) assert path.join(plot_path, "visibilities.png") in plot_patch.paths assert not path.join(plot_path, "u_wavelengths.png") in plot_patch.paths assert path.join(plot_path, "v_wavelengths.png") in plot_patch.paths assert path.join(plot_path, "amplitudes_vs_uv_distances.png") in plot_patch.paths assert path.join(plot_path, "phases_vs_uv_distances.png") not in plot_patch.paths
def test__works_with_all_extras_included( self, array_2d_7x7, mask_2d_7x7, grid_2d_7x7, grid_2d_irregular_7x7_list, plot_path, plot_patch, ): array_plotter = aplt.Array2DPlotter( array=array_2d_7x7, mat_plot_2d=aplt.MatPlot2D(output=aplt.Output( path=plot_path, filename="array1", format="png")), ) array_plotter.figure_2d() assert path.join(plot_path, "array1.png") in plot_patch.paths array_plotter = aplt.Array2DPlotter( array=array_2d_7x7, include_2d=aplt.Include2D(origin=True, mask=True, border=True), mat_plot_2d=aplt.MatPlot2D(output=aplt.Output( path=plot_path, filename="array2", format="png")), ) array_plotter.figure_2d() assert path.join(plot_path, "array2.png") in plot_patch.paths visuals_2d = aplt.Visuals2D( origin=grid_2d_irregular_7x7_list, mask=mask_2d_7x7, border=mask_2d_7x7.border_grid_sub_1.binned, grid=grid_2d_7x7, positions=grid_2d_irregular_7x7_list, # lines=grid_2d_irregular_7x7_list, array_overlay=array_2d_7x7, ) array_plotter = aplt.Array2DPlotter( array=array_2d_7x7, visuals_2d=visuals_2d, mat_plot_2d=aplt.MatPlot2D(output=aplt.Output( path=plot_path, filename="array3", format="png")), ) array_plotter.figure_2d() assert path.join(plot_path, "array3.png") in plot_patch.paths
def test__fit_individuals__source_and_lens__depedent_on_input( fit_imaging_7x7, plot_path, plot_patch): aplt.fit_imaging.individuals( fit=fit_imaging_7x7, include=aplt.Include(mask=True), plot_image=True, plot_noise_map=False, plot_signal_to_noise_map=False, plot_model_image=True, plot_chi_squared_map=True, plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "image.png" in plot_patch.paths assert plot_path + "noise_map.png" not in plot_patch.paths assert plot_path + "signal_to_noise_map.png" not in plot_patch.paths assert plot_path + "model_image.png" in plot_patch.paths assert plot_path + "residual_map.png" not in plot_patch.paths assert plot_path + "normalized_residual_map.png" not in plot_patch.paths assert plot_path + "chi_squared_map.png" in plot_patch.paths aplt.fit_imaging.individuals( fit=fit_imaging_7x7, plot_image=True, plot_noise_map=False, plot_signal_to_noise_map=False, plot_model_image=True, plot_chi_squared_map=True, plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "image.png" in plot_patch.paths assert plot_path + "noise_map.png" not in plot_patch.paths assert plot_path + "signal_to_noise_map.png" not in plot_patch.paths assert plot_path + "model_image.png" in plot_patch.paths assert plot_path + "residual_map.png" not in plot_patch.paths assert plot_path + "normalized_residual_map.png" not in plot_patch.paths assert plot_path + "chi_squared_map.png" in plot_patch.paths
def test__individual_attributes_are_output(interferometer_7, plot_path, plot_patch): aplt.interferometer.visibilities( interferometer=interferometer_7, plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "visibilities.png" in plot_patch.paths aplt.interferometer.noise_map( interferometer=interferometer_7, plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "noise_map.png" in plot_patch.paths aplt.interferometer.u_wavelengths( interferometer=interferometer_7, plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "u_wavelengths.png" in plot_patch.paths aplt.interferometer.v_wavelengths( interferometer=interferometer_7, plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "v_wavelengths.png" in plot_patch.paths aplt.interferometer.uv_wavelengths( interferometer=interferometer_7, plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "uv_wavelengths.png" in plot_patch.paths aplt.interferometer.amplitudes_vs_uv_distances( interferometer=interferometer_7, plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "amplitudes_vs_uv_distances.png" in plot_patch.paths aplt.interferometer.phases_vs_uv_distances( interferometer=interferometer_7, plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "phases_vs_uv_distances.png" in plot_patch.paths aplt.interferometer.primary_beam( interferometer=interferometer_7, plotter=aplt.Plotter(output=aplt.Output(plot_path, format="png")), ) assert plot_path + "primary_beam.png" in plot_patch.paths
def test__subplot_of_plotter_list_figure(self, imaging_7x7, plot_path, plot_patch): mat_plot_1d = aplt.MatPlot1D( output=aplt.Output(plot_path, format="png")) plotter_0 = MockYX1DPlotter( y=np.array([1.0, 2.0, 3.0]), x=np.array([0.5, 1.0, 1.5]), mat_plot_1d=mat_plot_1d, ) plotter_1 = MockYX1DPlotter( y=np.array([1.0, 2.0, 4.0]), x=np.array([0.5, 1.0, 1.5]), mat_plot_1d=mat_plot_1d, ) plotter_list = [plotter_0, plotter_1] multi_plotter = aplt.MultiYX1DPlotter(plotter_list=plotter_list) multi_plotter.figure_1d(func_name="figures_1d", figure_name="figure_name") assert path.join(plot_path, "multi_figure_name.png") in plot_patch.paths
def test__subplot_of_plotter_list_figure(self, imaging_7x7, plot_path, plot_patch): mat_plot_2d = aplt.MatPlot2D( output=aplt.Output(plot_path, format="png")) plotter_0 = aplt.ImagingPlotter(imaging=imaging_7x7, mat_plot_2d=mat_plot_2d) plotter_1 = aplt.ImagingPlotter(imaging=imaging_7x7) plotter_list = [plotter_0, plotter_1] multi_plotter = aplt.MultiFigurePlotter(plotter_list=plotter_list) multi_plotter.subplot_of_figure(func_name="figures_2d", figure_name="image") assert path.join(plot_path, "subplot_image_list.png") in plot_patch.paths plot_patch.paths = [] multi_plotter = aplt.MultiFigurePlotter(plotter_list=plotter_list) multi_plotter.subplot_of_figure(func_name="figures_2d", figure_name="image", noise_map=True) assert path.join(plot_path, "subplot_image_list.png") in plot_patch.paths
def test__image_and_mapper_subplot_is_output_for_all_mappers( self, imaging_7x7, rectangular_mapper_7x7_3x3, voronoi_mapper_9_3x3, plot_path, plot_patch, ): mapper_plotter = aplt.MapperPlotter( mapper=rectangular_mapper_7x7_3x3, visuals_2d=aplt.Visuals2D(indexes=[[(0, 0), (0, 1)], [(1, 2)]], pixelization_indexes=[[0, 1], [2]]), mat_plot_2d=aplt.MatPlot2D( output=aplt.Output(path=plot_path, format="png")), include_2d=aplt.Include2D(mapper_source_pixelization_grid=True), ) mapper_plotter.subplot_image_and_mapper(image=imaging_7x7.image) assert path.join(plot_path, "subplot_image_and_mapper.png") in plot_patch.paths mapper_plotter.subplot_image_and_mapper(image=imaging_7x7.image) assert path.join(plot_path, "subplot_image_and_mapper.png") in plot_patch.paths
def test__fit_individuals__dependent_on_input(fit_interferometer_7, plot_path, plot_patch): aplt.fit_interferometer.individuals( fit=fit_interferometer_7, plot_visibilities=True, plot_noise_map=False, plot_signal_to_noise_map=False, plot_model_visibilities=True, plot_chi_squared_map=True, plotter=aplt.Plotter(output=aplt.Output(plot_path, format="png")), ) assert plot_path + "visibilities.png" in plot_patch.paths assert plot_path + "noise_map.png" not in plot_patch.paths assert plot_path + "signal_to_noise_map.png" not in plot_patch.paths assert plot_path + "model_visibilities.png" in plot_patch.paths assert plot_path + "residual_map_vs_uv_distances_real.png" not in plot_patch.paths assert plot_path + "residual_map_vs_uv_distances_imag.png" not in plot_patch.paths assert (plot_path + "normalized_residual_map_vs_uv_distances_real.png" not in plot_patch.paths) assert (plot_path + "normalized_residual_map_vs_uv_distances_imag.png" not in plot_patch.paths) assert plot_path + "chi_squared_map_vs_uv_distances_real.png" in plot_patch.paths assert plot_path + "chi_squared_map_vs_uv_distances_imag.png" in plot_patch.paths
def test__plotter_with_new_outputs__new_outputs_are_setup_correctly_if_input( self): plotter = aplt.Plotter( output=aplt.Output(path="Path", format="png", filename="file")) plotter = plotter.plotter_with_new_output() assert plotter.output.path == "Path" assert plotter.output._format == "png" assert plotter.output.format == "png" assert plotter.output.filename == "file" plotter = plotter.plotter_with_new_output(path="Path0", filename="file0") assert plotter.output.path == "Path0" assert plotter.output._format == "png" assert plotter.output.format == "png" assert plotter.output.filename == "file0" plotter = plotter.plotter_with_new_output(path="Path1", filename="file1", format="fits") assert plotter.output.path == "Path1" assert plotter.output._format == "fits" assert plotter.output.format == "fits" assert plotter.output.filename == "file1"
def test__plot_grid__works_with_all_extras_included( self, plot_path, plot_patch): grid = aa.grid.uniform(shape_2d=(11, 11), pixel_scales=1.0) color_array = np.linspace(start=0.0, stop=1.0, num=grid.shape_1d) plotter = aplt.Plotter( output=aplt.Output(path=plot_path, filename="grid1", format="png")) plotter.plot_grid( grid=grid, color_array=color_array, axis_limits=[-1.5, 1.5, -2.5, 2.5], lines=[[(1.0, 1.0), (2.0, 2.0)], [(2.0, 4.0), (5.0, 6.0)]], indexes=[0, 1, 2, 14], symmetric_around_centre=False, ) assert plot_path + "grid1.png" in plot_patch.paths plotter = aplt.Plotter( output=aplt.Output(path=plot_path, filename="grid2", format="png")) plotter.plot_grid( grid=grid, color_array=color_array, axis_limits=[-1.5, 1.5, -2.5, 2.5], lines=[[(1.0, 1.0), (2.0, 2.0)], [(2.0, 4.0), (5.0, 6.0)]], indexes=[0, 1, 2, 14], symmetric_around_centre=True, ) assert plot_path + "grid2.png" in plot_patch.paths aplt.grid( grid=grid, color_array=color_array, axis_limits=[-1.5, 1.5, -2.5, 2.5], lines=[[(1.0, 1.0), (2.0, 2.0)], [(2.0, 4.0), (5.0, 6.0)]], indexes=[0, 1, 2, 14], symmetric_around_centre=True, plotter=aplt.Plotter(output=aplt.Output( path=plot_path, filename="grid3", format="png")), ) assert plot_path + "grid3.png" in plot_patch.paths
def test__plot_voronoi_mapper__works_with_all_extras_included( self, voronoi_mapper_9_3x3, plot_path, plot_patch): plotter = aplt.Plotter(output=aplt.Output( path=plot_path, filename="mapper1", format="png")) plotter.plot_voronoi_mapper( mapper=voronoi_mapper_9_3x3, include_pixelization_grid=True, include_grid=True, include_border=True, image_pixel_indexes=[[(0, 0), (0, 1)], [(1, 2)]], source_pixel_indexes=[[0, 1], [2]], ) assert plot_path + "mapper1.png" in plot_patch.paths plotter = aplt.Plotter(output=aplt.Output( path=plot_path, filename="mapper2", format="png")) plotter.plot_voronoi_mapper( mapper=voronoi_mapper_9_3x3, include_pixelization_grid=True, include_grid=True, include_border=True, image_pixel_indexes=[[(0, 0), (0, 1)], [(1, 2)]], source_pixel_indexes=[[0, 1], [2]], ) assert plot_path + "mapper2.png" in plot_patch.paths aplt.mapper_obj( mapper=voronoi_mapper_9_3x3, include=aplt.Include( inversion_pixelization_grid=True, inversion_grid=True, inversion_border=True, ), image_pixel_indexes=[[(0, 0), (0, 1)], [(1, 2)]], source_pixel_indexes=[[0, 1], [2]], plotter=aplt.Plotter(output=aplt.Output( path=plot_path, filename="mapper3", format="png")), ) assert plot_path + "mapper3.png" in plot_patch.paths
def test__subplots_are_output(interferometer_7, plot_path, plot_patch): interferometer_plotter = aplt.InterferometerPlotter( interferometer=interferometer_7, mat_plot_1d=aplt.MatPlot1D( output=aplt.Output(path=plot_path, format="png")), mat_plot_2d=aplt.MatPlot2D( output=aplt.Output(path=plot_path, format="png")), ) interferometer_plotter.subplot_interferometer() assert path.join(plot_path, "subplot_interferometer.png") in plot_patch.paths interferometer_plotter.subplot_dirty_images() assert path.join(plot_path, "subplot_dirty_images.png") in plot_patch.paths
def test__subplot_is_output(interferometer_7, plot_path, plot_patch): aplt.interferometer.subplot_interferometer( interferometer=interferometer_7, sub_plotter=aplt.SubPlotter( output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "subplot_interferometer.png" in plot_patch.paths
def test__constructor(self): output = aplt.Output() assert output.path == None assert output._format == None assert output.format == "show" assert output.filename == None output = aplt.Output(path="Path", format="png", filename="file") assert output.path == "Path" assert output._format == "png" assert output.format == "png" assert output.filename == "file" if path.exists(output.path): shutil.rmtree(output.path)
def test__fit_sub_plot(fit_interferometer_7, plot_path, plot_patch): aplt.fit_interferometer.subplot_fit_interferometer( fit=fit_interferometer_7, sub_plotter=aplt.SubPlotter( output=aplt.Output(plot_path, format="png")), ) assert plot_path + "subplot_fit_interferometer.png" in plot_patch.paths
def test__plot_line__works_with_all_extras_included( self, plot_path, plot_patch): plotter = aplt.Plotter( output=aplt.Output(path=plot_path, filename="line1", format="png")) plotter.plot_line( y=np.array([1.0, 2.0, 3.0]), x=np.array([0.5, 1.0, 1.5]), plot_axis_type="loglog", vertical_lines=[1.0, 2.0], label="line0", vertical_line_labels=["line1", "line2"], ) assert plot_path + "line1.png" in plot_patch.paths plotter = aplt.Plotter( output=aplt.Output(path=plot_path, filename="line2", format="png")) plotter.plot_line( y=np.array([1.0, 2.0, 3.0]), x=np.array([0.5, 1.0, 1.5]), plot_axis_type="semilogy", vertical_lines=[1.0, 2.0], label="line0", vertical_line_labels=["line1", "line2"], ) assert plot_path + "line2.png" in plot_patch.paths aplt.line( y=np.array([1.0, 2.0, 3.0]), x=np.array([0.5, 1.0, 1.5]), plot_axis_type="loglog", vertical_lines=[1.0, 2.0], label="line0", vertical_line_labels=["line1", "line2"], plotter=aplt.Plotter(output=aplt.Output( path=plot_path, filename="line3", format="png")), ) assert plot_path + "line3.png" in plot_patch.paths
def test__fit_sub_plot(fit_imaging_7x7, plot_path, plot_patch): aplt.fit_imaging.subplot_fit_imaging( fit=fit_imaging_7x7, include=aplt.Include(mask=True), sub_plotter=aplt.SubPlotter( output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "subplot_fit_imaging.png" in plot_patch.paths
def test__fit_sub_plots(fit_interferometer_7, plot_path, plot_patch): fit_interferometer_plotter = aplt.FitInterferometerPlotter( fit=fit_interferometer_7, mat_plot_1d=aplt.MatPlot1D( output=aplt.Output(path=plot_path, format="png")), mat_plot_2d=aplt.MatPlot2D( output=aplt.Output(path=plot_path, format="png")), ) fit_interferometer_plotter.subplot_fit_interferometer() assert path.join(plot_path, "subplot_fit_interferometer.png") in plot_patch.paths fit_interferometer_plotter.subplot_fit_dirty_images() assert path.join(plot_path, "subplot_fit_dirty_images.png") in plot_patch.paths
def test__subplot_is_output(imaging_7x7, positions_7x7, mask_7x7, plot_path, plot_patch): aplt.imaging.subplot_imaging( imaging=imaging_7x7, sub_plotter=aplt.SubPlotter( output=aplt.Output(plot_path, format="png")), ) assert plot_path + "subplot_imaging.png" in plot_patch.paths
def test__fit_quantities_are_output(fit_imaging_7x7, plot_path, plot_patch): aplt.fit_imaging.image( fit=fit_imaging_7x7, include=aplt.Include(mask=True), plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "image.png" in plot_patch.paths aplt.fit_imaging.noise_map( fit=fit_imaging_7x7, include=aplt.Include(mask=True), plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "noise_map.png" in plot_patch.paths aplt.fit_imaging.signal_to_noise_map( fit=fit_imaging_7x7, include=aplt.Include(mask=True), plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "signal_to_noise_map.png" in plot_patch.paths aplt.fit_imaging.model_image( fit=fit_imaging_7x7, include=aplt.Include(mask=True), plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "model_image.png" in plot_patch.paths aplt.fit_imaging.residual_map( fit=fit_imaging_7x7, include=aplt.Include(mask=True), plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "residual_map.png" in plot_patch.paths aplt.fit_imaging.normalized_residual_map( fit=fit_imaging_7x7, include=aplt.Include(mask=True), plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "normalized_residual_map.png" in plot_patch.paths aplt.fit_imaging.chi_squared_map( fit=fit_imaging_7x7, include=aplt.Include(mask=True), plotter=aplt.Plotter(output=aplt.Output(path=plot_path, format="png")), ) assert plot_path + "chi_squared_map.png" in plot_patch.paths
def test__fit_sub_plot(fit_imaging_7x7, plot_path, plot_patch): fit_imaging_plotter = aplt.FitImagingPlotter( fit=fit_imaging_7x7, include_2d=aplt.Include2D(origin=True, mask=True, border=True), mat_plot_2d=aplt.MatPlot2D( output=aplt.Output(path=plot_path, format="png")), ) fit_imaging_plotter.subplot_fit_imaging() assert path.join(plot_path, "subplot_fit_imaging.png") in plot_patch.paths
def test__input_path_is_created(self): test_path = path.join(directory, "files", "output_path") if path.exists(test_path): shutil.rmtree(test_path) assert not path.exists(test_path) output = aplt.Output(path=test_path) assert path.exists(test_path)
def test__subplot_is_output(imaging_7x7, grid_2d_irregular_7x7_list, mask_2d_7x7, plot_path, plot_patch): imaging_plot = aplt.ImagingPlotter( imaging=imaging_7x7, mat_plot_2d=aplt.MatPlot2D( output=aplt.Output(plot_path, format="png")), ) imaging_plot.subplot_imaging() assert path.join(plot_path, "subplot_imaging.png") in plot_patch.paths
def test__plot_rectangular_mapper__works_with_all_extras_included( self, rectangular_mapper_7x7_3x3, plot_path, plot_patch): mapper_plotter = aplt.MapperPlotter( mapper=rectangular_mapper_7x7_3x3, visuals_2d=aplt.Visuals2D(indexes=[[(0, 0), (0, 1)], [(1, 2)]], pixelization_indexes=[[0, 1], [2]]), mat_plot_2d=aplt.MatPlot2D(output=aplt.Output( path=plot_path, filename="mapper1", format="png")), ) mapper_plotter.figure_2d() assert path.join(plot_path, "mapper1.png") in plot_patch.paths mapper_plotter = aplt.MapperPlotter( mapper=rectangular_mapper_7x7_3x3, visuals_2d=aplt.Visuals2D(indexes=[[(0, 0), (0, 1)], [(1, 2)]], pixelization_indexes=[[0, 1], [2]]), mat_plot_2d=aplt.MatPlot2D(output=aplt.Output( path=plot_path, filename="mapper2", format="png")), ) mapper_plotter.figure_2d() assert path.join(plot_path, "mapper2.png") in plot_patch.paths mapper_plotter = aplt.MapperPlotter( mapper=rectangular_mapper_7x7_3x3, visuals_2d=aplt.Visuals2D(indexes=[[(0, 0), (0, 1)], [(1, 2)]], pixelization_indexes=[[0, 1], [2]]), mat_plot_2d=aplt.MatPlot2D(output=aplt.Output( path=plot_path, filename="mapper3", format="png")), include_2d=aplt.Include2D(origin=True, mapper_source_pixelization_grid=True), ) mapper_plotter.figure_2d() assert path.join(plot_path, "mapper3.png") in plot_patch.paths
def test__plot_voronoi_mapper__works_with_all_extras_included( self, voronoi_mapper_9_3x3, plot_path, plot_patch): mapper_plotter = aplt.MapperPlotter( mapper=voronoi_mapper_9_3x3, visuals_2d=aplt.Visuals2D(indexes=[[(0, 0), (0, 1)], [(1, 2)]], pixelization_indexes=[[0, 1], [2]]), mat_plot_2d=aplt.MatPlot2D(output=aplt.Output( path=plot_path, filename="mapper1", format="png")), ) mapper_plotter.figure_2d() assert path.join(plot_path, "mapper1.png") in plot_patch.paths mapper_plotter = aplt.MapperPlotter( visuals_2d=aplt.Visuals2D(indexes=[[(0, 0), (0, 1)], [(1, 2)]], pixelization_indexes=[[0, 1], [2]]), mapper=voronoi_mapper_9_3x3, mat_plot_2d=aplt.MatPlot2D(output=aplt.Output( path=plot_path, filename="mapper2", format="png")), ) mapper_plotter.figure_2d() assert path.join(plot_path, "mapper2.png") in plot_patch.paths mapper_plotter = aplt.MapperPlotter( visuals_2d=aplt.Visuals2D(indexes=[[(0, 0), (0, 1)], [(1, 2)]], pixelization_indexes=[[0, 1], [2]]), mapper=voronoi_mapper_9_3x3, mat_plot_2d=aplt.MatPlot2D(output=aplt.Output( path=plot_path, filename="mapper3", format="png")), ) mapper_plotter.figure_2d() assert path.join(plot_path, "mapper3.png") in plot_patch.paths