Ejemplo n.º 1
0
    def visualize(self, instance, during_analysis):
        instance = self.associate_hyper_images(instance=instance)
        tracer = self.tracer_for_instance(instance=instance)
        hyper_image_sky = self.hyper_image_sky_for_instance(instance=instance)
        hyper_background_noise = self.hyper_background_noise_for_instance(
            instance=instance)

        fit = self.masked_imaging_fit_for_tracer(
            tracer=tracer,
            hyper_image_sky=hyper_image_sky,
            hyper_background_noise=hyper_background_noise,
        )

        if tracer.has_mass_profile:

            visualizer = self.visualizer.new_visualizer_with_preloaded_critical_curves_and_caustics(
                preloaded_critical_curves=tracer.critical_curves,
                preloaded_caustics=tracer.caustics,
            )

        else:

            visualizer = self.visualizer

        visualizer.visualize_ray_tracing(tracer=fit.tracer,
                                         during_analysis=during_analysis)
        visualizer.visualize_fit(fit=fit, during_analysis=during_analysis)
Ejemplo n.º 2
0
    def visualize(self, instance, during_analysis):

        self.associate_hyper_images(instance=instance)
        tracer = self.tracer_for_instance(instance=instance)
        hyper_background_noise = self.hyper_background_noise_for_instance(
            instance=instance
        )

        fit = self.masked_interferometer_fit_for_tracer(
            tracer=tracer, hyper_background_noise=hyper_background_noise
        )

        if tracer.has_mass_profile:

            try:

                visualizer = self.visualizer.new_visualizer_with_preloaded_critical_curves_and_caustics(
                    preloaded_critical_curves=tracer.critical_curves,
                    preloaded_caustics=tracer.caustics,
                )

            except Exception or IndexError or ValueError:

                visualizer = self.visualizer

        else:

            visualizer = self.visualizer

        visualizer.visualize_ray_tracing(
            tracer=fit.tracer, during_analysis=during_analysis
        )
        visualizer.visualize_fit(fit=fit, during_analysis=during_analysis)
Ejemplo n.º 3
0
    def visualize(self, instance, during_analysis):

        instance = self.associate_hyper_images(instance=instance)
        tracer = self.tracer_for_instance(instance=instance)
        hyper_image_sky = self.hyper_image_sky_for_instance(instance=instance)
        hyper_background_noise = self.hyper_background_noise_for_instance(
            instance=instance
        )

        fit = self.masked_imaging_fit_for_tracer(
            tracer=tracer,
            hyper_image_sky=hyper_image_sky,
            hyper_background_noise=hyper_background_noise,
        )

        if tracer.has_mass_profile:

            try:

                visualizer = self.visualizer.new_visualizer_with_preloaded_critical_curves_and_caustics(
                    preloaded_critical_curves=tracer.critical_curves,
                    preloaded_caustics=tracer.caustics,
                )

            except Exception or IndexError or ValueError:

                visualizer = self.visualizer

        else:

            visualizer = self.visualizer

        try:
            visualizer.visualize_ray_tracing(
                tracer=fit.tracer, during_analysis=during_analysis
            )
            visualizer.visualize_fit(fit=fit, during_analysis=during_analysis)
        except Exception:
            pass

        if not during_analysis and visualizer.plot_stochastic_histogram:

            log_evidences = self.stochastic_log_evidences_for_instance(
                instance=instance
            )

            visualizer.visualize_stochastic_histogram(
                log_evidences=log_evidences,
                max_log_evidence=fit.log_evidence,
                during_analysis=during_analysis,
            )
Ejemplo n.º 4
0
    def visualize(self, instance, during_analysis):
        instance = self.associate_hyper_visibilities(instance=instance)
        tracer = self.tracer_for_instance(instance=instance)
        hyper_background_noise = self.hyper_background_noise_for_instance(
            instance=instance)

        fit = self.masked_interferometer_fit_for_tracer(
            tracer=tracer, hyper_background_noise=hyper_background_noise)

        visualizer = self.visualizer.new_visualizer_with_preloaded_critical_curves_and_caustics(
            preloaded_critical_curves=tracer.critical_curves,
            preloaded_caustics=tracer.caustics,
        )

        visualizer.visualize_ray_tracing(tracer=fit.tracer,
                                         during_analysis=during_analysis)
        visualizer.visualize_fit(fit=fit, during_analysis=during_analysis)
Ejemplo n.º 5
0
    def visualize(self, paths, instance, during_analysis):

        instance = self.associate_hyper_images(instance=instance)
        tracer = self.tracer_for_instance(instance=instance)
        hyper_image_sky = self.hyper_image_sky_for_instance(instance=instance)
        hyper_background_noise = self.hyper_background_noise_for_instance(
            instance=instance)

        fit = self.positions_fit_for_tracer(
            tracer=tracer,
            hyper_image_sky=hyper_image_sky,
            hyper_background_noise=hyper_background_noise,
        )

        if tracer.has_mass_profile:

            try:

                visualizer = self.visualizer.new_visualizer_with_preloaded_critical_curves_and_caustics(
                    preloaded_critical_curves=tracer.critical_curves,
                    preloaded_caustics=tracer.caustics,
                )

            except (Exception, IndexError, ValueError):

                visualizer = self.visualizer

        else:

            visualizer = self.visualizer

        try:
            visualizer.visualize_ray_tracing(tracer=fit.tracer,
                                             during_analysis=during_analysis)
            visualizer.visualize_fit(fit=fit, during_analysis=during_analysis)
        except Exception:
            pass
Ejemplo n.º 6
0
    def visualize(self, paths: af.Paths, instance, during_analysis):

        self.visualizer.visualize_interferometer(paths=paths)

        self.associate_hyper_images(instance=instance)
        tracer = self.tracer_for_instance(instance=instance)

        hyper_background_noise = self.hyper_background_noise_for_instance(
            instance=instance
        )

        fit = self.masked_interferometer_fit_for_tracer(
            tracer=tracer, hyper_background_noise=hyper_background_noise
        )

        if tracer.has_mass_profile:

            try:

                visualizer = self.visualizer.new_visualizer_with_preloaded_critical_curves_and_caustics(
                    preloaded_critical_curves=tracer.critical_curves,
                    preloaded_caustics=tracer.caustics,
                )

            except (Exception, IndexError, ValueError):

                visualizer = self.visualizer

        else:

            visualizer = self.visualizer

        visualizer.visualize_ray_tracing(
            paths=paths, tracer=fit.tracer, during_analysis=during_analysis
        )
        visualizer.visualize_fit(paths=paths, fit=fit, during_analysis=during_analysis)

        self.visualizer.visualize_hyper_images(
            paths=paths,
            hyper_galaxy_image_path_dict=self.hyper_galaxy_image_path_dict,
            hyper_model_image=self.hyper_model_image,
            contribution_maps_of_galaxies=tracer.contribution_maps_of_planes,
        )

        if self.visualizer.plot_fit_no_hyper:

            fit = self.masked_interferometer_fit_for_tracer(
                tracer=tracer,
                hyper_background_noise=hyper_background_noise,
                use_hyper_scalings=False,
            )

            try:
                visualizer.visualize_fit(
                    paths=paths,
                    fit=fit,
                    during_analysis=during_analysis,
                    subfolders="fit_no_hyper",
                )
            except Exception:
                pass