Example #1
0
def run(
    module, test_name=None, search=af.DynestyStatic(), config_folder="config", mask=None
):

    test_name = test_name or module.test_name
    test_path = "{}/../..".format(os.path.dirname(os.path.realpath(__file__)))
    output_path = f"{test_path}/output/imaging"
    config_path = f"{test_path}/{config_folder}"
    conf.instance = conf.Config(config_path=config_path, output_path=output_path)

    imaging = instrument_util.load_test_imaging(
        data_name=module.data_name, instrument=module.instrument
    )

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

    info = {"Test": 100}

    module.make_pipeline(
        name=test_name, folders=[module.test_type, test_name], search=search
    ).run(dataset=imaging, mask=mask, info=info)
import autolens as al
import autolens.plot as aplt
from test_autolens.simulators.imaging import instrument_util
import numpy as np

imaging = instrument_util.load_test_imaging(
    dataset_name="light_sersic__source_sersic", instrument="vro")

array = imaging.image

plotter = aplt.Plotter(
    figure=aplt.Figure(figsize=(10, 10)),
    cmap=aplt.ColorMap(cmap="gray",
                       norm="symmetric_log",
                       norm_min=-0.13,
                       norm_max=20,
                       linthresh=0.02),
    grid_scatterer=aplt.GridScatterer(marker="+", colors="cyan", size=450),
)

grid = al.GridIrregular(grid=[[1.0, 1.0], [2.0, 2.0], [3.0, 3.0]])

print(grid)

vector_field = al.VectorFieldIrregular(vectors=[(1.0, 2.0), (2.0, 1.0)],
                                       grid=[(-1.0, 0.0), (-2.0, 0.0)])

aplt.Array(
    array=array.in_2d,
    grid=grid,
    positions=al.GridIrregularGrouped([(0.0, 1.0), (0.0, 2.0)]),
Example #3
0
from autolens.plot.mat_wrap import plotter
from test_autolens.simulators.imaging import instrument_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 = instrument_util.load_test_imaging(
    dataset_name="light_sersic__source_sersic", instrument="vro")
array = imaging.image

mask = al.Mask2D.circular(
    shape_2d=imaging.shape_2d,
    pixel_scales=imaging.pixel_scales,
    radius=5.0,
    centre=(0.0, 0.0),
)
aplt.Array(array=array,
           mask=mask,
           positions=[[(1.0, 1.0)]],
           centres=[[(0.0, 0.0)]])

imaging = instrument_util.load_test_imaging(
    dataset_name="mass_sie__source_sersic__offset_centre", instrument="vro")
array = imaging.image

mask = al.Mask2D.circular(
    shape_2d=imaging.shape_2d,
    pixel_scales=imaging.pixel_scales,
    radius=5.0,
Example #4
0
        centre=(0.0, 0.0), einstein_radius=1.6, elliptical_comps=(0.17647, 0.0)
    ),
)

pixelization = al.pix.VoronoiBrightnessImage(pixels=pixels)

data_points_total = []
profiling_dict = {}
xticks_list = []
times_list = []
memory_use = []

for instrument in ["vro", "euclid", "hst", "hst_up"]:  # , 'ao']:

    imaging = instrument_util.load_test_imaging(
        data_name="lens_sie__source_smooth", instrument=instrument
    )

    mask = al.Mask.circular(
        shape_2d=imaging.shape_2d,
        pixel_scales=imaging.pixel_scales,
        sub_size=sub_size,
        radius=radius,
    )

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

    source_galaxy = al.Galaxy(
        redshift=1.0,
        pixelization=pixelization,
        regularization=al.reg.Constant(coefficient=1.0),
Example #5
0
                                    elliptical_comps=(0.17647, 0.0)),
)

pixelization = al.pix.Rectangular(shape=pixelization_shape_2d)

source_galaxy = al.Galaxy(
    redshift=1.0,
    pixelization=pixelization,
    regularization=al.reg.Constant(coefficient=1.0),
)

for instrument in ["vro", "euclid", "hst", "hst_up"]:  # , 'ao']:

    imaging = instrument_util.load_test_imaging(
        data_name="lens_sie__source_smooth",
        instrument=instrument,
        psf_shape_2d=psf_shape_2d,
    )

    mask = al.Mask.circular(
        shape_2d=imaging.shape_2d,
        pixel_scales=imaging.pixel_scales,
        sub_size=sub_size,
        radius=radius,
    )

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

    print("Rectangular Inversion fit run times for image type " + instrument +
          "\n")
    print("Number of points = " + str(masked_imaging.grid.sub_shape_1d) + "\n")