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]")
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
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
A full description of all options can be found ? and ?. The model used to represent the lens galaxy's mass is input into _SLaMPipelineMassTotal_ and this runner uses the default of an _EllipticalPowerLaw_ in this example. For this runner the _SLaMPipelineMass_ customizes: - The _MassProfile_ fitted by the pipeline. - If there is an _ExternalShear_ in the mass model or not. """ setup_mass = al.SetupMassTotal(mass_prior_model=al.mp.EllipticalPowerLaw, with_shear=False) 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"{dataset_label}_bspline_clean/{data_name}", redshift_lens=info["redshift_lens"], redshift_source=info["redshift_source"],
For this runner the `SLaMPipelineMass` customizes: - If there is an `ExternalShear` in the mass model or not. """ setup_mass = al.SetupMassLightDark( bulge_prior_model=al.lmp.EllipticalSersic, disk_prior_model=al.lmp.EllipticalExponential, envelope_prior_model=None, with_shear=True, ) setup_smbh = al.SetupSMBH(smbh_centre_fixed=True) pipeline_mass = al.SLaMPipelineMass(setup_mass=setup_mass, setup_smbh=setup_smbh) """ __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_light_parametric=pipeline_light,
A full description of all options can be found ? and ?. The model used to represent the lens `Galaxy`'s mass is input into `SLaMPipelineMassTotal` and this runner uses the default of an `EllipticalPowerLaw` in this example. For this runner the `SLaMPipelineMass` customizes: - The `MassProfile` fitted by the pipeline. - If there is an `ExternalShear` in the mass model or not (this lens was not simulated with shear and we do not include it in the mass model). """ setup_mass = al.SetupMassTotal(mass_prior_model=al.mp.EllipticalPowerLaw) pipeline_mass = al.SLaMPipelineMass(setup_mass=setup_mass, light_is_model=False) """ __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_light_parametric=pipeline_light, pipeline_mass=pipeline_mass,
def test__shear_from_previous_pipeline(self): setup_mass = al.SetupMassTotal(with_shear=False) pipeline_mass = al.SLaMPipelineMass(setup_mass=setup_mass) assert pipeline_mass.shear_from_result(result=None) == None
def test__light_is_model_tag(self): pipeline_mass = al.SLaMPipelineMass(light_is_model=False) assert pipeline_mass.light_is_model_tag == "__light_is_instance" pipeline_mass = al.SLaMPipelineMass(light_is_model=True) assert pipeline_mass.light_is_model_tag == "__light_is_model"