Beispiel #1
0
    def visualize_fit_in_fits(self, fit):

        fits_plotter = self.plotter.plotter_with_new_output(
            path=self.plotter.output.path + "fit_imaging/fits/", format="fits")

        fit_imaging_plots.individuals(
            fit=fit,
            plot_image=True,
            plot_noise_map=True,
            plot_signal_to_noise_map=True,
            plot_model_image=True,
            plot_residual_map=True,
            plot_normalized_residual_map=True,
            plot_chi_squared_map=True,
            plot_subtracted_images_of_planes=True,
            plot_model_images_of_planes=True,
            plot_plane_images_of_planes=True,
            include=self.include,
            plotter=fits_plotter,
        )

        if fit.inversion is not None:

            fits_plotter = self.plotter.plotter_with_new_output(
                path=self.plotter.output.path + "inversion/fits/",
                format="fits")

            inversion_plots.individuals(
                inversion=fit.inversion,
                plot_reconstructed_image=True,
                plot_interpolated_reconstruction=True,
                plot_interpolated_errors=True,
                include=self.include,
                plotter=fits_plotter,
            )
    def visualize_fit_in_fits(self, paths: af.Paths, fit):

        fits_plotter = self.plotter_from_paths(
            paths=paths, subfolders=path.join("fit_imaging", "fits"), format="fits"
        )

        fit_imaging_plots.individuals(
            fit=fit,
            plot_image=True,
            plot_noise_map=True,
            plot_signal_to_noise_map=True,
            plot_model_image=True,
            plot_residual_map=True,
            plot_normalized_residual_map=True,
            plot_chi_squared_map=True,
            plot_subtracted_images_of_planes=True,
            plot_model_images_of_planes=True,
            plot_plane_images_of_planes=True,
            include=self.include,
            plotter=fits_plotter,
        )

        if fit.inversion is not None:

            fits_plotter = self.plotter_from_paths(
                paths=paths, subfolders=path.join("inversion", "fits"), format="fits"
            )

            inversion_plots.individuals(
                inversion=fit.inversion,
                plot_reconstructed_image=True,
                plot_interpolated_reconstruction=True,
                plot_interpolated_errors=True,
                include=self.include,
                plotter=fits_plotter,
            )
Beispiel #3
0
    def visualize_fit(self, fit, during_analysis):

        plotter = self.plotter.plotter_with_new_output(
            path=self.plotter.output.path + "fit_imaging/")

        if self.plot_subplot_fit:
            fit_imaging_plots.subplot_fit_imaging(fit=fit,
                                                  include=self.include,
                                                  sub_plotter=self.sub_plotter)

        if self.plot_subplots_of_all_planes_fits:
            fit_imaging_plots.subplots_of_all_planes(
                fit=fit, include=self.include, sub_plotter=self.sub_plotter)

        fit_imaging_plots.individuals(
            fit=fit,
            plot_image=self.plot_fit_data,
            plot_noise_map=self.plot_fit_noise_map,
            plot_signal_to_noise_map=self.plot_fit_signal_to_noise_map,
            plot_model_image=self.plot_fit_model_data,
            plot_residual_map=self.plot_fit_residual_map,
            plot_chi_squared_map=self.plot_fit_chi_squared_map,
            plot_normalized_residual_map=self.plot_fit_normalized_residual_map,
            plot_subtracted_images_of_planes=self.
            plot_fit_subtracted_images_of_planes,
            plot_model_images_of_planes=self.plot_fit_model_images_of_planes,
            plot_plane_images_of_planes=self.plot_fit_plane_images_of_planes,
            include=self.include,
            plotter=plotter,
        )

        if fit.inversion is not None:

            if self.plot_subplot_inversion:
                inversion_plots.subplot_inversion(
                    inversion=fit.inversion,
                    image_positions=self.include.positions_from_fit(fit=fit),
                    source_positions=self.include.
                    positions_of_plane_from_fit_and_plane_index(
                        fit=fit, plane_index=-1),
                    grid=self.include.
                    inversion_image_pixelization_grid_from_fit(fit=fit),
                    light_profile_centres=self.include.
                    light_profile_centres_of_galaxies_from_obj(
                        obj=fit.tracer.image_plane),
                    mass_profile_centres=self.include.
                    mass_profile_centres_of_galaxies_from_obj(
                        obj=fit.tracer.image_plane),
                    critical_curves=self.include.critical_curves_from_obj(
                        obj=fit.tracer),
                    caustics=self.include.caustics_from_obj(obj=fit.tracer),
                    include=self.include,
                    sub_plotter=self.sub_plotter,
                )

            plotter = self.plotter.plotter_with_new_output(
                path=self.plotter.output.path + "inversion/")

            inversion_plots.individuals(
                inversion=fit.inversion,
                image_positions=self.include.positions_from_fit(fit=fit),
                source_positions=self.include.
                positions_of_plane_from_fit_and_plane_index(fit=fit,
                                                            plane_index=-1),
                grid=self.include.inversion_image_pixelization_grid_from_fit(
                    fit=fit),
                light_profile_centres=self.include.
                light_profile_centres_of_galaxies_from_obj(
                    obj=fit.tracer.image_plane),
                mass_profile_centres=self.include.
                mass_profile_centres_of_galaxies_from_obj(
                    obj=fit.tracer.image_plane),
                critical_curves=self.include.critical_curves_from_obj(
                    obj=fit.tracer),
                caustics=self.include.caustics_from_obj(obj=fit.tracer),
                plot_reconstructed_image=self.plot_inversion_reconstruction,
                plot_reconstruction=self.plot_inversion_reconstruction,
                plot_errors=self.plot_inversion_errors,
                plot_residual_map=self.plot_inversion_residual_map,
                plot_normalized_residual_map=self.
                plot_inversion_normalized_residual_map,
                plot_chi_squared_map=self.plot_inversion_chi_squared_map,
                plot_regularization_weight_map=self.
                plot_inversion_regularization_weights,
                plot_interpolated_reconstruction=self.
                plot_inversion_interpolated_reconstruction,
                plot_interpolated_errors=self.
                plot_inversion_interpolated_errors,
                include=self.include,
                plotter=plotter,
            )

        if not during_analysis:

            if self.plot_fit_all_at_end_png:
                fit_imaging_plots.individuals(
                    fit=fit,
                    plot_image=True,
                    plot_noise_map=True,
                    plot_signal_to_noise_map=True,
                    plot_model_image=True,
                    plot_residual_map=True,
                    plot_normalized_residual_map=True,
                    plot_chi_squared_map=True,
                    plot_subtracted_images_of_planes=True,
                    plot_model_images_of_planes=True,
                    plot_plane_images_of_planes=True,
                    include=self.include,
                    plotter=plotter,
                )

                if fit.inversion is not None:
                    inversion_plots.individuals(
                        inversion=fit.inversion,
                        image_positions=self.include.positions_from_fit(
                            fit=fit),
                        source_positions=self.include.
                        positions_of_plane_from_fit_and_plane_index(
                            fit=fit, plane_index=-1),
                        grid=self.include.
                        inversion_image_pixelization_grid_from_fit(fit=fit),
                        light_profile_centres=self.include.
                        light_profile_centres_of_galaxies_from_obj(
                            obj=fit.tracer.image_plane),
                        mass_profile_centres=self.include.
                        mass_profile_centres_of_galaxies_from_obj(
                            obj=fit.tracer.image_plane),
                        critical_curves=self.include.critical_curves_from_obj(
                            obj=fit.tracer),
                        caustics=self.include.caustics_from_obj(
                            obj=fit.tracer),
                        plot_reconstructed_image=True,
                        plot_reconstruction=True,
                        plot_errors=True,
                        plot_residual_map=True,
                        plot_normalized_residual_map=True,
                        plot_chi_squared_map=True,
                        plot_regularization_weight_map=True,
                        plot_interpolated_reconstruction=True,
                        plot_interpolated_errors=True,
                        include=self.include,
                        plotter=plotter,
                    )

            if self.plot_fit_all_at_end_fits:

                self.visualize_fit_in_fits(fit=fit)