Example #1
0
    def test__multiple_images_scatterer__from_config_or_via_manual_input(self):

        plotter = aplt.Plotter()

        assert plotter.multiple_images_scatterer.size == 12
        assert plotter.multiple_images_scatterer.marker == "o"
        assert plotter.multiple_images_scatterer.colors == ["k", "w"]

        plotter = aplt.Plotter(
            multiple_images_scatterer=aplt.MultipleImagesScatterer(
                size=1, marker=".", colors="k"
            )
        )

        assert plotter.multiple_images_scatterer.size == 1
        assert plotter.multiple_images_scatterer.marker == "."
        assert plotter.multiple_images_scatterer.colors == ["k"]

        sub_plotter = aplt.SubPlotter()

        assert sub_plotter.multiple_images_scatterer.size == 17
        assert sub_plotter.multiple_images_scatterer.marker == "."
        assert sub_plotter.multiple_images_scatterer.colors == ["g"]

        sub_plotter = aplt.SubPlotter(
            multiple_images_scatterer=aplt.MultipleImagesScatterer.sub(
                marker="o", colors="r"
            )
        )

        assert sub_plotter.multiple_images_scatterer.size == 17
        assert sub_plotter.multiple_images_scatterer.marker == "o"
        assert sub_plotter.multiple_images_scatterer.colors == ["r"]
Example #2
0
    def test__mass_profile_centres_scatterer__from_config_or_via_manual_input(self):

        plotter = aplt.Plotter()

        assert plotter.mass_profile_centres_scatterer.size == 11
        assert plotter.mass_profile_centres_scatterer.marker == "x"
        assert plotter.mass_profile_centres_scatterer.colors == ["r", "k"]

        plotter = aplt.Plotter(
            mass_profile_centres_scatterer=aplt.MassProfileCentreScatterer(
                size=1, marker=".", colors="k"
            )
        )

        assert plotter.mass_profile_centres_scatterer.size == 1
        assert plotter.mass_profile_centres_scatterer.marker == "."
        assert plotter.mass_profile_centres_scatterer.colors == ["k"]

        sub_plotter = aplt.SubPlotter()

        assert sub_plotter.mass_profile_centres_scatterer.size == 16
        assert sub_plotter.mass_profile_centres_scatterer.marker == "o"
        assert sub_plotter.mass_profile_centres_scatterer.colors == ["k"]

        sub_plotter = aplt.SubPlotter(
            mass_profile_centres_scatterer=aplt.MassProfileCentreScatterer.sub(
                marker="o", colors="r"
            )
        )

        assert sub_plotter.mass_profile_centres_scatterer.size == 16
        assert sub_plotter.mass_profile_centres_scatterer.marker == "o"
        assert sub_plotter.mass_profile_centres_scatterer.colors == ["r"]
Example #3
0
    def test__light_profile_centres_scatterer__from_config_or_via_manual_input(self):

        plotter = aplt.Plotter()

        assert plotter.light_profile_centres_scatterer.size == 10
        assert plotter.light_profile_centres_scatterer.marker == "+"
        assert plotter.light_profile_centres_scatterer.colors == ["k", "r"]

        plotter = aplt.Plotter(
            light_profile_centres_scatterer=aplt.LightProfileCentreScatterer(
                size=1, marker=".", colors="k"
            )
        )

        assert plotter.light_profile_centres_scatterer.size == 1
        assert plotter.light_profile_centres_scatterer.marker == "."
        assert plotter.light_profile_centres_scatterer.colors == ["k"]

        sub_plotter = aplt.SubPlotter()

        assert sub_plotter.light_profile_centres_scatterer.size == 15
        assert sub_plotter.light_profile_centres_scatterer.marker == "."
        assert sub_plotter.light_profile_centres_scatterer.colors == ["b"]

        sub_plotter = aplt.SubPlotter(
            light_profile_centres_scatterer=aplt.LightProfileCentreScatterer.sub(
                marker="o", colors="r"
            )
        )

        assert sub_plotter.light_profile_centres_scatterer.size == 15
        assert sub_plotter.light_profile_centres_scatterer.marker == "o"
        assert sub_plotter.light_profile_centres_scatterer.colors == ["r"]
Example #4
0
    def test__caustics_liner__from_config_or_via_manual_input(self):

        plotter = aplt.Plotter()

        assert plotter.caustics_liner.width == 3
        assert plotter.caustics_liner.style == "--"
        assert plotter.caustics_liner.colors == ["w", "g"]
        assert plotter.caustics_liner.pointsize == 21

        plotter = aplt.Plotter(
            caustics_liner=aplt.CausticsLiner(
                width=1, style=".", colors="k", pointsize=3
            )
        )

        assert plotter.caustics_liner.width == 1
        assert plotter.caustics_liner.style == "."
        assert plotter.caustics_liner.colors == ["k"]
        assert plotter.caustics_liner.pointsize == 3

        sub_plotter = aplt.SubPlotter()

        assert sub_plotter.caustics_liner.width == 7
        assert sub_plotter.caustics_liner.style == "--"
        assert sub_plotter.caustics_liner.colors == ["g"]
        assert sub_plotter.caustics_liner.pointsize == 23

        sub_plotter = aplt.SubPlotter(
            caustics_liner=aplt.CausticsLiner.sub(style=".", colors="r", pointsize=21)
        )

        assert sub_plotter.caustics_liner.width == 7
        assert sub_plotter.caustics_liner.style == "."
        assert sub_plotter.caustics_liner.colors == ["r"]
        assert sub_plotter.caustics_liner.pointsize == 21
def test__fit_sub_plot__all_types_of_galaxy_fit(
    gal_fit_7x7_image,
    gal_fit_7x7_convergence,
    gal_fit_7x7_potential,
    gal_fit_7x7_deflections_y,
    gal_fit_7x7_deflections_x,
    positions_7x7,
    include_all,
    plot_patch,
    galaxy_fit_plotter_path,
):
    aplt.fit_galaxy.subplot_fit_galaxy(
        fit=gal_fit_7x7_image,
        positions=positions_7x7,
        include=include_all,
        sub_plotter=aplt.SubPlotter(
            output=aplt.Output(path=galaxy_fit_plotter_path, format="png")),
    )

    assert galaxy_fit_plotter_path + "subplot_fit_galaxy.png" in plot_patch.paths

    aplt.fit_galaxy.subplot_fit_galaxy(
        fit=gal_fit_7x7_convergence,
        positions=positions_7x7,
        include=include_all,
        sub_plotter=aplt.SubPlotter(
            output=aplt.Output(path=galaxy_fit_plotter_path, format="png")),
    )

    assert galaxy_fit_plotter_path + "subplot_fit_galaxy.png" in plot_patch.paths

    aplt.fit_galaxy.subplot_fit_galaxy(
        fit=gal_fit_7x7_potential,
        positions=positions_7x7,
        include=include_all,
        sub_plotter=aplt.SubPlotter(
            output=aplt.Output(path=galaxy_fit_plotter_path, format="png")),
    )

    assert galaxy_fit_plotter_path + "subplot_fit_galaxy.png" in plot_patch.paths

    aplt.fit_galaxy.subplot_fit_galaxy(
        fit=gal_fit_7x7_deflections_y,
        positions=positions_7x7,
        include=include_all,
        sub_plotter=aplt.SubPlotter(
            output=aplt.Output(path=galaxy_fit_plotter_path, format="png")),
    )

    assert galaxy_fit_plotter_path + "subplot_fit_galaxy.png" in plot_patch.paths

    aplt.fit_galaxy.subplot_fit_galaxy(
        fit=gal_fit_7x7_deflections_x,
        positions=positions_7x7,
        include=include_all,
        sub_plotter=aplt.SubPlotter(
            output=aplt.Output(path=galaxy_fit_plotter_path, format="png")),
    )

    assert galaxy_fit_plotter_path + "subplot_fit_galaxy.png" in plot_patch.paths
Example #6
0
    def test__critical_curves_liner__from_config_or_via_manual_input(self):

        plotter = aplt.Plotter()

        assert plotter.critical_curves_liner.width == 2
        assert plotter.critical_curves_liner.style == "-"
        assert plotter.critical_curves_liner.colors == ["w", "k"]
        assert plotter.critical_curves_liner.pointsize == 20

        plotter = aplt.Plotter(
            critical_curves_liner=aplt.CriticalCurvesLiner(
                width=1, style=".", colors="k", pointsize=3
            )
        )

        assert plotter.critical_curves_liner.width == 1
        assert plotter.critical_curves_liner.style == "."
        assert plotter.critical_curves_liner.colors == ["k"]
        assert plotter.critical_curves_liner.pointsize == 3

        sub_plotter = aplt.SubPlotter()

        assert sub_plotter.critical_curves_liner.width == 6
        assert sub_plotter.critical_curves_liner.style == "-"
        assert sub_plotter.critical_curves_liner.colors == ["b"]
        assert sub_plotter.critical_curves_liner.pointsize == 22

        sub_plotter = aplt.SubPlotter(
            critical_curves_liner=aplt.CriticalCurvesLiner.sub(
                style=".", colors="r", pointsize=21
            )
        )

        assert sub_plotter.critical_curves_liner.width == 6
        assert sub_plotter.critical_curves_liner.style == "."
        assert sub_plotter.critical_curves_liner.colors == ["r"]
        assert sub_plotter.critical_curves_liner.pointsize == 21
def test__individual_galaxy_quantities__all_are_output(
    gal_x1_lp_x1_mp,
    sub_grid_7x7,
    positions_7x7,
    include_all,
    galaxy_plotter_path,
    plot_patch,
):
    aplt.galaxy.profile_image_subplot(
        galaxy=gal_x1_lp_x1_mp,
        grid=sub_grid_7x7,
        positions=positions_7x7,
        include=include_all,
        sub_plotter=aplt.SubPlotter(
            output=aplt.Output(galaxy_plotter_path, format="png")
        ),
    )

    assert galaxy_plotter_path + "profile_image_subplot.png" in plot_patch.paths

    aplt.galaxy.convergence_subplot(
        galaxy=gal_x1_lp_x1_mp,
        grid=sub_grid_7x7,
        positions=positions_7x7,
        include=include_all,
        sub_plotter=aplt.SubPlotter(
            output=aplt.Output(galaxy_plotter_path, format="png")
        ),
    )

    assert galaxy_plotter_path + "convergence_subplot.png" in plot_patch.paths

    aplt.galaxy.potential_subplot(
        galaxy=gal_x1_lp_x1_mp,
        grid=sub_grid_7x7,
        positions=positions_7x7,
        include=include_all,
        sub_plotter=aplt.SubPlotter(
            output=aplt.Output(galaxy_plotter_path, format="png")
        ),
    )

    assert galaxy_plotter_path + "potential_subplot.png" in plot_patch.paths

    aplt.galaxy.deflections_y_subplot(
        galaxy=gal_x1_lp_x1_mp,
        grid=sub_grid_7x7,
        positions=positions_7x7,
        include=include_all,
        sub_plotter=aplt.SubPlotter(
            output=aplt.Output(galaxy_plotter_path, format="png")
        ),
    )

    assert galaxy_plotter_path + "deflections_y_subplot.png" in plot_patch.paths

    aplt.galaxy.deflections_x_subplot(
        galaxy=gal_x1_lp_x1_mp,
        grid=sub_grid_7x7,
        positions=positions_7x7,
        include=include_all,
        sub_plotter=aplt.SubPlotter(
            output=aplt.Output(galaxy_plotter_path, format="png")
        ),
    )

    assert galaxy_plotter_path + "deflections_x_subplot.png" in plot_patch.paths