Пример #1
0
def run(
    module,
    test_name=None,
    non_linear_class=af.MultiNest,
    config_folder="config",
    mask=None,
    positions=None,
):
    test_name = test_name or module.test_name
    test_path = "{}/../../".format(os.path.dirname(os.path.realpath(__file__)))
    output_path = test_path + "output/imaging/"
    config_path = test_path + config_folder
    af.conf.instance = af.conf.Config(config_path=config_path,
                                      output_path=output_path)
    integration_util.reset_paths(test_name=test_name, output_path=output_path)

    imaging = simulate_util.load_test_imaging(
        data_type=module.data_type,
        data_resolution=module.data_resolution,
        name="test_dataset",
        metadata={"test": 2},
    )

    if mask is None:
        mask = aa.Mask.circular(shape_2d=imaging.shape_2d,
                                pixel_scales=imaging.pixel_scales,
                                radius=3.0)

    module.make_pipeline(
        name=test_name,
        phase_folders=[module.test_type, test_name],
        non_linear_class=non_linear_class,
    ).run(dataset=imaging, mask=mask, positions=positions)
Пример #2
0
import autolens as al

from test_autolens.simulate.imaging import simulate_util

# In this tutorial, we'll introduce a new pixelization, called an adaptive-pixelization. This pixelization doesn't use
# uniform grid of rectangular pixels, but instead uses ir'Voronoi' pixels. So, why would we want to do that?
# Lets take another look at the rectangular grid, and think about its weakness.

# Lets quickly remind ourselves of the image, and the 3.0" circular mask we'll use to mask it.
imaging = simulate_util.load_test_imaging(data_type="lens_sis__source_smooth",
                                          data_resolution="hst")
mask = al.Mask.circular(
    shape_2d=imaging.shape_2d,
    pixel_scales=imaging.pixel_scales,
    radius=3.0,
    centre=(0.0, 0.0),
)

lens_galaxy = al.Galaxy(redshift=0.5,
                        mass=al.mp.SphericalIsothermal(centre=(0.0, 0.0),
                                                       einstein_radius=1.6))

source_galaxy = al.Galaxy(
    redshift=1.0,
    pixelization=al.pix.Rectangular(shape=(20, 20)),
    regularization=al.reg.Constant(coefficient=1.0),
)

masked_imaging = al.MaskedImaging(imaging=imaging, mask=mask)

tracer = al.Tracer.from_galaxies(galaxies=[lens_galaxy, source_galaxy])
Пример #3
0
import autolens as al
import autolens.plot as aplt

from test_autolens.simulate.imaging import simulate_util

# In this tutorial, we'll introduce a new pixelization, called an adaptive-pixelization. This pixelization doesn't use
# uniform grid of rectangular pixels, but instead uses ir'Voronoi' pixels. So, why would we want to do that?
# Lets take another look at the rectangular grid, and think about its weakness.

# Lets quickly remind ourselves of the image, and the 3.0" circular mask we'll use to mask it.
imaging = simulate_util.load_test_imaging(
    data_type="lens_mass__source_cuspy", data_resolution="hst"
)
mask = al.mask.circular(
    shape_2d=imaging.shape_2d,
    pixel_scales=imaging.pixel_scales,
    radius=3.0,
    centre=(0.0, 0.0),
    sub_size=4,
)

lens_galaxy = al.Galaxy(
    redshift=0.5, mass=al.mp.SphericalIsothermal(centre=(0.1, 0.2), einstein_radius=1.5)
)

source_galaxy = al.Galaxy(
    redshift=1.0,
    pixelization=al.pix.VoronoiMagnification(shape=(20, 20)),
    regularization=al.reg.Constant(coefficient=1.0),
)
import autolens as al

from test_autolens.simulate.imaging import simulate_util

imaging = simulate_util.load_test_imaging(
    data_type="lens_sie__source_smooth__offset_centre", data_resolution="lsst")


def fit_with_offset_centre(centre):

    mask = al.Mask.elliptical(
        shape_2d=imaging.shape_2d,
        pixel_scales=imaging.pixel_scales,
        major_axis_radius=3.0,
        axis_ratio=1.0,
        phi=0.0,
        centre=centre,
    )

    # The lines of code below do everything we're used to, that is, setup an image and its grid, mask it, trace it
    # via a tracer, setup the rectangular mapper, etc.
    lens_galaxy = al.Galaxy(
        redshift=0.5,
        mass=al.mp.EllipticalIsothermal(centre=(2.0, 2.0),
                                        einstein_radius=1.2,
                                        axis_ratio=0.7,
                                        phi=45.0),
    )
    source_galaxy = al.Galaxy(
        redshift=1.0,
        pixelization=al.pix.VoronoiMagnification(shape=(20, 20)),