Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)
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)
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)
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, results):
### Lens Mass, PL -> PL, Shear -> Shear ###
self.lens_galaxies.lens = results.from_phase('phase_1_lens_pl_shear_source_sersic').constant.lens
### Lens Subhalo, Adjust priors to physical masses (10^6 - 10^10) and concentrations (6-24)
self.lens_galaxies.subhalo.mass.kappa_s = prior.UniformPrior(lower_limit=0.0001, upper_limit=0.1)
self.lens_galaxies.subhalo.mass.scale_radius = prior.UniformPrior(lower_limit=0.0, upper_limit=5.0)
self.lens_galaxies.subhalo.mass.centre_0 = prior.UniformPrior(lower_limit=-2.0, upper_limit=2.0)
self.lens_galaxies.subhalo.mass.centre_1 = prior.UniformPrior(lower_limit=-2.0, upper_limit=2.0)
### Source Light, Sersic -> Sersic ###
self.source_galaxies.source.light.centre = \
results.from_phase('phase_1_lens_pl_shear_source_sersic').variable_absolute(a=0.3).source.light.centre
self.source_galaxies.source.light.intensity = \
results.from_phase('phase_1_lens_pl_shear_source_sersic').variable.source.light.intensity
self.source_galaxies.source.light.effective_radius = \
results.from_phase('phase_1_lens_pl_shear_source_sersic').variable.source.light.effective_radius
self.source_galaxies.source.light.sersic_index = \
results.from_phase('phase_1_lens_pl_shear_source_sersic').variable.source.light.sersic_index
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.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)
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)
# 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)