Пример #1
0
def test__1d__via_light_obj_from(lp_0):

    visuals_1d = aplt.Visuals1D()
    include_1d = aplt.Include1D(half_light_radius=True)

    get_visuals = GetVisuals1D(include=include_1d, visuals=visuals_1d)

    visuals_1d_via = get_visuals.via_light_obj_from(light_obj=lp_0)

    assert visuals_1d_via.half_light_radius == lp_0.half_light_radius

    include_1d = aplt.Include1D(half_light_radius=False)

    get_visuals = GetVisuals1D(include=include_1d, visuals=visuals_1d)

    visuals_1d_via = get_visuals.via_light_obj_from(light_obj=lp_0)

    assert visuals_1d_via.half_light_radius is None
Пример #2
0
def test__1d__via_mass_obj_from(mp_0, grid_2d_7x7):

    visuals_1d = aplt.Visuals1D()
    include_1d = aplt.Include1D(einstein_radius=True)

    get_visuals = GetVisuals1D(include=include_1d, visuals=visuals_1d)

    visuals_1d_via = get_visuals.via_mass_obj_from(mass_obj=mp_0,
                                                   grid=grid_2d_7x7)

    assert visuals_1d_via.einstein_radius == mp_0.einstein_radius_from(
        grid=grid_2d_7x7)

    include_1d = aplt.Include1D(einstein_radius=False)

    get_visuals = GetVisuals1D(include=include_1d, visuals=visuals_1d)

    visuals_1d_via = get_visuals.via_mass_obj_from(mass_obj=mp_0,
                                                   grid=grid_2d_7x7)

    assert visuals_1d_via.einstein_radius is None
Пример #3
0
def test__1d__via_light_obj_list_from(lp_0):

    visuals_1d = aplt.Visuals1D()
    include_1d = aplt.Include1D(half_light_radius=True)

    get_visuals = GetVisuals1D(include=include_1d, visuals=visuals_1d)

    visuals_1d_via = get_visuals.via_light_obj_list_from(
        light_obj_list=[lp_0, lp_0], low_limit=1.0)

    assert visuals_1d_via.half_light_radius == lp_0.half_light_radius
    assert visuals_1d_via.half_light_radius_errors[0][
        0] == lp_0.half_light_radius

    include_1d = aplt.Include1D(half_light_radius=False)

    get_visuals = GetVisuals1D(include=include_1d, visuals=visuals_1d)

    visuals_1d_via = get_visuals.via_light_obj_list_from(
        light_obj_list=[lp_0, lp_0], low_limit=1.0)

    assert visuals_1d_via.half_light_radius is None
    assert visuals_1d_via.half_light_radius_errors is None
Пример #4
0
def test__1d__via_mass_obj_list_from(mp_0, grid_2d_7x7):

    visuals_1d = aplt.Visuals1D()
    include_1d = aplt.Include1D(einstein_radius=True)

    get_visuals = GetVisuals1D(include=include_1d, visuals=visuals_1d)

    visuals_1d_via = get_visuals.via_mass_obj_list_from(
        mass_obj_list=[mp_0, mp_0], grid=grid_2d_7x7, low_limit=1.0)

    assert visuals_1d_via.einstein_radius == mp_0.einstein_radius_from(
        grid=grid_2d_7x7)
    assert visuals_1d_via.einstein_radius_errors[0][
        0] == mp_0.einstein_radius_from(grid=grid_2d_7x7)

    include_1d = aplt.Include1D(einstein_radius=False)

    get_visuals = GetVisuals1D(include=include_1d, visuals=visuals_1d)

    visuals_1d_via = get_visuals.via_mass_obj_list_from(
        mass_obj_list=[mp_0, mp_0], grid=grid_2d_7x7, low_limit=1.0)

    assert visuals_1d_via.einstein_radius is None
    assert visuals_1d_via.einstein_radius_errors is None
Пример #5
0
    def __init__(
            self,
            fit: FitPointDataset,
            mat_plot_1d: aplt.MatPlot1D = aplt.MatPlot1D(),
            visuals_1d: aplt.Visuals1D = aplt.Visuals1D(),
            include_1d: aplt.Include1D = aplt.Include1D(),
            mat_plot_2d: aplt.MatPlot2D = aplt.MatPlot2D(),
            visuals_2d: aplt.Visuals2D = aplt.Visuals2D(),
            include_2d: aplt.Include2D = aplt.Include2D(),
    ):
        super().__init__(
            mat_plot_1d=mat_plot_1d,
            visuals_1d=visuals_1d,
            include_1d=include_1d,
            mat_plot_2d=mat_plot_2d,
            include_2d=include_2d,
            visuals_2d=visuals_2d,
        )

        self.fit = fit
Пример #6
0
    def __init__(
            self,
            point_dict: PointDict,
            mat_plot_1d: aplt.MatPlot1D = aplt.MatPlot1D(),
            visuals_1d: aplt.Visuals1D = aplt.Visuals1D(),
            include_1d: aplt.Include1D = aplt.Include1D(),
            mat_plot_2d: aplt.MatPlot2D = aplt.MatPlot2D(),
            visuals_2d: aplt.Visuals2D = aplt.Visuals2D(),
            include_2d: aplt.Include2D = aplt.Include2D(),
    ):
        super().__init__(
            mat_plot_1d=mat_plot_1d,
            visuals_1d=visuals_1d,
            include_1d=include_1d,
            mat_plot_2d=mat_plot_2d,
            include_2d=include_2d,
            visuals_2d=visuals_2d,
        )

        self.point_dict = point_dict
Пример #7
0
    def __init__(
            self,
            fit: FitInterferometer,
            mat_plot_1d: aplt.MatPlot1D = aplt.MatPlot1D(),
            visuals_1d: aplt.Visuals1D = aplt.Visuals1D(),
            include_1d: aplt.Include1D = aplt.Include1D(),
            mat_plot_2d: aplt.MatPlot2D = aplt.MatPlot2D(),
            visuals_2d: aplt.Visuals2D = aplt.Visuals2D(),
            include_2d: aplt.Include2D = aplt.Include2D(),
    ):
        """
        Plots the attributes of `FitInterferometer` objects using the matplotlib method `imshow()` and many
        other matplotlib functions which customize the plot's appearance.

        The `mat_plot_1d` and `mat_plot_2d` attributes wrap matplotlib function calls to make the figure. By default,
        the settings passed to every matplotlib function called are those specified in
        the `config/visualize/mat_wrap/*.ini` files, but a user can manually input values into `MatPlot2d` to
        customize the figure's appearance.

        Overlaid on the figure are visuals, contained in the `Visuals1D` and `Visuals2D` objects. Attributes may be
        extracted from the `FitInterferometer` and plotted via the visuals object, if the corresponding entry is `True` in
        the `Include1D` or `Include2D` object or the `config/visualize/include.ini` file.

        Parameters
        ----------
        fit
            The fit to an interferometer dataset the plotter plots.
        mat_plot_1d
            Contains objects which wrap the matplotlib function calls that make 1D plots.
        visuals_1d
            Contains 1D visuals that can be overlaid on 1D plots.
        include_1d
            Specifies which attributes of the `FitInterferometer` are extracted and plotted as visuals for 1D plots.
        mat_plot_2d
            Contains objects which wrap the matplotlib function calls that make 2D plots.
        visuals_2d
            Contains 2D visuals that can be overlaid on 2D plots.
        include_2d
            Specifies which attributes of the `FitInterferometer` are extracted and plotted as visuals for 2D plots.
        """
        super().__init__(
            mat_plot_1d=mat_plot_1d,
            include_1d=include_1d,
            visuals_1d=visuals_1d,
            mat_plot_2d=mat_plot_2d,
            include_2d=include_2d,
            visuals_2d=visuals_2d,
        )

        self.fit = fit

        self._fit_interferometer_meta_plotter = FitInterferometerPlotterMeta(
            fit=self.fit,
            get_visuals_2d_real_space=self.get_visuals_2d_real_space,
            mat_plot_1d=self.mat_plot_1d,
            include_1d=self.include_1d,
            visuals_1d=self.visuals_1d,
            mat_plot_2d=self.mat_plot_2d,
            include_2d=self.include_2d,
            visuals_2d=self.visuals_2d,
        )

        self.subplot = self._fit_interferometer_meta_plotter.subplot
        self.subplot_fit_interferometer = (
            self._fit_interferometer_meta_plotter.subplot_fit_interferometer)
        self.subplot_fit_dirty_images = (
            self._fit_interferometer_meta_plotter.subplot_fit_dirty_images)
Пример #8
0
    def __init__(
            self,
            tracer: Tracer,
            grid: aa.type.Grid2DLike,
            mat_plot_1d: aplt.MatPlot1D = aplt.MatPlot1D(),
            visuals_1d: aplt.Visuals1D = aplt.Visuals1D(),
            include_1d: aplt.Include1D = aplt.Include1D(),
            mat_plot_2d: aplt.MatPlot2D = aplt.MatPlot2D(),
            visuals_2d: aplt.Visuals2D = aplt.Visuals2D(),
            include_2d: aplt.Include2D = aplt.Include2D(),
    ):
        """
        Plots the attributes of `Tracer` objects using the matplotlib methods `plot()` and `imshow()` and many 
        other matplotlib functions which customize the plot's appearance.

        The `mat_plot_1d` and `mat_plot_2d` attributes wrap matplotlib function calls to make the figure. By default, 
        the settings passed to every matplotlib function called are those specified in 
        the `config/visualize/mat_wrap/*.ini` files, but a user can manually input values into `MatPlot2D` to 
        customize the figure's appearance.

        Overlaid on the figure are visuals, contained in the `Visuals1D` and `Visuals2D` objects. Attributes may be 
        extracted from the `MassProfile` and plotted via the visuals object, if the corresponding entry is `True` in 
        the `Include1D` or `Include2D` object or the `config/visualize/include.ini` file.

        Parameters
        ----------
        tracer
            The tracer the plotter plots.
        grid
            The 2D (y,x) grid of coordinates used to evaluate the tracer's light and mass quantities that are plotted.
        mat_plot_1d
            Contains objects which wrap the matplotlib function calls that make 1D plots.
        visuals_1d
            Contains 1D visuals that can be overlaid on 1D plots.
        include_1d
            Specifies which attributes of the `MassProfile` are extracted and plotted as visuals for 1D plots.
        mat_plot_2d
            Contains objects which wrap the matplotlib function calls that make 2D plots.
        visuals_2d
            Contains 2D visuals that can be overlaid on 2D plots.
        include_2d
            Specifies which attributes of the `MassProfile` are extracted and plotted as visuals for 2D plots.
        """
        super().__init__(
            mat_plot_1d=mat_plot_1d,
            visuals_1d=visuals_1d,
            include_1d=include_1d,
            mat_plot_2d=mat_plot_2d,
            include_2d=include_2d,
            visuals_2d=visuals_2d,
        )

        self.tracer = tracer
        self.grid = grid

        self._mass_plotter = MassPlotter(
            mass_obj=self.tracer,
            grid=self.grid,
            get_visuals_2d=self.get_visuals_2d,
            mat_plot_2d=self.mat_plot_2d,
            include_2d=self.include_2d,
            visuals_2d=self.visuals_2d,
        )