コード例 #1
0
def run(
    module,
    test_name=None,
    optimizer_class=af.MultiNest,
    config_folder="config",
    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/"
    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_data = simulation_util.load_test_imaging_data(
        data_type=module.data_type, data_resolution=module.data_resolution
    )

    module.make_pipeline(
        name=test_name,
        phase_folders=[module.test_type, test_name],
        optimizer_class=optimizer_class,
    ).run(data=imaging_data, positions=positions)
コード例 #2
0
sub_size = 2
inner_radius_arcsec = 0.2
outer_radius_arcsec = 4.0

print("sub grid size = " + str(sub_size))
print("annular inner mask radius = " + str(inner_radius_arcsec) + "\n")
print("annular outer mask radius = " + str(outer_radius_arcsec) + "\n")

for data_resolution in ["HST_Up"]:

    print()

    imaging_data = simulation_util.load_test_imaging_data(
        data_type="lens_mass__source_smooth",
        data_resolution=data_resolution,
        psf_shape=(3, 3),
    )
    mask = al.Mask.circular_annular(
        shape=imaging_data.shape,
        pixel_scale=imaging_data.pixel_scale,
        inner_radius_arcsec=inner_radius_arcsec,
        outer_radius_arcsec=outer_radius_arcsec,
    )
    lens_data = al.LensData(imaging_data=imaging_data,
                            mask=mask,
                            sub_size=sub_size)

    print("Deflection angle run times for image type " + data_resolution +
          "\n")
    print("Number of points = " + str(lens_data.grid.shape[0]) + "\n")
コード例 #3
0
from autolens.array import mask as msk
from test.simulation import simulation_util
from autolens.plotters import array_plotters

# 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_data = simulation_util.load_test_imaging_data(
    data_type="lens_light_dev_vaucouleurs", data_resolution="LSST")
array = imaging_data.image

mask = al.Mask.circular(
    shape=imaging_data.shape,
    pixel_scale=imaging_data.pixel_scale,
    radius_arcsec=5.0,
    centre=(0.0, 0.0),
)
array_plotters.plot_array(
    array=array,
    mask=mask,
    positions=[[[1.0, 1.0]]],
    centres=[[(0.0, 0.0)]],
    zoom_around_mask=True,
    extract_array_from_mask=True,
)

imaging_data = simulation_util.load_test_imaging_data(
    data_type="lens_sis__source_smooth__offset_centre", data_resolution="LSST")
array = imaging_data.image
コード例 #4
0
from autolens.lens.plotters import lens_imaging_fit_plotters
from test.simulation import simulation_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_data = simulation_util.load_test_imaging_data(
    data_type="lens_light_dev_vaucouleurs", data_resolution="LSST"
)
mask = al.Mask.circular(
    shape=imaging_data.shape, pixel_scale=imaging_data.pixel_scale, radius_arcsec=3.0
)

# The lines of code below do everything we're used to, that is, setup an image and its al.ogrid, mask it, trace it
# via a tracer, setup the rectangular mapper, etc.
lens_galaxy = al.Galaxy(
    bulge=al.EllipticalDevVaucouleurs(
        centre=(0.0, 0.0), axis_ratio=0.9, phi=45.0, intensity=0.1, effective_radius=1.0
    )
)

lens_data = al.LensData(imaging_data=imaging_data, mask=mask)

tracer = al.Tracer.from_galaxies(galaxies=[lens_galaxy])
fit = al.LensImageFit.from_lens_data_and_tracer(lens_data=lens_data, tracer=tracer)
lens_imaging_fit_plotters.plot_fit_subplot(
    fit=fit, should_plot_mask=True, extract_array_from_mask=True, zoom_around_mask=True
)
コード例 #5
0
# It is convinient to specify the lens name as a string, so that if the pipeline is applied to multiple images we \
# don't have to change all of the path entries in the load_imaging_data_from_fits function below.
data_type = "no_lens_source_smooth"
data_resolution = "Euclid"

# Setup the size of the sub-grid and mask used for this precision analysis.
sub_size = 2
inner_radius_arcsec = 0.0
outer_radius_arcsec = 3.0

# The pixel scale of the interpolation grid, where a smaller pixel scale gives a higher resolution grid and therefore
# more precise interpolation of the sub-grid deflection angles.
pixel_scale_interpolation_grid = 0.2

imaging_data = simulation_util.load_test_imaging_data(
    data_type=data_type, data_resolution=data_resolution, psf_shape=(21, 21))

# The phase is passed the mask we setup below using the radii specified above.
mask = al.Mask.circular_annular(
    shape=imaging_data.shape,
    pixel_scale=imaging_data.pixel_scale,
    inner_radius_arcsec=inner_radius_arcsec,
    outer_radius_arcsec=outer_radius_arcsec,
)

# Plot the Imaging data_type and mask.
imaging_plotters.plot_imaging_subplot(imaging_data=imaging_data, mask=mask)

# To perform the analysis, we set up a phase using the 'phase' module (imported as 'ph').
# A phase takes our galaxy models and fits their parameters using a non-linear search (in this case, MultiNest).
phase = al.PhaseImaging(