Ejemplo n.º 1
0
V = lambda x, y: np.array([x, y], dtype=np.double)

renderers.setDefaultLensPlaneRenderer(
    "threads")  # threads, mpi, opencl, None or a Renderer object
renderers.setDefaultMassRenderer(
    "threads")  # threads, mpi, None, or a Renderer object
inversion.setDefaultInverter("threads")  # threads, mpi or an Inverter object
plotutil.setDefaultAngularUnit(ANGLE_ARCSEC)

z_lens = 0.4
iws = inversion.InversionWorkSpace(z_lens,
                                   250 * ANGLE_ARCSEC,
                                   cosmology=Cosmology(0.7, 0.27, 0, 0.73))

imgList = images.readInputImagesFile("inputpoints.txt", True)
null = images.ImagesData.load("null.imgdata")

for i in imgList:
    iws.addImageDataToList(i["imgdata"], i["z"], "pointimages")
    iws.addImageDataToList(null, i["z"], "pointnullgrid")

iws.setDefaultInversionArguments(gridSizeFactor=1.3, sheetSearch="genome")

# For a quick test to see if all code executes
# iws.setDefaultInversionArguments(maximumGenerations = 10, gridSizeFactor = 1.3, sheetSearch = "genome")

iws.setUniformGrid(15)
lens1, fitness, fitdesc = iws.invert(512)
lens1.save("inv1_null.lensdata")
Ejemplo n.º 2
0
-60.06804983	14.08154015
37.96515147	68.83852853

-64.12416086	-82.79545034	3.2336
36.2571622	13.72493334
39.32244461	15.59162438
"""

z_lens = 0.4

for useWeights in [False, True]:
    iws = inversion.InversionWorkSpace(z_lens,
                                       250 * ANGLE_ARCSEC,
                                       cosmology=Cosmology(0.7, 0.27, 0, 0.73))

    imgList = images.readInputImagesFile(pointData, True)
    for i in imgList:
        iws.addImageDataToList(i["imgdata"], i["z"], "pointimages")

    iws.setUniformGrid(15)
    if showPlots:
        plotutil.plotSubdivisionGrid(iws.getGrid())
        plt.show()
    lens1, fitness1, fitdesc = iws.invert(popSize,
                                          maximumGenerations=maxGen,
                                          rescaleBasisFunctions=useWeights,
                                          basisFunctionType=basisFunctionType)

    iws.setSubdivisionGrid(lens1, 300, 400)
    if showPlots:
        plotutil.plotSubdivisionGrid(iws.getGrid())
Ejemplo n.º 3
0
z_lens = 0.4
cosm = cosmology.Cosmology(0.7, 0.27, 0, 0.73)
cosmology.setDefaultCosmology(cosm)

strongSize = 200 * ANGLE_ARCSEC
weakSize = 30 * ANGLE_ARCMIN
weakSubDiv = 48
weakThreshold = 0.1  # Threshold for |1-kappa|
sheetType = "nosheet"  # or "genome"

iws = inversion.InversionWorkSpace(z_lens, strongSize)

# Add the SL data
# Note: not using null space
for i in images.readInputImagesFile("images.txt", True):
    iws.addImageDataToList(i["imgdata"], i["z"], "pointimages")

iws.addImageDataToList(images.ImagesData.load("ellipt_48x48_exact_z1.imgdata"),
                       1, "sheardata", {"threshold": weakThreshold})
iws.addImageDataToList(images.ImagesData.load("ellipt_48x48_exact_z2.imgdata"),
                       2, "sheardata", {"threshold": weakThreshold})
iws.addImageDataToList(images.ImagesData.load("ellipt_48x48_exact_z4.imgdata"),
                       4, "sheardata", {"threshold": weakThreshold})

iws.setDefaultInversionArguments(
    sheetSearch=sheetType
)  # add maximumGenerations = 2 to test if script works

# This is something that can be used below:
# The genomes will only describe the mass in each basisfunction up to a scale