예제 #1
0
def mi_star(z, cosmo=(0.3, 0.7, 0.7)):

    # Set the cosmology
    c = cosmopy.set(cosmo)
    dlum = c.dlum(z)[0]

    Mb_star = -19.43 - 1.01 * z
    Mi_star = cosmology.reobs('El_Benitez2003',
                              m=Mb_star,
                              oldfilter="B_Johnson",
                              newfilter="i_MOSAICII")
    return Mi_star + 5.0 * math.log10(dlum) + 25
예제 #2
0
def mr_star(z, h=0.7, cosmo=(0.3, 0.7, 0.7)):
    #dlum = self.c.dlum(z)[0]
    dlum = cosmology.dl(z, cosmology=cosmo)

    # Red galaxies fit from Brown et al
    Mb_star = -19.43 - 1.01 * z
    Mr_star = cosmology.reobs('El_Benitez2003',
                              m=Mb_star,
                              oldfilter="B_Johnson",
                              newfilter="r_SDSS")

    # Alternative -- Paolillo et al. (2001) LF for clusters
    #Mr_star = -21.53 + self.evf['r'](z)[0]
    #Mi_star = cosmology.reobs('El_Benitez2003',m=Mr_star, oldfilter="R_Cousins", newfilter="i_MOSAICII")

    # Blanton M*
    Mi_star = -21.22 - 5 * math.log10(h)  #+ self.evf['i'](z)[0]
    Mr_star = cosmology.reobs('El_Benitez2003',
                              m=Mi_star,
                              oldfilter="i_SDSS",
                              newfilter="r_SDSS")
    return Mr_star + 5.0 * numpy.log10(dlum) + 25
예제 #3
0
    def get_BCG_candidates(self, Mr_limit=-22.71, p_lim=1e-4):

        t0 = time.time()
        sout.write("# Computing p_BCG probabilities... ")

        # The Abs mag limit @ z=0.1 in the i-band
        Mi_limit = cosmology.reobs('El_Benitez2003',
                                   m=Mr_limit,
                                   oldfilter="r_MOSAICII",
                                   newfilter="i_MOSAICII")

        # Evaluate the genertic mask for BCG only onece
        if not self.BCG_probs:

            # We get the limit at the z_ph of each candidate, corrected by z=0.1
            Mr_BCG_limit = Mr_limit + self.ev_r - self.evf['r'](
                0.1)  #+ self.DM_factor
            Mi_BCG_limit = Mi_limit + self.ev_i - self.evf['i'](
                0.1)  #+ self.DM_factor
            # Evaluate the BCG Probability function, we get the limit for each object
            self.p = p_BCG(self.Mr, Mr_BCG_limit)
            self.BCG_probs = True

            i_lim = 25.0
            star_lim = 0.5
            mask_p = np.where(self.p >= p_lim, 1, 0)
            mask_g = np.where(self.g < i_lim + 5, 1, 0)
            mask_r = np.where(self.r < i_lim + 5, 1, 0)
            mask_i = np.where(self.i < i_lim, 1, 0)
            mask_t = np.where(self.type < 2.0, 1, 0)

            # Avoid freakishly bright objects, 2.5 mags brighter than the M_BCG_limit
            mask_br = np.where(self.Mr > Mr_BCG_limit - 3.5, 1, 0)
            mask_bi = np.where(self.Mi > Mi_BCG_limit - 3.5, 1, 0)

            # Put a more strict cut in class_star for bcg candidates
            sout.write("# Avoiding CLASS_STAR > %s in BGCs\n" % star_lim)
            mask_star = np.where(self.class_star <= star_lim, 1, 0)

            # Construct the final mask now
            self.mask_BCG = mask_t * mask_g * mask_r * mask_i * mask_br * mask_bi * mask_p
            self.BCG_masked = True
            sout.write(" \t Done: %s\n" % extras.elapsed_time_str(t0))

        # Select the candidates now
        idx = np.where(self.mask_BCG == 1)

        # And pass up to to class
        # The index number
        self.idx_BCG = idx
        self.ra_BCG = self.ra[idx]
        self.dec_BCG = self.dec[idx]
        self.p_BCG = self.p[idx]
        self.z_BCG = self.z_ph[idx]
        self.t_BCG = self.type[idx]
        self.N_BCG = len(idx[0])
        self.Mi_BCG = self.Mi[idx]
        self.Mr_BCG = self.Mr[idx]
        self.DM_BCG = self.DM[idx]  # distance modulus
        self.dang_BCG = self.dang[idx]  # distance modulus

        self.zml_BCG = self.z_ml[idx]
        self.tml_BCG = self.t_ml[idx]
        self.zb_BCG = self.z_b[idx]
        self.tb_BCG = self.t_b[idx]
        self.class_BCG = self.class_star[idx]
        self.a_BCG = self.a_image[idx]
        self.b_BCG = self.b_image[idx]
        self.theta_BCG = self.theta[idx]
        self.x_BCG = self.x_image[idx]
        self.x_BCG = self.x_image[idx]

        # r,i-band stuff
        self.r_BCG = self.r[idx]
        self.i_BCG = self.i[idx]

        # Get the 1-sigma intervals
        self.z1_BCG = self.z1[idx]
        self.z2_BCG = self.z2[idx]

        # The r-band Luminosity of the BCGs
        self.LBCG = self.Lr[idx]

        # The distance to the candidate's position for each BCG, in arcmin
        sout.write("# Found %s BCG candidates\n" % self.N_BCG)

        return
예제 #4
0
def get_BCG_candidates(self, Mr_limit=-22.71, p_lim=1e-4):

    t0 = time.time()
    sout.write("# Computing p_BCG probabilities...\n")

    # The Abs mag limit @ z=0.1 in the i-band
    Mi_limit = cosmology.reobs(
        'El_Benitez2003',
        m=Mr_limit,
        oldfilter="r_MOSAICII",
        newfilter="i_MOSAICII")

    # Evaluate the genertic mask for BCG only onece
    if not self.BCG_probs:

        # We get the limit at the z_ph of each candidate, corrected by z=0.1
        Mr_BCG_limit = Mr_limit + self.ev_r - self.evf['r'](
            0.1)  # + self.DM_factor
        Mi_BCG_limit = Mi_limit + self.ev_i - self.evf['i'](
            0.1)  # + self.DM_factor

        # Evaluate the BCG Probability function, we
        # get the limit for each object
        self.p = p_BCG(self.Mr, Mr_BCG_limit)

        self.BCG_probs = True

        i_lim = 25.0
        star_lim = self.starlim
        p_lim = max(self.p) * 0.8
        sout.write("\tAvoiding BCG_prob < %.3f in BGCs\n" % p_lim)
        mask_p = numpy.where(self.p >= p_lim, 1, 0)
        mask_g = numpy.where(self.g < i_lim + 5, 1, 0)
        mask_r = numpy.where(self.r < i_lim + 2, 1, 0)
        mask_i = numpy.where(self.i < i_lim, 1, 0)
        mask_z = numpy.where(self.z < i_lim + 1, 1, 0)
        mask_t = numpy.where(self.type <= 2.0, 1, 0)

        # Avoid freakishly bright objects, 2.5 mags brighter than the
        # M_BCG_limit
        mask_br = numpy.where(self.Mr > Mr_BCG_limit - 2.5, 1, 0)
        mask_bi = numpy.where(self.Mi > Mi_BCG_limit - 2.5, 1, 0)

        # Put a more strict cut in class_star for bcg candidates
        sout.write("\tAvoiding CLASS_STAR > %s in BGCs\n" % star_lim)
        mask_star = numpy.where(self.class_star <= star_lim, 1, 0)

        # Construct the final mask now
        self.mask_BCG = (mask_t * mask_g * mask_r * mask_i * mask_z *
                         mask_br * mask_bi * mask_p * mask_star)

        self.BCG_masked = True

        # Model color only once
        #self.zx = numpy.arange(0.01, self.zlim, 0.01)
        self.gr_model = cosmology.color_z(
            sed='El_Benitez2003',
            filter_new='g_MOSAICII',
            filter_old='r_MOSAICII',
            z=self.zx,
            calibration='AB')
        self.ri_model = cosmology.color_z(
            sed='El_Benitez2003',
            filter_new='r_MOSAICII',
            filter_old='i_MOSAICII',
            z=self.zx,
            calibration='AB')
        self.iz_model = cosmology.color_z(
            sed='El_Benitez2003',
            filter_new='i_MOSAICII',
            filter_old='z_MOSAICII',
            z=self.zx,
            calibration='AB')

        sout.write(" \tDone: %s\n" % extras.elapsed_time_str(t0))

    # Select the candidates now
    idx = numpy.where(self.mask_BCG == 1)

    # And pass up to to class
    self.idx_BCG = idx
    self.id_BCG = self.id[idx]
    self.ra_BCG = self.ra[idx]
    self.dec_BCG = self.dec[idx]
    self.p_BCG = self.p[idx]
    self.z_BCG = self.z_ph[idx]
    self.t_BCG = self.type[idx]
    self.N_BCG = len(idx[0])
    self.Mi_BCG = self.Mi[idx]
    self.Mr_BCG = self.Mr[idx]
    self.DM_BCG = self.DM[idx]  # distance modulus
    self.dang_BCG = self.dang[idx]  # distance modulus

    self.zml_BCG = self.z_ml[idx]
    self.tml_BCG = self.t_ml[idx]
    self.zb_BCG = self.z_b[idx]
    self.tb_BCG = self.t_b[idx]
    self.class_BCG = self.class_star[idx]
    self.a_BCG = self.a_image[idx]
    self.b_BCG = self.b_image[idx]
    self.theta_BCG = self.theta[idx]

    # r,i-band stuff
    self.r_BCG = self.r[idx]
    self.i_BCG = self.i[idx]

    # Get the 1-sigma intervals
    self.z1_BCG = self.z1[idx]
    self.z2_BCG = self.z2[idx]

    # The r-band Luminosity of the BCGs
    self.LBCG = self.Lr[idx]

    # The distance to the candidate's position for each BCG, in arcmin
    if self.N_BCG:
        sout.write(color("\tFound %s BCG candidates\n" % self.N_BCG, 36, 1))
    else:
        sout.write(color("\tFound %s BCG candidates\n" % self.N_BCG, 31, 5))
    return