def pass_priors(self, previous_results):

            phase_1_results = previous_results[0]
            phase_2_results = previous_results[1]
            phase_3_results = previous_results[2]

            # Results are split over multiple phases, so we setup the light and mass profiles of each lens separately.

            self.lens_galaxies.left_lens.light = phase_1_results.variable.left_lens.light
            self.lens_galaxies.left_lens.mass = phase_3_results.variable.left_lens.mass
            self.lens_galaxies.right_lens.light = phase_2_results.variable.right_lens.light
            self.lens_galaxies.right_lens.mass = phase_3_results.variable.right_lens.mass

            # When we pass a a 'variable' galaxy from a previous phase, parameters fixed to constants remain constant.
            # Because centre_0 and centre_1 of the mass profile were fixed to constants in phase 3, they're still
            # constants after the line after. We need to therefore manually over-ride their priors.

            self.lens_galaxies.left_lens.mass.centre_0 = phase_3_results.variable.left_lens.mass.centre_0
            self.lens_galaxies.left_lens.mass.centre_1 = phase_3_results.variable.left_lens.mass.centre_1
            self.lens_galaxies.right_lens.mass.centre_0 = phase_3_results.variable.right_lens.mass.centre_0
            self.lens_galaxies.right_lens.mass.centre_1 = phase_3_results.variable.right_lens.mass.centre_1

            # We also want the Sersic index's to be free parameters now, so lets change it from a constant to a
            # variable.

            self.lens_galaxies.left_lens.light.sersic_index = prior.GaussianPrior(
                mean=4.0, sigma=2.0)
            self.lens_galaxies.right_lens.light.sersic_index = prior.GaussianPrior(
                mean=4.0, sigma=2.0)

            # Things are much simpler for the source galaxies - just like them togerther!

            self.source_galaxies.source = phase_3_results.variable.source
        def pass_priors(self, previous_results):

            self.lens_galaxies.right_lens.light.centre_0 = prior.GaussianPrior(
                mean=0.0, sigma=0.05)
            self.lens_galaxies.right_lens.light.centre_1 = prior.GaussianPrior(
                mean=1.0, sigma=0.05)
            self.lens_galaxies.right_lens.light.sersic_index = 4.0
        def pass_priors(self, previous_results):

            # Lets restrict the prior's on the centres around the pixel we know the galaxy's light centre peaks.

            self.lens_galaxies.left_lens.light.centre_0 = prior.GaussianPrior(
                mean=0.0, sigma=0.05)
            self.lens_galaxies.left_lens.light.centre_1 = prior.GaussianPrior(
                mean=-1.0, sigma=0.05)

            # Given we are only fitting the very central region of the lens galaxy, we don't want to let a parameter
            # like th Sersic index vary. Lets fix it to 4.0.

            self.lens_galaxies.left_lens.light.sersic_index = 4.0
    def pass_priors(self, previous_results):

        # You may wish to fix the first galaxy to its true centre / einstein radius

        #  self.galaxies.lens.mass.centre_0 = 0.0
        #  self.galaxies.lens.mass.centre_1 = 0.0
        #  self.galaxies.lens.mass.einstein_radius = 1.0

        # Adjusting the priors on the centre of galaxies away from (0.0", 0.0") is also a good idea.

        self.galaxies.subhalo.mass.centre_0 = prior.GaussianPrior(mean=0.5,
                                                                  sigma=0.3)
        self.galaxies.subhalo.mass.centre_1 = prior.GaussianPrior(mean=0.5,
                                                                  sigma=0.3)
    def pass_priors(self, previous_results):

        # To change priors, we use the 'prior' module of PyAutoFit. These priors link our GalaxyModel to the
        # non-linear search. Thus, it tells PyAutoLens where to search non-linear parameter space.

        # These two lines change the centre of the lens galaxy's mass-profile to UniformPriors around the coordinates
        # (-0.1", 0.1"). For real lens modeling, this might be done by visually inspecting the centre of emission of
        # the lens galaxy's light.

        # The term 'lens_galaxy' refers to the name of the galaxy that we give it below (scroll down cell [5].
        # By naming galaxies in this way, we can easily keep track of how to pass their priors).

        # The word 'mass' corresponds to the word we used when setting up the GalaxyModel above.

        self.lens_galaxies.lens_galaxy.mass.centre_0 = prior.UniformPrior(
            lower_limit=-0.1, upper_limit=0.1)
        self.lens_galaxies.lens_galaxy.mass.centre_1 = prior.UniformPrior(
            lower_limit=-0.1, upper_limit=0.1)

        # Lets also change the prior on the lens galaxy's einstein radius, to a GaussianPrior centred on 1.4".
        # For real lens modeling, this might be done by visually estimating the radius the lens's arcs / ring appear.

        self.lens_galaxies.lens_galaxy.mass.einstein_radius = prior.GaussianPrior(
            mean=1.4, sigma=0.2)

        # We can also customize the source galaxy - lets say we believe it is compact and limit its effective radius

        self.source_galaxies.source_galaxy.light.effective_radius = prior.UniformPrior(
            lower_limit=0.0, upper_limit=0.3)
Beispiel #6
0
        def pass_priors(self, previous_results):

            self.lens_galaxies.lens.mass.centre_0 = 0.0
            self.lens_galaxies.lens.mass.centre_1 = 0.0
            self.lens_galaxies.lens.mass.einstein_radius = 1.6

            self.source_galaxies.source.pixelization.shape_0 = 8.0
            self.source_galaxies.source.pixelization.shape_1 = 8.0
            self.source_galaxies.source.regularization.coefficients_0 = 1.0

            self.sensitive_galaxies.subhalo.mass.centre_0 = prior.GaussianPrior(
                mean=0.0, sigma=1.0)
            self.sensitive_galaxies.subhalo.mass.centre_1 = prior.GaussianPrior(
                mean=0.0, sigma=1.0)
            self.sensitive_galaxies.subhalo.mass.kappa_s = 0.1
            self.sensitive_galaxies.subhalo.mass.scale_radius = 5.0
Beispiel #7
0
        def pass_priors(self, previous_results):

            self.lens_galaxies.lens.mass.centre_0 = 0.0
            self.lens_galaxies.lens.mass.centre_1 = 0.0
            self.lens_galaxies.lens.mass.einstein_radius = 1.6

            self.source_galaxies.source.light.centre_0 = 0.0
            self.source_galaxies.source.light.centre_1 = 0.0
            self.source_galaxies.source.light.intensity = 1.0
            self.source_galaxies.source.light.effective_radius = 0.5
            self.source_galaxies.source.light.sersic_index = 1.0

            self.sensitive_galaxies.subhalo.mass.centre_0 = prior.GaussianPrior(
                mean=0.0, sigma=1.0)
            self.sensitive_galaxies.subhalo.mass.centre_1 = prior.GaussianPrior(
                mean=0.0, sigma=1.0)
            self.sensitive_galaxies.subhalo.mass.kappa_s = 0.1
            self.sensitive_galaxies.subhalo.mass.scale_radius = 5.0
Beispiel #8
0
    def pass_priors(self, previous_results):

        # We've called our lens galaxy 'lens' this time, for shorter more readable code.

        # By default, the prior on the (y,x) coordinates of a light / mass profile is a GaussianPrior with mean
        # 0.0" and sigma "1.0. However, visual inspection of our strong lens image tells us that its clearly around
        # x = 0.0" and y = 0.0", so lets reduce where non-linear search looks for these parameters.

        self.lens_galaxies.lens.light.centre_0 = prior.UniformPrior(
            lower_limit=-0.05, upper_limit=0.05)
        self.lens_galaxies.lens.light.centre_1 = prior.UniformPrior(
            lower_limit=-0.05, upper_limit=0.05)
        self.lens_galaxies.lens.mass.centre_0 = prior.UniformPrior(
            lower_limit=-0.05, upper_limit=0.05)
        self.lens_galaxies.lens.mass.centre_1 = prior.UniformPrior(
            lower_limit=-0.05, upper_limit=0.05)

        # By default, the axis-ratio (ellipticity) of our lens galaxy's light profile is a UniformPrior between 0.2 and
        # 1.0. However, by looking at the image it looks fairly circular, so lets use a GaussianPrior nearer 1.0.
        self.lens_galaxies.lens.light.axis_ratio = prior.GaussianPrior(
            mean=0.8, sigma=0.15)

        # We'll also assume that the light profile's axis_ratio informs us of the mass-profile's axis_ratio, but
        # because this may not strictly be true (e.g. because of dark matter) we'll use a wider prior.
        self.lens_galaxies.lens.mass.axis_ratio = prior.GaussianPrior(
            mean=0.8, sigma=0.25)

        # By default, the orientation of the galaxy's light profile, phi, uses a UniformPrior between 0.0 and
        # 180.0 degrees. However, if you look really close at the image (and maybe adjust the color-map of the plot),
        # you'll be able to notice that it is elliptical and that it is oriented around 45.0 degrees counter-clockwise
        # from the x-axis. Lets update our prior
        self.lens_galaxies.lens.light.phi = prior.GaussianPrior(mean=45.0,
                                                                sigma=15.0)

        # Again, lets kind of assume that the light's orientation roughly traces that of mass.
        self.lens_galaxies.lens.mass.phi = prior.GaussianPrior(mean=45.0,
                                                               sigma=30.0)

        # The effective radius of a light profile is its 'half-light' radius, the radius at which 50% of its
        # total luminosity is internal to a circle defined within that radius. PyAutoLens assumes a
        # UniformPrior on this quantity between 0.0" and 4.0", but inspection of the image (again, using a colormap
        # scaling) shows the lens's light doesn't extend anywhere near 4.0", so lets reduce it.
        self.lens_galaxies.lens.light.effective_radius = prior.GaussianPrior(
            mean=0.5, sigma=0.8)

        # Typically, we have some knowledge of what morphology our lens galaxy is. Infact, most strong lenses are
        # massive elliptical galaxies, and anyone who studies galaxy morphology will tell you these galaxies have a
        # Sersic index near 4. So lets change our Sersic index from a UniformPrior between 0.8 and 8.0 to reflect this.
        self.lens_galaxies.lens.light.sersic_index = prior.GaussianPrior(
            mean=4.0, sigma=1.0)

        # Finally, the 'ring' that the lensed source forms clearly has a radius of about 0.8". This is its Einstein
        # radius, so lets change the prior from a UniformPrior between 0.0" and 4.0".
        self.lens_galaxies.lens.mass.einstein_radius = prior.GaussianPrior(
            mean=0.8, sigma=0.2)
Beispiel #9
0
        def pass_priors(self, previous_results):

            self.lens_galaxies.lens.light.centre_0 = prior.GaussianPrior(
                mean=0.0, sigma=0.1)
            self.lens_galaxies.lens.light.centre_1 = prior.GaussianPrior(
                mean=0.0, sigma=0.1)
            self.lens_galaxies.los0.light.centre_0 = prior.GaussianPrior(
                mean=4.0, sigma=0.1)
            self.lens_galaxies.los0.light.centre_1 = prior.GaussianPrior(
                mean=4.0, sigma=0.1)
            self.lens_galaxies.los1.light.centre_0 = prior.GaussianPrior(
                mean=3.6, sigma=0.1)
            self.lens_galaxies.los1.light.centre_1 = prior.GaussianPrior(
                mean=-5.3, sigma=0.1)
            self.lens_galaxies.los2.light.centre_0 = prior.GaussianPrior(
                mean=-3.1, sigma=0.1)
            self.lens_galaxies.los2.light.centre_1 = prior.GaussianPrior(
                mean=-2.4, sigma=0.1)
    def pass_priors(self, previous_results):

        # What I've done here is looked at the results of phase 1, and manually specified a prior for every parameter.
        # If a parameter was fixed in the previous phase, its prior is based around the previous value. Don't worry
        # about the sigma values for now, I've chosen values that I know will ensure reasonable sampling, but we'll
        # cover this later.

        self.lens_galaxies.lens.light.centre_0 = prior.GaussianPrior(mean=0.0, sigma=0.1)
        self.lens_galaxies.lens.light.centre_1 = prior.GaussianPrior(mean=0.0, sigma=0.1)
        self.lens_galaxies.lens.light.axis_ratio = prior.GaussianPrior(mean=0.8, sigma=0.15)
        self.lens_galaxies.lens.light.phi = prior.GaussianPrior(mean=45.0, sigma=15.0)
        self.lens_galaxies.lens.light.intensity = prior.GaussianPrior(mean=0.02, sigma=0.01)
        self.lens_galaxies.lens.light.effective_radius = prior.GaussianPrior(mean=0.62, sigma=0.2)
        self.lens_galaxies.lens.light.sersic_index = prior.GaussianPrior(mean=4.0, sigma=2.0)

        self.lens_galaxies.lens.mass.centre_0 = prior.GaussianPrior(mean=0.0, sigma=0.1)
        self.lens_galaxies.lens.mass.centre_1 = prior.GaussianPrior(mean=0.0, sigma=0.1)
        self.lens_galaxies.lens.mass.axis_ratio = prior.GaussianPrior(mean=0.8, sigma=0.25)
        self.lens_galaxies.lens.mass.phi = prior.GaussianPrior(mean=45.0, sigma=30.0)
        self.lens_galaxies.lens.mass.einstein_radius = prior.GaussianPrior(mean=0.8, sigma=0.1)

        self.source_galaxies.source.light.centre_0 = prior.GaussianPrior(mean=0.0, sigma=0.1)
        self.source_galaxies.source.light.centre_1 = prior.GaussianPrior(mean=0.0, sigma=0.1)
        self.source_galaxies.source.light.axis_ratio = prior.GaussianPrior(mean=0.8, sigma=0.1)
        self.source_galaxies.source.light.phi = prior.GaussianPrior(mean=90.0, sigma=10.0)
        self.source_galaxies.source.light.intensity = prior.GaussianPrior(mean=0.14, sigma=0.05)
        self.source_galaxies.source.light.effective_radius = prior.GaussianPrior(mean=0.12, sigma=0.2)
        def pass_priors(self, previous_results):

            self.lens_galaxies.lens.mass.centre_0 = prior.GaussianPrior(
                mean=0.0, sigma=0.1)
            self.lens_galaxies.lens.mass.centre_1 = prior.GaussianPrior(
                mean=0.0, sigma=0.1)