def test__grid_size_tag(self): setup = al.SetupSubhalo(number_of_steps=3) assert setup.grid_size_tag == "__grid_3" setup = al.SetupSubhalo(number_of_steps=4) assert setup.grid_size_tag == "__grid_4"
def test__grid_size_tag(self): setup = al.SetupSubhalo(grid_size=3) assert setup.grid_size_tag == "__grid_3" setup = al.SetupSubhalo(grid_size=4) assert setup.grid_size_tag == "__grid_4"
def test__source_is_model_tag(self): setup = al.SetupSubhalo(source_is_model=False) assert setup.source_is_model_tag == "__source_is_instance" setup = al.SetupSubhalo(source_is_model=True) assert setup.source_is_model_tag == "__source_is_model"
def test__subhalo_prior_model_and_tags(self): setup = al.SetupSubhalo() assert setup.subhalo_prior_model.cls is al.mp.SphericalNFWMCRLudlow assert setup.subhalo_prior_model_tag == "nfw_sph_ludlow" setup = al.SetupSubhalo( subhalo_prior_model=af.PriorModel(al.mp.EllipticalNFW)) assert setup.subhalo_prior_model.cls is al.mp.EllipticalNFW assert setup.subhalo_prior_model_tag == "nfw"
def test__subhalo_mass_at_200_tag(self): setup = al.SetupSubhalo(subhalo_instance=None) assert setup.subhalo_mass_at_200_tag == "" setup = al.SetupSubhalo(subhalo_instance=al.mp.SphericalNFWMCRLudlow( mass_at_200=1e8)) assert setup.subhalo_mass_at_200_tag == "__mass_1.0e+08" setup = al.SetupSubhalo(subhalo_instance=al.mp.SphericalNFWMCRLudlow( mass_at_200=1e9)) assert setup.subhalo_mass_at_200_tag == "__mass_1.0e+09" setup = al.SetupSubhalo(subhalo_instance=al.mp.SphericalNFWMCRLudlow( mass_at_200=1e10)) assert setup.subhalo_mass_at_200_tag == "__mass_1.0e+10"
def test__subhalo_centre_tag(self): setup = al.SetupSubhalo(subhalo_instance=None) assert setup.subhalo_centre_tag == "" setup = al.SetupSubhalo(subhalo_instance=al.mp.SphericalNFW( centre=(2.0, 2.0))) assert setup.subhalo_centre_tag == "__centre_(2.00,2.00)" setup = al.SetupSubhalo(subhalo_instance=al.mp.SphericalNFW( centre=(3.0, 4.0))) assert setup.subhalo_centre_tag == "__centre_(3.00,4.00)" setup = al.SetupSubhalo(subhalo_instance=al.mp.SphericalNFW( centre=(3.027, 4.033))) assert setup.subhalo_centre_tag == "__centre_(3.03,4.03)"
def test__tag(self): setup = al.SetupSubhalo(source_is_model=False) assert setup.tag == "subhalo[nfw_sph_ludlow__source_is_instance__grid_5]" setup = al.SetupSubhalo( source_is_model=True, number_of_steps=4, subhalo_instance=al.mp.SphericalNFWMCRLudlow(centre=(2.0, 2.0), mass_at_200=1e10), ) assert ( setup.tag == "subhalo[nfw_sph_ludlow__source_is_model__grid_4__centre_(2.00,2.00)__mass_1.0e+10]" )
def test__tag(self): hyper = al.SetupHyper( hyper_galaxies_lens=True, hyper_background_noise=al.hyper_data.HyperBackgroundNoise, hyper_image_sky=al.hyper_data.HyperImageSky, ) setup_mass = al.SetupMassLightDark(align_bulge_dark_centre=True) setup = al.SetupPipeline(setup_hyper=hyper, setup_mass=setup_mass) assert ( setup.tag == "setup__" "hyper[galaxies_lens__bg_sky__bg_noise]__" "mass[light_dark__bulge_sersic__disk_exp__mlr_free__dark_nfw_ludlow__with_shear__align_bulge_dark_centre]" ) setup_source = al.SetupSourceInversion( pixelization_prior_model=al.pix.Rectangular, regularization_prior_model=al.reg.Constant, ) setup_light = al.SetupLightParametric(light_centre=(1.0, 2.0)) setup_mass = al.SetupMassLightDark(mass_centre=(3.0, 4.0), with_shear=False) setup = al.SetupPipeline(setup_source=setup_source, setup_light=setup_light, setup_mass=setup_mass) assert ( setup.tag == "setup__" "light[parametric__bulge_sersic__disk_exp__align_bulge_disk_centre__centre_(1.00,2.00)]__" "mass[light_dark__bulge_sersic__disk_exp__mlr_free__dark_nfw_ludlow__no_shear__centre_(3.00,4.00)]__" "source[inversion__pix_rect__reg_const]") setup_mass = al.SetupMassLightDark(align_bulge_dark_centre=True) setup = al.SetupPipeline(setup_mass=setup_mass) assert ( setup.tag == "setup__" "mass[light_dark__bulge_sersic__disk_exp__mlr_free__dark_nfw_ludlow__with_shear__align_bulge_dark_centre]" ) smbh = al.SetupSMBH(smbh_centre_fixed=True) setup_subhalo = al.SetupSubhalo( subhalo_instance=al.mp.SphericalNFWMCRLudlow(centre=(1.0, 2.0), mass_at_200=1e8)) setup = al.SetupPipeline(setup_smbh=smbh, setup_subhalo=setup_subhalo) assert ( setup.tag == "setup__" "smbh[point_mass__centre_fixed]__" "subhalo[nfw_sph_ludlow__mass_is_model__source_is_model__grid_5__centre_(1.00,2.00)__mass_1.0e+08]" )
The final pipeline fits the lens and source model including a `SphericalNFW` subhalo, using a grid-search of non-linear searchesn. A full description of all options can be found ? and ?. The models used to represent the lens `Galaxy`'s mass and the source are those used in the previous pipelines. For this runner the `SetupSubhalo` customizes: - If the source galaxy (parametric or _Inversion) is treated as a model (all free parameters) or instance (all fixed) during the subhalo detection grid search. - The NxN size of the grid-search. """ 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,
The final pipeline fits the lens and source model including a `SphericalNFW` subhalo, using a grid-search of non-linear searchesn. A full description of all options can be found ? and ?. The models used to represent the lens `Galaxy`'s mass and the source are those used in the previous pipelines. For this runner the `SetupSubhalo` customizes: - If the source galaxy (parametric or _Inversion) is treated as a model (all free parameters) or instance (all fixed) during the subhalo detection grid search. - The NxN size of the grid-search. """ setup_subhalo = al.SetupSubhalo(source_is_model=True, number_of_steps=2, number_of_cores=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,
A full description of all options can be found ? and ?. The models used to represent the lens `Galaxy`'s mass and the source are those used in the previous pipelines. For this runner the `SetupSubhalo` customizes: - If the lens galaxy mass is treated as a model (all free parameters) or instance (all fixed) during the subhalo detection grid search. - If the source galaxy (parametric or _Inversion) is treated as a model (all free parameters) or instance (all fixed) during the subhalo detection grid search. - The NxN size of the grid-search. """ 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,