Ejemplo n.º 1
0
    def test__mass_tag(self):

        slam = al.SLaM(
            pipeline_source_parametric=al.SLaMPipelineSourceParametric(),
            pipeline_light_parametric=al.SLaMPipelineLightParametric(),
            pipeline_mass=al.SLaMPipelineMass(),
        )

        assert (
            slam.mass_tag == f"mass__"
            f"light[parametric__bulge_sersic__disk_exp__align_bulge_disk_centre]__"
            f"mass[total__power_law__with_shear]__"
            f"source[parametric__bulge_sersic]")

        pipeline_source_parametric = al.SLaMPipelineSourceParametric(
            setup_light=al.SetupLightParametric(
                bulge_prior_model=al.lp.SphericalExponential,
                disk_prior_model=None,
                align_bulge_disk_centre=False,
            ),
            setup_mass=al.SetupMassTotal(
                mass_prior_model=al.mp.EllipticalPowerLaw,
                mass_centre=(0.0, 0.0)),
            setup_source=al.SetupSourceParametric(
                bulge_prior_model=al.lp.SphericalDevVaucouleurs),
        )

        pipeline_source_inversion = al.SLaMPipelineSourceInversion(
            setup_source=al.SetupSourceInversion(
                pixelization_prior_model=al.pix.VoronoiMagnification,
                regularization_prior_model=al.reg.AdaptiveBrightness,
            ))

        pipeline_light_parametric = al.SLaMPipelineLightParametric(
            setup_light=al.SetupLightParametric(
                bulge_prior_model=al.lp.SphericalDevVaucouleurs,
                disk_prior_model=al.lp.SphericalExponential,
                align_bulge_disk_centre=False,
                light_centre=(0.0, 0.0),
            ))

        pipeline_mass = al.SLaMPipelineMass(setup_mass=al.SetupMassLightDark(
            bulge_prior_model=al.lmp.EllipticalSersicRadialGradient))

        slam = al.SLaM(
            pipeline_source_parametric=pipeline_source_parametric,
            pipeline_source_inversion=pipeline_source_inversion,
            pipeline_light_parametric=pipeline_light_parametric,
            pipeline_mass=pipeline_mass,
        )

        assert (
            slam.mass_tag == f"mass__"
            f"light[parametric__bulge_dev_sph__disk_exp_sph__centre_(0.00,0.00)]__"
            f"mass[light_dark__bulge_sersic_grad__disk_exp__mlr_free__dark_nfw_ludlow__with_shear]__"
            f"source[inversion__pix_voro_mag__reg_adapt_bright]")
Ejemplo n.º 2
0
    def test__source_inversion_tag(self):

        slam = al.SLaM(
            pipeline_source_parametric=al.SLaMPipelineSourceParametric(),
            pipeline_source_inversion=al.SLaMPipelineSourceInversion(),
            pipeline_mass=al.SLaMPipelineMass(),
        )

        assert (slam.source_inversion_tag == f"source__"
                f"mass[total__sie__with_shear]__"
                f"source[inversion__pix_rect__reg_const]")
        assert slam.source_inversion_tag == slam.source_tag

        pipeline_source_parametric = al.SLaMPipelineSourceParametric(
            setup_light=al.SetupLightParametric(
                bulge_prior_model=al.lp.SphericalExponential,
                disk_prior_model=None),
            setup_mass=al.SetupMassTotal(
                mass_prior_model=al.mp.EllipticalPowerLaw,
                mass_centre=(0.0, 0.0)),
            setup_source=al.SetupSourceParametric(
                bulge_prior_model=al.lp.SphericalDevVaucouleurs),
        )

        pipeline_source_inversion = al.SLaMPipelineSourceInversion(
            setup_source=al.SetupSourceInversion(
                pixelization_prior_model=al.pix.VoronoiMagnification,
                regularization_prior_model=al.reg.AdaptiveBrightness,
            ))

        slam = al.SLaM(
            pipeline_source_parametric=pipeline_source_parametric,
            pipeline_source_inversion=pipeline_source_inversion,
            pipeline_light_parametric=al.SLaMPipelineLightParametric(),
            pipeline_mass=al.SLaMPipelineMass(),
        )

        assert (slam.source_inversion_tag == f"source__"
                f"light[parametric__bulge_exp_sph]__"
                f"mass[total__power_law__with_shear__centre_(0.00,0.00)]__"
                f"source[inversion__pix_voro_mag__reg_adapt_bright]")
        assert slam.source_inversion_tag == slam.source_tag
Ejemplo n.º 3
0
    def test__source_parametric_tag(self):

        slam = al.SLaM(
            pipeline_source_parametric=al.SLaMPipelineSourceParametric(),
            pipeline_mass=al.SLaMPipelineMass(),
        )

        assert (slam.source_parametric_tag == f"source__"
                f"mass[total__sie__with_shear]__"
                f"source[parametric__bulge_sersic]")
        assert slam.source_parametric_tag == slam.source_tag

        pipeline_source_parametric = al.SLaMPipelineSourceParametric(
            setup_light=al.SetupLightParametric(
                bulge_prior_model=al.lp.SphericalExponential,
                disk_prior_model=None,
                align_bulge_disk_centre=False,
            ),
            setup_mass=al.SetupMassTotal(
                mass_prior_model=al.mp.EllipticalPowerLaw,
                mass_centre=(0.0, 0.0)),
            setup_source=al.SetupSourceParametric(
                bulge_prior_model=al.lp.SphericalDevVaucouleurs,
                align_bulge_disk_centre=False,
            ),
        )

        slam = al.SLaM(
            pipeline_source_parametric=pipeline_source_parametric,
            pipeline_light_parametric=al.SLaMPipelineLightParametric(),
            pipeline_mass=al.SLaMPipelineMass(),
        )

        assert (slam.source_parametric_tag == f"source__"
                f"light[parametric__bulge_exp_sph]__"
                f"mass[total__power_law__with_shear__centre_(0.00,0.00)]__"
                f"source[parametric__bulge_dev_sph]")
        assert slam.source_parametric_tag == slam.source_tag
# %%
"""
__SLaM__

We combine all of the above _SLaM_ pipelines into a _SLaM_ object.

The _SLaM_ object contains a number of methods used in the make_pipeline functions which are used to compose the model 
based on the input values. It also handles pipeline tagging and path structure.
"""

slam = al.SLaM(
    path_prefix=f"{dataset_label}_bspline_clean/{data_name}",
    redshift_lens=info["redshift_lens"],
    redshift_source=info["redshift_source"],
    setup_hyper=hyper,
    pipeline_source_parametric=pipeline_source_parametric,
    pipeline_source_inversion=pipeline_source_inversion,
    pipeline_mass=pipeline_mass,
)

# %%
"""
__PIPELINE CREATION__

We import and make pipelines as per usual, albeit we'll now be doing this for multiple pipelines!

We then add the pipelines together and run this summed pipeline, which runs each individual pipeline back-to-back.
"""

# %%
Ejemplo n.º 5
0
setup_mass = al.SetupMassLightDark(with_shear=True)

pipeline_mass = al.SLaMPipelineMass(setup_mass=setup_mass)
"""
__SLaM__

We combine all of the above `SLaM` pipelines into a `SLaM` object.

The `SLaM` object contains a number of methods used in the make_pipeline functions which are used to compose the model 
based on the input values. It also handles pipeline tagging and path structure.
"""

slam = al.SLaM(
    path_prefix=f"slam/{dataset_name}",
    setup_hyper=hyper,
    pipeline_source_parametric=pipeline_source_parametric,
    pipeline_source_inversion=pipeline_source_inversion,
    pipeline_light_parametric=pipeline_light,
    pipeline_mass=pipeline_mass,
)

"""
__PIPELINE CREATION__

We import and make pipelines as per usual, albeit we'll now be doing this for multiple pipelines!

We then add the pipelines together and run this summed pipeline, which runs each individual pipeline back-to-back.
"""

from pipelines import source__parametric
from pipelines import source__inversion
from pipelines import light__parametric
Ejemplo n.º 6
0
setup_mass = al.SetupMassTotal(mass_prior_model=al.mp.EllipticalIsothermal,
                               with_shear=True)

pipeline_mass = al.SLaMPipelineMass(setup_mass=setup_mass)
"""
__SLaM__

We combine all of the above `SLaM` pipelines into a `SLaM` object.

The `SLaM` object contains a number of methods used in the make_pipeline functions which are used to compose the model 
based on the input values. It also handles pipeline tagging and path structure.
"""

slam = al.SLaM(
    path_prefix=path.join("slam", dataset_name),
    setup_hyper=hyper,
    pipeline_source_parametric=pipeline_source_parametric,
    pipeline_mass=pipeline_mass,
)
"""
__PIPELINE CREATION__

We import and make pipelines as per usual, albeit we'll now be doing this for multiple pipelines!

We then run each pipeline, passing the results of previous pipelines to subsequent pipelines.
"""

from slam.interferometer.pipelines import source__parametric
from slam.interferometer.pipelines import mass__total

source__parametric = source__parametric.make_pipeline(
    slam=slam, settings=settings, real_space_mask=real_space_mask)
"""

setup_subhalo = al.SetupSubhalo(source_is_model=False, number_of_steps=2)
"""
__SLaM__

We combine all of the above `SLaM` pipelines into a `SLaM` object.

The `SLaM` object contains a number of methods used in the make_pipeline functions which are used to compose the model 
based on the input values. It also handles pipeline tagging and path structure.
"""

slam = al.SLaM(
    path_prefix=path.join("slam", dataset_name),
    setup_hyper=hyper,
    pipeline_source_parametric=pipeline_source_parametric,
    pipeline_source_inversion=pipeline_source_inversion,
    pipeline_mass=pipeline_mass,
    setup_subhalo=setup_subhalo,
)
"""
__PIPELINE CREATION__

We import and make pipelines as per usual, albeit we'll now be doing this for multiple pipelines!

We then run each pipeline, passing the results of previous pipelines to subsequent pipelines.
"""

from slam.imaging.no_lens_light.pipelines import source__parametric
from slam.imaging.no_lens_light.pipelines import source__inversion
from slam.imaging.no_lens_light.pipelines import mass__total
from slam.imaging.no_lens_light.pipelines import subhalo
Ejemplo n.º 8
0
setup_subhalo = al.SetupSubhalo(mass_is_model=True,
                                source_is_model=True,
                                grid_size=5)
"""
__SLaM__

We combine all of the above `SLaM` pipelines into a `SLaM` object.

The `SLaM` object contains a number of methods used in the make_pipeline functions which are used to compose the model 
based on the input values. It also handles pipeline tagging and path structure.
"""

slam = al.SLaM(
    path_prefix=f"slam/{dataset_name}",
    setup_hyper=hyper,
    pipeline_source_parametric=pipeline_source_parametric,
    pipeline_mass=pipeline_mass,
    setup_subhalo=setup_subhalo,
)
"""
__PIPELINE CREATION__

We import and make pipelines as per usual, albeit we'll now be doing this for multiple pipelines!

We then add the pipelines together and run this summed pipeline, which runs each individual pipeline back-to-back.
"""

from pipelines import source__parametric
from pipelines import mass__total
from pipelines import subhalo