In [2]:
from astropy.cosmology import Planck13 as cosmo
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
from astropy import units as u
Assume that the galaxy has a physical size of the order of 1kpc. We can find the angle subtended by it in a particular cosmology. If this is too small, we should not be able to resolve it.
In [3]:
l = 1.0* u.kpc
z = np.arange(0.05, 1.4, 0.1)
dA = cosmo.angular_diameter_distance(z)
angle = l/dA + np.zeros(len(z))
In [4]:
plt.plot(z, angle*180./np.pi*3600, 'o')
plt.ylabel('angular diameter (sec)')
plt.xlabel('z')
Out[4]:
I have changed the galaxy catalogs by inserting a '#' at the beginning of the header line
In [5]:
from basicio import io
from astropy.table import Table
In [6]:
import os
desdata = os.getenv('DESData')
print desdata
In [7]:
fname = os.path.join(desdata, 'SVA1GOLD','C1_SVA1GOLD_v0.cat')
print fname
rec = io.file2recarray(file=fname, headerstring='#')
In [8]:
t = Table(rec)
In [9]:
binindex = np.array(np.floor(np.asarray(t['PHOTOZ'])/0.1), dtype='i8')
uniqueinds = np.unique(binindex)
In [10]:
newcol = Table.Column(binindex, name='binindex', dtype=np.dtype('i8'))
t.add_column(newcol)
In [11]:
x = t.group_by('binindex')
In [12]:
x.groups[14]['PHOTOZ'].max()
Out[12]:
In [13]:
import pandas as pd
In [14]:
df = pd.DataFrame(rec)
In [15]:
plt.hist(x.groups[14]['A_IMAGE'], histtype='step')
plt.hist(x.groups[0]['A_IMAGE'], histtype='step')
Out[15]:
In [16]:
bins = plt.hist(x.groups[0]['A_IMAGE'], histtype='step', color='k', lw =2.0, normed=True, bins=40, label='0.0-0.1')
bins = plt.hist(x.groups[5]['A_IMAGE'], histtype='step', color='b', lw =2.0, normed=True, bins=40, label='0.5-0.6')
bins = plt.hist(x.groups[10]['A_IMAGE'], histtype='step', color='r', lw =2.0, normed=True, bins=40, label='1.0-1.1')
plt.xlabel('A_IMAGE')
plt.ylabel('PDF')
plt.legend(loc='best')
Out[16]:
Historgram of galaxy 'A_IMAGE' at three redshift bins. This is normal, showing that galaxies at small redshifts appear larger while galaxies at high redshifts look smaller.
In [17]:
bins = plt.hist(x.groups[0]['A_IMAGE'], histtype='step', color='k', lw=2.0, normed=False, bins=np.arange(0.,5.,0.1))
bins = plt.hist(x.groups[5]['A_IMAGE'], histtype='step', color='b', lw=2.0, normed=False, bins=np.arange(0.,5,0.1))
bins = plt.hist(x.groups[10]['A_IMAGE'], histtype='step', color='r', lw=2.0, normed=False, bins=np.arange(0.,5,0.1))
plt.xlabel('A_IMAGE')
plt.ylabel('numbers')
Out[17]:
So, that seems like about 0.7 arc sec is about the size of the PSF, so there is nothing at smaller sizes
In [22]:
factor = 1./3600.* np.pi /180.
x0 = factor*x.groups[0]['A_IMAGE']* cosmo.angular_diameter_distance(0.05).value
xp5 = factor*x.groups[0]['A_IMAGE']* cosmo.angular_diameter_distance(0.55).value
x1 = factor*x.groups[0]['A_IMAGE']* cosmo.angular_diameter_distance(1.05).value
In [24]:
bins = plt.hist(x0, histtype='step', color='k', lw =2.0, normed=True, bins=50)
bins = plt.hist(xp5, histtype='step', color='b', lw =1.0, normed=True, bins=50)
bins = plt.hist(x1, histtype='step', color='r', lw =2.0, normed=True, bins=50)
plt.xlabel('A_IMAGE')
plt.ylabel('PDF')
plt.xlim(0.,0.1)
Out[24]:
In [88]:
x0
Out[88]:
In [ ]: