In [1]:
%pylab inline

from __future__ import (division, print_function)

import os
import sys
import copy
import fnmatch
import warnings
import collections

import numpy as np
import scipy
try:
    from scipy.stats import scoreatpercentile
except:
    scoreatpercentile = False
from scipy.interpolate import interp1d
import cPickle as pickle

# Astropy
from astropy.io import fits
from astropy    import units as u
from astropy.stats import sigma_clip
from astropy.table import Table, Column
from astropy.utils.console import ProgressBar

# AstroML
from astroML.plotting import hist

# Matplotlib related
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
from matplotlib.ticker import NullFormatter
from matplotlib.ticker import MaxNLocator
# Matplotlib default settings
rcdef = plt.rcParams.copy()
pylab.rcParams['figure.figsize'] = 12, 10
pylab.rcParams['xtick.major.size'] = 8.0
pylab.rcParams['xtick.major.width'] = 2.5
pylab.rcParams['xtick.minor.size'] = 4.0
pylab.rcParams['xtick.minor.width'] = 2.5
pylab.rcParams['ytick.major.size'] = 8.0
pylab.rcParams['ytick.major.width'] = 2.5
pylab.rcParams['ytick.minor.size'] = 4.0
pylab.rcParams['ytick.minor.width'] = 2.5

# Personal
import hscUtils as hUtil
import galSBP


Populating the interactive namespace from numpy and matplotlib

In [5]:
# Code for Get Bootstrap mean or median 
def _confidence_interval_1d(A, alpha=.05, metric=np.mean, numResamples=10000, interpolate=True):
    """Calculates bootstrap confidence interval along one dimensional array"""
    
    if not isinstance(alpha, collections.Iterable):
        alpha = np.array([alpha])

    N = len(A)
    resampleInds = np.random.randint(0, N, (numResamples,N))
    metricOfResampled = metric(A[resampleInds], axis=-1)

    confidenceInterval = np.zeros(2*len(alpha),dtype='float')
    
    if interpolate:
        for thisAlphaInd, thisAlpha in enumerate(alpha):
            confidenceInterval[2*thisAlphaInd] = scoreatpercentile(metricOfResampled, 
                                                                   thisAlpha*100/2.0)
            confidenceInterval[2*thisAlphaInd+1] = scoreatpercentile(metricOfResampled, 
                                                                     100-thisAlpha*100/2.0)
    else:
        sortedMetricOfResampled = np.sort(metricOfResampled)
        for thisAlphaInd, thisAlpha in enumerate(alpha):
            confidenceInterval[2*thisAlphaInd] = sortedMetricOfResampled[int(round(thisAlpha*numResamples/2.0))]
            confidenceInterval[2*thisAlphaInd+1] = sortedMetricOfResampled[int(round(numResamples - 
                                                                                     thisAlpha*numResamples/2.0))]
    return confidenceInterval
    
def _ma_confidence_interval_1d(A, alpha=.05, metric=np.mean, numResamples=10000, interpolate=True):
    A = np.ma.masked_invalid(A, copy=True)
    A = A.compressed()
    confidenceInterval = _confidence_interval_1d(A, alpha, metric, numResamples, interpolate)
    return confidenceInterval

def confidence_interval(A, axis=None, alpha=.05, metric=np.mean, numResamples=10000, interpolate=True):
    """Return the bootstrap confidence interval of an array or along an axis ignoring NaNs and masked elements.
    
    Parameters
    ----------
    A : array_like
        Array containing numbers whose confidence interval is desired. 
    axis : int, optional
        Axis along which the confidence interval is computed.
        The default is to compute the confidence interval of the flattened array.
    alpha: float or array, optional
        confidence level of confidence interval. 100.0*(1-alpha) percent confidence 
        interval will be returned.
        If length-n array, n confidence intervals will be computed
        The default is .05
    metric : numpy function, optional
        metric to calculate confidence interval for.
        The default is numpy.mean
    numResamples : int, optional
        number of bootstrap samples. The default is 10000.
    interpolate: bool, optional
        uses scipy.stats.scoreatpercentile to interpolate between bootstrap samples 
        if alpha*numResamples/2.0 is not integer.
        The default is True
        
    Returns
    -------
    confidenceInterval : ndarray
    An array with the same shape as `A`, with the specified axis replaced by one twice the length of the alpha
    If `A` is a 0-d array, or if axis is None, a length-2 ndarray is returned.
    """
    if interpolate is True and scoreatpercentile is False:
        print("need scipy to interpolate between values")
        interpolate = False
    A = A.copy()
    if axis is None:
        A = A.ravel()
        outA = _ma_confidence_interval_1d(A, alpha, metric, numResamples, interpolate)
    else:
        outA = np.apply_along_axis(_ma_confidence_interval_1d, axis, A, alpha, 
                                   metric, numResamples, interpolate)
        
    return outA

Summary of 1-D SBP for BCG v.s. non-BCG comparison

2015-12-09

Two datasets are available:

1. 280 redMapper BCGs (`redBCG`)
2. 644 $$0.22 < z < 0.26$$ massive ($$M_{\star}>10^{11.0}M_{\odot}$$) galaxies in the GAMA fields (`nonBCG`)

In [50]:
# Absolute magnitude of sun in HSC filters

# Actuall borrowed from DES filters
# Values from magsun.data in FSPS
amag_sun_des_g = 5.08
amag_sun_des_r = 4.62
amag_sun_des_i = 4.52
amag_sun_des_z = 4.52
amag_sun_des_y = 4.51

# Based on http://www.baryons.org/ezgal/filters.php
amag_sun_ukiss_y = 4.515

# Extinction correction factor for HSC 
## A\_lambda = Coeff * E(B-V) 

a_hsc_g = 3.233
a_hsc_r = 2.291 
a_hsc_i = 1.635
a_hsc_z = 1.261
a_hsc_y = 1.076

# 
SIGMA1 = 0.3173
SIGMA2 = 0.0455
SIGMA3 = 0.0027

In [7]:
# Location of the cutouts 
import platform 

if 'Linux' in platform.platform():
    """ On Astro2 / For Linux """
    machine = 'w520'
    baseDir = '/media/hs/Astro2/hsc/master'
elif 'Darwin' in platform.platform():
    machine = 'mbp13'
    """ On Astro3 / For MacOS"""
    baseDir = '/Users/songhuang/astro3/hscs' 
else: 
    raise Exception("## Unknown location for HSC data!")

# The two current datasets 
redBCG = os.path.join(baseDir, 'redmapper')
if not os.path.exists(redBCG): 
    raise Exception("## Can not find location for redBCG data")
    
nonBCG = os.path.join(baseDir, 'nonbcg')
#nonBCG = os.path.join(baseDir, 'gama1')
if not os.path.exists(nonBCG): 
    raise Exception("## Can not find location for nonBCG data")
    
# Summary tables: 
redBCG_sum = os.path.join(redBCG, 'redBCG_new.fits')
nonBCG_sum = os.path.join(nonBCG, 'nonBCG_new.fits')

Functions to Deal with Profiles


In [8]:
def findProfile(pattern, loc, verbose=False):
    """
    Find the prefix of the ellipse profiles. 
    
    Parameters: 
    """
    result = []
    for root, dirs, files in os.walk(loc):
        for name in files:
            if fnmatch.fnmatch(name, pattern):
                result.append(os.path.join(root, name))
    if verbose: 
        print("### %d files found !" % len(result))
    
    return result

def testFindProfile():
    """Test the findProfile function."""
    find = findProfile("*ellip*.pkl", 
                        os.path.join(redBCG, '127', 'HSC-I', 'default'))
    return find

In [9]:
def readProfile(ellFile):
    """ Load the pickle format 1-D profile. """
    if os.path.isfile(ellFile):
        return pickle.load(open(ellFile, 'rb'))
    else:
        warnings.warn("!!! Can not find the Ellipse Output at %s" % 
                      ellFile )
        return None

In [10]:
def getEllipProfile(galid, base, filter='HSC-I', rerun='default', 
                    prefix='redBCG', suffix=None, stage='3', 
                    verbose=False):
    """
    Find and load the Ellipse output.
    
    Parameters: 
    """
    galid = str(galid).strip()
    if suffix is None: 
        suffix = '_'
    else: 
        suffix = '_' + suffix + '_'
    
    location = os.path.join(base, galid, filter, rerun)
    ellFile = (prefix + '_' + str(galid) + '_' + filter + 
               '_full_img_ellip_' + rerun + 
               suffix + stage + '.pkl')
    ellFile = os.path.join(location, ellFile)
    
    if not os.path.isfile(ellFile):
        if verbose:
            warnings.warn('!!! Can not find the Ellipse profile ! %s' % 
                          ellFile)
        return None
    else: 
        ellProf = readProfile(ellFile)
        return ellProf

In [11]:
def correctProf(ellProf, redshift, extinction=0.0, zp=27.0, 
                amag_sun=None, dimming=True, corCurve=True,
                verbose=False, m2l=None, z0=0.1):
    """
    Photometric correction of the Ellipse profile. 
    
    Parameters: 
    """
    """ Get physical pixel scale and distant module """
    scale = hUtil.cosmoScale(redshift)
    distmod = hUtil.cosmoDistMod(redshift)
    if dimming:
        dim = getDimming(redshift, z0)
    else: 
        dim = 0.0
    if verbose: 
        print("### REDSHIFT  : %7.4f" % redshift)
        print("### PIX SCALE : %7.4f kpc/arcsec" % scale)
        print("### DIST_MOD  : %7.4f mag" % distmod)
        print("### DIMMING   : %7.4f mag" % dim)
    
    """ Convert unit of major axis radius to Kpc """
    sma_kpc = ellProf['sma_asec'] * scale
    
    if not corCurve:
        abs_mag = (-2.5 * np.log10(ellProf['growth_ori']) + 
                   zp - extinction - distmod)
    else:
        abs_mag = (-2.5 * np.log10(ellProf['growth_cor']) + 
                   zp - extinction - distmod)
    
    """ Extinction and/or Dimming corrected SBP """
    sbp_cor = (ellProf['sbp'] - extinction - dim)
    sbp_cor_upp = (ellProf['sbp_upp'] - extinction - dim)
    sbp_err = (sbp_cor_upp - sbp_cor)

    """ 
    If absolute magnitude of the Sun is provided, 
    Convert the SBP into physical unit of (L_sun/kpc**2)
    """
    if amag_sun is not None: 
        abs_sbp = ((amag_sun + 21.572 - sbp_cor)/2.5 + 6.0)
        abs_sbp_low = ((amag_sun + 21.572 - sbp_cor_upp)/2.5 + 6.0)
        err_sbp = (abs_sbp - abs_sbp_low)
        """
        Convert the absolute magnitude into log(L*/L_sun)
        """
        abs_mag = ((amag_sun - abs_mag) / 2.5)
        """ 
        If M/L ratio is provided, furthur convert it into 
        surface stellar mass density profile
        """
        if m2l is not None: 
            abs_sbp += np.log10(m2l)
            abs_mag += np.log10(m2l)
    else:
        abs_sbp = sbp_cor
        err_sbp = sbp_err

    return sma_kpc, abs_sbp, abs_mag, err_sbp

In [12]:
def sbpExtract(loc, galID, redshift, filter, 
               prefix, rerun, stage, suffix=None,
               zp=27.0, extinction=0.0, 
               amag_sun=None, m2l=None, 
               origin=False):
    """
    Return important SBP information. 
    
    Parameters: 
    """
    prof = getEllipProfile(galID, loc, filter=filter, 
                           rerun=rerun, prefix=prefix, 
                           stage=stage, suffix=suffix)
    if prof is not None:
        ell = correctProf(prof, redshift, 
                          extinction=extinction, 
                          zp=zp, amag_sun=amag_sun, 
                          dimming=True, corCurve=True,
                          verbose=False, m2l=m2l)
        if origin: 
            return ell, prof
        else: 
            return ell
    else: 
        return None

In [13]:
def sbpCollect(loc, galID, redshift, prefix='redBCG', 
               a_g=0.0, a_r=0.0, a_i=0.0, 
               a_z=0.0, a_y=0.0, suffix=None,
               m2l_g=None, m2l_r=None, m2l_i=None, 
               m2l_z=None, m2l_y=None, 
               verbose=False, save=True):
    """
    Collect profiles from the cutout folder. 
    
    This is a quick work-around, eventually should us a Class for dataset 
    
    This works for the redBCG and nonBCG datasets 2015-12-09
    And, can not use for any profile with suffix
    """
    """ Location and Table name """
    sumDir = os.path.join(loc, 'sum')
    if suffix is None:
        sumTab = str(galID) + '_sbp_sum.fits'
        suffix = ''
    else: 
        sumTab = str(galID) + '_' + suffix + '_sbp_sum.fits'

    if not os.path.exists(sumDir): 
        os.mkdir(sumDir)
    sumTable = os.path.join(sumDir, sumTab)
        
    """ The basic reference model """
    refEllI = sbpExtract(loc, galID, redshift, 'HSC-I',
                         prefix, 'default', '3', 
                         extinction=a_i, m2l=m2l_i, 
                         amag_sun=amag_sun_des_i)
    if refEllI is not None:
        """ Reference profile in I-band """
        rad, muI1, lumI1, errI1 = refEllI
        """ Create a NaN array """
        empty = copy.deepcopy(rad)
        empty[:] = np.nan

        """ I largeR1 """
        ellI2 = sbpExtract(loc, galID, redshift, 
                           'HSC-I', prefix, 'largeR1', '4', 
                           m2l=m2l_i, extinction=a_i, 
                           amag_sun=amag_sun_des_i)
        if ellI2 is not None: 
            r, muI2, lumI2, errI2 = ellI2
        else: 
            muI2, lumI2, errI2 = empty, empty, empty
            warnings.warn('### Can not find the largeR1 for I-band!')
            
        """ I smallR1 """
        ellI3 = sbpExtract(loc, galID, redshift, 
                           'HSC-I', prefix, 'smallR1', '4', 
                           m2l=m2l_i, extinction=a_i, 
                           amag_sun=amag_sun_des_i)
        if ellI3 is not None: 
            r, muI3, lumI3, errI3 = ellI3
        else: 
            muI3, lumI3, errI3 = empty, empty, empty
            warnings.warn('### Can not find the smallR1 for I-band!')

        """ G default """
        ellG1 = sbpExtract(loc, galID, redshift, 
                           'HSC-G', prefix, 'default', '4', 
                           m2l=m2l_g, extinction=a_g, 
                           amag_sun=amag_sun_des_g)
        if ellG1 is not None: 
            r, muG1, lumG1, errG1 = ellG1
        else: 
            muG1, lumG1, errG1 = empty, empty, empty
            warnings.warn('### Can not find the default for G-band!')

        """ R default """
        ellR1 = sbpExtract(loc, galID, redshift, 
                           'HSC-R', prefix, 'default', '4', 
                           m2l=m2l_r, extinction=a_r, 
                           amag_sun=amag_sun_des_r)
        if ellR1 is not None: 
            r, muR1, lumR1, errR1 = ellR1
        else: 
            muR1, lumR1, errR1 = empty, empty, empty
            warnings.warn('### Can not find the default for R-band!')
  
        """ Z default """
        ellZ1 = sbpExtract(loc, galID, redshift, 
                           'HSC-Z', prefix, 'default', '4', 
                           m2l=m2l_z, extinction=a_z, 
                           amag_sun=amag_sun_des_z)
        if ellZ1 is not None: 
            r, muZ1, lumZ1, errZ1 = ellZ1
        else: 
            muZ1, lumZ1, errZ1 = empty, empty, empty
            warnings.warn('### Can not find the default for Z-band!')

        """ Y default """
        ellY1 = sbpExtract(loc, galID, redshift, 
                           'HSC-Y', prefix, 'default', '4', 
                           m2l=m2l_y, extinction=a_y, 
                           amag_sun=amag_sun_des_y)
        if ellY1 is not None: 
            r, muY1, lumY1, errY1 = ellY1
        else: 
            muY1, lumY1, errY1 = empty, empty, empty
            warnings.warn('### Can not find the default for Y-band!')
        
        
        """ Save the summary table """
        sbpTable = Table([rad, muI1, lumI1, errI1, 
                          muI2, lumI2, errI2, 
                          muI3, lumI3, errI3, 
                          muG1, lumG1, errG1, 
                          muR1, lumR1, errR1, 
                          muZ1, lumZ1, errZ1,
                          muY1, lumY1, errY1, 
                          ], 
                         names=('rKpc', 'muI1', 'lumI1', 'errI1', 
                                'muI2', 'lumI2', 'errI2', 
                                'muI3', 'lumI3', 'errI3', 
                                'muG1', 'lumG1', 'errG1', 
                                'muR1', 'lumR1', 'errR1', 
                                'muZ1', 'lumZ1', 'errZ1', 
                                'muY1', 'lumY1', 'errY1'), 
                         meta={'LOCATION': loc, 
                               'GALID': galID, 
                               'REDSHIFT': redshift, 
                               'PREFIX': prefix, 
                               'SUFFIX': suffix, 
                               'A_G': a_g, 
                               'A_R': a_r,
                               'A_I': a_i, 
                               'A_Z': a_z, 
                               'A_Y': a_y})
        if save: 
            sbpTable.write(sumTable, format='fits', 
                           overwrite=True)
        return sbpTable
    else:
        rad, muI1, lumI1, errI1 = None, None, None, None
        warnings.warn('### Model is not available at %s for %s' % 
                      (loc, str(galID)))
        return None

In [14]:
## Sometime the Geometric run can have different column size 
## Should find a way to fix it

        #""" I default Stage-2 for Geometry """
        #ref, profI1 = sbpExtract(loc, galID, redshift, 'HSC-I',
        #                         prefix, 'default', '2', 
        #                         extinction=a_i, m2l=m2l_i, 
        #                         amag_sun=amag_sun_des_i, 
        #                         origin=True)
        #x0, x0err = profI1['x0'], profI1['x0_err']
        #y0, y0err = profI1['y0'], profI1['y0_err']
        #ell, ellerr = profI1['ell'], profI1['ell_err']
        #pa, paerr = profI1['pa'], profI1['pa_err']

Useful Functions


In [15]:
def getExtinction(ra, dec, a_lambda=None):
    """
    Estimate the Galactic extinction for HSC filters.

    Parameters:
        ra, dec : The input coordinates can be arrays
    """
    # Check the input, if it's scalar, convert to array 
    if not hasattr(ra, "__len__") or not hasattr(dec, "__len__"):
        ra = np.asrray([ra])
        dec = np.asarray([dec])
    if len(ra) != len(dec):
        raise Exception("## The RA and DEC should contain same number of elements!")
    # First try mwdust from Jo Bovy
    try:
        import mwdust
        sfd = mwdust.SFD(sf10=True)

        from astropy.coordinates import SkyCoord
        coords = SkyCoord(ra, dec, frame='icrs', unit='deg')
        galactic = coords.galactic
        l, b = galactic.l, galactic.b
        ebv = sfd(l, b, 0)
    except ImportError:
        try:
            # Then try sncosmo
            from sncosmo import SFD98Map
            dustDir = os.environ.get('DUST_DIR')
            if (not os.path.isfile(os.path.join(dustDir,
                                   'SFD_dust_4096_ngp.fits'))) or (
                not os.path.isfile(os.path.join(dustDir,
                                   'SFD_dust_4096_sgp.fits'))):
                print('# DUST_DIR : %s' % dustDir)
                raise Exception("# Can not find the SFD dust map!")
            else:
                sfd = SFD98Map(dustDir)
                ebv = sfd.get_ebv((ra, dec))
        except ImportError:
            raise Exception("# Both mwdust and sncosmo are not available")
    if a_lambda is not None:
        return (ebv * a_lambda)
    else:
        return ebv

In [16]:
def getLuminosity(mag, redshift, extinction=None, 
                  amag_sun=None):
    """Get the absolute magnitude or luminosity."""
    distmod = hUtil.cosmoDistMod(redshift)
    absMag = (mag - distmod)
    if extinction is not None: 
        absMag -= extinction 
    if amag_sun is not None: 
        absMag = ((amag_sun - absMag) / 2.5)
    
    return absMag

In [17]:
def getDimming(z1, z0=0.1): 
    """
    Get the surface brightness dimming effect.
    
    Parameters: 
        z1: Observed redshift 
        z0: Reference redshift 
            Default = 0.1
    """
    return (3.0 * np.log10((1.0 + z1) / (1.0 + z0)))

In [18]:
def normProf(sma, sbp, minSma, maxSma): 
    """
    Naive method to normalize the profile. 
    
    Parameters: 
        sbp    : Array for surface brightness profile 
        sma    : Radius range 
        minSma : Minimum SMA
        maxSma   Maximum SMA
    """
    offset = np.nanmedian(sbp[(sma >= minSma) & 
                              (sma <= maxSma)])
    return (sbp-offset)

In [19]:
def pixKpc(redshift, pix=0.168, show=True, npix=1.0):
    """
    Get the corresponding Kpc size of a pixel.  
    
    Parameters: 
    """
    pixKpc = pix * npix * hUtil.cosmoScale(redshift)

    if show:
        print("# %d pixel(s) = %6.3f Kpc" % (npix, pixKpc))
        
    return pixKpc

In [20]:
def logAdd(para1, para2):
    """ Useful for adding magnitudes. """
    return np.log10((10.0 ** np.asarray(para1)) + 
                    (10.0 ** np.asarray(para2)))

In [21]:
def errAdd(err1, err2):
    """Add error quadral..."""
    return np.sqrt((err1 ** 2.0) + 
                   (err2 ** 2.0))

In [23]:
def toColorArr(data, bottom=None, top=None):
    """ 
    Convert a data array to "color array" (between 0 and 1). 
    
    Parameters:
        bottom, top  : 
    """
    if top is not None:
        data[data >= top] = top
    if bottom is not None:
        data[data <= bottom] = bottom
        
    return ((data - np.nanmin(data)) / 
            (np.nanmax(data) - np.nanmin(data))) * 255.0

Example


In [47]:
# Nearby cluster as example
expID = 127 
expRed = 0.185
prefix = 'redBCG'

In [48]:
tab = sbpCollect(redBCG, expID, expRed, prefix='redBCG', save=True)


/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:31: RuntimeWarning: divide by zero encountered in log10

In [49]:
tab


Out[49]:
<Table length=69>
rKpcmuI1lumI1errI1muI2lumI2errI2muI3lumI3errI3muG1lumG1errG1muR1lumR1errR1muZ1lumZ1errZ1muY1lumY1errY1x0x0erry0y0errellellerrpapaerr
float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64
0.09.16376525931-infnan9.16376525931-infnan9.16376525931-infnan8.5767020968-infnan8.87510858694-infnan9.22566351542-infnan9.28505342244-infnan751.0nan751.0nannannannannan
0.2724383213469.14474814315-inf0.003152995122749.14474814315-inf0.003152995122749.14474814315-inf0.003152995122748.56400829928-inf0.001833780432678.86190706915-inf0.001830302062419.21139679768-inf0.002482320190619.27020925741-inf0.00234944308098751.00.02649354751.00.026931490.0012255080.1015782-118.78322458.408
0.3051308840529.142449858268.076620000130.003537052792489.142449858268.076606770470.003537052792489.142449858268.076613567560.003537052792488.562493782597.496751216210.002055317877828.860331863847.794523261360.002056829144529.209663828878.143852242670.002783304081279.268425846698.202661415160.00263594914502751.00.02954701751.00.030035430.0012255080.1011477-118.78322447.989
0.3417466006849.139872581678.428219320820.003968293354349.139872581678.428206047470.003968293354349.139872581678.4282128670.003968293354348.56080077747.848841607680.002303239239018.858570947738.146575796610.002311681158169.207718037068.495802116710.003120895962349.266428611478.554582848750.00295777369457751.00.03294537751.00.033489980.0012255080.1006976-118.78322437.094
0.3827562244039.136979642588.656496222370.004453638377829.136979642588.656482898330.004453638377829.136979642588.656489743910.004453638377828.558906642598.077688300130.002581591766778.856600946758.375378895650.002600176894959.205530920738.724482677340.003500358587099.264190248048.783233212880.00332010117137751.00.03670608751.00.037281610.0027849440.1000531-118.78321066.406
0.428686927049.133734309488.835185452580.004999000806249.133734309488.835172069930.004999000806249.133734309488.835178945620.004999000806248.55679013038.257036846520.002893749561778.854399363788.554677301190.002925375464169.2030735128.903634833120.003926572337239.261683728098.962354139110.0037274845622751.00.03157353751.00.031694370.0041018680.0763388-131.03471552.7878
0.4801293646129.130090519028.987347385930.005613021821959.130090519028.987333935640.005613021821959.130090519028.987340846080.005613021821958.554423828418.409960031710.003244111082698.851938313038.707543159380.003293490867549.200309361369.056325912580.004406008731519.258875000099.115013970220.00418615142626751.00.0459753751.00.04578940.0041877390.09885563-139.22088701.1896
0.5377447955649.126001062579.123207260320.006304068011379.126001062579.123193732130.006304068011379.126001062579.123200682590.006304068011378.55178175478.546697117760.003636876135618.849189894388.844214736550.003709857747649.197200907819.192788507670.004944872385639.255729797629.251446754530.00470270411093751.00.03364832751.00.033512260.0041877390.06459846-139.22088458.2011
0.6022740444869.120975661639.248065712090.007059725339259.120975661639.248052090960.007059725339259.120975661639.248059089170.007059725339258.548576228928.672608712440.004061612886788.845844886788.970046563710.004164888863919.193340056689.318348592590.005535769216889.251844671179.376980581840.00526922907802751.00.01356818751.00.01350650.0079789880.02320845-140.5213486.5641
0.6745474149199.112933459139.364566894480.007777882101779.112933459139.364553146580.007777882101779.112933459139.364560209930.007777882101778.543433580328.790540182910.004506267369888.840537382359.087882259680.004637821825119.187035088179.435755597620.006141118467729.245499359619.494359650530.00584883938981751.00.01173457751.00.01175040.027251280.01780137-125.5789219.63034
..........................................................................................
194.94564396nan11.4281862721nan4.786198400511.49017166970.346530182352nan11.3985869499nannan11.0492935187nannan11.325663881nannan11.5322053867nannan11.5646533057nan751.0nan751.0nan0.5024965nan-127.30342nan
218.339144436nan11.4197092179nannan11.4875994462nannan11.3914275951nannan11.0436149683nannan11.3191210371nannan11.5235225271nannan11.5468149143nan751.0nan751.0nan0.5024965nan-127.30342nan
244.539869187nan11.4158041487nannan11.4851696814nannan11.3888655108nannan11.0387697697nannan11.3155728767nannan11.5200532941nannan11.5423791788nan751.0nan751.0nan0.5024965nan-127.30342nan
273.884642943nan11.4087563786nannan11.4797371173nannan11.3812538018nannan11.027217783nannan11.309208366nannan11.5116827744nannan11.5346942543nan751.0nan751.0nan0.5024965nan-127.30342nan
306.750785333nan11.418433437nannan11.4899590793nannan11.3967341568nannan11.0355639258nannan11.3222528039nannan11.5202304381nannan11.5397207399nan751.0nan751.0nan0.5024965nan-127.30342nan
343.5609091nan11.4222291429nannan11.4907156588nannan11.3993917218nannan11.0347770897nannan11.3218935688nannan11.5175636686nannan11.5326245939nan751.0nan751.0nan0.5024965nan-127.30342nan
384.788192883nan11.4200825997nannan11.4853173837nannan11.3956285382nannan11.0224892917nannan11.3103133579nannan11.511148411nannan11.5185275148nan751.0nan751.0nan0.5024965nan-127.30342nan
430.962761265nan11.4216625286nannan11.4816530948nannan11.3939259658nannan11.0180594151nannan11.3012965953nannan11.5084470036nannan11.5274762374nan751.0nan751.0nan0.5024965nan-127.30342nan
482.678275744nan11.4379003369nannan11.4874703902nannan11.4018567071nannan11.017027328nannan11.3003467082nannan11.5187897522nannan11.5526889726nan751.0nan751.0nan0.5024965nan-127.30342nan
540.599474796nan11.474951918nannan11.5110934881nannan11.4316616232nannan11.0689561312nannan11.3234369765nannan11.551126453nannan11.5857694797nan751.0nan751.0nan0.5024965nan-127.30342nan

In [50]:
refEllI = sbpExtract(redBCG, expID, expRed, 'HSC-I',
                     'redBCG', 'default', '3', 
                      extinction=0.1, amag_sun=amag_sun_des_i)


/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:31: RuntimeWarning: divide by zero encountered in log10

In [51]:
# Find certain profile 
# Reference profile in I-band 
expProfI = getEllipProfile(expID, redBCG, filter='HSC-I', 
                           rerun='largeR1', prefix='redBCG', 
                           stage='4')
# G-band force model 
expProfG = getEllipProfile(expID, redBCG, filter='HSC-G', 
                           rerun='largeR1', prefix='redBCG',
                           stage='4')

In [52]:
expProfG


Out[52]:
<Table length=69>
smaintensint_errpix_varrmsellell_errpapa_errx0x0_erry0y0_errgradgrad_errgrad_r_errrsmamagmag_lerrmag_uerrtflux_etflux_ctmag_etmag_cnpix_enpix_ca3a3_errb3b3_erra4a4_errb4b4_errndatanflagniterstopa_bigsareaa1a1_errb1b1_erra2a2_errb2b2_errpa_normsbpsbp_lowsbp_uppsma_asecrsma_asecavg_x0avg_y0avg_qavg_pagrowth_oriavg_bkggrowth_corrad_outermag_tot
float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64int64int64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64
0.013.423587643nannannannannannannan751.0nan751.0nan-0.7481309nannan0.051.18068nannannannannannannannannannannannannannannannan10nannannannannannannannannannannannannan20.3072217536nannan0.00.0751.0751.00.8030983-54.963470.0-0.0042876430.0420.07568493617.0778174422
0.516688913.0370376430.055146290.2811920.19883280.19690170.08722937-54.9634714.56556751.00.02660309751.00.02497277-0.73191051.5847492.1652230.847827151.212410.0046038990.00458443213.419313.419351.1806851.180681.01.00.013985060.058002960.025996020.07364693-0.091741590.1989447-0.12038010.2608591301.00.0nan2.0-0.00040520540.0040751760.0017576790.003938817-0.00082837510.0040362710.0016235430.003892629-54.9634720.338956247420.334371796320.34354069840.08680373520.542793456328751.0751.00.8030983-54.963470.0-0.0042876430.0420.07568493617.0778174422
0.578691512.9916676430.061609020.31414560.22213450.19690170.08645347-54.9634714.436751.00.02953043751.00.02772071-0.72826051.5804722.1702010.872191451.21620.0051627360.00513832713.419313.419351.1806851.180681.01.00.012980120.056585450.025388880.07249519-0.090954050.1976877-0.11947770.25949671301.00.0nan2.0-0.00045012730.0044919710.0019501210.004341666-0.00092019970.0044484340.0018011110.004290123-54.9634720.342742539120.337604244420.34788083380.0972201720.558391882592751.0751.00.8030983-54.963472.22543541111-0.0042876432.22617011453420.07568493617.0778174422
0.648134512.9411376430.06879160.35076970.24803160.19690170.08554836-54.9634714.28486751.00.03272782751.00.03072215-0.72430361.5755352.1752410.897255851.220430.0057893130.00575755213.419313.419351.1806851.180681.01.00.011868730.055040860.024667570.07111228-0.089997850.1960614-0.1184320.25782051301.00.0nan2.0-0.00049946330.0049426220.0021626570.004777238-0.0010210170.0048938570.0019972420.004719695-54.9634720.346975052120.34121695420.35273315020.1088865960.574438587043751.0751.00.8030983-54.963475.00616378133-0.0042876435.00782009786420.07568493617.0778174422
0.725910712.8848376430.076794320.39157580.27688590.19690170.08459206-54.9634714.12518751.00.03624541751.00.03402417-0.71935081.5700442.1825850.923040651.225160.0064918910.0064547113.419313.419351.1806851.180681.01.00.010612880.053401990.02392690.06972072-0.089009370.1945589-0.11731520.25624841301.00.0nan2.0-0.0005533060.0054193420.0023920460.005238007-0.0011310710.0053647870.0022087540.005173866-54.9634720.351710389120.345256409720.35816436850.12195299760.590946438952751.0751.00.8030983-54.963478.47913134312-0.0042876438.4819437318420.07568493617.0778174422
0.813019912.8222176430.085692380.43694710.30896820.19690170.08345659-54.9634713.93558751.00.04004996751.00.03759556-0.71427631.5639262.1895250.949566351.230460.0072828280.00723445213.419313.419351.1806851.180681.01.00.0091727410.05159390.023073540.06807239-0.087808280.192541-0.11596760.25410751301.00.0nan2.0-0.00061200870.0059334770.0026412730.005734938-0.001251070.0058725650.002438520.005663574-54.9634720.357001669820.349767295920.36423604370.13658734320.607928654778751.0751.00.8030983-54.9634712.8144351318-0.00428764312.8186976949420.07568493617.0778174422
0.910582312.7525676430.095584190.48738570.34463370.19690170.08222852-54.9634713.73052751.00.04419589751.00.04148743-0.70825251.5571682.1986060.976854351.236370.008171850.00810969213.419313.419351.1806851.180681.01.00.007545340.049732130.022075190.06619244-0.086500090.1904557-0.11451610.25196441301.00.0nan2.0-0.0006761310.006477070.0029134970.006260342-0.0013821050.0064089750.0026894170.006180894-54.9634720.362917424520.354807146820.37102770220.15297782640.625398912157751.0751.00.8030983-54.9634718.2230952105-0.00428764318.2291768742420.07568493617.0778174422
1.01985212.6752476430.10655490.54332560.38418920.19690170.07681096-54.9634712.82589751.00.04623817751.00.04340455-0.73820421.5483532.0974591.00492751.242980.009168250.00909293313.419364.3654651.1806849.478371.05.00.0054105510.045297250.019891720.05927128-0.080779770.1697016-0.10722440.22508241301.00.0nan2.0-0.00074542810.0070464820.0032059570.006810701-0.0015237240.0069704470.0029588070.006722384-54.9634720.369522608820.360430418520.37861479910.1713351360.643371188527751.0751.00.8030983-54.9634724.9665566034-0.00428764324.9749201428420.07568493617.0778174422
1.14223412.5820676430.11818180.60261110.42611040.19690170.048508-54.963478.099865751.00.0327046751.00.03070035-1.0618011.5231611.4345071.03380551.250990.010249960.0101540338.8220264.3654650.0273149.478373.05.00.0036395890.028286960.010070510.03034828-0.046263240.06680779-0.069537730.10001931301.00.0nan2.0-0.0007758670.0091417930.0037742040.008835902-0.0015793620.0090656590.0035084930.008743032-54.9634720.377536423320.367382391120.38769045550.1918953120.661859933389751.0751.00.8030983-54.9634733.3633425921-0.00428764333.3745685143420.07568493617.0778174422
1.27930312.4340076430.1296430.66105220.46743450.19690170.03102312-54.963475.180241751.00.02342605751.00.02199042-1.2508221.4875231.1892371.06351451.263850.011384610.0112649264.3654664.3654649.4783749.478375.05.00.0063685460.01871550.015050530.02429643-0.020328250.02647956-0.036094470.044137411301.00.0nan2.0-0.0003869240.017118770.0017966030.01654596-0.00079115150.017128690.0016739620.01651911-54.9634720.390393044820.379127376320.40165871320.2149229040.680880152865751.0751.00.8030983-54.9634743.7723730288-0.00428764343.7871895553420.07568493617.0778174422
.............................................................................................................................................................................................
369.72130.00332735830.0012287630.29392130.012591070.19690170.001027538-54.963470.1649033751.00.2158223751.00.2066246-0.00536871nannan4.3849954.0nan-8.9277288168.7238121.3644.2196144.22593237537.0273660.0-0.0013893050.001259809-0.0010870630.0010534290.0023151530.001910421-0.0029645030.002415446105211.00.0nan544.92490.00020813270.0009502087-0.0004900180.0008885718-0.00037039520.00091984190.00014806160.0009219435-54.96347nannannan62.11317842.80734597668751.0751.00.8030983-54.963477829.63905578-0.0042876439308.35682498420.07568493617.0778174422
414.0879-0.0006954360.0007002290.18632590.0072092980.19690170.0003895594-54.963470.07134023751.00.09976539751.00.09443592-0.006710888nannan4.51100354.0nannan7924.787731.69544.2525344.27931285945.0323878.0-0.00014074370.00026980220.00011112980.00027969440.0008539180.0007201346-0.00064262850.0005663996106201.00.0nan667.9753-5.349943e-060.0006717069-3.631215e-050.0006342503-0.00086894360.0006850827-0.00021222220.0006039441-54.96347nannannan69.56676722.88802172248751.0751.00.8030983-54.963477392.4363344-0.0042876439247.34103299420.07568493617.0778174422
463.7785-0.0008865330.00065103410.17840210.0064119430.19690170.0002513488-54.963470.04451758751.00.07048894751.00.0678447-0.00838861nannan4.64063754.0nannan7604.2567325.34544.2973644.33793330683.0385870.00.00012386150.00018899550.00016776280.00020915830.0004641950.0003994905-0.00019932160.000222605197291.00.0nan774.1419-0.00023778170.0006279415-0.00016363730.0005649051-0.0005012410.00061398334.899858e-050.0005599456-54.96347nannannan77.9147882.97101588157751.0751.00.8030983-54.963476822.9773567-0.0042876439149.77106709420.07568493617.0778174422
519.4319-0.0012833390.0004903970.15195450.004829850.19690170.0001524995-54.963470.02645401751.00.04778897751.00.04602357-0.01048576nannan4.77399754.0nannan7174.1646790.23344.3605744.42029394608.0476792.02.569088e-059.922929e-050.00011103940.00013030780.00017038970.0001640098-9.446853e-050.000122732797291.00.0nan989.82761.758438e-050.0005532587-8.402974e-050.0004936912-0.00026598430.0005306179-1.1314e-060.0004932876-54.96347nannannan87.26455923.05639495971751.0751.00.8030983-54.963476053.86728287-0.0042876438972.59782312420.07568493617.0778174422
581.76370.0007511880.00049113210.2115890.0054469180.19690170.0001205737-54.963470.01933191751.00.0409044751.00.03799733-0.0131072nannan4.91118954.0nannan6644.0456106.24844.4439244.53556485849.0601652.00.0002107780.0001832682-7.035003e-059.057331e-050.00015690150.0001434254-4.036058e-057.729668e-0512331.00.0nan1508.984-2.194664e-050.0005323905-1.118573e-050.0005322502-1.448179e-050.00053062824.465664e-050.0005339847-54.96347nannannan97.73630163.14422759744751.0751.00.8030983-54.963475441.43108526-0.0042876439102.68705723420.07568493617.0778174422
651.5754-0.000193390.00036454010.17072110.0039431040.19690177.122809e-05-54.963470.01067819751.00.02618124751.00.02427057-0.016384nannan5.05232454.0nannan6140.9585172.72344.5294144.7157611719.0771929.02.505228e-054.611626e-05-6.471478e-056.657118e-059.201097e-058.312103e-050.00010424629.276321e-0511791.00.0nan1874.5544.907138e-050.00042113175.186852e-060.00042362272.593529e-060.0004087692-4.729869e-050.0004374532-54.96347nannannan109.46466723.23458441929751.0751.00.8030983-54.963474467.99501408-0.0042876439060.67602946420.07568493617.0778174422
729.7644-0.0008254950.00037277870.19663840.0040494130.19690174.422847e-05-54.963470.006703404751.00.01864387751.00.01694255-0.02048nannan5.19751454.0nannan5388.4863984.85244.6713344.99897764257.0975342.08.707419e-062.64781e-05-3.345676e-053.791339e-053.731946e-053.614966e-050.00016918760.000137001911881.00.0nan2358.047-1.380428e-050.00030097150.00014478780.0003206139-6.689871e-060.00030087630.00025666360.000318837-54.96347nannannan122.60041923.32753773207751.0751.00.8030983-54.963473074.67050245-0.0042876438835.72954498420.07568493617.0778174422
817.3361-0.0002906580.00049482140.24079950.0043980690.19690173.393032e-05-54.963470.006536432751.00.01916191751.00.01636629-0.0256nannan5.34687754.0nannan4443.4663366.08144.880745.18219958504.01147648.0-2.120545e-052.917303e-05-1.254742e-062.10825e-054.107604e-061.437806e-050.00015028690.000121294979471.00.0nan2997.693-0.00015105670.00027841677.009569e-050.000366383-0.00031197730.00034554080.00043976890.0002890384-54.96347nannannan137.31246483.42316230163751.0751.00.8030983-54.963471509.70334331-0.0042876438736.37604583420.07568493617.0778174422
915.41640.0001201550.00057878360.21988530.0035678620.19690173.042025e-05-54.963470.0093966751.00.02595961751.00.02029341-0.032nannan5.50053254.0nannan3693.6413334.65545.0813645.192371124838.01231724.0-1.701946e-052.253465e-05-4.967225e-054.435619e-052.050454e-052.467015e-051.693193e-052.267853e-0538881.01.0nan3798.1860.0001390250.00042820130.0002819050.00083215980.00038808790.00089800860.00020346880.0004692184-54.96347nannannan153.78995523.52153486596751.0751.00.8030983-54.96347nan-0.0042876438787.89638895420.07568493617.0778174422
1025.2660.0017215390.00093585970.26634180.0038586480.19690174.881437e-06-54.963470.0008147287751.00.0007331733751.00.0006891407-0.04nannan5.65860354.0nannan3349.1713385.7345.1876645.175871231375.01278519.02.051378e-052.870369e-05-0.00011438859.975964e-056.519615e-055.715359e-05-3.916408e-053.638704e-05171091.01.0nan4764.40.00014448660.00076405470.0019103380.003978546-0.00014624220.001953813-6.090891e-050.0007606981-54.96347nannannan172.2446883.62273410227751.0751.00.8030983-54.96347nan-0.0042876439713.84821423420.07568493617.0778174422

In [53]:
rKpcI, muI, lumI, muErrI = correctProf(expProfI, expRed, 
                                       extinction=0.10, zp=27.0, 
                                       amag_sun=amag_sun_des_i, 
                                       dimming=True, corCurve=True, 
                                       verbose=False, m2l=None)
rKpcG, muG, lumG, muErrG = correctProf(expProfG, expRed, 
                                       extinction=0.25, zp=27.0, 
                                       amag_sun=amag_sun_des_i, 
                                       dimming=True, corCurve=True, 
                                       verbose=False, m2l=None)


/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:31: RuntimeWarning: divide by zero encountered in log10

In [55]:
ax1 = plt.subplot(1,1,1)
ax1.plot(rKpcI**0.25, muI, c='r', linewidth=5)
ax1.fill_between(rKpcI**0.25, 
                 (muI + muErrI), 
                 (muI - muErrI),
                 facecolor='r', 
                 alpha=0.2)

ax1.plot(rKpcG**0.25, muG, c='b', linewidth=5)
ax1.fill_between(rKpcG**0.25, 
                 (muG + muErrG), 
                 (muG - muErrG),
                 facecolor='b', 
                 alpha=0.2)
ax1.set_ylim(4.2, 9.5)


Out[55]:
(4.2, 9.5)

In [118]:
giColor, giErr = (muI - muG), errAdd(muErrG, muErrI)
plt.plot(rKpcG**0.25, giColor, c='r', linewidth=5)
plt.fill_between(rKpcG**0.25, 
                 (giColor + giErr), 
                 (giColor - giErr),
                 facecolor='r', 
                 alpha=0.2)
plt.xlim(1.0, 3.2)
plt.ylim(0.4, 0.8)


Out[118]:
(0.4, 0.8)

redMapper Catalog


In [29]:
# The input cata
tabDir = '/Users/songhuang/work/hscs/gama_compare/redmapper/'
## Cat 1: Includes all 280 clusters
redCat1 = os.path.join(tabDir, 'hsc_redmapper_cluster_1509.fits')
## Cat 2: HSC matched ones in GAMA; with stellar mass from SED fitting. 
redCat2 = os.path.join(tabDir, 'hsc_redmapper_cluster_gama_1509_mass.fits')

redData1 = Table.read(redCat1, format='fits')
redData2 = Table.read(redCat2, format='fits')


WARNING: UnitsWarning: 'dex' did not parse as fits unit: At col 0, Unit 'dex' not supported by the FITS standard.  [astropy.units.core]
WARNING:astropy:UnitsWarning: 'dex' did not parse as fits unit: At col 0, Unit 'dex' not supported by the FITS standard. 

In [32]:
'RA' in redData1.colnames


Out[32]:
False

In [93]:
## Add HSC 5-band extinction information 
extG = getExtinction(redData1['RA_BCG'], redData1['DEC_BCG'], 
                     a_lambda=a_hsc_g)
extR = getExtinction(redData1['RA_BCG'], redData1['DEC_BCG'], 
                     a_lambda=a_hsc_r)
extI = getExtinction(redData1['RA_BCG'], redData1['DEC_BCG'], 
                     a_lambda=a_hsc_i)
extZ = getExtinction(redData1['RA_BCG'], redData1['DEC_BCG'], 
                     a_lambda=a_hsc_z)
extY = getExtinction(redData1['RA_BCG'], redData1['DEC_BCG'], 
                     a_lambda=a_hsc_y)

In [94]:
c1 = Column(name='a_g', data=extG)
c2 = Column(name='a_r', data=extR)
c3 = Column(name='a_i', data=extI)
c4 = Column(name='a_z', data=extZ)
c5 = Column(name='a_y', data=extY)

In [95]:
redData1.add_columns([c1, c2, c3, c4, c5])

In [96]:
print(redData1.colnames)


['ID_CLUSTER', 'NAME', 'RA_BCG', 'DEC_BCG', 'Z_LAMBDA', 'Z_LAMBDA_ERR', 'LAMBDA_CLUSTER', 'LAMBDA_ERR_CLUSTER', 'S_CLUSTER', 'Z_SPEC_BCG', 'OBJID_BCG', 'IMAG_BCG', 'IMAG_ERR_BCG', 'MODEL_MAG_u_BCG', 'MODEL_MAG_g_BCG', 'MODEL_MAG_r_BCG', 'MODEL_MAG_i_BCG', 'MODEL_MAG_z_BCG', 'MODEL_MAGERR_u_BCG', 'MODEL_MAGERR_g_BCG', 'MODEL_MAGERR_r_BCG', 'MODEL_MAGERR_i_BCG', 'MODEL_MAGERR_z_BCG', 'ILUM_BCG', 'PZBINS_1', 'PZBINS_2', 'PZBINS_3', 'PZ_1', 'PZ_2', 'PZ_3', 'P_CEN_1', 'P_CEN_2', 'P_CEN_3', 'P_CEN_4', 'P_CEN_5', 'RA_CEN_1', 'RA_CEN_2', 'RA_CEN_3', 'RA_CEN_4', 'RA_CEN_5', 'DEC_CEN_1', 'DEC_CEN_2', 'DEC_CEN_3', 'DEC_CEN_4', 'DEC_CEN_5', 'ID_CEN_1', 'ID_CEN_2', 'ID_CEN_3', 'ID_CEN_4', 'ID_CEN_5', 'a_g', 'a_r', 'a_i', 'a_z', 'a_y']

In [97]:
print(redData2.colnames)


['ID_CLUSTER', 'NAME', 'RA_BCG', 'DEC_BCG', 'Z_LAMBDA', 'Z_LAMBDA_ERR', 'LAMBDA_CLUSTER', 'LAMBDA_ERR_CLUSTER', 'S_CLUSTER', 'Z_SPEC_BCG', 'OBJID_BCG', 'IMAG_BCG', 'IMAG_ERR_BCG', 'MODEL_MAG_u_BCG', 'MODEL_MAG_g_BCG', 'MODEL_MAG_r_BCG', 'MODEL_MAG_i_BCG', 'MODEL_MAG_z_BCG', 'MODEL_MAGERR_u_BCG', 'MODEL_MAGERR_g_BCG', 'MODEL_MAGERR_r_BCG', 'MODEL_MAGERR_i_BCG', 'MODEL_MAGERR_z_BCG', 'ILUM_BCG', 'PZBINS_1', 'PZBINS_2', 'PZBINS_3', 'PZ_1', 'PZ_2', 'PZ_3', 'P_CEN_1', 'P_CEN_2', 'P_CEN_3', 'P_CEN_4', 'P_CEN_5', 'RA_CEN_1', 'RA_CEN_2', 'RA_CEN_3', 'RA_CEN_4', 'RA_CEN_5', 'DEC_CEN_1', 'DEC_CEN_2', 'DEC_CEN_3', 'DEC_CEN_4', 'DEC_CEN_5', 'ID_CEN_1', 'ID_CEN_2', 'ID_CEN_3', 'ID_CEN_4', 'ID_CEN_5', 'ra_hsc', 'dec_hsc', 'tract', 'patch', 'id', 'parent', 'a_g', 'a_r', 'a_i', 'a_z', 'a_y', 'imag_aperture01', 'imag_aperture02', 'imag_aperture03', 'imag_aperture04', 'imag_aperture05', 'imag_aperture06', 'imag_aperture07', 'imag_aperture08', 'imag_aperture09', 'gmag_psf', 'gmag_psf_err', 'rmag_psf', 'rmag_psf_err', 'imag_psf', 'imag_psf_err', 'zmag_psf', 'zmag_psf_err', 'ymag_psf', 'ymag_psf_err', 'gmag_kron', 'gmag_kron_err', 'rmag_kron', 'rmag_kron_err', 'imag_kron', 'imag_kron_err', 'zmag_kron', 'zmag_kron_err', 'ymag_kron', 'ymag_kron_err', 'gmag_cmodel', 'gmag_cmodel_err', 'gmag_cmodel_exp', 'gmag_cmodel_exp_err', 'gmag_cmodel_dev', 'gmag_cmodel_dev_err', 'rmag_cmodel', 'rmag_cmodel_err', 'rmag_cmodel_exp', 'rmag_cmodel_exp_err', 'rmag_cmodel_dev', 'rmag_cmodel_dev_err', 'imag_cmodel', 'imag_cmodel_err', 'imag_cmodel_exp', 'imag_cmodel_exp_err', 'imag_cmodel_dev', 'imag_cmodel_dev_err', 'zmag_cmodel', 'zmag_cmodel_err', 'zmag_cmodel_exp', 'zmag_cmodel_exp_err', 'zmag_cmodel_dev', 'zmag_cmodel_dev_err', 'ymag_cmodel', 'ymag_cmodel_err', 'ymag_cmodel_exp', 'ymag_cmodel_exp_err', 'ymag_cmodel_dev', 'ymag_cmodel_dev_err', 'if_classification_extendedness', 'if_flags_pixel_edge', 'if_flags_pixel_interpolated_center', 'if_flags_pixel_saturated_center', 'if_centroid_naive_flags', 'if_centroid_sdss_flags', 'if_flux_aperture_flags', 'if_flux_kron_flags', 'if_cmodel_flux_flags', 'if_shape_sdss_flags', 'if_countinputs', 'if_cmodel_fracdev', 'if_cmodel_objective', 'im_mag_kron_1', 'im_mag_kron_1a', 'im_mag_cmodel', 'im_mag_cmodel_err', 'im_mag_cmodel_exp', 'im_mag_cmodel_dev', 'im_cmodel_flux', 'im_cmodel_flux_err', 'im_cmodel_exp_flux', 'im_cmodel_exp_flux_err', 'im_cmodel_dev_flux', 'im_cmodel_dev_flux_err', 'im_deblend_blendedness', 'im_cmodel_exp_ixx', 'im_cmodel_exp_iyy', 'im_cmodel_exp_ixy', 'im_cmodel_dev_ixx', 'im_cmodel_dev_iyy', 'im_cmodel_dev_ixy', 'im_cmodel_fracdev', 'im_cmodel_objective', 'im_classification_extendedness', 'im_flux_kron_flags', 'im_cmodel_flux_flags', 'im_shape_sdss_flags', 'im_detect_is_patch_inner', 'im_detect_is_tract_inner', 'im_detect_is_primary', 'im_merge_peak_g', 'im_merge_peak_r', 'im_merge_peak_i', 'im_merge_peak_z', 'im_merge_peak_y', 'im_merge_footprint_g', 'im_merge_footprint_r', 'im_merge_footprint_i', 'im_merge_footprint_z', 'im_merge_footprint_y', 'ir_deblend_blendedness', 'ir_deblend_has_stray_flux', 'ir_deblend_masked', 'ir_deblend_parent_too_big', 'ir_deblend_skipped', 'ir_deblend_too_many_peaks', 'ir_deblend_as_psf', 'ir_detect_is_patch_inner', 'ir_detect_is_tract_inner', 'ir_detect_is_primary', 'ir_merge_measurement_g', 'ir_merge_measurement_r', 'ir_merge_measurement_i', 'ir_merge_measurement_z', 'ir_merge_measurement_y', 'ra_gama', 'dec_gama', 'gama_id', 'gama_name', 'n_spec', 'n_gama_spec', 'gama_specid', 'survey', 'survey_code', 'z_gama', 'z_use', 'zquality_gama', 'z_tonry_gama', 'zprob_gama', 'objid_dr6', 'nbands', 'logms_gama', 'logms_err_gama', 'logm2l_i_gama', 'logm2l_i_err_gama', 'gi_rest_sed', 'gi_rest_sed_err', 'ur_rest_sed', 'ur_rest_sed_err', 'gi_rest_star', 'ur_rest_star', 'GAL_MAG_R', 'GAL_RE_R', 'GAL_INDEX_R', 'GAL_ELLIP_R', 'GAL_PA_R', 'GAL_MAG_ERR_R', 'GAL_RE_ERR_R', 'GAL_ELLIP_ERR_R', 'GAL_PA_ERR_R', 'GAL_MAG_I', 'GAL_RE_I', 'GAL_INDEX_I', 'GAL_ELLIP_I', 'GAL_PA_I', 'GAL_MAG_ERR_I', 'GAL_RE_ERR_I', 'GAL_INDEX_ERR_I', 'GAL_ELLIP_ERR_I', 'GAL_PA_ERR_I', 'ra_sdss', 'dec_sdss', 'objid_dr12', 'specobjid_dr12', 'plate', 'mjd', 'fiberid', 'ra_fib', 'dec_fib', 'ra_err_sdss', 'dec_err_sdss', 'z_sdss', 'z_err_sdss', 'veldisp', 'veldisp_err', 'cmodelMag_u', 'cmodelMagErr_u', 'cmodelMag_g', 'cmodelMagErr_g', 'cmodelMag_r', 'cmodelMagErr_r', 'cmodelMag_i', 'cmodelMagErr_i', 'cmodelMag_z', 'cmodelMagErr_z', 'modelMag_u', 'modelMagErr_u', 'modelMag_g', 'modelMagErr_g', 'modelMag_r', 'modelMagErr_r', 'modelMag_i', 'modelMagErr_i', 'modelMag_z', 'modelMagErr_z', 'petroMag_u', 'petroMagErr_u', 'petroMag_g', 'petroMagErr_g', 'petroMag_r', 'petroMagErr_r', 'petroMag_i', 'petroMagErr_i', 'petroMag_z', 'petroMagErr_z', 'model_gr', 'model_gi', 'fracDev_r', 'fracDev_i', 'devRad_r', 'devRad_i', 'devAB_r', 'devAB_i', 'devRadErr_r', 'devABErr_r', 'expRad_r', 'expRad_i', 'expAB_r', 'expAB_i', 'expRadErr_r', 'expABErr_r', 'petroR50_r', 'petroR90_r', 'petroR50Err_r', 'petroR90Err_r', 'petroR50_i', 'petroR90_i', 'petroR50Err_i', 'petroR90Err_i', 'mE1_r', 'mE1_i', 'mE2_r', 'mE2_i', 'nchild', 'extinction_u', 'extinction_g', 'extinction_r', 'extinction_i', 'extinction_z', 'deVFlux_u', 'deVFlux_g', 'deVFlux_r', 'deVFlux_i', 'deVFlux_z', 'deVFluxIvar_u', 'deVFluxIvar_g', 'deVFluxIvar_r', 'deVFluxIvar_i', 'deVFluxIvar_z', 'expFlux_u', 'expFlux_g', 'expFlux_r', 'expFlux_i', 'expFlux_z', 'expFluxIvar_u', 'expFluxIvar_g', 'expFluxIvar_r', 'expFluxIvar_i', 'expFluxIvar_z', 'modelFlux_u', 'modelFlux_g', 'modelFlux_r', 'modelFlux_i', 'modelFlux_z', 'modelFluxIvar_u', 'modelFluxIvar_g', 'modelFluxIvar_r', 'modelFluxIvar_i', 'modelFluxIvar_z', 'cmodelFlux_u', 'cmodelFlux_g', 'cmodelFlux_r', 'cmodelFlux_i', 'cmodelFlux_z', 'cmodelFluxIvar_u', 'cmodelFluxIvar_g', 'cmodelFluxIvar_r', 'cmodelFluxIvar_i', 'cmodelFluxIvar_z', 'logms_pca', 'logms_err_pca', 'cModelAbsMag_u', 'cModelAbsMag_g', 'cModelAbsMag_r', 'cModelAbsMag_i', 'cModelAbsMag_z', 'logms_gran', 'logms_err_gran', 'm2l_u', 'm2l_g', 'm2l_r', 'm2l_i', 'm2l_z', 'Separation_1', 'ISEDFIT_ID', 'RA', 'DEC', 'Z', 'MAGGIES', 'IVARMAGGIES', 'BESTMAGGIES', 'CHUNKINDX', 'MODELINDX', 'DELAYED', 'BURSTTYPE', 'CHI2', 'TOTALMASS', 'TOTALMASS_ERR', 'MSTAR', 'AGE', 'SFRAGE', 'TAU', 'ZMETAL', 'AV', 'MU', 'OIIIHB', 'NLYC', 'SFR', 'SFR100', 'B100', 'B1000', 'EWOII', 'EWOIIIHB', 'EWNIIHA', 'NBURST', 'TRUNCTAU', 'TBURST', 'DTBURST', 'FBURST', 'MSTAR_50', 'AGE_50', 'SFRAGE_50', 'TAU_50', 'ZMETAL_50', 'AV_50', 'MU_50', 'OIIIHB_50', 'SFR_50', 'SFR100_50', 'B100_50', 'B1000_50', 'EWOII_50', 'EWOIIIHB_50', 'EWNIIHA_50', 'MSTAR_AVG', 'AGE_AVG', 'SFRAGE_AVG', 'TAU_AVG', 'ZMETAL_AVG', 'AV_AVG', 'MU_AVG', 'OIIIHB_AVG', 'SFR_AVG', 'SFR100_AVG', 'B100_AVG', 'B1000_AVG', 'EWOII_AVG', 'EWOIIIHB_AVG', 'EWNIIHA_AVG', 'MSTAR_ERR', 'AGE_ERR', 'SFRAGE_ERR', 'TAU_ERR', 'ZMETAL_ERR', 'AV_ERR', 'MU_ERR', 'OIIIHB_ERR', 'SFR_ERR', 'SFR100_ERR', 'B100_ERR', 'B1000_ERR', 'EWOII_ERR', 'EWOIIIHB_ERR', 'EWNIIHA_ERR', 'fluxscale_gama', 'age_gama', 'ageerr_gama', 'Separation']

Necessary information includes:

  1. ID: ID_CLUSTER
  2. RA, DEC: RA_BCG, DEC_BCG
  3. Redshift: Z_LAMBDA

In [113]:
colTemp = (np.asarray(redData2['Z_LAMBDA']) * 0.0 - 9999.0)
newRedCat = copy.deepcopy(redData2)

col1 = Column(name='ilum_max', data=colTemp)
col2 = Column(name='ilum_100', data=colTemp)
col3 = Column(name='ilum_50', data=colTemp)
col4 = Column(name='ilum_25', data=colTemp)
col5 = Column(name='ilum_10', data=colTemp)

col6 = Column(name='glum_hsc', data=colTemp)
col7 = Column(name='rlum_hsc', data=colTemp)
col8 = Column(name='ilum_hsc', data=colTemp)
col9 = Column(name='zlum_hsc', data=colTemp)
col10 = Column(name='ylum_hsc', data=colTemp)
newRedCat.add_columns([col1, col2, col3, col4, col5, 
                       col6, col7, col8, col9, col10])

In [34]:
ellRed = []

with ProgressBar(len(redData2), ipython_widget=True) as bar:
    
    print('# Will deal with %d galaxies' % len(redData2))
    for (i, galaxy) in enumerate(redData2): 
        
        """ For red BCG """
        loc = redBCG 
    
        """ ID, Z, RA, DEC """
        galID = galaxy['ID_CLUSTER']
        redshift = galaxy['Z_LAMBDA']

        """ Location and Table name """
        sumDir = os.path.join(loc, 'sum')
        sumTab = str(galID) + '_sbp_sum.fits'
        if not os.path.exists(loc): 
            os.mkdir(sumDir, exist_ok=True)
        sumTable = os.path.join(sumDir, sumTab)

        ellTab = sbpCollect(loc, galID, redshift, 
                            prefix='redBCG', save=False, 
                            a_g=galaxy['a_g'], a_r=galaxy['a_r'],
                            a_i=galaxy['a_i'], a_z=galaxy['a_z'],
                            a_y=galaxy['a_y'])
        if ellTab is not None:
            
            """ Radius KPc """
            rKpc = ellTab['rKpc']
            """ Maximum i-band luminosity """
            maxLumI1 = np.nanmax(ellTab['lumI1'])
            ellTab.meta['ILUM_MAX'] = maxLumI1.astype(np.float32)
            ellTab.meta['ILUM_100'] = np.nanmax(ellTab['lumI1'][rKpc <= 100.0])
            ellTab.meta['ILUM_50'] = np.nanmax(ellTab['lumI1'][rKpc <= 50.0])
            ellTab.meta['ILUM_25'] = np.nanmax(ellTab['lumI1'][rKpc <= 25.0])
            ellTab.meta['ILUM_10'] = np.nanmax(ellTab['lumI1'][rKpc <= 10.0])

            """ Update the metadata """
            ellTab.meta['RA'] = galaxy['RA_BCG'].astype(np.float32)
            ellTab.meta['DEC'] = galaxy['DEC_BCG'].astype(np.float32)
    
            """ STELLAR MASS FROM OTHER WORKS """
            if np.isfinite(galaxy['logms_gama'].astype(np.float32)):
                ellTab.meta['LOGM1'] = galaxy['logms_gama'].astype(np.float32)
            else: 
                ellTab.meta['LOGM1'] = -9999.0
                
            if np.isfinite(galaxy['logms_err_gama'].astype(np.float32)):
                ellTab.meta['LOGM1E'] = galaxy['logms_err_gama'].astype(np.float32)
            else: 
                ellTab.meta['LOGM1E'] = -9999.0
    
            """ STELLAR MASS FROM ISEDFIT """
            ellTab.meta['LOGM2'] = galaxy['MSTAR'].astype(np.float32)
            ellTab.meta['LOGM2E'] = galaxy['MSTAR_ERR'].astype(np.float32)
    
            """ HSC CMODEL MAG (EXTINCTION CORRECTED) """
            gmag_hsc = (galaxy['gmag_cmodel'] - galaxy['a_g']).astype(np.float32)
            rmag_hsc = (galaxy['rmag_cmodel'] - galaxy['a_r']).astype(np.float32)
            imag_hsc = (galaxy['imag_cmodel'] - galaxy['a_i']).astype(np.float32)
            zmag_hsc = (galaxy['zmag_cmodel'] - galaxy['a_z']).astype(np.float32)
            ymag_hsc = (galaxy['ymag_cmodel'] - galaxy['a_y']).astype(np.float32)
        
            ellTab.meta['GCMOD_HSC'] = gmag_hsc
            ellTab.meta['RCMOD_HSC'] = rmag_hsc
            ellTab.meta['ICMOD_HSC'] = imag_hsc
            ellTab.meta['ZCMOD_HSC'] = zmag_hsc
            ellTab.meta['YCMOD_HSC'] = ymag_hsc
            
            glum_hsc = getLuminosity(gmag_hsc, redshift, amag_sun=amag_sun_des_g)
            rlum_hsc = getLuminosity(rmag_hsc, redshift, amag_sun=amag_sun_des_r)
            ilum_hsc = getLuminosity(imag_hsc, redshift, amag_sun=amag_sun_des_i)
            zlum_hsc = getLuminosity(zmag_hsc, redshift, amag_sun=amag_sun_des_z)
            ylum_hsc = getLuminosity(ymag_hsc, redshift, amag_sun=amag_sun_des_y)

            """ HSC CMODEL LUMINOSITY """
            ellTab.meta['GLUM_HSC'] = glum_hsc
            ellTab.meta['RLUM_HSC'] = rlum_hsc
            ellTab.meta['ILUM_HSC'] = ilum_hsc
            ellTab.meta['ZLUM_HSC'] = zlum_hsc
            ellTab.meta['YLUM_HSC'] = ylum_hsc
            
            ellTab.write(sumTable, format='fits', overwrite=True)
            
            ## Pass it to table 
            newRedCat['ilum_max'][i] = ellTab.meta['ILUM_MAX']
            newRedCat['ilum_100'][i] = ellTab.meta['ILUM_100']
            newRedCat['ilum_50'][i] = ellTab.meta['ILUM_50']
            newRedCat['ilum_25'][i] = ellTab.meta['ILUM_25']
            newRedCat['ilum_10'][i] = ellTab.meta['ILUM_10']
            newRedCat['glum_hsc'][i] = glum_hsc
            newRedCat['rlum_hsc'][i] = rlum_hsc
            newRedCat['ilum_hsc'][i] = ilum_hsc
            newRedCat['zlum_hsc'][i] = zlum_hsc
            newRedCat['ylum_hsc'][i] = ylum_hsc
            
            """"""
            ellRed.append(ellTab)
        else: 
            warnings.warn('### NO USEFUL DATA FOR %i' % galID)
            
        bar.update()
               
# Save a new table 
newRedCat.write(os.path.join(redBCG, 'redBCG_new.fits'), format='fits', 
                overwrite=True)


# Will deal with 159 galaxies

---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-34-b99e5225cec4> in <module>()
     24                             a_g=galaxy['a_g'], a_r=galaxy['a_r'],
     25                             a_i=galaxy['a_i'], a_z=galaxy['a_z'],
---> 26                             a_y=galaxy['a_y'])
     27         if ellTab is not None:
     28 

<ipython-input-23-ef58898dccea> in sbpCollect(loc, galID, redshift, prefix, a_g, a_r, a_i, a_z, a_y, suffix, m2l_g, m2l_r, m2l_i, m2l_z, m2l_y, verbose, save)
     29                          prefix, 'default', '3',
     30                          extinction=a_i, m2l=m2l_i,
---> 31                          amag_sun=amag_sun_des_i)
     32     if refEllI is not None:
     33         """ Reference profile in I-band """

<ipython-input-22-4b0308878605> in sbpExtract(loc, galID, redshift, filter, prefix, rerun, stage, suffix, zp, extinction, amag_sun, m2l, origin)
     11     prof = getEllipProfile(galID, loc, filter=filter, 
     12                            rerun=rerun, prefix=prefix,
---> 13                            stage=stage, suffix=suffix)
     14     if prof is not None:
     15         ell = correctProf(prof, redshift, 

<ipython-input-19-baf9905f8620> in getEllipProfile(galid, base, filter, rerun, prefix, suffix, stage, verbose)
     19     ellFile = os.path.join(location, ellFile)
     20 
---> 21     if not os.path.isfile(ellFile):
     22         if verbose:
     23             warnings.warn('!!! Can not find the Ellipse profile ! %s' % 

/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/genericpath.pyc in isfile(path)
     35     """Test whether a path is a regular file"""
     36     try:
---> 37         st = os.stat(path)
     38     except os.error:
     39         return False

KeyboardInterrupt: 

GAMA non-BCG Catalog


In [115]:
gamaCat = os.path.join(nonBCG, 'massive_nonBCG_test.fits')

gamaData = Table.read(gamaCat, format='fits')

In [117]:
print(gamaData.colnames)


['ISEDFIT_ID', 'RA', 'DEC', 'Z', 'MAGGIES', 'IVARMAGGIES', 'BESTMAGGIES', 'CHUNKINDX', 'MODELINDX', 'DELAYED', 'BURSTTYPE', 'CHI2', 'TOTALMASS', 'TOTALMASS_ERR', 'MSTAR', 'AGE', 'SFRAGE', 'TAU', 'ZMETAL', 'AV', 'MU', 'OIIIHB', 'NLYC', 'SFR', 'SFR100', 'B100', 'B1000', 'EWOII', 'EWOIIIHB', 'EWNIIHA', 'NBURST', 'TRUNCTAU', 'TBURST', 'DTBURST', 'FBURST', 'MSTAR_50', 'AGE_50', 'SFRAGE_50', 'TAU_50', 'ZMETAL_50', 'AV_50', 'MU_50', 'OIIIHB_50', 'SFR_50', 'SFR100_50', 'B100_50', 'B1000_50', 'EWOII_50', 'EWOIIIHB_50', 'EWNIIHA_50', 'MSTAR_AVG', 'AGE_AVG', 'SFRAGE_AVG', 'TAU_AVG', 'ZMETAL_AVG', 'AV_AVG', 'MU_AVG', 'OIIIHB_AVG', 'SFR_AVG', 'SFR100_AVG', 'B100_AVG', 'B1000_AVG', 'EWOII_AVG', 'EWOIIIHB_AVG', 'EWNIIHA_AVG', 'MSTAR_ERR', 'AGE_ERR', 'SFRAGE_ERR', 'TAU_ERR', 'ZMETAL_ERR', 'AV_ERR', 'MU_ERR', 'OIIIHB_ERR', 'SFR_ERR', 'SFR100_ERR', 'B100_ERR', 'B1000_ERR', 'EWOII_ERR', 'EWOIIIHB_ERR', 'EWNIIHA_ERR', 'ra_hsc', 'dec_hsc', 'tract', 'patch', 'id', 'parent', 'a_g', 'a_r', 'a_i', 'a_z', 'a_y', 'imag_aperture01', 'imag_aperture02', 'imag_aperture03', 'imag_aperture04', 'imag_aperture05', 'imag_aperture06', 'imag_aperture07', 'imag_aperture08', 'imag_aperture09', 'gmag_psf', 'gmag_psf_err', 'rmag_psf', 'rmag_psf_err', 'imag_psf', 'imag_psf_err', 'zmag_psf', 'zmag_psf_err', 'ymag_psf', 'ymag_psf_err', 'gmag_kron', 'gmag_kron_err', 'rmag_kron', 'rmag_kron_err', 'imag_kron', 'imag_kron_err', 'zmag_kron', 'zmag_kron_err', 'ymag_kron', 'ymag_kron_err', 'gmag_cmodel', 'gmag_cmodel_err', 'gmag_cmodel_exp', 'gmag_cmodel_exp_err', 'gmag_cmodel_dev', 'gmag_cmodel_dev_err', 'rmag_cmodel', 'rmag_cmodel_err', 'rmag_cmodel_exp', 'rmag_cmodel_exp_err', 'rmag_cmodel_dev', 'rmag_cmodel_dev_err', 'imag_cmodel', 'imag_cmodel_err', 'imag_cmodel_exp', 'imag_cmodel_exp_err', 'imag_cmodel_dev', 'imag_cmodel_dev_err', 'zmag_cmodel', 'zmag_cmodel_err', 'zmag_cmodel_exp', 'zmag_cmodel_exp_err', 'zmag_cmodel_dev', 'zmag_cmodel_dev_err', 'ymag_cmodel', 'ymag_cmodel_err', 'ymag_cmodel_exp', 'ymag_cmodel_exp_err', 'ymag_cmodel_dev', 'ymag_cmodel_dev_err', 'if_classification_extendedness', 'if_flags_pixel_edge', 'if_flags_pixel_interpolated_center', 'if_flags_pixel_saturated_center', 'if_centroid_naive_flags', 'if_centroid_sdss_flags', 'if_flux_aperture_flags', 'if_flux_kron_flags', 'if_cmodel_flux_flags', 'if_shape_sdss_flags', 'if_countinputs', 'if_cmodel_fracdev', 'if_cmodel_objective', 'im_mag_kron_1', 'im_mag_kron_1a', 'im_mag_cmodel', 'im_mag_cmodel_err', 'im_mag_cmodel_exp', 'im_mag_cmodel_dev', 'im_cmodel_flux', 'im_cmodel_flux_err', 'im_cmodel_exp_flux', 'im_cmodel_exp_flux_err', 'im_cmodel_dev_flux', 'im_cmodel_dev_flux_err', 'im_deblend_blendedness', 'im_cmodel_exp_ixx', 'im_cmodel_exp_iyy', 'im_cmodel_exp_ixy', 'im_cmodel_dev_ixx', 'im_cmodel_dev_iyy', 'im_cmodel_dev_ixy', 'im_cmodel_fracdev', 'im_cmodel_objective', 'im_classification_extendedness', 'im_flux_kron_flags', 'im_cmodel_flux_flags', 'im_shape_sdss_flags', 'im_detect_is_patch_inner', 'im_detect_is_tract_inner', 'im_detect_is_primary', 'im_merge_peak_g', 'im_merge_peak_r', 'im_merge_peak_i', 'im_merge_peak_z', 'im_merge_peak_y', 'im_merge_footprint_g', 'im_merge_footprint_r', 'im_merge_footprint_i', 'im_merge_footprint_z', 'im_merge_footprint_y', 'ir_deblend_blendedness', 'ir_deblend_has_stray_flux', 'ir_deblend_masked', 'ir_deblend_parent_too_big', 'ir_deblend_skipped', 'ir_deblend_too_many_peaks', 'ir_deblend_as_psf', 'ir_detect_is_patch_inner', 'ir_detect_is_tract_inner', 'ir_detect_is_primary', 'ir_merge_measurement_g', 'ir_merge_measurement_r', 'ir_merge_measurement_i', 'ir_merge_measurement_z', 'ir_merge_measurement_y', 'ra_gama', 'dec_gama', 'gama_id', 'gama_name', 'n_spec', 'n_gama_spec', 'gama_specid', 'survey', 'survey_code', 'z_gama', 'z_use', 'zquality_gama', 'z_tonry_gama', 'zprob_gama', 'objid_dr6', 'nbands', 'logms_gama', 'logms_err_gama', 'logm2l_i_gama', 'logm2l_i_err_gama', 'fluxscale_gama', 'gi_rest_sed', 'gi_rest_sed_err', 'ur_rest_sed', 'ur_rest_sed_err', 'gi_rest_star', 'ur_rest_star', 'GAL_MAG_R', 'GAL_RE_R', 'GAL_INDEX_R', 'GAL_ELLIP_R', 'GAL_PA_R', 'GAL_MAG_ERR_R', 'GAL_RE_ERR_R', 'GAL_ELLIP_ERR_R', 'GAL_PA_ERR_R', 'GAL_MAG_I', 'GAL_RE_I', 'GAL_INDEX_I', 'GAL_ELLIP_I', 'GAL_PA_I', 'GAL_MAG_ERR_I', 'GAL_RE_ERR_I', 'GAL_INDEX_ERR_I', 'GAL_ELLIP_ERR_I', 'GAL_PA_ERR_I', 'ra_sdss', 'dec_sdss', 'objid_dr12', 'specobjid_dr12', 'plate', 'mjd', 'fiberid', 'ra_fib', 'dec_fib', 'ra_err_sdss', 'dec_err_sdss', 'z_sdss', 'z_err_sdss', 'veldisp', 'veldisp_err', 'cmodelMag_u', 'cmodelMagErr_u', 'cmodelMag_g', 'cmodelMagErr_g', 'cmodelMag_r', 'cmodelMagErr_r', 'cmodelMag_i', 'cmodelMagErr_i', 'cmodelMag_z', 'cmodelMagErr_z', 'modelMag_u', 'modelMagErr_u', 'modelMag_g', 'modelMagErr_g', 'modelMag_r', 'modelMagErr_r', 'modelMag_i', 'modelMagErr_i', 'modelMag_z', 'modelMagErr_z', 'petroMag_u', 'petroMagErr_u', 'petroMag_g', 'petroMagErr_g', 'petroMag_r', 'petroMagErr_r', 'petroMag_i', 'petroMagErr_i', 'petroMag_z', 'petroMagErr_z', 'model_gr', 'model_gi', 'fracDev_r', 'fracDev_i', 'devRad_r', 'devRad_i', 'devAB_r', 'devAB_i', 'devRadErr_r', 'devABErr_r', 'expRad_r', 'expRad_i', 'expAB_r', 'expAB_i', 'expRadErr_r', 'expABErr_r', 'petroR50_r', 'petroR90_r', 'petroR50Err_r', 'petroR90Err_r', 'petroR50_i', 'petroR90_i', 'petroR50Err_i', 'petroR90Err_i', 'mE1_r', 'mE1_i', 'mE2_r', 'mE2_i', 'nchild', 'extinction_u', 'extinction_g', 'extinction_r', 'extinction_i', 'extinction_z', 'deVFlux_u', 'deVFlux_g', 'deVFlux_r', 'deVFlux_i', 'deVFlux_z', 'deVFluxIvar_u', 'deVFluxIvar_g', 'deVFluxIvar_r', 'deVFluxIvar_i', 'deVFluxIvar_z', 'expFlux_u', 'expFlux_g', 'expFlux_r', 'expFlux_i', 'expFlux_z', 'expFluxIvar_u', 'expFluxIvar_g', 'expFluxIvar_r', 'expFluxIvar_i', 'expFluxIvar_z', 'modelFlux_u', 'modelFlux_g', 'modelFlux_r', 'modelFlux_i', 'modelFlux_z', 'modelFluxIvar_u', 'modelFluxIvar_g', 'modelFluxIvar_r', 'modelFluxIvar_i', 'modelFluxIvar_z', 'cmodelFlux_u', 'cmodelFlux_g', 'cmodelFlux_r', 'cmodelFlux_i', 'cmodelFlux_z', 'cmodelFluxIvar_u', 'cmodelFluxIvar_g', 'cmodelFluxIvar_r', 'cmodelFluxIvar_i', 'cmodelFluxIvar_z', 'logms_pca', 'logms_err_pca', 'cModelAbsMag_u', 'cModelAbsMag_g', 'cModelAbsMag_r', 'cModelAbsMag_i', 'cModelAbsMag_z', 'logms_gran', 'logms_err_gran', 'm2l_u', 'm2l_g', 'm2l_r', 'm2l_i', 'm2l_z', 'age_gama', 'ageerr_gama', 'Separation']

In [118]:
colTemp = (np.asarray(gamaData['MSTAR']) * 0.0 - 9999.0)
newGamaCat = copy.deepcopy(gamaData)

col1 = Column(name='ilum_max', data=colTemp)
col2 = Column(name='ilum_100', data=colTemp)
col3 = Column(name='ilum_50', data=colTemp)
col4 = Column(name='ilum_25', data=colTemp)
col5 = Column(name='ilum_10', data=colTemp)

col6 = Column(name='glum_hsc', data=colTemp)
col7 = Column(name='rlum_hsc', data=colTemp)
col8 = Column(name='ilum_hsc', data=colTemp)
col9 = Column(name='zlum_hsc', data=colTemp)
col10 = Column(name='ylum_hsc', data=colTemp)
newGamaCat.add_columns([col1, col2, col3, col4, col5, 
                       col6, col7, col8, col9, col10])

In [119]:
ellGama = []

with ProgressBar(len(gamaData), ipython_widget=True) as bar:
    
    for (i, galaxy) in enumerate(gamaData): 
        
        """ For non BCG """
        loc = nonBCG 
    
        """ ID, Z, RA, DEC """
        galID = galaxy['ISEDFIT_ID']
        redshift = galaxy['Z']

        """ Location and Table name """
        sumDir = os.path.join(loc, 'sum')
        sumTab = str(galID) + '_sbp_sum.fits'
        if not os.path.exists(loc): 
            os.mkdir(sumDir, exist_ok=True)
        sumTable = os.path.join(sumDir, sumTab)

        ellTab = sbpCollect(loc, galID, redshift, 
                               prefix='nonBCG', save=False, 
                               a_g=galaxy['a_g'], a_r=galaxy['a_r'],
                               a_i=galaxy['a_i'], a_z=galaxy['a_z'],
                               a_y=galaxy['a_y'])
        if ellTab is not None:
        
            """ Radius KPc """
            rKpc = ellTab['rKpc']
            """ Maximum i-band luminosity """
            maxLumI1 = np.nanmax(ellTab['lumI1'])
            ellTab.meta['ILUM_MAX'] = maxLumI1.astype(np.float32)
            ellTab.meta['ILUM_100'] = np.nanmax(ellTab['lumI1'][rKpc <= 100.0])
            ellTab.meta['ILUM_50'] = np.nanmax(ellTab['lumI1'][rKpc <= 50.0])
            ellTab.meta['ILUM_25'] = np.nanmax(ellTab['lumI1'][rKpc <= 25.0])
            ellTab.meta['ILUM_10'] = np.nanmax(ellTab['lumI1'][rKpc <= 10.0])

            """ Update the metadata """
            ellTab.meta['RA'] = galaxy['RA'].astype(np.float32)
            ellTab.meta['DEC'] = galaxy['DEC'].astype(np.float32)
    
            """ STELLAR MASS FROM OTHER WORKS """
            if np.isfinite(galaxy['logms_gama'].astype(np.float32)):
                ellTab.meta['LOGM1'] = galaxy['logms_gama'].astype(np.float32)
            else: 
                ellTab.meta['LOGM1'] = -9999.0
                
            if np.isfinite(galaxy['logms_err_gama'].astype(np.float32)):
                ellTab.meta['LOGM1E'] = galaxy['logms_err_gama'].astype(np.float32)
            else: 
                ellTab.meta['LOGM1E'] = -9999.0
    
            """ STELLAR MASS FROM ISEDFIT """
            ellTab.meta['LOGM2'] = galaxy['MSTAR'].astype(np.float32)
            ellTab.meta['LOGM2E'] = galaxy['MSTAR_ERR'].astype(np.float32)
    
            """ HSC CMODEL MAG (EXTINCTION CORRECTED) """
            gmag_hsc = (galaxy['gmag_cmodel'] - galaxy['a_g']).astype(np.float32)
            rmag_hsc = (galaxy['rmag_cmodel'] - galaxy['a_r']).astype(np.float32)
            imag_hsc = (galaxy['imag_cmodel'] - galaxy['a_i']).astype(np.float32)
            zmag_hsc = (galaxy['zmag_cmodel'] - galaxy['a_z']).astype(np.float32)
            ymag_hsc = (galaxy['ymag_cmodel'] - galaxy['a_y']).astype(np.float32)
        
            ellTab.meta['GCMOD_HSC'] = gmag_hsc
            ellTab.meta['RCMOD_HSC'] = rmag_hsc
            ellTab.meta['ICMOD_HSC'] = imag_hsc
            ellTab.meta['ZCMOD_HSC'] = zmag_hsc
            ellTab.meta['YCMOD_HSC'] = ymag_hsc
            
            glum_hsc = getLuminosity(gmag_hsc, redshift, amag_sun=amag_sun_des_g)
            rlum_hsc = getLuminosity(rmag_hsc, redshift, amag_sun=amag_sun_des_r)
            ilum_hsc = getLuminosity(imag_hsc, redshift, amag_sun=amag_sun_des_i)
            zlum_hsc = getLuminosity(zmag_hsc, redshift, amag_sun=amag_sun_des_z)
            ylum_hsc = getLuminosity(ymag_hsc, redshift, amag_sun=amag_sun_des_y)

            """ HSC CMODEL LUMINOSITY """
            ellTab.meta['GLUM_HSC'] = glum_hsc
            ellTab.meta['RLUM_HSC'] = rlum_hsc
            ellTab.meta['ILUM_HSC'] = ilum_hsc
            ellTab.meta['ZLUM_HSC'] = zlum_hsc
            ellTab.meta['YLUM_HSC'] = ylum_hsc
            
            ellTab.write(sumTable, format='fits', overwrite=True)
            
            ## Pass it to table 
            newGamaCat['ilum_max'][i] = ellTab.meta['ILUM_MAX']
            newGamaCat['ilum_100'][i] = ellTab.meta['ILUM_100']
            newGamaCat['ilum_50'][i] = ellTab.meta['ILUM_50']
            newGamaCat['ilum_25'][i] = ellTab.meta['ILUM_25']
            newGamaCat['ilum_10'][i] = ellTab.meta['ILUM_10']
            newGamaCat['glum_hsc'][i] = glum_hsc
            newGamaCat['rlum_hsc'][i] = rlum_hsc
            newGamaCat['ilum_hsc'][i] = ilum_hsc
            newGamaCat['zlum_hsc'][i] = zlum_hsc
            newGamaCat['ylum_hsc'][i] = ylum_hsc
            
            """"""
            ellGama.append(ellTab)
        else: 
            warnings.warn('### NO USEFUL DATA FOR %i' % galID)
            
        bar.update()
               
# Save a new table 
newGamaCat.write(os.path.join(nonBCG, 'nonBCG_new.fits'), format='fits', 
                overwrite=True)


/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:59: UserWarning: ### Can not find the smallR1 for I-band!

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:103: UserWarning: ### Can not find the default for Y-band!

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5875

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5875

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5755

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5755

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 4748

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 4748

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5761

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5761

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5518

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5518

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 4877

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 4877

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5770

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5770

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5016

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5016

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 4817

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 4817

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5230

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5230

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5233

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5233

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5876

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5876

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5418

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5418

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5270

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5270

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5096

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5096

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5678

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5678

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5556

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5556

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5666

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5666

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 4745

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 4745

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 4713

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 4713

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:139: UserWarning: ### Model is not available at /Users/songhuang/astro3/hscs/nonbcg for 5675

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:100: UserWarning: ### NO USEFUL DATA FOR 5675


Photometric Comparison


In [120]:
redLogM2L = (newRedCat['MSTAR'] - newRedCat['ilum_hsc'])
gamaLogM2L = (newGamaCat['MSTAR'] - newGamaCat['ilum_hsc'])

In [121]:
fig = plt.figure(figsize=(10, 10))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

logmRange = np.arange(10.0, 12.5, 0.2)
ax1.plot(logmRange, logmRange, 'k', linestyle='--', linewidth=3.0, alpha=0.8)


ax1.axhline(0.0, linewidth=5.0, alpha=0.6, 
            linestyle='dashed', c='k')


# GAMA 
ax1.scatter(newGamaCat['MSTAR'], 
            (newGamaCat['ilum_max'] + gamaLogM2L) - newGamaCat['MSTAR'], 
            marker='o', color='b', s=75, label='nonBCG',
            alpha=0.4)
# Red
ax1.scatter(newRedCat['MSTAR'], 
            (newRedCat['ilum_max'] + redLogM2L) - newRedCat['MSTAR'], 
            marker='o', color='r', s=75, label='redBCG',
            alpha=0.6)

ax1.set_xlim(10.7, 12.3)
ax1.set_ylim(-0.2, 1.0)

ax1.set_xlabel('ISEDFIT Stellar Mass',  size=25.0)
ax1.set_ylabel('Mass Difference', size=25.0)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(20) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(20) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)

ax1.legend(prop={'size':36})

#ax1.text(-23.45, -23.0, '$0.3<z<0.4$', size=32.0)
#ax1.text(-23.25, -22.8, 'log $(M_{s}/M_{\odot})>11.6$', size=32.0)

#ax1.text(-23.35, -22.55, 'within 50 Kpc', color='g', size=32.0)
#ax1.text(-23.30, -22.35, 'within 100 Kpc', color='r', size=32.0)


Out[121]:
<matplotlib.legend.Legend at 0x118ff0590>

In [228]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')

for gamaProf in ellGama:
    m2l = (gamaProf.meta['LOGM2'] - gamaProf.meta['ILUM_HSC'])
    ax1.plot((gamaProf['rKpc']**0.25), gamaProf['muI1'] + m2l, c='b', 
             alpha=0.25, linewidth=1.5)
    
for redProf in ellRed:
    m2l = (redProf.meta['LOGM2'] - redProf.meta['ILUM_HSC'])
    ax1.plot((redProf['rKpc']**0.25), redProf['muI1'] + m2l, c='r', 
             alpha=0.2, linewidth=2.0)

#ax1.fill_between(rsma_common_z1, asbp_avg_z1+std_stack_z1, asbp_avg_z1-std_stack_z1,
#                 facecolor='b', alpha=0.2)

#ax1.text(2.4, 8.6, '$0.15<z<0.30$', size=42)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('log $({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=32)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(4.4, 10.4)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [227]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')

for gamaProf in ellGama:
    m2l = (gamaProf.meta['LOGM2'] - gamaProf.meta['ILUM_HSC'])
    mnew = (gamaProf.meta['ILUM_MAX'] + m2l)
    if (mnew <= 11.6) and (mnew >= 11.40):
        ax1.plot((gamaProf['rKpc']**0.25), (gamaProf['muI1'] + m2l), c='b', 
                 alpha=0.1, linewidth=1.5)
    
for redProf in ellRed:
    m2l = (redProf.meta['LOGM2'] - redProf.meta['ILUM_HSC'])
    mnew = (redProf.meta['ILUM_MAX'] + m2l)
    redshift = redProf.meta['redshift']
    if (mnew <= 11.60) and (mnew >= 11.40):
        ax1.plot((redProf['rKpc']**0.25), redProf['muI1'] + m2l, c='r', 
                 alpha=0.6, linewidth=2.5)

#ax1.fill_between(rsma_common_z1, asbp_avg_z1+std_stack_z1, asbp_avg_z1-std_stack_z1,
#                 facecolor='b', alpha=0.2)

#ax1.text(2.4, 8.6, '$0.15<z<0.30$', size=42)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('log $({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=32)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(4.4, 10.4)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [239]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')

for gamaProf in ellGama:
    m2l = (gamaProf.meta['LOGM2'] - gamaProf.meta['ILUM_HSC'])
    mnew = (gamaProf.meta['ILUM_25'] + m2l)
    if (mnew <= 11.5) and (mnew >= 11.30):
        ax1.plot((gamaProf['rKpc']**0.25), (gamaProf['muI1'] + m2l), c='b', 
                 alpha=0.5, linewidth=2.0)
    
for redProf in ellRed:
    m2l = (redProf.meta['LOGM2'] - redProf.meta['ILUM_HSC'])
    mnew = (redProf.meta['ILUM_25'] + m2l)
    redshift = redProf.meta['redshift']
    if (mnew <= 11.5) and (mnew >= 11.30):
        ax1.plot((redProf['rKpc']**0.25), redProf['muI1'] + m2l, c='r', 
                 alpha=0.6, linewidth=2.5)

#ax1.fill_between(rsma_common_z1, asbp_avg_z1+std_stack_z1, asbp_avg_z1-std_stack_z1,
#                 facecolor='b', alpha=0.2)

#ax1.text(2.4, 8.6, '$0.15<z<0.30$', size=42)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('log $({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=32)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(4.4, 10.4)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [234]:
fig = plt.figure(figsize=(16, 10))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')

for gamaProf in ellGama:
    ax1.plot((gamaProf['rKpc']**0.25), gamaProf['muI2'] - gamaProf['muI1'] , c='b', 
             alpha=0.1, linewidth=1.5)
    
for redProf in ellRed:
    ax1.plot((redProf['rKpc']**0.25), redProf['muI2'] - redProf['muI1'], c='r', 
             alpha=0.3, linewidth=2.5)

#ax1.fill_between(rsma_common_z1, asbp_avg_z1+std_stack_z1, asbp_avg_z1-std_stack_z1,
#                 facecolor='b', alpha=0.2)

#ax1.text(2.4, 8.6, '$0.15<z<0.30$', size=42)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('Change of Surface Brightness Profile', size=32)

ax1.set_xlim(0.0, 4.2)
ax1.set_ylim(-0.2, 2.0)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [242]:
fig = plt.figure(figsize=(16, 9))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')

for gamaProf in ellGama:
    m2l = (gamaProf.meta['LOGM2'] - gamaProf.meta['ILUM_HSC'])
    mnew = (gamaProf.meta['ILUM_MAX'] + m2l)
    if (mnew <= 11.6) and (mnew >= 11.40):
        ax1.plot((gamaProf['rKpc']**0.25), (gamaProf['muZ1'] - gamaProf['muG1']), c='b', 
                 alpha=0.3, linewidth=2.0)
    
for redProf in ellRed:
    m2l = (redProf.meta['LOGM2'] - redProf.meta['ILUM_HSC'])
    mnew = (redProf.meta['ILUM_MAX'] + m2l)
    redshift = redProf.meta['redshift']
    if (mnew <= 11.6) and (mnew >= 11.40) and (redshift < 0.35):
        ax1.plot((redProf['rKpc']**0.25), (redProf['muZ1'] - redProf['muG1']), c='r', 
                 alpha=0.5, linewidth=4)

#ax1.fill_between(rsma_common_z1, asbp_avg_z1+std_stack_z1, asbp_avg_z1-std_stack_z1,
#                 facecolor='b', alpha=0.2)

#ax1.text(2.4, 8.6, '$0.15<z<0.30$', size=42)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('HSC-G - HSC-I (mag)', size=32)

ax1.set_xlim(1.0, 3.5)
ax1.set_ylim(0.01, 1.4)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [240]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')

for gamaProf in ellGama:
    ax1.plot((gamaProf['rKpc']**0.25), gamaProf['muI1'], c='b', 
             alpha=0.25, linewidth=1.5)
    
for redProf in ellRed:
    ax1.plot((redProf['rKpc']**0.25), redProf['muI1'], c='r', 
             alpha=0.2, linewidth=2.0)

#ax1.fill_between(rsma_common_z1, asbp_avg_z1+std_stack_z1, asbp_avg_z1-std_stack_z1,
#                 facecolor='b', alpha=0.2)

#ax1.text(2.4, 8.6, '$0.15<z<0.30$', size=42)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('log $({\mu}/[M_{\odot} Kpc^{-2}])$', size=32)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(4.4, 10.4)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [255]:
fig = plt.figure(figsize=(12, 9))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')

for gamaProf in ellGama:
    m2l = (gamaProf.meta['LOGM2'] - gamaProf.meta['ILUM_HSC'])
    mnew = (gamaProf.meta['ILUM_10'] + m2l)
    if (mnew <= 11.20) and (mnew >= 11.00):
        ax1.plot((gamaProf['rKpc']**0.25), gamaProf['lumI1'] + m2l, c='b', 
                 alpha=0.6, linewidth=1.5)
    
for redProf in ellRed:
    m2l = (redProf.meta['LOGM2'] - redProf.meta['ILUM_HSC'])
    mnew = (redProf.meta['ILUM_10'] + m2l)
    redshift = redProf.meta['redshift']
    if (mnew <= 11.20) and (mnew >= 11.00) and (redshift <= 0.40):
        ax1.plot((redProf['rKpc']**0.25), redProf['lumI1'] + m2l, c='r', 
                 alpha=0.4, linewidth=2.5)

#ax1.fill_between(rsma_common_z1, asbp_avg_z1+std_stack_z1, asbp_avg_z1-std_stack_z1,
#                 facecolor='b', alpha=0.2)

#ax1.text(2.4, 8.6, '$0.15<z<0.30$', size=42)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('log $(L_{*}/L_{\odot})$', size=32)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(8.5, 12.4)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [130]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)


ax1.plot(np.linspace(9.5, 13.0, 100), np.linspace(9.5, 13.0, 100),
         linewidth=2.5, linestyle='dashed', color='k', alpha=0.8)
ax1.plot(np.linspace(9.5, 13.0, 100), (0.301 + np.linspace(9.5, 13.0, 100)),
         linewidth=4.0, linestyle='dashed', color='g')

for gamaProf in ellGama:
    m2l = (gamaProf.meta['LOGM2'] - gamaProf.meta['ILUM_HSC'])
    ax1.scatter((gamaProf.meta['ILUM_10'] + m2l), 
                (gamaProf.meta['LOGM2']), c='b', 
                 alpha=0.45, s=100, marker='o')
    
for redProf in ellRed:
    m2l = (redProf.meta['LOGM2'] - redProf.meta['ILUM_HSC'])
    ax1.scatter((redProf.meta['ILUM_10'] + m2l), 
                (redProf.meta['LOGM2']), c='r', 
                 alpha=0.5, s=120, marker='o')
    
ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('log $({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=32)

ax1.set_xlim(10.4, 11.8)
ax1.set_ylim(10.8, 12.2)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


New Results

  • 2015-12-18

In [24]:
newDir = '/Users/songhuang/Downloads/sbp'

# Folder for two datasets
bcgDir = os.path.join(newDir, 'redmapper')
gamaDir = os.path.join(newDir, 'gama')
# Two summary catalogs
bcgCat = os.path.join(bcgDir, 'hsc_redmapper_cluster_gama_1509_mass_sbpsum_use.fits')
gamaCat = os.path.join(gamaDir, 'gama_z0.1_0.25_m11.2_nonbcg_sbpsum_use.fits')

if not os.path.isfile(bcgCat):
    raise Exception("## Can not find catalog for BCGs : %s" % bcgCat)
else: 
    bcgTab = Table.read(bcgCat, format='fits')
    
if not os.path.isfile(gamaCat):
    raise Exception("## Can not find catalog for GAMA galaxies : %s" % gamaCat)
else: 
    gamaTab = Table.read(gamaCat, format='fits')


WARNING: UnitsWarning: 'dex' did not parse as fits unit: At col 0, Unit 'dex' not supported by the FITS standard.  [astropy.units.core]
WARNING:astropy:UnitsWarning: 'dex' did not parse as fits unit: At col 0, Unit 'dex' not supported by the FITS standard. 

In [25]:
print("## Deal with %i galaxies in BCG sample" % len(bcgTab))
print("## Deal with %i galaxies in GAMA sample" % len(gamaTab))


## Deal with 146 galaxies in BCG sample
## Deal with 4929 galaxies in GAMA sample

Subsamples

Use ilum_100 instead of ilum_max for now


In [26]:
gama1 = gamaTab[(gamaTab['Z'] >= 0.22) & 
                ((gamaTab['ilum_100'] + gamaTab['logm2l_i']) >= 11.4) & 
                ((gamaTab['ilum_100'] + gamaTab['logm2l_i']) <= 11.6)]
bcg1 = bcgTab[(bcgTab['Z'] >= 0.1) & 
              (bcgTab['Z'] <= 0.45) & 
              ((bcgTab['ilum_100'] + bcgTab['logm2l_i']) >= 11.4) & 
              ((bcgTab['ilum_100'] + bcgTab['logm2l_i']) <= 11.6) & 
              (bcgTab['P_CEN_1'] >= 0.8)]

print("## 0.2 < z < 0.4 ; 11.4 < logM* < 11.6 using SBP Mass \n")
print("## GAMA1 : %i galaxies" % len(gama1))
print("##     Median redshift  : ", np.nanmedian(gama1['Z']))
print("##     Median logm_sbp  : ", np.nanmedian(gama1['ilum_100'] + gama1['logm2l_i']))
print("##     Median logm_gama : ", np.nanmedian(gama1['logms_gama']))

print("## BCG1  : %i galaxies" % len(bcg1))
print("##     Median redshift  : ", np.nanmedian(bcg1['Z']))
print("##     Median logm_sbp  : ", np.nanmedian(bcg1['ilum_100'] + bcg1['logm2l_i']))
print("##     Median logm_gama : ", np.nanmedian(bcg1['logms_gama']))


## 0.2 < z < 0.4 ; 11.4 < logM* < 11.6 using SBP Mass 

## GAMA1 : 1229 galaxies
##     Median redshift  :  0.309909999371
##     Median logm_sbp  :  11.4868451885
##     Median logm_gama :  11.2761976468
## BCG1  : 18 galaxies
##     Median redshift  :  0.306100010872
##     Median logm_sbp  :  11.4945875383
##     Median logm_gama :  11.359728093

In [31]:
confidence_interval(bcg1['Z'], alpha=np.asarray([0.3173, 1.0]), 
                    metric=np.median, numResamples=1000, interpolate=True)


Out[31]:
array([ 0.29421502,  0.33296502,  0.30610001,  0.30610001])

In [32]:
gama2 = gamaTab[(gamaTab['Z'] >= 0.20) & 
                ((gamaTab['ilum_100'] + gamaTab['logm2l_i']) >= 11.65) & 
                ((gamaTab['ilum_100'] + gamaTab['logm2l_i']) <= 11.8)]
bcg2 = bcgTab[(bcgTab['Z'] >= 0.2) & 
              (bcgTab['Z'] <= 0.4) & 
              ((bcgTab['ilum_100'] + bcgTab['logm2l_i']) >= 11.6) & 
              ((bcgTab['ilum_100'] + bcgTab['logm2l_i']) <= 11.8) & 
              (bcgTab['P_CEN_1'] >= 0.8)]

print("## 0.2 < z < 0.4 ; 11.6 < logM* < 11.8 using SBP Mass \n")
print("## GAMA2 : %i galaxies" % len(gama2))
print("##     Median redshift  : ", np.nanmedian(gama2['Z']))
print("##     Median logm_sbp  : ", np.nanmedian(gama2['ilum_100'] + gama2['logm2l_i']))
print("##     Median logm_gama : ", np.nanmedian(gama2['logms_gama']))

print("## BCG2  : %i galaxies" % len(bcg2))
print("##     Median redshift  : ", np.nanmedian(bcg2['Z']))
print("##     Median logm_sbp  : ", np.nanmedian(bcg2['ilum_100'] + bcg2['logm2l_i']))
print("##     Median logm_gama : ", np.nanmedian(bcg2['logms_gama']))


## 0.2 < z < 0.4 ; 11.6 < logM* < 11.8 using SBP Mass 

## GAMA2 : 311 galaxies
##     Median redshift  :  0.31670999527
##     Median logm_sbp  :  11.7022594685
##     Median logm_gama :  11.4476932822
## BCG2  : 35 galaxies
##     Median redshift  :  0.302410006523
##     Median logm_sbp  :  11.7128493856
##     Median logm_gama :  11.5343465539

In [33]:
gama3 = gamaTab[(gamaTab['Z'] >= 0.20) & 
                ((gamaTab['ilum_100'] + gamaTab['logm2l_i']) >= 11.8) & 
                ((gamaTab['ilum_100'] + gamaTab['logm2l_i']) <= 12.0)]
bcg3 = bcgTab[(bcgTab['Z_LAMBDA'] >= 0.2) & 
              (bcgTab['Z_LAMBDA'] <= 0.45) & 
              ((bcgTab['ilum_100'] + bcgTab['logm2l_i']) >= 11.8) & 
              ((bcgTab['ilum_100'] + bcgTab['logm2l_i']) <= 12.0) & 
              (bcgTab['P_CEN_1'] >= 0.8)]

print("## 0.2 < z < 0.4 ; 11.8 < logM* < 12.0 using SBP Mass \n")
print("## GAMA3 : %i galaxies" % len(gama3))
print("##     Median redshift  : ", np.nanmedian(gama3['Z']))
print("##     Median logm_sbp  : ", np.nanmedian(gama3['ilum_100'] + gama3['logm2l_i']))
print("##     Median logm_gama : ", np.nanmedian(gama3['logms_gama']))

print("## BCG3  : %i galaxies" % len(bcg3))
print("##     Median redshift  : ", np.nanmedian(bcg3['Z']))
print("##     Median logm_sbp  : ", np.nanmedian(bcg3['ilum_100'] + bcg3['logm2l_i']))
print("##     Median logm_gama : ", np.nanmedian(bcg3['logms_gama']))


## 0.2 < z < 0.4 ; 11.8 < logM* < 12.0 using SBP Mass 

## GAMA3 : 98 galaxies
##     Median redshift  :  0.323885023594
##     Median logm_sbp  :  11.8711767503
##     Median logm_gama :  11.5615737801
## BCG3  : 13 galaxies
##     Median redshift  :  0.326249986887
##     Median logm_sbp  :  11.8622706715
##     Median logm_gama :  11.7218925322

Stellar Mass Comparison


In [34]:
# Redshift - iSEDFit Mass

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axhline(11.4, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axhline(11.6, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axhline(11.8, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axhline(12.0, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')

ax1.scatter(gamaTab['Z'], gamaTab['MSTAR'], c='b', alpha=0.15, 
            s=100, marker='o', label='non-BCGs')
legnd = ax1.scatter(bcgTab['Z_LAMBDA'], bcgTab['MSTAR'], c='r', alpha=0.9, 
                    s=((bcgTab['P_CEN_1'] - 0.5) * 250), marker='s', 
                    label='BCGs')

ax1.set_xlabel('Redshift', size=32)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{\mathrm{ISEDFit}}$', size=36)

ax1.set_xlim(0.09, 0.51)
ax1.set_ylim(11.01, 12.35)

ax1.legend(loc=(0.10, 0.85), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.12, 0.78, 'Size: P_CEN_1', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=20.0, transform=ax1.transAxes)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


/usr/local/lib/python2.7/site-packages/matplotlib/collections.py:806: RuntimeWarning: invalid value encountered in sqrt
  scale = np.sqrt(self._sizes) * dpi / 72.0 * self._factor

In [35]:
# Redshift - iSEDFit Mass

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axhline(11.4, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axhline(11.6, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axhline(11.8, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axhline(12.0, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')

ax1.scatter(gamaTab['Z'], gamaTab['logms_gama'], c='b', alpha=0.15, 
            s=100, marker='o', label='non-BCGs')
legnd = ax1.scatter(bcgTab['Z_LAMBDA'], bcgTab['logms_gama'], c='r', alpha=0.9, 
                    s=((bcgTab['LAMBDA_CLUSTER'] - 20) * 5), marker='s', 
                    label='BCGs')

ax1.set_xlabel('Redshift', size=32)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{\mathrm{GAMA}}$', size=36)

ax1.set_xlim(0.09, 0.51)
ax1.set_ylim(11.01, 12.35)

ax1.legend(loc=(0.10, 0.85), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.12, 0.78, 'Size: ${\Lambda}_{\mathrm{redMapper}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=20.0, transform=ax1.transAxes)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [36]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

logmRange = np.arange(10.0, 12.5, 0.2)
ax1.plot(logmRange, logmRange, 'k', linestyle='--', linewidth=3.0, alpha=0.8)

ax1.scatter((gamaTab['ilum_max'] + gamaTab['logm2l_i']), 
            (gamaTab['ilum_100'] + gamaTab['logm2l_i']),
            c='b', alpha=0.15, s=100, marker='o', label='non-BCGs')
ax1.scatter((bcgTab['ilum_max'] + bcgTab['logm2l_i']),
            (bcgTab['ilum_100'] + bcgTab['logm2l_i']),
            c='r', alpha=0.9, s=((bcgTab['LAMBDA_CLUSTER'] - 20) * 5), 
            marker='s', label='BCGs')

ax1.set_xlabel('$\log (M_{\star}/M_{\odot})_{\mathrm{Max}}$', size=36)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{<100 \mathrm{kpc}}$', size=36)

ax1.set_xlim(11.01, 12.35)
ax1.set_ylim(11.01, 12.35)

ax1.legend()

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.legend(loc=(0.10, 0.85), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.12, 0.78, 'Size: ${\Lambda}_{\mathrm{redMapper}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=20.0, transform=ax1.transAxes)
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [37]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axhline(11.4, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axhline(11.6, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axhline(11.8, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axhline(12.0, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')

ax1.scatter(gamaTab['Z'], (gamaTab['ilum_100'] + gamaTab['logm2l_i']) , 
            c='b', alpha=0.3, s=100, marker='o', label='non-BCGs')
ax1.scatter(bcgTab['Z_LAMBDA'], (bcgTab['ilum_100'] + bcgTab['logm2l_i']), 
            c='r', alpha=0.9, s=((bcgTab['LAMBDA_CLUSTER'] - 20) * 5), 
            marker='s', label='BCGs')

ax1.set_xlabel('Redshift', size=32)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{\mathrm{SBP}}$', size=36)

ax1.set_xlim(0.09, 0.51)
ax1.set_ylim(11.01, 12.35)

ax1.legend()

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.legend(loc=(0.10, 0.85), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.12, 0.78, 'Size: ${\Lambda}_{\mathrm{redMapper}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=20.0, transform=ax1.transAxes)
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [38]:
fig = plt.figure(figsize=(10, 10))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(11.4, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(11.6, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(11.8, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(12.0, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')

ax1.axhline(0.0, linewidth=5.0, alpha=0.6, 
            linestyle='dashed', c='k')

# 
gMassNew = (gamaTab['ilum_100'] + gamaTab['logm2l_i'])
ax1.scatter(gMassNew, (gMassNew - gamaTab['MSTAR']), 
            c='b', alpha=0.3, s=100, marker='o', label='non-BCGs')
bMassNew = (bcgTab['ilum_100'] + bcgTab['logm2l_i'])
ax1.scatter(bMassNew, (bMassNew - bcgTab['MSTAR']), 
            c='r', alpha=0.9, s=((bcgTab['LAMBDA_CLUSTER'] - 20) * 5), 
            marker='s', label='BCGs')

ax1.set_xlabel('$\log (M_{\star}/M_{\odot})_{\mathrm{SBP}}$', size=34)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{\mathrm{SBP}} - \log (M_{\star}/M_{\odot})_{\mathrm{iSEDFit}}$', size=34)

ax1.set_xlim(11.01, 12.35)
ax1.set_ylim(-0.6, 1.5)

ax1.legend()

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.legend(loc=(0.10, 0.85), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.12, 0.78, 'Size: ${\Lambda}_{\mathrm{redMapper}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=20.0, transform=ax1.transAxes)
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [39]:
fig = plt.figure(figsize=(10, 10))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(11.4, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(11.6, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(11.8, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(12.0, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')

ax1.axhline(0.0, linewidth=5.0, alpha=0.6, 
            linestyle='dashed', c='k')

gMassNew = (gamaTab['ilum_100'] + gamaTab['logm2l_i'])
ax1.scatter(gMassNew, (gMassNew - gamaTab['logms_gama']), 
            c='b', alpha=0.3, s=100, marker='o', label='non-BCGs')
bMassNew = (bcgTab['ilum_100'] + bcgTab['logm2l_i'])
ax1.scatter(bMassNew, (bMassNew - bcgTab['logms_gama']), 
            c='r', alpha=0.9, s=((bcgTab['LAMBDA_CLUSTER'] - 20) * 5), 
            marker='s', label='BCGs')

ax1.set_xlabel('$\log (M_{\star}/M_{\odot})_{\mathrm{SBP}}$', size=34)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{\mathrm{SBP}} - \log (M_{\star}/M_{\odot})_{\mathrm{GAMA}}$', size=34)

ax1.set_xlim(11.01, 12.35)
ax1.set_ylim(-0.6, 1.5)

ax1.legend()

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.legend(loc=(0.10, 0.85), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.12, 0.78, 'Size: ${\Lambda}_{\mathrm{redMapper}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=20.0, transform=ax1.transAxes)
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [40]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

logmRange = np.arange(10.0, 12.5, 0.2)
ax1.plot(logmRange, logmRange, 'k', linestyle='--', linewidth=3.0, alpha=0.8)

ax1.scatter((gamaTab['ilum_10'] + gamaTab['logm2l_i']), 
            (gamaTab['ilum_25'] + gamaTab['logm2l_i']), 
            c='b', alpha=0.15, s=(gamaTab['ilum_100'] + gamaTab['logm2l_i'] - 11.1) * 140.0, 
            marker='o', label='non-BCGs')
ax1.scatter((bcgTab['ilum_10'] + bcgTab['logm2l_i']), 
            (bcgTab['ilum_25'] + bcgTab['logm2l_i']), 
            c='r', alpha=0.80, s=(bcgTab['ilum_100'] + bcgTab['logm2l_i'] - 11.1) * 140.0, 
            marker='s', label='BCGs')

# Sample1
ax1.scatter(np.nanmedian(gama1['ilum_10'] + gama1['logm2l_i']), 
            np.nanmedian(gama1['ilum_25'] + gama1['logm2l_i']), 
            c='c', alpha=0.9, s=240, marker='h', label='GAMA1')
ax1.scatter(np.nanmedian(bcg1['ilum_10'] + bcg1['logm2l_i']), 
            np.nanmedian(bcg1['ilum_25'] + bcg1['logm2l_i']), 
            c='orange', alpha=0.9, s=240, marker='h', label='BCG1')
# Sample2
ax1.scatter(np.nanmedian(gama2['ilum_10'] + gama2['logm2l_i']), 
            np.nanmedian(gama2['ilum_25'] + gama2['logm2l_i']), 
            c='c', alpha=0.9, s=240, marker='p', label='GAMA2')
ax1.scatter(np.nanmedian(bcg2['ilum_10'] + bcg2['logm2l_i']), 
            np.nanmedian(bcg2['ilum_25'] + bcg2['logm2l_i']), 
            c='orange', alpha=0.9, s=240, marker='p', label='BCG2')
# Sample3
ax1.scatter(np.nanmedian(gama3['ilum_10'] + gama3['logm2l_i']), 
            np.nanmedian(gama3['ilum_25'] + gama3['logm2l_i']), 
            c='c', alpha=0.9, s=240, marker='8', label='GAMA3')
ax1.scatter(np.nanmedian(bcg3['ilum_10'] + bcg3['logm2l_i']), 
            np.nanmedian(bcg3['ilum_25'] + bcg3['logm2l_i']), 
            c='orange', alpha=0.9, s=240, marker='8', label='BCG3')

ax1.set_xlabel('$\log (M_{\star}/M_{\odot})_{<10 \mathrm{kpc}}$', size=32)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{<25 \mathrm{kpc}}$', size=36)

ax1.set_xlim(10.7, 12.35)
ax1.set_ylim(10.7, 12.35)

ax1.legend()

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.legend(loc=(0.70, 0.16), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.60, 0.08, 'Size: $\log (M_{\star}/M_{\odot})_{\mathrm{SBP}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=24.0, transform=ax1.transAxes)
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [41]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

logmRange = np.arange(10.0, 12.5, 0.2)
ax1.plot(logmRange, logmRange, 'k', linestyle='--', linewidth=3.0, alpha=0.8)

ax1.scatter((gamaTab['ilum_10'] + gamaTab['logm2l_i']), 
            (gamaTab['ilum_50'] + gamaTab['logm2l_i']), 
            c='b', alpha=0.15, s=(gamaTab['ilum_100'] + gamaTab['logm2l_i'] - 11.1) * 140.0, 
            marker='o', label='non-BCGs')
ax1.scatter((bcgTab['ilum_10'] + bcgTab['logm2l_i']), 
            (bcgTab['ilum_50'] + bcgTab['logm2l_i']), 
            c='r', alpha=0.80, s=(bcgTab['ilum_100'] + bcgTab['logm2l_i'] - 11.1) * 140.0, 
            marker='s', label='BCGs')

# Sample1
ax1.scatter(np.nanmedian(gama1['ilum_10'] + gama1['logm2l_i']), 
            np.nanmedian(gama1['ilum_50'] + gama1['logm2l_i']), 
            c='c', alpha=0.9, s=240, marker='h', label='GAMA1')
ax1.scatter(np.nanmedian(bcg1['ilum_10'] + bcg1['logm2l_i']), 
            np.nanmedian(bcg1['ilum_50'] + bcg1['logm2l_i']), 
            c='orange', alpha=0.9, s=240, marker='h', label='BCG1')
# Sample2
ax1.scatter(np.nanmedian(gama2['ilum_10'] + gama2['logm2l_i']), 
            np.nanmedian(gama2['ilum_50'] + gama2['logm2l_i']), 
            c='c', alpha=0.9, s=240, marker='p', label='GAMA2')
ax1.scatter(np.nanmedian(bcg2['ilum_10'] + bcg2['logm2l_i']), 
            np.nanmedian(bcg2['ilum_50'] + bcg2['logm2l_i']), 
            c='orange', alpha=0.9, s=240, marker='p', label='BCG2')
# Sample3
ax1.scatter(np.nanmedian(gama3['ilum_10'] + gama3['logm2l_i']), 
            np.nanmedian(gama3['ilum_50'] + gama3['logm2l_i']), 
            c='c', alpha=0.9, s=240, marker='8', label='GAMA3')
ax1.scatter(np.nanmedian(bcg3['ilum_10'] + bcg3['logm2l_i']), 
            np.nanmedian(bcg3['ilum_50'] + bcg3['logm2l_i']), 
            c='orange', alpha=0.9, s=240, marker='8', label='BCG3')


ax1.set_xlabel('$\log (M_{\star}/M_{\odot})_{<10 \mathrm{kpc}}$', size=32)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{<50 \mathrm{kpc}}$', size=36)

ax1.set_xlim(10.7, 12.35)
ax1.set_ylim(10.7, 12.35)

ax1.legend()

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.legend(loc=(0.70, 0.16), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.60, 0.08, 'Size: $\log (M_{\star}/M_{\odot})_{\mathrm{SBP}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=24.0, transform=ax1.transAxes)
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [42]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

logmRange = np.arange(10.0, 12.5, 0.2)
ax1.plot(logmRange, logmRange, 'k', linestyle='--', linewidth=3.0, alpha=0.8)

ax1.scatter((gamaTab['ilum_10'] + gamaTab['logm2l_i']), 
            (gamaTab['ilum_75'] + gamaTab['logm2l_i']), 
            c='b', alpha=0.15, s=(gamaTab['ilum_100'] + gamaTab['logm2l_i'] - 11.1) * 140.0, 
            marker='o', label='non-BCGs')
ax1.scatter((bcgTab['ilum_10'] + bcgTab['logm2l_i']), 
            (bcgTab['ilum_75'] + bcgTab['logm2l_i']), 
            c='r', alpha=0.80, s=(bcgTab['ilum_100'] + bcgTab['logm2l_i'] - 11.1) * 140.0, 
            marker='s', label='BCGs')

# Sample1
ax1.scatter(np.nanmedian(gama1['ilum_10'] + gama1['logm2l_i']), 
            np.nanmedian(gama1['ilum_75'] + gama1['logm2l_i']), 
            c='c', alpha=0.9, s=240, marker='h', label='GAMA1')
ax1.scatter(np.nanmedian(bcg1['ilum_10'] + bcg1['logm2l_i']), 
            np.nanmedian(bcg1['ilum_75'] + bcg1['logm2l_i']), 
            c='orange', alpha=0.9, s=240, marker='h', label='BCG1')
# Sample2
ax1.scatter(np.nanmedian(gama2['ilum_10'] + gama2['logm2l_i']), 
            np.nanmedian(gama2['ilum_75'] + gama2['logm2l_i']), 
            c='c', alpha=0.9, s=240, marker='p', label='GAMA2')
ax1.scatter(np.nanmedian(bcg2['ilum_10'] + bcg2['logm2l_i']), 
            np.nanmedian(bcg2['ilum_75'] + bcg2['logm2l_i']), 
            c='orange', alpha=0.9, s=240, marker='p', label='BCG2')
# Sample3
ax1.scatter(np.nanmedian(gama3['ilum_10'] + gama3['logm2l_i']), 
            np.nanmedian(gama3['ilum_75'] + gama3['logm2l_i']), 
            c='c', alpha=0.9, s=240, marker='8', label='GAMA3')
ax1.scatter(np.nanmedian(bcg3['ilum_10'] + bcg3['logm2l_i']), 
            np.nanmedian(bcg3['ilum_75'] + bcg3['logm2l_i']), 
            c='orange', alpha=0.9, s=240, marker='8', label='BCG3')

ax1.set_xlabel('$\log (M_{\star}/M_{\odot})_{<10 \mathrm{kpc}}$', size=32)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{<75 \mathrm{kpc}}$', size=36)

ax1.set_xlim(10.7, 12.35)
ax1.set_ylim(10.7, 12.35)

ax1.legend()

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.legend(loc=(0.70, 0.16), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.60, 0.08, 'Size: $\log (M_{\star}/M_{\odot})_{\mathrm{SBP}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=24.0, transform=ax1.transAxes)
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [43]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

logmRange = np.arange(10.0, 12.5, 0.2)
ax1.plot(logmRange, logmRange, 'k', linestyle='--', linewidth=3.0, alpha=0.8)

ax1.scatter((gamaTab['ilum_10'] + gamaTab['logm2l_i']), 
            (gamaTab['ilum_100'] + gamaTab['logm2l_i']), 
            c='b', alpha=0.15, s=(gamaTab['ilum_100'] + gamaTab['logm2l_i'] - 11.1) * 140.0, 
            marker='o', label='non-BCGs')
ax1.scatter((bcgTab['ilum_10'] + bcgTab['logm2l_i']), 
            (bcgTab['ilum_100'] + bcgTab['logm2l_i']), 
            c='r', alpha=0.80, s=(bcgTab['ilum_100'] + bcgTab['logm2l_i'] - 11.1) * 140.0, 
            marker='s', label='BCGs')

# Sample1
ax1.scatter(np.nanmedian(gama1['ilum_10'] + gama1['logm2l_i']), 
            np.nanmedian(gama1['ilum_100'] + gama1['logm2l_i']), 
            c='c', alpha=0.9, s=240, marker='h', label='GAMA1')
ax1.scatter(np.nanmedian(bcg1['ilum_10'] + bcg1['logm2l_i']), 
            np.nanmedian(bcg1['ilum_100'] + bcg1['logm2l_i']), 
            c='orange', alpha=0.9, s=240, marker='h', label='BCG1')
# Sample2
ax1.scatter(np.nanmedian(gama2['ilum_10'] + gama2['logm2l_i']), 
            np.nanmedian(gama2['ilum_100'] + gama2['logm2l_i']), 
            c='c', alpha=0.9, s=240, marker='p', label='GAMA2')
ax1.scatter(np.nanmedian(bcg2['ilum_10'] + bcg2['logm2l_i']), 
            np.nanmedian(bcg2['ilum_100'] + bcg2['logm2l_i']), 
            c='orange', alpha=0.9, s=240, marker='p', label='BCG2')
# Sample3
ax1.scatter(np.nanmedian(gama3['ilum_10'] + gama3['logm2l_i']), 
            np.nanmedian(gama3['ilum_100'] + gama3['logm2l_i']), 
            c='c', alpha=0.9, s=240, marker='8', label='GAMA3')
ax1.scatter(np.nanmedian(bcg3['ilum_10'] + bcg3['logm2l_i']), 
            np.nanmedian(bcg3['ilum_100'] + bcg3['logm2l_i']), 
            c='orange', alpha=0.9, s=240, marker='8', label='BCG3')

ax1.set_xlabel('$\log (M_{\star}/M_{\odot})_{<10 \mathrm{kpc}}$', size=32)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{<100 \mathrm{kpc}}$', size=36)

ax1.set_xlim(10.7, 12.35)
ax1.set_ylim(10.7, 12.35)

ax1.legend()

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.legend(loc=(0.70, 0.16), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.60, 0.08, 'Size: $\log (M_{\star}/M_{\odot})_{\mathrm{SBP}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=24.0, transform=ax1.transAxes)
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [44]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(11.4, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(11.6, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(11.8, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(12.0, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')

ax1.axhline(0.0, linewidth=5.0, alpha=0.6, 
            linestyle='dashed', c='k')

ax1.scatter((gamaTab['ilum_100'] + gamaTab['logm2l_i']), 
            (gamaTab['ilum_25'] + gamaTab['logm2l_i']) - (gamaTab['ilum_10'] + gamaTab['logm2l_i']), 
            c='b', alpha=0.15, s=100.0, 
            marker='o', label='non-BCGs')
ax1.scatter((bcgTab['ilum_100'] + bcgTab['logm2l_i']), 
            (bcgTab['ilum_25'] + bcgTab['logm2l_i']) - (bcgTab['ilum_10'] + bcgTab['logm2l_i']), 
            c='r', alpha=0.80, s=((bcgTab['LAMBDA_CLUSTER'] - 20) * 5), 
            marker='s', label='BCGs')

# Sample1
ax1.scatter(np.nanmedian(gama1['ilum_100'] + gama1['logm2l_i']), 
            np.nanmedian(gama1['ilum_25'] - gama1['ilum_10']), 
            c='c', alpha=0.9, s=240, marker='h', label='GAMA1')
ax1.scatter(np.nanmedian(bcg1['ilum_100'] + bcg1['logm2l_i']), 
            np.nanmedian(bcg1['ilum_25'] - bcg1['ilum_10']), 
            c='orange', alpha=0.9, s=240, marker='h', label='BCG1')
# Sample2
ax1.scatter(np.nanmedian(gama2['ilum_100'] + gama2['logm2l_i']), 
            np.nanmedian(gama2['ilum_25'] - gama2['ilum_10']), 
            c='c', alpha=0.9, s=240, marker='p', label='GAMA2')
ax1.scatter(np.nanmedian(bcg2['ilum_100'] + bcg2['logm2l_i']), 
            np.nanmedian(bcg2['ilum_25'] - bcg2['ilum_10']), 
            c='orange', alpha=0.9, s=240, marker='p', label='BCG2')
# Sample3
ax1.scatter(np.nanmedian(gama3['ilum_100'] + gama3['logm2l_i']), 
            np.nanmedian(gama3['ilum_25'] - gama3['ilum_10']), 
            c='c', alpha=0.9, s=240, marker='8', label='GAMA3')
ax1.scatter(np.nanmedian(bcg3['ilum_100'] + bcg3['logm2l_i']), 
            np.nanmedian(bcg3['ilum_25'] - bcg3['ilum_10']), 
            c='orange', alpha=0.9, s=240, marker='8', label='BCG3')

ax1.set_xlabel('$\log (M_{\star}/M_{\odot})_{\mathrm{SBP}}$', size=32)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{<25 \mathrm{kpc}} - \log (M_{\star}/M_{\odot})_{<10 \mathrm{kpc}}$', 
               size=36)

ax1.set_xlim(10.7, 12.35)
ax1.set_ylim(0.01, 0.90)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.legend(loc=(0.08, 0.53), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.10, 0.47, 'Size: ${\Lambda}_{\mathrm{redMapper}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=24.0, transform=ax1.transAxes)
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [45]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(11.4, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(11.6, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(11.8, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(12.0, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')

ax1.axhline(0.0, linewidth=5.0, alpha=0.6, 
            linestyle='dashed', c='k')

ax1.scatter((gamaTab['ilum_100'] + gamaTab['logm2l_i']), 
            (gamaTab['ilum_50'] + gamaTab['logm2l_i']) - (gamaTab['ilum_10'] + gamaTab['logm2l_i']), 
            c='b', alpha=0.15, s=100.0, 
            marker='o', label='non-BCGs')
ax1.scatter((bcgTab['ilum_100'] + bcgTab['logm2l_i']), 
            (bcgTab['ilum_50'] + bcgTab['logm2l_i']) - (bcgTab['ilum_10'] + bcgTab['logm2l_i']), 
            c='r', alpha=0.80, s=((bcgTab['LAMBDA_CLUSTER'] - 20) * 5), 
            marker='s', label='BCGs')

ax1.set_xlabel('$\log (M_{\star}/M_{\odot})_{\mathrm{SBP}}$', size=32)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{<50 \mathrm{kpc}} - \log (M_{\star}/M_{\odot})_{<10 \mathrm{kpc}}$', 
               size=36)

# Sample1
ax1.scatter(np.nanmedian(gama1['ilum_100'] + gama1['logm2l_i']), 
            np.nanmedian(gama1['ilum_50'] - gama1['ilum_10']), 
            c='c', alpha=0.9, s=240, marker='h', label='GAMA1')
ax1.scatter(np.nanmedian(bcg1['ilum_100'] + bcg1['logm2l_i']), 
            np.nanmedian(bcg1['ilum_50'] - bcg1['ilum_10']), 
            c='orange', alpha=0.9, s=240, marker='h', label='BCG1')
# Sample2
ax1.scatter(np.nanmedian(gama2['ilum_100'] + gama2['logm2l_i']), 
            np.nanmedian(gama2['ilum_50'] - gama2['ilum_10']), 
            c='c', alpha=0.9, s=240, marker='p', label='GAMA2')
ax1.scatter(np.nanmedian(bcg2['ilum_100'] + bcg2['logm2l_i']), 
            np.nanmedian(bcg2['ilum_50'] - bcg2['ilum_10']), 
            c='orange', alpha=0.9, s=240, marker='p', label='BCG2')
# Sample3
ax1.scatter(np.nanmedian(gama3['ilum_100'] + gama3['logm2l_i']), 
            np.nanmedian(gama3['ilum_50'] - gama3['ilum_10']), 
            c='c', alpha=0.9, s=240, marker='8', label='GAMA3')
ax1.scatter(np.nanmedian(bcg3['ilum_100'] + bcg3['logm2l_i']), 
            np.nanmedian(bcg3['ilum_50'] - bcg3['ilum_10']), 
            c='orange', alpha=0.9, s=240, marker='8', label='BCG3')

ax1.set_xlim(10.7, 12.35)
ax1.set_ylim(0.01, 0.90)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.legend(loc=(0.08, 0.53), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.10, 0.47, 'Size: ${\Lambda}_{\mathrm{redMapper}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=24.0, transform=ax1.transAxes)
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [46]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(11.4, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(11.6, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(11.8, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(12.0, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')

ax1.axhline(0.0, linewidth=5.0, alpha=0.6, 
            linestyle='dashed', c='k')

ax1.scatter((gamaTab['ilum_100'] + gamaTab['logm2l_i']), 
            (gamaTab['ilum_75'] + gamaTab['logm2l_i']) - (gamaTab['ilum_10'] + gamaTab['logm2l_i']), 
            c='b', alpha=0.15, s=100.0, 
            marker='o', label='non-BCGs')
ax1.scatter((bcgTab['ilum_100'] + bcgTab['logm2l_i']), 
            (bcgTab['ilum_75'] + bcgTab['logm2l_i']) - (bcgTab['ilum_10'] + bcgTab['logm2l_i']), 
            c='r', alpha=0.80, s=((bcgTab['LAMBDA_CLUSTER'] - 20) * 5), 
            marker='s', label='BCGs')

# Sample1
ax1.scatter(np.nanmedian(gama1['ilum_100'] + gama1['logm2l_i']), 
            np.nanmedian(gama1['ilum_75'] - gama1['ilum_10']), 
            c='c', alpha=0.9, s=240, marker='h', label='GAMA1')
ax1.scatter(np.nanmedian(bcg1['ilum_100'] + bcg1['logm2l_i']), 
            np.nanmedian(bcg1['ilum_75'] - bcg1['ilum_10']), 
            c='orange', alpha=0.9, s=240, marker='h', label='BCG1')
# Sample2
ax1.scatter(np.nanmedian(gama2['ilum_100'] + gama2['logm2l_i']), 
            np.nanmedian(gama2['ilum_75'] - gama2['ilum_10']), 
            c='c', alpha=0.9, s=240, marker='p', label='GAMA2')
ax1.scatter(np.nanmedian(bcg2['ilum_100'] + bcg2['logm2l_i']), 
            np.nanmedian(bcg2['ilum_75'] - bcg2['ilum_10']), 
            c='orange', alpha=0.9, s=240, marker='p', label='BCG2')
# Sample3
ax1.scatter(np.nanmedian(gama3['ilum_100'] + gama3['logm2l_i']), 
            np.nanmedian(gama3['ilum_75'] - gama3['ilum_10']), 
            c='c', alpha=0.9, s=240, marker='8', label='GAMA3')
ax1.scatter(np.nanmedian(bcg3['ilum_100'] + bcg3['logm2l_i']), 
            np.nanmedian(bcg3['ilum_75'] - bcg3['ilum_10']), 
            c='orange', alpha=0.9, s=240, marker='8', label='BCG3')

ax1.set_xlabel('$\log (M_{\star}/M_{\odot})_{\mathrm{SBP}}$', size=32)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{<75 \mathrm{kpc}} - \log (M_{\star}/M_{\odot})_{<10 \mathrm{kpc}}$', 
               size=36)

ax1.set_xlim(10.7, 12.35)
ax1.set_ylim(0.01, 0.90)

ax1.legend()

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.legend(loc=(0.08, 0.53), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.10, 0.47, 'Size: ${\Lambda}_{\mathrm{redMapper}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=24.0, transform=ax1.transAxes)
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)



In [47]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axvline(11.4, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(11.6, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(11.8, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')
ax1.axvline(12.0, linewidth=5.0, alpha=0.3, 
            linestyle='dashed', c='k')

ax1.axhline(0.0, linewidth=5.0, alpha=0.6, 
            linestyle='dashed', c='k')

ax1.scatter((gamaTab['ilum_100'] + gamaTab['logm2l_i']), 
            (gamaTab['ilum_100'] + gamaTab['logm2l_i']) - (gamaTab['ilum_10'] + gamaTab['logm2l_i']), 
            c='b', alpha=0.15, s=100.0, 
            marker='o', label='non-BCGs')
ax1.scatter((bcgTab['ilum_100'] + bcgTab['logm2l_i']), 
            (bcgTab['ilum_100'] + bcgTab['logm2l_i']) - (bcgTab['ilum_10'] + bcgTab['logm2l_i']), 
            c='r', alpha=0.80, s=((bcgTab['LAMBDA_CLUSTER'] - 20) * 5), 
            marker='s', label='BCGs')

# Sample1
ax1.scatter(np.nanmedian(gama1['ilum_100'] + gama1['logm2l_i']), 
            np.nanmedian(gama1['ilum_100'] - gama1['ilum_10']), 
            c='c', alpha=0.9, s=240, marker='h', label='GAMA1')
ax1.scatter(np.nanmedian(bcg1['ilum_100'] + bcg1['logm2l_i']), 
            np.nanmedian(bcg1['ilum_100'] - bcg1['ilum_10']), 
            c='orange', alpha=0.9, s=240, marker='h', label='BCG1')
# Sample2
ax1.scatter(np.nanmedian(gama2['ilum_100'] + gama2['logm2l_i']), 
            np.nanmedian(gama2['ilum_100'] - gama2['ilum_10']), 
            c='c', alpha=0.9, s=240, marker='p', label='GAMA2')
ax1.scatter(np.nanmedian(bcg2['ilum_100'] + bcg2['logm2l_i']), 
            np.nanmedian(bcg2['ilum_100'] - bcg2['ilum_10']), 
            c='orange', alpha=0.9, s=240, marker='p', label='BCG2')
# Sample3
ax1.scatter(np.nanmedian(gama3['ilum_100'] + gama3['logm2l_i']), 
            np.nanmedian(gama3['ilum_100'] - gama3['ilum_10']), 
            c='c', alpha=0.9, s=240, marker='8', label='GAMA3')
ax1.scatter(np.nanmedian(bcg3['ilum_100'] + bcg3['logm2l_i']), 
            np.nanmedian(bcg3['ilum_100'] - bcg3['ilum_10']), 
            c='orange', alpha=0.9, s=240, marker='8', label='BCG3')

ax1.set_xlabel('$\log (M_{\star}/M_{\odot})_{\mathrm{SBP}}$', size=32)
ax1.set_ylabel('$\log (M_{\star}/M_{\odot})_{<100 \mathrm{kpc}} - \log (M_{\star}/M_{\odot})_{<10 \mathrm{kpc}}$', 
               size=36)

ax1.set_xlim(10.7, 12.35)
ax1.set_ylim(0.01, 0.90)

ax1.legend()

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.legend(loc=(0.08, 0.53), shadow=True, fancybox=True, 
           numpoints=1, fontsize=24, scatterpoints=1, 
           markerscale=1.2, borderpad=0.25, handletextpad=0.1)

ax1.text(0.10, 0.47, 'Size: ${\Lambda}_{\mathrm{redMapper}}$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=24.0, transform=ax1.transAxes)
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


Stacked Profiles

Sample 1


In [67]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama1), ipython_widget=True) as bar:
    try:
        del gMstack
    except Exception: 
        pass
    for g in gama1:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        ax1.plot((gProf['rKpc']**0.25), (gProf['muI1'] + g['logm2l_i']), c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d((gProf['rKpc']**0.25), (gProf['muI1'] + g['logm2l_i']), 
                              kind='linear')
        try:
            gMprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA :BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gMstack = np.vstack((gMstack, gMprof_intrp))
        except NameError: 
            gMstack = gMprof_intrp
        bar.update()
     
with ProgressBar(len(bcg1), ipython_widget=True) as bar:
    try:
        del bMstack
    except Exception:
        pass
    for b in bcg1:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        ax1.plot((bProf['rKpc']**0.25), (bProf['muI1'] + b['logm2l_i']), c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), (bProf['muI1'] + b['logm2l_i']), 
                              kind='linear')
        try:
            bMprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG :BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bMstack = np.vstack((bMstack, bMprof_intrp))
        except NameError: 
            bMstack = bMprof_intrp
        bar.update()

# Median & Average profiles
gMprof_med = confidence_interval(gMstack, axis=0, alpha=np.asarray([SIGMA1, 1.0]), 
                                 metric=np.nanmedian, numResamples=1000, 
                                 interpolate=True) 
gMprof_avg = np.nanmean(gMstack, axis=0) 
bMprof_med = confidence_interval(bMstack, axis=0, alpha=np.asarray([SIGMA1, 1.0]), 
                                 metric=np.nanmedian, numResamples=1000, 
                                 interpolate=True)
bMprof_avg = np.nanmean(bMstack, axis=0) 

ax1.fill_between(rsma_common, gMprof_med[0], gMprof_med[1], 
                 facecolor='b', alpha=0.4, zorder=1005)
ax1.fill_between(rsma_common, bMprof_med[0], bMprof_med[1], 
                 facecolor='r', alpha=0.4, zorder=1005)

ax1.plot(rsma_common, gMprof_med[2], c='b', linewidth=3.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gMprof_avg, c='b', linewidth=3.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bMprof_med[2], c='r', linewidth=3.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bMprof_avg, c='r', linewidth=3.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.4 < \log (M_{\mathrm{SBP}}) < 11.6$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('$log ({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=36)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(4.4, 10.4)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA :BAD INTERPOLATION FOR 9218



In [188]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama1), ipython_widget=True) as bar:
    try:
        del gNstack
    except Exception: 
        pass
    for g in gama1:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gNorm = normProf(gProf['rKpc'], (gProf['muI1'] + g['logm2l_i']), 10.0, 12.0)
        ax1.plot((gProf['rKpc']**0.25), gNorm, c='c', 
                 alpha=0.15, linewidth=1.0)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gNorm, 
                              kind='linear')
        try:
            gNprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA :BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue        
        try: 
            gNstack = np.vstack((gNstack, gNprof_intrp))
        except NameError: 
            gNstack = gNprof_intrp
        bar.update()
     
with ProgressBar(len(bcg1), ipython_widget=True) as bar:
    try:
        del bNstack
    except Exception: 
        pass
    for b in bcg1:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bNorm = normProf(bProf['rKpc'], (bProf['muI1'] + b['logm2l_i']), 10.0, 12.0)
        ax1.plot((bProf['rKpc']**0.25), bNorm, c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bNorm, 
                              kind='linear')
        try:
            bNprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG :BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue             
        try: 
            bNstack = np.vstack((bNstack, bNprof_intrp))
        except NameError: 
            bNstack = bNprof_intrp
        bar.update()
    
# Median & Average profiles
gNprof_med = np.nanmedian(gNstack, axis=0) 
gNprof_avg = np.nanmean(gNstack, axis=0) 
bNprof_med = np.nanmedian(bNstack, axis=0) 
bNprof_avg = np.nanmean(bNstack, axis=0) 
ax1.plot(rsma_common, gNprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gNprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bNprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bNprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.4 < \log (M_{\mathrm{SBP}}) < 11.6$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)
ax1.text(0.30, 0.83, 'Normalized at 10 kpc', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('$\log ({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=36)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(-4.1, 2.09)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA :BAD INTERPOLATION FOR 9218



In [189]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama1), ipython_widget=True) as bar:
    try:
        del gCstack
    except Exception: 
        pass
    for g in gama1:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gCNorm = normProf(gProf['rKpc'], (gProf['muI1'] - gProf['muG1']), 10.0, 12.0)
        ax1.plot((gProf['rKpc']**0.25), gCNorm, c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gCNorm, 
                              kind='linear')
        try:
            gCprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA :BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue             
        try: 
            gCstack = np.vstack((gCstack, gCprof_intrp))
        except NameError: 
            gCstack = gCprof_intrp
        bar.update()
     
with ProgressBar(len(bcg1), ipython_widget=True) as bar:
    try:
        del bCstack
    except Exception: 
        pass
    for b in bcg1:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bCNorm = normProf(bProf['rKpc'], (bProf['muI1'] - bProf['muG1']), 10.0, 12.0)
        ax1.plot((bProf['rKpc']**0.25), bCNorm, c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bCNorm, 
                              kind='linear')
        try:
            bCprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG :BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bCstack = np.vstack((bCstack, bCprof_intrp))
        except NameError: 
            bCstack = bCprof_intrp
        bar.update()
    
# Median & Average profiles
gCprof_med = np.nanmedian(gCstack, axis=0) 
gCprof_avg = np.nanmean(gCstack, axis=0) 
bCprof_med = np.nanmedian(bCstack, axis=0) 
bCprof_avg = np.nanmean(bCstack, axis=0) 
ax1.plot(rsma_common, gCprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gCprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bCprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bCprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.4 < \log (M_{\mathrm{SBP}}) < 11.6$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)
ax1.text(0.30, 0.83, 'Normalized at 10 kpc', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('($g-i$) (mag)', size=36)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(-0.6, 0.5)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA :BAD INTERPOLATION FOR 9218

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:21: RuntimeWarning: invalid value encountered in subtract
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:44: RuntimeWarning: invalid value encountered in subtract


In [190]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axhline(0.00, linewidth=4.0, c='k', linestyle='solid', alpha=0.4)
# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama1), ipython_widget=True) as bar:
    try:
        del gGstack
    except Exception: 
        pass
    for g in gama1:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gGrowth = (gProf['lumI1'] - g['ilum_100'])
        ax1.plot((gProf['rKpc']**0.25), gGrowth, c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gGrowth, 
                              kind='linear')
        try:
            gGrowth_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA :BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gGstack = np.vstack((gGstack, gGrowth_intrp))
        except NameError: 
            gGstack = gGrowth_intrp
        bar.update()
     
with ProgressBar(len(bcg1), ipython_widget=True) as bar:
    try:
        del bGstack
    except Exception: 
        pass
    for b in bcg1:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bGrowth = (bProf['lumI1'] - b['ilum_100'])
        ax1.plot((bProf['rKpc']**0.25), bGrowth, c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bGrowth, 
                              kind='linear')
        try:
            bGrowth_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG :BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bGstack = np.vstack((bGstack, bGrowth_intrp))
        except NameError: 
            bGstack = bGrowth_intrp
        bar.update()

# Median & Average profiles
gGprof_med = np.nanmedian(gGstack, axis=0) 
gGprof_avg = np.nanmean(gGstack, axis=0) 
bGprof_med = np.nanmedian(bGstack, axis=0) 
bGprof_avg = np.nanmean(bGstack, axis=0) 
ax1.plot(rsma_common, gGprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gGprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bGprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bGprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.4 < \log (M_{\mathrm{SBP}}) < 11.6$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('Nomalized Curve of Growth', size=32)

ax1.set_xlim(0.5, 4.3)
ax1.set_ylim(-3.0, 0.49)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA :BAD INTERPOLATION FOR 9218



In [199]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axhline(0.00, linewidth=4.0, c='k', linestyle='solid', alpha=0.4)
# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama1), ipython_widget=True) as bar:
    try:
        del gLstack
    except Exception: 
        pass
    for g in gama1:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gLprof = (gProf['lumI1'] + g['logm2l_i'])
        ax1.plot((gProf['rKpc']**0.25), gLprof, c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gLprof, 
                              kind='linear')
        try:
            gLprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA :BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gLstack = np.vstack((gLstack, gLprof_intrp))
        except NameError: 
            gLstack = gLprof_intrp
        bar.update()
     
with ProgressBar(len(bcg1), ipython_widget=True) as bar:
    try:
        del bLstack
    except Exception: 
        pass
    for b in bcg1:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bLprof = (bProf['lumI1'] + b['logm2l_i'])
        ax1.plot((bProf['rKpc']**0.25), bLprof, c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bLprof, 
                              kind='linear')
        try:
            bLprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG :BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bLstack = np.vstack((bLstack, bLprof_intrp))
        except NameError: 
            bLstack = bLprof_intrp
        bar.update()

# Median & Average profiles
gLprof_med = np.nanmedian(gLstack, axis=0) 
gLprof_avg = np.nanmean(gLstack, axis=0) 
bLprof_med = np.nanmedian(bLstack, axis=0) 
bLprof_avg = np.nanmean(bLstack, axis=0) 
ax1.plot(rsma_common, gLprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gLprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bLprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bLprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.4 < \log (M_{\mathrm{SBP}}) < 11.6$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('Nomalized Curve of Growth', size=32)

ax1.set_xlim(0.5, 4.3)
ax1.set_ylim(8.5, 12.09)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA :BAD INTERPOLATION FOR 9218


Sample 2


In [192]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama2), ipython_widget=True) as bar:
    try:
        del gMstack
    except Exception: 
        pass
    for g in gama2:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        ax1.plot((gProf['rKpc']**0.25), (gProf['muI1'] + g['logm2l_i']), c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d((gProf['rKpc']**0.25), (gProf['muI1'] + g['logm2l_i']), 
                              kind='linear')
        try:
            gMprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA: BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gMstack = np.vstack((gMstack, gMprof_intrp))
        except NameError: 
            gMstack = gMprof_intrp
        bar.update()
     
with ProgressBar(len(bcg2), ipython_widget=True) as bar:
    try:
        del bMstack
    except Exception:
        pass
    for b in bcg2:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        ax1.plot((bProf['rKpc']**0.25), (bProf['muI1'] + b['logm2l_i']), c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), (bProf['muI1'] + b['logm2l_i']), 
                              kind='linear')
        try:
            bMprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG: BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bMstack = np.vstack((bMstack, bMprof_intrp))
        except NameError: 
            bMstack = bMprof_intrp
        bar.update()

# Median & Average profiles
gMprof_med = np.nanmedian(gMstack, axis=0) 
gMprof_avg = np.nanmean(gMstack, axis=0) 
bMprof_med = np.nanmedian(bMstack, axis=0) 
bMprof_avg = np.nanmean(bMstack, axis=0) 
ax1.plot(rsma_common, gMprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gMprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bMprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bMprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.6 < \log (M_{\mathrm{SBP}}) < 11.8$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('$log ({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=36)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(4.4, 10.4)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA: BAD INTERPOLATION FOR 9041



In [193]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama2), ipython_widget=True) as bar:
    try:
        del gNstack
    except Exception: 
        pass
    for g in gama2:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gNorm = normProf(gProf['rKpc'], (gProf['muI1'] + g['logm2l_i']), 10.0, 12.0)
        ax1.plot((gProf['rKpc']**0.25), gNorm, c='c', 
                 alpha=0.15, linewidth=1.0)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gNorm, 
                              kind='linear')
        try:
            gNprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA : BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gNstack = np.vstack((gNstack, gNprof_intrp))
        except NameError: 
            gNstack = gNprof_intrp
        bar.update()
     
with ProgressBar(len(bcg2), ipython_widget=True) as bar:
    try:
        del bNstack
    except Exception: 
        pass
    for b in bcg2:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bNorm = normProf(bProf['rKpc'], (bProf['muI1'] + b['logm2l_i']), 10.0, 12.0)
        ax1.plot((bProf['rKpc']**0.25), bNorm, c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bNorm, 
                              kind='linear')
        try:
            bNprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA : BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bNstack = np.vstack((bNstack, bNprof_intrp))
        except NameError: 
            bNstack = bNprof_intrp
        bar.update()
    
# Median & Average profiles
gNprof_med = np.nanmedian(gNstack, axis=0) 
gNprof_avg = np.nanmean(gNstack, axis=0) 
bNprof_med = np.nanmedian(bNstack, axis=0) 
bNprof_avg = np.nanmean(bNstack, axis=0) 
ax1.plot(rsma_common, gNprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gNprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bNprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bNprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.6 < \log (M_{\mathrm{SBP}}) < 11.8$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)
ax1.text(0.30, 0.83, 'Normalized at 10 kpc', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('$\log ({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=36)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(-4.1, 2.09)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA : BAD INTERPOLATION FOR 9041



In [194]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama2), ipython_widget=True) as bar:
    try:
        del gNstack
    except Exception: 
        pass
    for g in gama2:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gNorm = normProf(gProf['rKpc'], (gProf['muI1'] + g['logm2l_i']), 13.0, 17.0)
        ax1.plot((gProf['rKpc']**0.25), gNorm, c='c', 
                 alpha=0.15, linewidth=1.0)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gNorm, 
                              kind='linear')
        try:
            gNprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA : BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gNstack = np.vstack((gNstack, gNprof_intrp))
        except NameError: 
            gNstack = gNprof_intrp
        bar.update()
     
with ProgressBar(len(bcg2), ipython_widget=True) as bar:
    try:
        del bNstack
    except Exception: 
        pass
    for b in bcg2:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bNorm = normProf(bProf['rKpc'], (bProf['muI1'] + b['logm2l_i']), 13.0, 17.0)
        ax1.plot((bProf['rKpc']**0.25), bNorm, c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bNorm, 
                              kind='linear')
        try:
            bNprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG : BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bNstack = np.vstack((bNstack, bNprof_intrp))
        except NameError: 
            bNstack = bNprof_intrp
        bar.update()
    
# Median & Average profiles
gNprof_med = np.nanmedian(gNstack, axis=0) 
gNprof_avg = np.nanmean(gNstack, axis=0) 
bNprof_med = np.nanmedian(bNstack, axis=0) 
bNprof_avg = np.nanmean(bNstack, axis=0) 
ax1.plot(rsma_common, gNprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gNprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bNprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bNprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.6 < \log (M_{\mathrm{SBP}}) < 11.8$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)
ax1.text(0.30, 0.83, 'Normalized at 15 kpc', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('$\log ({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=36)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(-3.8, 2.39)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA : BAD INTERPOLATION FOR 9041



In [195]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama2), ipython_widget=True) as bar:
    try:
        del gCstack
    except Exception: 
        pass
    for g in gama2:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gCNorm = normProf(gProf['rKpc'], (gProf['muI1'] - gProf['muG1']), 10.0, 12.0)
        ax1.plot((gProf['rKpc']**0.25), gCNorm, c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gCNorm, 
                              kind='linear')
        try:
            gCprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA : BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gCstack = np.vstack((gCstack, gCprof_intrp))
        except NameError: 
            gCstack = gCprof_intrp
        bar.update()
     
with ProgressBar(len(bcg2), ipython_widget=True) as bar:
    try:
        del bCstack
    except Exception: 
        pass
    for b in bcg2:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bCNorm = normProf(bProf['rKpc'], (bProf['muI1'] - bProf['muG1']), 10.0, 12.0)
        ax1.plot((bProf['rKpc']**0.25), bCNorm, c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bCNorm, 
                              kind='linear')
        try:
            bCprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG : BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue        
        try: 
            bCstack = np.vstack((bCstack, bCprof_intrp))
        except NameError: 
            bCstack = bCprof_intrp
        bar.update()
    
# Median & Average profiles
gCprof_med = np.nanmedian(gCstack, axis=0) 
gCprof_avg = np.nanmean(gCstack, axis=0) 
bCprof_med = np.nanmedian(bCstack, axis=0) 
bCprof_avg = np.nanmean(bCstack, axis=0) 
ax1.plot(rsma_common, gCprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gCprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bCprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bCprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.6 < \log (M_{\mathrm{SBP}}) < 11.8$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)
ax1.text(0.30, 0.83, 'Normalized at 10 kpc', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('($g-i$) (mag)', size=36)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(-0.6, 0.5)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA : BAD INTERPOLATION FOR 9041

/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:21: RuntimeWarning: invalid value encountered in subtract
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:44: RuntimeWarning: invalid value encountered in subtract


In [196]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axhline(0.00, linewidth=4.0, c='k', linestyle='solid', alpha=0.4)
# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama2), ipython_widget=True) as bar:
    try:
        del gGstack
    except Exception: 
        pass
    for g in gama2:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gGrowth = (gProf['lumI1'] - g['ilum_max'])
        ax1.plot((gProf['rKpc']**0.25), gGrowth, c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gGrowth, 
                              kind='linear')
        try:
            gGrowth_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA : BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue        
        try: 
            gGstack = np.vstack((gGstack, gGrowth_intrp))
        except NameError: 
            gGstack = gGrowth_intrp
        bar.update()
     
with ProgressBar(len(bcg2), ipython_widget=True) as bar:
    try:
        del bGstack
    except Exception: 
        pass
    for b in bcg2:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bGrowth = (bProf['lumI1'] - b['ilum_max'])
        ax1.plot((bProf['rKpc']**0.25), bGrowth, c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bGrowth, 
                              kind='linear')
        try:
            bGrowth_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG : BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bGstack = np.vstack((bGstack, bGrowth_intrp))
        except NameError: 
            bGstack = bGrowth_intrp
        bar.update()

# Median & Average profiles
gGprof_med = np.nanmedian(gGstack, axis=0) 
gGprof_avg = np.nanmean(gGstack, axis=0) 
bGprof_med = np.nanmedian(bGstack, axis=0) 
bGprof_avg = np.nanmean(bGstack, axis=0) 
ax1.plot(rsma_common, gGprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gGprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bGprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bGprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.6 < \log (M_{\mathrm{SBP}}) < 11.8$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('Nomalized Curve of Growth', size=32)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(-3.0, 0.49)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA : BAD INTERPOLATION FOR 9041



In [201]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axhline(0.00, linewidth=4.0, c='k', linestyle='solid', alpha=0.4)
# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama2), ipython_widget=True) as bar:
    try:
        del gLstack
    except Exception: 
        pass
    for g in gama2:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gLprof = (gProf['lumI1'] + g['logm2l_i'])
        ax1.plot((gProf['rKpc']**0.25), gLprof, c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gLprof, 
                              kind='linear')
        try:
            gLprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA :BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gLstack = np.vstack((gLstack, gLprof_intrp))
        except NameError: 
            gLstack = gLprof_intrp
        bar.update()
     
with ProgressBar(len(bcg2), ipython_widget=True) as bar:
    try:
        del bLstack
    except Exception: 
        pass
    for b in bcg2:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bLprof = (bProf['lumI1'] + b['logm2l_i'])
        ax1.plot((bProf['rKpc']**0.25), bLprof, c='orange', 
                 alpha=0.6, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bLprof, 
                              kind='linear')
        try:
            bLprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG :BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bLstack = np.vstack((bLstack, bLprof_intrp))
        except NameError: 
            bLstack = bLprof_intrp
        bar.update()

# Median & Average profiles
gLprof_med = np.nanmedian(gLstack, axis=0) 
gLprof_avg = np.nanmean(gLstack, axis=0) 
bLprof_med = np.nanmedian(bLstack, axis=0) 
bLprof_avg = np.nanmean(bLstack, axis=0) 
ax1.plot(rsma_common, gLprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gLprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bLprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bLprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.6 < \log (M_{\mathrm{SBP}}) < 11.8$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('Nomalized Curve of Growth', size=32)

ax1.set_xlim(0.5, 4.3)
ax1.set_ylim(8.5, 12.19)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA :BAD INTERPOLATION FOR 9041


Sample 3


In [202]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama3), ipython_widget=True) as bar:
    try:
        del gMstack
    except Exception: 
        pass
    for g in gama3:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        ax1.plot((gProf['rKpc']**0.25), (gProf['muI1'] + g['logm2l_i']), c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d((gProf['rKpc']**0.25), (gProf['muI1'] + g['logm2l_i']), 
                              kind='linear')
        try:
            gMprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA : BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gMstack = np.vstack((gMstack, gMprof_intrp))
        except NameError: 
            gMstack = gMprof_intrp
        bar.update()
     
with ProgressBar(len(bcg3), ipython_widget=True) as bar:
    try:
        del bMstack
    except Exception:
        pass
    for b in bcg3:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        ax1.plot((bProf['rKpc']**0.25), (bProf['muI1'] + b['logm2l_i']), c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), (bProf['muI1'] + b['logm2l_i']), 
                              kind='linear')
        try:
            bMprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG : BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bMstack = np.vstack((bMstack, bMprof_intrp))
        except NameError: 
            bMstack = bMprof_intrp
        bar.update()

# Median & Average profiles
gMprof_med = np.nanmedian(gMstack, axis=0) 
gMprof_avg = np.nanmean(gMstack, axis=0) 
bMprof_med = np.nanmedian(bMstack, axis=0) 
bMprof_avg = np.nanmean(bMstack, axis=0) 
ax1.plot(rsma_common, gMprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gMprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bMprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bMprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.8 < \log (M_{\mathrm{SBP}}) < 12.0$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('$log ({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=36)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(4.4, 10.4)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA : BAD INTERPOLATION FOR 12025



In [203]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama3), ipython_widget=True) as bar:
    try:
        del gNstack
    except Exception: 
        pass
    for g in gama3:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gNorm = normProf(gProf['rKpc'], (gProf['muI1'] + g['logm2l_i']), 10.0, 12.0)
        ax1.plot((gProf['rKpc']**0.25), gNorm, c='c', 
                 alpha=0.15, linewidth=1.0)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gNorm, 
                              kind='linear')
        try:
            gNprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA : BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gNstack = np.vstack((gNstack, gNprof_intrp))
        except NameError: 
            gNstack = gNprof_intrp
        bar.update()
     
with ProgressBar(len(bcg3), ipython_widget=True) as bar:
    try:
        del bNstack
    except Exception: 
        pass
    for b in bcg3:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bNorm = normProf(bProf['rKpc'], (bProf['muI1'] + b['logm2l_i']), 10.0, 12.0)
        ax1.plot((bProf['rKpc']**0.25), bNorm, c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bNorm, 
                              kind='linear')
        try:
            bNprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG : BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bNstack = np.vstack((bNstack, bNprof_intrp))
        except NameError: 
            bNstack = bNprof_intrp
        bar.update()
    
# Median & Average profiles
gNprof_med = np.nanmedian(gNstack, axis=0) 
gNprof_avg = np.nanmean(gNstack, axis=0) 
bNprof_med = np.nanmedian(bNstack, axis=0) 
bNprof_avg = np.nanmean(bNstack, axis=0) 
ax1.plot(rsma_common, gNprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gNprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bNprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bNprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.8 < \log (M_{\mathrm{SBP}}) < 12.0$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)
ax1.text(0.30, 0.83, 'Normalized at 10 kpc', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('$\log ({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=36)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(-4.1, 2.09)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA : BAD INTERPOLATION FOR 12025



In [204]:
fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama3), ipython_widget=True) as bar:
    try:
        del gNstack
    except Exception: 
        pass
    for g in gama3:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gNorm = normProf(gProf['rKpc'], (gProf['muI1'] + g['logm2l_i']), 13.0, 17.0)
        ax1.plot((gProf['rKpc']**0.25), gNorm, c='c', 
                 alpha=0.15, linewidth=1.0)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gNorm, 
                              kind='linear')
        try:
            gNprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA : BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gNstack = np.vstack((gNstack, gNprof_intrp))
        except NameError: 
            gNstack = gNprof_intrp
        bar.update()
     
with ProgressBar(len(bcg3), ipython_widget=True) as bar:
    try:
        del bNstack
    except Exception: 
        pass
    for b in bcg3:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bNorm = normProf(bProf['rKpc'], (bProf['muI1'] + b['logm2l_i']), 13.0, 17.0)
        ax1.plot((bProf['rKpc']**0.25), bNorm, c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bNorm, 
                              kind='linear')
        try:
            bNprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG : BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bNstack = np.vstack((bNstack, bNprof_intrp))
        except NameError: 
            bNstack = bNprof_intrp
        bar.update()
    
# Median & Average profiles
gNprof_med = np.nanmedian(gNstack, axis=0) 
gNprof_avg = np.nanmean(gNstack, axis=0) 
bNprof_med = np.nanmedian(bNstack, axis=0) 
bNprof_avg = np.nanmean(bNstack, axis=0) 
ax1.plot(rsma_common, gNprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gNprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bNprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bNprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.8 < \log (M_{\mathrm{SBP}}) < 12.0$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)
ax1.text(0.30, 0.83, 'Normalized at 15 kpc', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('$\log ({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=36)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(-3.8, 2.39)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA : BAD INTERPOLATION FOR 12025



In [205]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama3), ipython_widget=True) as bar:
    try:
        del gCstack
    except Exception: 
        pass
    for g in gama3:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gCNorm = normProf(gProf['rKpc'], (gProf['muI1'] - gProf['muG1']), 10.0, 12.0)
        ax1.plot((gProf['rKpc']**0.25), gCNorm, c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gCNorm, 
                              kind='linear')
        try:
            gCprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA : BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gCstack = np.vstack((gCstack, gCprof_intrp))
        except NameError: 
            gCstack = gCprof_intrp
        bar.update()
     
with ProgressBar(len(bcg3), ipython_widget=True) as bar:
    try:
        del bCstack
    except Exception: 
        pass
    for b in bcg3:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bCNorm = normProf(bProf['rKpc'], (bProf['muI1'] - bProf['muG1']), 10.0, 12.0)
        ax1.plot((bProf['rKpc']**0.25), bCNorm, c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bCNorm, 
                              kind='linear')
        try:
            bCprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG : BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue        
        try: 
            bCstack = np.vstack((bCstack, bCprof_intrp))
        except NameError: 
            bCstack = bCprof_intrp
        bar.update()
    
# Median & Average profiles
gCprof_med = np.nanmedian(gCstack, axis=0) 
gCprof_avg = np.nanmean(gCstack, axis=0) 
bCprof_med = np.nanmedian(bCstack, axis=0) 
bCprof_avg = np.nanmean(bCstack, axis=0) 
ax1.plot(rsma_common, gCprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gCprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bCprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bCprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.8 < \log (M_{\mathrm{SBP}}) < 12.0$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)
ax1.text(0.30, 0.83, 'Normalized at 10 kpc', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('($g-i$) (mag)', size=36)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(-0.6, 0.5)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA : BAD INTERPOLATION FOR 12025


/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:21: RuntimeWarning: invalid value encountered in subtract

In [206]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axhline(0.00, linewidth=4.0, c='k', linestyle='solid', alpha=0.4)
# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama3), ipython_widget=True) as bar:
    try:
        del gGstack
    except Exception: 
        pass
    for g in gama3:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gGrowth = (gProf['lumI1'] - g['ilum_max'])
        ax1.plot((gProf['rKpc']**0.25), gGrowth, c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gGrowth, 
                              kind='linear')
        try:
            gGrowth_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA : BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue        
        try: 
            gGstack = np.vstack((gGstack, gGrowth_intrp))
        except NameError: 
            gGstack = gGrowth_intrp
        bar.update()
     
with ProgressBar(len(bcg3), ipython_widget=True) as bar:
    try:
        del bGstack
    except Exception: 
        pass
    for b in bcg3:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bGrowth = (bProf['lumI1'] - b['ilum_max'])
        ax1.plot((bProf['rKpc']**0.25), bGrowth, c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bGrowth, 
                              kind='linear')
        try:
            bGrowth_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG : BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bGstack = np.vstack((bGstack, bGrowth_intrp))
        except NameError: 
            bGstack = bGrowth_intrp
        bar.update()

# Median & Average profiles
gGprof_med = np.nanmedian(gGstack, axis=0) 
gGprof_avg = np.nanmean(gGstack, axis=0) 
bGprof_med = np.nanmedian(bGstack, axis=0) 
bGprof_avg = np.nanmean(bGstack, axis=0) 
ax1.plot(rsma_common, gGprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gGprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bGprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bGprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.8 < \log (M_{\mathrm{SBP}}) < 12.0$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('Nomalized Curve of Growth', size=32)

ax1.set_xlim(0.5, 4.1)
ax1.set_ylim(-3.0, 0.49)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA : BAD INTERPOLATION FOR 12025



In [207]:
rsma_common = np.arange(0.4, 4.1, 0.1)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

ax1.axhline(0.00, linewidth=4.0, c='k', linestyle='solid', alpha=0.4)
# 100 Kpc
ax1.axvline(3.20, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3 ** 0.25, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4 ** 0.25, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama3), ipython_widget=True) as bar:
    try:
        del gLstack
    except Exception: 
        pass
    for g in gama3:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        gLprof = (gProf['lumI1'] + g['logm2l_i'])
        ax1.plot((gProf['rKpc']**0.25), gLprof, c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d((gProf['rKpc']**0.25), gLprof, 
                              kind='linear')
        try:
            gLprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## GAMA :BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gLstack = np.vstack((gLstack, gLprof_intrp))
        except NameError: 
            gLstack = gLprof_intrp
        bar.update()
     
with ProgressBar(len(bcg3), ipython_widget=True) as bar:
    try:
        del bLstack
    except Exception: 
        pass
    for b in bcg3:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        bLprof = (bProf['lumI1'] + b['logm2l_i'])
        ax1.plot((bProf['rKpc']**0.25), bLprof, c='orange', 
                 alpha=0.6, linewidth=2.5)
        intrpFunc = interp1d((bProf['rKpc']**0.25), bLprof, 
                              kind='linear')
        try:
            bLprof_intrp = intrpFunc(rsma_common)
        except Exception:
            print("## BCG :BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bLstack = np.vstack((bLstack, bLprof_intrp))
        except NameError: 
            bLstack = bLprof_intrp
        bar.update()

# Median & Average profiles
gLprof_med = np.nanmedian(gLstack, axis=0) 
gLprof_avg = np.nanmean(gLstack, axis=0) 
bLprof_med = np.nanmedian(bLstack, axis=0) 
bLprof_avg = np.nanmean(bLstack, axis=0) 
ax1.plot(rsma_common, gLprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(rsma_common, gLprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(rsma_common, bLprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(rsma_common, bLprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.8 < \log (M_{\mathrm{SBP}}) < 12.0$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R^{1/4}$ (Kpc)', size=32)
ax1.set_ylabel('Nomalized Curve of Growth', size=32)

ax1.set_xlim(0.5, 4.3)
ax1.set_ylim(8.5, 12.29)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA :BAD INTERPOLATION FOR 12025



In [208]:
sma_common = np.arange(0.1, 200.0, 2.0)

fig = plt.figure(figsize=(12, 12))
fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)
ax1 = fig.add_subplot(111)

# 100 Kpc
ax1.axvline(100.0, linewidth=5.0, c='k', linestyle='dashed')
# z = 0.2 : 1"=3.3 Kpc
ax1.axvline(3.3, linewidth=8.0, c='g', linestyle='dashed', alpha=0.2)
# z = 0.4 : 1"=5.4 Kpc
ax1.axvline(5.4, linewidth=8.0, c='k', linestyle='solid', alpha=0.2)

with ProgressBar(len(gama3), ipython_widget=True) as bar:
    try:
        del gMstack
    except Exception: 
        pass
    for g in gama3:
        gProf = Table.read(os.path.join(gamaDir, g['sum_tab'].replace('./', '')).strip())
        ax1.plot(gProf['rKpc'], (gProf['muI1'] + g['logm2l_i']), c='c', 
                 alpha=0.15, linewidth=1.5)
        intrpFunc = interp1d(gProf['rKpc'], (gProf['muI1'] + g['logm2l_i']), 
                             kind='linear')
        try:
            gMprof_intrp = intrpFunc(sma_common)
        except Exception:
            print("## GAMA : BAD INTERPOLATION FOR %i" % g['ISEDFIT_ID'])
            continue
        try: 
            gMstack = np.vstack((gMstack, gMprof_intrp))
        except NameError: 
            gMstack = gMprof_intrp
        bar.update()
     
with ProgressBar(len(bcg3), ipython_widget=True) as bar:
    try:
        del bMstack
    except Exception:
        pass
    for b in bcg3:
        bProf = Table.read(os.path.join(bcgDir, b['sum_tab'].replace('./', '')).strip())
        ax1.plot(bProf['rKpc'], (bProf['muI1'] + b['logm2l_i']), c='orange', 
                 alpha=0.8, linewidth=2.5)
        intrpFunc = interp1d(bProf['rKpc'], (bProf['muI1'] + b['logm2l_i']), 
                             kind='linear')
        try:
            bMprof_intrp = intrpFunc(sma_common)
        except Exception:
            print("## BCG : BAD INTERPOLATION FOR %i" % b['ID_CLUSTER'])
            continue
        try: 
            bMstack = np.vstack((bMstack, bMprof_intrp))
        except NameError: 
            bMstack = bMprof_intrp
        bar.update()

# Median & Average profiles
gMprof_med = np.nanmedian(gMstack, axis=0) 
gMprof_avg = np.nanmean(gMstack, axis=0) 
bMprof_med = np.nanmedian(bMstack, axis=0) 
bMprof_avg = np.nanmean(bMstack, axis=0) 
ax1.plot(sma_common, gMprof_med, c='b', linewidth=4.5, linestyle='-', 
         label='non-BCG Med')
ax1.plot(sma_common, gMprof_avg, c='b', linewidth=4.5, linestyle='--',
         label='non-BCG Avg')
ax1.plot(sma_common, bMprof_med, c='r', linewidth=4.5, linestyle='-',
         label='BCG Med')
ax1.plot(sma_common, bMprof_avg, c='r', linewidth=4.5, linestyle='--',
         label='BCG Avg')

ax1.text(0.30, 0.90, '$11.8 < \log (M_{\mathrm{SBP}}) < 12.0$', 
         verticalalignment='bottom', horizontalalignment='left',
         fontsize=30.0, transform=ax1.transAxes)

ax1.set_xlabel('$R$ (Kpc)', size=32)
ax1.set_ylabel('$log ({\mu}_{\star}/[M_{\odot} Kpc^{-2}])$', size=36)

ax1.set_xlim(0.2, 256.0)
ax1.set_ylim(4.4, 10.4)

for tick in ax1.xaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
for tick in ax1.yaxis.get_major_ticks():
    tick.label.set_fontsize(30) 
    
ax1.spines['top'].set_linewidth(3.5)
ax1.spines['right'].set_linewidth(3.5)
ax1.spines['bottom'].set_linewidth(3.5)
ax1.spines['left'].set_linewidth(3.5)


## GAMA : BAD INTERPOLATION FOR 12025



In [ ]: