Exemplo n.º 1
0
 def massrich_norm(self, norm):
     self._massrich_norm = utils.check_units_and_type(norm,
                                                      units.Msun,
                                                      is_scalar=True)
     # behavior is to convert current n200 -> new m200
     if hasattr(self, 'n200'):
         self._richness_to_mass()
Exemplo n.º 2
0
 def m200(self, mass):
     # Creates/updates values of cluster M200s & dependant variables.
     self._m200 = utils.check_units_and_type(mass,
                                             units.Msun,
                                             num=self.number)
     self._df['m200'] = pd.Series(self._m200, index=self._df.index)
     self._mass_to_richness()
Exemplo n.º 3
0
 def n200(self, richness):
     # Creates/updates values of cluster N200s & dependant variables.
     self._n200 = utils.check_units_and_type(richness,
                                             None,
                                             num=self.number)
     self._df['n200'] = pd.Series(self._n200, index=self._df.index)
     self._richness_to_mass()
Exemplo n.º 4
0
 def z(self, redshifts):
     # Changes the values of the cluster z's and z-dependant variables.
     self._z = utils.check_units_and_type(redshifts, None, num=self.number)
     self._Dang_l = self._cosmo.angular_diameter_distance(self._z)
     self._df['z'] = pd.Series(self._z, index=self._df.index)
     self._rho_crit = self._cosmo.critical_density(self._z)
     if self._n200 is not None:
         self._update_dependant_variables()
Exemplo n.º 5
0
 def z(self, redshifts):
     # Changes the values of the cluster z's and z-dependant variables.
     self._z = utils.check_units_and_type(redshifts, None, num=self.number)
     self._Dang_l = self._cosmo.angular_diameter_distance(self._z)
     self._df['z'] = pd.Series(self._z, index=self._df.index)
     self._rho_crit = self._cosmo.critical_density(self._z)
     if self._n200 is not None:
         self._update_dependant_variables()
Exemplo n.º 6
0
    def __init__(self, rs, delta_c, rho_crit, offsets=None, rbins=None,
                 numTh=200, numRoff=200, numRinner=20, factorRouter=3):
        if rbins is None:
            rmin, rmax = 0.1, 5.
            rbins = np.logspace(np.log10(rmin), np.log10(rmax), num=50)
            self._rbins = rbins * units.Mpc
        else:
            # check rbins input units & type
            self._rbins = utils.check_units_and_type(rbins, units.Mpc)

        # check input units & types
        self._rs = utils.check_units_and_type(rs, units.Mpc)
        self._delta_c = utils.check_units_and_type(delta_c, None)
        self._rho_crit = utils.check_units_and_type(rho_crit, units.Msun /
                                                    units.Mpc / (units.pc**2))

        self._numRoff = utils.check_units_and_type(numRoff, None,
                                                   is_scalar=True)
        self._numTh = utils.check_units_and_type(numTh, None, is_scalar=True)
        self._numRinner = utils.check_units_and_type(numRinner, None,
                                                     is_scalar=True)
        self._factorRouter = utils.check_units_and_type(factorRouter, None,
                                                        is_scalar=True)
        # check numbers of bins are all positive
        if (numRoff <= 0) or (numTh <= 0) or (numRinner <= 0) or \
           (factorRouter <= 0):
                raise ValueError('Require numbers of bins > 0')

        self._nbins = self._rbins.shape[0]
        self._nlens = self._rs.shape[0]

        if offsets is not None:
            self._sigmaoffset = utils.check_units_and_type(offsets, units.Mpc)
            utils.check_input_size(self._sigmaoffset, self._nlens)
        else:
            self._sigmaoffset = offsets

        # check array sizes are compatible
        utils.check_input_size(self._rs, self._nlens)
        utils.check_input_size(self._delta_c, self._nlens)
        utils.check_input_size(self._rho_crit, self._nlens)
        utils.check_input_size(self._rbins, self._nbins)

        rs_dc_rcrit = self._rs * self._delta_c * self._rho_crit
        self._rs_dc_rcrit = rs_dc_rcrit.reshape(self._nlens,
                                                1).repeat(self._nbins, 1)

        # set self._x, self._x_big, self._x_small, self._x_one
        _set_dimensionless_radius(self)
Exemplo n.º 7
0
    def calc_nfw(self, rbins, offsets=None, numTh=200, numRoff=200,
                 numRinner=20, factorRouter=3):
        """Calculates Sigma and DeltaSigma profiles.

        Generates the surface mass density (sigma_nfw attribute of parent
        object) and differential surface mass density (deltasigma_nfw
        attribute of parent object) profiles of each cluster, assuming a
        spherical NFW model. Optionally includes the effect of cluster
        miscentering offsets.

        Parameters
        ----------
        rbins : array_like
            Radial bins (in Mpc) for calculating cluster profiles. Should
            be 1D, optionally with astropy.units of Mpc.
        offsets : array_like, optional
            Parameter describing the width (in Mpc) of the Gaussian
            distribution of miscentering offsets. Should be 1D, optionally
            with astropy.units of Mpc.

        Other Parameters
        -------------------
        numTh : int, optional
            Parameter to pass to SurfaceMassDensity(). Number of bins to
            use for integration over theta, for calculating offset profiles
            (no effect for offsets=None). Default 200.
        numRoff : int, optional
            Parameter to pass to SurfaceMassDensity(). Number of bins to
            use for integration over R_off, for calculating offset profiles
            (no effect for offsets=None). Default 200.
        numRinner : int, optional
            Parameter to pass to SurfaceMassDensity(). Number of bins at
            r < min(rbins) to use for integration over Sigma(<r), for
            calculating DeltaSigma (no effect for Sigma ever, and no effect
            for DeltaSigma if offsets=None). Default 20.
        factorRouter : int, optional
            Parameter to pass to SurfaceMassDensity(). Factor increase over
            number of rbins, at min(r) < r < max(r), of bins that will be
            used at for integration over Sigma(<r), for calculating
            DeltaSigma (no effect for Sigma, and no effect for DeltaSigma
            if offsets=None). Default 3.
        """
        if offsets is None:
            self._sigoffset = np.zeros(self.number) * units.Mpc
        else:
            self._sigoffset = utils.check_units_and_type(offsets, units.Mpc,
                                                         num=self.number)

        self.rbins = utils.check_units_and_type(rbins, units.Mpc)

        rhoc = self._rho_crit.to(units.Msun / units.pc**2 / units.Mpc)
        smd = SurfaceMassDensity(self.rs, self.delta_c, rhoc,
                                 offsets=self._sigoffset,
                                 rbins=self.rbins,
                                 numTh=numTh,
                                 numRoff=numRoff,
                                 numRinner=numRinner,
                                 factorRouter=factorRouter)

        self.sigma_nfw = smd.sigma_nfw()
        self.deltasigma_nfw = smd.deltasigma_nfw()
Exemplo n.º 8
0
 def massrich_norm(self, norm):
     self._massrich_norm = utils.check_units_and_type(norm, units.Msun,
                                                      is_scalar=True)
     # behavior is to convert current n200 -> new m200
     if hasattr(self, 'n200'):
         self._richness_to_mass()
Exemplo n.º 9
0
 def m200(self, mass):
     # Creates/updates values of cluster M200s & dependant variables.
     self._m200 = utils.check_units_and_type(mass, units.Msun,
                                             num=self.number)
     self._df['m200'] = pd.Series(self._m200, index=self._df.index)
     self._mass_to_richness()
Exemplo n.º 10
0
 def n200(self, richness):
     # Creates/updates values of cluster N200s & dependant variables.
     self._n200 = utils.check_units_and_type(richness, None,
                                             num=self.number)
     self._df['n200'] = pd.Series(self._n200, index=self._df.index)
     self._richness_to_mass()
Exemplo n.º 11
0
    def calc_nfw(self,
                 rbins,
                 offsets=None,
                 numTh=200,
                 numRoff=200,
                 numRinner=20,
                 factorRouter=3):
        """Calculates Sigma and DeltaSigma profiles.

        Generates the surface mass density (sigma_nfw attribute of parent
        object) and differential surface mass density (deltasigma_nfw
        attribute of parent object) profiles of each cluster, assuming a
        spherical NFW model. Optionally includes the effect of cluster
        miscentering offsets.

        Parameters
        ----------
        rbins : array_like
            Radial bins (in Mpc) for calculating cluster profiles. Should
            be 1D, optionally with astropy.units of Mpc.
        offsets : array_like, optional
            Parameter describing the width (in Mpc) of the Gaussian
            distribution of miscentering offsets. Should be 1D, optionally
            with astropy.units of Mpc.

        Other Parameters
        -------------------
        numTh : int, optional
            Parameter to pass to SurfaceMassDensity(). Number of bins to
            use for integration over theta, for calculating offset profiles
            (no effect for offsets=None). Default 200.
        numRoff : int, optional
            Parameter to pass to SurfaceMassDensity(). Number of bins to
            use for integration over R_off, for calculating offset profiles
            (no effect for offsets=None). Default 200.
        numRinner : int, optional
            Parameter to pass to SurfaceMassDensity(). Number of bins at
            r < min(rbins) to use for integration over Sigma(<r), for
            calculating DeltaSigma (no effect for Sigma ever, and no effect
            for DeltaSigma if offsets=None). Default 20.
        factorRouter : int, optional
            Parameter to pass to SurfaceMassDensity(). Factor increase over
            number of rbins, at min(r) < r < max(r), of bins that will be
            used at for integration over Sigma(<r), for calculating
            DeltaSigma (no effect for Sigma, and no effect for DeltaSigma
            if offsets=None). Default 3.
        """
        if offsets is None:
            self._sigoffset = np.zeros(self.number) * units.Mpc
        else:
            self._sigoffset = utils.check_units_and_type(offsets,
                                                         units.Mpc,
                                                         num=self.number)

        self.rbins = utils.check_units_and_type(rbins, units.Mpc)

        rhoc = self._rho_crit.to(units.Msun / units.pc**2 / units.Mpc)
        smd = SurfaceMassDensity(self.rs,
                                 self.delta_c,
                                 rhoc,
                                 offsets=self._sigoffset,
                                 rbins=self.rbins,
                                 numTh=numTh,
                                 numRoff=numRoff,
                                 numRinner=numRinner,
                                 factorRouter=factorRouter)

        self.sigma_nfw = smd.sigma_nfw()
        self.deltasigma_nfw = smd.deltasigma_nfw()