def rho_at_scale_radius_for_units( self, redshift_object, redshift_source, unit_length="arcsec", unit_mass="solMass", cosmology=cosmo.Planck15, ): """The Cosmic average density is defined at the redshift of the profile.""" kpc_per_arcsec = cosmology_util.kpc_per_arcsec_from_redshift_and_cosmology( redshift=redshift_object, cosmology=cosmology) critical_surface_density = cosmology_util.critical_surface_density_between_redshifts_from_redshifts_and_cosmology( redshift_0=redshift_object, redshift_1=redshift_source, cosmology=cosmology, unit_length=self.unit_length, unit_mass=unit_mass, ) rho_at_scale_radius = (self.kappa_s * critical_surface_density / self.scale_radius) rho_at_scale_radius = dim.MassOverLength3(value=rho_at_scale_radius, unit_length=self.unit_length, unit_mass=unit_mass) return rho_at_scale_radius.convert( unit_length=unit_length, unit_mass=unit_mass, kpc_per_arcsec=kpc_per_arcsec, critical_surface_density=critical_surface_density, )
def einstein_mass_in_units( self, redshift_object=None, redshift_source=None, cosmology=cosmo.Planck15, unit_mass="solMass", ): einstein_radius = self.einstein_radius_in_units() einstein_mass = dim.Mass(np.pi * (einstein_radius**2)) if unit_mass is "solMass": critical_surface_density = cosmology_util.critical_surface_density_between_redshifts_from_redshifts_and_cosmology( redshift_0=redshift_object, redshift_1=redshift_source, cosmology=cosmology, unit_length=self.unit_length, unit_mass=unit_mass, ) else: critical_surface_density = None return einstein_mass.convert( unit_mass=unit_mass, critical_surface_density=critical_surface_density)
def critical_surface_density_between_planes_in_units( self, i, j, unit_length="arcsec", unit_mass="solMass"): return cosmology_util.critical_surface_density_between_redshifts_from_redshifts_and_cosmology( redshift_0=self.plane_redshifts[i], redshift_1=self.plane_redshifts[j], cosmology=self.cosmology, unit_length=unit_length, unit_mass=unit_mass, )
def mass_at_200_for_units( self, redshift_object, redshift_source, unit_length="arcsec", unit_mass="solMass", redshift_of_cosmic_average_density="profile", cosmology=cosmo.Planck15, ): if redshift_of_cosmic_average_density is "profile": redshift_calc = redshift_object elif redshift_of_cosmic_average_density is "local": redshift_calc = 0.0 else: raise exc.UnitsException( "The redshift of the cosmic average density haas been specified as an invalid " "string. Must be (local | profile)") cosmic_average_density = cosmology_util.cosmic_average_density_from_redshift_and_cosmology( redshift=redshift_calc, cosmology=cosmology, unit_length=unit_length, unit_mass=unit_mass, ) critical_surface_density = cosmology_util.critical_surface_density_between_redshifts_from_redshifts_and_cosmology( redshift_0=redshift_object, redshift_1=redshift_source, cosmology=cosmology, unit_length=self.unit_length, unit_mass=unit_mass, ) radius_at_200 = self.radius_at_200_for_units( redshift_object=redshift_object, redshift_source=redshift_source, unit_length=unit_length, unit_mass=unit_mass, redshift_of_cosmic_average_density= redshift_of_cosmic_average_density, cosmology=cosmology, ) mass_at_200 = dim.Mass( 200.0 * ((4.0 / 3.0) * np.pi) * cosmic_average_density * (radius_at_200**3.0), unit_mass=unit_mass, ) return mass_at_200.convert( unit_mass=unit_mass, critical_surface_density=critical_surface_density)
for i in range(len(lens)): ## creating galaxies in autolens from autolens model results lens_galaxy = al.Galaxy( mass=al.mp.EllipticalIsothermal( centre=(results.loc[lens[i]]['param']['centre_0'], results.loc[lens[i]]['param']['centre_1']), axis_ratio=results.loc[lens[i]]['param']['axis_ratio'], phi=results.loc[lens[i]]['param']['phi'], einstein_radius=results.loc[lens[i]]['param']['einstein_radius']), redshift = slacs['z_lens'][i] ) einstein_radius = lens_galaxy.einstein_radius_in_units(unit_length='arcsec') einstein_mass = lens_galaxy.einstein_mass_in_units(redshift_object=lens_galaxy.redshift, redshift_source=slacs['z_source'][i], cosmology=cosmo, unit_mass='solMass' ) sigma_crit = cosmology_util.critical_surface_density_between_redshifts_from_redshifts_and_cosmology( redshift_0=slacs['z_lens'][i], redshift_1=slacs['z_source'][i], cosmology=cosmo, unit_mass='solMass' ) einstein_mass_SLACS = np.pi*sigma_crit* slacs['b_SIE'][i]**2 axis_ratio = results.loc[lens[i]]['param']['axis_ratio'] phi = results.loc[lens[i]]['param']['phi'] radius_rescaled = results.loc[lens[i]]['param']['einstein_radius'] * ( 2 * np.sqrt(axis_ratio) / (1 + axis_ratio)) r_error = np.array([(np.abs((results.loc[lens[i]]['+error']['einstein_radius']-results.loc[lens[i]]['param']['einstein_radius']) /results.loc[lens[i]]['param']['einstein_radius'])), (np.abs(results.loc[lens[i]]['-error']['einstein_radius'] - results.loc[lens[i]]['param']['einstein_radius'])) / results.loc[lens[i]]['param']['einstein_radius']])