def calculateAvgMassEinsteinRadius(gz, qz): avgMass = 0.247 # avgMass = 0.20358470458734301 dL = cosmo.angular_diameter_distance(gz).to('m') dS = cosmo.angular_diameter_distance(qz).to('m') dLS = cosmo.angular_diameter_distance_z1z2(gz, qz).to('m') thetaE = 4 * const.G * u.Quantity( avgMass, 'solMass').to('kg') * dLS / dL / dS / const.c / const.c thetaEUnit = u.def_unit('theta_E', math.sqrt(thetaE.value) * u.rad) return thetaEUnit
def generateSpecialUnits(qMass, qR, gR): linearRg = (qMass.to('kg') * const.G / const.c / const.c).to('m') angleRg = linearRg / cosmo.angular_diameter_distance(qR) rgUnit = u.def_unit('r_g', angleRg.value * u.rad) thetaE = 4 * const.G * u.Quantity(0.5, 'solMass').to('kg') * _scaleFactor( qR, gR) / const.c / const.c thetaEUnit = u.def_unit('theta_E', math.sqrt(thetaE.value) * u.rad) return [thetaEUnit, rgUnit]
def angDiamDist(self): return cosmo.angular_diameter_distance(self.__redshift).to('lyr')
def calculateGravRad(mass, qz): linRG = (mass.to('kg') * const.G / const.c / const.c).to('m') angG = linRG / cosmo.angular_diameter_distance(qz).to('m') rgUnit = u.def_unit('r_g', angG * u.rad) return rgUnit
def __init__(self, snapnum, subhalos, mi, ci, RA_deg, DEC_deg, snapz, galaxy_camera_posx, galaxy_camera_posy, galaxy_camera_posz, centerz, galaxy_camera_velx, galaxy_camera_vely, galaxy_camera_velz, cyl, gmag): #fields=['SubhaloMass','SubhaloMassInMaxRad','SubhaloMassInRadType','SubhaloMassInMaxRadType','SubhaloPos','SubhaloSFR','SubhaloSFRinRad','SubhaloVel','SubhaloBHMass','SubhaloBHMdot','SubhaloStellarPhotometrics','SubhaloWindMass'] self.snapshot_number = snapnum + np.zeros_like(ci) self.subhalo_index = subhalos['SubFindID'][mi[ci]] self.RA_deg = RA_deg self.DEC_deg = DEC_deg self.snapz = snapz + np.zeros_like(RA_deg) self.center_z = centerz + np.zeros_like(RA_deg) self.cylinder_number = cyl + np.zeros_like(self.subhalo_index) self.galaxy_comoving_x_mpc = galaxy_camera_posx[ci] / 1000.0 self.galaxy_comoving_y_mpc = galaxy_camera_posy[ci] / 1000.0 self.galaxy_comoving_z_mpc = galaxy_camera_posz[ci] / 1000.0 #self.galaxy_camera_posx = galaxy_camera_posx[ci]/1000.0 #self.galaxy_camera_posy = galaxy_camera_posy[ci]/1000.0 #self.galaxy_camera_posz = galaxy_camera_posz[ci]/1000.0 self.galaxy_camera_velx = galaxy_camera_velx[ci] self.galaxy_camera_vely = galaxy_camera_vely[ci] self.galaxy_camera_velz = galaxy_camera_velz[ci] self.galaxy_peculiar_vr = 1.0 * self.galaxy_camera_velz self.galaxy_peculiar_z = 1.0 * self.galaxy_peculiar_vr / ( astropy.constants.c.value / 1.0e3) self.cosmological_redshift = np.zeros_like(self.RA_deg) for i, index in enumerate(ci): self.cosmological_redshift[i] = np.float64( z_at_value(WMAP7.comoving_distance, self.galaxy_comoving_z_mpc[i] * u.megaparsec, ztol=1e-12, maxfun=2000)) self.hubble_velocity = self.cosmological_redshift * astropy.constants.c.value / 1.0e3 #in km/s self.galaxy_observed_z = 1.0 * self.cosmological_redshift + self.galaxy_peculiar_z #self.galaxy_comoving_x_mpc = self.galaxy_camera_posx*(1.0 + self.cosmological_redshift) #self.galaxy_comoving_y_mpc = self.galaxy_camera_posy*(1.0 + self.cosmological_redshift) #self.galaxy_comoving_z_mpc = self.galaxy_camera_posz*(1.0 + self.cosmological_redshift) self.galaxy_camera_posx = self.galaxy_comoving_x_mpc / ( 1.0 + self.cosmological_redshift) self.galaxy_camera_posy = self.galaxy_comoving_y_mpc / ( 1.0 + self.cosmological_redshift) self.galaxy_camera_posz = self.galaxy_comoving_z_mpc / ( 1.0 + self.cosmological_redshift) self.angdiam_mpc = np.asarray( WMAP7.angular_diameter_distance(self.cosmological_redshift)) self.kpc_per_arcsec = np.asarray( WMAP7.kpc_proper_per_arcmin(self.cosmological_redshift) / 60.0) self.observed_angdiam_mpc = np.asarray( WMAP7.angular_diameter_distance(self.galaxy_observed_z)) self.observed_comoving_mpc = np.asarray( WMAP7.comoving_distance(self.galaxy_observed_z)) self.observed_kpc_per_arcsec = np.asarray( WMAP7.kpc_proper_per_arcmin(self.galaxy_observed_z) / 60.0) self.RA_kpc = self.RA_deg * 3600.0 * self.kpc_per_arcsec self.DEC_kpc = self.DEC_deg * 3600.0 * self.kpc_per_arcsec self.observed_RA_kpc = self.RA_deg * 3600.0 * self.observed_kpc_per_arcsec self.observed_DEC_kpc = self.DEC_deg * 3600.0 * self.observed_kpc_per_arcsec self.mstar_msun = subhalos['SubhaloMassInRadType'][self.subhalo_index, 4] * (1.0e10) / ilh self.mgas_msun = subhalos['SubhaloMassInRadType'][ self.subhalo_index, 0] * (1.0e10) / ilh #includes wind mass self.mbh_msun = subhalos['SubhaloMassInRadType'][self.subhalo_index, 5] * (1.0e10) / ilh self.mhalo_msun = subhalos['SubhaloMass'][self.subhalo_index] * ( 1.0e10) / ilh self.baryonmass_msun = self.mstar_msun + self.mgas_msun + self.mbh_msun #within 2x stellar half mass radius... best? self.xpos_ckh = subhalos['SubhaloPos'][self.subhalo_index, 0] #in cKpc/h of max bound part self.ypos_ckh = subhalos['SubhaloPos'][self.subhalo_index, 1] self.zpos_ckh = subhalos['SubhaloPos'][self.subhalo_index, 2] self.xpos_pmpc = (self.xpos_ckh * 1.0 / (1.0 + snapz) / ilh) / 1.0e3 self.ypos_pmpc = (self.ypos_ckh * 1.0 / (1.0 + snapz) / ilh) / 1.0e3 self.zpos_pmpc = (self.zpos_ckh * 1.0 / (1.0 + snapz) / ilh) / 1.0e3 self.xvel_kms = subhalos['SubhaloVel'][self.subhalo_index, 0] self.yvel_kms = subhalos['SubhaloVel'][self.subhalo_index, 1] self.zvel_kms = subhalos['SubhaloVel'][self.subhalo_index, 2] self.sfr = subhalos['SubhaloSFRinRad'][self.subhalo_index] self.bhmdot = subhalos['SubhaloBHMdot'][self.subhalo_index] self.gmag = subhalos['SubhaloStellarPhotometrics'][self.subhalo_index, 4] self.rmag = subhalos['SubhaloStellarPhotometrics'][self.subhalo_index, 5] self.imag = subhalos['SubhaloStellarPhotometrics'][self.subhalo_index, 6] self.zmag = subhalos['SubhaloStellarPhotometrics'][self.subhalo_index, 7] self.gmag_apparent = gmag[ci] #self.total_redshift = return
def _scaleFactor(qR, gR): return (cosmo.angular_diameter_distance_z1z2(gR, qR) / cosmo.angular_diameter_distance(qR) / cosmo.angular_diameter_distance(gR)).to('1/m')