In [1]:
import numpy as np
import pandas as pd
from astropy.table import Table
import cPickle
import matplotlib.pyplot as plt
%matplotlib inline
In [2]:
table1 = pd.read_csv("../GZ2ASSETS_NAIR_MORPH_MAIN.csv", usecols=np.arange(0,31,1))
table2 = pd.read_csv("../gz2sample.csv")
In [25]:
table2.columns
Out[25]:
In [ ]:
table3 = pd.read_csv("../missing_from_cutouts.csv", dtype='int64')
table3 = table3.rename(index=str, columns={'objid':'OBJID'})
table4 = Table.read("../SDSSmorphology_full_catalog_92415.fits").to_pandas()
In [ ]:
table4= table4.rename(index=str, columns={'objid':'OBJID'})
In [ ]:
print len(table4)
#print table4['OBJID']
#print table1[table1['name']==587730845812064684]
In [ ]:
table1['OBJID'] = table1['name'].copy()
In [ ]:
table = pd.merge(table1, table2, on='OBJID')
In [ ]:
print len(table4)
print table4.columns
In [ ]:
print table1.columns
print table4.columns
print len(table1), len(table4)
In [ ]:
test = pd.merge(table1, table4, on=['OBJID'])
In [ ]:
# What we started with - what we have after the merge
# The twelve are likely those S82 objects that snuck into the main sample :(
282350-282338
In [ ]:
test.columns
In [ ]:
plt.scatter(test.C_x, test.C_y)
plt.scatter(test.M20_x, test.M20_y)
plt.scatter(test.A_x, test.A_y)
plt.scatter(test.G_x, test.G_y)
Estimated the source density for every cutout I made by counting the number of objects in the resulting SExtractor catalog (bright run). Took this value and divided by the area of the image in arcsec (which itself was estimated as ($4\times(2\times r_{\mathrm{Petro}}))^2$)
In [ ]:
#plt.hist(table4.cat,bins=np.arange(0,9,1))
In [10]:
table2['source_density'] = table2['bright_count']/(4*2*table2['PETROR90_R'].values)**2
In [14]:
h, bins, _ = plt.hist(table2['source_density'].values, range=(0,0.0035))
In [37]:
for i in range(len(bins)-1):
objects = table2[(table2['source_density']>bins[i]) &
(table2['source_density']<bins[i+1])]
idx = np.random.choice(objects['Unnamed: 0'], size=10, replace=False, p=None)
sample = objects.loc[idx]
print sample[ 'OBJID']
In [ ]:
print "What Morphologies was I able to Measure?"
print "All GZ2:", len(table)
#print "All GZ2 (published):", len(table[''])
print "Petrosian radius:", len(table['Rp'].dropna())
print "Concentration:", len(table['C'].dropna())
print "M20:", len(table['M20'].dropna())
print "A:", len(table['A'].dropna())
print "Gini:", len(table['G'].dropna())
print "elipt:", len(table['elipt'].dropna())
In [ ]:
table[['OBJID','A']]
In [ ]:
print np.min(table['REDSHIFT']), np.max(table['REDSHIFT'])
In [ ]:
plt.hist(table['REDSHIFT_SIMPLE_BIN'], range=(0, 20))
In [ ]:
zbins = np.unique(table['REDSHIFT_SIMPLE_BIN'])[2:-1]
print zbins
In [ ]:
In [ ]:
sample = [np.random.choice(table["OBJID"][table['REDSHIFT_SIMPLE_BIN'] == n]) for n in zbins]
In [ ]:
sample
In [ ]: